|
|
|
@ -11,6 +11,7 @@ import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.auth.DeptUserEntity;
|
|
|
|
|
import com.glxp.api.entity.auth.SysRole;
|
|
|
|
|
import com.glxp.api.entity.auth.WarehouseUserEntity;
|
|
|
|
|
import com.glxp.api.req.auth.FilterAuthUserRequest;
|
|
|
|
|
import com.glxp.api.req.auth.AuthUserSaveRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
@ -19,11 +20,13 @@ import com.glxp.api.res.auth.DeptUserResponse;
|
|
|
|
|
import com.glxp.api.service.auth.AuthAdminService;
|
|
|
|
|
import com.glxp.api.service.auth.DeptUserService;
|
|
|
|
|
import com.glxp.api.service.auth.ISysRoleService;
|
|
|
|
|
import com.glxp.api.service.auth.WarehouseUserService;
|
|
|
|
|
import com.glxp.api.util.PasswordUtils;
|
|
|
|
|
import com.glxp.api.util.StreamUtils;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.util.StringUtils;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
@ -52,6 +55,9 @@ public class SysUserController extends BaseController {
|
|
|
|
|
@Resource
|
|
|
|
|
ISysRoleService sysRoleService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
WarehouseUserService warehouseUserService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public BaseResponse list(FilterAuthUserRequest filterAuthUserRequest, BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
@ -181,6 +187,14 @@ public class SysUserController extends BaseController {
|
|
|
|
|
userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//默认插入第一部门
|
|
|
|
|
List<Long> deptCodeList=authUserSaveRequest.getDepts();
|
|
|
|
|
if(deptCodeList == null){
|
|
|
|
|
deptCodeList=new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
deptCodeList.add(1L);
|
|
|
|
|
authUserSaveRequest.setDepts(deptCodeList);
|
|
|
|
|
|
|
|
|
|
//插入部门
|
|
|
|
|
if (CollUtil.isNotEmpty(authUserSaveRequest.getDepts())) {
|
|
|
|
|
List<DeptUserEntity> list = new ArrayList<>();
|
|
|
|
@ -195,6 +209,15 @@ public class SysUserController extends BaseController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 插入仓库
|
|
|
|
|
if (StringUtils.isNotBlank(authUserSaveRequest.getLocInvCode())) {
|
|
|
|
|
WarehouseUserEntity warehouseUserEntity = new WarehouseUserEntity();
|
|
|
|
|
warehouseUserEntity.setCode(authUserSaveRequest.getLocInvCode());
|
|
|
|
|
warehouseUserEntity.setUsername(authUserSaveRequest.getUserName());
|
|
|
|
|
warehouseUserEntity.setUserid(authAdmin.getId());
|
|
|
|
|
warehouseUserService.insert(warehouseUserEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Long> res = new HashMap<>();
|
|
|
|
|
res.put("id", authAdmin.getId());
|
|
|
|
|
return ResultVOUtils.success(res);
|
|
|
|
@ -236,7 +259,14 @@ public class SysUserController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
// 修改角色
|
|
|
|
|
userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
|
|
|
|
|
// userService.insertUserAuth(authAdmin.getId(), authUserSaveRequest.getRoles());
|
|
|
|
|
|
|
|
|
|
userService.updateAuthAdmin(authAdmin);
|
|
|
|
|
|
|
|
|
|
//默认插入第一部门
|
|
|
|
|
List<Long> deptCodeList=authUserSaveRequest.getDepts();
|
|
|
|
|
deptCodeList.add(1L);
|
|
|
|
|
authUserSaveRequest.setDepts(deptCodeList);
|
|
|
|
|
|
|
|
|
|
//修改所属部门
|
|
|
|
|
deptUserService.deleteByUser(authUserSaveRequest.getId());
|
|
|
|
|