|
@@ -4,9 +4,11 @@ import cn.hutool.core.date.DateTime;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.feign.ExcelTabClient;
|
|
import org.springblade.manager.feign.ExcelTabClient;
|
|
import org.springblade.manager.feign.WbsTreeContractOldHtmlClient;
|
|
import org.springblade.manager.feign.WbsTreeContractOldHtmlClient;
|
|
@@ -66,7 +68,7 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public void updateSyncPrivateForm(WbsTreePrivate wbsTreePrivate, List<WbsTreePrivate> collect,Long createUserId, Long id,String errorMsg) {
|
|
|
|
|
|
+ public void updateSyncPrivateForm(WbsTreePrivate wbsTreePrivate, List<WbsTreePrivate> collect, Long createUserId, Long id, String errorMsg) {
|
|
List<Long> ids = collect.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
List<Long> ids = collect.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
List<Long> parentIds = collect.stream().map(WbsTreePrivate::getParentId).collect(Collectors.toList());
|
|
List<Long> parentIds = collect.stream().map(WbsTreePrivate::getParentId).collect(Collectors.toList());
|
|
//节点公式同步
|
|
//节点公式同步
|
|
@@ -78,7 +80,7 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
.set(WbsTreePrivate::getInitTableId, wbsTreePrivate.getInitTableId())
|
|
.set(WbsTreePrivate::getInitTableId, wbsTreePrivate.getInitTableId())
|
|
.set(WbsTreePrivate::getInitTableName, wbsTreePrivate.getInitTableName())
|
|
.set(WbsTreePrivate::getInitTableName, wbsTreePrivate.getInitTableName())
|
|
.set(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
.set(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
- .set(wbsTreePrivate.getExcelId()!=null,WbsTreePrivate::getIsLinkTable, 2)
|
|
|
|
|
|
+ .set(wbsTreePrivate.getExcelId() != null, WbsTreePrivate::getIsLinkTable, 2)
|
|
.set(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId())
|
|
.set(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId())
|
|
.set(WbsTreePrivate::getUpdateTime, DateTime.now())
|
|
.set(WbsTreePrivate::getUpdateTime, DateTime.now())
|
|
.set(WbsTreePrivate::getUpdateUser, createUserId)
|
|
.set(WbsTreePrivate::getUpdateUser, createUserId)
|
|
@@ -93,7 +95,7 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public void syncPrivateForceForm(WbsTreePrivate wbsTreePrivate,Long createUserId, String nodeId, Long id) {
|
|
|
|
|
|
+ public void syncPrivateForceForm(WbsTreePrivate wbsTreePrivate, Long createUserId, String nodeId, Long id) {
|
|
WbsTreePrivate wbsTreePrivate1 = wbsTreePrivateMapper.selectById(nodeId);
|
|
WbsTreePrivate wbsTreePrivate1 = wbsTreePrivateMapper.selectById(nodeId);
|
|
|
|
|
|
wbsTreePrivateMapper.update(null, Wrappers.<WbsTreePrivate>lambdaUpdate()
|
|
wbsTreePrivateMapper.update(null, Wrappers.<WbsTreePrivate>lambdaUpdate()
|
|
@@ -101,7 +103,7 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
.set(WbsTreePrivate::getInitTableName, wbsTreePrivate.getInitTableName())
|
|
.set(WbsTreePrivate::getInitTableName, wbsTreePrivate.getInitTableName())
|
|
.set(WbsTreePrivate::getInitTableId, wbsTreePrivate.getInitTableId())
|
|
.set(WbsTreePrivate::getInitTableId, wbsTreePrivate.getInitTableId())
|
|
.set(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
.set(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
- .set(StringUtils.isBlank(wbsTreePrivate.getFullName()),WbsTreePrivate::getFullName, wbsTreePrivate1.getNodeName())
|
|
|
|
|
|
+ .set(StringUtils.isBlank(wbsTreePrivate.getFullName()), WbsTreePrivate::getFullName, wbsTreePrivate1.getNodeName())
|
|
.set(WbsTreePrivate::getNodeName, wbsTreePrivate.getNodeName())
|
|
.set(WbsTreePrivate::getNodeName, wbsTreePrivate.getNodeName())
|
|
.set(WbsTreePrivate::getUpdateTime, DateTime.now())
|
|
.set(WbsTreePrivate::getUpdateTime, DateTime.now())
|
|
.set(WbsTreePrivate::getUpdateUser, createUserId)
|
|
.set(WbsTreePrivate::getUpdateUser, createUserId)
|
|
@@ -286,9 +288,10 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 同项目下不同节点 不同的节点公式
|
|
* 同项目下不同节点 不同的节点公式
|
|
- * @param projectId 项目id
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param projectId 项目id
|
|
* @param tempParentId 源节点父级id
|
|
* @param tempParentId 源节点父级id
|
|
- * @param parentId 节点父级id
|
|
|
|
|
|
+ * @param parentId 节点父级id
|
|
*/
|
|
*/
|
|
public void saveFormula(Long projectId, Long tempParentId, Long parentId) {
|
|
public void saveFormula(Long projectId, Long tempParentId, Long parentId) {
|
|
|
|
|
|
@@ -315,4 +318,58 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
elementFormulaMappingService.saveBatch(collect1);
|
|
elementFormulaMappingService.saveBatch(collect1);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void insertContractForm(WbsTreeSynchronousRecord wbsTreeSynchronousRecord, List<WbsTreeContract> list, Long pId) {
|
|
|
|
+
|
|
|
|
+ //新增-----------------------------------------------------------------------------------------------------------------
|
|
|
|
+ //排序调整
|
|
|
|
+ if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
|
+ list.sort(Comparator.comparingInt(WbsTreeContract::getSort));
|
|
|
|
+ //获取节点下的当前表单
|
|
|
|
+ List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
+ .select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
|
+ .eq(WbsTreeContract::getPId, pId)
|
|
|
|
+ .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
|
+ .orderByAsc(WbsTreeContract::getSort));
|
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
|
+ for (int i = 0; i < resourceData.size(); i++) {
|
|
|
|
+ resourceData.get(i).setSort(i + 1);
|
|
|
|
+ }
|
|
|
|
+ //修改排序为连续排序
|
|
|
|
+ wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (WbsTreeContract wbsTreePrivate : list) {
|
|
|
|
+ wbsTreeContractMapper.updateSortByPId(pId, wbsTreePrivate.getSort());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //单个批次一个事务,只会回滚当前批次数据
|
|
|
|
+ Integer i = wbsTreeContractMapper.insertBatchSomeColumn(list);
|
|
|
|
+ //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
|
+ throw new ServiceException("添加失败:");
|
|
|
|
+ } else {
|
|
|
|
+ //排序调整
|
|
|
|
+ if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
|
+ //获取节点下的当前表单
|
|
|
|
+ List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
+ .select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
|
+ .eq(WbsTreeContract::getPId, pId)
|
|
|
|
+ .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
|
+ .orderByAsc(WbsTreeContract::getSort));
|
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
|
+ for (int j = 0; i < resourceData.size(); j++) {
|
|
|
|
+ resourceData.get(j).setSort(j + 1);
|
|
|
|
+ }
|
|
|
|
+ //修改排序为连续排序
|
|
|
|
+ wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|