Prechádzať zdrojové kódy

Merge branch 'test-merge' of http://219.151.181.73:3000/zhuwei/bladex into test-merge

lvy 1 týždeň pred
rodič
commit
f2b04e7cc5

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

@@ -116,6 +116,8 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import static java.util.stream.Collectors.groupingBy;
+
 
 /**
  * 清表基础数据表 控制器
@@ -1620,7 +1622,7 @@ public class ExcelTabController extends BladeController {
         //System.out.println(zikey);
         // 去掉重复的数
         Map<String, String> groupMap2 = colTitle.stream()
-                .collect(Collectors.groupingBy(ExctabCell::getTextInfo, Collectors.mapping(ExctabCell::getXys, Collectors.joining(","))));
+                .collect(groupingBy(ExctabCell::getTextInfo, Collectors.mapping(ExctabCell::getXys, Collectors.joining(","))));
 
         exctabCellService.DeletExcelByTableId(excelId + "");
 
@@ -4707,7 +4709,7 @@ public class ExcelTabController extends BladeController {
         List<TableFile> tableFiles = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableFile.class));
         List<InformationQuery> querys = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(InformationQuery.class));
 
-        Map<String, List<TableFile>> tableFileMap = tableFiles.stream().collect(Collectors.groupingBy(TableFile::getTabId));
+        Map<String, List<TableFile>> tableFileMap = tableFiles.stream().collect(groupingBy(TableFile::getTabId));
         for (InformationQuery query : querys) {
             if (query.getNodePdfUrl() == null || query.getEVisaPdfPage() == null || query.getEVisaPdfPage().equals(0) || query.getEVisaPdfSize() == null) {
                 List<TableFile> tableFiles1 = tableFileMap.get(query.getWbsId() + "");
@@ -5155,32 +5157,24 @@ public class ExcelTabController extends BladeController {
         return R.data(query);
     }
 
-    @GetMapping("/checkAllNodeDate")
-    @ApiOperationSupport(order = 43)
-    @ApiOperation(value = "检查所有表单是否填写完毕日期")
-    public R checkAllNodeDate(Long projectId,Long contractId) throws Exception {
-        //查询出当前项目或合同段下所有的表单
-        List<WbsTreeContract>list= wbsTreeContractMapper.selectListForcheckAllNodeDate(projectId,contractId);
-        //将表单通过pid分组
-        Map<Long, List<WbsTreeContract>> map = list.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
-        int i=map.size();
-        System.out.println("当前项目合同段有:"+i+"个节点");
+    @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";
+        List<WbsTreeContract> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        Map<Long, List<WbsTreeContract>> map = list.stream().collect(groupingBy(WbsTreeContract::getPId));
         for (Map.Entry<Long, List<WbsTreeContract>> entry : map.entrySet()) {
             Long pId = entry.getKey();
             WbsTreeContract parent = wbsTreeContractMapper.selectOne(new LambdaQueryWrapper<>(WbsTreeContract.class).eq(WbsTreeContract::getPKeyId, pId));
             if(parent==null){
-                i--;
-                System.out.println("剩余:"+i+"个节点未检查");
                 continue;
             }
-            String informationSql="select * from u_information_query where wbs_id="+parent.getPKeyId()+" and contract_id="+contractId+" and is_deleted=0";
+            String informationSql="select * from u_information_query where wbs_id="+parent.getPKeyId()+" and contract_id="+parent.getContractId()+" and is_deleted=0";
             List<InformationQuery> query = jdbcTemplate.query(informationSql, new BeanPropertyRowMapper<>(InformationQuery.class));
             if(query.isEmpty()||query.get(0).getStatus()!=0){
-                i--;
-                System.out.println("剩余:"+i+"个节点未检查");
                 continue;
             }
             List<WbsTreeContract> wbsTreeContractList = entry.getValue();
+            boolean flag=true;
             for (WbsTreeContract contract : wbsTreeContractList) {
                 Map<String, Object> dataInfo = excelTabService.getBussDataInfo(contract.getPKeyId(), 0, true);
                 if(dataInfo!=null){
@@ -5199,7 +5193,10 @@ public class ExcelTabController extends BladeController {
                                 }
                             }
                             if(!dateFlag){
+                                flag=false;
                                 wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,contract.getPKeyId()).set(WbsTreeContract::getDateIsComplete,2));
+                            }else {
+                                wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,contract.getPKeyId()).set(WbsTreeContract::getDateIsComplete,1));
                             }
                         }
                     }catch (Exception e){
@@ -5207,9 +5204,12 @@ public class ExcelTabController extends BladeController {
                     }
                 }
             }
-            wbsTreeContractService.checkNodeAllDate(parent);
-            i--;
-            System.out.println("剩余:"+i+"个节点未检查");
+           if(flag){
+               List<Long> longList = Func.toLongList(parent.getAncestorsPId());
+               if(!longList.isEmpty()){
+                   wbsTreeContractMapper.update(null,new LambdaUpdateWrapper<WbsTreeContract>().in(WbsTreeContract::getPKeyId,longList).set(WbsTreeContract::getDateIsComplete,2));
+               }
+           }
         }
         System.out.println("检查完毕");
         return R.status(true);