|
@@ -16,6 +16,7 @@ import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
import org.springblade.manager.feign.WbsTreeContractClient;
|
|
import org.springblade.manager.feign.WbsTreeContractClient;
|
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -40,13 +41,94 @@ public class NeiWaiYeProgressController {
|
|
|
|
|
|
private final IConstructionLedgerService constructionLedgerService;
|
|
private final IConstructionLedgerService constructionLedgerService;
|
|
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 内外业进度
|
|
|
|
|
|
+ * 内外业进度 ,id为当前合同段id
|
|
*/
|
|
*/
|
|
@GetMapping("/neiWaiYeProgress")
|
|
@GetMapping("/neiWaiYeProgress")
|
|
@ApiOperationSupport(order = 1)
|
|
@ApiOperationSupport(order = 1)
|
|
@ApiOperation(value = "内外业进度")
|
|
@ApiOperation(value = "内外业进度")
|
|
- public R<List<NeiWaiYeProgressVO>> neiWaiYeProgress(@RequestParam String primaryKeyId, @RequestParam String contractId) {
|
|
|
|
|
|
+ public R<List<NeiWaiYeProgressVO>> neiWaiYeProgress(@RequestParam String primaryKeyId, @RequestParam String contractId,@RequestParam String contractIdRelation) {
|
|
|
|
+ if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
|
|
+ //判断primaryKeyId是唯一键还是泛用键
|
|
|
|
+ WbsTreeContract node = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId);
|
|
|
|
+ if (node == null) {
|
|
|
|
+ //说明是监理合同段
|
|
|
|
+ node = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(Long.parseLong(primaryKeyId), Long.parseLong(contractId));
|
|
|
|
+ }
|
|
|
|
+ Integer classFy = jdbcTemplate.queryForObject(" select contract_type from m_contract_info WHERE id = " + contractIdRelation, Integer.class);
|
|
|
|
+ //设置返回集合
|
|
|
|
+ List<NeiWaiYeProgressVO> result = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ //获取当前节点的子节点
|
|
|
|
+ List<WbsTreeContract> childList = this.wbsTreeContractClient.queryChildByParentId(node, "noeQueryTable", "");
|
|
|
|
+ //删除掉首件的
|
|
|
|
+ childList.removeIf(child -> child.getNodeType() != null && child.getNodeType() == 111);
|
|
|
|
+
|
|
|
|
+ //获取当前节点下的所有填报节点
|
|
|
|
+ List<QueryProcessDataVO> queryProcessDataVOList;
|
|
|
|
+ if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())) {
|
|
|
|
+ queryProcessDataVOList = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), classFy, contractId);
|
|
|
|
+ } else {
|
|
|
|
+ //填报节点
|
|
|
|
+ queryProcessDataVOList = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(node.getPKeyId().toString(), classFy);
|
|
|
|
+ childList.clear();
|
|
|
|
+ //设置填报节点进集合中
|
|
|
|
+ childList.add(node);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (queryProcessDataVOList != null && queryProcessDataVOList.size() > 0) {
|
|
|
|
+ //删除掉开工报告等节点
|
|
|
|
+ queryProcessDataVOList.removeIf(vo -> !new Integer("4").equals(vo.getMajorDataType()));
|
|
|
|
+ //循环子节点
|
|
|
|
+ for (WbsTreeContract child : childList) {
|
|
|
|
+ //设置返回参数
|
|
|
|
+ int amount = 0, neiYeSuccessAmount = 0, waiYeSuccessAmount = 0;
|
|
|
|
+
|
|
|
|
+ //使用迭代器,减少之后的循环次数
|
|
|
|
+ Iterator<QueryProcessDataVO> iterator = queryProcessDataVOList.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ QueryProcessDataVO vo = iterator.next();
|
|
|
|
+ //找到自己的子节点
|
|
|
|
+ if (vo.getAncestors().contains(child.getId().toString()) || vo.getParentId().equals(child.getId().toString()) || vo.getPrimaryKeyId().equals(child.getPKeyId().toString())) {
|
|
|
|
+ //统计内业数量(内业根据已审批的节点资料统计)
|
|
|
|
+ if (new Integer("2").equals(vo.getStatus())) {
|
|
|
|
+ neiYeSuccessAmount++;
|
|
|
|
+ }
|
|
|
|
+ //统计外业数量(外业根据当前填报节点是否已经生成一份施工日志为准(暂时))
|
|
|
|
+ Integer logCount = this.contractLogWbsService.countContractLogBySelectPrimaryKeyIdsAndClassify(Func.toStrList(vo.getPrimaryKeyId()), 7);
|
|
|
|
+ if (logCount != null && logCount > 0) {
|
|
|
|
+ waiYeSuccessAmount++;
|
|
|
|
+ } else {
|
|
|
|
+ //检查是否填有对应的施工台账(以施工台账是否填写开工时间为准)
|
|
|
|
+ ConstructionLedger ledger = this.constructionLedgerService.getOne(Wrappers.<ConstructionLedger>lambdaQuery().eq(ConstructionLedger::getWbsId, vo.getPrimaryKeyId()));
|
|
|
|
+ if (ledger != null && ledger.getSiteStartTime() != null) {
|
|
|
|
+ waiYeSuccessAmount++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //统计总数
|
|
|
|
+ amount++;
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //添加返回结果
|
|
|
|
+ result.add(new NeiWaiYeProgressVO(StringUtils.isNotEmpty(child.getFullName()) ? child.getFullName() : child.getNodeName(), amount, neiYeSuccessAmount, waiYeSuccessAmount));
|
|
|
|
+ }
|
|
|
|
+ return R.data(result);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return R.data(300, null, "未查询到数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 内外业进度- 原统计改为了2
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/neiWaiYeProgress2")
|
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
|
+ @ApiOperation(value = "内外业进度")
|
|
|
|
+ public R<List<NeiWaiYeProgressVO>> neiWaiYeProgress2(@RequestParam String primaryKeyId, @RequestParam String contractId) {
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
if (StringUtils.isNotEmpty(primaryKeyId)) {
|
|
//判断primaryKeyId是唯一键还是泛用键
|
|
//判断primaryKeyId是唯一键还是泛用键
|
|
WbsTreeContract node = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId);
|
|
WbsTreeContract node = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId);
|