huZhiHao před 5 roky
rodič
revize
929eb39acc

+ 139 - 44
src/main/java/platform/modules/government/service/IndustrialLandSupplyDetailService.java

@@ -1218,7 +1218,12 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
 
         //短信参数
         Map<String, String> params = new HashMap<>();
-        IndustrialLandSupplyDetail detail = this.findById(applyId);
+        IndustrialLandSupplyDetail detail = null;
+        try {
+            detail = this.selectById(applyId + "");
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
         params.put("title", detail.getTitle());
         params.put("no", detail.getNo());
         String templateCode = Constant.SMS_TemplateCode.INDUSTRIAL_LAND_SUPPLY;
@@ -1282,7 +1287,34 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             for (UserGroup userGroup : userGroups) {
                 for (User user : users) {
                     if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                        sb.append(userGroup.getUser_id() + ",");
+                        if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
+                            List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
+                            for (IndustrialLandSupplyConsultation ilsc : ids) {
+                                if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
+                                    sb.append(userGroup.getUser_id() + ",");
+                                    //发送短信
+                                    try {
+                                        AlibabaSMSUtil.sendSMSMessage(
+                                                user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                        );
+                                    } catch (ClientException e) {
+                                        e.printStackTrace();
+                                    }
+                                    break;
+                                }
+                            }
+                        } else {
+                            sb.append(userGroup.getUser_id() + ",");
+                            //发送短信
+                            try {
+                                AlibabaSMSUtil.sendSMSMessage(
+                                        user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                );
+                            } catch (ClientException e) {
+                                e.printStackTrace();
+                            }
+                        }
+
 //                        String message = user.getUser_name() +0 ",您好。“" + company.getCompany_name() + "企业”的“" + projectName + "项目”申请需要您审核。谢谢。";
 //                        messages.setContent(message);
 //                        int[] streetArrInt = new int[1];
@@ -1290,15 +1322,6 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
 //                        messageService.saveMessageAndPush(messages, streetArrInt, Constant.UserType.GOVERNMENT);
 //                        waitToDoService.newTODO("区级智能制造审核", "/government/projectIntelligent/approve/" + projectApplication.getId(), Constant.WaitToDo_OperType.AUDIT, projectApplication.getId(),
 //                                Constant.DictionaryType.PROJECT_INTELLIGENT, projectApplication.getApply_no(), userGroup.getUser_id().toString(), Constant.WaitToDo_IsSerial.IS_SERIAL, false);
-
-                        //发送短信
-                        try {
-                            AlibabaSMSUtil.sendSMSMessage(
-                                    user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
-                            );
-                        } catch (ClientException e) {
-                            e.printStackTrace();
-                        }
                     }
                 }
             }
