|
@@ -649,13 +649,14 @@ public class WbsSynchronousServiceImpl {
|
|
|
List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(wrapperContract);
|
|
|
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<>();
|
|
|
//查询质检合同节点填表信息
|
|
|
- String sql = "SELECT b.wbs_id, b.STATUS FROM" +
|
|
|
- "( SELECT p_key_id FROM m_wbs_tree_contract WHERE is_deleted = 0 AND contract_id = " + contractInfo.getId() + " AND FIND_IN_SET( " + wbsTreeContract.getPKeyId() + ", ancestors_p_id ) ) a" +
|
|
|
- " INNER JOIN ( SELECT c.wbs_id, c.STATUS FROM u_information_query c" +
|
|
|
+ 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 ) b ON a.p_key_id = b.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));
|
|
|
//质检节点填报信息
|
|
@@ -665,6 +666,9 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//合同段节点对应的项目id
|
|
|
List<Long> typePrivateIds = wbsTreeContracts.stream().map(WbsTreeContract::getIsTypePrivatePid).collect(Collectors.toList());
|
|
|
|
|
@@ -696,26 +700,37 @@ public class WbsSynchronousServiceImpl {
|
|
|
switch (Integer.valueOf(wbsTreePrivate.getWbsType())) {
|
|
|
//质检
|
|
|
case 1:
|
|
|
+ //判断是否已保存
|
|
|
+ if(StringUtils.isEmpty(editContractNode.getInitTableName())){
|
|
|
+ throw new ServiceException(wbsTreeContract.getNodeName() + "--实体表不存在");
|
|
|
+ }
|
|
|
+ String isSave = "select count(0) from " + editContractNode.getInitTableName() + " where p_key_id = " + editContractNode.getPKeyId();
|
|
|
+ Integer i = jdbcTemplate.queryForObject(isSave, Integer.class);
|
|
|
+
|
|
|
+ //判断是否上报审批
|
|
|
Integer submit = informationQueryMap.get(editContractNode.getPKeyId());
|
|
|
|
|
|
if (submit == null && contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) {
|
|
|
- //未审批 101
|
|
|
+ //未填报 101
|
|
|
isSync = true;
|
|
|
} else {
|
|
|
- if (submit == null) {
|
|
|
- throw new ServiceException(wbsTreeContract.getNodeName() + "--下表单未查到填报信息");
|
|
|
+ if (i == 0) {
|
|
|
+ throw new ServiceException(editContractNode.getNodeName() + "--表单未查到填报信息");
|
|
|
}
|
|
|
- if (submit == 0 && contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code)) {
|
|
|
+ if (contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code)) {
|
|
|
//已填报-未上报 102
|
|
|
isSync = true;
|
|
|
- } else if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
- //待审批 104
|
|
|
- isSync = true;
|
|
|
- isOldHtml = true;
|
|
|
- } else if (submit == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code)) {
|
|
|
- //已审批 105
|
|
|
- isSync = true;
|
|
|
- isOldHtml = true;
|
|
|
+ } else {
|
|
|
+ if (submit == null) {
|
|
|
+ throw new ServiceException(wbsTreeContract.getNodeName() + "--下表单未查到上报信息");
|
|
|
+ }
|
|
|
+ if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
+ //待审批 104
|
|
|
+ isSync = true;
|
|
|
+ } else if (submit == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code)) {
|
|
|
+ //已审批 105
|
|
|
+ isSync = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
break;
|