|
@@ -21,32 +21,28 @@ import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springblade.business.entity.ConstructionLedger;
|
|
|
import org.springblade.business.mapper.ConstructionLedgerMapper;
|
|
|
-import org.springblade.business.service.IConstructionLedgerService;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.log.logger.BladeLogger;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
-import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringPool;
|
|
|
import org.springblade.manager.dto.FormElementDTO;
|
|
|
import org.springblade.manager.dto.WbsTreeContractDTO;
|
|
|
-import org.springblade.manager.entity.WbsInfo;
|
|
|
-import org.springblade.manager.entity.WbsTreeContract;
|
|
|
+import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.excel.WbsExcelUtil;
|
|
|
-import org.springblade.manager.excel.WbsTreeExcel;
|
|
|
import org.springblade.manager.mapper.WbsInfoMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreeContractMapper;
|
|
|
import org.springblade.manager.mapper.WbsTreeMapper;
|
|
|
+import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.IWbsFormElementService;
|
|
|
import org.springblade.manager.service.IWbsTreeService;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
-import org.springblade.manager.entity.WbsFormElement;
|
|
|
-import org.springblade.manager.entity.WbsTree;
|
|
|
import org.springblade.manager.vo.WbsNodeTableVO;
|
|
|
+import org.springblade.manager.vo.WbsTreeAllListVO;
|
|
|
import org.springblade.manager.vo.WbsTreeContractVO;
|
|
|
import org.springblade.manager.vo.WbsTreeVO;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -71,9 +67,12 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
private final BladeLogger logger;
|
|
|
private final WbsTreeMapper wbsTreeMapper;
|
|
|
private final ConstructionLedgerMapper constructionLedgerMapper;
|
|
|
+ private final IWbsFormElementService wbsFormElementService;
|
|
|
private final WbsInfoMapper wbsInfoMapper;
|
|
|
private final WbsTreeContractMapper wbsTreeContractMapper;
|
|
|
- private final IWbsFormElementService wbsFormElementService;
|
|
|
+ private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
+ private final WbsTreePrivateServiceImpl wbsTreePrivateService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public IPage<WbsTreeVO> selectWbsTreePage(IPage<WbsTreeVO> page, WbsTreeVO wbsTree) {
|
|
@@ -109,6 +108,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
String ancestors = parent.getAncestors() + StringPool.COMMA + dept.getParentId();
|
|
|
dept.setAncestors(ancestors);
|
|
|
}
|
|
|
+ dept.setStatus(1);
|
|
|
dept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
|
|
return saveOrUpdate(dept);
|
|
|
}
|
|
@@ -254,45 +254,81 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean saveWbsTreeInProject(WbsTreeContractDTO pawDTO) {
|
|
|
+ public Boolean submitWbsTreeInProject(WbsTreeContractDTO pawDTO) {
|
|
|
String wbsTreeIds = pawDTO.getWbsTreeIds();
|
|
|
if (StringUtils.isEmpty(wbsTreeIds)) {
|
|
|
return false;
|
|
|
}
|
|
|
- //获取节点ids,查询出所需节点树
|
|
|
- List<WbsTree> list = findAllNodeList(wbsTreeIds);
|
|
|
- if (list != null) {
|
|
|
- list.forEach(System.out::print);
|
|
|
+ String[] ids = wbsTreeIds.split(",");
|
|
|
+ List<String> idList1 = Arrays.asList(ids);
|
|
|
+ List<String> idList2 = new ArrayList<>();
|
|
|
+ //查询出当前私有库下所有的wbs节点
|
|
|
+ QueryWrapper<WbsTreePrivate> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("project_id", pawDTO.getProjectId());
|
|
|
+ List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(queryWrapper);
|
|
|
+ for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
|
|
|
+ idList2.add(String.valueOf(wbsTreePrivate.getId()));
|
|
|
+ }
|
|
|
+ //比对
|
|
|
+ List<String> diffrent = WbsTreeContractServiceImpl.getDiffrent(idList1, idList2);
|
|
|
+ if (diffrent.size() == 0) { //相同
|
|
|
+ return false;
|
|
|
+ } else { //不相同
|
|
|
+ if (idList1.size() > idList2.size()){//根据ids新增多余项目私有wbs树节点
|
|
|
+
|
|
|
+ }else {//根据id、wbsID、projectId逻辑删除当前多余的项目私有wbs树节点
|
|
|
+ for (String id : diffrent) {
|
|
|
+ wbsTreePrivateMapper.deleteByCondition(id,pawDTO.getWbsId(), pawDTO.getProjectId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /*if (list != null) {
|
|
|
//新增节点
|
|
|
for (WbsTree wbsTree : list) {
|
|
|
- //初始化wbs私有库
|
|
|
- Integer row = baseMapper.insertWbsTreePrivate(pawDTO.getProjectId(), wbsTree);
|
|
|
- if (row > 0) {
|
|
|
- logger.info(wbsTree.getId().toString(), "初始化项目私有wbs树成功");
|
|
|
- }
|
|
|
- //初始化创建合同段私有wbs树
|
|
|
- Boolean b1 = baseMapper.insertWbsTreeContract(pawDTO.getProjectId(), pawDTO.getContractId(), wbsTree);
|
|
|
- if (b1) {
|
|
|
- logger.info(wbsTree.getId().toString(), "初始化合同段wbs树成功");
|
|
|
- }
|
|
|
- //初始化施工台账数据
|
|
|
- if (wbsTree.getDeptCategory() == 6) {
|
|
|
- ConstructionLedger constructionLedger = new ConstructionLedger();
|
|
|
- constructionLedger.setIsBeton(0);
|
|
|
- constructionLedger.setWbsId(Long.parseLong(pawDTO.getWbsId()));
|
|
|
- constructionLedger.setContractId(Long.parseLong(pawDTO.getContractId()));
|
|
|
- int b2 = constructionLedgerMapper.insert(constructionLedger);
|
|
|
- if (b2 > 0) {
|
|
|
- logger.info(constructionLedger.getId().toString(), "施工台账初始化成功");
|
|
|
+ //判重
|
|
|
+ Integer r = baseMapper.selectRepeatByProjectId(pawDTO.getProjectId());
|
|
|
+ if (r <= 0) {
|
|
|
+ //初始化wbs私有树,每个项目只初始化一次
|
|
|
+ Integer row = baseMapper.insertWbsTreePrivate(pawDTO.getProjectId(), wbsTree);
|
|
|
+ if (row > 0) {
|
|
|
+ logger.info(wbsTree.getId().toString(), "初始化项目私有wbs树成功");
|
|
|
}
|
|
|
+ //初始化创建合同段私有wbs树
|
|
|
+ Boolean b1 = baseMapper.insertWbsTreeContract(pawDTO.getProjectId(), pawDTO.getContractId(), wbsTree);
|
|
|
+ if (b1) {
|
|
|
+ logger.info(wbsTree.getId().toString(), "初始化合同段wbs树成功");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
}
|
|
|
//TODO 初始化元素表、公式
|
|
|
}
|
|
|
}
|
|
|
+ //通过wbs总树id获取当前树下的元素表信息
|
|
|
+ List<WbsTree> listTable = baseMapper.findAllNodeTableList(pawDTO.getWbsId());
|
|
|
+ if (listTable != null && listTable.size() > 0) {
|
|
|
+ for (WbsTree wbsTree : listTable) {
|
|
|
+ //判重
|
|
|
+ Integer r = baseMapper.selectRepeatByProjectId(pawDTO.getProjectId());
|
|
|
+ if (r <= 0) {
|
|
|
+ //初始化wbs私有树元素表,每个项目只初始化一次
|
|
|
+ Integer row = baseMapper.insertWbsTreePrivate(pawDTO.getProjectId(), wbsTree);
|
|
|
+ if (row > 0) {
|
|
|
+ logger.info(wbsTree.getId().toString(), "初始化项目私有wbs树元素表成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private List<WbsTree> findAllNodeList(String wbsTreeIds) {
|
|
|
+ public List<WbsTree> findAllNodeList(String wbsTreeIds) {
|
|
|
String[] ids = wbsTreeIds.split(",");
|
|
|
List<Long> idList = new ArrayList<>();
|
|
|
for (String id : ids) {
|
|
@@ -302,15 +338,18 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public WbsTreeContractVO findWbsTreeList() {
|
|
|
- WbsTreeContractVO wbsTreeContractVO = new WbsTreeContractVO();
|
|
|
+ public WbsTreeAllListVO findWbsTreeList(Integer type) {
|
|
|
+ WbsTreeAllListVO wbsTreeAllListVO = new WbsTreeAllListVO();
|
|
|
//查询Wbs总树
|
|
|
- List<WbsInfo> wbsInfos = wbsInfoMapper.selectAll();
|
|
|
- wbsTreeContractVO.setWbsInfos(wbsInfos);
|
|
|
- //查询私有树
|
|
|
- List<WbsTreeContractDTO> wbsTreeContracts = wbsTreeContractMapper.selectAll();
|
|
|
- wbsTreeContractVO.setWbsTreeContracts(wbsTreeContracts);
|
|
|
- return wbsTreeContractVO;
|
|
|
+ List<WbsInfo> wbsInfos = wbsInfoMapper.selectAll(type);
|
|
|
+ wbsTreeAllListVO.setWbsInfos(wbsInfos);
|
|
|
+ //查询项目私有树 TODO 默认type=1质检查询wbs总树+项目私有树 如果=2实验不需要wbs私有树可以加判断不查询
|
|
|
+ List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectAll();
|
|
|
+ wbsTreeAllListVO.setWbsTreePrivates(wbsTreePrivates);
|
|
|
+ //查询合同段私有树 TODO 暂时未说明是否要引用合同段私有树(已确认暂时不引用合同树)
|
|
|
+ /*List<WbsTreeContractVO> wbsTreeContractDTOS = wbsTreeContractMapper.selectAll();
|
|
|
+ wbsTreeAllListVO.setWbsTreeContracts(wbsTreeContractDTOS);*/
|
|
|
+ return wbsTreeAllListVO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -335,17 +374,17 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
formElementDTO.setInitTableName(newTableName);
|
|
|
//创建表单
|
|
|
boolean b1 = submit2(formElementDTO);
|
|
|
- //查询当前新建表单的id,通过表单名字查询,表单名必须唯一
|
|
|
+ //判重
|
|
|
String tableId = selectTableIdByTableName(formElementDTO.getDeptName());
|
|
|
if (("-1").equals(tableId)) {
|
|
|
return R.fail("表单名已经存在,请重新填写表单名");
|
|
|
}
|
|
|
- //赋值fid
|
|
|
+ //赋值
|
|
|
List<WbsFormElement> elementList = formElementDTO.getElementList();
|
|
|
for (WbsFormElement wbsFormElement : elementList) {
|
|
|
wbsFormElement.setFId(tableId);
|
|
|
}
|
|
|
- //批量新增元素
|
|
|
+ //新增元素
|
|
|
boolean b2 = wbsFormElementService.saveBatch(elementList);
|
|
|
//通过fId查找当前表下的所有元素
|
|
|
List<WbsFormElement> list = wbsFormElementService.selectElementListByFid(tableId);
|