Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
356ae93f
Commit
356ae93f
authored
Apr 02, 2019
by
季圣华
Browse files
增加录入限制条件
parent
492a0ce3
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/constants/ExceptionConstants.java
View file @
356ae93f
...
@@ -42,6 +42,10 @@ public class ExceptionConstants {
...
@@ -42,6 +42,10 @@ public class ExceptionConstants {
//登录名已存在
//登录名已存在
public
static
final
int
USER_LOGIN_NAME_ALREADY_EXISTS_CODE
=
500003
;
public
static
final
int
USER_LOGIN_NAME_ALREADY_EXISTS_CODE
=
500003
;
public
static
final
String
USER_LOGIN_NAME_ALREADY_EXISTS_MSG
=
"登录名已存在"
;
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
* type = 10
...
@@ -262,6 +266,9 @@ public class ExceptionConstants {
...
@@ -262,6 +266,9 @@ public class ExceptionConstants {
//修改单据信息失败
//修改单据信息失败
public
static
final
int
DEPOT_HEAD_EDIT_FAILED_CODE
=
8500002
;
public
static
final
int
DEPOT_HEAD_EDIT_FAILED_CODE
=
8500002
;
public
static
final
String
DEPOT_HEAD_EDIT_FAILED_MSG
=
"修改单据信息失败"
;
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
* type = 90
...
@@ -354,7 +361,6 @@ public class ExceptionConstants {
...
@@ -354,7 +361,6 @@ public class ExceptionConstants {
public
static
final
String
ORGA_USER_REL_EDIT_FAILED_MSG
=
"修改机构用户关联关系失败"
;
public
static
final
String
ORGA_USER_REL_EDIT_FAILED_MSG
=
"修改机构用户关联关系失败"
;
/**
/**
* 标准正常返回/操作成功返回
* 标准正常返回/操作成功返回
* @return
* @return
...
@@ -365,4 +371,11 @@ public class ExceptionConstants {
...
@@ -365,4 +371,11 @@ public class ExceptionConstants {
success
.
put
(
GLOBAL_RETURNS_MESSAGE
,
SERVICE_SUCCESS_MSG
);
success
.
put
(
GLOBAL_RETURNS_MESSAGE
,
SERVICE_SUCCESS_MSG
);
return
success
;
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
;
}
}
}
src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
356ae93f
...
@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
...
@@ -8,6 +8,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
import
com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4List
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4List
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount
;
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.depotHead.DepotHeadService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.BaseResponseInfo
;
...
@@ -15,6 +16,7 @@ import com.jsh.erp.utils.ErpInfo;
...
@@ -15,6 +16,7 @@ import com.jsh.erp.utils.ErpInfo;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -37,10 +39,12 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
...
@@ -37,10 +39,12 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
public
class
DepotHeadController
{
public
class
DepotHeadController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
DepotHeadController
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
DepotHeadController
.
class
);
@Value
(
"${mybatis-plus.status}"
)
private
String
mybatisPlusStatus
;
@Resource
@Resource
private
DepotHeadService
depotHeadService
;
private
DepotHeadService
depotHeadService
;
/**
/**
* 批量设置状态-审核或者反审核
* 批量设置状态-审核或者反审核
* @param status
* @param status
...
@@ -432,8 +436,14 @@ public class DepotHeadController {
...
@@ -432,8 +436,14 @@ public class DepotHeadController {
@RequestParam
(
"deleted"
)
String
deleted
,
@RequestParam
(
"deleted"
)
String
deleted
,
@RequestParam
(
"updated"
)
String
updated
,
HttpServletRequest
request
)
throws
Exception
{
@RequestParam
(
"updated"
)
String
updated
,
HttpServletRequest
request
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
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
;
return
result
;
}
}
/**
/**
...
...
src/main/java/com/jsh/erp/controller/UserController.java
View file @
356ae93f
...
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.entities.User;
...
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.entities.User;
import
com.jsh.erp.datasource.entities.UserEx
;
import
com.jsh.erp.datasource.entities.UserEx
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNodeEx
;
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.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.*
;
import
com.jsh.erp.utils.*
;
...
@@ -117,9 +118,13 @@ public class UserController {
...
@@ -117,9 +118,13 @@ public class UserController {
if
(
obj
!=
null
&&
obj
.
getString
(
"code"
).
equals
(
CODE_OK
))
{
if
(
obj
!=
null
&&
obj
.
getString
(
"code"
).
equals
(
CODE_OK
))
{
JSONObject
dataObj
=
obj
.
getJSONObject
(
"data"
);
JSONObject
dataObj
=
obj
.
getJSONObject
(
"data"
);
if
(
dataObj
!=
null
)
{
if
(
dataObj
!=
null
)
{
String
id
=
dataObj
.
getString
(
"tenantId"
);
String
tenantId
=
dataObj
.
getString
(
"tenantId"
);
if
(
id
!=
null
)
{
String
userNumLimit
=
dataObj
.
getString
(
"userNumLimit"
);
request
.
getSession
().
setAttribute
(
"tenantId"
,
id
);
//租户id
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 {
...
@@ -176,6 +181,8 @@ public class UserController {
try
{
try
{
request
.
getSession
().
removeAttribute
(
"user"
);
request
.
getSession
().
removeAttribute
(
"user"
);
request
.
getSession
().
removeAttribute
(
"tenantId"
);
request
.
getSession
().
removeAttribute
(
"tenantId"
);
request
.
getSession
().
removeAttribute
(
"userNumLimit"
);
request
.
getSession
().
removeAttribute
(
"billsNumLimit"
);
request
.
getSession
().
removeAttribute
(
"mybatisPlusStatus"
);
request
.
getSession
().
removeAttribute
(
"mybatisPlusStatus"
);
response
.
sendRedirect
(
"/login.html"
);
response
.
sendRedirect
(
"/login.html"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -310,10 +317,17 @@ public class UserController {
...
@@ -310,10 +317,17 @@ public class UserController {
*/
*/
@PostMapping
(
"/addUser"
)
@PostMapping
(
"/addUser"
)
@ResponseBody
@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
();
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
UserEx
ue
=
JSON
.
parseObject
(
beanJson
,
UserEx
.
class
);
Long
userNumLimit
=
Long
.
parseLong
(
request
.
getSession
().
getAttribute
(
"userNumLimit"
).
toString
());
userService
.
addUserAndOrgUserRel
(
ue
);
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
;
return
result
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment