|
@@ -16,6 +16,7 @@ import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.enums.WbsSyncTypeEnum;
|
|
|
import org.springblade.manager.mapper.*;
|
|
|
+import org.springblade.manager.service.WbsTreeContractExtendService;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@@ -23,6 +24,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
@@ -74,6 +76,10 @@ public class WbsSynchronousServiceImpl {
|
|
|
@Autowired
|
|
|
private WbsTreeSynchronousRecordMapper synchronousRecordMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private WbsTreeContractExtendService wbsTreeContractExtendService;
|
|
|
+
|
|
|
+
|
|
|
@Async("taskExecutor1")
|
|
|
public void syncExecute(WbsTreeSynchronousRecord wbsTreeSynchronousRecord) {
|
|
|
// 类型枚举 WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED
|
|
@@ -852,12 +858,47 @@ public class WbsSynchronousServiceImpl {
|
|
|
Set<Long> pIdsNew = new HashSet<>();
|
|
|
//新增数据
|
|
|
Map<Long, List<WbsTreeContract>> collect2 = addData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
+ List<WbsTreeContractExtend> wbsTreeContractExtends = new ArrayList<>();
|
|
|
+ //同步的表单及祖级节点
|
|
|
if (CollectionUtil.isNotEmpty(addData)) {
|
|
|
+ addData.forEach(f -> {
|
|
|
+ WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
|
|
|
+ wbsTreeContractExtend.setPKeyId(f.getPKeyId());
|
|
|
+ wbsTreeContractExtend.setIsSync(1);
|
|
|
+ wbsTreeContractExtend.setSyncTime(DateTime.now());
|
|
|
+ wbsTreeContractExtend.setAncestors(f.getAncestorsPId());
|
|
|
+ //施工
|
|
|
+ if(Arrays.asList("1", "2", "3").contains(f.getTableOwner())){
|
|
|
+ //
|
|
|
+ wbsTreeContractExtend.setType(1);
|
|
|
+ }
|
|
|
+ //监理
|
|
|
+ if(Arrays.asList("4", "5", "6").contains(f.getTableOwner())){
|
|
|
+ wbsTreeContractExtend.setType(2);
|
|
|
+ }
|
|
|
+ wbsTreeContractExtends.add(wbsTreeContractExtend);
|
|
|
+ });
|
|
|
pIdsNew.addAll(collect2.keySet());
|
|
|
}
|
|
|
//修改数据
|
|
|
Map<Long, List<WbsTreeContract>> collect1 = editData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
if (CollectionUtil.isNotEmpty(editData)) {
|
|
|
+ editData.forEach(f -> {
|
|
|
+ WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
|
|
|
+ wbsTreeContractExtend.setPKeyId(f.getPKeyId());
|
|
|
+ wbsTreeContractExtend.setIsSync(1);
|
|
|
+ wbsTreeContractExtend.setSyncTime(DateTime.now());
|
|
|
+ //施工
|
|
|
+ if(Arrays.asList("1", "2", "3").contains(f.getTableOwner())){
|
|
|
+ //
|
|
|
+ wbsTreeContractExtend.setType(1);
|
|
|
+ }
|
|
|
+ //监理
|
|
|
+ if(Arrays.asList("4", "5", "6").contains(f.getTableOwner())){
|
|
|
+ wbsTreeContractExtend.setType(2);
|
|
|
+ }
|
|
|
+ wbsTreeContractExtends.add(wbsTreeContractExtend);
|
|
|
+ });
|
|
|
pIdsNew.addAll(collect1.keySet());
|
|
|
}
|
|
|
//计数 同步节点数量 按最小节点统计
|
|
@@ -910,6 +951,11 @@ public class WbsSynchronousServiceImpl {
|
|
|
}
|
|
|
|
|
|
System.err.println(errorMsg);
|
|
|
+
|
|
|
+ //添加记录
|
|
|
+ if(CollectionUtil.isNotEmpty(wbsTreeContractExtends)){
|
|
|
+ wbsTreeContractExtendService.saveOrUpdateBatch(wbsTreeContractExtends);
|
|
|
+ }
|
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
|
.set(WbsTreeSynchronousRecord::getStatus, 2)
|
|
|
.set(WbsTreeSynchronousRecord::getErrorMsg, null)
|