|
@@ -7,6 +7,8 @@ import io.swagger.annotations.*;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTermType;
|
|
|
|
+import org.springblade.common.utils.CommonUtil;
|
|
import org.springblade.core.cache.utils.CacheUtil;
|
|
import org.springblade.core.cache.utils.CacheUtil;
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
@@ -25,8 +27,7 @@ import org.springblade.manager.excel.WbsTreeExcel;
|
|
import org.springblade.manager.mapper.WbsInfoMapper;
|
|
import org.springblade.manager.mapper.WbsInfoMapper;
|
|
import org.springblade.manager.mapper.WbsTreeContractMapper;
|
|
import org.springblade.manager.mapper.WbsTreeContractMapper;
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
-import org.springblade.manager.service.IFormulaService;
|
|
|
|
-import org.springblade.manager.service.IWbsFormElementService;
|
|
|
|
|
|
+import org.springblade.manager.service.*;
|
|
import org.springblade.manager.vo.*;
|
|
import org.springblade.manager.vo.*;
|
|
import org.springblade.system.cache.DictCache;
|
|
import org.springblade.system.cache.DictCache;
|
|
import org.springblade.system.entity.Role;
|
|
import org.springblade.system.entity.Role;
|
|
@@ -38,7 +39,6 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
-import org.springblade.manager.service.IWbsTreeService;
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -57,6 +57,8 @@ import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
|
|
@Api(value = "公有wbs树", tags = "公有wbs树接口")
|
|
@Api(value = "公有wbs树", tags = "公有wbs树接口")
|
|
public class WbsTreeController extends BladeController {
|
|
public class WbsTreeController extends BladeController {
|
|
|
|
|
|
|
|
+ private final IProjectInfoService projectInfoService;
|
|
|
|
+ private final IContractInfoService contractInfoService;
|
|
private final IWbsTreeService wbsTreeService;
|
|
private final IWbsTreeService wbsTreeService;
|
|
private final IWbsFormElementService wbsFormElementService;
|
|
private final IWbsFormElementService wbsFormElementService;
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
@@ -502,6 +504,44 @@ public class WbsTreeController extends BladeController {
|
|
return R.data(result);
|
|
return R.data(result);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @GetMapping("setContractIsPid")
|
|
|
|
+ public void setContractIsPid(){
|
|
|
|
+ //为合同段节点没有设置is_pid的字段设置isPid
|
|
|
|
+ // 1 获取所有项目,循环项目
|
|
|
|
+ List<ProjectInfo> projects = projectInfoService.list();
|
|
|
|
+ Map<Long,Long> updateMap = new HashMap<>();
|
|
|
|
+ for (ProjectInfo project : projects) {
|
|
|
|
+ // 2 查询wbs_private中的节点
|
|
|
|
+ List<WbsTreePrivate> privates = wbsTreePrivateMapper.getAllNodeByProjectId(project.getId());
|
|
|
|
+ // 3 查询wbs_contract中的节点,排除is_pid有值的
|
|
|
|
+ List<WbsTreeContract> contracts = wbsTreeContractMapper.getAllNodeByProjectId(project.getId());
|
|
|
|
+ if (privates.size() == 0 || contracts.size() == 0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // 分组,key为项目id,id,wbs_id,值为合同节点主键拼接
|
|
|
|
+ Map<ContractIsPidVO, List<Long>> listMap = contracts.stream().collect(Collectors
|
|
|
|
+ .groupingBy(l -> new ContractIsPidVO(l.getId(), l.getWbsId()),Collectors.mapping(WbsTreeContract::getPKeyId,Collectors.toList())));
|
|
|
|
+ // 4 循环private,从分组中获取数据
|
|
|
|
+ for (WbsTreePrivate aPrivate : privates) {
|
|
|
|
+ List<Long> pIds = listMap.get(new ContractIsPidVO(aPrivate.getId(), aPrivate.getWbsId()));
|
|
|
|
+ if (pIds != null && pIds.size() > 0){
|
|
|
|
+ //存在数据,设置主键和isPid,添加进修改集合
|
|
|
|
+ for (Long pId : pIds) {
|
|
|
|
+ updateMap.put(pId,aPrivate.getPKeyId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 5 批量修改
|
|
|
|
+ if (updateMap.size() != 0) {
|
|
|
|
+ List<Map<Long, Long>> mapList = CommonUtil.splitByChunkSize(updateMap, 1000);
|
|
|
|
+ for (Map<Long, Long> map : mapList) {
|
|
|
|
+ wbsTreeContractMapper.updateIsPId(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ System.out.println(updateMap.size());
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|