|
@@ -1,17 +1,13 @@
|
|
package org.springblade.business.controller;
|
|
package org.springblade.business.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
-import com.alibaba.nacos.common.utils.StringUtils;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springblade.business.entity.ConstructionLedger;
|
|
import org.springblade.business.entity.ConstructionLedger;
|
|
-import org.springblade.business.feignClient.ClientTreePublicCodeClientImpl;
|
|
|
|
import org.springblade.business.service.IConstructionLedgerService;
|
|
import org.springblade.business.service.IConstructionLedgerService;
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
import org.springblade.business.service.IInformationQueryService;
|
|
import org.springblade.business.vo.NeiYeLedgerVO;
|
|
import org.springblade.business.vo.NeiYeLedgerVO;
|
|
@@ -40,8 +36,6 @@ public class NeiYeController {
|
|
|
|
|
|
private final IConstructionLedgerService constructionLedgerService;
|
|
private final IConstructionLedgerService constructionLedgerService;
|
|
|
|
|
|
- private final ClientTreePublicCodeClientImpl clientTreePublicCodeClient;
|
|
|
|
-
|
|
|
|
private final IInformationQueryService informationQueryService;
|
|
private final IInformationQueryService informationQueryService;
|
|
|
|
|
|
private final ContractClient contractClient;
|
|
private final ContractClient contractClient;
|
|
@@ -66,69 +60,78 @@ public class NeiYeController {
|
|
|
|
|
|
//根据点击的节点获取这个节点下所有填报节点
|
|
//根据点击的节点获取这个节点下所有填报节点
|
|
WbsTreeContract node = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(queryVO.getWbsIds().get(0));
|
|
WbsTreeContract node = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(queryVO.getWbsIds().get(0));
|
|
-
|
|
|
|
|
|
+ if(node == null){
|
|
|
|
+ //这一步主要是为了兼容监理合同段
|
|
|
|
+ node = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(Long.parseLong(queryVO.getWbsIds().get(0)), Long.parseLong(queryVO.getContractId()));
|
|
|
|
+ }
|
|
|
|
+ //不是工序,则查询当前节点下的所有填报节点
|
|
|
|
+ List<QueryProcessDataVO> queryDataResult;
|
|
if(!new Integer("6").equals(node.getDeptCategory()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())){
|
|
if(!new Integer("6").equals(node.getDeptCategory()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())){
|
|
- //不是工序,则查询当前节点下的所有填报节点
|
|
|
|
- List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), 1, queryVO.getContractId());
|
|
|
|
- if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
|
- //删除非工序节点
|
|
|
|
- queryDataResult.removeIf(vo -> !new Integer("4").equals(vo.getMajorDataType()));
|
|
|
|
-
|
|
|
|
- //分组
|
|
|
|
- List<List<QueryProcessDataVO>> groupList = CommonUtil.getBatchSize(queryDataResult, queryVO.getSize());
|
|
|
|
- List<QueryProcessDataVO> groupQueryList = groupList.get(queryVO.getCurrent() == 0 ? 0 : queryVO.getCurrent() - 1);
|
|
|
|
-
|
|
|
|
- //获取所有施工日志记录
|
|
|
|
- List<String> primaryKeyIds = groupQueryList.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
|
- List<ConstructionLedger> ledgers = this.constructionLedgerService.list(Wrappers.<ConstructionLedger>lambdaQuery().in(ConstructionLedger::getWbsId, primaryKeyIds));
|
|
|
|
-
|
|
|
|
- for(QueryProcessDataVO vo : groupQueryList){
|
|
|
|
- //处理父节点信息
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- this.foreachGetParent(map, idToNodeMap, vo.getParentId(), queryVO.getContractId());
|
|
|
|
-
|
|
|
|
- //获取当前工序的施工台账信息
|
|
|
|
- if(ledgers != null && ledgers.size() > 0){
|
|
|
|
- Iterator<ConstructionLedger> iterator = ledgers.iterator();
|
|
|
|
- while (iterator.hasNext()){
|
|
|
|
- ConstructionLedger ledger = iterator.next();
|
|
|
|
- if(vo.getPrimaryKeyId().equals(ledger.getWbsId().toString())){
|
|
|
|
- if(ledger.getSiteStartTime() != null && ledger.getSiteEndTime() != null){
|
|
|
|
- //获取施工起止时间
|
|
|
|
- map.put("siteStartToEndTime", DateUtil.format(ledger.getSiteStartTime(), "yyyy-MM-dd") + " ~ " + DateUtil.format(ledger.getSiteEndTime(), "yyyy-MM-dd"));
|
|
|
|
- }
|
|
|
|
- if(ledger.getDetectionStartTime() != null && ledger.getDetectionEndTime() != null){
|
|
|
|
- //获取检测起止时间
|
|
|
|
- map.put("detectionStartToEndTime", DateUtil.format(ledger.getDetectionStartTime(), "yyyy-MM-dd") + " ~ " + DateUtil.format(ledger.getDetectionEndTime(), "yyyy-MM-dd"));
|
|
|
|
- }
|
|
|
|
- iterator.remove();
|
|
|
|
- break;
|
|
|
|
|
|
+ //非填报节点
|
|
|
|
+ queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), 1, queryVO.getContractId());
|
|
|
|
+ } else {
|
|
|
|
+ //填报节点
|
|
|
|
+ queryDataResult = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(node.getPKeyId().toString(), 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (queryDataResult != null && queryDataResult.size() > 0) {
|
|
|
|
+ //删除非工序节点
|
|
|
|
+ queryDataResult.removeIf(vo -> !new Integer("4").equals(vo.getMajorDataType()));
|
|
|
|
+
|
|
|
|
+ //分组
|
|
|
|
+ List<List<QueryProcessDataVO>> groupList = CommonUtil.getBatchSize(queryDataResult, queryVO.getSize());
|
|
|
|
+ List<QueryProcessDataVO> groupQueryList = groupList.get(queryVO.getCurrent() == 0 ? 0 : queryVO.getCurrent() - 1);
|
|
|
|
+
|
|
|
|
+ //获取所有施工日志记录
|
|
|
|
+ List<String> primaryKeyIds = groupQueryList.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
|
+ List<ConstructionLedger> ledgers = this.constructionLedgerService.list(Wrappers.<ConstructionLedger>lambdaQuery().in(ConstructionLedger::getWbsId, primaryKeyIds));
|
|
|
|
+
|
|
|
|
+ for (QueryProcessDataVO vo : groupQueryList) {
|
|
|
|
+ //处理父节点信息
|
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
|
+ this.foreachGetParent(map, idToNodeMap, vo.getParentId(), queryVO.getContractId());
|
|
|
|
+
|
|
|
|
+ //获取当前工序的施工台账信息
|
|
|
|
+ if (ledgers != null && ledgers.size() > 0) {
|
|
|
|
+ Iterator<ConstructionLedger> iterator = ledgers.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ ConstructionLedger ledger = iterator.next();
|
|
|
|
+ if (vo.getPrimaryKeyId().equals(ledger.getWbsId().toString())) {
|
|
|
|
+ if (ledger.getSiteStartTime() != null && ledger.getSiteEndTime() != null) {
|
|
|
|
+ //获取施工起止时间
|
|
|
|
+ map.put("siteStartToEndTime", DateUtil.format(ledger.getSiteStartTime(), "yyyy-MM-dd") + " ~ " + DateUtil.format(ledger.getSiteEndTime(), "yyyy-MM-dd"));
|
|
|
|
+ }
|
|
|
|
+ if (ledger.getDetectionStartTime() != null && ledger.getDetectionEndTime() != null) {
|
|
|
|
+ //获取检测起止时间
|
|
|
|
+ map.put("detectionStartToEndTime", DateUtil.format(ledger.getDetectionStartTime(), "yyyy-MM-dd") + " ~ " + DateUtil.format(ledger.getDetectionEndTime(), "yyyy-MM-dd"));
|
|
}
|
|
}
|
|
|
|
+ iterator.remove();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //todo 当前缺少流程状态、是否关联评定、是否关联试验 =================================
|
|
|
|
- //新增列表数据
|
|
|
|
- neiYeLedgerVOList.add(new NeiYeLedgerVO(map.get("unitProject"),
|
|
|
|
- map.get("partProject"),
|
|
|
|
- map.get("partChildProject"),
|
|
|
|
- map.get("subentryProject"),
|
|
|
|
- map.get("subentryChildProject"),
|
|
|
|
- vo.getTitle(),
|
|
|
|
- map.get("siteStartToEndTime"),
|
|
|
|
- map.get("detectionStartToEndTime"),
|
|
|
|
- new Integer("1").equals(vo.getStatus()) ? "待审批" : new Integer("2").equals(vo.getStatus()) ? "已审批" : "未上报",
|
|
|
|
- "false",
|
|
|
|
- "false"));
|
|
|
|
}
|
|
}
|
|
- //转换为page信息
|
|
|
|
- Query query = new Query();
|
|
|
|
- query.setCurrent(queryVO.getCurrent());
|
|
|
|
- query.setSize(queryVO.getSize());
|
|
|
|
- IPage<NeiYeLedgerVO> page = Condition.getPage(query);
|
|
|
|
- page.setTotal(queryDataResult.size());
|
|
|
|
- page.setRecords(neiYeLedgerVOList);
|
|
|
|
- return R.data(page);
|
|
|
|
|
|
+ //todo 当前缺少是否关联评定、是否关联试验 =================================
|
|
|
|
+ //新增列表数据
|
|
|
|
+ neiYeLedgerVOList.add(new NeiYeLedgerVO(map.get("unitProject"),
|
|
|
|
+ map.get("partProject"),
|
|
|
|
+ map.get("partChildProject"),
|
|
|
|
+ map.get("subentryProject"),
|
|
|
|
+ map.get("subentryChildProject"),
|
|
|
|
+ vo.getTitle(),
|
|
|
|
+ map.get("siteStartToEndTime"),
|
|
|
|
+ map.get("detectionStartToEndTime"),
|
|
|
|
+ new Integer("1").equals(vo.getStatus()) ? "待审批" : new Integer("2").equals(vo.getStatus()) ? "已审批" : "未上报",
|
|
|
|
+ "false",
|
|
|
|
+ "false"));
|
|
}
|
|
}
|
|
|
|
+ //转换为page信息
|
|
|
|
+ Query query = new Query();
|
|
|
|
+ query.setCurrent(queryVO.getCurrent());
|
|
|
|
+ query.setSize(queryVO.getSize());
|
|
|
|
+ IPage<NeiYeLedgerVO> page = Condition.getPage(query);
|
|
|
|
+ page.setTotal(queryDataResult.size());
|
|
|
|
+ page.setRecords(neiYeLedgerVOList);
|
|
|
|
+ return R.data(page);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -170,35 +173,4 @@ public class NeiYeController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取当前合同段的划分树
|
|
|
|
- * @param wbsType 查询类型,1为质检类型划分
|
|
|
|
- * @return 结果
|
|
|
|
- */
|
|
|
|
- @GetMapping("/queryContractWbsTreeByContractIdAndType")
|
|
|
|
- @ApiOperationSupport(order = 1)
|
|
|
|
- @ApiOperation(value = "获取当前合同段的划分树")
|
|
|
|
- @ApiImplicitParams(value = {
|
|
|
|
- @ApiImplicitParam(name = "wbsType", value = "数据类型,目前质检为1"),
|
|
|
|
- @ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
|
|
|
|
- @ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
|
- })
|
|
|
|
- public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam Integer wbsType, @RequestParam String parentId, @RequestParam String contractId){
|
|
|
|
- List<WbsTreeContractTreeVOS> rootTreeNode;
|
|
|
|
- if(StringUtils.isEmpty(parentId)){
|
|
|
|
- //为空,说明初始化
|
|
|
|
- //获取根节点
|
|
|
|
- rootTreeNode = this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, 1, "0");
|
|
|
|
- //设置名称
|
|
|
|
- rootTreeNode.get(0).setTitle(this.contractClient.getContractById(Long.parseLong(contractId)).getContractName());
|
|
|
|
- } else {
|
|
|
|
- //不为空,获取其下子节点
|
|
|
|
- rootTreeNode = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- rootTreeNode.removeIf(vos -> Arrays.asList("1,2,3".split(",")).contains(vos.getMajorDataType().toString()));
|
|
|
|
-
|
|
|
|
- return R.data(rootTreeNode);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|