yaozhixue 1 year ago
parent
commit
b8ed243982

+ 3 - 0
src/main/java/com/zfire/jiasm/syncdata/service/PublicService.java

@@ -163,4 +163,7 @@ public interface PublicService {
     void getProductId(Map<String,String> productMap);
 
     void upSmsRecordSendTime(String synTaskNo,String phone,Date date);
+
+    Boolean getCppjly(String pjly);
+    String getAppraiseStatusT(String pjly);
 }

+ 8 - 64
src/main/java/com/zfire/jiasm/syncdata/service/impl/AddInstallBusinessImpl.java

@@ -2176,7 +2176,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
 
             // 置能否申诉标识 canappeal=1可申诉 中差评均可申诉
             // 这里以后可能需要,不要删除
-            cppjly = getCppjly(s);
+            cppjly = publicService.getCppjly(s.getPjly().trim());
             // 置可申诉标识 当前评价为中差评时看是否有已同步的差评,有不再产生申诉数据
             if (cppjly){
                 OrderAppraise oldoat = orderAppraiseService.lambdaQuery()
@@ -2278,7 +2278,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
                         orderBase.getOrderStatus().equals(GDOrderStatusEnum.INSTALL_STATUS_G10.getCode()))){
             // 首评
             // 首次评价
-            orderBase.setAppraiseStatus(getAppraiseStatus(s.getPjly().trim()));
+            orderBase.setAppraiseStatus(publicService.getAppraiseStatusT(s.getPjly().trim()));
             // 首次评价内容
             orderBase.setAppraiseContent(s.getPjly().trim());
             // 首次评价时间
@@ -2287,7 +2287,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             // orderBase.setAppraiseSource();
         } else {
             // 追评评价状态
-            orderBase.setSecondAppraiseStatus(getAppraiseStatus(s.getPjly().trim()));
+            orderBase.setSecondAppraiseStatus(publicService.getAppraiseStatusT(s.getPjly().trim()));
             // 追评评价内容
             orderBase.setSecondContent(s.getPjly().trim());
             // 追评评价时间
@@ -2340,65 +2340,9 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
     }
 
 
