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
8bfe0ba9
Commit
8bfe0ba9
authored
Apr 17, 2019
by
qiankunpingtai
Browse files
异常封装之仓库信息后台修改
parent
ae416e8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/DepotController.java
View file @
8bfe0ba9
...
...
@@ -41,7 +41,7 @@ public class DepotController {
private
UserBusinessService
userBusinessService
;
@GetMapping
(
value
=
"/getAllList"
)
public
BaseResponseInfo
getAllList
(
HttpServletRequest
request
)
{
public
BaseResponseInfo
getAllList
(
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
List
<
Depot
>
depotList
=
depotService
.
getAllList
();
...
...
@@ -64,7 +64,7 @@ public class DepotController {
*/
@PostMapping
(
value
=
"/findUserDepot"
)
public
JSONArray
findUserDepot
(
@RequestParam
(
"UBType"
)
String
type
,
@RequestParam
(
"UBKeyId"
)
String
keyId
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
JSONArray
arr
=
new
JSONArray
();
try
{
List
<
Depot
>
dataList
=
depotService
.
findUserDepot
();
...
...
@@ -104,7 +104,7 @@ public class DepotController {
@RequestMapping
(
value
=
"/findDepotByUserId"
)
public
JSONArray
findDepotByUserId
(
@RequestParam
(
"UBType"
)
String
type
,
@RequestParam
(
"UBKeyId"
)
String
keyId
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
JSONArray
arr
=
new
JSONArray
();
try
{
List
<
Depot
>
dataList
=
depotService
.
findUserDepot
();
...
...
@@ -145,7 +145,7 @@ public class DepotController {
public
String
getDepotList
(
@RequestParam
(
value
=
Constants
.
PAGE_SIZE
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
Constants
.
CURRENT_PAGE
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
Constants
.
SEARCH
,
required
=
false
)
String
search
)
{
@RequestParam
(
value
=
Constants
.
SEARCH
,
required
=
false
)
String
search
)
throws
Exception
{
Map
<
String
,
Object
>
parameterMap
=
new
HashMap
<
String
,
Object
>();
//查询参数
JSONObject
obj
=
JSON
.
parseObject
(
search
);
...
...
src/main/java/com/jsh/erp/service/depot/DepotComponent.java
View file @
8bfe0ba9
...
...
@@ -20,16 +20,16 @@ public class DepotComponent implements ICommonQuery {
private
DepotService
depotService
;
@Override
public
Object
selectOne
(
String
condition
)
{
public
Object
selectOne
(
String
condition
)
throws
Exception
{
return
null
;
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
getDepotList
(
map
);
}
private
List
<?>
getDepotList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getDepotList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
Integer
type
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"type"
));
...
...
@@ -39,7 +39,7 @@ public class DepotComponent implements ICommonQuery {
}
@Override
public
Long
counts
(
Map
<
String
,
String
>
map
)
{
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
Integer
type
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"type"
));
...
...
@@ -48,27 +48,27 @@ public class DepotComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
depotService
.
insertDepot
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
depotService
.
updateDepot
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
depotService
.
deleteDepot
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
depotService
.
batchDeleteDepot
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
depotService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
8bfe0ba9
...
...
@@ -41,91 +41,214 @@ public class DepotService {
@Resource
private
DepotItemMapperEx
depotItemMapperEx
;
public
Depot
getDepot
(
long
id
)
{
return
depotMapper
.
selectByPrimaryKey
(
id
);
public
Depot
getDepot
(
long
id
)
throws
Exception
{
Depot
result
=
null
;
try
{
result
=
depotMapper
.
selectByPrimaryKey
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
public
List
<
Depot
>
getDepot
()
{
public
List
<
Depot
>
getDepot
()
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
depotMapper
.
selectByExample
(
example
);
List
<
Depot
>
list
=
null
;
try
{
list
=
depotMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
Depot
>
getAllList
()
{
public
List
<
Depot
>
getAllList
()
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"sort"
);
return
depotMapper
.
selectByExample
(
example
);
List
<
Depot
>
list
=
null
;
try
{
list
=
depotMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
Depot
>
select
(
String
name
,
Integer
type
,
String
remark
,
int
offset
,
int
rows
)
{
return
depotMapperEx
.
selectByConditionDepot
(
name
,
type
,
remark
,
offset
,
rows
);
public
List
<
Depot
>
select
(
String
name
,
Integer
type
,
String
remark
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
Depot
>
list
=
null
;
try
{
list
=
depotMapperEx
.
selectByConditionDepot
(
name
,
type
,
remark
,
offset
,
rows
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
Long
countDepot
(
String
name
,
Integer
type
,
String
remark
)
{
return
depotMapperEx
.
countsByDepot
(
name
,
type
,
remark
);
public
Long
countDepot
(
String
name
,
Integer
type
,
String
remark
)
throws
Exception
{
Long
result
=
null
;
try
{
result
=
depotMapperEx
.
countsByDepot
(
name
,
type
,
remark
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertDepot
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertDepot
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
Depot
depot
=
JSONObject
.
parseObject
(
beanJson
,
Depot
.
class
);
return
depotMapper
.
insertSelective
(
depot
);
int
result
=
0
;
try
{
result
=
depotMapper
.
insertSelective
(
depot
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateDepot
(
String
beanJson
,
Long
id
)
{
public
int
updateDepot
(
String
beanJson
,
Long
id
)
throws
Exception
{
Depot
depot
=
JSONObject
.
parseObject
(
beanJson
,
Depot
.
class
);
depot
.
setId
(
id
);
return
depotMapper
.
updateByPrimaryKeySelective
(
depot
);
int
result
=
0
;
try
{
result
=
depotMapper
.
updateByPrimaryKeySelective
(
depot
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteDepot
(
Long
id
)
{
return
depotMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteDepot
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
depotMapper
.
deleteByPrimaryKey
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepot
(
String
ids
)
{
public
int
batchDeleteDepot
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
depotMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
depotMapper
.
deleteByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Depot
>
list
=
depotMapper
.
selectByExample
(
example
);
return
list
.
size
();
List
<
Depot
>
list
=
null
;
try
{
list
=
depotMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
==
null
?
0
:
list
.
size
();
}
public
List
<
Depot
>
findUserDepot
(){
public
List
<
Depot
>
findUserDepot
()
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andTypeEqualTo
(
0
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
Depot
>
list
=
depotMapper
.
selectByExample
(
example
);
List
<
Depot
>
list
=
null
;
try
{
list
=
depotMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
Depot
>
findGiftByType
(
Integer
type
){
public
List
<
Depot
>
findGiftByType
(
Integer
type
)
throws
Exception
{
DepotExample
example
=
new
DepotExample
();
example
.
createCriteria
().
andTypeEqualTo
(
type
);
example
.
setOrderByClause
(
"Sort"
);
List
<
Depot
>
list
=
depotMapper
.
selectByExample
(
example
);
List
<
Depot
>
list
=
null
;
try
{
list
=
depotMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
DepotEx
>
getDepotList
(
Map
<
String
,
Object
>
parameterMap
)
{
return
depotMapperEx
.
getDepotList
(
parameterMap
);
public
List
<
DepotEx
>
getDepotList
(
Map
<
String
,
Object
>
parameterMap
)
throws
Exception
{
List
<
DepotEx
>
list
=
null
;
try
{
list
=
depotMapperEx
.
getDepotList
(
parameterMap
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotByIds
(
String
ids
)
{
public
int
batchDeleteDepotByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
depotMapperEx
.
batchDeleteDepotByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
depotMapperEx
.
batchDeleteDepotByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
/**
* create by: qiankunpingtai
...
...
@@ -153,7 +276,15 @@ public class DepotService {
/**
* 校验单据主表 jsh_depothead
* */
List
<
DepotHead
>
depotHeadList
=
depotHeadMapperEx
.
getDepotHeadListByDepotIds
(
idArray
);
List
<
DepotHead
>
depotHeadList
=
null
;
try
{
depotHeadList
=
depotHeadMapperEx
.
getDepotHeadListByDepotIds
(
idArray
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
if
(
depotHeadList
!=
null
&&
depotHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,DepotIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
...
...
@@ -163,7 +294,15 @@ public class DepotService {
/**
* 校验单据子表 jsh_depotitem
* */
List
<
DepotItem
>
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByDepotIds
(
idArray
);
List
<
DepotItem
>
depotItemList
=
null
;
try
{
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByDepotIds
(
idArray
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,DepotIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
...
...
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