diff --git a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java index 34868d3d..ffccc3e4 100644 --- a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java +++ b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java @@ -15,6 +15,7 @@ import com.glxp.api.controller.BaseController; import com.glxp.api.dto.DictDto; import com.glxp.api.entity.auth.*; import com.glxp.api.entity.basic.BasicBussinessTypeEntity; +import com.glxp.api.entity.system.CompanyEntity; import com.glxp.api.req.auth.*; import com.glxp.api.req.basic.FilterBussinessTypeRequest; import com.glxp.api.req.system.DeleteRequest; @@ -25,8 +26,10 @@ import com.glxp.api.res.auth.InvWarehouseThirdSysResponse; import com.glxp.api.res.basic.BasicBussinessTypeResponse; import com.glxp.api.service.auth.*; import com.glxp.api.service.basic.IBasicBussinessTypeService; +import com.glxp.api.service.system.CompanyService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.util.IntUtil; +import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -48,6 +51,8 @@ public class InvWarehouseController extends BaseController { @Resource CustomerService customerService; @Resource + CompanyService companyService; + @Resource private WarehouseUserService warehouseUserService; @Resource private SystemParamConfigService systemParamConfigService; @@ -59,6 +64,8 @@ public class InvWarehouseController extends BaseController { private InvSpaceService invSpaceService; @Resource InvBusUserService invBusUserService; + @Resource + AuthWarehouseUnifyService authWarehouseUnifyService; /** * 获取仓库列表 @@ -664,4 +671,76 @@ public class InvWarehouseController extends BaseController { return ResultVOUtils.success(list); } + + + @GetMapping("spms/sub/inv/unifyWarehouseList") + public BaseResponse unifyWarehouseList() { + FilterInvSubWarehouseRequest filterInvSubWarehouseRequest = new FilterInvSubWarehouseRequest(); + filterInvSubWarehouseRequest.setUnifyUse(true); + filterInvSubWarehouseRequest.setSpUse(true); + List responses = invWarehouseService.unifyWarehouseList(filterInvSubWarehouseRequest); + return ResultVOUtils.success(responses); + } + + /** + * 根据仓位码获取关联用户数据 + */ + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/warehouseListByCode") + public BaseResponse warehouseListByCode(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + List warehouseUserList = warehouseUserService.warehouseListByCode(filterInvLinkDataRequest); + PageInfo pageInfo = new PageInfo<>(warehouseUserList); + PageSimpleResponse response = new PageSimpleResponse<>(); + response.setList(pageInfo.getList()); + response.setTotal(pageInfo.getTotal()); + return ResultVOUtils.success(response); + } + + + + /** + * 获取医院用户列表 + * + * @return + */ + @AuthRuleAnnotation("") + @GetMapping("/warehouse/inout/selectNotSelectCustomer") + public BaseResponse selectNotSelectCustomer(FilterInvLinkDataRequest filterInvLinkDataRequest) { + //获取当前仓库已关联用户 + FilterInvLinkDataRequest temRequest = new FilterInvLinkDataRequest(); + temRequest.setCode(filterInvLinkDataRequest.getCode()); + List companyEntities = warehouseUserService.warehouseListByCode(temRequest); + List customerIds = new ArrayList<>(); + for (CompanyEntity item : companyEntities) { + customerIds.add(item.getCustomerId()); + } + FilterCompanyRequest companyRequest = new FilterCompanyRequest(); + companyRequest.setNotSelectCustomers(customerIds); + List companyEntities1 = companyService.filterCompany(companyRequest); + + PageInfo pageInfo = new PageInfo<>(companyEntities1); + PageSimpleResponse response = new PageSimpleResponse<>(); + response.setTotal(pageInfo.getTotal()); + response.setList(companyEntities1); + return ResultVOUtils.success(response); + + } + + + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/addWarehouseCustomer") + public BaseResponse addWarehouseCustomer(@RequestBody FilterInvLinkDataRequest filterInvLinkDataRequest) { + warehouseUserService.addWarehouseCustomer(filterInvLinkDataRequest); + return ResultVOUtils.success(); + } + + @AuthRuleAnnotation("") + @PostMapping("/warehouse/inout/deleteWarehouseCustomer") + public BaseResponse deleteWarehouseCustomer(@RequestBody AuthWarehouseUnify authWarehouseUnify) { + authWarehouseUnifyService.deleteWarehouseCustomer(authWarehouseUnify); + return ResultVOUtils.success(); + } } diff --git a/src/main/java/com/glxp/api/controller/auth/RegisterController.java b/src/main/java/com/glxp/api/controller/auth/RegisterController.java index 420f3b14..6111c29b 100644 --- a/src/main/java/com/glxp/api/controller/auth/RegisterController.java +++ b/src/main/java/com/glxp/api/controller/auth/RegisterController.java @@ -257,6 +257,10 @@ public class RegisterController { if (userRegisterEntity2 != null) { return ResultVOUtils.error(500, "该企业已被注册!"); } + List unifyWarehouse = userRegisterEntity.getUnifyWarehouse(); + if (unifyWarehouse == null || unifyWarehouse.size() == 0){ + return ResultVOUtils.error(500, "配送医院不可以为空!"); + } userRegisterEntity.setRegisterTime(DateUtil.getDateTime()); userRegisterEntity.setCheckType(0);//未审核 diff --git a/src/main/java/com/glxp/api/dao/auth/AuthWarehouseUnifyMapper.java b/src/main/java/com/glxp/api/dao/auth/AuthWarehouseUnifyMapper.java new file mode 100644 index 00000000..6fa410bf --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/AuthWarehouseUnifyMapper.java @@ -0,0 +1,10 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.auth.AuthWarehouseUnify; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AuthWarehouseUnifyMapper extends BaseMapperPlus { + +} \ No newline at end of file diff --git a/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java b/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java index c096cba0..9ede627b 100644 --- a/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java +++ b/src/main/java/com/glxp/api/dao/auth/WarehouseUserDao.java @@ -2,6 +2,7 @@ package com.glxp.api.dao.auth; import com.glxp.api.dao.BaseMapperPlus; import com.glxp.api.entity.auth.WarehouseUserEntity; +import com.glxp.api.entity.system.CompanyEntity; import com.glxp.api.req.auth.FilterInvLinkDataRequest; import com.glxp.api.req.auth.FilterInvUserRequest; import org.apache.ibatis.annotations.Mapper; @@ -69,4 +70,6 @@ public interface WarehouseUserDao extends BaseMapperPlus warehouseListByCode(FilterInvLinkDataRequest filterInvLinkDataRequest); } diff --git a/src/main/java/com/glxp/api/entity/auth/AuthWarehouseUnify.java b/src/main/java/com/glxp/api/entity/auth/AuthWarehouseUnify.java new file mode 100644 index 00000000..bda61210 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/AuthWarehouseUnify.java @@ -0,0 +1,37 @@ +package com.glxp.api.entity.auth; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +/** + * 医院共同体关系表 + */ +@Data +@TableName(value = "auth_warehouse_unify") +public class AuthWarehouseUnify { + + @TableId(value = "id", type = IdType.INPUT) + private Long id; + + /** + * 仓库编码 + */ + @TableField("code") + private String code; + + /** + * 客户ID + */ + @TableField("customerId") + private String customerId; + + @TableField("updateTime") + private Date updateTime; + + +} \ No newline at end of file diff --git a/src/main/java/com/glxp/api/entity/auth/InvWarehouseEntity.java b/src/main/java/com/glxp/api/entity/auth/InvWarehouseEntity.java index 9462f642..84470f84 100644 --- a/src/main/java/com/glxp/api/entity/auth/InvWarehouseEntity.java +++ b/src/main/java/com/glxp/api/entity/auth/InvWarehouseEntity.java @@ -91,6 +91,13 @@ public class InvWarehouseEntity { @TableField(value = "spUse") private Boolean spUse; + + /** + * 是否医院标识 0否 1是 + */ + @TableField(value = "unifyUse") + private Boolean unifyUse; + @TableField(value = "updateTime") private Date updateTime; diff --git a/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java b/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java index 936394cb..50f89a5c 100644 --- a/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java +++ b/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java @@ -2,6 +2,8 @@ package com.glxp.api.entity.auth; import lombok.Data; +import java.util.List; + @Data public class UserRegisterEntity { @@ -29,4 +31,5 @@ public class UserRegisterEntity { private String licenseUrl; private String udplatCompanyName; private String udplatCompanyId; + private List unifyWarehouse; } diff --git a/src/main/java/com/glxp/api/entity/system/CompanyEntity.java b/src/main/java/com/glxp/api/entity/system/CompanyEntity.java index 8c725c70..c58bea66 100644 --- a/src/main/java/com/glxp/api/entity/system/CompanyEntity.java +++ b/src/main/java/com/glxp/api/entity/system/CompanyEntity.java @@ -80,4 +80,5 @@ public class CompanyEntity { private String alihealthAppKey; private String alihealthAppSecret; private String alihealthRefEntId; + private Long unifyId; } diff --git a/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java b/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java index ca745799..5b703e75 100644 --- a/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java +++ b/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java @@ -15,4 +15,5 @@ public class FilterCompanyRequest extends ListPageRequest { private String unitIdFk; private List auditStatusList; + private List notSelectCustomers; } diff --git a/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java b/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java index 58fc1977..22455d57 100644 --- a/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java +++ b/src/main/java/com/glxp/api/req/auth/FilterInvLinkDataRequest.java @@ -1,8 +1,11 @@ package com.glxp.api.req.auth; +import com.glxp.api.entity.system.CompanyEntity; import com.glxp.api.util.page.ListPageRequest; import lombok.Data; +import java.util.List; + /** * 查询仓库关联的数据请求参数 */ @@ -15,6 +18,7 @@ public class FilterInvLinkDataRequest extends ListPageRequest { private String employeeName; private Long listUser[]; private String parentId; + private List customerList; } diff --git a/src/main/java/com/glxp/api/req/auth/FilterInvSubWarehouseRequest.java b/src/main/java/com/glxp/api/req/auth/FilterInvSubWarehouseRequest.java index 85c6ecc7..31e100ff 100644 --- a/src/main/java/com/glxp/api/req/auth/FilterInvSubWarehouseRequest.java +++ b/src/main/java/com/glxp/api/req/auth/FilterInvSubWarehouseRequest.java @@ -11,6 +11,8 @@ public class FilterInvSubWarehouseRequest extends ListPageRequest { private String name; private String parentId; private Boolean defaultInv; + private Boolean spUse; + private Boolean unifyUse; private Integer advanceType; public String thirdId; diff --git a/src/main/java/com/glxp/api/res/auth/InvSubWarehouseResponse.java b/src/main/java/com/glxp/api/res/auth/InvSubWarehouseResponse.java index 7a9bb3a5..e8dfaec0 100644 --- a/src/main/java/com/glxp/api/res/auth/InvSubWarehouseResponse.java +++ b/src/main/java/com/glxp/api/res/auth/InvSubWarehouseResponse.java @@ -1,5 +1,6 @@ package com.glxp.api.res.auth; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; /** @@ -23,4 +24,11 @@ public class InvSubWarehouseResponse { private String parentInvName; private Integer advanceType; private Boolean spUse; + + + /** + * 是否医院标识 0否 1是 + */ + @TableField(value = "unifyUse") + private Boolean unifyUse; } diff --git a/src/main/java/com/glxp/api/service/auth/AuthWarehouseUnifyService.java b/src/main/java/com/glxp/api/service/auth/AuthWarehouseUnifyService.java new file mode 100644 index 00000000..e90bde7e --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/AuthWarehouseUnifyService.java @@ -0,0 +1,7 @@ +package com.glxp.api.service.auth; + +import com.glxp.api.entity.auth.AuthWarehouseUnify; + +public interface AuthWarehouseUnifyService { + void deleteWarehouseCustomer(AuthWarehouseUnify authWarehouseUnify); +} diff --git a/src/main/java/com/glxp/api/service/auth/InvWarehouseService.java b/src/main/java/com/glxp/api/service/auth/InvWarehouseService.java index 86c97e5d..be7e030a 100644 --- a/src/main/java/com/glxp/api/service/auth/InvWarehouseService.java +++ b/src/main/java/com/glxp/api/service/auth/InvWarehouseService.java @@ -100,4 +100,6 @@ public interface InvWarehouseService { InvWarehouseEntity findOneLevel(String code); + + List unifyWarehouseList(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest); } diff --git a/src/main/java/com/glxp/api/service/auth/WarehouseUserService.java b/src/main/java/com/glxp/api/service/auth/WarehouseUserService.java index 7e216450..8e5b0e8a 100644 --- a/src/main/java/com/glxp/api/service/auth/WarehouseUserService.java +++ b/src/main/java/com/glxp/api/service/auth/WarehouseUserService.java @@ -3,6 +3,7 @@ package com.glxp.api.service.auth; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.auth.WarehouseUserEntity; +import com.glxp.api.entity.system.CompanyEntity; import com.glxp.api.req.auth.FilterInvLinkDataRequest; import com.glxp.api.req.auth.FilterInvUserRequest; import org.apache.ibatis.annotations.Param; @@ -73,4 +74,8 @@ public interface WarehouseUserService { Integer countUserBySubInvCode(String subInvCode); boolean insert(WarehouseUserEntity warehouseUserEntity); + + List warehouseListByCode(FilterInvLinkDataRequest filterInvLinkDataRequest); + + void addWarehouseCustomer(FilterInvLinkDataRequest filterInvLinkDataRequest); } diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthWarehouseUnifyServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthWarehouseUnifyServiceImpl.java new file mode 100644 index 00000000..85c987c4 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/impl/AuthWarehouseUnifyServiceImpl.java @@ -0,0 +1,22 @@ +package com.glxp.api.service.auth.impl; + +import com.glxp.api.dao.auth.AuthWarehouseUnifyMapper; +import com.glxp.api.entity.auth.AuthWarehouseUnify; +import com.glxp.api.service.auth.AuthWarehouseUnifyService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +@Service +@Transactional(rollbackFor = Exception.class) +public class AuthWarehouseUnifyServiceImpl implements AuthWarehouseUnifyService { + + @Resource + AuthWarehouseUnifyMapper authWarehouseUnifyMapper; + + @Override + public void deleteWarehouseCustomer(AuthWarehouseUnify authWarehouseUnify) { + authWarehouseUnifyMapper.deleteById(authWarehouseUnify.getId()); + } +} diff --git a/src/main/java/com/glxp/api/service/auth/impl/InvWarehouseServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/InvWarehouseServiceImpl.java index e1350e8a..ad437014 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/InvWarehouseServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/InvWarehouseServiceImpl.java @@ -277,4 +277,10 @@ public class InvWarehouseServiceImpl implements InvWarehouseService { } return null; } + + @Override + public List unifyWarehouseList(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) { + List data = invWarehouseDao.filterInvSubWarehouse(filterInvSubWarehouseRequest); + return data; + } } diff --git a/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java index 3017fb46..023313f6 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java @@ -1,7 +1,12 @@ package com.glxp.api.service.auth.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.auth.AuthWarehouseUnifyMapper; import com.glxp.api.dao.auth.UserRegisterDao; +import com.glxp.api.entity.auth.AuthWarehouseUnify; import com.glxp.api.entity.auth.UserRegisterEntity; import com.glxp.api.req.auth.UserResisterFilterRequest; import com.glxp.api.service.auth.UserRegisterService; @@ -9,7 +14,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.List; @Service @@ -18,6 +25,8 @@ public class UserRegisterServiceImpl implements UserRegisterService { @Resource private UserRegisterDao userRegisterDao; + @Resource + private AuthWarehouseUnifyMapper authWarehouseUnifyMapper; @Override @@ -32,7 +41,30 @@ public class UserRegisterServiceImpl implements UserRegisterService { @Override public boolean insertUserRegister(UserRegisterEntity userRegisterEntity) { - return userRegisterDao.insertUserRegister(userRegisterEntity); + + boolean b = userRegisterDao.insertUserRegister(userRegisterEntity); + if (b){ + //添加供应商的配送医院的关联关系 + String companyId = userRegisterEntity.getCompanyId(); + List unifyWarehouse = userRegisterEntity.getUnifyWarehouse(); + if (StrUtil.isNotEmpty(companyId) && CollUtil.isNotEmpty(unifyWarehouse)){ + authWarehouseUnifyMapper.delete(new LambdaQueryWrapper().eq(AuthWarehouseUnify::getCustomerId,companyId)); + List addList = new ArrayList<>(); + for (int i = 0; i < unifyWarehouse.size(); i++) { + String unifyWarehouseCode = unifyWarehouse.get(i); + AuthWarehouseUnify authWarehouseUnify = new AuthWarehouseUnify(); + authWarehouseUnify.setCode(unifyWarehouseCode); + authWarehouseUnify.setCustomerId(companyId); + authWarehouseUnify.setUpdateTime(new Date()); + addList.add(authWarehouseUnify); + } + + if (CollUtil.isNotEmpty(addList)){ + authWarehouseUnifyMapper.insertBatch(addList); + } + } + } + return b; } @Override @@ -42,7 +74,29 @@ public class UserRegisterServiceImpl implements UserRegisterService { @Override public boolean updateUserRegister(UserRegisterEntity userRegisterEntity) { - return userRegisterDao.updateUserRegister(userRegisterEntity); + boolean b = userRegisterDao.updateUserRegister(userRegisterEntity); + if (b){ + //添加供应商的配送医院的关联关系 + String companyId = userRegisterEntity.getCompanyId(); + List unifyWarehouse = userRegisterEntity.getUnifyWarehouse(); + if (StrUtil.isNotEmpty(companyId) && CollUtil.isNotEmpty(unifyWarehouse)){ + authWarehouseUnifyMapper.delete(new LambdaQueryWrapper().eq(AuthWarehouseUnify::getCustomerId,companyId)); + List addList = new ArrayList<>(); + for (int i = 0; i < unifyWarehouse.size(); i++) { + String unifyWarehouseCode = unifyWarehouse.get(i); + AuthWarehouseUnify authWarehouseUnify = new AuthWarehouseUnify(); + authWarehouseUnify.setCode(unifyWarehouseCode); + authWarehouseUnify.setCustomerId(companyId); + authWarehouseUnify.setUpdateTime(new Date()); + addList.add(authWarehouseUnify); + } + + if (CollUtil.isNotEmpty(addList)){ + authWarehouseUnifyMapper.insertBatch(addList); + } + } + } + return b; } @Override diff --git a/src/main/java/com/glxp/api/service/auth/impl/WarehouseUserServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/WarehouseUserServiceImpl.java index ac6c4387..ff651b49 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/WarehouseUserServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/WarehouseUserServiceImpl.java @@ -2,10 +2,15 @@ package com.glxp.api.service.auth.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.auth.AuthWarehouseUnifyMapper; import com.glxp.api.dao.auth.WarehouseUserDao; import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.auth.AuthWarehouseUnify; import com.glxp.api.entity.auth.WarehouseUserEntity; +import com.glxp.api.entity.system.CompanyEntity; import com.glxp.api.req.auth.FilterInvLinkDataRequest; import com.glxp.api.req.auth.FilterInvUserRequest; import com.glxp.api.service.auth.WarehouseUserService; @@ -16,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.List; @Slf4j @@ -26,6 +32,8 @@ public class WarehouseUserServiceImpl implements WarehouseUserService { @Resource private WarehouseUserDao warehouseUserDao; + @Resource + private AuthWarehouseUnifyMapper authWarehouseUnifyMapper; @Override public WarehouseUserEntity selectById(Long id) { @@ -145,4 +153,37 @@ public class WarehouseUserServiceImpl implements WarehouseUserService { public boolean insert(WarehouseUserEntity warehouseUserEntity) { return warehouseUserDao.insertEntity(warehouseUserEntity) > 0; } + + @Override + public List warehouseListByCode(FilterInvLinkDataRequest filterInvLinkDataRequest) { + if (filterInvLinkDataRequest == null) { + return Collections.emptyList(); + } + if (filterInvLinkDataRequest.getPage() != null) { + int offset = (filterInvLinkDataRequest.getPage() - 1) * filterInvLinkDataRequest.getLimit(); + PageHelper.offsetPage(offset, filterInvLinkDataRequest.getLimit()); + } + return warehouseUserDao.warehouseListByCode(filterInvLinkDataRequest); + } + + @Override + public void addWarehouseCustomer(FilterInvLinkDataRequest filterInvLinkDataRequest) { + List customerList = filterInvLinkDataRequest.getCustomerList(); + String code = filterInvLinkDataRequest.getCode(); + if (CollUtil.isNotEmpty(customerList)) { + List addList = new ArrayList<>(); + for (int i = 0; i < customerList.size(); i++) { + CompanyEntity companyEntity = customerList.get(i); + AuthWarehouseUnify authWarehouseUnify = new AuthWarehouseUnify(); + authWarehouseUnify.setCode(code); + authWarehouseUnify.setCustomerId(companyEntity.getCustomerId()); + authWarehouseUnify.setUpdateTime(new Date()); + addList.add(authWarehouseUnify); + } + + if (CollUtil.isNotEmpty(addList)) { + authWarehouseUnifyMapper.insertBatch(addList); + } + } + } } diff --git a/src/main/resources/mybatis/mapper/auth/AuthWarehouseUnifyMapper.xml b/src/main/resources/mybatis/mapper/auth/AuthWarehouseUnifyMapper.xml new file mode 100644 index 00000000..e306ec9e --- /dev/null +++ b/src/main/resources/mybatis/mapper/auth/AuthWarehouseUnifyMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml b/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml index cb8c7dff..2d80f388 100644 --- a/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml +++ b/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml @@ -25,6 +25,12 @@ AND a.defaultInv = #{defaultInv} + + AND a.spUse = #{spUse} + + + AND a.unifyUse = #{unifyUse} + @@ -230,6 +236,9 @@ spUse=#{spUse}, + + unifyUse=#{unifyUse}, + WHERE id = #{id} @@ -297,7 +306,8 @@ b.name as parentName, a.parentCode, c.name parentInvName, - a.spUse + a.spUse, + a.unifyUse FROM auth_warehouse a left join auth_dept b on a.parentId = b.code left join auth_warehouse c on a.parentCode = c.code diff --git a/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml b/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml index 36a98206..f9daca47 100644 --- a/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml +++ b/src/main/resources/mybatis/mapper/auth/WarehouseUserDao.xml @@ -331,4 +331,21 @@ set isDirector = #{isDirector} where id = #{id} + + + + diff --git a/src/main/resources/mybatis/mapper/system/CompanyDao.xml b/src/main/resources/mybatis/mapper/system/CompanyDao.xml index 36467c2d..61b8e74a 100644 --- a/src/main/resources/mybatis/mapper/system/CompanyDao.xml +++ b/src/main/resources/mybatis/mapper/system/CompanyDao.xml @@ -33,6 +33,12 @@ and unitIdFk = #{unitIdFk} + + and customerId not in + + #{item} + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 29146da2..39660d52 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -1269,3 +1269,16 @@ CALL Pro_Temp_ColumnWork('basic_corp', 'adSickNum', ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL', 1); +CALL Pro_Temp_ColumnWork('auth_warehouse', 'unifyUse', + ' tinyint NULL DEFAULT b''0''COMMENT ''是否医院标识 0否 1是''', + 1); + + + +CREATE TABLE IF NOT EXISTS `auth_warehouse_unify` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '仓库编码', + `customerId` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '客户ID', + `updateTime` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='医院共同体关系表'; \ No newline at end of file