From 812387edcca1a4e614573f24eb087b367cd4e794 Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 16 Jul 2025 18:49:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/domain/lease/LeaseApplyInfo.java | 5 +++ .../lease/domain/LeaseApplyDetails.java | 8 ++++- .../lease/mapper/LeaseApplyDetailsMapper.java | 3 +- .../lease/mapper/LeaseApplyInfoMapper.java | 7 +++++ .../impl/LeaseApplyInfoServiceImpl.java | 31 ++++++++++++++++--- .../impl/LeaseOutDetailsServiceImpl.java | 2 +- .../service/impl/LeaseTaskServiceImpl.java | 2 +- .../lease/LeaseApplyDetailsMapper.xml | 25 +++++++++++++-- .../material/lease/LeaseApplyInfoMapper.xml | 19 ++++++++++-- 9 files changed, 89 insertions(+), 13 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java index 1dd690dd..090977b0 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java @@ -318,4 +318,9 @@ public class LeaseApplyInfo extends BaseEntity{ private String ids; private Long leaseSignId; + + private List typeIdList; + + @ApiModelProperty(value = "一级类型id") + private Long firstId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java index 597af222..45e4b52d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetails.java @@ -179,6 +179,11 @@ public class LeaseApplyDetails extends BaseEntity { private String leaseSignId; + @ApiModelProperty(value = "一级类型id") + private Long firstId; + + private List typeIdList; + @ApiModelProperty(value = "领料物资名称汇总") private String maTypeNames; public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) { @@ -194,9 +199,10 @@ public class LeaseApplyDetails extends BaseEntity { public LeaseApplyDetails() {} - public LeaseApplyDetails(Long parentId, String keyword, Long userId) { + public LeaseApplyDetails(Long parentId, String keyword, Long userId, List typeIdList) { this.parentId = parentId; this.keyword = keyword; this.userId = userId; + this.typeIdList = typeIdList; } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java index ec370818..50c29c69 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java @@ -141,7 +141,8 @@ public interface LeaseApplyDetailsMapper { * @param publishTask * @return */ - List getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask); + List getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask, + @Param("list") List typeIdList); /** * 根据领料任务id查询领料任务详细 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java index 4d908d6e..29fd9c4f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java @@ -134,4 +134,11 @@ public interface LeaseApplyInfoMapper { List getDetailsLeaseList(LeaseApplyDetails bean); LeaseConfirmSign getLeaseConfirmSign(LeaseApplyDetails bean); + + /** + * 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + * @param userId + * @return + */ + List selectTypeIdList(Long userId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index b313021d..1f35b7e6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -88,7 +88,13 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); leaseApplyInfo.setId(id); Long userId = SecurityUtils.getLoginUser().getUserid(); - leaseApplyInfo.setUserId(userId); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); + if (!CollectionUtils.isEmpty(typeIdList)) { + leaseApplyInfo.setTypeIdList(typeIdList); + } else { + leaseApplyInfo.setUserId(userId); + } Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); // 查询领用出库数据 @@ -134,11 +140,16 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId)); + List details = new ArrayList<>(); + if (leaseApplyInfo.getUserId() != null) { + details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId, null)); + } else { + details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, null, typeIdList)); + } // 走单独的领用详情查询 if (StringUtils.isNotBlank(publishTask)) { // 根据领用批次查询领用详情 - details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask); + details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask, typeIdList); if (!CollectionUtils.isEmpty(details)) { for (LeaseApplyDetails detail : details) { if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) { @@ -270,7 +281,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { - leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); + Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息 + List typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId); + if (CollectionUtils.isEmpty(typeIdList)) { + leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); + } List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); // 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接 if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { @@ -291,6 +307,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) .collect(Collectors.toList()); if (!CollectionUtils.isEmpty(sortedList)) { + if (!CollectionUtils.isEmpty(typeIdList)) { + sortedList = sortedList.stream() + .filter(item -> typeIdList.contains(item.getFirstId())) + .collect(Collectors.toList()); + } String keyWord = leaseApplyInfo.getKeyWord(); // 如果关键字不为空,进行过滤 if (!StringUtils.isBlank(keyWord)) { @@ -946,7 +967,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyDetailsList(LeaseApplyInfo leaseApplyInfo) { - return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId())); + return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId(), null)); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index 30c802dd..93fa7ec3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -448,7 +448,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { if (StringUtils.isNotBlank(record.getPublishTask())) { // 根据领用批次查询领用详情 boolean isFinished = true; - List details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask()); + List details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask(), null); if (!CollectionUtils.isEmpty(details)) { for (LeaseApplyDetails bean : details) { if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index c2f37589..144a02d7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -361,7 +361,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId)); + List details = mapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyWord, userId, null)); if (!CollectionUtils.isEmpty(details)) { leaseApplyRequestVo.setLeaseApplyDetailsList(details); for (LeaseApplyDetails detail : details) { diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index 7b06e908..66ea27ab 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -44,13 +44,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(lad.audit_num,0) as audit_num, IFNULL(lad.al_num,0) as al_num, IFNULL(lad.status,0) as status, mt.unit_name,mt.unit_value, - lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id + lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id, + mt4.type_id as firstId from lease_apply_details lad left join ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0' left join ma_type mt2 on mt2.type_id = mt.parent_id and mt2.`level` = '3' and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' left join (SELECT mt.type_id, mt2.type_name AS typeName, mt.type_name AS typeModelName, @@ -79,6 +82,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and lad.al_num = #{alNum} and lad.status = #{status} and lad.company_id = #{companyId} + + and mt4.type_id in + + #{item} + + @@ -439,13 +448,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(subquery0.num, 0) ELSE IFNULL(mt.storage_num, 0) - END as storageNum + END as storageNum, + mt4.type_id as firstId FROM lease_publish_details lpd LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id AND mt.del_flag = '0' LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0' + left join ma_type mt3 ON mt1.parent_id = mt3.type_id and mt3.del_flag = '0' + left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0' left join (SELECT mt.type_id, mt2.type_name AS typeName, mt.type_name AS typeModelName, @@ -460,12 +472,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND lpd.publish_task = lod.publish_task LEFT JOIN (SELECT id, parent_id, type_id from lease_apply_details GROUP BY parent_id, type_id) a on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id + + JOIN ma_type_keeper mtk ON mtk.type_id = lpd.new_type AND mtk.user_id = #{userId} + WHERE lpd.publish_task = #{publishTask} AND (mt1.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%') OR mt.type_name LIKE CONCAT(CONCAT('%', #{keyWord}), '%')) + + and mt4.type_id in + + #{item} + + GROUP BY lpd.new_type diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml index 26e4f6f4..31317899 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml @@ -57,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames, bp.contract_part as contractPart, sd.dept_name as impUnitName, - tt.task_type as taskType + tt.task_type as taskType, + mt3.type_id as firstId from lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id @@ -71,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sda.dict_type = 'lease_task_status' left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0' left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0' + left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} @@ -334,7 +337,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lai.material_man AS materialMan, lai.confirm_time AS confirmTime, lai.is_confirm AS isConfirm, - lai.confirm_remark AS confirmRemark + lai.confirm_remark AS confirmRemark, + mt3.type_id AS firstId FROM lease_publish_details lpd LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id @@ -349,6 +353,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND mt.del_flag = '0' LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0' + left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0' + left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0' LEFT JOIN bm_agreement_info bai ON lpd.unit_id = bai.unit_id AND lpd.project_id = bai.project_id @@ -558,6 +564,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lod.create_time DESC + + update lease_out_details