From 3680bf221a995076ca4be1468bca5536748a47fd Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 27 Dec 2024 18:35:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=85=B3=E8=81=94=E5=BA=93?= =?UTF-8?q?=E7=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ArchivesServiceImpl.java | 6 +++-- .../lease/domain/LeaseApplyDetails.java | 6 ++++- .../lease/mapper/LeaseApplyDetailsMapper.java | 3 ++- .../lease/mapper/LeaseApplyInfoMapper.java | 4 ++-- .../impl/LeaseApplyInfoServiceImpl.java | 22 +++++++++++++------ .../material/Archives/ArchivesMapper.xml | 3 +++ .../lease/LeaseApplyDetailsMapper.xml | 6 +++++ .../material/lease/LeaseApplyInfoMapper.xml | 8 ++++++- 8 files changed, 44 insertions(+), 14 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java index f56f3a7f..980637e0 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/archives/service/impl/ArchivesServiceImpl.java @@ -212,6 +212,9 @@ public class ArchivesServiceImpl implements ArchivesService { * @return */ private boolean isNameDuplicate(ArchivesDetails archivesDetails) { + archivesDetails.setLevel(StringUtils.isNotBlank(archivesDetails.getLevel()) + ? String.valueOf(Integer.parseInt(archivesDetails.getLevel()) + 1) + : "1"); ArchivesDetails info = archivesMapper.selectDetailsByName(archivesDetails); return info != null; } @@ -224,8 +227,7 @@ public class ArchivesServiceImpl implements ArchivesService { @Override public AjaxResult updateDetails(ArchivesDetails archivesDetails) { // 根据类型名称和上级id查询,同级下名称不能重复 - ArchivesDetails info = archivesMapper.selectDetailsByName(archivesDetails); - if (info != null && !archivesDetails.getDetailsId().equals(info.getDetailsId())) { + if (isNameDuplicate(archivesDetails)) { return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg()); } archivesDetails.setUpdateBy(SecurityUtils.getUsername()); 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 82c1fc2b..aade8173 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 @@ -96,6 +96,9 @@ public class LeaseApplyDetails extends BaseEntity { private String keyword; + @ApiModelProperty(value = "用户ID") + private Long userId; + @ApiModelProperty(value = "编码类型集合") private List maCodeVoList; @@ -112,8 +115,9 @@ public class LeaseApplyDetails extends BaseEntity { public LeaseApplyDetails() {} - public LeaseApplyDetails(Long parentId, String keyword) { + public LeaseApplyDetails(Long parentId, String keyword, Long userId) { this.parentId = parentId; this.keyword = keyword; + this.userId = userId; } } 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 0c308e5f..562accbf 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 @@ -101,7 +101,8 @@ public interface LeaseApplyDetailsMapper { /** * 获取领料出库单详情 * @param id + * @param userId * @return */ - List selectLeaseOutDetailsList(Long id); + List selectLeaseOutDetailsList(@Param("id") Long id, @Param("userId") Long userId); } 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 eb511d74..c77cc46f 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 @@ -13,10 +13,10 @@ public interface LeaseApplyInfoMapper { /** * 查询领料任务 * - * @param id 领料任务主键 + * @param leaseApplyInfo * @return 领料任务 */ - LeaseApplyInfo selectLeaseApplyInfoById(Long id); + LeaseApplyInfo selectLeaseApplyInfoById(LeaseApplyInfo leaseApplyInfo); /** * 查询领料任务列表 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 b38e4c83..e838795e 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 @@ -77,13 +77,17 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Override public LeaseApplyRequestVo selectLeaseApplyInfoById(Long id, String keyword) { try { - Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(id)); + LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); + leaseApplyInfo.setId(id); + Long userId = SecurityUtils.getUserId(); + leaseApplyInfo.setUserId(userId); + Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); optionalInfo.ifPresent(info -> { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword)); + List details = leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(info.getId(), keyword, userId)); if (!CollectionUtils.isEmpty(details)) { leaseApplyRequestVo.setLeaseApplyDetailsList(details); for (LeaseApplyDetails detail : details) { @@ -114,10 +118,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { + leaseApplyInfo.setUserId(SecurityUtils.getUserId()); List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); - for (LeaseApplyInfo applyInfo : list) { + /*for (LeaseApplyInfo applyInfo : list) { applyInfo.setMaTypeNames(leaseApplyDetailsMapper.selectMaTypeNameByParentId(applyInfo.getId())); - } + }*/ return list; } @@ -317,7 +322,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyDetailsList(LeaseApplyInfo leaseApplyInfo) { - return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord())); + return leaseApplyDetailsMapper.selectLeaseApplyDetailsList(new LeaseApplyDetails(leaseApplyInfo.getId(), leaseApplyInfo.getKeyWord(), leaseApplyInfo.getUserId())); } /** @@ -350,13 +355,16 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Override public LeaseApplyRequestVo getInfo(Long id) { try { - Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(id)); + LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); + leaseApplyInfo.setId(id); + Long userId = SecurityUtils.getUserId(); + Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); optionalInfo.ifPresent(info -> { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = leaseApplyDetailsMapper.selectLeaseOutDetailsList(id); + List details = leaseApplyDetailsMapper.selectLeaseOutDetailsList(id, userId); if (!CollectionUtils.isEmpty(details)) { leaseApplyRequestVo.setLeaseOutVoList(details); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/Archives/ArchivesMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/Archives/ArchivesMapper.xml index fed444a0..908d1842 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/Archives/ArchivesMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/Archives/ArchivesMapper.xml @@ -97,6 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and info_id = #{infoId} + + and level = #{level} + and parent_id = #{detailsId} 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 67b0cd37..013ff9ed 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 @@ -60,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id WHERE mm.ma_code is not null and mm.ma_status in (1) GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id + + JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} + 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 291ae199..6d2570b1 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 @@ -46,7 +46,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus, sda.dict_label as taskStatusName, IFNULL(sum(lad.pre_num),0) as preCountNum, - IFNULL(sum(lad.al_num),0) as alNum + IFNULL(sum(lad.al_num),0) as alNum, + GROUP_CONCAT(mt1.type_name) as maTypeNames from lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id @@ -57,6 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join bm_project bp on bp.pro_id = bai.project_id left join sys_dict_data sda on tt.task_status = sda.dict_value 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' + + JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} +