From 0a28d48bea28a2984ef1184c95ac47cb07737b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Tue, 3 Jan 2023 10:32:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=93=E5=BA=93=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E7=94=A8=E6=88=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/inout/WareHouseController.java | 38 +++++++++---------- .../inventory/FilterInvBusUserRequest.java | 3 ++ .../req/inventory/FilterInvUserRequest.java | 4 ++ .../mybatis/mapper/inout/WarehouseUserDao.xml | 6 +++ .../mapper/inventory/InvBusUserDao.xml | 7 +++- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java index d782ed83..a26cede1 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/inout/WareHouseController.java @@ -30,6 +30,7 @@ import com.glxp.api.admin.req.basic.CompanyProductRelevanceRequest; import com.glxp.api.admin.req.inout.*; import com.glxp.api.admin.req.inventory.FilterInvBusUserRequest; import com.glxp.api.admin.req.inventory.FilterInvLinkDataRequest; +import com.glxp.api.admin.req.inventory.FilterInvUserRequest; import com.glxp.api.admin.res.PageSimpleResponse; import com.glxp.api.admin.res.basic.BussinessTypResponse; import com.glxp.api.admin.res.basic.UdiRelevanceResponse; @@ -1280,28 +1281,25 @@ public class WareHouseController { if (StrUtil.isBlank(code) || StrUtil.isBlank(userListJson)) return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); List userList = JSONUtil.toList(userListJson, AuthAdmin.class); - - - //获取用户关联单据类型信息 - FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest(); - filterInvBusUserRequest.setSubInvCode(code); - List invBusUserEntities = invBusUserService.filterJoinInvBusUser(filterInvBusUserRequest); - Map filteBusTypes = new HashMap<>(); - for (InvBusUserResponse invBusUserEntity : invBusUserEntities) { - boolean isExit = false; - for (AuthAdmin authAdmin : userList) { - if (authAdmin.getId() == Long.parseLong(invBusUserEntity.getUserId())) { - isExit = true; - continue; - } - } - if (isExit) { - filteBusTypes.put(invBusUserEntity.getUserId(), invBusUserEntity); + //取出选中的userId + List list = userList .stream().map(AuthAdmin::getId).distinct().collect(Collectors.toList()); + //查询该仓库下面绑定的用户 + FilterInvUserRequest filterInvUserRequest=new FilterInvUserRequest(); + filterInvUserRequest.setCode(code); + filterInvUserRequest.setUserList(list); + List filterList=warehouseUserService.filterWarehouseUsers(filterInvUserRequest); + list = filterList .stream().map(WarehouseUserEntity::getUserid).distinct().collect(Collectors.toList()); + + if(list.size()>0){ + //获取用户关联单据类型信息 + FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest(); + filterInvBusUserRequest.setSubInvCode(code); + filterInvBusUserRequest.setUserList(list); + List invBusUserEntities = invBusUserService.filterJoinInvBusUser(filterInvBusUserRequest); + if (invBusUserEntities.size() > 0) { + return ResultVOUtils.error(500, "请先移除用户已关联单据类型!"); } } - if (filteBusTypes.size() > 0) { - return ResultVOUtils.error(500, "请先移除用户已关联单据类型!"); - } warehouseUserService.saveWarehouseUser(code, userList); InvSubWarehouseEntity invSubWarehouseEntity = diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvBusUserRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvBusUserRequest.java index dd59eb38..232eb10f 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvBusUserRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvBusUserRequest.java @@ -3,6 +3,8 @@ package com.glxp.api.admin.req.inventory; import com.glxp.api.admin.req.ListPageRequest; import lombok.Data; +import java.util.List; + @Data public class FilterInvBusUserRequest extends ListPageRequest { @@ -10,4 +12,5 @@ public class FilterInvBusUserRequest extends ListPageRequest { private String userId; private String subInvCode; private String scAction; + private List userList; } diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvUserRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvUserRequest.java index 640b8b79..465f8df3 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvUserRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterInvUserRequest.java @@ -3,6 +3,8 @@ package com.glxp.api.admin.req.inventory; import com.glxp.api.admin.req.ListPageRequest; import lombok.Data; +import java.util.List; + @Data public class FilterInvUserRequest extends ListPageRequest { @@ -16,4 +18,6 @@ public class FilterInvUserRequest extends ListPageRequest { private Boolean isDirector; private String lastUpdateTime; + private List userList; + } diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseUserDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseUserDao.xml index 28ef981b..ac2e70b3 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseUserDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseUserDao.xml @@ -269,6 +269,12 @@ = DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]> + + AND userId not in + + #{item} + + diff --git a/api-admin/src/main/resources/mybatis/mapper/inventory/InvBusUserDao.xml b/api-admin/src/main/resources/mybatis/mapper/inventory/InvBusUserDao.xml index 7f8f57e9..ff9f45ba 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inventory/InvBusUserDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inventory/InvBusUserDao.xml @@ -36,7 +36,12 @@ AND scAction = #{scAction} - + + AND userId in + + #{item} + + group by inv_bustype_user.id