Browse Source

添加月度定额更新新逻辑(撤场时间为上月的)

fyz 9 months ago
parent
commit
94894a9d13

+ 8 - 2
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/TimerServiceImpl.java

@@ -1,5 +1,6 @@
 package com.malk.lanyun.service.impl;
 
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
@@ -55,7 +56,8 @@ public class TimerServiceImpl implements TimerService {
      */
     @Override
     public String updateYuedudinge() {
-
+        //获取上月时间戳
+        long lastMonth = DateUtil.beginOfMonth(DateUtil.lastMonth()).getTime();
         List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
                 .appType("APP_ERBDTFS82HOVBPL3NFH0")
                 .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
@@ -64,7 +66,9 @@ public class TimerServiceImpl implements TimerService {
                 .build());
         log.info("项目点数据, {}", dataList.size());
         dataList.forEach(formData -> {
-            if (UtilMap.getString(formData, "selectField_lrn2oy4a").equals("进行中")){
+            //获取撤场时间
+            Long withdrawalTime = formData.get("dateField_lzaqu26p")==null?null:DateUtil.beginOfMonth(DateUtil.date(Long.parseLong(formData.get("dateField_lzaqu26p").toString()))).getTime();
+            if (UtilMap.getString(formData, "selectField_lrn2oy4a").equals("进行中") || (ObjectUtil.isNotNull(withdrawalTime) && lastMonth == withdrawalTime)){
                 List<Map> details = UtilMap.getList(formData, "tableField_lrru2tnq");
 //            details = details.stream().filter(item -> UtilMap.isNotBlankString(item, "dateField_lrru2tnr")).collect(Collectors.toList());
                 // 数据格式化
@@ -126,10 +130,12 @@ public class TimerServiceImpl implements TimerService {
 
     @Override
     public void updateBigOut() {
+        //获取上月月份的时间戳
         Date beginDate = DateUtil.beginOfMonth(DateUtil.lastMonth());
         String lastMonth = DateUtil.format(beginDate,"yyyy-MM");
         long beginDateTime = beginDate.getTime();
         String strLastMonth = String.valueOf(beginDateTime);
+        //获取本月时间戳
         long todayTime = DateUtil.beginOfMonth(new Date()).getTime();
         String year = DateUtil.format(DateUtil.beginOfYear(new Date()),"yyyy-MM");
         Date endDate = DateUtil.endOfMonth(DateUtil.lastMonth());