From cceb802448f9c1cd99ec92cd87e8621970dbc589 Mon Sep 17 00:00:00 2001 From: mashuai Date: Wed, 23 Jul 2025 09:04:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BackApplyInfoServiceImpl.java | 7 ++++ .../controller/LeaseApplyInfoController.java | 4 +-- .../lease/mapper/LeaseApplyDetailsMapper.java | 11 +++---- .../lease/mapper/LeaseApplyInfoMapper.java | 7 ++++ .../lease/service/ILeaseApplyInfoService.java | 4 +-- .../impl/LeaseApplyInfoServiceImpl.java | 33 ++++++++++++------- .../impl/LeaseOutDetailsServiceImpl.java | 4 ++- .../bonus/material/ma/domain/vo/MaTypeVo.java | 2 ++ .../material/repair/domain/RepairTask.java | 2 +- .../repair/domain/vo/ScrapApplyDetailsVO.java | 2 +- .../lease/LeaseApplyDetailsMapper.xml | 13 ++++++-- .../material/lease/LeaseApplyInfoMapper.xml | 33 +++++++++++++++++++ .../mapper/material/lease/LeaseTaskMapper.xml | 4 +-- .../mapper/material/ma/TypeRepairMapper.xml | 7 +++- 14 files changed, 101 insertions(+), 32 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index 555ed46b..3421b78b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -9,6 +9,7 @@ import cn.hutool.core.util.PhoneUtil; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.TypeTreeNode; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.common.biz.enums.*; import com.bonus.common.core.exception.ServiceException; @@ -345,6 +346,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { if (CollectionUtils.isNotEmpty(infos)) { list.addAll(infos); } + if (CollectionUtils.isNotEmpty( list)) { + list = list.stream() + .sorted(Comparator.comparing(BackApplyInfo::getCreateTime, + Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) + .collect(Collectors.toList()); + } // 提取关键字 String keyWord = backApplyInfo.getKeyWord(); // 如果关键字不为空,进行过滤 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java index 6408df60..455435cd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java @@ -189,7 +189,7 @@ public class LeaseApplyInfoController extends BaseController { //@RequiresPermissions("lease:info:query") @GetMapping(value = "/getInfo") public AjaxResult getInfo(LeaseApplyInfo leaseApplyInfo) { - return success(leaseApplyInfoService.getInfo(leaseApplyInfo.getId())); + return success(leaseApplyInfoService.getInfo(leaseApplyInfo)); } @ApiOperation(value = "导出领料出库单详情") @@ -197,7 +197,7 @@ public class LeaseApplyInfoController extends BaseController { @SysLog(title = "领料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务详情") @PostMapping("/exportInfo") public void exportInfo(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) { - LeaseApplyRequestVo leaseApplyRequestVo = leaseApplyInfoService.getInfo(leaseApplyInfo.getId()); + LeaseApplyRequestVo leaseApplyRequestVo = leaseApplyInfoService.getInfo(leaseApplyInfo); leaseApplyInfoService.exportInfo(leaseApplyInfo, leaseApplyRequestVo, response); } 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 50c29c69..76c77c34 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,11 +101,10 @@ public interface LeaseApplyDetailsMapper { /** * 获取领料出库单详情 - * @param id - * @param userId + * @param leaseApplyInfo * @return */ - List selectLeaseOutDetailsList(@Param("id") Long id, @Param("userId") Long userId); + List selectLeaseOutDetailsList(LeaseApplyInfo leaseApplyInfo); /** * 根据领料任务id查询领料任务详细 @@ -137,12 +136,10 @@ public interface LeaseApplyDetailsMapper { /** * 根据领料任务id查询领料任务详细 - * @param keyWord - * @param publishTask + * @param leaseApplyInfo * @return */ - List getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask, - @Param("list") List typeIdList); + List getDetailsPublish(LeaseApplyInfo leaseApplyInfo); /** * 根据领料任务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 e43e7d5d..69c40cbf 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 @@ -148,4 +148,11 @@ public interface LeaseApplyInfoMapper { * @return */ List selectOutList(@Param("id") Long id, @Param("leaseSignId") String leaseSignId); + + /** + * 查询领用单的领用单出库签名 + * @param leaseApplyInfo + * @return + */ + LeaseApplyInfo selectLeaseApplyInfoPublishList(LeaseApplyInfo leaseApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java index 105b7f09..11d26d1d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java @@ -124,10 +124,10 @@ public interface ILeaseApplyInfoService { /** * 获取领料任务详情 - * @param id + * @param leaseApplyInfo * @return */ - LeaseApplyRequestVo getInfo(Long id); + LeaseApplyRequestVo getInfo(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 fbd7f8cf..b1e290b3 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 @@ -95,6 +95,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } else { leaseApplyInfo.setUserId(userId); } + if (StringUtils.isNotBlank(keyword)) { + leaseApplyInfo.setKeyWord(keyword); + } + if (StringUtils.isNotBlank(publishTask)) { + leaseApplyInfo.setPublishTask(publishTask); + } Optional optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo)); LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); // 查询领用出库数据 @@ -149,7 +155,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { // 走单独的领用详情查询 if (StringUtils.isNotBlank(publishTask)) { // 根据领用批次查询领用详情 - details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask, typeIdList); + details = leaseApplyDetailsMapper.getDetailsPublish(leaseApplyInfo); if (!CollectionUtils.isEmpty(details)) { for (LeaseApplyDetails detail : details) { if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) { @@ -161,11 +167,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } } if (!CollectionUtils.isEmpty(details)) { - /*if (StringUtils.isNotBlank(keyword)) { - details = details.stream() - .filter(item -> containsDetailsKeyword(item, keyword)) - .collect(Collectors.toList()); - }*/ leaseApplyRequestVo.setLeaseApplyDetailsList(details); for (LeaseApplyDetails detail : details) { // 获取编码详情 @@ -203,7 +204,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } catch (Exception e) { // 记录异常日志 System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage()); - throw new RuntimeException("Failed to select lease apply info", e); + throw new RuntimeException("查询失败,请联系管理员"); } } @@ -1037,18 +1038,26 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } @Override - public LeaseApplyRequestVo getInfo(Long id) { + public LeaseApplyRequestVo getInfo(LeaseApplyInfo leaseApplyInfo) { try { - LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo(); - leaseApplyInfo.setId(id); Long userId = SecurityUtils.getLoginUser().getUserid(); + // 首先根据用户名去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)); + if (StringUtils.isNotBlank(leaseApplyInfo.getPublishTask())) { + optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoPublishList(leaseApplyInfo)); + } LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo(); optionalInfo.ifPresent(info -> { leaseApplyRequestVo.setLeaseApplyInfo(info); // 获取领料单详情 - List details = leaseApplyDetailsMapper.selectLeaseOutDetailsList(id, userId); + List details = leaseApplyDetailsMapper.selectLeaseOutDetailsList(leaseApplyInfo); if (!CollectionUtils.isEmpty(details)) { leaseApplyRequestVo.setLeaseOutVoList(details); } @@ -1056,7 +1065,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { return leaseApplyRequestVo; } catch (Exception e) { // 记录异常日志 - System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage()); + System.err.println("Error occurred while selecting lease apply info by ID: " + leaseApplyInfo.getId() + ", " + e.getMessage()); throw new RuntimeException("Failed to select lease apply info", e); } } 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 93fa7ec3..cd93574d 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 @@ -446,9 +446,11 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { int res = 0; // 领用任务单独判断 if (StringUtils.isNotBlank(record.getPublishTask())) { + LeaseApplyInfo applyInfo = new LeaseApplyInfo(); + applyInfo.setPublishTask(record.getPublishTask()); // 根据领用批次查询领用详情 boolean isFinished = true; - List details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask(), null); + List details = leaseApplyDetailsMapper.getDetailsPublish(applyInfo); 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/ma/domain/vo/MaTypeVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVo.java index ddc506e9..81c1f70d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/vo/MaTypeVo.java @@ -43,4 +43,6 @@ public class MaTypeVo extends Type { @ApiModelProperty(value = "是否显示绑定关系") private Boolean displayBindRelationship; + + private String keyword; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java index 28e915e6..f8e501df 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java @@ -156,7 +156,7 @@ public class RepairTask { * 维修人员 */ @ApiModelProperty(value = "维修人员") - @Excel(name = "维修班组",sort = 15) + //@Excel(name = "维修班组",sort = 15) private String repairer; /** * 维修时间 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java index b14394c0..849f1ebd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/ScrapApplyDetailsVO.java @@ -42,7 +42,7 @@ public class ScrapApplyDetailsVO { * 维修班组名称 */ @Excel(name = "维修班组",sort = 6) - @ApiModelProperty(value = "维修班组") + //@ApiModelProperty(value = "维修班组") private String teamName; /** 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 66ea27ab..5b80fcad 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 @@ -327,14 +327,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lease_out_details lod LEFT JOIN ma_type mt ON lod.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 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 ma_machine mm ON lod.ma_id = mm.ma_id LEFT JOIN lease_apply_details lad ON lod.type_id = lad.type_id AND lad.parent_id = #{id} -# LEFT JOIN purchase_check_details pcd ON lod.type_id = pcd.type_id JOIN ma_type_keeper mtk ON mtk.type_id = lod.type_id AND mtk.user_id = #{userId} WHERE lod.parent_id = #{id} - GROUP BY lod.type_id, mm.ma_code + + and mt4.type_id in + + #{item} + + + GROUP BY lod.type_id, mm.ma_id 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 0678bd39..c8619c24 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 @@ -568,6 +568,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update lease_out_details diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml index f6f82b10..005ee1ce 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseTaskMapper.xml @@ -771,9 +771,9 @@ GROUP BY mt.type_id ) AS subquery0 ON subquery0.type_id = mt.type_id - + WHERE lad.parent_id = #{id} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml index f10f5582..46ebfeae 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeRepairMapper.xml @@ -123,7 +123,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mt.type_id is not null and mhs.house_id = #{houseId} and mhs.del_flag = 0 - + + and ( + mt.type_name like concat('%', #{keyword}, '%') + or su.nick_name like concat('%', #{keyword}, '%') + ) +