diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/auth/AuthAdminController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/auth/AuthAdminController.java index dc46a50d..d5268780 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/auth/AuthAdminController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/auth/AuthAdminController.java @@ -9,9 +9,12 @@ import com.glxp.api.admin.entity.auth.AuthAdmin; import com.glxp.api.admin.entity.auth.AuthRole; import com.glxp.api.admin.entity.auth.AuthRoleAdmin; import com.glxp.api.admin.entity.auth.DeptEntity; +import com.glxp.api.admin.entity.inout.WarehouseUserEntity; import com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity; import com.glxp.api.admin.req.auth.AuthAdminQueryRequest; import com.glxp.api.admin.req.auth.AuthAdminSaveRequest; +import com.glxp.api.admin.req.auth.FilterNoSelectUserRequest; +import com.glxp.api.admin.req.inventory.FilterInvLinkDataRequest; import com.glxp.api.admin.res.PageSimpleResponse; import com.glxp.api.admin.res.auth.AuthAdminResponse; import com.glxp.api.admin.res.auth.AuthAdminRoleResponse; @@ -59,7 +62,6 @@ public class AuthAdminController { private WarehouseUserService warehouseUserService; - /** * 获取管理员列表 */ @@ -285,7 +287,7 @@ public class AuthAdminController { // 先删除之前的角色 authRoleAdminService.deleteByAdminId(authAdminSaveRequest.getId()); - warehouseUserService.deleteByCodeAndId(authAdminSaveRequest.getId(),byId.getLocSubInvCode()); + warehouseUserService.deleteByCodeAndId(authAdminSaveRequest.getId(), byId.getLocSubInvCode()); return ResultVOUtils.success(); } @@ -295,11 +297,31 @@ public class AuthAdminController { * @return */ @AuthRuleAnnotation("") + @GetMapping("/admin/auth/admin/selectNotSelectUser") + public BaseResponse selectNotSelectUser(FilterInvLinkDataRequest filterInvLinkDataRequest) { + List warehouseUserEntities = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest); + List userIds = new ArrayList<>(); + warehouseUserEntities.forEach(user -> { + userIds.add(user.getUserid()); + }); + FilterNoSelectUserRequest filterNoSelectUserRequest = new FilterNoSelectUserRequest(); + BeanUtils.copyProperties(filterInvLinkDataRequest, filterNoSelectUserRequest); + filterNoSelectUserRequest.setUserIds(userIds); + List hospitalUserList = authAdminService.selectNotSelectUser(filterNoSelectUserRequest); + PageInfo authAdminPageInfo = new PageInfo<>(hospitalUserList); + PageSimpleResponse authAdminPageSimpleResponse = new PageSimpleResponse<>(); + authAdminPageSimpleResponse.setTotal(authAdminPageInfo.getTotal()); + authAdminPageSimpleResponse.setList(hospitalUserList); + return ResultVOUtils.success(authAdminPageSimpleResponse); + + } + + //仓库未关联用户列表 + @AuthRuleAnnotation("") @GetMapping("/admin/auth/admin/hospitalUserList") public BaseResponse getHospitalUserList() { List hospitalUserList = authAdminService.getHospitalUserList(); return ResultVOUtils.success(hospitalUserList); } - } 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 7ed02b14..6d04c6f6 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 @@ -1279,7 +1279,6 @@ public class WareHouseController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); List userList = JSONUtil.toList(userListJson, AuthAdmin.class); - //获取用户关联单据类型信息 FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest(); filterInvBusUserRequest.setSubInvCode(code); @@ -1300,6 +1299,23 @@ public class WareHouseController { if (filteBusTypes.size() > 0) { return ResultVOUtils.error(500, "请先移除用户已关联单据类型!"); } + warehouseUserService.deleteByCode(code); + warehouseUserService.saveWarehouseUser(code, userList); + InvSubWarehouseEntity invSubWarehouseEntity = + invSubWarehouseService.findByInvSubByCode(code); + invWarehouseService.updateTime(invSubWarehouseEntity.getParentId(), new Date()); + return ResultVOUtils.success(); + } + + + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/addWarehouseUser") + public BaseResponse addWarehouseUser(@RequestBody Map params) { + String code = String.valueOf(params.get("code")); + String userListJson = String.valueOf(params.get("userList")); + if (StrUtil.isBlank(code) || StrUtil.isBlank(userListJson)) + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + List userList = JSONUtil.toList(userListJson, AuthAdmin.class); warehouseUserService.saveWarehouseUser(code, userList); InvSubWarehouseEntity invSubWarehouseEntity = @@ -1308,6 +1324,7 @@ public class WareHouseController { return ResultVOUtils.success(); } + @AuthRuleAnnotation("") @PostMapping("/warehouse/inout/saveWarehouseBussinessType") public BaseResponse saveWarehouseBussinessType(@RequestBody Map params) { diff --git a/api-admin/src/main/java/com/glxp/api/admin/dao/auth/AuthAdminDao.java b/api-admin/src/main/java/com/glxp/api/admin/dao/auth/AuthAdminDao.java index ac620bf0..23d3aaab 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/dao/auth/AuthAdminDao.java +++ b/api-admin/src/main/java/com/glxp/api/admin/dao/auth/AuthAdminDao.java @@ -3,6 +3,7 @@ package com.glxp.api.admin.dao.auth; import com.glxp.api.admin.req.auth.AuthAdminQueryRequest; import com.glxp.api.admin.entity.auth.AuthAdmin; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -73,6 +74,8 @@ public interface AuthAdminDao { */ List selectHospitalUser(); + List selectNotSelectUser(@Param("userIds") List userIds); + List selectAllocatedList(AuthAdminQueryRequest authAdminQueryRequest); List selectUnallocatedList(AuthAdminQueryRequest authAdminQueryRequest); diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/auth/AuthAdminQueryRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/auth/AuthAdminQueryRequest.java index df01f03d..7c99beee 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/auth/AuthAdminQueryRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/auth/AuthAdminQueryRequest.java @@ -27,5 +27,6 @@ public class AuthAdminQueryRequest extends ListPageRequest { * 部门编码 */ private String deptCode; + private String invCode; //仓库号 } diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/auth/FilterNoSelectUserRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/auth/FilterNoSelectUserRequest.java new file mode 100644 index 00000000..6a9b53eb --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/req/auth/FilterNoSelectUserRequest.java @@ -0,0 +1,13 @@ +package com.glxp.api.admin.req.auth; + +import com.glxp.api.admin.req.ListPageRequest; +import lombok.Data; + +import java.util.List; + +@Data +public class FilterNoSelectUserRequest extends ListPageRequest { + + + List userIds; +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/auth/AuthAdminService.java b/api-admin/src/main/java/com/glxp/api/admin/service/auth/AuthAdminService.java index 7b6244f2..cc54aeb6 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/auth/AuthAdminService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/auth/AuthAdminService.java @@ -3,6 +3,7 @@ package com.glxp.api.admin.service.auth; import com.glxp.api.admin.entity.auth.AuthAdmin; import com.glxp.api.admin.req.auth.AuthAdminQueryRequest; +import com.glxp.api.admin.req.auth.FilterNoSelectUserRequest; import java.util.List; @@ -31,6 +32,7 @@ public interface AuthAdminService { */ List getHospitalUserList(); + List selectNotSelectUser(FilterNoSelectUserRequest filterNoSelectUserRequest); List selectAllocatedList(AuthAdminQueryRequest authAdminQueryRequest); diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/auth/impl/AuthAdminServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/auth/impl/AuthAdminServiceImpl.java index 8d705935..4d17b280 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/auth/impl/AuthAdminServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/auth/impl/AuthAdminServiceImpl.java @@ -8,6 +8,7 @@ import com.glxp.api.admin.entity.auth.AuthAdmin; import com.glxp.api.admin.entity.auth.SysUserRole; import com.glxp.api.admin.exception.JsonException; import com.glxp.api.admin.req.auth.AuthAdminQueryRequest; +import com.glxp.api.admin.req.auth.FilterNoSelectUserRequest; import com.glxp.api.admin.req.auth.SysUserRoleRequest; import com.glxp.api.admin.service.auth.AuthAdminService; import com.glxp.api.common.enums.ResultEnum; @@ -127,6 +128,20 @@ public class AuthAdminServiceImpl implements AuthAdminService { return authAdminDao.selectHospitalUser(); } + @Override + public List selectNotSelectUser(FilterNoSelectUserRequest filterNoSelectUserRequest) { + + + if (filterNoSelectUserRequest == null) { + return Collections.emptyList(); + } + if (filterNoSelectUserRequest.getPage() != null) { + int offset = (filterNoSelectUserRequest.getPage() - 1) * filterNoSelectUserRequest.getLimit(); + PageHelper.offsetPage(offset, filterNoSelectUserRequest.getLimit()); + } + return authAdminDao.selectNotSelectUser(filterNoSelectUserRequest.getUserIds()); + } + @Override public List selectAllocatedList(AuthAdminQueryRequest authAdminQueryRequest) { diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inout/WarehouseUserService.java b/api-admin/src/main/java/com/glxp/api/admin/service/inout/WarehouseUserService.java index 81c79011..4f70cabb 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inout/WarehouseUserService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inout/WarehouseUserService.java @@ -5,7 +5,6 @@ import com.glxp.api.admin.entity.auth.AuthAdmin; import com.glxp.api.admin.entity.inout.WarehouseUserEntity; import com.glxp.api.admin.req.inventory.FilterInvLinkDataRequest; import com.glxp.api.admin.req.inventory.FilterInvUserRequest; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -51,7 +50,7 @@ public interface WarehouseUserService { void deleteWarehouseUser(Integer id); void deleteByCodeAndId(Long id, String code); - + void deleteByCode(String code); /** * 查询分仓关联的用户列表 * diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inout/impl/WarehouseUserServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/inout/impl/WarehouseUserServiceImpl.java index b5670a16..58cdfd32 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inout/impl/WarehouseUserServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inout/impl/WarehouseUserServiceImpl.java @@ -65,8 +65,6 @@ public class WarehouseUserServiceImpl implements WarehouseUserService { @Override public void saveWarehouseUser(String code, List userList) { - //删除旧数据 - warehouseUserDao.deleteByCode(code); if (CollUtil.isNotEmpty(userList)) { List warehouseUserEntities = new ArrayList<>(userList.size()); userList.forEach(user -> { @@ -107,11 +105,16 @@ public class WarehouseUserServiceImpl implements WarehouseUserService { @Override public void deleteByCodeAndId(Long id, String code) { - if(null !=id && null !=code){ - warehouseUserDao.deleteByCodeAndId(id,code); + if (null != id && null != code) { + warehouseUserDao.deleteByCodeAndId(id, code); } } + @Override + public void deleteByCode(String code) { + warehouseUserDao.deleteByCode(code); + } + @Override public List getWarehouseUserList(FilterInvLinkDataRequest filterInvLinkDataRequest) { if (filterInvLinkDataRequest == null) { diff --git a/api-admin/src/main/resources/application-dev.properties b/api-admin/src/main/resources/application-dev.properties index 49ca51d6..2c87aee0 100644 --- a/api-admin/src/main/resources/application-dev.properties +++ b/api-admin/src/main/resources/application-dev.properties @@ -1,4 +1,4 @@ -server.port=9992 +server.port=9991 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udiwms_ph1?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true spring.datasource.username=root diff --git a/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml b/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml index 72cc7cad..92adcbfc 100644 --- a/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml @@ -156,6 +156,23 @@ + + +