ソースを参照

项目合同续签流程抓取前12个月的项目经营分析数据

fyz 3 ヶ月 前
コミット
6087f3ba48

+ 3 - 2
mjava-lanyun/src/main/java/com/malk/lanyun/controller/TimerController.java

@@ -310,9 +310,10 @@ public class TimerController {
      * @return
      */
     @PostMapping("getProjectAnalysisForContract")
-    public void getProjectAnalysisForContract(@RequestBody Map<String,Object> data){
+    public McR getProjectAnalysisForContract(@RequestBody Map<String,Object> data){
         log.info("开始修改单个各项目点月度经营分析");
-        timerService.getProjectAnalysisForContract(data);
+        Map projectAnalysisForContract = timerService.getProjectAnalysisForContract(data);
+        return McR.success(projectAnalysisForContract);
     }
 
 }

+ 1 - 1
mjava-lanyun/src/main/java/com/malk/lanyun/service/TimerService.java

@@ -136,5 +136,5 @@ public interface TimerService {
 
     void exportBusinessAnalysis(Map data, HttpServletResponse response, HttpServletRequest request);
 
-    void getProjectAnalysisForContract(Map<String, Object> data);
+    Map getProjectAnalysisForContract(Map<String, Object> data);
 }

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

@@ -74,13 +74,13 @@ public class SyncAssetsImpl implements SyncAssetsService {
                     if (ObjectUtil.isNotNull(formMap.get("dateField_lty0oyv9"))){
                         long buyTime = Long.parseLong(formMap.get("dateField_lty0oyv9").toString());
                         Map<String, Object> map = new HashMap<>();
-                        if (buyTime < toMonth && "否".equals(formMap.get("selectField_lu2eb47g"))){
+                        if (buyTime < toMonth){
                             DateBetween dateBetween = new DateBetween(DateUtil.date(buyTime),DateUtil.date(toMonth));
                             long months = dateBetween.betweenMonth(true) + 1;
                             if (ObjectUtil.isNotNull(formMap.get("textField_ltxyt75i"))) {
                                 map.put("numberField_m207nu7h",months);
                             }
-                            if (metValue > 0 && depreciation > 0){
+                            if (metValue > 0 && depreciation > 0 && "否".equals(formMap.get("selectField_lu2eb47g"))){
                                 log.info("metValue:"+metValue);
                                 log.info("depreciation:"+depreciation);
                                 float updateDepreciation = (metValue - depreciation) >0 ? (metValue - depreciation) : 0;

+ 15 - 12
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/TimerServiceImpl.java

@@ -2000,7 +2000,7 @@ public class TimerServiceImpl implements TimerService {
     }
 
     @Override
-    public void getProjectAnalysisForContract(Map<String, Object> data) {
+    public Map getProjectAnalysisForContract(Map<String, Object> data) {
 
         List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
                 .appType("APP_ERBDTFS82HOVBPL3NFH0")
@@ -2052,19 +2052,22 @@ public class TimerServiceImpl implements TimerService {
         List<ProjectAnalysis> analysisList = jdbcTemplate.query(sql, new ProjectAnalysisMapper());
 
         System.out.println(sql);
-
-        ydClient.operateData(YDParam.builder()
-                .appType("APP_ERBDTFS82HOVBPL3NFH0")
-                .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
-                .formInstanceId(data.get("formInstanceId").toString())
-                .useLatestVersion(true)
-                .updateFormDataJson(JSON.toJSONString(UtilMap.map("numberField_ly418zpc, numberField_ly418zq9, numberField_m60tn0xu",
-                        analysisList.get(0).getPersonCost(),analysisList.get(0).getMaterial(),analysisList.get(0).getFoldingRepair())))
-                .build(), YDConf.FORM_OPERATION.update);
+        if (ObjectUtil.isNotNull(data.get("formInstanceId"))){
+            ydClient.operateData(YDParam.builder()
+                    .appType("APP_ERBDTFS82HOVBPL3NFH0")
+                    .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
+                    .formInstanceId(data.get("formInstanceId").toString())
+                    .useLatestVersion(true)
+                    .updateFormDataJson(JSON.toJSONString(UtilMap.map("numberField_ly418zpc, numberField_ly418zq9, numberField_m60tn0xu",
+                            analysisList.get(0).getPersonCost(),analysisList.get(0).getMaterial(),analysisList.get(0).getFoldingRepair())))
+                    .build(), YDConf.FORM_OPERATION.update);
+        }
+        return UtilMap.map("numberField_ly418zpc, numberField_ly418zq9, numberField_m60tn0xu",
+                analysisList.get(0).getPersonCost(),analysisList.get(0).getMaterial(),analysisList.get(0).getFoldingRepair());
 
     }
 
-//    获取本年所有月时间戳
+    //    获取本年所有月时间戳
     public List<Long> getAllTimestamp(){
         LocalDate now = LocalDate.now();
         int currentYear = now.getYear();
@@ -2081,7 +2084,7 @@ public class TimerServiceImpl implements TimerService {
         return timestamps;
     }
 
-//    获取前12个月时间戳
+    //    获取前12个月时间戳
     public List<Long> getLastTimestamp(){
         LocalDate currentDate = LocalDate.now();
         List<Long> timestamps = new ArrayList<>();