-    // 首次评价(A:好评,B:中评,C:差评,N:未评价,O:其他
-    private String getAppraiseStatus(String pjly){
-        String appraiseStatus="";
-        if (pjly.equals("1") || pjly.indexOf("满意")>=0){
-            appraiseStatus="A";
-        } else if (pjly.equals("2") || pjly.indexOf("一般")>=0){
-            appraiseStatus="B";
-        } else if (pjly.equals("3") || pjly.indexOf("不满意")>=0){
-            appraiseStatus="C";
-        } else {
-            // 这里需要增加一个表用来查询确认是否为不满意
-            appraiseStatus=getAppraiseStatusr(pjly);
-        }
-
-        return appraiseStatus;
-    }
-
-    // 看是否为中差评
-    @NotNull
-    private Boolean getCppjly(ItfTblAzAssignSatisfactionDownload s) {
-        Boolean cppjly;
-        if (s.getPjly().trim().equals("1") || s.getPjly().trim().indexOf("满意")>=0){
-            cppjly = Boolean.FALSE;
-        } else if (s.getPjly().trim().equals("2") || s.getPjly().trim().indexOf("一般")>=0){
-            cppjly = Boolean.TRUE;
-        } else if (s.getPjly().trim().equals("3") || s.getPjly().trim().indexOf("不满意")>=0){
-            cppjly = Boolean.TRUE;
-        } else {
-            cppjly = publicService.checkEvaluatemessage(s.getPjly());
-        }
-        return cppjly;
-    }
-
-    //  A=满意  B=一般  C=不满意 O:其他
-    @NotNull
-    private String getAppraiseStatusr(String pjly) {
-        String appraiseStatus = "";
-        SatisfactionList sfs = publicService.getAppraiseStatus(pjly);
-        if (sfs == null){
-            appraiseStatus="O";
-            return appraiseStatus;
-        }
-        if (sfs.getAppraiseType().equals(AppraiseTypeEnum.SATISFACTION.getCode())){
-            appraiseStatus="A";
-        } else if (sfs.getAppraiseType().equals(AppraiseTypeEnum.GENERAL.getCode())){
-            appraiseStatus="B";
-        } else if (sfs.getAppraiseType().equals(AppraiseTypeEnum.DISPLEASURE.getCode())){
-            appraiseStatus="C";
-        } else {
-            appraiseStatus="O";
-        }
-
-        return appraiseStatus;
-
-    }
-
     private int getCp(OrderBase orderBase, List<OrderAppeal> orderAppeals,
                       ItfTblAzAssignSatisfactionDownload s, Date ssDate) {
-        if (s.getPjnr().equals("3") || s.getPjnr().indexOf("不满意")>=0 || getCppjly(s)){
+        if (s.getPjnr().equals("3") || s.getPjnr().indexOf("不满意")>=0 || publicService.getCppjly(s.getPjly().trim())){
             OrderAppeal orderAppeal=new OrderAppeal();
             orderAppeal.setOrderBaseId(orderBase.getId());
             orderAppeal.setPgid(orderBase.getPgid());
@@ -2407,7 +2351,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             // 网点必填
             orderAppeal.setWebsitId(orderBase.getWebsitId());
             orderAppeal.setBadEvaluate(s.getPjnr());
-            orderAppeal.setAppraiseStatus(getAppraiseStatus(s.getPjly()));
+            orderAppeal.setAppraiseStatus(publicService.getAppraiseStatusT(s.getPjly()));
             orderAppeal.setStatus(1);
             orderAppeal.setCanApply(Boolean.TRUE);
             orderAppeal.setCreateTime(new Date());
@@ -2423,7 +2367,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
                           List<FaGreeSms> fsList, Date jzDate) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-        if (s.getPjly().equals("3") || s.getPjnr().indexOf("不满意")>=0 || getCppjly(s)){
+        if (s.getPjly().equals("3") || s.getPjnr().indexOf("不满意")>=0 || publicService.getCppjly(s.getPjly().trim())){
             if (StringUtils.isNotEmpty(s.getHfwdno()) && !s.getHfwdno().equals("99999999") && StringUtils.isNotEmpty(websitFWS.getWdlxdh())){
                 FaGreeSms fs=new FaGreeSms();
                 fs.setSynTaskNo(publicService.getUUID());
@@ -2469,7 +2413,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
             o.setMainName(sysDictRefDLMap.get(String.valueOf(s.getSplb())).get(0).getDictValue());
         }
 
-        o.setAppraiseStatus(getAppraiseStatus(s.getPjly()));
+        o.setAppraiseStatus(publicService.getAppraiseStatusT(s.getPjly()));
 
         o.setAppraiseContent(s.getPjnr());
         o.setSource("GREE");
@@ -2494,7 +2438,7 @@ public class AddInstallBusinessImpl implements AddInstallBusiness {
         if (s.getSxlx().equals(0)){
             o.setType(1);
         } else {
-            o.setType(24);
+            o.setType(2);
         }
 
         if (s.getCreatedBy()!=null){

+ 53 - 0
src/main/java/com/zfire/jiasm/syncdata/service/impl/PublicServiceImpl.java

@@ -1834,6 +1834,59 @@ public class PublicServiceImpl implements PublicService {
         }
     }
 
+    @Override
+    public Boolean getCppjly(String pjly){
+        Boolean cppjly;
+        if (pjly.equals("1") || pjly.indexOf("满意")>=0){
+            cppjly = Boolean.FALSE;
+        } else if (pjly.equals("2") || pjly.indexOf("一般")>=0){
+            cppjly = Boolean.TRUE;
+        } else if (pjly.equals("3") || pjly.indexOf("不满意")>=0){
+            cppjly = Boolean.TRUE;
+        } else {
+            cppjly = publicService.checkEvaluatemessage(pjly);
+        }
+        return cppjly;
+    }
+
+    // 首次评价(A:好评,B:中评,C:差评,N:未评价,O:其他
+    @Override
+    public String getAppraiseStatusT(String pjly){
+        String appraiseStatus="";
+        if (pjly.equals("1") || pjly.indexOf("满意")>=0){
+            appraiseStatus="A";
+        } else if (pjly.equals("2") || pjly.indexOf("一般")>=0){
+            appraiseStatus="B";
+        } else if (pjly.equals("3") || pjly.indexOf("不满意")>=0){
+            appraiseStatus="C";
+        } else {
+            // 这里需要增加一个表用来查询确认是否为不满意
+            appraiseStatus=getAppraiseStatusr(pjly);
+        }
+
+        return appraiseStatus;
+    }
+
+    private String getAppraiseStatusr(String pjly) {
+        String appraiseStatus = "";
+        SatisfactionList sfs = getAppraiseStatus(pjly);
+        if (sfs == null){
+            appraiseStatus="O";
+            return appraiseStatus;
+        }
+        if (sfs.getAppraiseType().equals(AppraiseTypeEnum.SATISFACTION.getCode())){
+            appraiseStatus="A";
+        } else if (sfs.getAppraiseType().equals(AppraiseTypeEnum.GENERAL.getCode())){
+            appraiseStatus="B";
+        } else if (sfs.getAppraiseType().equals(AppraiseTypeEnum.DISPLEASURE.getCode())){
+            appraiseStatus="C";
+        } else {
+            appraiseStatus="O";
+        }
+
+        return appraiseStatus;
+    }
+
 
     private void setLocationByAddress(OrderBase orderBase) {
         if (StringUtils.isEmpty(orderBase.getLng()) || StringUtils.isEmpty(orderBase.getLat())) {

+ 49 - 7
src/main/java/com/zfire/jiasm/syncdata/service/impl/SMSSelfGetArrivedServiceImpl.java

@@ -2,12 +2,8 @@ package com.zfire.jiasm.syncdata.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.zfire.jiasm.syncdata.plus.entity.FaExceptionMobile;
-import com.zfire.jiasm.syncdata.plus.entity.SmsRecord;
-import com.zfire.jiasm.syncdata.plus.entity.SyncSmsOrder;
-import com.zfire.jiasm.syncdata.plus.service.FaExceptionMobileService;
-import com.zfire.jiasm.syncdata.plus.service.SmsRecordService;
-import com.zfire.jiasm.syncdata.plus.service.SyncSmsOrderService;
+import com.zfire.jiasm.syncdata.plus.entity.*;
+import com.zfire.jiasm.syncdata.plus.service.*;
 import com.zfire.jiasm.syncdata.pojo.bo.DownRepairOrderGD;
 import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.test;
@@ -40,6 +36,10 @@ public class SMSSelfGetArrivedServiceImpl {
 	SyncSmsOrderService syncSmsOrderService;
 	@Resource
 	FaExceptionMobileService faExceptionMobileService;
+	@Resource
+	OrderBaseService orderBaseService;
+	@Resource
+	OrderAppealService orderAppealService;
 
 	@Transactional(rollbackFor = Exception.class)
 	public void insertData(JSONObject datas) throws Exception {
@@ -218,6 +218,8 @@ public class SMSSelfGetArrivedServiceImpl {
 	}
 
 	private void syncSmsRecord(JSONObject data) {
+		Map<String,String> orderPjnr = new HashMap<>();
+		List<OrderAppeal> orderAppeals = new ArrayList<>();
 		// 同步工单回复信息 这里使用手机号+发送码来确认 存在无对应的情况不处理
 		// 最近两个月的一定只有一条,为防止出现问题,用list
 		List<SmsRecord> rec = smsRecordService.lambdaQuery()
@@ -230,15 +232,55 @@ public class SMSSelfGetArrivedServiceImpl {
 				item.setReplyContent(data.getString("content"));
 				item.setReplyTime(new Date());
 				u.add(item);
+
+				orderPjnr.put(item.getOrderBaseId(),item.getReplyContent().trim());
 			}
 			smsRecordService.updateBatchById(u);
 			u.clear();
 
-			// 差评时向申诉表插入数据自工单插入差评申诉
+			// 差评时向申诉表插入数据自工单插入差评申诉(非商用空调且为差评信息)
 			// 总部发送的短信回复在从总部同步时已做了处理
+			for (Map.Entry entry :orderPjnr.entrySet()){
+				OrderBase orderBase = orderBaseService.lambdaQuery()
+						.eq(OrderBase::getId,(String) entry.getKey())
+						.eq(OrderBase::getUploadFlag,Boolean.FALSE).one();
+				// 提取差评申诉信息 差评申诉 仅一次
+				OrderAppeal oldcpss = orderAppealService.lambdaQuery()
+						.eq(OrderAppeal::getOrderBaseId,(String) entry.getKey())
+						.last("limit 1").one();
+
+				if (orderBase!=null && oldcpss == null &&
+						!orderBase.getMainId().equals("102") && !orderBase.getMainId().equals("109") &&
+						publicService.getCppjly((String) entry.getValue())){
+					OrderAppeal orderAppeal=new OrderAppeal();
+					orderAppeal.setOrderBaseId(orderBase.getId());
+					orderAppeal.setPgid(orderBase.getPgid());
+					orderAppeal.setWorkerName(orderBase.getWorkerName());
+					orderAppeal.setWorkerId(orderBase.getWorkerId());
+					// 网点必填
+					orderAppeal.setWebsitId(orderBase.getWebsitId());
+					orderAppeal.setBadEvaluate((String) entry.getValue());
+					orderAppeal.setAppraiseStatus(publicService.getAppraiseStatusT((String) entry.getValue()));
+					orderAppeal.setStatus(1);
+					orderAppeal.setCanApply(Boolean.TRUE);
+					orderAppeal.setCreateTime(new Date());
+					orderAppeal.setCreateBy("system");
+					orderAppeal.setEvaluateTime(new Date());
+					orderAppeals.add(orderAppeal);
+				}
+			}
+
 
 
 
+
+			// 生成申诉数据
+			if (orderAppeals.size()>0){
+				orderAppealService.saveOrUpdateBatch(orderAppeals);
+				orderAppeals.clear();
+			}
+
+
 		}
 	}