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/impl/DeductionSingleServiceImpl.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 93 insertions(+), 4 deletions(-) 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