Browse Source

Merge remote-tracking branch 'origin/master'

lfx 7 months ago
parent
commit
40a463e5de

+ 15 - 22
mjava-lanyun/src/main/java/com/malk/lanyun/controller/TimerController.java

@@ -137,14 +137,6 @@ public class TimerController {
         return McR.success();
     }
 
-    /**
-     * 各项目点月度经营分析插入数据库
-     */
-    @GetMapping("insertAnalysisList")
-    public void insertAnalysisList(){
-        log.info("开始调用各项目分析报表插入数据库接口");
-        timerService.insertAnalysisList();
-    }
 
     /**
      * 项目点档案点编辑保存后,更新是否补充字段为是
@@ -204,22 +196,23 @@ public class TimerController {
     private FService fService;
 
     /**
-     * 蓝云, 全量同步账龄表
+     * 蓝云, 全量同步账龄表、催款函、各项目点月度经营分析插入数据库
      */
-    @GetMapping("syncAgingSchedule")
-    public McR syncAgingSchedule() {
-        log.info("全量同步账龄表");
-        fService.syncAgingSchedule();
+    @PostMapping("syncAgingSchedule")
+    public McR syncAgingSchedule(@RequestBody Map data) {
+        log.info("传入参数:{}",data);
+        String type = data.get("type").toString();
+        if ("0".equals(type)){
+            log.info("开始同步账龄表");
+            fService.syncAgingSchedule();
+        } else if ("1".equals(type)) {
+            log.info("同步催款函");
+            fService.syncCallLetters();
+        } else if ("2".equals(type)) {
+            log.info("开始调用各项目分析报表插入数据库接口");
+            timerService.insertAnalysisList();
+        }
         return McR.success();
     }
 
-    /**
-     * 蓝云, 同步催款函
-     */
-    @GetMapping("syncCallLetters")
-    public McR syncCallLetters() {
-        log.info("同步催款函");
-        fService.syncCallLetters();
-        return McR.success();
-    }
 }

+ 25 - 2
mjava-lanyun/src/main/java/com/malk/lanyun/schedule/ScheduleTask.java

@@ -1,5 +1,6 @@
 package com.malk.lanyun.schedule;
 
+import com.malk.lanyun.service.FService;
 import com.malk.lanyun.service.SyncAssetsService;
 import com.malk.lanyun.service.TimerService;
 import lombok.extern.slf4j.Slf4j;
