fyz 8 mēneši atpakaļ
vecāks
revīzija
d12367543b

+ 2 - 0
mjava-lanyun/src/main/java/com/malk/lanyun/schedule/NCTask.java

@@ -3,6 +3,7 @@ package com.malk.lanyun.schedule;
 import com.malk.lanyun.service.NCService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -10,6 +11,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 @Slf4j
 @Configuration
 @EnableScheduling
+@ConditionalOnProperty(name = {"spel.scheduling"})
 public class NCTask {
     @Autowired
     NCService ncService;

+ 19 - 0
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/NCServiceImpl.java

@@ -1,5 +1,6 @@
 package com.malk.lanyun.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.malk.lanyun.entity.SqlServerBean;
 import com.malk.lanyun.service.NCService;
@@ -7,6 +8,7 @@ import com.malk.server.aliwork.YDConf;
 import com.malk.server.aliwork.YDParam;
 import com.malk.service.aliwork.YDClient;
 import com.malk.utils.UtilDateTime;
+import com.malk.utils.UtilMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -38,6 +40,7 @@ public class NCServiceImpl implements NCService {
         // 获取上月年,月
         int year = lastMonth.getYear();
         String month = String.format("%02d",lastMonth.getMonthValue()) ;
+        deleteMonthDate("FORM-D7FAD41DA72041ED96431F4219F082B7DTNH","textField_m0dkzhwo", String.valueOf(year),month);
 
         Connection connection = null;
         Statement statement = null;
@@ -103,6 +106,7 @@ public class NCServiceImpl implements NCService {
         // 获取当前年
         int year = lastMonth.getYear();
         String month = String.format("%02d",lastMonth.getMonthValue()) ;
+        deleteMonthDate("FORM-EC67BCB875264EE9AE25C9D663568CAFCYU6","textField_m0dkzhwo", String.valueOf(year),month);
 
         Connection connection = null;
         Statement statement = null;
@@ -172,6 +176,7 @@ public class NCServiceImpl implements NCService {
         // 获取当前年
         int year = lastMonth.getYear();
         String month = String.format("%02d",lastMonth.getMonthValue()) ;
+        deleteMonthDate("FORM-87BF51F1E54D4D73A987939613D07BD5ZZE9","textField_m0dkzhwo", String.valueOf(year),month);
 
         Connection connection = null;
         Statement statement = null;
@@ -239,6 +244,7 @@ public class NCServiceImpl implements NCService {
         // 获取当前年
         int year = lastMonth.getYear();
         String month = String.format("%02d",lastMonth.getMonthValue()) ;
+        deleteMonthDate("FORM-5654B7C22E7546E9BBE7B4EF46DE08BAXZXU","textField_m0dkzhwo", String.valueOf(year),month);
 
         System.out.println(month);
         Connection connection = null;
@@ -307,6 +313,7 @@ public class NCServiceImpl implements NCService {
         // 获取当前年
         int year = lastMonth.getYear();
         String month = String.format("%02d",lastMonth.getMonthValue()) ;
+        deleteMonthDate("FORM-09CDC75CDC6048379567EC87ED6CE7B6T8PP","textField_m0g4itw4", String.valueOf(year),null);
 
         LocalDate firstDayOfYear = LocalDate.of(year, 1, 1);
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -365,4 +372,16 @@ public class NCServiceImpl implements NCService {
             }
         }
     }
+    private void deleteMonthDate(String formUuid,String key, String year, String month){
+        String yearAndMonth = year;
+        if (ObjectUtil.isNotNull(month)){
+            yearAndMonth = yearAndMonth + "-" + month;
+        }
+        ydClient.operateData(YDParam.builder()
+                .appType("APP_ERBDTFS82HOVBPL3NFH0")
+                .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
+                .formUuid(formUuid)
+                .formDataJson(JSON.toJSONString(UtilMap.map(key,yearAndMonth)))
+                .build(), YDConf.FORM_OPERATION.delete);
+    }
 }

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

@@ -758,9 +758,9 @@ public class TimerServiceImpl implements TimerService {
                         String projectDate = s.get("textField_luh0k82j").toString();
                         if (date.equals(projectDate)){
                             //剩余物耗定额
-                            double remaining = Double.parseDouble(s.get("numberField_lrru2tnv_value").toString());
+                            double remaining = s.get("numberField_lrru2tnv_value") == null?0f:Double.parseDouble(s.get("numberField_lrru2tnv_value").toString());
                             //已用物耗定额
-                            double used = Double.parseDouble(s.get("numberField_ludujw4f_value").toString());
+                            double used = s.get("numberField_ludujw4f_value") == null?0f:Double.parseDouble(s.get("numberField_ludujw4f_value").toString());
                             remaining = remaining - nowCost;
                             s.put("numberField_lrru2tnv",remaining);
                             used = used + nowCost;
@@ -865,8 +865,6 @@ public class TimerServiceImpl implements TimerService {
         String[] dateList = new String[2];
         dateList[0] = String.valueOf(beginOfMonth.getTime());
         dateList[1] = String.valueOf(date.getTime());
-        System.out.println(dateList);
-        //查询宜搭已存在的当月数据并删除
         List<Map> materialList = ydService.queryFormData_all(YDParam.builder()
                 .appType("APP_ERBDTFS82HOVBPL3NFH0")
                 .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")