yaozhixue 1 year ago
parent
commit
18b005c2d7

+ 1 - 1
src/main/java/com/zfire/jiasm/syncdata/download/basedata/GLPPGFWebsitWorker.java

@@ -108,7 +108,7 @@ public class GLPPGFWebsitWorker {
 
 
     /**
-     * 数据同步到本地表
+     * 数据同步到本地表 师傅信息
      * 师傅信息一定新增 - 多次变到后无则新增,有则修改
      */
     @Scheduled(fixedDelayString = "${gfwww}")

+ 47 - 2
src/main/java/com/zfire/jiasm/syncdata/service/impl/SMSSelfGetArrivedServiceImpl.java

@@ -2,8 +2,10 @@ 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.pojo.bo.DownRepairOrderGD;
@@ -36,11 +38,24 @@ public class SMSSelfGetArrivedServiceImpl {
 	PublicService publicService;
 	@Resource
 	SyncSmsOrderService syncSmsOrderService;
+	@Resource
+	FaExceptionMobileService faExceptionMobileService;
 
 	@Transactional(rollbackFor = Exception.class)
 	public void insertData(JSONObject datas) throws Exception {
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
 		JSONArray reports = datas.getJSONArray("reports");
+		List<String> mobiles = new ArrayList<>();
+
+		// 提取 退订用户信息
+		List<FaExceptionMobile> fems = faExceptionMobileService.lambdaQuery().list();
+		if (CollectionUtils.isNotEmpty(fems)){
+			fems.stream().forEach(event->{
+				mobiles.add(event.getMobile());
+			});
+			fems.clear();
+		}
+
 		for (int i = 0; i < reports.size(); i++) {
 			JSONObject data = reports.getJSONObject(i);
 
@@ -49,6 +64,9 @@ public class SMSSelfGetArrivedServiceImpl {
 
 			// 同步回复内容信息smsrecord
 			syncSmsRecord(data);
+
+			// 退订写入 fa_exception_mobile
+			addFaExceptionMobile(mobiles, data);
 		}
 	}
 
@@ -96,6 +114,17 @@ public class SMSSelfGetArrivedServiceImpl {
 	public void insertDataGD(DownRepairOrderGD datas) throws Exception {
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
 		JSONArray reports = datas.getData();
+		List<String> mobiles = new ArrayList<>();
+
+		// 提取 退订用户信息
+		List<FaExceptionMobile> fems = faExceptionMobileService.lambdaQuery().list();
+		if (CollectionUtils.isNotEmpty(fems)){
+			fems.stream().forEach(event->{
+				mobiles.add(event.getMobile());
+			});
+			fems.clear();
+		}
+
 
 		// 写入接收表中 状态同步使用
 		saveSyncSmsOrder(datas);
@@ -103,15 +132,30 @@ public class SMSSelfGetArrivedServiceImpl {
 		for (int i = 0; i < reports.size(); i++) {
 			JSONObject data = reports.getJSONObject(i);
 
-			// 回复数据写入表
+			// 回复数据写入表 itf_receive_sms
 			saveItfReceiveSms(sdf, data);
 
 			// 同步回复内容信息 smsrecord
 			syncSmsRecord(data);
+
+			// 退订写入 fa_exception_mobile
+			addFaExceptionMobile(mobiles, data);
 		}
 
 	}
 
+	private void addFaExceptionMobile(List<String> mobiles, JSONObject data) {
+		if (!mobiles.contains(data.getString("fromNum"))){
+			String content = data.getString("content").toUpperCase();
+			if (content.length()==2 && "QX".equals(content)){
+				FaExceptionMobile fem = new FaExceptionMobile();
+				fem.setMobile(data.getString("fromNum"));
+				fem.setCreatetime(new Date());
+				fem.insert();
+			}
+		}
+	}
+
 	private void saveItfReceiveSms(SimpleDateFormat sdf, JSONObject data) throws ParseException {
 		String sql = "insert into itf_receive_sms (smsType,fromNum,content,recvTime,"
 				+ "dateSent,status,appendCode,action,deliverCode,reqId,smsCount,spCode,subappend) "
@@ -190,8 +234,9 @@ public class SMSSelfGetArrivedServiceImpl {
 			smsRecordService.updateBatchById(u);
 			u.clear();
 
+			// 差评时向申诉表插入数据自工单插入差评申诉
+			// 总部发送的短信回复在从总部同步时已做了处理
 
-			// 差评时向申诉表插入数据
 
 
 		}