yaozhixue 1 year ago
parent
commit
78bdf3d638

+ 7 - 0
src/main/java/com/zfire/jiasm/syncdata/sendmessage/MarketingSMSSelfTask.java

@@ -2,15 +2,19 @@ package com.zfire.jiasm.syncdata.sendmessage;
 
 
 import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.service.SMSService;
 import com.zfire.jiasm.syncdata.utils.SMSSelfManager;
+import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -31,6 +35,8 @@ public class MarketingSMSSelfTask {
 	private SMSService smsService;
 	@Value("${SMSSelf_marketing_templateId}")
 	private String templateId;
+	@Resource
+	PublicService publicService;
 
 	@Scheduled(fixedRateString = "${SMSSelf_marketing_Rate}")
 	private void process() {
@@ -68,6 +74,7 @@ public class MarketingSMSSelfTask {
 					smsSelfManager.templateSMS(phoneNo, templateId, (String) row.get("syn_task_no"),
 							(String) row.get("fsma"), datas);
 					smsService.successUpdate("fa_marketing_sms", synTaskNo);
+					publicService.upSmsRecordSendTime(synTaskNo,phoneNo,new Date());
 				} catch (Exception ex) {
 					log.error("营销短信发送失败[syn_task_no=" + synTaskNo + "]", ex);
 					synTimes++;

+ 7 - 0
src/main/java/com/zfire/jiasm/syncdata/sendmessage/SMSMessageFinish.java

@@ -6,6 +6,7 @@ package com.zfire.jiasm.syncdata.sendmessage;
  */
 
 import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.service.SMSRepairFinishService;
 import com.zfire.jiasm.syncdata.utils.SMSSelfManager;
 import lombok.extern.slf4j.Slf4j;
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -30,6 +32,10 @@ public class SMSMessageFinish {
     private SMSRepairFinishService smsRepairFinishService;
     @Autowired
     private SMSSelfManager smsSelfManager;
+    @Resource
+    PublicService publicService;
+
+
 
     @Scheduled(fixedDelayString = "${zwgmsgsend}")
     private void process() {
@@ -59,6 +65,7 @@ public class SMSMessageFinish {
                     smsRepairFinishService.failureUpdate(synTaskNo,resultData);
                 } else {
                     smsRepairFinishService.successUpdate(synTaskNo);
+                    publicService.upSmsRecordSendTime(synTaskNo,(String)row.get("sjid"),new Date());
                 }
             }
 

+ 7 - 0
src/main/java/com/zfire/jiasm/syncdata/sendmessage/SMSWorkerSend.java

@@ -3,6 +3,7 @@ package com.zfire.jiasm.syncdata.sendmessage;
 import com.alibaba.fastjson.JSON;
 import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
 import com.zfire.jiasm.syncdata.data.Token;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.service.SMSService;
 import com.zfire.jiasm.syncdata.utils.DataUtil;
 import com.zfire.jiasm.syncdata.utils.OLDSystemUtil;
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -36,6 +38,9 @@ public class SMSWorkerSend {
 	private SMSService smsService;
 	@Autowired
 	private OLDSystemUtil oldSystemTask;
+	@Resource
+	PublicService publicService;
+
 
 
 
@@ -93,6 +98,8 @@ public class SMSWorkerSend {
 					}
 				}
 				smsService.successUpdate("fa_gree_sms_worker", synTaskNo);
+				publicService.upSmsRecordSendTime(synTaskNo,(String)row.get("sjid"),new Date());
+				publicService.upSmsRecordSendTime(synTaskNo,(String)row.get("sjid2"),new Date());
 			}
 			log.info("派工短信发送结束: \uF0B7{}", sdf.format(new Date()));
 		} catch (Exception ex) {

+ 7 - 3
src/main/java/com/zfire/jiasm/syncdata/sendmessage/SendGreeMessage.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
 import com.zfire.jiasm.syncdata.data.Token;
 import com.zfire.jiasm.syncdata.plus.entity.ItfMessagehuifangentity;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.service.SMSRepairFinishService;
 import com.zfire.jiasm.syncdata.utils.OLDSystemUtil;
 import com.zfire.jiasm.syncdata.utils.TokenCenter;
@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -31,15 +33,16 @@ public class SendGreeMessage {
     private String repaireMessageFinishTopicName;
     @Value("${wgmsgsendc}")
     private String wgmsgsendc = "";
-
-
-
     @Autowired
     private TokenCenter tokenCenter;
     @Autowired
     private OLDSystemUtil oldSystemTask;
     @Autowired
     private SMSRepairFinishService smsRepairFinishService;
+    @Resource
+    PublicService publicService;
+
+
 
     @Scheduled(fixedDelayString = "${wgmsgsend}")
     public void process() throws Exception {
@@ -85,6 +88,7 @@ public class SendGreeMessage {
             // log.info(name+"评价短信" + json);
             oldSystemTask.sendMessage2Server(topic, json, token, key);
             smsRepairFinishService.successUpdate(synTaskNo);
+            publicService.upSmsRecordSendTime(synTaskNo,(String)row.get("sjid"),new Date());
         }
 
         log.info("评价短信发送到总部结束: \uF0B7{}", sdf.format(new Date()));

+ 5 - 0
src/main/java/com/zfire/jiasm/syncdata/sendmessage/SendGreeSms.java

@@ -3,6 +3,7 @@ package com.zfire.jiasm.syncdata.sendmessage;
 import com.alibaba.fastjson.JSON;
 import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
 import com.zfire.jiasm.syncdata.data.Token;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.service.SMSService;
 import com.zfire.jiasm.syncdata.utils.OLDSystemUtil;
 import com.zfire.jiasm.syncdata.utils.TokenCenter;
@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -37,6 +39,8 @@ public class SendGreeSms {
     private SMSService smsService;
     @Autowired
     private OLDSystemUtil oldSystemTask;
+    @Resource
+    PublicService publicService;
 
 
 
@@ -91,6 +95,7 @@ public class SendGreeSms {
                         (isInstall ? this.installTopicName : this.repaireMessageApointmentTopicName), json, token, key);
 
                 smsService.successUpdate("fa_gree_sms", synTaskNo);
+                publicService.upSmsRecordSendTime(synTaskNo,(String)row.get("sjid"),new Date());
             }
 
         } catch (Exception ex) {

+ 9 - 1
src/main/java/com/zfire/jiasm/syncdata/sendmessage/SendMessage.java

@@ -6,6 +6,7 @@ import com.zfire.jiasm.syncdata.dao.mapper.SendGreeSmsMapper;
 import com.zfire.jiasm.syncdata.plus.entity.FaOrderSms;
 import com.zfire.jiasm.syncdata.plus.entity.SmsRecord;
 import com.zfire.jiasm.syncdata.plus.service.SmsRecordService;
+import com.zfire.jiasm.syncdata.service.PublicService;
 import com.zfire.jiasm.syncdata.utils.SMSSelfManager;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +37,12 @@ public class SendMessage {
     SendGreeSmsMapper sendGreeSmsMapper;
     @Resource
     SmsRecordService smsRecordService;
+    @Resource
+    PublicService publicService;
+
+
+
+
 
     @Scheduled(fixedDelayString = "${zjgdmsgsend}")
     public void processXQDLTask() throws Exception {
@@ -65,7 +72,8 @@ public class SendMessage {
                 // 用户手机号,?,自生成主键,随机发送码,发送的内容
                 smsSelfManager.templateSMS(item.getSjid(), templateId,item.getSynTaskNo(),
                         item.getFsma(), datas);
-                sendSuccess(item);
+                // sendSuccess(item);
+                publicService.upSmsRecordSendTime(item.getSynTaskNo(),item.getSjid(),new Date());
             } catch (Exception ex) {
                 log.error("自建工单短信发送失败[syn_task_no=" + item.getSynTaskNo() + "]", ex);
                 sendError(item, synTimes, ex);

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

@@ -162,5 +162,5 @@ public interface PublicService {
     void setUserLevel(OrderBase order);
     void getProductId(Map<String,String> productMap);
 
-
+    void upSmsRecordSendTime(String synTaskNo,String phone,Date date);
 }

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

@@ -1819,6 +1819,21 @@ public class PublicServiceImpl implements PublicService {
         }
     }
 
+    @Override
+    public void upSmsRecordSendTime(String synTaskNo,String phone,Date date){
+        // 提取信息,有则更新
+        SmsRecord sr = smsRecordService.lambdaQuery()
+                .eq(SmsRecord::getSynTaskNo,synTaskNo)
+                .eq(SmsRecord::getPhone,phone)
+                .isNull(SmsRecord::getSendTime)
+                .orderByDesc(SmsRecord::getCreateTime)
+                .last("limit 1").one();
+        if (sr != null){
+            sr.setSendTime(date);
+            sr.updateById();
+        }
+    }
+
 
     private void setLocationByAddress(OrderBase orderBase) {
         if (StringUtils.isEmpty(orderBase.getLng()) || StringUtils.isEmpty(orderBase.getLat())) {