|
|
@@ -109,6 +109,8 @@ import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static java.util.stream.Collectors.groupingBy;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 清表基础数据表 控制器
|
|
|
@@ -5222,32 +5224,39 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data(query);
|
|
|
}
|
|
|
|
|
|
+ @Scheduled(cron = "0 0 23 * * ?")
|
|
|
@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+"个节点");
|
|
|
+ public void checkAllNodeDate() throws Exception {
|
|
|
+ String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
+ if (sys_isonline.equals("20")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String deleteSql="delete from m_is_data_complete";
|
|
|
+ jdbcTemplate.execute(deleteSql);
|
|
|
+ String insertSql="INSERT INTO m_is_data_complete (p_key_id) SELECT DISTINCT p_key_id FROM m_wbs_tree_contract WHERE date_is_complete = 2";
|
|
|
+ jdbcTemplate.execute(insertSql);
|
|
|
+ String updateSql="update m_wbs_tree_contract set date_is_complete=1 where is_deleted=0 and type=1";
|
|
|
+ jdbcTemplate.update(updateSql);
|
|
|
+ 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 and is_buss_show!=2";
|
|
|
+ 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){
|
|
|
- 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+"个节点未检查");
|
|
|
+ if(query.isEmpty()){
|
|
|
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){
|
|
|
@@ -5266,7 +5275,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){
|
|
|
@@ -5274,11 +5286,18 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- wbsTreeContractService.checkNodeAllDate(parent);
|
|
|
- i--;
|
|
|
- System.out.println("剩余:"+i+"个节点未检查");
|
|
|
+ if(!flag){
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|