Browse Source

[深爱]获取客商数据

zxl 1 year ago
parent
commit
f85682ac54

+ 4 - 0
src/main/java/com/uas/eis/service/Impl/STKServiceImpl.java

@@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
 import javax.servlet.http.HttpServletRequest;
@@ -158,6 +159,9 @@ public class STKServiceImpl implements STKService {
 
     @Override
     public void getCustvend(TravellingMerchantVo travellingMerchantVo , Boolean isdelete) {
+        if(null == travellingMerchantVo.getData() || CollectionUtils.isEmpty(travellingMerchantVo.getData().getList())){
+            return ;
+        }
         List<CustvendDTO> custvendDTOS = travellingMerchantVo.getData().getList();
         List<String> sqls = new ArrayList<>();
         if (isdelete) {

+ 18 - 4
src/main/java/com/uas/eis/task/STKTask.java

@@ -44,7 +44,7 @@ public class STKTask {
     @Autowired
     private STKService stkService;
 
-    @Scheduled(cron = "0 30 22 * * ?")
+    @Scheduled(cron = "0 55 22 * * ?")
     public void getSellerOrders(){
         log.info("开始获取深投控客商状态信息=========start=============");
         Date date = new Date();
@@ -54,16 +54,30 @@ public class STKTask {
         dto.setPage(1);
         dto.setSize(500);
 
-        TravellingMerchantVo travellingMerchantVo =  requestSTKService.selectTravellingMerchantList(dto,COMPLEXITY_QUERY_URL);
+        TravellingMerchantVo travellingMerchantVo = new TravellingMerchantVo();
+        Boolean exception = false;
+        try{
+            travellingMerchantVo =  requestSTKService.selectTravellingMerchantList(dto,COMPLEXITY_QUERY_URL);
+        }catch (Exception e){
+            log.info("获取客商信息数据异常:{}",e.getMessage());
+            exception = true;
+        }
         log.info("定时任务获取深投控客商信息数据结果:{}", JSONObject.toJSONString(travellingMerchantVo));
         //第一次删除STK_CUSTVEND的数据
         stkService.getCustvend(travellingMerchantVo, true);
         if (travellingMerchantVo.getData().getHasNextPage()){
             Boolean isBreak = true;
             while(isBreak) {
-                dto.setPage(travellingMerchantVo.getData().getNextPage());
+                if(!exception){
+                    dto.setPage(travellingMerchantVo.getData().getNextPage());
+                }
                 log.info("while循环获取客商数据,查询参数:{}",JSONObject.toJSONString(dto));
-                travellingMerchantVo = requestSTKService.selectTravellingMerchantList(dto, COMPLEXITY_QUERY_URL);
+                try{
+                    travellingMerchantVo = requestSTKService.selectTravellingMerchantList(dto, COMPLEXITY_QUERY_URL);
+                }catch (Exception e){
+                    log.info("获取客商信息数据异常:{}",e.getMessage());
+                    exception = true;
+                }
                 stkService.getCustvend(travellingMerchantVo, false);
                 if (!travellingMerchantVo.getData().getHasNextPage() || dto.getSize() > travellingMerchantVo.getData().getEndRow()){
                     isBreak = false;