|
@@ -436,7 +436,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
editPrivateNode.setInitTableName(templateNode.getInitTableName());
|
|
|
|
|
|
if (StringUtil.isBlank(templateNode.getHtmlUrl())) {
|
|
|
- throw new ServiceException(templateNode.getNodeName() + "( " + templateNode.getPKeyId() + ")HTML文件不存在");
|
|
|
+ throw new ServiceException(templateNode.getNodeName() + "( " + templateNode.getPKeyId() + ")HTML文件不存在");
|
|
|
}
|
|
|
//封装Html路径 根据模板html copy一份到自己项目节点上
|
|
|
String[] split = templateNode.getHtmlUrl().split("/");
|
|
@@ -617,7 +617,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
.eq(WbsTreePrivate::getType, 2)
|
|
|
.eq(WbsTreePrivate::getIsDeleted, 0)
|
|
|
.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreePrivate.getPKeyId());
|
|
|
- if(CollectionUtil.isNotEmpty(formList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(formList)) {
|
|
|
wrapperPrivate.in(WbsTreePrivate::getPKeyId, formList);
|
|
|
}
|
|
|
//当前项目的子节点数据
|
|
@@ -640,6 +640,20 @@ public class WbsSynchronousServiceImpl {
|
|
|
// throw new ServiceException("当前节点不存在");
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ //查询合同段下所有的填报审批信息
|
|
|
+ HashMap<Long, Integer> informationQueryMap = new HashMap<>();
|
|
|
+ //查询质检合同节点填表信息
|
|
|
+ String sql = "SELECT c.wbs_id, c.STATUS FROM u_information_query c" +
|
|
|
+ " JOIN ( SELECT wbs_id, MAX( update_time ) AS max_update_time FROM u_information_query WHERE contract_id = " + contractInfo.getId() + " GROUP BY wbs_id ) subquery ON c.wbs_id = subquery.wbs_id " +
|
|
|
+ " AND c.update_time = subquery.max_update_time WHERE c.contract_id = " + contractInfo.getId() + " and c.is_deleted = 0";
|
|
|
+
|
|
|
+ List<InformationQuery> informationQueries = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
+ //质检节点填报信息
|
|
|
+ for (InformationQuery informationQuery : informationQueries) {
|
|
|
+ informationQueryMap.put(informationQuery.getWbsId(), informationQuery.getStatus());
|
|
|
+ }
|
|
|
+
|
|
|
for (WbsTreeContract wbsTreeContract : startContacts) {
|
|
|
//获取合同 当前节点的所有子节点数据
|
|
|
LambdaQueryWrapper<WbsTreeContract> wrapperContract = Wrappers.lambdaQuery();
|
|
@@ -647,7 +661,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
.eq(WbsTreeContract::getContractId, contractInfo.getId())
|
|
|
.eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreeContract.getPKeyId());
|
|
|
- if(CollectionUtil.isNotEmpty(formList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(formList)) {
|
|
|
wrapperContract.in(WbsTreeContract::getIsTypePrivatePid, formList);
|
|
|
}
|
|
|
|
|
@@ -656,27 +670,6 @@ public class WbsSynchronousServiceImpl {
|
|
|
wbsTreeContracts.add(wbsTreeContract);
|
|
|
|
|
|
|
|
|
- //获取所有表单的父节点
|
|
|
- List<Long> pIds = wbsTreeContracts.stream().filter(f -> f.getType() == 2).map(WbsTreeContract::getPId).collect(Collectors.toList());
|
|
|
- HashMap<Long, Integer> informationQueryMap = new HashMap<>();
|
|
|
- if(CollectionUtil.isNotEmpty(pIds)){
|
|
|
- //查询质检合同节点填表信息
|
|
|
- String sql = "SELECT c.wbs_id, c.STATUS FROM u_information_query c" +
|
|
|
- " JOIN ( SELECT wbs_id, MAX( update_time ) AS max_update_time FROM u_information_query WHERE contract_id = " + contractInfo.getId() + " GROUP BY wbs_id ) subquery ON c.wbs_id = subquery.wbs_id " +
|
|
|
- " AND c.update_time = subquery.max_update_time WHERE c.contract_id = " + contractInfo.getId() + " and c.is_deleted = 0 and c.wbs_id in(" + StringUtil.join(pIds,",") +")";
|
|
|
-
|
|
|
- List<InformationQuery> informationQueries = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
- //质检节点填报信息
|
|
|
-
|
|
|
- for (InformationQuery informationQuery : informationQueries) {
|
|
|
- informationQueryMap.put(informationQuery.getWbsId(), informationQuery.getStatus());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//合同段节点对应的项目id
|
|
|
List<Long> typePrivateIds = wbsTreeContracts.stream().map(WbsTreeContract::getIsTypePrivatePid).collect(Collectors.toList());
|
|
|
|
|
@@ -704,7 +697,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
//质检
|
|
|
case 1:
|
|
|
//判断是否已保存
|
|
|
- if(StringUtils.isEmpty(editContractNode.getInitTableName())){
|
|
|
+ if (StringUtils.isEmpty(editContractNode.getInitTableName())) {
|
|
|
throw new ServiceException(editContractNode.getNodeName() + "( " + editContractNode.getPKeyId() + ")--实体表不存在");
|
|
|
}
|
|
|
String isSave = "select count(0) from " + editContractNode.getInitTableName() + " where p_key_id = " + editContractNode.getPKeyId();
|
|
@@ -729,7 +722,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
if (submit == null) {
|
|
|
isSync = false;
|
|
|
errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未上报;");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
//待审批 104
|
|
|
isSync = true;
|
|
@@ -765,7 +758,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//清表 公式 元素
|
|
|
if (collect.contains(2) || collect.contains(3) || collect.contains(5)) {
|
|
|
- if(collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)){
|
|
|
+ if (collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)) {
|
|
|
errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未配置清表;");
|
|
|
continue;
|
|
|
}
|
|
@@ -819,18 +812,16 @@ public class WbsSynchronousServiceImpl {
|
|
|
Set<Long> longs = collect1.keySet();
|
|
|
for (Long aLong : longs) {
|
|
|
Integer status = informationQueryMap.get(aLong);
|
|
|
- if(status == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
//已填报 并且勾选了已填报-未上报;状态未待审批并且勾选了待审批;状态为已审批并且勾选了已审批
|
|
|
- if((status == 0 && contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code)) ||
|
|
|
- (status == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) ||
|
|
|
- (status == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code))){
|
|
|
+ if ((status == null && contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) ||
|
|
|
+ (status != null && status == 0 && contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code)) ||
|
|
|
+ (status != null && status == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) ||
|
|
|
+ (status != null && status == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code))) {
|
|
|
//这就是要新增的数据
|
|
|
addData.addAll(collect1.get(aLong));
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
addData.addAll(list);
|
|
|
}
|
|
|
|
|
@@ -861,12 +852,12 @@ public class WbsSynchronousServiceImpl {
|
|
|
Set<Long> pIdsNew = new HashSet<>();
|
|
|
//新增数据
|
|
|
Map<Long, List<WbsTreeContract>> collect2 = addData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
- if(CollectionUtil.isNotEmpty(addData)){
|
|
|
+ if (CollectionUtil.isNotEmpty(addData)) {
|
|
|
pIdsNew.addAll(collect2.keySet());
|
|
|
}
|
|
|
//修改数据
|
|
|
Map<Long, List<WbsTreeContract>> collect1 = editData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
- if(CollectionUtil.isNotEmpty(editData)){
|
|
|
+ if (CollectionUtil.isNotEmpty(editData)) {
|
|
|
pIdsNew.addAll(collect1.keySet());
|
|
|
}
|
|
|
//计数 同步节点数量 按最小节点统计
|
|
@@ -880,7 +871,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//新增数据
|
|
|
List<WbsTreeContract> addContractNode = collect2.get(pId);
|
|
|
- if(CollectionUtil.isNotEmpty(addContractNode)){
|
|
|
+ if (CollectionUtil.isNotEmpty(addContractNode)) {
|
|
|
int i = wbsSynchronousEViSaService.insertContractForm(wbsTreeSynchronousRecord, addContractNode, pId);
|
|
|
//如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
if (i == 0) {
|
|
@@ -907,7 +898,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
|
|
|
List<WbsTreeContract> list = collect1.get(pId);
|
|
|
- if(CollectionUtil.isNotEmpty(list)){
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
//历史html 只会在更新数据的时候取记录
|
|
|
List<WbsTreeContract> oldHtmlPId = collect3.get(pId);
|
|
|
wbsSynchronousEViSaService.updateContract(wbsTreeSynchronousRecord.getType(), pId, wbsTreeSynchronousRecord.getCreateUserId(), list, oldHtmlPId);
|
|
@@ -1098,11 +1089,10 @@ public class WbsSynchronousServiceImpl {
|
|
|
HashMap<Long, Long> map = new HashMap<>();
|
|
|
|
|
|
|
|
|
-
|
|
|
//选给新增的节点赋值
|
|
|
addContractNodes.forEach(f -> {
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
- map.put(id,f.getPId());
|
|
|
+ map.put(id, f.getPId());
|
|
|
|
|
|
f.setIsTypePrivatePid(f.getPKeyId());
|
|
|
f.setPKeyId(id);
|