Sfoglia il codice sorgente

资产档案计提数和净值做NC和宜搭更新的区分
出差单同行人未同步
项目点档案月度定额匹配问题修复

fyz 3 mesi fa
parent
commit
5192c2903c

+ 1 - 1
mjava-lanyun/src/main/java/com/malk/lanyun/controller/TLYController.java

@@ -45,7 +45,7 @@ public class TLYController {
         log.info("推送审批, {} {}", type, processInstanceId);
         // OA组件name, 匹配宜搭组件ID
         if ("出差".equals(type)) {
-            Map<String, String> compsId_main = UtilMap.map("出差类型, 预算, 出差天数, 出差事由, 出差备注", "textField_lygo4abp, numberField_lygo9owt, numberField_lygo4abs, textareaField_lygo9owv, textareaField_lygo9ox1");
+            Map<String, String> compsId_main = UtilMap.map("出差类型, 预算, 出差天数, 出差事由, 出差备注, 同行人", "textField_lygo4abp, numberField_lygo9owt, numberField_lygo4abs, textareaField_lygo9owv, textareaField_lygo9ox1, employeeField_lygo9ox2");
             Map<String, String> compsId_itinerary = UtilMap.map("交通工具, 单程往返, 出发城市, 目的城市, 开始时间, 结束时间, 时长", "textField_lygo9oww, textField_lygo9owx, textField_lygo9owy, textField_lygo9owz, textField_lygvu31i, textField_lygvu31j, numberField_lygo9ox0");
             compsId_main.put("出差明细", "tableField_lygo9owu"); // 子表组件
             syncYD(processInstanceId, "FORM-210DA087671044F8A5CD72F0E9E89060SZ8Q", compsId_main, compsId_itinerary, "itinerary");

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

@@ -76,6 +76,12 @@ public class TimerController {
         return McR.success();
     }
 
+    @RequestMapping("ncTest")
+    McR ncTest(@RequestBody Map data) {
+        ncService.getByMonth(data);
+        return McR.success();
+    }
+
     /**
      * 采购订单导出excel
      * @param data 前端传入数据
@@ -192,9 +198,9 @@ public class TimerController {
      * @param
      */
     @PostMapping("updateDailyPrice")
-    void updateDailyPrice(String formInstId){
+    void updateDailyPrice(@RequestBody Map<String,Object> data){
         log.info("进入更新获取首条供应商价目表单价方法");
-        timerService.updateDailyPrice(formInstId);
+        timerService.updateDailyPrice(data.get("formInstId").toString());
     }
 
     @Autowired

+ 6 - 0
mjava-lanyun/src/main/java/com/malk/lanyun/service/NCService.java

@@ -1,5 +1,9 @@
 package com.malk.lanyun.service;
 
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.Map;
+
 public interface NCService {
 
 
@@ -23,4 +27,6 @@ public interface NCService {
     void getProjectOperate();
 
     void ncToYiDa();
+
+    void getByMonth(@RequestBody Map data);
 }

File diff suppressed because it is too large
+ 601 - 3
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/NCServiceImpl.java


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

@@ -71,29 +71,35 @@ public class SyncAssetsImpl implements SyncAssetsService {
                     int count = UtilMap.getInt((Map) formMap,"numberField_lutjo2dt");
                     long toMonth = DateUtil.beginOfMonth(new Date()).getTime();
                     //购入日期
-                    long buyTime = Long.parseLong(formMap.get("dateField_lty0oyv9").toString());
-                    if (metValue > 0 && depreciation > 0 && buyTime < toMonth){
-                        log.info("metValue:"+metValue);
-                        log.info("depreciation:"+depreciation);
-                        float updateDepreciation = (metValue - depreciation) >0 ? (metValue - depreciation) : 0;
-                        if (ObjectUtil.isNotEmpty(formMap.get("dateField_lty0oyva"))){
-                            //折旧截止日
-                            long endTime = Long.parseLong(formMap.get("dateField_lty0oyva").toString());
-                            String endDate = DateUtil.date(endTime).toString("yyyy-MM");
-                            long parseTime = DateUtil.beginOfMonth(DateUtil.parse(endDate, "yyyy-MM")).getTime();
-                            if (toMonth <= parseTime){
-                                count = count + 1;
+                    if (ObjectUtil.isNotNull(formMap.get("dateField_lty0oyv9"))){
+                        long buyTime = Long.parseLong(formMap.get("dateField_lty0oyv9").toString());
+                        if (metValue > 0 && depreciation > 0 && buyTime < toMonth){
+                            log.info("metValue:"+metValue);
+                            log.info("depreciation:"+depreciation);
+                            float updateDepreciation = (metValue - depreciation) >0 ? (metValue - depreciation) : 0;
+                            if (ObjectUtil.isNotEmpty(formMap.get("dateField_lty0oyva"))){
+                                //折旧截止日
+                                long endTime = Long.parseLong(formMap.get("dateField_lty0oyva").toString());
+                                String endDate = DateUtil.date(endTime).toString("yyyy-MM");
+                                long parseTime = DateUtil.beginOfMonth(DateUtil.parse(endDate, "yyyy-MM")).getTime();
+                                if (toMonth <= parseTime){
+                                    count = count + 1;
+                                }
                             }
-                        }
-                        DateBetween dateBetween = new DateBetween(DateUtil.date(buyTime),DateUtil.date(toMonth));
-                        long months = dateBetween.betweenMonth(true) + 1;
-                        // 更新
+                            DateBetween dateBetween = new DateBetween(DateUtil.date(buyTime),DateUtil.date(toMonth));
+                            long months = dateBetween.betweenMonth(true) + 1;
+                            Map<String, Object> map = UtilMap.map("numberField_lu2ejqd4, numberField_lutjo2dt, numberField_m207nu7h", updateDepreciation, count, months);
+                            if (ObjectUtil.isNotNull(formMap.get("textField_ltxyt75i")) && "同步成功".equals(formMap.get("textField_ltxyt75i"))) {
+                                map = UtilMap.map("numberField_m207nu7h",months);
+                            }
+                            // 更新
                         ydClient.operateData(YDParam.builder()
                                 .appType("APP_ERBDTFS82HOVBPL3NFH0")
                                 .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
                                 .formInstanceId((String) dataItem.get("formInstanceId"))
-                                .updateFormDataJson(JSON.toJSONString(UtilMap.map("numberField_lu2ejqd4, numberField_lutjo2dt, numberField_m207nu7h",updateDepreciation,count,months)))
+                                .updateFormDataJson(JSON.toJSONString(map))
                                 .build(), YDConf.FORM_OPERATION.update);
+                        }
                     }
                 }
             });

+ 49 - 42
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/TimerServiceImpl.java

@@ -30,6 +30,7 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -68,6 +69,8 @@ public class TimerServiceImpl implements TimerService {
     @Autowired
     private DDClient_Personnel ddClientPersonnel;
 
+    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
     /**
      * 月度定额更新
      */
@@ -83,64 +86,68 @@ public class TimerServiceImpl implements TimerService {
                 .build());
         log.info("项目点数据, {}", dataList.size());
         dataList.forEach(formData -> {
-            //获取撤场时间
-            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");
+//            if("PM00411".equals(UtilMap.getString(formData, "textField_ltxrn8h1"))){
+
+                //获取撤场时间
+                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());
-                // 数据格式化
+                    // 数据格式化
 //            details.forEach(row -> {
 //                row.put("textField_luh0k82j", UtilDateTime.format(new Date(UtilMap.getLong(row, "dateField_lrru2tnr")), "yyyy-MM"));
 //            }
 //            });
 //            Collections.sort(details, Comparator.comparingLong(o -> UtilMap.getLong(o, "dateField_lrru2tnr")));
 
-                // 查找当月数据
-                LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
+                    // 查找当月数据
+                    LocalDateTime currentDate = UtilDateTime.firstDayOfLastMonth(LocalDateTime.now());
 //            LocalDateTime currentDate = UtilDateTime.parseLocalDateTime("2024-07-01 00:00:00");
 
-                try {
-                    Optional optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(currentDate) == UtilMap.getLong(item, "dateField_lrru2tnr")).findAny();
-                    log.info("上个月数据, {}, {}", currentDate, optional);
-                    if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") != 0f) {
-                        return;
-                    }
+                    try {
+                        Optional optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(currentDate) == UtilMap.getLong(item, "dateField_lrru2tnr") || (currentDate.getYear() +"-"+ String.format("%02d", currentDate.getMonthValue())).equals(UtilMap.getString(item,"textField_luh0k82j"))).findAny();
+                        log.info("上个月数据, {}, {}", currentDate, optional);
+                        if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
+                            return;
+                        }
 
-                    LocalDateTime lastMonthDate = UtilDateTime.firstDayOfLastMonth(currentDate);
+                        LocalDateTime lastMonthDate = UtilDateTime.firstDayOfLastMonth(currentDate);
 //            LocalDateTime lastMonthDate = UtilDateTime.parseLocalDateTime("2024-06-01 00:00:00");
-                    Map currentRow = (Map) optional.get();
-                    optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(lastMonthDate) == UtilMap.getLong(item, "dateField_lrru2tnr")).findAny();
-                    log.info("上上月数据, {}, {}", lastMonthDate, optional);
-
-                    float price;
-                    if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
-                        price = UtilMap.getFloat(currentRow, "numberField_lrru2tns");
-                        currentRow.put("numberField_lrru2tnz", price); // 取本月收入定额
-                    } else {
-                        price = UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz");
-                        currentRow.put("numberField_lrru2tnz", price); // 取上月收入预估
-                    }
-                    //明细合计
-                    currentRow.put("numberField_lryopn7o", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
-                    currentRow.put("numberField_m1hhyqiv", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
+                        Map currentRow = (Map) optional.get();
+                        optional = details.stream().filter(item -> UtilDateTime.getLocalDateTimeTimeStamp(lastMonthDate) == UtilMap.getLong(item, "dateField_lrru2tnr") || (currentDate.getYear() +"-"+ String.format("%02d", currentDate.getMonthValue())).equals(UtilMap.getString(item,"textField_luh0k82j"))).findAny();
+                        log.info("上上月数据, {}, {}", lastMonthDate, optional);
+
+                        float price;
+                        if (!optional.isPresent() || UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz") == 0f) {
+                            price = UtilMap.getFloat(currentRow, "numberField_lrru2tns");
+                            currentRow.put("numberField_lrru2tnz", price); // 取本月收入定额
+                        } else {
+                            price = UtilMap.getFloat((Map) optional.get(), "numberField_lrru2tnz");
+                            currentRow.put("numberField_lrru2tnz", price); // 取上月收入预估
+                        }
+                        //明细合计
+                        currentRow.put("numberField_lryopn7o", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
+                        currentRow.put("numberField_m1hhyqiv", UtilMap.getFloat(currentRow, "numberField_lrru2tnz") + UtilMap.getFloat(currentRow, "numberField_lrru2to0") + UtilMap.getFloat(currentRow, "numberField_lrru2to1"));
 
-                    price += UtilMap.getFloat(formData, "numberField_lutjev0u");
-                    log.info("price, {}", price);
+                        price += UtilMap.getFloat(formData, "numberField_lutjev0u");
+                        log.info("price, {}", price);
 
-                    System.out.println("更新内容:" + JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)));
-                    // 合计初始化
+                        System.out.println("更新内容:" + JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)));
+                        // 合计初始化
 //            price = details.stream().map(item -> UtilMap.getFloat(item, "numberField_lrru2tnz")).collect(Collectors.toList()).stream().reduce(0f, (acc, cur) -> acc + cur);
-                    ydClient.operateData(YDParam.builder()
-                            .appType("APP_ERBDTFS82HOVBPL3NFH0")
-                            .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
-                            .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
+                        ydClient.operateData(YDParam.builder()
+                                .appType("APP_ERBDTFS82HOVBPL3NFH0")
+                                .systemToken("RRB66F91T97H1WN89QZYC47PKLZO2ZQOUMOQLP")
+                                .formInstanceId(UtilMap.getString(formData, "formInstanceId"))
 //                    .useLatestVersion(true)
-                            .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)))
-                            .build(), YDConf.FORM_OPERATION.update);
-                } catch (Exception e) {
-                    e.printStackTrace();
+                                .updateFormDataJson(JSON.toJSONString(UtilMap.map("tableField_lrru2tnq, numberField_lutjev0u", details, price)))
+                                .build(), YDConf.FORM_OPERATION.update);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
                 }
-            }
+//            }
+
         });
 
         return null;