|
|
|
@ -6,6 +6,7 @@ import com.glxp.api.annotation.Log;
|
|
|
|
|
import com.glxp.api.constant.BusinessType;
|
|
|
|
|
import com.glxp.api.entity.auth.DeptEntity;
|
|
|
|
|
import com.glxp.api.entity.auth.DeptUserEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
|
|
|
|
import com.glxp.api.req.auth.FilterDeptUserReqeust;
|
|
|
|
|
import com.glxp.api.req.auth.FilterInvWarehouseRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
@ -14,6 +15,8 @@ import com.glxp.api.service.auth.DeptService;
|
|
|
|
|
import com.glxp.api.service.auth.DeptUserService;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.service.auth.WarehouseUserService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
@ -30,6 +33,11 @@ public class DeptUserController {
|
|
|
|
|
DeptUserService deptUserService;
|
|
|
|
|
@Resource
|
|
|
|
|
DeptService deptService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderService ioOrderService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
WarehouseUserService warehouseUserService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@ -56,6 +64,26 @@ public class DeptUserController {
|
|
|
|
|
@PostMapping("udi/auth/dept/user/delete")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
|
|
|
public BaseResponse delete(@RequestBody DeptUserEntity deptUserEntity) {
|
|
|
|
|
// 判断此用户是否创建单据
|
|
|
|
|
List<IoOrderEntity> ioOrderEntities = ioOrderService.selectList(deptUserEntity.getUserId());
|
|
|
|
|
if( ioOrderEntities != null){
|
|
|
|
|
return ResultVOUtils.error(500,"该用户已创建单据,不能移除!");
|
|
|
|
|
}
|
|
|
|
|
//判断此用户是否与仓库有关联
|
|
|
|
|
List<String> listWareHouse = warehouseUserService.selectCodeByUser(deptUserEntity.getUserId() + "");
|
|
|
|
|
if( listWareHouse != null ){
|
|
|
|
|
return ResultVOUtils.error(500,"该用户已绑定仓库,不能移除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断此用户是否与除一级部门 还绑定其他部门
|
|
|
|
|
FilterDeptUserReqeust filterDeptUserReqeust = new FilterDeptUserReqeust();
|
|
|
|
|
filterDeptUserReqeust.setUserId(deptUserEntity.getUserId());
|
|
|
|
|
List<DeptUserEntity> deptUserEntities = deptUserService.selectDeptUser(filterDeptUserReqeust);
|
|
|
|
|
if( deptUserEntities != null && deptUserEntities.size()>1){
|
|
|
|
|
return ResultVOUtils.error(500,"该用户已绑定多个部门,不能移除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean b = deptUserService.delete(deptUserEntity.getDeptId(), deptUserEntity.getUserId());
|
|
|
|
|
if (b)
|
|
|
|
|
return ResultVOUtils.success("移除成功!");
|
|
|
|
|