|
@@ -1,25 +1,32 @@
|
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
+import org.springblade.manager.feign.WbsTreeContractOldHtmlClient;
|
|
|
import org.springblade.manager.mapper.TextdictInfoMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreeContractMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreeSynchronousRecordMapper;
|
|
|
+import org.springblade.manager.service.WbsTreeContractOldHtmlService;
|
|
|
+import org.springblade.manager.utils.FileUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.StandardCopyOption;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static org.springblade.core.secure.utils.AuthUtil.getUser;
|
|
|
+
|
|
|
/**
|
|
|
* @author LHB
|
|
|
*/
|
|
@@ -40,6 +47,9 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
@Autowired
|
|
|
private ElementFormulaMappingServiceImpl elementFormulaMappingService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WbsTreeContractOldHtmlService wbsTreeContractOldHtmlService;
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateTextDictInfo(Long projectId, List<Long> editPrivateIds, List<TextdictInfo> addData) {
|
|
|
//删除 需要新增的节点的电签和默认值
|
|
@@ -154,7 +164,7 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateContract(String type, Long pId, Long createUserId, List<WbsTreeContract> list) {
|
|
|
+ public void updateContract(String type, Long pId, Long createUserId, List<WbsTreeContract> list, List<WbsTreeContract> wbsTreeContracts) {
|
|
|
//排序调整
|
|
|
if (type.contains("7")) {
|
|
|
list.sort(Comparator.comparingInt(WbsTreeContract::getSort));
|
|
@@ -202,6 +212,42 @@ public class WbsSynchronousEViSaServiceImpl {
|
|
|
wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //处理html 复制之后记录在新表中w
|
|
|
+ if (CollectionUtils.isNotEmpty(wbsTreeContracts)) {
|
|
|
+ List<WbsTreeContractOldHtml> data = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ for (WbsTreeContract wbsTreeContract : wbsTreeContracts) {
|
|
|
+ //如果有历史记录 并且状态为0 则不记录当前历史记录
|
|
|
+ long count = wbsTreeContractOldHtmlService.count(Wrappers.<WbsTreeContractOldHtml>lambdaQuery()
|
|
|
+ .eq(WbsTreeContractOldHtml::getContractFormId, wbsTreeContract.getPKeyId())
|
|
|
+ .eq(WbsTreeContractOldHtml::getIsDeleted, 0));
|
|
|
+ if(count > 0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ WbsTreeContractOldHtml oldHtml = new WbsTreeContractOldHtml();
|
|
|
+ oldHtml.setId(SnowFlakeUtil.getId());
|
|
|
+ oldHtml.setCreateUser(getUser().getUserId());
|
|
|
+ String htmlUrl = wbsTreeContract.getHtmlUrl();
|
|
|
+ // 获取或下载文件
|
|
|
+ Path sourcePath = FileUtils.getOrDownloadFile(htmlUrl);
|
|
|
+ // 生成副本路径
|
|
|
+ Path copyPath = FileUtils.generateCopyPath(sourcePath);
|
|
|
+ // 执行复制操作(覆盖已存在的文件)
|
|
|
+ Files.copy(sourcePath, copyPath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
+
|
|
|
+ oldHtml.setContractFormId(wbsTreeContract.getPKeyId());
|
|
|
+ oldHtml.setOldHtmlUrl(copyPath.toFile().getAbsolutePath());
|
|
|
+ data.add(oldHtml);
|
|
|
+ }
|
|
|
+ wbsTreeContractOldHtmlService.saveBatch(data);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new ServiceException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|