From e016b340f5075a8bd5904c156b48c2b6793a7bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <8153694@qq.com> Date: Thu, 13 Jul 2023 19:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=B3=E8=AF=89=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mortals/xhx/busiz/BaseReq.java | 2 - .../mortals/xhx/busiz/req/InspectSaveReq.java | 105 +++++++ .../xhx/busiz/web/FeedbackApiController.java | 2 + .../xhx/busiz/web/InspectApiController.java | 291 ++++++++++++------ 4 files changed, 312 insertions(+), 88 deletions(-) diff --git a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/BaseReq.java b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/BaseReq.java index 3f972134..452a346b 100644 --- a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/BaseReq.java +++ b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/BaseReq.java @@ -21,8 +21,6 @@ public abstract class BaseReq implements Serializable { - - /** * 宸ュ彿 */ diff --git a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/InspectSaveReq.java b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/InspectSaveReq.java index 1dc1e3bd..8bdf199b 100644 --- a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/InspectSaveReq.java +++ b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/req/InspectSaveReq.java @@ -9,6 +9,7 @@ import java.util.Date; @Data public class InspectSaveReq extends BaseReq { + //鑰冨嫟 /** * 鎵€灞炶€冨嫟缁処D */ @@ -42,8 +43,112 @@ public class InspectSaveReq extends BaseReq { */ private String errorResult; +//璇勪环 + /** + * 璇勪环缁撴灉(1.闈炲父涓嶆弧鎰�,2.宸瘎) + */ + private Integer reviewResult; + /** + * 璇勪环鏃堕棿 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date reviewTime; + /** + * 璇勪环鏉ユ簮(绐楀彛璇勪环绯荤粺,瀵艰绯荤粺,鑷姪鏈嶅姟绯荤粺,寰畼缃�,鍏跺畠) + */ + private String reviewSource; + /** + * 璇勪环璁惧 + */ + private String reviewDevice; + + //鎶曡瘔 + + /** + * 鎶曡瘔鏍囬 + */ + private String complainTitle; + /** + * 鎶曡瘔鍐呭 + */ + private String complainContent; + /** + * 鎶曡瘔浜虹湡瀹炲鍚� + */ + private String complainRealName; + /** + * 鑱旂郴鐢佃瘽 + */ + private String contact; + /** + * 鎶曡瘔鏃堕棿 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date complainTime; + /** + * 鎶曡瘔鏉ユ簮 + */ + private String complainSource; + /** + * 鎶曡瘔璁惧 + */ + private String complainDevice; + //鍔炰欢 + /** + * 鍔炰欢缂栫爜 + */ + private String goworkCode; + /** + * 鍔炰欢鎵€灞為儴闂� + */ + private String goworkDepts; + /** + * 浜嬮」鍚嶇О + */ + private String matterlName; + /** + * 鍔炵悊鏃堕棿 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date goworkTime; + + + //鏁堣兘 + + /** + * 杩濊绫诲瀷(1.鑴卞矖,2.绂诲矖,3.鐜╂墜鏈�,4.鐫¤) + */ + private Integer irregularType; + /** + * 鍙戠敓鏃堕棿 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date happenTime; + /** + * 鎸佺画鏃堕棿锛岀 + */ + private Integer duration; + /** + * 鎶ヨ鏃堕棿 + */ + private Date alarmTime; + + //鍏跺畠 + /** + * 杩濊绫诲瀷(1.宸ヤ綔绾緥) + */ + private Integer irregularOtherType; +// /** +// * 鍙戠敓鏃堕棿 +// */ +// @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") +// private Date happenTime; + /** + * 璇勫垎鏍囧噯 + */ + private String ruleDesc; } diff --git a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/FeedbackApiController.java b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/FeedbackApiController.java index c3797ea9..5ac0983b 100644 --- a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/FeedbackApiController.java +++ b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/FeedbackApiController.java @@ -105,6 +105,8 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> { model.put(PAGEINFO_KEY, pageAllInfo); parsePageInfo(model, pageAllInfo); + rest.setData(model); + recordSysLog(request, busiDesc + " 銆愭垚鍔熴€�"); } catch (Exception e) { log.error(busiDesc, e); diff --git a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/InspectApiController.java b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/InspectApiController.java index b5c3155e..97b0b597 100644 --- a/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/InspectApiController.java +++ b/attendance-performance-manager/src/main/java/com/mortals/xhx/busiz/web/InspectApiController.java @@ -7,17 +7,18 @@ import com.mortals.framework.exception.AppException; import com.mortals.framework.model.Context; import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.Result; -import com.mortals.xhx.busiz.req.AppealReq; -import com.mortals.xhx.busiz.req.PerformReq; +import com.mortals.xhx.busiz.req.*; import com.mortals.xhx.busiz.rsp.AppealStatInfo; import com.mortals.xhx.common.code.PerformTypeEnum; import com.mortals.xhx.common.code.ProcessStatusEnum; import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.module.check.model.*; import com.mortals.xhx.module.check.service.*; -import com.mortals.xhx.module.perform.model.PerformAttendAppealEntity; -import com.mortals.xhx.module.perform.model.PerformAttendAppealQuery; -import com.mortals.xhx.module.perform.service.PerformAttendAppealService; +import com.mortals.xhx.module.perform.model.*; +import com.mortals.xhx.module.perform.service.*; +import com.mortals.xhx.module.staff.model.StaffEntity; +import com.mortals.xhx.module.staff.model.StaffQuery; +import com.mortals.xhx.module.staff.service.StaffService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -47,107 +48,64 @@ import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT; @RequestMapping("/api/v1/inspect") public class InspectApiController extends AbstractBaseController<PerformReq> { + + + @Autowired - private CheckAttendRecordService checkAttendRecordService; + private PerformAttendRecordService attendRecordService; @Autowired - private CheckReviewRecordService checkReviewRecordService; + private PerformReviewRecordService reviewRecordService; @Autowired - private CheckComplainRecordService checkComplainRecordService; + private PerformComplainRecordService complainRecordService; @Autowired - private CheckEffectRecordService checkEffectRecordService; + private PerformGoworkRecordService performGoworkRecordService; @Autowired - private CheckGoworkRecordService checkGoworkRecordService; + private PerformEffectRecordService effectRecordService; @Autowired - private CheckOtherRecordService checkOtherRecordService; - - + private PerformOtherRecordService otherRecordService; @Autowired - private PerformAttendAppealService appealService; - - - /** - * 涓汉鐢宠瘔缁╂晥缁熻 - */ - @PostMapping(value = "stat") - public Rest<AppealStatInfo> appealStat() { - String busiDesc = "H5涓汉鐢宠瘔缁╂晥缁熻"; - Rest<AppealStatInfo> rest = Rest.ok(busiDesc + " 銆愭垚鍔熴€�"); - Context context = this.getContext(); - if (ObjectUtils.isEmpty(context) || ObjectUtils.isEmpty(context.getUser())) { - throw new AppException(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT); - } - log.info("銆恵}銆戙€愯姹備綋銆�--> 鐢ㄦ埛:{}", busiDesc, context.getUser().getRealName()); - try { - //todo 鏌ヨ褰撳墠鐧诲綍浜虹殑缁╂晥鍒嗘暟 - AppealStatInfo appealStatInfo = new AppealStatInfo(); - appealStatInfo.setTotalScore(new BigDecimal("10.52")); - appealStatInfo.setTotalTimes(12); - appealStatInfo.setTodayScore(new BigDecimal("2.5")); - appealStatInfo.setTodayTimes(3); - rest.setData(appealStatInfo); - recordSysLog(request, busiDesc + " 銆愭垚鍔熴€�"); - } catch (Exception e) { - log.error(busiDesc, e); - rest = Rest.fail(super.convertException(e)); - } - return rest; - } + private PerformRulesService rulesService; + @Autowired + private StaffService staffService; /** * 宸℃煡鏂板 */ @PostMapping(value = "save") - public Rest<PerformAttendAppealEntity> appealSave(@RequestBody AppealReq req) { - String busiDesc = "涓汉鐢宠瘔鏂板"; + public Rest<PerformAttendAppealEntity> appealSave(@RequestBody InspectSaveReq req) { + String busiDesc = "涓汉宸℃煡璁板綍鏂板"; log.info("銆恵}銆戙€愯姹備綋銆�--> {}", busiDesc, JSONObject.toJSONString(req)); Rest<PerformAttendAppealEntity> rest = Rest.ok(busiDesc + " 銆愭垚鍔熴€�"); Context context = this.getContext(); try { //鏍规嵁鐘舵€� 鏌ヨ 褰撳墠鏄惁宸茬粡瀛樺湪姝e湪杩涜鐨勭敵璇� - if (ObjectUtils.isEmpty(req.getId())) throw new AppException("鏍告煡璁板綍Id涓嶈兘涓虹┖锛�"); if (ObjectUtils.isEmpty(req.getPerformType())) throw new AppException("缁╂晥绫诲瀷涓嶈兘涓虹┖锛�"); - //鏌ヨ褰撳墠鏍告煡鏄惁宸插瓨鍦ㄨ繘琛屼腑鐨勭敵璇夎褰� - PerformAttendAppealEntity appealEntity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(req.getId())); - if (!ObjectUtils.isEmpty(appealEntity) && appealEntity.getProcessStatus() == ProcessStatusEnum.鏈鐞�.getValue()) { - throw new AppException("褰撳墠缁╂晥鏍告煡宸茬粡瀛樺湪姝e湪杩涜涓殑鐢宠瘔璁板綍锛�"); - } - PerformAttendAppealEntity entity = new PerformAttendAppealEntity(); - entity.initAttrValue(); + if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("鎵嬫満鍙风爜涓嶈兘涓虹┖锛�"); + if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("缁╂晥瑙勫垯缂栫爜涓嶈兘涓虹┖锛�"); - if (PerformTypeEnum.鑰冨嫟缁╂晥.getValue().equals(req.getPerformType())) { - CheckAttendRecordEntity checkEntity = checkAttendRecordService.get(req.getId(), context); - BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); + if (PerformTypeEnum.鑰冨嫟缁╂晥.getValue().equals(req.getPerformType())) { + boolean bool = attend(req); + if (!bool) throw new AppException(busiDesc + "澶辫触锛�"); } else if (PerformTypeEnum.璇勪环宸瘎缁╂晥.getValue().equals(req.getPerformType())) { - CheckReviewRecordEntity checkEntity = checkReviewRecordService.get(req.getId(), context); - BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); - + boolean bool = review(req); + if (!bool) throw new AppException(busiDesc + "澶辫触锛�"); } else if (PerformTypeEnum.璇勪环鎶曡瘔缁╂晥.getValue().equals(req.getPerformType())) { - CheckComplainRecordEntity checkEntity = checkComplainRecordService.get(req.getId(), context); - BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); - + boolean bool = complain(req); + if (!bool) throw new AppException(busiDesc + "澶辫触锛�"); } else if (PerformTypeEnum.鍔炰欢缁╂晥.getValue().equals(req.getPerformType())) { - CheckGoworkRecordEntity checkEntity = checkGoworkRecordService.get(req.getId(), context); - BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); - + boolean bool = gowork(req); + if (!bool) throw new AppException(busiDesc + "澶辫触锛�"); } else if (PerformTypeEnum.鏁堣兘缁╂晥.getValue().equals(req.getPerformType())) { - CheckEffectRecordEntity checkEntity = checkEffectRecordService.get(req.getId(), context); - BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); - + boolean bool = effect(req); + if (!bool) throw new AppException(busiDesc + "澶辫触锛�"); } else if (PerformTypeEnum.鍏跺畠缁╂晥.getValue().equals(req.getPerformType())) { - CheckOtherRecordEntity checkEntity = checkOtherRecordService.get(req.getId(), context); - BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); - + boolean bool = other(req); + if (!bool) throw new AppException(busiDesc + "澶辫触锛�"); } else { throw new AppException("涓嶆敮鎸佸綋鍓嶇哗鏁堢被鍨�"); } - entity.setPerformType(req.getPerformType()); - entity.setPerformAttendAppealFilesList(req.getPerformAttendAppealFilesList()); - entity.setProcessStatus(1); - entity.setAppealDesc(req.getAppealDesc()); - PerformAttendAppealEntity saveEntity = appealService.save(entity, context); - rest.setData(saveEntity); recordSysLog(request, busiDesc + " 銆愭垚鍔熴€�"); } catch (Exception e) { log.error(busiDesc, e); @@ -158,20 +116,181 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { } - protected PageInfo buildPageInfo(AppealReq query) { - PageInfo pageInfo = new PageInfo(); - if (!ObjectUtils.isEmpty(query) && !ObjectUtils.isEmpty(query.getPage())) { - pageInfo.setCurrPage(query.getPage()); - } - if (!ObjectUtils.isEmpty(query) && !ObjectUtils.isEmpty(query.getSize())) { - pageInfo.setPrePageResult(query.getSize()); - } - return pageInfo; + + private boolean attend(InspectSaveReq req) throws AppException { + //鑰冨嫟淇濆瓨 + //閫氳繃鎵嬫満鍙风爜鏌ヨ鍛樺伐灞炴€� + PerformRulesEntity rule = getRule(req.getRuleCode()); + StaffEntity staffEntity = getStaff(req.getPhone()); + + PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity(); + recordEntity.initAttrValue(); + BeanUtils.copyProperties(req, recordEntity); + recordEntity.setStaffId(staffEntity.getId()); + recordEntity.setStaffName(staffEntity.getName()); + + + recordEntity.setSubAddType(rule.getSubAddType()); + recordEntity.setScore(rule.getScore()); + recordEntity.setRuleId(rule.getId()); + recordEntity.setRuleNme(rule.getName()); + recordEntity.setCategoryId(rule.getCategoryId()); + recordEntity.setCategoryName(rule.getCategoryName()); + + recordEntity.setCreateUserId(1L); + recordEntity.setCreateTime(new Date()); + PerformAttendRecordEntity save = attendRecordService.save(recordEntity); + + return save.newEntity(); + } + private boolean review(InspectSaveReq req) throws AppException { + //璇勪环淇濆瓨 + StaffEntity staffEntity = getStaff(req.getPhone()); + PerformRulesEntity rule = getRule(req.getRuleCode()); + + PerformReviewRecordEntity recordEntity = new PerformReviewRecordEntity(); + + recordEntity.initAttrValue(); + BeanUtils.copyProperties(req, recordEntity); + recordEntity.setStaffId(staffEntity.getId()); + recordEntity.setStaffName(staffEntity.getName()); + recordEntity.setSubAddType(rule.getSubAddType()); + recordEntity.setScore(rule.getScore()); + recordEntity.setRuleId(rule.getId()); + recordEntity.setRuleName(rule.getName()); + recordEntity.setCategoryId(rule.getCategoryId()); + recordEntity.setCategoryName(rule.getCategoryName()); + + recordEntity.setCreateUserId(1L); + recordEntity.setCreateTime(new Date()); + PerformReviewRecordEntity save = reviewRecordService.save(recordEntity); + return save.newEntity(); + + } + + private boolean complain(InspectSaveReq req) throws AppException { + //鎶曡瘔淇濆瓨 + StaffEntity staffEntity = getStaff(req.getPhone()); + PerformRulesEntity rule = getRule(req.getRuleCode()); + + PerformComplainRecordEntity recordEntity = new PerformComplainRecordEntity(); + + recordEntity.initAttrValue(); + BeanUtils.copyProperties(req, recordEntity); + recordEntity.setStaffId(staffEntity.getId()); + recordEntity.setStaffName(staffEntity.getName()); + recordEntity.setSubAddType(rule.getSubAddType()); + recordEntity.setScore(rule.getScore()); + recordEntity.setRuleId(rule.getId()); + recordEntity.setRuleName(rule.getName()); + recordEntity.setCategoryId(rule.getCategoryId()); + recordEntity.setCategoryName(rule.getCategoryName()); + + recordEntity.setCreateUserId(1L); + recordEntity.setCreateTime(new Date()); + PerformComplainRecordEntity save = complainRecordService.save(recordEntity); + return save.newEntity(); + + } + + private boolean gowork(InspectSaveReq req) throws AppException { + //鍔炰欢淇濆瓨 + StaffEntity staffEntity = getStaff(req.getPhone()); + PerformRulesEntity rule = getRule(req.getRuleCode()); + + PerformGoworkRecordEntity recordEntity = new PerformGoworkRecordEntity(); + + recordEntity.initAttrValue(); + BeanUtils.copyProperties(req, recordEntity); + recordEntity.setStaffId(staffEntity.getId()); + recordEntity.setStaffName(staffEntity.getName()); + recordEntity.setSubAddType(rule.getSubAddType()); + recordEntity.setScore(rule.getScore()); + recordEntity.setRuleId(rule.getId()); + recordEntity.setRuleName(rule.getName()); + recordEntity.setCategoryId(rule.getCategoryId()); + recordEntity.setCategoryName(rule.getCategoryName()); + + recordEntity.setCreateUserId(1L); + recordEntity.setCreateTime(new Date()); + PerformGoworkRecordEntity save = performGoworkRecordService.save(recordEntity); + return save.newEntity(); + + } + + private boolean effect(InspectSaveReq req) throws AppException { + //鏁堣兘淇濆瓨 + StaffEntity staffEntity = getStaff(req.getPhone()); + PerformRulesEntity rule = getRule(req.getRuleCode()); + + PerformEffectRecordEntity recordEntity = new PerformEffectRecordEntity(); + + recordEntity.initAttrValue(); + BeanUtils.copyProperties(req, recordEntity); + recordEntity.setStaffId(staffEntity.getId()); + recordEntity.setStaffName(staffEntity.getName()); + recordEntity.setSubAddType(rule.getSubAddType()); + recordEntity.setScore(rule.getScore()); + recordEntity.setRuleId(rule.getId()); + recordEntity.setRuleName(rule.getName()); + recordEntity.setCategoryId(rule.getCategoryId()); + recordEntity.setCategoryName(rule.getCategoryName()); + + recordEntity.setCreateUserId(1L); + recordEntity.setCreateTime(new Date()); + PerformEffectRecordEntity save = effectRecordService.save(recordEntity); + return save.newEntity(); + } + + private boolean other(InspectSaveReq req) throws AppException { + //鍏跺畠淇濆瓨 + + StaffEntity staffEntity = getStaff(req.getPhone()); + PerformRulesEntity rule = getRule(req.getRuleCode()); + + PerformOtherRecordEntity recordEntity = new PerformOtherRecordEntity(); + + recordEntity.initAttrValue(); + BeanUtils.copyProperties(req, recordEntity); + recordEntity.setStaffId(staffEntity.getId()); + recordEntity.setStaffName(staffEntity.getName()); + recordEntity.setSubAddType(rule.getSubAddType()); + recordEntity.setScore(rule.getScore()); + recordEntity.setRuleId(rule.getId()); + recordEntity.setRuleName(rule.getName()); + recordEntity.setCategoryId(rule.getCategoryId()); + recordEntity.setCategoryName(rule.getCategoryName()); + + recordEntity.setCreateUserId(1L); + recordEntity.setCreateTime(new Date()); + PerformOtherRecordEntity save = otherRecordService.save(recordEntity); + return save.newEntity(); + } + + + private PerformRulesEntity getRule(String ruleCode) { + PerformRulesEntity rule = rulesService.getCache(ruleCode); + if (ObjectUtils.isEmpty(rule)) + throw new AppException(String.format("褰撳墠鎵嬫満鍙风爜鏈壘鍒板尮閰嶇殑鍛樺伐锛乺ule:%s", ruleCode)); + + return rule; + } + + private StaffEntity getStaff(String phone) { + StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(phone)); + if (ObjectUtils.isEmpty(staffEntity)) + throw new AppException(String.format("褰撳墠鎵嬫満鍙风爜鏈壘鍒板尮閰嶇殑鍛樺伐锛乸hone:%s", phone)); + + return staffEntity; + } + + + protected void parsePageInfo(Map<String, Object> model, PageInfo pageInfo) { model.put(TOTAL, pageInfo.getTotalResult()); model.put(PER_PAGE, pageInfo.getPrePageResult()); -- 2.24.3