|
@@ -387,71 +387,76 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
|
} else {
|
|
|
//首先根据wbsId获取合同段ID和项目ID
|
|
|
WbsTreeContract contractTree = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(primaryKeyId));
|
|
|
+ int type = (contractTree.getIsExpernode() == null || contractTree.getIsExpernode() <= 0) ? 1 : 2;
|
|
|
+ if (DistributedRedisLock.acquire("saveOrUpdateInformationQueryData:" + primaryKeyId + ":" + contractTree.getContractId() + ":" + classify + ":" + type,5)) {
|
|
|
+ try {
|
|
|
+ //判断当前填报节点下是否已经存在相应数据
|
|
|
+ InformationQuery oldData = this.baseMapper.getInformationQueryByWbsId(contractTree.getPKeyId(), classify,contractTree.getContractId());
|
|
|
|
|
|
- //判断当前填报节点下是否已经存在相应数据
|
|
|
- InformationQuery oldData = this.baseMapper.getInformationQueryByWbsId(contractTree.getPKeyId(), classify,contractTree.getContractId());
|
|
|
-
|
|
|
- if (oldData != null) {
|
|
|
- //存在记录,修改
|
|
|
- if (StringUtils.isNotEmpty(fileName)) {
|
|
|
- oldData.setName(fileName);
|
|
|
- }
|
|
|
-
|
|
|
- //拼接填报人信息
|
|
|
- String fileUser = userId + "-" + userNmae;
|
|
|
- if (StringUtils.isNotEmpty(oldData.getFileUserIdAndName())) {
|
|
|
- if (!oldData.getFileUserIdAndName().contains(userId.toString())) {
|
|
|
- //不包含,拼接
|
|
|
- oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
|
|
|
- }
|
|
|
- } else {
|
|
|
- oldData.setFileUserIdAndName(fileUser);
|
|
|
- }
|
|
|
-
|
|
|
- oldData.setUpdateTime(new Date());
|
|
|
- oldData.setUpdateUser(userId);
|
|
|
+ if (oldData != null) {
|
|
|
+ //存在记录,修改
|
|
|
+ if (StringUtils.isNotEmpty(fileName)) {
|
|
|
+ oldData.setName(fileName);
|
|
|
+ }
|
|
|
|
|
|
- List<String> linkIds = linkDataList.stream().map(json -> json.getString("id")).distinct().collect(Collectors.toList());
|
|
|
- if (linkIds.size() > 0) {
|
|
|
- oldData.setSjRecordIds(StringUtils.join(linkIds, ","));
|
|
|
- }
|
|
|
+ //拼接填报人信息
|
|
|
+ String fileUser = userId + "-" + userNmae;
|
|
|
+ if (StringUtils.isNotEmpty(oldData.getFileUserIdAndName())) {
|
|
|
+ if (!oldData.getFileUserIdAndName().contains(userId.toString())) {
|
|
|
+ //不包含,拼接
|
|
|
+ oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ oldData.setFileUserIdAndName(fileUser);
|
|
|
+ }
|
|
|
|
|
|
- //修改数据
|
|
|
- this.baseMapper.updateById(oldData);
|
|
|
- } else {
|
|
|
- //新增基础数据
|
|
|
- InformationQuery newData = new InformationQuery();
|
|
|
- //设置文件题名
|
|
|
- newData.setName(fileName);
|
|
|
- //设置文件类型
|
|
|
- newData.setCategory(contractTree.getNodeType());
|
|
|
- //项目ID
|
|
|
- newData.setProjectId(Long.parseLong(contractTree.getProjectId()));
|
|
|
- //合同段ID
|
|
|
- newData.setContractId(Long.parseLong(contractTree.getContractId()));
|
|
|
- //施工资料还是质检资料
|
|
|
- newData.setClassify(classify);
|
|
|
- //节点ID
|
|
|
- newData.setWbsId(contractTree.getPKeyId());
|
|
|
-
|
|
|
- //1资料填报,2试验,3首件
|
|
|
- newData.setType((contractTree.getIsExpernode() == null || contractTree.getIsExpernode() <= 0) ? 1 : 2);
|
|
|
-
|
|
|
- //流程状态,默认未上报
|
|
|
- newData.setStatus(0);
|
|
|
- //填报人ID及姓名
|
|
|
- newData.setFileUserIdAndName(userId + "-" + userNmae);
|
|
|
- //数据源类型
|
|
|
- newData.setSourceType(sourceType);
|
|
|
- newData.setCreateUser(userId);
|
|
|
- newData.setCreateTime(new Date());
|
|
|
+ oldData.setUpdateTime(new Date());
|
|
|
+ oldData.setUpdateUser(userId);
|
|
|
|
|
|
- List<String> linkIds = linkDataList.stream().map(json -> json.getString("id")).distinct().collect(Collectors.toList());
|
|
|
- if (linkIds.size() > 0) {
|
|
|
- newData.setSjRecordIds(StringUtils.join(linkIds, ","));
|
|
|
+ List<String> linkIds = linkDataList.stream().map(json -> json.getString("id")).distinct().collect(Collectors.toList());
|
|
|
+ if (linkIds.size() > 0) {
|
|
|
+ oldData.setSjRecordIds(StringUtils.join(linkIds, ","));
|
|
|
+ }
|
|
|
+ //修改数据
|
|
|
+ this.baseMapper.updateById(oldData);
|
|
|
+ } else {
|
|
|
+ //新增基础数据
|
|
|
+ InformationQuery newData = new InformationQuery();
|
|
|
+ //设置文件题名
|
|
|
+ newData.setName(fileName);
|
|
|
+ //设置文件类型
|
|
|
+ newData.setCategory(contractTree.getNodeType());
|
|
|
+ //项目ID
|
|
|
+ newData.setProjectId(Long.parseLong(contractTree.getProjectId()));
|
|
|
+ //合同段ID
|
|
|
+ newData.setContractId(Long.parseLong(contractTree.getContractId()));
|
|
|
+ //施工资料还是质检资料
|
|
|
+ newData.setClassify(classify);
|
|
|
+ //节点ID
|
|
|
+ newData.setWbsId(contractTree.getPKeyId());
|
|
|
+
|
|
|
+ //1资料填报,2试验,3首件
|
|
|
+ newData.setType(type);
|
|
|
+
|
|
|
+ //流程状态,默认未上报
|
|
|
+ newData.setStatus(0);
|
|
|
+ //填报人ID及姓名
|
|
|
+ newData.setFileUserIdAndName(userId + "-" + userNmae);
|
|
|
+ //数据源类型
|
|
|
+ newData.setSourceType(sourceType);
|
|
|
+ newData.setCreateUser(userId);
|
|
|
+ newData.setCreateTime(new Date());
|
|
|
+
|
|
|
+ List<String> linkIds = linkDataList.stream().map(json -> json.getString("id")).distinct().collect(Collectors.toList());
|
|
|
+ if (linkIds.size() > 0) {
|
|
|
+ newData.setSjRecordIds(StringUtils.join(linkIds, ","));
|
|
|
+ }
|
|
|
+ //保存数据
|
|
|
+ this.baseMapper.insert(newData);
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ DistributedRedisLock.release("saveOrUpdateInformationQueryData:" + primaryKeyId + ":" + contractTree.getContractId() + ":" + classify + ":" + type);
|
|
|
}
|
|
|
- //保存数据
|
|
|
- this.baseMapper.insert(newData);
|
|
|
}
|
|
|
}
|
|
|
return null;
|