From 8f9daa07745d8e46e17b7c315ad90147bc155359 Mon Sep 17 00:00:00 2001 From: MrZhai Date: Mon, 14 Mar 2022 17:21:08 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BB=93=E5=BA=93=E5=AD=97=E5=85=B8=E5=85=B3?= =?UTF-8?q?=E8=81=94=E7=94=A8=E6=88=B7=E5=92=8C=E5=8D=95=E6=8D=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/auth/AuthAdminController.java | 12 ++++- .../controller/inout/WareHouseController.java | 53 ++++++++++++++++--- .../sale/admin/dao/auth/AuthAdminDao.java | 8 ++- .../dao/inout/WarehouseBussinessTypeDao.java | 4 ++ .../admin/dao/inout/WarehouseUserDao.java | 20 ++++++- .../entity/inout/WarehouseUserEntity.java | 6 +++ .../admin/service/auth/AuthAdminService.java | 8 ++- .../auth/impl/AuthAdminServiceImpl.java | 11 +++- .../inout/WarehouseBussinessTypeService.java | 22 ++++++++ .../service/inout/WarehouseUserService.java | 18 ++++++- .../WarehouseBussinessTypeServiceImpl.java | 32 +++++++++++ .../inout/impl/WarehouseUserServiceImpl.java | 38 ++++++++++++- .../mybatis/mapper/auth/AuthAdminDao.xml | 3 ++ .../inout/WarehouseBussinessTypeDao.xml | 8 +++ .../mybatis/mapper/inout/WarehouseUserDao.xml | 31 ++++++++--- 15 files changed, 253 insertions(+), 21 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/auth/AuthAdminController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/auth/AuthAdminController.java index 7b1c151..9fa377a 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/auth/AuthAdminController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/auth/AuthAdminController.java @@ -5,7 +5,6 @@ import com.glxp.sale.admin.annotation.AuthRuleAnnotation; import com.glxp.sale.admin.entity.auth.AuthAdmin; import com.glxp.sale.admin.entity.auth.AuthRole; import com.glxp.sale.admin.entity.auth.AuthRoleAdmin; -import com.glxp.sale.admin.entity.auth.CustomerInfoEntity; import com.glxp.sale.admin.exception.JsonException; import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest; import com.glxp.sale.admin.req.auth.AuthAdminSaveRequest; @@ -15,7 +14,6 @@ import com.glxp.sale.admin.res.auth.AuthAdminRoleResponse; import com.glxp.sale.admin.service.auth.AuthAdminService; import com.glxp.sale.admin.service.auth.AuthRoleAdminService; import com.glxp.sale.admin.service.auth.AuthRoleService; -import com.glxp.sale.admin.service.auth.CustomerInfoService; import com.glxp.sale.admin.util.PasswordUtils; import com.glxp.sale.common.enums.ResultEnum; import com.glxp.sale.common.res.BaseResponse; @@ -335,4 +333,14 @@ public class AuthAdminController { AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId)); return authAdmin; } + + /** + * 获取医院用户列表 + * @return + */ + @AuthRuleAnnotation("") + @GetMapping("/admin/auth/admin/hospitalUserList") + public BaseResponse getHospitalUserList() { + return ResultVOUtils.success(authAdminService.getHospitalUserList()); + } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java index 53a4bac..454f284 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java @@ -1,5 +1,7 @@ package com.glxp.sale.admin.controller.inout; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.github.pagehelper.PageInfo; import com.glxp.sale.admin.annotation.AuthRuleAnnotation; import com.glxp.sale.admin.constant.ConstantStatus; @@ -12,11 +14,11 @@ import com.glxp.sale.admin.entity.info.CompanyEntity; import com.glxp.sale.admin.entity.inout.ErpOrderEntity; import com.glxp.sale.admin.entity.inout.OrderEntity; import com.glxp.sale.admin.entity.inout.WarehouseEntity; -import com.glxp.sale.admin.entity.inout.WarehouseUserEntity; import com.glxp.sale.admin.entity.udid.UdiEntity; import com.glxp.sale.admin.exception.JsonException; import com.glxp.sale.admin.req.inout.*; import com.glxp.sale.admin.res.PageSimpleResponse; +import com.glxp.sale.admin.res.basic.BussinessTypResponse; import com.glxp.sale.admin.res.inout.WarehouseResponse; import com.glxp.sale.admin.service.auth.AuthAdminService; import com.glxp.sale.admin.service.auth.CustomerService; @@ -42,6 +44,7 @@ import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Random; import java.util.stream.Collectors; @@ -476,12 +479,50 @@ public class WareHouseController { * @return */ @AuthRuleAnnotation("") - @GetMapping("/admin/warehouse/inout/warehouseUserList") - private BaseResponse getWarehouseUserList(String code) { - if (StringUtils.isBlank(code)) { + @GetMapping("/warehouse/inout/warehouseUserList") + public BaseResponse getWarehouseUserList(String code) { + if (StringUtils.isBlank(code)) return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); - } - List warehouseUserEntities = warehouseUserService.getWarehouseUserList(code); + return ResultVOUtils.success(warehouseUserService.getListByCode(code)); + } + + @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/warehouseBussniessTypeList") + public BaseResponse getWarehouseBussniessTypeList(String code) { + if (StrUtil.isBlank(code)) + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + return ResultVOUtils.success(warehouseBussinessTypeService.getListByCode(code)); + } + + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/saveWarehouseUser") + public BaseResponse saveWarehouseUser(@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); + warehouseUserService.saveWarehouseUser(code, JSONUtil.toList(userListJson, AuthAdmin.class)); + return ResultVOUtils.success(); + } + + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/saveWarehouseBussinessType") + public BaseResponse saveWarehouseBussinessType(@RequestBody Map params) { + String code = String.valueOf(params.get("code")); + String bussinessTypeJson = String.valueOf(params.get("bussinessTypes")); + if (StrUtil.isBlank(code) || StrUtil.isBlank(bussinessTypeJson)) + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + warehouseBussinessTypeService.saveWarehouseBussinessType(code, JSONUtil.toList(bussinessTypeJson, BussinessTypResponse.class)); + return ResultVOUtils.success(); + } + + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/updateDirector") + public BaseResponse updateDirector(Integer id) { + if (null == id) + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + warehouseUserService.updateDirector(id); return ResultVOUtils.success(); } + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthAdminDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthAdminDao.java index 7e45b0d..1d32a32 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthAdminDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/auth/AuthAdminDao.java @@ -1,7 +1,6 @@ package com.glxp.sale.admin.dao.auth; import com.glxp.sale.admin.entity.auth.AuthAdmin; -import com.glxp.sale.admin.entity.auth.UpdateUserflagBean; import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -70,4 +69,11 @@ public interface AuthAdminDao { boolean deleteById(Long id); boolean deleteByCustomerId(Long customerId); + + /** + * 查询医院用户列表 + * + * @return + */ + List selectHospitalUser(); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseBussinessTypeDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseBussinessTypeDao.java index 04c01b1..17ae1cf 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseBussinessTypeDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseBussinessTypeDao.java @@ -27,4 +27,8 @@ public interface WarehouseBussinessTypeDao { int updateBatchSelective(List list); int batchInsert(@Param("list") List list); + + List selectListByCode(@Param("code") String code); + + void deleteByCode(@Param("code") String code); } \ No newline at end of file diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseUserDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseUserDao.java index de3d933..c9a5917 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseUserDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/inout/WarehouseUserDao.java @@ -28,5 +28,23 @@ public interface WarehouseUserDao { int batchInsert(@Param("list") List list); - List selectWarehouseUserListByCode(@Param("code") String code); + List selectListByCode(@Param("code") String code); + + void deleteByCode(@Param("code") String code); + + /** + * 更新此仓库下的主管状态 + * + * @param code + * @param isDirector + */ + void updateDirector(@Param("code") String code, @Param("isDirector") int isDirector); + + /** + * 根据id更新主管状态 + * + * @param id + * @param isDirector + */ + void updateDirectorById(@Param("id") Integer id, @Param("isDirector") int isDirector); } \ No newline at end of file diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseUserEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseUserEntity.java index e068ad8..c22db91 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseUserEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/WarehouseUserEntity.java @@ -26,4 +26,10 @@ public class WarehouseUserEntity { * 用户名/登录账号 */ private String username; + + /** + * 是否是仓库主管 + */ + private boolean isDirector; + } \ No newline at end of file diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/auth/AuthAdminService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/auth/AuthAdminService.java index bd7aa09..dbd94d2 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/auth/AuthAdminService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/auth/AuthAdminService.java @@ -2,7 +2,6 @@ package com.glxp.sale.admin.service.auth; import com.glxp.sale.admin.entity.auth.AuthAdmin; -import com.glxp.sale.admin.entity.auth.UpdateUserflagBean; import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest; import java.util.List; @@ -28,4 +27,11 @@ public interface AuthAdminService { boolean deleteByCustomerId(Long customerId); + /** + * 获取医院用户列表 + * + * @return + */ + List getHospitalUserList(); + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/auth/impl/AuthAdminServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/auth/impl/AuthAdminServiceImpl.java index bf693cc..82945bc 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/auth/impl/AuthAdminServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/auth/impl/AuthAdminServiceImpl.java @@ -1,9 +1,9 @@ package com.glxp.sale.admin.service.auth.impl; +import cn.hutool.core.collection.CollUtil; import com.github.pagehelper.PageHelper; import com.glxp.sale.admin.dao.auth.AuthAdminDao; import com.glxp.sale.admin.entity.auth.AuthAdmin; -import com.glxp.sale.admin.entity.auth.UpdateUserflagBean; import com.glxp.sale.admin.exception.JsonException; import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest; import com.glxp.sale.admin.service.auth.AuthAdminService; @@ -122,5 +122,14 @@ public class AuthAdminServiceImpl implements AuthAdminService { return authAdminDao.deleteByCustomerId(customerId); } + @Override + public List getHospitalUserList() { + List userList = authAdminDao.selectHospitalUser(); + if (CollUtil.isEmpty(userList)) { + return Collections.emptyList(); + } + return userList; + } + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseBussinessTypeService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseBussinessTypeService.java index eb4d355..bce80ee 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseBussinessTypeService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseBussinessTypeService.java @@ -1,4 +1,26 @@ package com.glxp.sale.admin.service.inout; +import com.glxp.sale.admin.entity.inout.WarehouseBussinessTypeEntity; +import com.glxp.sale.admin.res.basic.BussinessTypResponse; + +import java.util.List; + public interface WarehouseBussinessTypeService { + + + /** + * 根据code查询数据列表 + * + * @param code + * @return + */ + List getListByCode(String code); + + /** + * 添加仓库信息-单据类型关联数据 + * + * @param code + * @param bussinessTypeEntities + */ + void saveWarehouseBussinessType(String code, List bussinessTypResponseList); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseUserService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseUserService.java index 9b0ea68..e81bbfa 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseUserService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/WarehouseUserService.java @@ -1,5 +1,6 @@ package com.glxp.sale.admin.service.inout; +import com.glxp.sale.admin.entity.auth.AuthAdmin; import com.glxp.sale.admin.entity.inout.WarehouseUserEntity; import java.util.List; @@ -12,5 +13,20 @@ public interface WarehouseUserService { * @param code 仓位码 * @return */ - List getWarehouseUserList(String code); + List getListByCode(String code); + + /** + * 新增仓库字典,用户关联数据 + * + * @param code + * @param userList + */ + void saveWarehouseUser(String code, List userList); + + /** + * 设置主管 + * + * @param id + */ + void updateDirector(Integer id); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseBussinessTypeServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseBussinessTypeServiceImpl.java index 2c5d9dc..3073d4a 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseBussinessTypeServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseBussinessTypeServiceImpl.java @@ -1,11 +1,17 @@ package com.glxp.sale.admin.service.inout.impl; +import cn.hutool.core.collection.CollUtil; import com.glxp.sale.admin.dao.inout.WarehouseBussinessTypeDao; +import com.glxp.sale.admin.entity.inout.WarehouseBussinessTypeEntity; +import com.glxp.sale.admin.res.basic.BussinessTypResponse; import com.glxp.sale.admin.service.inout.WarehouseBussinessTypeService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; @Slf4j @Service @@ -14,4 +20,30 @@ public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessType @Resource private WarehouseBussinessTypeDao warehouseBussinessTypeDao; + @Override + public List getListByCode(String code) { + List warehouseBussinessTypeEntities = warehouseBussinessTypeDao.selectListByCode(code); + if (CollUtil.isEmpty(warehouseBussinessTypeEntities)) { + return Collections.emptyList(); + } + return warehouseBussinessTypeEntities; + } + + @Override + public void saveWarehouseBussinessType(String code, List bussinessTypResponseList) { + if (CollUtil.isNotEmpty(bussinessTypResponseList)) { + List warehouseBussinessTypeEntities = new ArrayList<>(bussinessTypResponseList.size()); + bussinessTypResponseList.forEach(bussinessTypeEntity -> { + WarehouseBussinessTypeEntity entity = new WarehouseBussinessTypeEntity(); + entity.setCode(code); + entity.setAction(bussinessTypeEntity.getAction()); + entity.setName(bussinessTypeEntity.getName()); + warehouseBussinessTypeEntities.add(entity); + }); + //删除旧数据 + warehouseBussinessTypeDao.deleteByCode(code); + //加入新数据 + warehouseBussinessTypeDao.batchInsert(warehouseBussinessTypeEntities); + } + } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseUserServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseUserServiceImpl.java index 182692f..dab2857 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseUserServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inout/impl/WarehouseUserServiceImpl.java @@ -1,12 +1,16 @@ package com.glxp.sale.admin.service.inout.impl; +import cn.hutool.core.collection.CollUtil; import com.glxp.sale.admin.dao.inout.WarehouseUserDao; +import com.glxp.sale.admin.entity.auth.AuthAdmin; import com.glxp.sale.admin.entity.inout.WarehouseUserEntity; import com.glxp.sale.admin.service.inout.WarehouseUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; @Slf4j @@ -18,7 +22,37 @@ public class WarehouseUserServiceImpl implements WarehouseUserService { private WarehouseUserDao warehouseUserDao; @Override - public List getWarehouseUserList(String code) { - return warehouseUserDao.selectWarehouseUserListByCode(code); + public List getListByCode(String code) { + List warehouseUserEntities = warehouseUserDao.selectListByCode(code); + if (CollUtil.isEmpty(warehouseUserEntities)) { + return Collections.emptyList(); + } + return warehouseUserEntities; + } + + @Override + public void saveWarehouseUser(String code, List userList) { + if (CollUtil.isNotEmpty(userList)) { + List warehouseUserEntities = new ArrayList<>(userList.size()); + userList.forEach(user -> { + WarehouseUserEntity warehouseUserEntity = new WarehouseUserEntity(); + warehouseUserEntity.setCode(code); + warehouseUserEntity.setUsername(user.getUserName()); + warehouseUserEntity.setUserid(user.getId()); + warehouseUserEntities.add(warehouseUserEntity); + }); + //删除旧数据 + warehouseUserDao.deleteByCode(code); + warehouseUserDao.batchInsert(warehouseUserEntities); + } + } + + @Override + public void updateDirector(Integer id) { + if (null != id) { + WarehouseUserEntity warehouseUserEntity = warehouseUserDao.selectByPrimaryKey(id); + warehouseUserDao.updateDirector(warehouseUserEntity.getCode(), 0); + warehouseUserDao.updateDirectorById(id, 1); + } } } 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 fb2c5b8..422fd1c 100644 --- a/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml @@ -133,4 +133,7 @@ where CustomerId = #{customerId} + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseBussinessTypeDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseBussinessTypeDao.xml index 97c5751..2726c13 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseBussinessTypeDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseBussinessTypeDao.xml @@ -226,4 +226,12 @@ + + + + + delete from inv_warehouse_bussiness_type where code = #{code} + \ No newline at end of file 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 178bf34..80e45f9 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseUserDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/WarehouseUserDao.xml @@ -8,10 +8,11 @@ + - id, code, userId, userName + id, code, userId, userName, isDirector + + + + delete from inv_warehouse_user where code = #{code} + + + + update inv_warehouse_user set isDirector = #{isDirector} where code = #{code} + + + + update inv_warehouse_user set isDirector = #{isDirector} where id = #{id} + \ No newline at end of file