diff --git a/attendance-performance-manager/src/main/java/com/mortals/xhx/module/feedback/web/FeedbackController.java b/attendance-performance-manager/src/main/java/com/mortals/xhx/module/feedback/web/FeedbackController.java index 2e236b9a16369ace9151c1c2005eb1e1fbce1ed0..7324a54c00c0c6c250f06f626b8faf7c09988b23 100644 --- a/attendance-performance-manager/src/main/java/com/mortals/xhx/module/feedback/web/FeedbackController.java +++ b/attendance-performance-manager/src/main/java/com/mortals/xhx/module/feedback/web/FeedbackController.java @@ -1,4 +1,5 @@ package com.mortals.xhx.module.feedback.web; + import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.common.Rest; import com.mortals.framework.exception.AppException; @@ -19,8 +20,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import com.mortals.framework.model.Context; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.xhx.module.feedback.service.FeedbackService; import org.apache.commons.lang3.ArrayUtils; @@ -28,20 +31,22 @@ import com.mortals.framework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; + import com.alibaba.fastjson.JSONObject; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; + import static com.mortals.framework.ap.SysConstains.*; + /** -* -* 缁╂晥鍙嶉璁板綍淇℃伅 -* -* @author zxfei -* @date 2023-07-05 -*/ + * 缁╂晥鍙嶉璁板綍淇℃伅 + * + * @author zxfei + * @date 2023-07-05 + */ @RestController @RequestMapping("feedback") -public class FeedbackController extends BaseCRUDJsonBodyMappingController<FeedbackService,FeedbackEntity,Long> { +public class FeedbackController extends BaseCRUDJsonBodyMappingController<FeedbackService, FeedbackEntity, Long> { @Autowired private ParamService paramService; @@ -52,41 +57,43 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba @Autowired private FeedbackAnswerService feedbackAnswerService; - public FeedbackController(){ - super.setModuleDesc( "缁╂晥鍙嶉璁板綍淇℃伅"); + public FeedbackController() { + super.setModuleDesc("缁╂晥鍙嶉璁板綍淇℃伅"); } @Override protected void init(Map<String, Object> model, Context context) { - Map<String,String> backStatus = new HashMap<>(); - backStatus.put("0","鏈弽棣�"); - backStatus.put("1","宸插弽棣�"); - this.addDict(model, "processStatus", paramService.getParamBySecondOrganize("Feedback","processStatus")); - this.addDict(model, "weblink", paramService.getParamBySecondOrganize("Feedback","weblink")); + Map<String, String> backStatus = new HashMap<>(); + backStatus.put("0", "鏈弽棣�"); + backStatus.put("1", "宸插弽棣�"); + this.addDict(model, "processStatus", paramService.getParamBySecondOrganize("Feedback", "processStatus")); + this.addDict(model, "weblink", paramService.getParamBySecondOrganize("Feedback", "weblink")); this.addDict(model, "backStatus", backStatus); super.init(model, context); } @Override protected int infoAfter(Long id, Map<String, Object> model, FeedbackEntity entity, Context context) throws AppException { - if(CollectionUtils.isNotEmpty(entity.getFeedbackQuestionList())){ - for(FeedbackQuestionEntity item:entity.getFeedbackQuestionList()){ + if (CollectionUtils.isNotEmpty(entity.getFeedbackQuestionList())) { + for (FeedbackQuestionEntity item : entity.getFeedbackQuestionList()) { List<FeedbackOptionEntity> optionEntities = feedbackOptionService.find(new FeedbackOptionQuery().questionId(item.getId())); item.setFeedbackOptionList(optionEntities); } } - List<FeedbackAnswerEntity> feedbackAnswerEntities = feedbackAnswerService.find(new FeedbackAnswerQuery().feedbackId(entity.getFeedbackId())); - if(!ObjectUtils.isEmpty(feedbackAnswerEntities)){ - entity.setFeedbackAnswerList(feedbackAnswerEntities); + if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) { + List<FeedbackAnswerEntity> feedbackAnswerEntities = feedbackAnswerService.find(new FeedbackAnswerQuery().feedbackId(entity.getFeedbackId()).staffId(context.getUser().getCustomerId())); + if (!ObjectUtils.isEmpty(feedbackAnswerEntities)) { + entity.setFeedbackAnswerList(feedbackAnswerEntities); + } } - return super.infoAfter(id, model, entity, context); } /** * 鏌ヨ闂嵎鍙嶉浜哄憳鍒楄〃 + * * @param query * @return */ @@ -98,23 +105,23 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba Context context = this.getContext(); String busiDesc = "鏌ヨ闂嵎鍙嶉浜哄憳鍒楄〃"; - int code=1; + int code = 1; try { PageInfo pageInfo = this.buildPageInfo(query); - Result<FeedbackStaffInfoVo> result = this.getService().getFeedbackStaffList(query,pageInfo); - if(CollectionUtils.isNotEmpty(result.getList())) { + Result<FeedbackStaffInfoVo> result = this.getService().getFeedbackStaffList(query, pageInfo); + if (CollectionUtils.isNotEmpty(result.getList())) { Map<Integer, List<FeedbackStaffInfoVo>> groupMap = result.getList().stream().collect(Collectors.groupingBy(FeedbackStaffInfoVo::getBackStatus)); - if(groupMap.containsKey(1)) { + if (groupMap.containsKey(1)) { model.put("feedBack", groupMap.get(1).size()); - }else { + } else { model.put("feedBack", 0); } - if(groupMap.containsKey(0)) { + if (groupMap.containsKey(0)) { model.put("notBack", groupMap.get(0).size()); - }else { + } else { model.put("notBack", 0); } - }else { + } else { model.put("feedBack", 0); model.put("notBack", 0); } @@ -138,10 +145,11 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba /** * 闂嵎鍗曢€夊閫夊弽棣堢粺璁� + * * @param feedbackId * @return */ - @RequestMapping(value = {"getOptionSummaryList"},method = {RequestMethod.POST, RequestMethod.GET}) + @RequestMapping(value = {"getOptionSummaryList"}, method = {RequestMethod.POST, RequestMethod.GET}) @UnAuth public Rest<Object> getOptionSummaryList(Long feedbackId) { Rest<Object> ret = new Rest(); @@ -149,11 +157,11 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba Context context = this.getContext(); String busiDesc = "鏌ヨ闂嵎鍗曢€夊閫夊弽棣堢粺璁�"; - int code=1; + int code = 1; try { List<OptionSummaryVo> result = this.getService().getOptionSummaryList(feedbackId); List<OptionSummaryVo> list = new ArrayList<>(); - if(CollectionUtils.isNotEmpty(result)) { + if (CollectionUtils.isNotEmpty(result)) { Map<Long, List<OptionSummaryVo>> groupMap = result.stream().collect(Collectors.groupingBy(OptionSummaryVo::getQuestionId)); for (Long key : groupMap.keySet()) { OptionSummaryVo vo = new OptionSummaryVo(); @@ -185,6 +193,7 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba /** * 闂嵎闂鍙嶉璇︽儏 + * * @param query * @return */ @@ -222,6 +231,7 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba /** * 鍙嶉璁板綍鏁翠綋鎯呭喌缁熻 + * * @return */ @PostMapping({"summary"}) @@ -234,7 +244,7 @@ public class FeedbackController extends BaseCRUDJsonBodyMappingController<Feedba int code = 1; try { - Map<String,Integer> result = this.getService().summaryFeedback(); + Map<String, Integer> result = this.getService().summaryFeedback(); model.put("data", result); model.put("message_info", busiDesc + "鎴愬姛"); if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) { diff --git a/attendance-performance-manager/src/main/resources/sqlmap/module/check/CheckAllRecordMapper.xml b/attendance-performance-manager/src/main/resources/sqlmap/module/check/CheckAllRecordMapper.xml index 22e0b42672ddfe37e37b01dae022d92ed52abf4b..44984c9f6e5c3a4d7b816a3c4b9f55cfbe449fd0 100644 --- a/attendance-performance-manager/src/main/resources/sqlmap/module/check/CheckAllRecordMapper.xml +++ b/attendance-performance-manager/src/main/resources/sqlmap/module/check/CheckAllRecordMapper.xml @@ -5,7 +5,7 @@ <select id="getList" parameterType="com.mortals.xhx.module.check.model.CheckAllRecordQuery" resultType="com.mortals.xhx.module.check.model.vo.CheckAllRecordVo"> SELECT * FROM ( - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -14,7 +14,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,4 AS checkType ,'effect' AS performType FROM mortals_xhx_check_effect_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,deductTime,4 AS checkType ,'effect' AS performType FROM mortals_xhx_check_effect_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -23,7 +23,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,6 AS checkType ,'complain' AS performType FROM mortals_xhx_check_complain_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,6 AS checkType ,'complain' AS performType FROM mortals_xhx_check_complain_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -32,7 +32,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName, subAddType,score,subMethod,checkTime,createTime AS deductTime,3 AS checkType ,'gowork' AS performType FROM mortals_xhx_check_gowork_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName, subAddType,score,subMethod,checkTime, deductTime,3 AS checkType ,'gowork' AS performType FROM mortals_xhx_check_gowork_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -41,7 +41,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,2 AS checkType ,'review' AS performType FROM mortals_xhx_check_review_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,2 AS checkType ,'review' AS performType FROM mortals_xhx_check_review_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -50,7 +50,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,5 AS checkType ,'other' AS performType FROM mortals_xhx_check_other_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,5 AS checkType ,'other' AS performType FROM mortals_xhx_check_other_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -63,7 +63,7 @@ <select id="getListCount" parameterType="com.mortals.xhx.module.check.model.CheckAllRecordQuery" resultType="int"> SELECT count(1) FROM ( - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -72,7 +72,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,4 AS checkType ,'effect' AS performType FROM mortals_xhx_check_effect_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,4 AS checkType ,'effect' AS performType FROM mortals_xhx_check_effect_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -81,7 +81,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,6 AS checkType ,'complain' AS performType FROM mortals_xhx_check_complain_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,deductTime,6 AS checkType ,'complain' AS performType FROM mortals_xhx_check_complain_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -90,7 +90,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,3 AS checkType ,'gowork' AS performType FROM mortals_xhx_check_gowork_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,3 AS checkType ,'gowork' AS performType FROM mortals_xhx_check_gowork_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -99,7 +99,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName, subAddType,score,subMethod,checkTime,createTime AS deductTime,2 AS checkType ,'review' AS performType FROM mortals_xhx_check_review_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName, subAddType,score,subMethod,checkTime, deductTime,2 AS checkType ,'review' AS performType FROM mortals_xhx_check_review_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if> @@ -108,7 +108,7 @@ <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> UNION - SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,5 AS checkType ,'other' AS performType FROM mortals_xhx_check_other_record WHERE 1=1 + SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime, deductTime,5 AS checkType ,'other' AS performType FROM mortals_xhx_check_other_record WHERE 1=1 <if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if> <if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if> <if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>