|
|
@@ -50,8 +50,38 @@ public class AdminOrganizationController extends BaseApiController{
|
|
|
if(olo!=null){
|
|
|
res.getError().add(buildError("","部门已存在"));
|
|
|
return res;
|
|
|
+ }
|
|
|
+ String sdepNo=organizationManagementMapper.selectDepNoByName(superId);
|
|
|
+ int Count=organizationManagementMapper.selectDepNoCount(superId);
|
|
|
+ if((Count+1)>99){
|
|
|
+ res.getError().add(buildError("","每层最多存在99个子类"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(Count<10){
|
|
|
+ String dep=sdepNo+"0"+Count;
|
|
|
+ String sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ while(sid!=null){
|
|
|
+ Count=(Count+1)%100;
|
|
|
+ if(Count>=10){
|
|
|
+ dep=sdepNo+Count;
|
|
|
+ }else{
|
|
|
+ dep=sdepNo+"0"+Count;
|
|
|
+ }
|
|
|
+ sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ }
|
|
|
+ organizationService.addOrganization(name, managerId, type, superId, remarks,dep);
|
|
|
+ }
|
|
|
+ if(Count>=10){
|
|
|
+ String dep=sdepNo+Count;
|
|
|
+ String sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ while(sid!=null){
|
|
|
+ Count=(Count+1)%100;
|
|
|
+ dep=sdepNo+Count;
|
|
|
+ sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ }
|
|
|
+ organizationService.addOrganization(name, managerId, type, superId, remarks,dep);
|
|
|
}
|
|
|
- organizationService.addOrganization(name, managerId, type, superId, remarks);
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
/**负责人自动补全查询**/
|
|
|
@@ -77,8 +107,39 @@ public class AdminOrganizationController extends BaseApiController{
|
|
|
|| StringUtils.isBlank(status)|| StringUtils.isBlank(remarks)){
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR,""));
|
|
|
return res;
|
|
|
+ }
|
|
|
+ String sdepNo=organizationManagementMapper.selectDepNoByName(superId);
|
|
|
+ superId=organizationManagementMapper.selectIdByName(superId);
|
|
|
+ int Count=organizationManagementMapper.selectDepNoCount(superId);
|
|
|
+ if((Count+1)>99){
|
|
|
+ res.getError().add(buildError("","每层最多存在99个子类"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if(Count<10){
|
|
|
+ String dep=sdepNo+"0"+Count;
|
|
|
+ String sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ while(sid!=null){
|
|
|
+ Count=(Count+1)%100;
|
|
|
+ if(Count>=10){
|
|
|
+ dep=sdepNo+Count;
|
|
|
+ }else{
|
|
|
+ dep=sdepNo+"0"+Count;
|
|
|
+ }
|
|
|
+ sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ }
|
|
|
+ organizationService.updateOrganization(name, type, managerId, superId, status, remarks,id,dep);
|
|
|
+ }
|
|
|
+ if(Count>=10){
|
|
|
+ String dep=sdepNo+Count;
|
|
|
+ String sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ while(sid!=null){
|
|
|
+ Count=(Count+1)%100;
|
|
|
+ dep=sdepNo+Count;
|
|
|
+ sid=organizationManagementMapper.selectIdByDepNo(dep);
|
|
|
+ }
|
|
|
+ organizationService.updateOrganization(name, type, managerId, superId, status, remarks,id,dep);
|
|
|
}
|
|
|
- organizationService.updateOrganization(name, type, managerId, superId, status, remarks,id);
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|