|
@@ -26,7 +26,9 @@ import org.springblade.common.utils.FileUtils;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springblade.core.redis.cache.BladeRedis;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.bean.NodeVO;
|
|
@@ -75,6 +77,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(WbsTreeContractServiceImpl.class);
|
|
|
+ private final BladeRedis bladeRedis;
|
|
|
private final ConstructionLedgerFeignClient constructionLedgerFeign;
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
@@ -119,6 +122,14 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
@Override
|
|
|
public boolean submitWbsTreeInContract(WbsTreeContractDTO pawDTO) {
|
|
|
+ /*加锁*/
|
|
|
+ String redisValue = bladeRedis.get("submit-wbs-contract:" + pawDTO.getContractId());
|
|
|
+ if (StringUtils.isNotEmpty(redisValue) && redisValue.equals("1")) {
|
|
|
+ throw new ServiceException("请勿重复提交,请60秒后再尝试");
|
|
|
+ }
|
|
|
+ bladeRedis.set("submit-wbs-contract:" + pawDTO.getContractId(), "1");
|
|
|
+ bladeRedis.expire("submit-wbs-contract:" + pawDTO.getContractId(), 60);
|
|
|
+
|
|
|
String wbsTreeIds = pawDTO.getWbsTreeIds();
|
|
|
String[] ids = wbsTreeIds.split(",");
|
|
|
//项目对应到合同段的入参节点ids
|
|
@@ -146,7 +157,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
List<String> saveIds = idList1.stream().filter(f -> !finalNowContractNodeIds.contains(f)).collect(Collectors.toList());
|
|
|
List<String> delIds = finalNowContractNodeIds.stream().filter(f -> !idList1.contains(f)).collect(Collectors.toList());
|
|
|
|
|
|
- //TODO ---------节点未变只同步元素表---------
|
|
|
+ // ================= 节点未变只同步元素表 =================
|
|
|
if (saveIds.size() == 0 && delIds.size() == 0) {
|
|
|
//当前项目所有原始表(从公有树到项目私有树同步后的,或是私有到私有的)
|
|
|
List<WbsTreePrivate> nowProjectTabs = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
|
|
@@ -274,7 +285,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- //TODO ---------删除---------
|
|
|
+ // ================= 删除 =================
|
|
|
if (delIds.size() > 0) {
|
|
|
List<ContractRelationJlyz> contractRelationJLYZList = baseMapper.selectContractRelationInfoByidSG2(pawDTO.getContractId());
|
|
|
if (contractRelationJLYZList.size() > 0) {
|
|
@@ -301,7 +312,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
baseMapper.deleteBatch(ids1, pawDTO.getWbsId(), pawDTO.getProjectId(), pawDTO.getContractId());
|
|
|
}
|
|
|
|
|
|
- //TODO ---------新增---------
|
|
|
+ // ================= 新增 =================
|
|
|
if (saveIds.size() > 0) {
|
|
|
ArrayList<ConstructionLedger> constructionLedgerList = new ArrayList<>();
|
|
|
List<WbsTreePrivate> wbsTreePrivatesList = wbsTreePrivateMapper.selectNodeAndTable2(pawDTO.getWbsId(), pawDTO.getProjectId());
|
|
@@ -2276,30 +2287,4 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- /*删除合同段本地缓存*/
|
|
|
- public void deleteContractLocalCache(String contractId) {
|
|
|
- /*删除节点缓存*/
|
|
|
- localCacheNodes.remove(contractId);
|
|
|
-
|
|
|
- /*删除资料缓存*/
|
|
|
- Iterator<Map.Entry<String, List<WbsTreeContractLazyQueryInfoVO>>> iterator_1 = localCacheQueryInfos.entrySet().iterator();
|
|
|
- while (iterator_1.hasNext()) {
|
|
|
- Map.Entry<String, List<WbsTreeContractLazyQueryInfoVO>> entry = iterator_1.next();
|
|
|
- String cacheKey = entry.getKey();
|
|
|
- if (cacheKey.startsWith(contractId + "_")) {
|
|
|
- iterator_1.remove();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /*删除节点计算统计缓存*/
|
|
|
- Iterator<Map.Entry<String, List<WbsTreeContractLazyVO>>> iterator_2 = localCacheParentCountNodes.entrySet().iterator();
|
|
|
- while (iterator_2.hasNext()) {
|
|
|
- Map.Entry<String, List<WbsTreeContractLazyVO>> entry = iterator_2.next();
|
|
|
- String cacheKey = entry.getKey();
|
|
|
- if (cacheKey.startsWith(contractId + "_")) {
|
|
|
- iterator_2.remove();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|