|
@@ -635,6 +635,23 @@ public class WbsSynchronousServiceImpl {
|
|
|
//不能抛异常 不然就会中止程序 开发阶段先抛异常,后续统一处理
|
|
|
throw new ServiceException("当前节点不存在");
|
|
|
}
|
|
|
+
|
|
|
+ //获取所有表单的父节点
|
|
|
+ List<Long> pIds = startContacts.stream().filter(f -> f.getType() == 2).map(WbsTreeContract::getPId).collect(Collectors.toList());
|
|
|
+ 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 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());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (WbsTreeContract wbsTreeContract : startContacts) {
|
|
|
//获取合同 当前节点的所有子节点数据
|
|
|
LambdaQueryWrapper<WbsTreeContract> wrapperContract = Wrappers.lambdaQuery();
|
|
@@ -648,20 +665,7 @@ public class WbsSynchronousServiceImpl {
|
|
|
List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(wrapperContract);
|
|
|
wbsTreeContracts.add(wbsTreeContract);
|
|
|
|
|
|
- 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" +
|
|
|
- " 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";
|
|
|
-
|
|
|
- List<InformationQuery> informationQueries = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
- //质检节点填报信息
|
|
|
|
|
|
- for (InformationQuery informationQuery : informationQueries) {
|
|
|
- informationQueryMap.put(informationQuery.getWbsId(), informationQuery.getStatus());
|
|
|
- }
|
|
|
|
|
|
|
|
|
//合同段节点对应的项目id
|
|
@@ -691,16 +695,24 @@ 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) {
|
|
|
+ if (submit == null || i == 0) {
|
|
|
throw new ServiceException(wbsTreeContract.getNodeName() + "--下表单未查到填报信息");
|
|
|
}
|
|
|
- if (submit == 0 && contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code)) {
|
|
|
+ if (i > 0 && contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code)) {
|
|
|
//已填报-未上报 102
|
|
|
isSync = true;
|
|
|
} else if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|