@@ -1386,15 +1409,32 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             for (UserGroup userGroup : userGroups) {
                 for (User user : users) {
                     if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                        sb.append(userGroup.getUser_id() + ",");
-
-                        //发送短信
-                        try {
-                            AlibabaSMSUtil.sendSMSMessage(
-                                    user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
-                            );
-                        } catch (ClientException e) {
-                            e.printStackTrace();
+                        if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
+                            List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
+                            for (IndustrialLandSupplyConsultation ilsc : ids) {
+                                if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
+                                    sb.append(userGroup.getUser_id() + ",");
+                                    //发送短信
+                                    try {
+                                        AlibabaSMSUtil.sendSMSMessage(
+                                                user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                        );
+                                    } catch (ClientException e) {
+                                        e.printStackTrace();
+                                    }
+                                    break;
+                                }
+                            }
+                        } else {
+                            sb.append(userGroup.getUser_id() + ",");
+                            //发送短信
+                            try {
+                                AlibabaSMSUtil.sendSMSMessage(
+                                        user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                );
+                            } catch (ClientException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 }
@@ -1483,14 +1523,32 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             for (UserGroup userGroup : userGroups) {
                 for (User user : users) {
                     if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                        sb.append(userGroup.getUser_id() + ",");
-                        //发送短信
-                        try {
-                            AlibabaSMSUtil.sendSMSMessage(
-                                    user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
-                            );
-                        } catch (ClientException e) {
-                            e.printStackTrace();
+                        if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
+                            List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
+                            for (IndustrialLandSupplyConsultation ilsc : ids) {
+                                if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
+                                    sb.append(userGroup.getUser_id() + ",");
+                                    //发送短信
+                                    try {
+                                        AlibabaSMSUtil.sendSMSMessage(
+                                                user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                        );
+                                    } catch (ClientException e) {
+                                        e.printStackTrace();
+                                    }
+                                    break;
+                                }
+                            }
+                        } else {
+                            sb.append(userGroup.getUser_id() + ",");
+                            //发送短信
+                            try {
+                                AlibabaSMSUtil.sendSMSMessage(
+                                        user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                );
+                            } catch (ClientException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 }
@@ -1569,14 +1627,32 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             for (UserGroup userGroup : userGroups) {
                 for (User user : users) {
                     if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                        sb.append(userGroup.getUser_id() + ",");
-                        //发送短信
-                        try {
-                            AlibabaSMSUtil.sendSMSMessage(
-                                    user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
-                            );
-                        } catch (ClientException e) {
-                            e.printStackTrace();
+                        if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.COMMERCE_PENDING_FEEDBACK)) {
+                            List<IndustrialLandSupplyConsultation> ids = detail.getConsultationList();
+                            for (IndustrialLandSupplyConsultation ilsc : ids) {
+                                if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
+                                    sb.append(userGroup.getUser_id() + ",");
+                                    //发送短信
+                                    try {
+                                        AlibabaSMSUtil.sendSMSMessage(
+                                                user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                        );
+                                    } catch (ClientException e) {
+                                        e.printStackTrace();
+                                    }
+                                    break;
+                                }
+                            }
+                        } else {
+                            sb.append(userGroup.getUser_id() + ",");
+                            //发送短信
+                            try {
+                                AlibabaSMSUtil.sendSMSMessage(
+                                        user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                );
+                            } catch (ClientException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 }
@@ -1990,14 +2066,32 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             for (UserGroup userGroup : userGroups) {
                 for (User user : users) {
                     if (Objects.equals(user.getId(), userGroup.getUser_id())) {
-                        sb.append(userGroup.getUser_id() + ",");
-                        //发送短信
-                        try {
-                            AlibabaSMSUtil.sendSMSMessage(
-                                    user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
-                            );
-                        } catch (ClientException e) {
-                            e.printStackTrace();
+                        if (newApproval.getAfter_approvalstatus().equals(Constant.LandSupplyApproveStatus.LAND_SUPPLY_PENDIND_FEEDBACK)) {
+                            List<IndustrialLandSupplyDistribution> ids = detail.getDistributionList();
+                            for (IndustrialLandSupplyDistribution ilsc : ids) {
+                                if (Objects.equals(user.getDepartment_id() + "", ilsc.getDepartment_id())) {
+                                    sb.append(userGroup.getUser_id() + ",");
+                                    //发送短信
+                                    try {
+                                        AlibabaSMSUtil.sendSMSMessage(
+                                                user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                        );
+                                    } catch (ClientException e) {
+                                        e.printStackTrace();
+                                    }
+                                    break;
+                                }
+                            }
+                        } else {
+                            sb.append(userGroup.getUser_id() + ",");
+                            //发送短信
+                            try {
+                                AlibabaSMSUtil.sendSMSMessage(
+                                        user.getPhone(), templateCode, Constant.SINGNAMW, JSONObject.toJSONString(params)
+                                );
+                            } catch (ClientException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 }
@@ -2211,6 +2305,7 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             entity.setProcess_stage(Constant.LandSupplyApproveStage.SUPPLY);
             industrialLandSupplyDetailDao.updateByPrimaryKeySelective(entity);
             approvalService.insertAndGetId(newApproval);
+            sendToLeader(params);
             return true;
         }