From 19963dcc829282b9d2c9d6e45dfd2866f631da1b Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Wed, 19 Mar 2025 18:09:28 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/basic/domain/BmProject.java | 3 + .../material/common/domain/dto/SelectDto.java | 3 + .../common/domain/vo/AgreementVo.java | 6 ++ .../SltAgreementInfoController.java | 15 +++ .../settlement/domain/SltAgreementInfo.java | 4 + .../mapper/SltAgreementInfoMapper.java | 11 +++ .../service/ISltAgreementInfoService.java | 13 +++ .../impl/SltAgreementInfoServiceImpl.java | 84 ++++++++++++++++- .../settlement/SltAgreementInfoMapper.xml | 91 ++++++++++++++++++- 9 files changed, 226 insertions(+), 4 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java index b293d999..b6b91494 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java @@ -146,4 +146,7 @@ public class BmProject extends BaseEntity @ApiModelProperty(value = "往来单位id") private Long unitId; + + @ApiModelProperty(value = "往来单位ids") + private int[] unitIds; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java index 734cf550..7f10b3fc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java @@ -2,6 +2,8 @@ package com.bonus.material.common.domain.dto; import lombok.Data; +import java.util.List; + /** * @author 10488 */ @@ -37,4 +39,5 @@ public class SelectDto { /** 计量单位*/ private String unitName; + private List unitIds; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/vo/AgreementVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/vo/AgreementVo.java index b869cbcc..2ae86cf9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/vo/AgreementVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/vo/AgreementVo.java @@ -2,6 +2,8 @@ package com.bonus.material.common.domain.vo; import lombok.Data; +import java.util.List; + /** * @author 10488 * 协议信息 @@ -17,4 +19,8 @@ public class AgreementVo { /** 是否结算*/ private String isSlt; + +// private List agreementIdList; +// +// private List agreementCodeList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index a313e3c1..7c9e2f99 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -16,7 +16,9 @@ import cn.hutool.core.convert.Convert; import com.bonus.common.biz.config.PoiOutPage; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.log.enums.OperaType; +import com.bonus.material.basic.domain.BmProject; import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.common.domain.dto.SelectDto; import com.bonus.material.countersign.domain.SignConfigVo; import com.bonus.material.lease.domain.vo.LeaseOutVo; import com.bonus.material.settlement.domain.SltAgreementApply; @@ -96,6 +98,19 @@ public class SltAgreementInfoController extends BaseController { return getDataTable(list); } + @ApiOperation(value = "工程下拉选") + @PostMapping("getProjectListByUnitIds") + public AjaxResult getProjectListByUnitIds(@RequestBody BmProject bmProject) { + return sltAgreementInfoService.getProjectListByUnitIds(bmProject); + } + + + @ApiOperation(value = "往来单位id和标段工程id获取协议信息") + @PostMapping("getAgreementInfoById") + public AjaxResult getAgreementInfoById(@RequestBody SelectDto dto){ + return sltAgreementInfoService.getAgreementInfoById(dto); + } + @ApiOperation(value = "根据协议获取结算清单") @PostMapping("/getSltInfo") public AjaxResult getSltInfo(@RequestBody SltAgreementInfo info) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java index 033714b5..55fcaf59 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java @@ -2,6 +2,8 @@ package com.bonus.material.settlement.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; @@ -30,6 +32,7 @@ public class SltAgreementInfo extends BaseEntity { @ApiModelProperty(value = "协议id") private Long agreementId; + /** * 协议编号 */ @@ -162,6 +165,7 @@ public class SltAgreementInfo extends BaseEntity { @ApiModelProperty(value = "往来单位id") private Long unitId; + private List unitIds; /** * 工程标段ID */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index 064558b8..64e4f622 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -1,8 +1,13 @@ package com.bonus.material.settlement.mapper; import java.util.List; +import java.util.Map; +import com.bonus.common.biz.domain.ProjectTreeNode; import com.bonus.common.biz.domain.lease.LeaseOutDetails; +import com.bonus.material.basic.domain.BmProject; +import com.bonus.material.common.domain.dto.SelectDto; +import com.bonus.material.common.domain.vo.AgreementVo; import com.bonus.material.ma.domain.Type; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementInfo; @@ -203,4 +208,10 @@ public interface SltAgreementInfoMapper { * @return 结果 */ public int updateBmAgreementReject(SltAgreementApply sltAgreementApply); + + int[] getProjectListByUnitIds(int unitId); + + List getProjectList(int projectId); + + List getAgreementInfoById(@Param("unitIds") List unitIds, @Param("projectId") int projectId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java index 9ad9ab11..db873e62 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/ISltAgreementInfoService.java @@ -3,6 +3,8 @@ package com.bonus.material.settlement.service; import java.util.List; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.basic.domain.BmProject; +import com.bonus.material.common.domain.dto.SelectDto; import com.bonus.material.countersign.domain.SignConfigVo; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementInfo; @@ -105,4 +107,15 @@ public interface ISltAgreementInfoService { * @return 结果 */ SltInfoVo getSltRecordDetailsList(SltAgreementInfo info); + + /** + * 工程下拉框 + * + * @param bmProject 工程下拉框 + * @return 工程下拉框 + */ + AjaxResult getProjectListByUnitIds(BmProject bmProject); + + + AjaxResult getAgreementInfoById(SelectDto dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index 7921b3ad..42fff7e6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -1,14 +1,18 @@ package com.bonus.material.settlement.service.impl; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; +import java.util.*; +import com.bonus.common.biz.domain.ProjectTreeBuild; +import com.bonus.common.biz.domain.ProjectTreeNode; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.basic.domain.BmProject; +import com.bonus.material.common.domain.dto.SelectDto; +import com.bonus.material.common.domain.vo.AgreementVo; import com.bonus.material.countersign.domain.SignConfigVo; import com.bonus.material.settlement.domain.SltAgreementApply; import com.bonus.material.settlement.domain.SltAgreementReduce; @@ -17,6 +21,7 @@ import com.bonus.material.settlement.domain.vo.SltInfoVo; import com.bonus.material.settlement.mapper.SltAgreementReduceMapper; import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.mapper.TmTaskMapper; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.settlement.mapper.SltAgreementInfoMapper; @@ -576,5 +581,80 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { return sltInfoVo; } + /** + * 工程类型树 + * @param bmProject + * @return + */ + @Override + public AjaxResult getProjectListByUnitIds(BmProject bmProject) { + List groupList = new ArrayList<>(); + List list = new ArrayList<>(); + try { + if(bmProject.getUnitIds()!=null){ + Map map= new HashMap<>(); + for (int i = 0; i < bmProject.getUnitIds().length; i++) { + int id = bmProject.getUnitIds()[i]; + int[] projectIds= sltAgreementInfoMapper.getProjectListByUnitIds(bmProject.getUnitIds()[i]); + Map mapTemp=new HashMap<>(); + for (int j = 0; j < projectIds.length; j++) { + mapTemp.put(projectIds[j],1); + } + mapTemp.forEach((k,v)->{ + if(map.containsKey(k)){ + map.put(Integer.valueOf(k),map.get(k)+v); + }else{ + map.put(Integer.valueOf(k),v); + } + }); + } + if(map.size()>0){ + List keys = new ArrayList<>(); + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == bmProject.getUnitIds().length) { + keys.add(entry.getKey()); + } + } + for (Integer key : keys) { + List listTemp = sltAgreementInfoMapper.getProjectList(key); + for (ProjectTreeNode node : listTemp) { + if (!list.contains(node)) { + list.add(node); + } + } + } + } + + + } +// list = sltAgreementInfoMapper.getProjectListByUnitIds(bmProject); + if (CollectionUtils.isNotEmpty(list)) { + // 创建树形结构(数据集合作为参数) + ProjectTreeBuild treeBuild = new ProjectTreeBuild(list); + // 原查询结果转换树形结构 + groupList = treeBuild.buildTree(); + } + } catch (Exception e) { + return AjaxResult.error(e+"工程下拉树查询失败"); + } + return AjaxResult.success(groupList); + } + + + @Override + public AjaxResult getAgreementInfoById(SelectDto dto) { + List vo = new ArrayList<>(); + try { + List list = sltAgreementInfoMapper.getAgreementInfoById(dto.getUnitIds(), dto.getProjectId()); + if (CollectionUtils.isNotEmpty(list)) { + vo = list; + } else { + return AjaxResult.error("未找到匹配的协议信息"); + } + } catch (Exception e) { + return AjaxResult.error(e+"协议查询失败"); + } + return AjaxResult.success(vo); + } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 24bd22e9..e9197d91 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -191,8 +191,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id LEFT JOIN slt_agreement_apply saa on saa.agreement_id = bai.agreement_id where bai.status = '1' - - and bui.unit_id = #{unitId} + + and bui.unit_id in + + #{item} + and bp.pro_id = #{projectId} @@ -580,4 +583,88 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where bai.agreement_id = #{agreementId} + + + + + + + \ No newline at end of file