From 7ee867936786bc685c26acd88c739f6eb58c32b9 Mon Sep 17 00:00:00 2001 From: Andru <769883346@qq.com> Date: 星期五, 22 十二月 2023 15:07:26 +0800 Subject: [PATCH] 添加撤销划扣发送消息给护士长 --- phi_platform_user/src/main/java/com/hx/phip/service/deduction/DeductionSingleService.java | 2 + phi_platform_user/src/main/java/com/hx/phip/controller/deduction/DeductionController.java | 5 +- phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 97 insertions(+), 7 deletions(-) diff --git a/phi_platform_user/src/main/java/com/hx/phip/controller/deduction/DeductionController.java b/phi_platform_user/src/main/java/com/hx/phip/controller/deduction/DeductionController.java index c0bb486..967996c 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/controller/deduction/DeductionController.java +++ b/phi_platform_user/src/main/java/com/hx/phip/controller/deduction/DeductionController.java @@ -8,16 +8,13 @@ import com.hx.phiappt.common.DeductionSingleConstants; import com.hx.phiappt.constants.tool.PerformanceInfoTool; import com.hx.phiappt.constants.tool.user.UserProjectTool; -import com.hx.phiappt.dao.mapper.IntroProjectManualMapper; import com.hx.phiappt.dao.mapper.NotificationLogMapper; import com.hx.phiappt.dao.mapper.ProjectMapper; import com.hx.phiappt.model.*; import com.hx.phiappt.model.deduction.*; import com.hx.phiappt.model.intro.IntroProjectManual; import com.hx.phiappt.model.performance.PerformanceInfo; -import com.hx.phiappt.model.project.ProjectGeneral; import com.hx.phip.config.CustomParameter; -import com.hx.phip.dao.mapper.ProjectGeneralMapper; import com.hx.phip.dao.mapper.ShopMapper; import com.hx.phip.dao.mapper.UserMapper; import com.hx.phip.service.ComparePhotoRecordPicturesService; @@ -424,6 +421,8 @@ threadPool.getThreadPool().execute(() -> deductionSingleService.autoTag(deductionDto.getDeductionSingleId())); // 淇濆Ε閫備勘涔愰儴鎾ゅ洖璧犻�佷紭鎯犲埜 threadPool.getThreadPool().execute(() -> deductionSingleService.cancelDeductionSingleCoupon(deductionDto.getDeductionSingleId())); + // 浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱 + threadPool.getThreadPool().execute(() -> deductionSingleService.cancelDeductionSingleSentNotice(deductionDto.getDeductionSingleId())); // 杩斿洖 return Result.success(); } diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/deduction/DeductionSingleService.java b/phi_platform_user/src/main/java/com/hx/phip/service/deduction/DeductionSingleService.java index 9c72816..f61760f 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/service/deduction/DeductionSingleService.java +++ b/phi_platform_user/src/main/java/com/hx/phip/service/deduction/DeductionSingleService.java @@ -63,4 +63,6 @@ //浣滃簾鍒掓墸鎾ら攢淇濆Ε閫備勘涔愰儴鏉冪泭璧犻�佺殑浼樻儬鍒� void cancelDeductionSingleCoupon(String deductionSingleId); + + void cancelDeductionSingleSentNotice(String deductionSingleId); } diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java index b7473cd..02d01b3 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java +++ b/phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java @@ -4,14 +4,14 @@ import com.alibaba.fastjson.JSONObject; import com.hx.common.service.CommonService; import com.hx.exception.TipsException; +import com.hx.guide.model.VisitOrder; +import com.hx.guide.util.corp.messages.SendMessageToolV2; import com.hx.mybatisTool.SqlSentence; import com.hx.phiappt.common.*; import com.hx.phiappt.constants.enums.WarehouseTypeEnum; -import com.hx.phiappt.constants.tool.CouponTool; -import com.hx.phiappt.constants.tool.PerformanceInfoTool; -import com.hx.phiappt.constants.tool.UserInfoTool; -import com.hx.phiappt.constants.tool.UserStatusTool; +import com.hx.phiappt.constants.tool.*; import com.hx.phiappt.constants.tool.appointment.AppointmentTool; +import com.hx.phiappt.constants.tool.employee.EmployeeTool; import com.hx.phiappt.constants.tool.user.UserLabelTool; import com.hx.phiappt.constants.tool.user.UserLevelTool; import com.hx.phiappt.dao.mapper.ProjectTypeMapper; @@ -39,6 +39,8 @@ import com.hx.phiappt.model.warehouse.ShopWarehouseChange; import com.hx.phiappt.model.warehouse.ShopWarehouseItem; import com.hx.phiappt.model.warehouse.ShopWarehouseType; +import com.hx.phip.common.wx.corp.WeiXinCorpMpUtil; +import com.hx.phip.common.wx.corp.WeiXinMpUtil; import com.hx.phip.config.BotoxClubConfig; import com.hx.phip.config.CustomParameter; import com.hx.phip.config.QuestionInvestigateConfig; @@ -74,6 +76,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; +import java.text.MessageFormat; import java.util.*; @Transactional @@ -4675,4 +4678,90 @@ UserInfoTool.addUserUpdateLog(commonService, deductionSingle.getAppId(), user, shop.getId(), opEmployee.getId(), null, null, "璋冩暣鐢ㄦ埛绉戝鍏崇郴鏁版嵁", logArray, null, recordNo); } } + + /** + * 浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱 + * @param deductionSingleId 鍒掓墸缂栧彿 + */ + @Override + public void cancelDeductionSingleSentNotice(String deductionSingleId) { + try { + // 鍒ゆ柇鍒掓墸鍗� + DeductionSingle deductionSingle = deductionSingleMapper.selectOneByKey(deductionSingleId); + if (deductionSingle == null) { + throw new TipsException("鍒掓墸鏁版嵁涓嶅瓨鍦�!"); + } + // 鍒ゆ柇鍒掓墸椤圭洰 + DeductionProject deductionProject = this.getDeductionProjectBySingleId(deductionSingle.getId()); + if (deductionProject == null) { + throw new TipsException("鍒掓墸椤圭洰鏁版嵁涓嶅瓨鍦�!"); + } + // 鍒ゆ柇鍒掓墸鐢ㄦ埛 + User user = commonService.selectOneByKey(UserMapper.class, deductionSingle.getUserId()); + if (user == null) { + throw new TipsException("鍒掓墸鐢ㄦ埛鏁版嵁涓嶅瓨鍦�!"); + } + // 鍒ゆ柇鏄惁鏈夋不鐤楀崟 + if (StringUtils.isEmpty(deductionSingle.getTreatSingleId())) { + logger.info("浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱鎻愮ず,涓嶅瓨鍦ㄦ不鐤楅�氱煡鍗�!"); + return; + } + // 鑾峰彇娌荤枟鍗� + TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, deductionSingle.getTreatSingleId()); + if (treatSingle == null) { + throw new TipsException("鍒掓墸娌荤枟鍗曟暟鎹笉瀛樺湪!"); + } + // 鍒ゆ柇鍒拌鍗� + if (StringUtils.isEmpty(treatSingle.getVisitOrderId())) { + logger.info("浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱鎻愮ず,涓嶅瓨鍦ㄥ埌璁垮崟!"); + return; + } + // 鑾峰彇鍒拌鍗� + VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, treatSingle.getVisitOrderId()); + if (visitOrder == null) { + logger.info("浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱鎻愮ず,涓嶅瓨鍦ㄥ埌璁垮崟!"); + return; + } + // 鑾峰彇鎵ц鎶ゅ+ + String nurseInfo = null; + DeductionJoin deductionName = this.getDeductionDoctorNameBySingleId(deductionSingleId, BaseEntity.NO); + if (deductionName != null && !StringUtils.isEmpty(deductionName.getEmployeeName())) { + nurseInfo = deductionName.getEmployeeName(); + } + // 鑾峰彇灏忕▼搴忔秷鎭痶oken + String mpToken = WeiXinMpUtil.getAccessToken(commonService, customParameter.getCorpMpAppId()); + String corpMpToken = WeiXinCorpMpUtil.getAccessToken(commonService, customParameter.getCorpMpAppId()); + if (StringUtils.isEmpty(mpToken)) { + throw new TipsException("鑾峰彇灏忕▼搴廡oken寮傚父锛�"); + } + if (StringUtils.isEmpty(corpMpToken)) { + throw new TipsException("鑾峰彇浼佷笟搴旂敤灏忕▼搴廡oken寮傚父锛�"); + } + // 娑堟伅鍐呭 浣滃簾鍒掓墸閫氱煡 瀹㈡埛锛� 椤圭洰锛屾墽琛屾姢澹細 + String content; + if (!StringUtils.isEmpty(nurseInfo)) { + content = MessageFormat.format("浣滃簾鍒掓墸閫氱煡锛歿0}锛寋1}锛寋2}", user.getName(), deductionProject.getProjectName(), nurseInfo); + } else { + content = MessageFormat.format("浣滃簾鍒掓墸閫氱煡锛歿0}锛寋1}", user.getName(), deductionProject.getProjectName()); + } + // 鍙戦�佷紒涓氬井淇¢�氱煡缁欏垎閰嶆不鐤楄嵂鎴� + if (!StringUtils.isEmpty(deductionSingle.getShopId())) { + // 鑾峰彇瑕佸彂閫佺殑鎴愬憳 + List<Employee> employees = EmployeeTool.getEmployeeByShopAndRoleList(commonService, deductionSingle.getShopId(), RoleType.UNIQUE_HEAD_NURSE); + if (employees != null && employees.size() > 0) { + //鍙戦�佷紒涓氬井淇¢�氱煡鑽埧 + for (Employee employee : employees) { + // 浼佷笟鏈嶅姟娑堟伅鎻愰啋 + String sendDate = SendMessageToolV2.sendDataByTreatOrderNoticeMic(visitOrder, employee, mpToken, "1000050", content); + if (StringUtils.isEmpty(sendDate)) { + continue; + } + SendMessageTool.sendMessge(sendDate, corpMpToken); + } + } + } + } catch (Exception e) { + logger.error("浣滃簾鍒掓墸鍙戦�氱煡缁欐姢澹暱鍑洪敊锛�", e); + } + } } -- Gitblit v1.8.0