用户权限和仓库相关接口修改

newFrame
anthonywj 2 years ago
parent b4581dc0e6
commit c067a3ed17

@ -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<WarehouseUserEntity> warehouseUserEntities = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest);
List<Long> userIds = new ArrayList<>();
warehouseUserEntities.forEach(user -> {
userIds.add(user.getUserid());
});
FilterNoSelectUserRequest filterNoSelectUserRequest = new FilterNoSelectUserRequest();
BeanUtils.copyProperties(filterInvLinkDataRequest, filterNoSelectUserRequest);
filterNoSelectUserRequest.setUserIds(userIds);
List<AuthAdmin> hospitalUserList = authAdminService.selectNotSelectUser(filterNoSelectUserRequest);
PageInfo<AuthAdmin> authAdminPageInfo = new PageInfo<>(hospitalUserList);
PageSimpleResponse<AuthAdmin> authAdminPageSimpleResponse = new PageSimpleResponse<>();
authAdminPageSimpleResponse.setTotal(authAdminPageInfo.getTotal());
authAdminPageSimpleResponse.setList(hospitalUserList);
return ResultVOUtils.success(authAdminPageSimpleResponse);
}
//仓库未关联用户列表
@AuthRuleAnnotation("")
@GetMapping("/admin/auth/admin/hospitalUserList")
public BaseResponse getHospitalUserList() {
List<AuthAdmin> hospitalUserList = authAdminService.getHospitalUserList();
return ResultVOUtils.success(hospitalUserList);
}
}

@ -1279,7 +1279,6 @@ public class WareHouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
List<AuthAdmin> 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<String, Object> 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<AuthAdmin> 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<String, Object> params) {

@ -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<AuthAdmin> selectHospitalUser();
List<AuthAdmin> selectNotSelectUser(@Param("userIds") List<Long> userIds);
List<AuthAdmin> selectAllocatedList(AuthAdminQueryRequest authAdminQueryRequest);
List<AuthAdmin> selectUnallocatedList(AuthAdminQueryRequest authAdminQueryRequest);

@ -27,5 +27,6 @@ public class AuthAdminQueryRequest extends ListPageRequest {
*
*/
private String deptCode;
private String invCode; //仓库号
}

@ -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<Long> userIds;
}

@ -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<AuthAdmin> getHospitalUserList();
List<AuthAdmin> selectNotSelectUser(FilterNoSelectUserRequest filterNoSelectUserRequest);
List<AuthAdmin> selectAllocatedList(AuthAdminQueryRequest authAdminQueryRequest);

@ -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<AuthAdmin> 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<AuthAdmin> selectAllocatedList(AuthAdminQueryRequest authAdminQueryRequest) {

@ -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);
/**
*
*

@ -65,8 +65,6 @@ public class WarehouseUserServiceImpl implements WarehouseUserService {
@Override
public void saveWarehouseUser(String code, List<AuthAdmin> userList) {
//删除旧数据
warehouseUserDao.deleteByCode(code);
if (CollUtil.isNotEmpty(userList)) {
List<WarehouseUserEntity> 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<WarehouseUserEntity> getWarehouseUserList(FilterInvLinkDataRequest filterInvLinkDataRequest) {
if (filterInvLinkDataRequest == null) {

@ -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

@ -156,6 +156,23 @@
</select>
<select id="selectNotSelectUser" resultType="com.glxp.api.admin.entity.auth.AuthAdmin">
select *
from auth_user
<where>
userFlag != 0
<if test="userIds != null and userIds.size()!=0">
and id not in
<foreach collection="userIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectAllocatedList" parameterType="com.glxp.api.admin.req.auth.AuthAdminQueryRequest"
resultType="com.glxp.api.admin.entity.auth.AuthAdmin">
select u.*

Loading…
Cancel
Save