Sfoglia il codice sorgente

自动检测日期是否填写完毕

cr 1 settimana fa
parent
commit
fc61ce817f

+ 14 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -5157,12 +5157,17 @@ public class ExcelTabController extends BladeController {
         return R.data(query);
     }
 
-    @Scheduled(cron = "0 30  4 * * ?")
-    public R checkAllNodeDate() throws Exception {
-        String sql="select * from m_wbs_tree_contract where is_deleted=0 and type=2 and date_is_complete=2 AND html_url is not null";
+    @Scheduled(cron = "0 16  18 * * ?")
+    @GetMapping("/checkAllNodeDate")
+    public void checkAllNodeDate() throws Exception {
+        String sql="select * from m_wbs_tree_contract where is_deleted=0 and type=2 and date_is_complete=2 AND html_url is not null and p_id is not null";
         List<WbsTreeContract> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
         Map<Long, List<WbsTreeContract>> map = list.stream().collect(groupingBy(WbsTreeContract::getPId));
+        int count=map.size();
+        int i=1;
+        System.out.println("开始检查"+count+"个节点");
         for (Map.Entry<Long, List<WbsTreeContract>> entry : map.entrySet()) {
+            System.out.println("检查节点:"+entry.getKey()+"已检查:"+i++);
             Long pId = entry.getKey();
             WbsTreeContract parent = wbsTreeContractMapper.selectOne(new LambdaQueryWrapper<>(WbsTreeContract.class).eq(WbsTreeContract::getPKeyId, pId));
             if(parent==null){
@@ -5205,14 +5210,18 @@ public class ExcelTabController extends BladeController {
                 }
             }
            if(flag){
-               List<Long> longList = Func.toLongList(parent.getAncestorsPId());
+               List<Long> longList = new ArrayList<>(
+                       parent.getAncestorsPId() != null ? Func.toLongList(parent.getAncestorsPId()) : new ArrayList<>()
+               );
+               if (parent.getPKeyId() != null) {
+                   longList.add(parent.getPKeyId());
+               }
                if(!longList.isEmpty()){
                    wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().in(WbsTreeContract::getPKeyId,longList).set(WbsTreeContract::getDateIsComplete,2));
                }
            }
         }
         System.out.println("检查完毕");
-        return R.status(true);
     }
 
     /**