| 
					
				 | 
			
			
				@@ -1,9 +1,16 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.fs.his.task; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.core.date.DateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.core.date.DateUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.core.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.core.util.ObjectUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.json.JSONUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.fastGpt.domain.FastgptChatVoiceHomo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.fastgptApi.util.AudioUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.fastgptApi.vo.AudioVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.sop.domain.QwSopTempVoice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baidu.dev2.api.sdk.payment.api.PaymentService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,11 +31,15 @@ import com.fs.course.mapper.FsCourseRedPacketLogMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.service.IFsCourseWatchLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.course.service.ITencentCloudCosService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.erp.domain.ErpDeliverys; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.erp.domain.ErpOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.erp.domain.ErpOrderQuery; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.erp.domain.FsErpFinishPush; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.erp.dto.ErpOrderQueryRequert; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.erp.dto.ErpOrderQueryResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.erp.dto.OrderQueryResponseDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.erp.service.IErpOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.fastGpt.domain.FastGptEventTokenLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.fastGpt.domain.FastGptPushTokenTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.fastGpt.domain.FastgptEventLogTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.fastGpt.mapper.FastGptChatSessionMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.fastGpt.service.IFastgptEventLogTotalService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -46,13 +57,19 @@ import com.fs.his.utils.ConfigUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.his.vo.FsSubOrderResultVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.hisStore.domain.FsStoreOrderScrm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.hisStore.domain.FsStorePaymentScrm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.hisStore.domain.FsUserInformationCollection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.hisStore.mapper.FsStoreOrderScrmMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.hisStore.mapper.FsUserInformationCollectionMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.hisStore.service.IFsStorePaymentScrmService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.hisStore.service.IFsUserInformationCollectionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.im.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.im.service.IImService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.im.service.OpenIMService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.domain.QwCompany; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.mapper.QwRestrictionPushRecordMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qwApi.service.QwApiService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.sop.service.IQwSopTempVoiceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.system.domain.SysConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.system.mapper.SysConfigMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.wx.domain.FsWxExpressTask; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -77,9 +94,18 @@ import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Component("task") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private FsUserInformationCollectionMapper userInformationCollectionMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsUserInformationCollectionService userInformationCollectionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private FsUserCouponMapper fsUserCouponMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private FsStoreOrderScrmMapper fsStoreOrderScrmMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysConfigMapper sysConfigMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IFsPrescribeService fsPrescribeService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -186,6 +212,16 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IFsStorePaymentService paymentScrmService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ShippingService shippingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private QwRestrictionPushRecordMapper qwRestrictionPushRecordMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private FastgptChatVoiceHomoMapper fastgptChatVoiceHomoMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IQwSopTempVoiceService qwSopTempVoiceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static final String SOP_TEMP_VOICE_KEY = "sop:tempVoice"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void syncExpressToWx() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<FsWxExpressTask> fsWxExpressTasks = fsWxExpressTaskMapper.selectPendingData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(fsWxExpressTasks)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -207,7 +243,7 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(ObjectUtil.isNotNull(fsStoreOrder)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<FsStorePaymentScrm> fsStorePayments = paymentScrmService.selectFsStorePaymentByOrderScrm(fsStoreOrder.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    List<FsStorePaymentScrm> fsStorePayments = paymentScrmService.selectFsStorePaymentByOrderScrmStatus1(fsStoreOrder.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(CollectionUtils.isNotEmpty(fsStorePayments)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -270,6 +306,87 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        fsWxExpressTaskMapper.batchUpdate(fsWxExpressTasks); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * sop任务token消耗统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void sopPushTokenTotal() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 判断是否是凌晨 00:00 - 00:59 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean isEarlyMorning = isEarlyMorning(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 获取日期字符串(今天或昨天) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String dateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (isEarlyMorning) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateTime = DateUtils.addDateDays(-1); // 昨天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dateTime = DateUtils.getDate(); // 今天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("开始执行sop任务token消耗统计"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<FastGptPushTokenTotal> fastGptPushTotalList = qwRestrictionPushRecordMapper.selectFastgptPushTokenTotal(dateTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (fastGptPushTotalList != null && !fastGptPushTotalList.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (FastGptPushTokenTotal fastGptPushTotal : fastGptPushTotalList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 获取统计数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Integer type = fastGptPushTotal.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(type == 7){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        count = fastGptPushTotal.getCount() * 450; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        count = fastGptPushTotal.getCount() * 150; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    fastGptPushTotal.setCount(count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    FastGptPushTokenTotal pushTotal = qwRestrictionPushRecordMapper.selectFastGptPushTokenTotalByInfo(fastGptPushTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(pushTotal == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        qwRestrictionPushRecordMapper.insertPushTokenTotal(fastGptPushTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        fastGptPushTotal.setId(pushTotal.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        qwRestrictionPushRecordMapper.updatePushTokenTotal(fastGptPushTotal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("结束执行sop任务token消耗统计"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("执行sop任务token消耗统计异常", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 一键生成语音定时任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void ConsumerSopTempVoice() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Long newCompanyUserId = redisCache.popVoiceKey(SOP_TEMP_VOICE_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (newCompanyUserId != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<QwSopTempVoice> sopTempVoices = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY + ":" + newCompanyUserId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (sopTempVoices != null && !sopTempVoices.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (QwSopTempVoice qwSopTempVoice : sopTempVoices) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                AudioVO audioVO = new AudioVO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                List<FastgptChatVoiceHomo> homos = fastgptChatVoiceHomoMapper.selectFastgptChatVoiceHomoList(new FastgptChatVoiceHomo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                audioVO = AudioUtils.createUserUrlAndUrl(homos, qwSopTempVoice.getCompanyUserId(), qwSopTempVoice.getVoiceTxt()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (audioVO != null && audioVO.getWavUrl() != null && audioVO.getUrl() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    qwSopTempVoice.setVoiceUrl(audioVO.getUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    qwSopTempVoice.setUserVoiceUrl(audioVO.getWavUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    qwSopTempVoice.setDuration(audioVO.getDuration()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    qwSopTempVoice.setRecordType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    qwSopTempVoiceService.updateQwSopTempVoice(qwSopTempVoice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } finally { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        redisCache.deleteObject(SOP_TEMP_VOICE_KEY + ":" + newCompanyUserId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("没有需要生成的语音"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("生成语音定时任务执行异常", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 获取订单商品信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -536,6 +653,20 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             qwUserService.syncQwUserName(company.getCorpId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IFsStorePaymentService fsStorePaymentService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void payment(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FsStorePayment> fsStorePayments = fsStorePaymentService.selectAllPayment(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (FsStorePayment fsStorePayment : fsStorePayments) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                fsStorePaymentService.updateFsStorePaymentByDecryptForm(fsStorePayment.getPaymentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.error("同步支付失败:"+fsStorePayment.getPaymentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void videoTranscode() throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -635,9 +766,114 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             fsPrescribeService.auditPrescribe(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void queryOrder(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IErpOrderService erpOrderService = getErpService(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void deliveryOp() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FsStoreOrder> orders = fsStoreOrderMapper.selectNoMergeOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(orders)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(FsStoreOrder order:orders){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ErpOrderQueryRequert request=new ErpOrderQueryRequert(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                request.setSo_id(order.getOrderCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (erpOrderService != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    OrderQueryResponseDTO mergeOrder = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        mergeOrder = erpOrderService.getMergeOrder(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Thread.sleep(2000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.error("调用ERP接口异常:",e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } catch (Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //throw new RuntimeException(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (erpOrderService == jSTOrderService) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (mergeOrder != null && mergeOrder.getOrders() != null && mergeOrder.getOrders().size() > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            List<OrderQueryResponseDTO.Order> collect = mergeOrder.getOrders() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .filter(s -> s.getIsMerge() != null && s.getIsMerge()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            OrderQueryResponseDTO.Order order1 = collect.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (order1 != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                List<OrderQueryResponseDTO.OrderPay> pays = order1.getPays(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (pays != null && !pays.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    pays.forEach(pay -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        FsStoreOrder fsStoreOrder = fsStoreOrderMapper.selectFsStoreOrderByOrderCode(pay.getOuterPayId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        FsStoreOrder map = new FsStoreOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        map.setIsMerge(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        map.setExtendOrderId(pay.getOId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        map.setOrderId(fsStoreOrder.getOrderId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        fsStoreOrderMapper.updateFsStoreOrder(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void queryOrderScrm(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IErpOrderService erpOrderService = getErpService(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FsStoreOrderScrm> orders = fsStoreOrderMapper.selectNoMergeOrderScrm(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(orders)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(FsStoreOrderScrm order:orders){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ErpOrderQueryRequert request=new ErpOrderQueryRequert(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                request.setSo_id(order.getOrderCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (erpOrderService != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    OrderQueryResponseDTO mergeOrder = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        mergeOrder = erpOrderService.getMergeOrder(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Thread.sleep(2000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.error("调用ERP接口异常:",e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } catch (Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //throw new RuntimeException(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (erpOrderService == jSTOrderService) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (mergeOrder != null && mergeOrder.getOrders() != null && mergeOrder.getOrders().size() > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            List<OrderQueryResponseDTO.Order> collect = mergeOrder.getOrders() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .filter(s -> s.getIsMerge() != null && s.getIsMerge()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            OrderQueryResponseDTO.Order order1 = collect.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (order1 != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                List<OrderQueryResponseDTO.OrderPay> pays = order1.getPays(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (pays != null && !pays.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    pays.forEach(pay -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        FsStoreOrderScrm fsStoreOrderScrm = fsStoreOrderScrmMapper.selectFsStoreOrderByOrderCode(pay.getOuterPayId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        FsStoreOrderScrm map = new FsStoreOrderScrm(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        map.setIsMerge(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        map.setExtendOrderId(pay.getOId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        map.setId(fsStoreOrderScrm.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        fsStoreOrderScrmMapper.updateFsStoreOrder(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void deliveryOp() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IErpOrderService erpOrderService = getErpService(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<FsStoreOrder> orders = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (erpOrderService == gyOrderService){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -647,13 +883,14 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for(FsStoreOrder order:orders){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ErpOrderQueryRequert request=new ErpOrderQueryRequert(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ErpOrderQueryRequert request = new ErpOrderQueryRequert(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             request.setCode(order.getExtendOrderId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (erpOrderService != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ErpOrderQueryResponse response= null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     response=erpOrderService.getOrder(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Thread.sleep(1000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Thread.sleep(2000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     logger.error("调用ERP接口异常:",e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     try { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -672,7 +909,7 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 for(ErpDeliverys delivery:orderQuery.getDeliverys()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     if(delivery.getDelivery()&& StringUtils.isNotEmpty(delivery.getMail_no())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         //更新商订单状态 删除REDIS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        fsStoreOrderService.deliveryOrder(order.getOrderCode(),delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        fsStoreOrderService.deliveryOrder(order.getOrderCode(),delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name(),delivery.getSend_date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         redisCache.deleteObject("delivery"+":"+order.getExtendOrderId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -699,8 +936,9 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (erpOrderService != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ErpOrderQueryResponse response= null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Thread.sleep(2000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     response = erpOrderService.getScrmOrder(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Thread.sleep(1000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Thread.sleep(2000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     logger.error("调用ERP接口异常:",e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     try { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -717,9 +955,10 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             if(orderQuery.getDeliverys()!=null&&orderQuery.getDeliverys().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 for(ErpDeliverys delivery:orderQuery.getDeliverys()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     if(delivery.getDelivery()&& StringUtils.isNotEmpty(delivery.getMail_no())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         logger.info("调用erp获取订单详情接口:"+response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         //更新商订单状态 删除REDIS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        fsStoreOrderService.deliveryOrderScrm(order.getOrderCode(),delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        fsStoreOrderService.deliveryOrderScrm(order.getOrderCode(),delivery.getMail_no(),delivery.getExpress_code(),delivery.getExpress_name(),delivery.getSend_date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         redisCache.deleteObject("delivery"+":"+order.getExtendOrderId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -781,7 +1020,7 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (Long l : omsList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 fsStoreOrderService.createOmsOrder(l); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Thread.sleep(1000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Thread.sleep(2000); // 1000毫秒 = 1秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 logger.error("推送订单异常:",e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 continue; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1596,5 +1835,23 @@ public class Task { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //用户信息采集 自动退款 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    void autoRefund(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FsUserInformationCollection> collections = userInformationCollectionMapper.selectAutoRefundOrderCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtil.isNotEmpty(collections)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(FsUserInformationCollection collection :collections) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    userInformationCollectionService.autoRefund(collection); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Thread.sleep(2000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.info("自动退款失败,订单号:{}", collection.getPackageOrderCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //throw new RuntimeException(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |