From 5cb917b2b7553fb03628b182e187a585803558d1 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期三, 22 五月 2024 22:50:12 +0800
Subject: [PATCH] 优化代码

---
 service-job/src/main/java/com/java110/job/adapt/Repair/MachineDistributeLeaflets.java |   93 +++++++++++++++++-----------------------------
 1 files changed, 35 insertions(+), 58 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/adapt/Repair/MachineDistributeLeaflets.java b/service-job/src/main/java/com/java110/job/adapt/Repair/MachineDistributeLeaflets.java
index 621461c..aec5cc0 100755
--- a/service-job/src/main/java/com/java110/job/adapt/Repair/MachineDistributeLeaflets.java
+++ b/service-job/src/main/java/com/java110/job/adapt/Repair/MachineDistributeLeaflets.java
@@ -143,11 +143,11 @@
         repairDto.setRepairId(repairId);
         List<RepairDto> repairDtos = repairInnerServiceSMO.queryRepairs(repairDto);
         IMsgNotify msgNotify = null;
-        if(RepairSettingDto.NOTIFY_WAY_SMS.equals(repairDtos.get(0).getNotifyWay())) {
+        if (RepairSettingDto.NOTIFY_WAY_SMS.equals(repairDtos.get(0).getNotifyWay())) {
             msgNotify = MsgNotifyFactory.getMsgNotify(MsgNotifyFactory.NOTIFY_WAY_ALI);
-        }else if(RepairSettingDto.NOTIFY_WAY_WECHAT.equals(repairDtos.get(0).getNotifyWay())){
+        } else if (RepairSettingDto.NOTIFY_WAY_WECHAT.equals(repairDtos.get(0).getNotifyWay())) {
             msgNotify = MsgNotifyFactory.getMsgNotify(MsgNotifyFactory.NOTIFY_WAY_WECHAT);
-        }else{
+        } else {
             return;
         }
 
@@ -172,57 +172,8 @@
         CommunityDto communityDto = new CommunityDto();
         communityDto.setCommunityId(communityId);
         List<CommunityDto> communityDtos = communityInnerServiceSMO.queryCommunitys(communityDto);
-        if (repairState.equals("1100") && businessRepairUser.getString("state").equals("10006")) { //娲惧崟
-            JSONObject paramIn = new JSONObject();
-            for (Business business : businesses) {
-                String businessTypeCd = business.getBusinessTypeCd();
-                if (!StringUtil.isEmpty(businessTypeCd) && businessTypeCd.equals("130200030001")) {
-                    JSONObject data = business.getData();
-                    if (!StringUtil.isEmpty(data.getString("state")) && data.getString("state").equals("10001")) {
-                        paramIn.put("staffId", data.getString("staffId"));
-                        paramIn.put("staffName", data.getString("staffName"));
-                    } else if (data.getString("state").equals("10006")) {
-                        paramIn.put("preStaffId", data.getString("preStaffId"));
-                        paramIn.put("preStaffName", data.getString("preStaffName"));
-                    }
-                }
-            }
-            paramIn.put("repairName", repairName);
-            paramIn.put("repairObjName", repairObjName);
-            paramIn.put("tel", tel);
-            paramIn.put("communityId", communityId);
-            paramIn.put("context", context);
-            paramIn.put("time", time);
-            paramIn.put("repairObjId", repairObjId);
-            paramIn.put("repairId", repairId);
-            //缁欑淮淇笀鍌呮帹閫佷俊鎭�
-            sendStaffMsg(paramIn, communityDtos.get(0),msgNotify);
-            //娲惧崟鎴愬姛缁欎笟涓绘帹閫佷俊鎭�
-            sendOwnerMsg(paramIn, communityDtos.get(0),msgNotify);
-
-            // 鑷姩鎵撳嵃灏忕エ
-            autoPrintRepair(repairUserDtos.get(0).getRuId(), repairDtos.get(0).getRepairType(), communityDtos.get(0));
-
-            //涓轰紒涓氬井淇$兢鍙戞秷鎭�
-            sendMsgToWechatGroup(paramIn, communityDtos.get(0));
-
-
-        } else if (repairState.equals("1100") && !businessRepairUser.getString("state").equals("10006")) {
-            JSONObject paramIn = new JSONObject();
-            paramIn.put("staffId", businessRepairUser.getString("staffId"));
-            paramIn.put("context", context);
-            paramIn.put("time", time);
-            paramIn.put("repairObjId", repairObjId);
-            paramIn.put("preStaffId", businessRepairUser.getString("preStaffId"));
-            paramIn.put("repairName", repairName);
-            paramIn.put("tel", tel);
-            paramIn.put("repairObjName", repairObjName);
-            paramIn.put("repairId", repairId);
-            //鎶㈠崟鎴愬姛缁欑淮淇笀鍌呮帹閫佷俊鎭�
-            sendStaffMsg(paramIn, communityDtos.get(0),msgNotify);
-            //鎶㈠崟鎴愬姛缁欎笟涓绘帹閫佷俊鎭�
-            sendOwnerMsg(paramIn, communityDtos.get(0),msgNotify);
-        } else if (repairState.equals("1300")) {   //杞崟
+        //todo 杞崟
+        if (RepairDto.STATE_TRANSFER.equals(repairState)) {
             JSONObject paramIn = new JSONObject();
             paramIn.put("repairName", repairName);
             paramIn.put("repairObjName", repairObjName);
@@ -233,9 +184,35 @@
             paramIn.put("preStaffName", businessRepairUser.getString("preStaffName"));
             paramIn.put("repairId", repairId);
             //缁欑淮淇笀鍌呮帹閫佷俊鎭�
-            sendStaffMsg(paramIn, communityDtos.get(0),msgNotify);
+            sendStaffMsg(paramIn, communityDtos.get(0), msgNotify);
+            return;
         }
-
+        //todo 涓嶆槸缁撳崟璺宠繃
+        if (!RepairDto.STATE_TAKING.equals(repairState)) {
+            return;
+        }
+        //todo 娲惧崟鍙墦鍗板皬绁�
+        if (RepairUserDto.STATE_DISPATCH.equals(businessRepairUser.getString("state"))) { //娲惧崟
+            // 鑷姩鎵撳嵃灏忕エ
+            autoPrintRepair(repairUserDtos.get(0).getRuId(), repairDtos.get(0).getRepairType(), communityDtos.get(0));
+            return;
+        }
+        JSONObject paramIn = new JSONObject();
+        paramIn.put("staffId", businessRepairUser.getString("staffId"));
+        paramIn.put("context", context);
+        paramIn.put("time", time);
+        paramIn.put("repairObjId", repairObjId);
+        paramIn.put("preStaffId", businessRepairUser.getString("preStaffId"));
+        paramIn.put("repairName", repairName);
+        paramIn.put("tel", tel);
+        paramIn.put("repairObjName", repairObjName);
+        paramIn.put("repairId", repairId);
+        //鎶㈠崟鎴愬姛缁欑淮淇笀鍌呮帹閫佷俊鎭�
+        sendStaffMsg(paramIn, communityDtos.get(0), msgNotify);
+        //鎶㈠崟鎴愬姛缁欎笟涓绘帹閫佷俊鎭�
+        sendOwnerMsg(paramIn, communityDtos.get(0), msgNotify);
+        //涓轰紒涓氬井淇$兢鍙戞秷鎭�
+        sendMsgToWechatGroup(paramIn, communityDtos.get(0));
     }
 
 
@@ -245,7 +222,7 @@
      * @param paramIn
      * @param communityDto
      */
-    private void sendStaffMsg(JSONObject paramIn, CommunityDto communityDto,IMsgNotify msgNotify) {
+    private void sendStaffMsg(JSONObject paramIn, CommunityDto communityDto, IMsgNotify msgNotify) {
         JSONObject content = new JSONObject();
         content.put("repairId", paramIn.getString("repairId"));
         content.put("repairName", paramIn.getString("repairName"));
@@ -271,7 +248,7 @@
      * @param paramIn
      * @param communityDto
      */
-    private void sendOwnerMsg(JSONObject paramIn, CommunityDto communityDto,IMsgNotify msgNotify) {
+    private void sendOwnerMsg(JSONObject paramIn, CommunityDto communityDto, IMsgNotify msgNotify) {
         //鏌ヨ鍏紬鍙烽厤缃�
         SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
         smallWeChatDto.setWeChatType("1100");

--
Gitblit v1.8.0