Commit 0588dc12 authored by unset's avatar unset

添加意见反馈添加信息

parent dfc09604
package com.upyuns.platform.rs.website.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @ClassName : FeedbackInfoDto
* @Description : 反馈信息
* @Author : jiaoruizhen
* @Date: 2020-12-22 13:51
*/
@Data
public class FeedbackInfoDto extends PageParam {
Integer type;
Integer userId;
String keywords;
}
package com.upyuns.platform.rs.website.biz; package com.upyuns.platform.rs.website.biz;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.upyuns.platform.rs.website.dto.FeedbackInfoDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.upyuns.platform.rs.website.entity.FeedbackInfo; import com.upyuns.platform.rs.website.entity.FeedbackInfo;
import com.upyuns.platform.rs.website.mapper.FeedbackInfoMapper; import com.upyuns.platform.rs.website.mapper.FeedbackInfoMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
/** /**
* 反馈信息 * 反馈信息
...@@ -14,5 +26,44 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -14,5 +26,44 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
* @date 2020-12-22 13:38:56 * @date 2020-12-22 13:38:56
*/ */
@Service @Service
public class FeedbackInfoBiz extends BaseBiz<FeedbackInfoMapper,FeedbackInfo> { public class FeedbackInfoBiz extends BaseBiz<FeedbackInfoMapper, FeedbackInfo> {
@Autowired
UserFeign userFeign;
@Autowired
HttpServletRequest request;
public ObjectRestResponse addObj(FeedbackInfo feedbackInfo) {
if (feedbackInfo == null) {
return ObjectRestResponse.paramIsEmpty();
}
AppUserDTO appUserDTO = userFeign.userDetailByToken(request.getHeader("Authorization")).getData();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
feedbackInfo.setUserId(appUserDTO.getUserid());
insertSelectiveRe(feedbackInfo);
return ObjectRestResponse.succ();
}
public ObjectRestResponse getAll(FeedbackInfoDto feedbackInfoDto) {
Query query = new Query(feedbackInfoDto);
Example example = new Example(FeedbackInfo.class);
Example.Criteria criteria = example.createCriteria();
if (feedbackInfoDto.getType() != null) {
criteria.andEqualTo("type", feedbackInfoDto.getType());
}
if (feedbackInfoDto.getUserId() != null) {
criteria.andEqualTo("userId", feedbackInfoDto.getUserId());
}
if (StringUtils.isNotBlank(feedbackInfoDto.getKeywords())) {
criteria.andLike("name", "%" + feedbackInfoDto.getKeywords() + "%")
.orLike("phone", "%" + feedbackInfoDto.getKeywords() + "%");
}
PageDataVO<FeedbackInfo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectByExample(example));
return ObjectRestResponse.succ(pageDataVO);
}
} }
\ No newline at end of file
package com.upyuns.platform.rs.website.controller; package com.upyuns.platform.rs.website.controller;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.upyuns.platform.rs.website.biz.FeedbackInfoBiz; import com.upyuns.platform.rs.website.biz.FeedbackInfoBiz;
import com.upyuns.platform.rs.website.dto.FeedbackInfoDto;
import com.upyuns.platform.rs.website.entity.FeedbackInfo; import com.upyuns.platform.rs.website.entity.FeedbackInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("feedbackInfo") @RequestMapping("feedbackInfo")
public class FeedbackInfoController extends BaseController<FeedbackInfoBiz,FeedbackInfo> { public class FeedbackInfoController extends BaseController<FeedbackInfoBiz, FeedbackInfo> {
@GetMapping(value = "getAll")
public ObjectRestResponse getAll(FeedbackInfoDto feedbackInfoDto) {
return baseBiz.getAll(feedbackInfoDto);
}
} }
\ No newline at end of file
package com.upyuns.platform.rs.website.controller.web; package com.upyuns.platform.rs.website.controller.web;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.upyuns.platform.rs.website.biz.FeedbackInfoBiz; import com.upyuns.platform.rs.website.biz.FeedbackInfoBiz;
import com.upyuns.platform.rs.website.entity.FeedbackInfo; import com.upyuns.platform.rs.website.entity.FeedbackInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -10,4 +13,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,4 +13,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("feedbackInfo/web") @RequestMapping("feedbackInfo/web")
public class FeedbackInfoWebController extends BaseController<FeedbackInfoBiz,FeedbackInfo> { public class FeedbackInfoWebController extends BaseController<FeedbackInfoBiz,FeedbackInfo> {
@PostMapping(value = "addObj")
public ObjectRestResponse addObj(@RequestBody FeedbackInfo feedbackInfo) {
return baseBiz.addObj(feedbackInfo);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment