|
|
@@ -9,6 +9,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
@@ -25,6 +26,7 @@ import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.dao.AdminMapper;
|
|
|
import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.AdminLocation;
|
|
|
import com.goafanti.common.utils.PasswordUtil;
|
|
|
@@ -43,6 +45,8 @@ public class AdminSuperviserApiController extends CertifyApiController {
|
|
|
private AdminLocationService adminLocationService;
|
|
|
@Resource
|
|
|
private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private AdminMapper adminMapper;
|
|
|
/**管理员列表*/
|
|
|
@RequestMapping(value = "/adminList", method = RequestMethod.GET)
|
|
|
public Result adminList(AdminListBo alb, String rid, String pageNo,
|
|
|
@@ -147,9 +151,40 @@ public class AdminSuperviserApiController extends CertifyApiController {
|
|
|
Admin a = newAdminService.selectByPrimaryKey(admin.getId());
|
|
|
if (null == a) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ //*********用户编号判断**************
|
|
|
+ String sdepNo=adminMapper.selectUserNoBySuperiorId(admin.getSuperiorId());
|
|
|
+ int Count=adminMapper.selectCountBySuperiorId(admin.getSuperiorId());
|
|
|
+ if((Count+1)>99){
|
|
|
+ res.getError().add(buildError("","每层最多存在99个子类"));
|
|
|
return res;
|
|
|
-
|
|
|
}
|
|
|
+ if(Count<10){
|
|
|
+ String dep=sdepNo+"0"+Count;
|
|
|
+ String sid=adminMapper.selectIdByUserNo(dep);
|
|
|
+ while(sid!=null){
|
|
|
+ Count=(Count+1)%100;
|
|
|
+ if(Count>=10){
|
|
|
+ dep=sdepNo+Count;
|
|
|
+ }else{
|
|
|
+ dep=sdepNo+"0"+Count;
|
|
|
+ }
|
|
|
+ sid=adminMapper.selectIdByUserNo(dep);
|
|
|
+ }
|
|
|
+ admin.setUserNo(dep);
|
|
|
+ }
|
|
|
+ if(Count>=10){
|
|
|
+ String dep=sdepNo+Count;
|
|
|
+ String sid=adminMapper.selectIdByUserNo(dep);
|
|
|
+ while(sid!=null){
|
|
|
+ Count=(Count+1)%100;
|
|
|
+ dep=sdepNo+Count;
|
|
|
+ sid=adminMapper.selectIdByUserNo(dep);
|
|
|
+ }
|
|
|
+ admin.setUserNo(dep);
|
|
|
+ }
|
|
|
+
|
|
|
Admin ad = new Admin();
|
|
|
BeanUtils.copyProperties(admin, ad);
|
|
|
res = disposeAdminLocationList(res, jo, ad);
|