@@ -26,6 +27,10 @@ public class ScheduleTask {
 
     @Autowired
     private SyncAssetsService syncAssetsService;
+
+    @Autowired
+    private FService fService;
+
     /**
      * 每月1日凌晨1点自动执行
      */
@@ -88,7 +93,7 @@ public class ScheduleTask {
     /**
      * 每月最后一天跑批离职人员
      */
-    @Scheduled(cron = "0 03 23 28-31 * ?")
+    @Scheduled(cron = "0 30 23 28-31 * ?")
     void SynDingLeaveOffice(){
         // 获取当前日期
         LocalDate today = LocalDate.now();
@@ -107,8 +112,8 @@ public class ScheduleTask {
      */
     @Scheduled(cron = "0 30 12 * * 5")
     public void projectUnshippedTask() {
-        timerService.projectUnshipped();
         log.info("项目点档案本周出库情况执行时间 :" + new Date());
+        timerService.projectUnshipped();
     }
 
     /**
@@ -118,4 +123,22 @@ public class ScheduleTask {
     void monthPersonnelTask(){
         timerService.monthPersonnelMatters();
     }
+    /**
+     * 每月10号上午9点同步催款函
+     */
+    @Scheduled(cron = "0 0 9 10 * ?")
+    void syncCallLettersTask(){
+        log.info("开始同步催款函");
+        fService.syncCallLetters();
+    }
+
+    /**
+     * 每天晚上22点全量同步账龄表
+     */
+    @Scheduled(cron = "0 0 22 * * ?")
+    void syncAgingTask(){
+        log.info("全量同步账龄表");
+        fService.syncAgingSchedule();
+    }
+
 }

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

@@ -16,5 +16,5 @@ public interface FService {
     /**
      * 蓝云, 同步催款函
      */
-     McR syncCallLetters();
+     void syncCallLetters();
 }

+ 8 - 12
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/FImplService.java

@@ -42,12 +42,11 @@ private YDService ydService;
      * 蓝云, 同步催款函
      */
     @Override
-    public McR syncCallLetters() {
+    public void syncCallLetters() {
         List<Map> dataList = ydService.queryFormData_all(_initLYParam()
                 .formUuid("FORM-EC785A5AB2B9432C892062823EB7C62A9NTL")
                 .searchFieldJson(JSON.toJSONString(UtilMap.map("selectField_lvituew9, radioField_m4qrz687", "正常", "否")))
                 .build());
-
         // 更新数据版本, upsert不支持版本更新
 //        if (true) {
 //            for (Map data : dataList) {
@@ -65,25 +64,23 @@ private YDService ydService;
                 .formUuid("FORM-B1425F3ECC294B858B267A806CB5AEDEFTND")
                 .build());
         log.info("同步账龄表数据, {}", dataList.size());
-        // 匹配逻辑: 客户 + 项目 + 蓝云主体【明细按照开票周期】
+        // 匹配逻辑: 客户 + 蓝云主体【明细按照开票周期】
         Map<String, Map> setMap = new HashMap();
-        Map dataMap = UtilMap.empty();
         for (Map data : dataList) {
             String kpgs = UtilMap.getString(data, "selectField_lvc9x4vo");  // 开票公司
-            String xmdbh = UtilMap.getString(data, "textField_m25j5gxk");   // 项目点编号
             String khmc = UtilMap.getString(data, "selectField_lvdojfui");  // 客户名称
-            String unique = kpgs + "_" + xmdbh + "_" + khmc;
+            String unique = kpgs + "_" + khmc;
             Map formData = UtilMap.getMap(setMap, unique); // 累计标识
-            if (!dataMap.containsKey(unique)) {
+            if (!setMap.containsKey(unique)) {
                 // 主表信息: 由 --> 至, 合计金额
                 formData = UtilMap.map("textField_m06ij3z7, textField_m06ij3z8, numberField_m06lmogz", kpgs, khmc, UtilMap.getFloat(data, "numberField_m4qrz685"));
-                List<Map> subjects = subjectList.stream().filter(item -> kpgs.equals(UtilMap.getString(item, "textField_lrintpap"))).collect(Collectors.toList());
+                List<Map> subjects = subjectList.stream().filter(item -> kpgs.equals(UtilMap.getString(item, "textField_lrintpap"))).collect(Collectors.toList()); // 精准匹配
                 if (subjects.size() == 0) {
                     continue;
                 }
                 formData.putAll(UtilMap.map("textField_m06ij3zr, textField_m06ij3zs", kpgs, UtilMap.getString(subjects.get(0), "textField_m4qrp33v")));
-                // 付款信息
-                List<Map> details = (List<Map>) UtilMap.getList(subjects.get(0), "tableField_luq9ph7m").stream().filter(item -> !"现金".equals(((Map) item).get("selectField_lt557ppq"))).collect(Collectors.toList());
+                // 付款信息, 指定主体下账号
+                List<Map> details = (List<Map>) UtilMap.getList(subjects.get(0), "tableField_luq9ph7m").stream().filter(item -> "是".equals(((Map) item).get("radioField_m4s770ep"))).collect(Collectors.toList());
                 if (details.size() > 0) {
                     // 开户行, 银行账号
                     formData.putAll(UtilMap.map("textField_m06ij3zt, textField_m06ij3zu", "textField_lrpq6es0, textField_lrpq6es1, ", details.get(0)));
@@ -108,7 +105,7 @@ private YDService ydService;
         log.info("催款函, {}", setMap.size());
         for (String unique : setMap.keySet()) {
             Map formData = UtilMap.getMap(setMap, unique);
-            formData.put("textField_m4qxo07x", unique + "_" + UtilDateTime.formatDate(new Date()));
+            formData.put("textField_m4qxo07x", unique + "_" + UtilMap.getFloat(formData, "numberField_m06lmogz"));
             ydClient.operateData(_initLYParam()
                     .formUuid("FORM-738D89FEC34740EC92B08BF6D7B9470DEQY6")
                     .processCode("TPROC--IMD665A1KDXNJ2V47QQ9UCM9I9F827DEEI60M6")
@@ -116,7 +113,6 @@ private YDService ydService;
                     .userId("396511732") // 通过宜搭平台发起的,不会有待办, 通过企业账号发送 (system)
                     .build(), YDConf.FORM_OPERATION.start);
         }
-        return McR.success();
     }