From 9e1f958e4003c68048676dc9712c3693eb61748e Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Mon, 17 Jun 2024 11:09:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E5=B7=A5=E6=9C=BA?= =?UTF-8?q?=E5=85=B7=E5=85=A5=E5=BA=93-=E9=87=87=E8=B4=AD=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/warehouseManage/warehousing/newTools/index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sgzb-ui/src/views/warehouseManage/warehousing/newTools/index.vue b/sgzb-ui/src/views/warehouseManage/warehousing/newTools/index.vue index 14b0627d..51f12083 100644 --- a/sgzb-ui/src/views/warehouseManage/warehousing/newTools/index.vue +++ b/sgzb-ui/src/views/warehouseManage/warehousing/newTools/index.vue @@ -27,7 +27,7 @@ - + Date: Mon, 17 Jun 2024 13:37:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=A2=86=E6=96=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseMacodeInfoController.java | 5 ++- .../impl/PurchaseMacodeInfoServiceImpl.java | 38 +++++++++++-------- .../mapper/material/AgreementInfoMapper.xml | 3 +- .../material/PurchaseMacodeInfoMapper.xml | 3 +- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java index f96250b7..c121bfdd 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/PurchaseMacodeInfoController.java @@ -53,8 +53,9 @@ public class PurchaseMacodeInfoController extends BaseController { @ApiOperation(value = "查询单个新购验收编号管理列表详情") @GetMapping("/details") public AjaxResult details(PurchaseMacodeInfo purchaseMacodeInfo) throws Exception { - if (purchaseMacodeInfo.getTaskId() == null || purchaseMacodeInfo.getTaskId() == 0) { - throw new Exception("任务taskId为空!!!"); + if (purchaseMacodeInfo.getTaskId() == null || purchaseMacodeInfo.getTaskId() == 0 + || purchaseMacodeInfo.getTypeId() == null || purchaseMacodeInfo.getTypeId() == 0) { + throw new Exception("任务taskId或者类型typeId为空!!!"); } List list = purchaseMacodeInfoService.selectPurchaseMacodeInfoListDetails(purchaseMacodeInfo); return AjaxResult.success(list); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java index 72c25af5..901e0801 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java @@ -2,10 +2,7 @@ package com.bonus.sgzb.material.service.impl; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import cn.hutool.core.collection.CollUtil; @@ -75,19 +72,30 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService */ @Override public List selectPurchaseMacodeInfoList(PurchaseMacodeInfo purchaseMacodeInfo) { - List purchaseMacodeInfoList = purchaseMacodeInfoMapper.selectPurchaseMacodeInfoList(purchaseMacodeInfo); //判断有没有绑定固定资产 - if (purchaseMacodeInfoList.size() > 0 && purchaseMacodeInfoList.get(0).getFixCode() != null) { - Map groupCounts = purchaseMacodeInfoList.stream().map(PurchaseMacodeInfo::getFixCode).collect(Collectors.groupingBy(String::valueOf, Collectors.counting())); - //去重 - purchaseMacodeInfoList = purchaseMacodeInfoList.stream().distinct().collect(Collectors.toList()); - for (PurchaseMacodeInfo purchaseMacodeInfo1 : purchaseMacodeInfoList) { - groupCounts.forEach((fixCode, count) -> { - if (purchaseMacodeInfo1.getFixCode().equals(fixCode)) { - purchaseMacodeInfo1.setBindNum(count.intValue()); - } - }); + if (purchaseMacodeInfoList.size() > 0 && purchaseMacodeInfoList.get(0).getFixCode()!=null) { + Map groupCounts = purchaseMacodeInfoList.stream().map(PurchaseMacodeInfo::getTypeId).collect(Collectors.groupingBy(String::valueOf, Collectors.counting())); + // 根据 typeId 进行去重 + purchaseMacodeInfoList = purchaseMacodeInfoList.stream() + // 指定键为 typeId + .collect(Collectors.toMap(PurchaseMacodeInfo::getTypeId, + // 指定值为对象本身 + maCodeInfo -> maCodeInfo, + // 如果存在重复的 typeId,则保留已存在的对象 + (existing, replacement) -> existing)) + .values().stream().collect(Collectors.toList()); + //遍历purchaseMaCodeInfoList集合,非空判断取值 + purchaseMacodeInfoList.stream() + .forEach(purchaseMaCodeInfo1 -> { + Optional.ofNullable(groupCounts.get(String.valueOf(purchaseMaCodeInfo1.getFixCode()))) + .ifPresent(count -> purchaseMaCodeInfo1.setBindNum(count.intValue())); + }); + } + //根据fixCode固定资产编号判断是否绑定,未绑定,绑定数量设置为0 + for (PurchaseMacodeInfo maCodeInfo : purchaseMacodeInfoList) { + if (maCodeInfo.getFixCode() == null) { + maCodeInfo.setBindNum(0); } } return purchaseMacodeInfoList; diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml index 83ed6c6b..b5a770d7 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml @@ -109,7 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id where bai.status = '1' - and (bai.contract_code like concat('%', #{keyWord}, '%') or + and (bai.agreement_code like concat('%', #{keyWord}, '%') or + bai.contract_code like concat('%', #{keyWord}, '%') or auth_person like concat('%', #{keyWord}, '%') or bp.lot_name like concat('%', #{keyWord}, '%') or bui.unit_name like concat('%', #{keyWord}, '%') or diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml index 0592528d..3e2cd785 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml @@ -45,7 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pmi.code_type = #{codeType} and pmi.status = #{status} and pmi.company_id = #{companyId} - GROUP BY pcd.type_id