增加录入限制条件
This commit is contained in:
@@ -42,6 +42,10 @@ public class ExceptionConstants {
|
||||
//登录名已存在
|
||||
public static final int USER_LOGIN_NAME_ALREADY_EXISTS_CODE = 500003;
|
||||
public static final String USER_LOGIN_NAME_ALREADY_EXISTS_MSG = "登录名已存在";
|
||||
//用户录入数量超出限制
|
||||
public static final int USER_OVER_LIMIT_FAILED_CODE = 500004;
|
||||
public static final String USER_OVER_LIMIT_FAILED_MSG = "用户录入数量超出限制,请联系管理员续费";
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
* type = 10
|
||||
@@ -262,6 +266,9 @@ public class ExceptionConstants {
|
||||
//修改单据信息失败
|
||||
public static final int DEPOT_HEAD_EDIT_FAILED_CODE = 8500002;
|
||||
public static final String DEPOT_HEAD_EDIT_FAILED_MSG = "修改单据信息失败";
|
||||
//单据录入数量超出限制
|
||||
public static final int DEPOT_HEAD_OVER_LIMIT_FAILED_CODE = 8500003;
|
||||
public static final String DEPOT_HEAD_OVER_LIMIT_FAILED_MSG = "单据录入数量超出限制,请联系管理员续费";
|
||||
/**
|
||||
* 单据明细信息
|
||||
* type = 90
|
||||
@@ -354,7 +361,6 @@ public class ExceptionConstants {
|
||||
public static final String ORGA_USER_REL_EDIT_FAILED_MSG = "修改机构用户关联关系失败";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 标准正常返回/操作成功返回
|
||||
* @return
|
||||
@@ -365,4 +371,11 @@ public class ExceptionConstants {
|
||||
success.put(GLOBAL_RETURNS_MESSAGE, SERVICE_SUCCESS_MSG);
|
||||
return success;
|
||||
}
|
||||
|
||||
public static JSONObject standardErrorUserOver () {
|
||||
JSONObject success = new JSONObject();
|
||||
success.put(GLOBAL_RETURNS_CODE, USER_OVER_LIMIT_FAILED_CODE);
|
||||
success.put(GLOBAL_RETURNS_MESSAGE, USER_OVER_LIMIT_FAILED_MSG);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.service.depotHead.DepotHeadService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
@@ -15,6 +16,7 @@ import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -37,10 +39,12 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
||||
public class DepotHeadController {
|
||||
private Logger logger = LoggerFactory.getLogger(DepotHeadController.class);
|
||||
|
||||
@Value("${mybatis-plus.status}")
|
||||
private String mybatisPlusStatus;
|
||||
|
||||
@Resource
|
||||
private DepotHeadService depotHeadService;
|
||||
|
||||
|
||||
/**
|
||||
* 批量设置状态-审核或者反审核
|
||||
* @param status
|
||||
@@ -432,8 +436,14 @@ public class DepotHeadController {
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated, HttpServletRequest request) throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
|
||||
|
||||
Long billsNumLimit = Long.parseLong(request.getSession().getAttribute("billsNumLimit").toString());
|
||||
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null);
|
||||
if(("open").equals(mybatisPlusStatus) && count>= billsNumLimit) {
|
||||
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
|
||||
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
|
||||
} else {
|
||||
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.entities.UserEx;
|
||||
import com.jsh.erp.datasource.vo.TreeNode;
|
||||
import com.jsh.erp.datasource.vo.TreeNodeEx;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.*;
|
||||
@@ -117,9 +118,13 @@ public class UserController {
|
||||
if(obj!=null && obj.getString("code").equals(CODE_OK)) {
|
||||
JSONObject dataObj = obj.getJSONObject("data");
|
||||
if(dataObj!=null) {
|
||||
String id = dataObj.getString("tenantId");
|
||||
if(id!=null) {
|
||||
request.getSession().setAttribute("tenantId",id); //租户id
|
||||
String tenantId = dataObj.getString("tenantId");
|
||||
String userNumLimit = dataObj.getString("userNumLimit");
|
||||
String billsNumLimit = dataObj.getString("billsNumLimit");
|
||||
if(tenantId!=null) {
|
||||
request.getSession().setAttribute("tenantId",tenantId); //租户tenantId
|
||||
request.getSession().setAttribute("userNumLimit",userNumLimit); //用户限制数
|
||||
request.getSession().setAttribute("billsNumLimit",billsNumLimit); //单据限制数
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,6 +181,8 @@ public class UserController {
|
||||
try {
|
||||
request.getSession().removeAttribute("user");
|
||||
request.getSession().removeAttribute("tenantId");
|
||||
request.getSession().removeAttribute("userNumLimit");
|
||||
request.getSession().removeAttribute("billsNumLimit");
|
||||
request.getSession().removeAttribute("mybatisPlusStatus");
|
||||
response.sendRedirect("/login.html");
|
||||
} catch(Exception e){
|
||||
@@ -310,10 +317,17 @@ public class UserController {
|
||||
*/
|
||||
@PostMapping("/addUser")
|
||||
@ResponseBody
|
||||
public Object addUser(@RequestParam("info") String beanJson)throws Exception{
|
||||
public Object addUser(@RequestParam("info") String beanJson, HttpServletRequest request)throws Exception{
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
UserEx ue= JSON.parseObject(beanJson, UserEx.class);
|
||||
userService.addUserAndOrgUserRel(ue);
|
||||
Long userNumLimit = Long.parseLong(request.getSession().getAttribute("userNumLimit").toString());
|
||||
Long count = userService.countUser(null,null);
|
||||
if(("open").equals(mybatisPlusStatus) && count>= userNumLimit) {
|
||||
throw new BusinessParamCheckingException(ExceptionConstants.USER_OVER_LIMIT_FAILED_CODE,
|
||||
ExceptionConstants.USER_OVER_LIMIT_FAILED_MSG);
|
||||
} else {
|
||||
UserEx ue= JSON.parseObject(beanJson, UserEx.class);
|
||||
userService.addUserAndOrgUserRel(ue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user