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
42835c94
Commit
42835c94
authored
Apr 20, 2019
by
乾坤平台
Committed by
季圣华
Apr 20, 2019
Browse files
!50 异常封装
Merge pull request !50 from 乾坤平台/master
parents
7ce3af46
8a831229
Changes
69
Expand all
Show whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
View file @
42835c94
...
...
@@ -35,6 +35,14 @@ public class GlobalExceptionHandler {
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_CODE
);
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_MSG
);
log
.
error
(
"Global Exception Occured => url : {}, msg : {}"
,
request
.
getRequestURL
(),
e
.
getMessage
());
/**
* create by: qiankunpingtai
* create time: 2019/4/18 17:41
* website:https://qiankunpingtai.cn
* description:
* 这里输出完整的堆栈信息,否则有些异常完全不知道哪里出错了。
*/
log
.
error
(
"Global Exception Occured => url : {}"
,
request
.
getRequestURL
(),
e
);
e
.
printStackTrace
();
return
status
;
}
...
...
src/main/java/com/jsh/erp/service/CommonQueryManager.java
View file @
42835c94
package
com.jsh.erp.service
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Log
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.LogMapper
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.springframework.stereotype.Service
;
...
...
@@ -12,12 +9,9 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
Tools
.
getLocalIp
;
/**
* @author jishenghua 752718920 2018-10-7 15:25:58
*/
...
...
@@ -36,7 +30,7 @@ public class CommonQueryManager {
* @param apiName 接口名称
* @param id ID
*/
public
Object
selectOne
(
String
apiName
,
String
id
)
{
public
Object
selectOne
(
String
apiName
,
String
id
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
)
&&
StringUtil
.
isNotEmpty
(
id
))
{
return
container
.
getCommonQuery
(
apiName
).
selectOne
(
id
);
}
...
...
@@ -49,7 +43,7 @@ public class CommonQueryManager {
* @param parameterMap
* @return
*/
public
List
<?>
select
(
String
apiName
,
Map
<
String
,
String
>
parameterMap
)
{
public
List
<?>
select
(
String
apiName
,
Map
<
String
,
String
>
parameterMap
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
select
(
parameterMap
);
}
...
...
@@ -62,7 +56,7 @@ public class CommonQueryManager {
* @param parameterMap
* @return
*/
public
Long
counts
(
String
apiName
,
Map
<
String
,
String
>
parameterMap
)
{
public
Long
counts
(
String
apiName
,
Map
<
String
,
String
>
parameterMap
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
counts
(
parameterMap
);
}
...
...
@@ -76,7 +70,7 @@ public class CommonQueryManager {
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insert
(
String
apiName
,
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
apiName
,
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
request
);
return
container
.
getCommonQuery
(
apiName
).
insert
(
beanJson
,
request
);
...
...
@@ -92,7 +86,7 @@ public class CommonQueryManager {
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
update
(
String
apiName
,
String
beanJson
,
Long
id
,
HttpServletRequest
request
)
{
public
int
update
(
String
apiName
,
String
beanJson
,
Long
id
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
id
).
toString
(),
request
);
...
...
@@ -108,7 +102,7 @@ public class CommonQueryManager {
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
delete
(
String
apiName
,
Long
id
,
HttpServletRequest
request
)
{
public
int
delete
(
String
apiName
,
Long
id
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
id
).
toString
(),
request
);
...
...
@@ -124,7 +118,7 @@ public class CommonQueryManager {
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDelete
(
String
apiName
,
String
ids
,
HttpServletRequest
request
)
{
public
int
batchDelete
(
String
apiName
,
String
ids
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
"批量删除,id集:"
+
ids
,
request
);
return
container
.
getCommonQuery
(
apiName
).
batchDelete
(
ids
);
...
...
@@ -139,7 +133,7 @@ public class CommonQueryManager {
* @param name
* @return
*/
public
int
checkIsNameExist
(
String
apiName
,
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
String
apiName
,
Long
id
,
String
name
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/ICommonQuery.java
View file @
42835c94
...
...
@@ -18,7 +18,7 @@ public interface ICommonQuery {
* @param condition 资源id
* @return 资源
*/
Object
selectOne
(
String
condition
);
Object
selectOne
(
String
condition
)
throws
Exception
;
/**
* 自定义查询
...
...
@@ -26,7 +26,7 @@ public interface ICommonQuery {
* @param parameterMap 查询参数
* @return 查询结果
*/
List
<?>
select
(
Map
<
String
,
String
>
parameterMap
);
List
<?>
select
(
Map
<
String
,
String
>
parameterMap
)
throws
Exception
;
/**
* 查询数量
...
...
@@ -34,7 +34,7 @@ public interface ICommonQuery {
* @param parameterMap 查询参数
* @return 查询结果
*/
Long
counts
(
Map
<
String
,
String
>
parameterMap
);
Long
counts
(
Map
<
String
,
String
>
parameterMap
)
throws
Exception
;
/**
* 新增数据
...
...
@@ -42,7 +42,7 @@ public interface ICommonQuery {
* @param beanJson
* @return
*/
int
insert
(
String
beanJson
,
HttpServletRequest
request
);
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
;
/**
* 更新数据
...
...
@@ -50,7 +50,7 @@ public interface ICommonQuery {
* @param beanJson
* @return
*/
int
update
(
String
beanJson
,
Long
id
);
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
;
/**
* 删除数据
...
...
@@ -58,7 +58,7 @@ public interface ICommonQuery {
* @param id
* @return
*/
int
delete
(
Long
id
);
int
delete
(
Long
id
)
throws
Exception
;
/**
* 批量删除数据
...
...
@@ -66,7 +66,7 @@ public interface ICommonQuery {
* @param ids
* @return
*/
int
batchDelete
(
String
ids
);
int
batchDelete
(
String
ids
)
throws
Exception
;
/**
* 查询名称是否存在
...
...
@@ -74,5 +74,5 @@ public interface ICommonQuery {
* @param id
* @return
*/
int
checkIsNameExist
(
Long
id
,
String
name
);
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/com/jsh/erp/service/account/AccountComponent.java
View file @
42835c94
package
com.jsh.erp.service.account
;
import
com.jsh.erp.service.ICommonQuery
;
import
com.jsh.erp.service.depot.DepotResource
;
import
com.jsh.erp.service.depot.DepotService
;
import
com.jsh.erp.utils.Constants
;
import
com.jsh.erp.utils.QueryUtils
;
import
com.jsh.erp.utils.StringUtil
;
...
...
@@ -26,11 +24,11 @@ public class AccountComponent implements ICommonQuery {
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
getAccountList
(
map
);
}
private
List
<?>
getAccountList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getAccountList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
serialNo
=
StringUtil
.
getInfo
(
search
,
"serialNo"
);
...
...
@@ -40,7 +38,7 @@ public class AccountComponent 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"
);
String
serialNo
=
StringUtil
.
getInfo
(
search
,
"serialNo"
);
...
...
@@ -49,27 +47,27 @@ public class AccountComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
accountService
.
insertAccount
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
accountService
.
updateAccount
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
accountService
.
deleteAccount
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
accountService
.
batchDeleteAccount
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
accountService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
42835c94
This diff is collapsed.
Click to expand it.
src/main/java/com/jsh/erp/service/accountHead/AccountHeadComponent.java
View file @
42835c94
...
...
@@ -19,16 +19,16 @@ public class AccountHeadComponent implements ICommonQuery {
private
AccountHeadService
accountHeadService
;
@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
getAccountHeadList
(
map
);
}
private
List
<?>
getAccountHeadList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getAccountHeadList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
String
billNo
=
StringUtil
.
getInfo
(
search
,
"billNo"
);
...
...
@@ -39,7 +39,7 @@ public class AccountHeadComponent 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
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
String
billNo
=
StringUtil
.
getInfo
(
search
,
"billNo"
);
...
...
@@ -49,27 +49,27 @@ public class AccountHeadComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
accountHeadService
.
insertAccountHead
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
accountHeadService
.
updateAccountHead
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
accountHeadService
.
deleteAccountHead
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
accountHeadService
.
batchDeleteAccountHead
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
accountHeadService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java
View file @
42835c94
...
...
@@ -42,18 +42,44 @@ public class AccountHeadService {
@Resource
private
AccountItemMapperEx
accountItemMapperEx
;
public
AccountHead
getAccountHead
(
long
id
)
{
return
accountHeadMapper
.
selectByPrimaryKey
(
id
);
public
AccountHead
getAccountHead
(
long
id
)
throws
Exception
{
AccountHead
result
=
null
;
try
{
result
=
accountHeadMapper
.
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
<
AccountHead
>
getAccountHead
()
{
public
List
<
AccountHead
>
getAccountHead
()
throws
Exception
{
AccountHeadExample
example
=
new
AccountHeadExample
();
return
accountHeadMapper
.
selectByExample
(
example
);
List
<
AccountHead
>
list
=
null
;
try
{
list
=
accountHeadMapper
.
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
<
AccountHeadVo4ListEx
>
select
(
String
type
,
String
billNo
,
String
beginTime
,
String
endTime
,
int
offset
,
int
rows
)
{
public
List
<
AccountHeadVo4ListEx
>
select
(
String
type
,
String
billNo
,
String
beginTime
,
String
endTime
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
AccountHeadVo4ListEx
>
resList
=
new
ArrayList
<
AccountHeadVo4ListEx
>();
List
<
AccountHeadVo4ListEx
>
list
=
accountHeadMapperEx
.
selectByConditionAccountHead
(
type
,
billNo
,
beginTime
,
endTime
,
offset
,
rows
);
List
<
AccountHeadVo4ListEx
>
list
=
null
;
try
{
list
=
accountHeadMapperEx
.
selectByConditionAccountHead
(
type
,
billNo
,
beginTime
,
endTime
,
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
);
}
if
(
null
!=
list
)
{
for
(
AccountHeadVo4ListEx
ah
:
list
)
{
if
(
ah
.
getChangeamount
()
!=
null
)
{
...
...
@@ -68,45 +94,107 @@ public class AccountHeadService {
return
resList
;
}
public
Long
countAccountHead
(
String
type
,
String
billNo
,
String
beginTime
,
String
endTime
)
{
return
accountHeadMapperEx
.
countsByAccountHead
(
type
,
billNo
,
beginTime
,
endTime
);
public
Long
countAccountHead
(
String
type
,
String
billNo
,
String
beginTime
,
String
endTime
)
throws
Exception
{
Long
result
=
null
;
try
{
result
=
accountHeadMapperEx
.
countsByAccountHead
(
type
,
billNo
,
beginTime
,
endTime
);
}
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
insertAccountHead
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertAccountHead
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
return
accountHeadMapper
.
insertSelective
(
accountHead
);
int
result
=
0
;
try
{
result
=
accountHeadMapper
.
insertSelective
(
accountHead
);
}
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
updateAccountHead
(
String
beanJson
,
Long
id
)
{
public
int
updateAccountHead
(
String
beanJson
,
Long
id
)
throws
Exception
{
AccountHead
accountHead
=
JSONObject
.
parseObject
(
beanJson
,
AccountHead
.
class
);
accountHead
.
setId
(
id
);
return
accountHeadMapper
.
updateByPrimaryKeySelective
(
accountHead
);
int
result
=
0
;
try
{
result
=
accountHeadMapper
.
updateByPrimaryKeySelective
(
accountHead
);
}
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
deleteAccountHead
(
Long
id
)
{
return
accountHeadMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteAccountHead
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
accountHeadMapper
.
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
batchDeleteAccountHead
(
String
ids
)
{
public
int
batchDeleteAccountHead
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AccountHeadExample
example
=
new
AccountHeadExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
accountHeadMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
accountHeadMapper
.
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
{
AccountHeadExample
example
=
new
AccountHeadExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
AccountHead
>
list
=
accountHeadMapper
.
selectByExample
(
example
);
return
list
.
size
();
List
<
AccountHead
>
list
=
null
;
try
{
list
=
accountHeadMapper
.
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
Long
getMaxId
()
{
return
accountHeadMapperEx
.
getMaxId
();
public
Long
getMaxId
()
throws
Exception
{
Long
result
=
null
;
try
{
result
=
accountHeadMapperEx
.
getMaxId
();
}
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
BigDecimal
findAllMoney
(
Integer
supplierId
,
String
type
,
String
mode
,
String
endTime
)
{
...
...
@@ -116,12 +204,29 @@ public class AccountHeadService {
}
else
if
(
mode
.
equals
(
"合计"
))
{
modeName
=
"TotalPrice"
;
}
return
accountHeadMapperEx
.
findAllMoney
(
supplierId
,
type
,
modeName
,
endTime
);
BigDecimal
result
=
null
;
try
{
result
=
accountHeadMapperEx
.
findAllMoney
(
supplierId
,
type
,
modeName
,
endTime
);
}
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
<
AccountHeadVo4ListEx
>
getDetailByNumber
(
String
billNo
)
{
public
List
<
AccountHeadVo4ListEx
>
getDetailByNumber
(
String
billNo
)
throws
Exception
{
List
<
AccountHeadVo4ListEx
>
resList
=
new
ArrayList
<
AccountHeadVo4ListEx
>();
List
<
AccountHeadVo4ListEx
>
list
=
accountHeadMapperEx
.
getDetailByNumber
(
billNo
);
List
<
AccountHeadVo4ListEx
>
list
=
null
;
try
{
list
=
accountHeadMapperEx
.
getDetailByNumber
(
billNo
);
}
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
(
null
!=
list
)
{
for
(
AccountHeadVo4ListEx
ah
:
list
)
{
if
(
ah
.
getChangeamount
()
!=
null
)
{
...
...
@@ -136,13 +241,22 @@ public class AccountHeadService {
return
resList
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountHeadByIds
(
String
ids
)
{
public
int
batchDeleteAccountHeadByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
accountHeadMapperEx
.
batchDeleteAccountHeadByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
accountHeadMapperEx
.
batchDeleteAccountHeadByIds
(
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
...
...
@@ -168,7 +282,15 @@ public class AccountHeadService {
/**
* 校验财务子表 jsh_accountitem
* */
List
<
AccountItem
>
accountItemList
=
accountItemMapperEx
.
getAccountItemListByHeaderIds
(
idArray
);
List
<
AccountItem
>
accountItemList
=
null
;
try
{
accountItemList
=
accountItemMapperEx
.
getAccountItemListByHeaderIds
(
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
(
accountItemList
!=
null
&&
accountItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,HeaderIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
...
...
src/main/java/com/jsh/erp/service/accountItem/AccountItemComponent.java
View file @
42835c94
...
...
@@ -19,16 +19,16 @@ public class AccountItemComponent implements ICommonQuery {
private
AccountItemService
accountItemService
;
@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
getAccountItemList
(
map
);
}
private
List
<?>
getAccountItemList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getAccountItemList
(
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"
));
...
...
@@ -38,7 +38,7 @@ public class AccountItemComponent 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"
));
...
...
@@ -47,27 +47,27 @@ public class AccountItemComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
accountItemService
.
insertAccountItem
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
accountItemService
.
updateAccountItem
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
accountItemService
.
deleteAccountItem
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
accountItemService
.
batchDeleteAccountItem
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
accountItemService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java
View file @
42835c94
...
...
@@ -3,12 +3,15 @@ package com.jsh.erp.service.accountItem;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.AccountHead
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItemExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.AccountItemMapper
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.ErpInfo
;
...
...
@@ -43,72 +46,179 @@ public class AccountItemService {
@Resource
private
UserService
userService
;
public
AccountItem
getAccountItem
(
long
id
)
{
return
accountItemMapper
.
selectByPrimaryKey
(
id
);
public
AccountItem
getAccountItem
(
long
id
)
throws
Exception
{
AccountItem
result
=
null
;
try
{
result
=
accountItemMapper
.
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
<
AccountItem
>
getAccountItem
()
{
public
List
<
AccountItem
>
getAccountItem
()
throws
Exception
{
AccountItemExample
example
=
new
AccountItemExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
accountItemMapper
.
selectByExample
(
example
);
List
<
AccountItem
>
list
=
null
;
try
{
list
=
accountItemMapper
.
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
<
AccountItem
>
select
(
String
name
,
Integer
type
,
String
remark
,
int
offset
,
int
rows
)
{
return
accountItemMapperEx
.
selectByConditionAccountItem
(
name
,
type
,
remark
,
offset
,
rows
);
public
List
<
AccountItem
>
select
(
String
name
,
Integer
type
,
String
remark
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
AccountItem
>
list
=
null
;
try
{
list
=
accountItemMapperEx
.
selectByConditionAccountItem
(
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
countAccountItem
(
String
name
,
Integer
type
,
String
remark
)
{
return
accountItemMapperEx
.
countsByAccountItem
(
name
,
type
,
remark
);
public
Long
countAccountItem
(
String
name
,
Integer
type
,
String
remark
)
throws
Exception
{
Long
result
=
null
;
try
{
result
=
accountItemMapperEx
.
countsByAccountItem
(
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
insertAccountItem
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertAccountItem
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
AccountItem
accountItem
=
JSONObject
.
parseObject
(
beanJson
,
AccountItem
.
class
);
return
accountItemMapper
.
insertSelective
(
accountItem
);
int
result
=
0
;
try
{
result
=
accountItemMapper
.
insertSelective
(
accountItem
);
}
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
updateAccountItem
(
String
beanJson
,
Long
id
)
{
public
int
updateAccountItem
(
String
beanJson
,
Long
id
)
throws
Exception
{
AccountItem
accountItem
=
JSONObject
.
parseObject
(
beanJson
,
AccountItem
.
class
);
accountItem
.
setId
(
id
);
return
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
int
result
=
0
;
try
{
result
=
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
}
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
deleteAccountItem
(
Long
id
)
{
return
accountItemMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteAccountItem
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
accountItemMapper
.
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
batchDeleteAccountItem
(
String
ids
)
{
public
int
batchDeleteAccountItem
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AccountItemExample
example
=
new
AccountItemExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
accountItemMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
accountItemMapper
.
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
{
AccountItemExample
example
=
new
AccountItemExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
AccountItem
>
list
=
accountItemMapper
.
selectByExample
(
example
);
return
list
.
size
();
List
<
AccountItem
>
list
=
null
;
try
{
list
=
accountItemMapper
.
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
();
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertAccountItemWithObj
(
AccountItem
accountItem
)
{
return
accountItemMapper
.
insertSelective
(
accountItem
);
public
int
insertAccountItemWithObj
(
AccountItem
accountItem
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
accountItemMapper
.
insertSelective
(
accountItem
);
}
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
updateAccountItemWithObj
(
AccountItem
accountItem
)
{
return
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
public
int
updateAccountItemWithObj
(
AccountItem
accountItem
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
accountItemMapper
.
updateByPrimaryKeySelective
(
accountItem
);
}
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
List
<
AccountItemVo4List
>
getDetailList
(
Long
headerId
)
{
return
accountItemMapperEx
.
getDetailList
(
headerId
);
List
<
AccountItemVo4List
>
list
=
null
;
try
{
list
=
accountItemMapperEx
.
getDetailList
(
headerId
);
}
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
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
,
String
listType
)
throws
DataAccess
Exception
{
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
,
String
listType
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT_ITEM
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
",headerId:"
).
append
(
headerId
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
...
...
@@ -181,12 +291,21 @@ public class AccountItemService {
return
null
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAccountItemByIds
(
String
ids
)
{
public
int
batchDeleteAccountItemByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT_ITEM
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
accountItemMapperEx
.
batchDeleteAccountItemByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
accountItemMapperEx
.
batchDeleteAccountItemByIds
(
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
;
}
}
src/main/java/com/jsh/erp/service/app/AppComponent.java
View file @
42835c94
...
...
@@ -19,16 +19,16 @@ public class AppComponent implements ICommonQuery {
private
AppService
appService
;
@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
getAppList
(
map
);
}
private
List
<?>
getAppList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getAppList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
...
@@ -37,7 +37,7 @@ public class AppComponent 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"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
...
@@ -45,27 +45,27 @@ public class AppComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
appService
.
insertApp
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
appService
.
updateApp
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
appService
.
deleteApp
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
appService
.
batchDeleteApp
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
0
;
}
...
...
src/main/java/com/jsh/erp/service/app/AppService.java
View file @
42835c94
...
...
@@ -2,12 +2,14 @@ package com.jsh.erp.service.app;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.App
;
import
com.jsh.erp.datasource.entities.AppExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.mappers.AppMapper
;
import
com.jsh.erp.datasource.mappers.AppMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
...
...
@@ -40,11 +42,19 @@ public class AppService {
@Resource
private
UserBusinessService
userBusinessService
;
public
List
<
App
>
findDock
(){
public
List
<
App
>
findDock
()
throws
Exception
{
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andZlEqualTo
(
"dock"
).
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
App
>
list
=
appMapper
.
selectByExample
(
example
);
List
<
App
>
list
=
null
;
try
{
list
=
appMapper
.
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
;
}
/**
...
...
@@ -55,86 +65,191 @@ public class AppService {
* @Param: null
* @return
*/
public
List
<
App
>
findDesk
(){
public
List
<
App
>
findDesk
()
throws
Exception
{
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andZlEqualTo
(
"desk"
).
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
App
>
list
=
appMapper
.
selectByExample
(
example
);
List
<
App
>
list
=
null
;
try
{
list
=
appMapper
.
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
App
getApp
(
long
id
)
{
return
appMapper
.
selectByPrimaryKey
(
id
);
public
App
getApp
(
long
id
)
throws
Exception
{
App
result
=
null
;
try
{
result
=
appMapper
.
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
<
App
>
getApp
()
{
public
List
<
App
>
getApp
()
throws
Exception
{
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
appMapper
.
selectByExample
(
example
);
List
<
App
>
list
=
null
;
try
{
list
=
appMapper
.
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
<
App
>
select
(
String
name
,
String
type
,
int
offset
,
int
rows
)
{
return
appMapperEx
.
selectByConditionApp
(
name
,
type
,
offset
,
rows
);
public
List
<
App
>
select
(
String
name
,
String
type
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
App
>
list
=
null
;
try
{
list
=
appMapperEx
.
selectByConditionApp
(
name
,
type
,
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
countApp
(
String
name
,
String
type
)
{
return
appMapperEx
.
countsByApp
(
name
,
type
);
public
Long
countApp
(
String
name
,
String
type
)
throws
Exception
{
Long
result
=
null
;
try
{
result
=
appMapperEx
.
countsByApp
(
name
,
type
);
}
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
insertApp
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertApp
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
App
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
return
appMapper
.
insertSelective
(
app
);
int
result
=
0
;
try
{
result
=
appMapper
.
insertSelective
(
app
);
}
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
updateApp
(
String
beanJson
,
Long
id
)
{
public
int
updateApp
(
String
beanJson
,
Long
id
)
throws
Exception
{
App
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
app
.
setId
(
id
);
return
appMapper
.
updateByPrimaryKeySelective
(
app
);
int
result
=
0
;
try
{
result
=
appMapper
.
updateByPrimaryKeySelective
(
app
);
}
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
deleteApp
(
Long
id
)
{
return
appMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteApp
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
appMapper
.
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
batchDeleteApp
(
String
ids
)
{
public
int
batchDeleteApp
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
appMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
appMapper
.
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
List
<
App
>
findRoleAPP
(){
public
List
<
App
>
findRoleAPP
()
throws
Exception
{
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
App
>
list
=
appMapper
.
selectByExample
(
example
);
List
<
App
>
list
=
null
;
try
{
list
=
appMapper
.
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
<
App
>
findAppInIds
(
String
ids
,
String
type
){
public
List
<
App
>
findAppInIds
(
String
ids
,
String
type
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andZlEqualTo
(
type
).
andEnabledEqualTo
(
true
).
andIdIn
(
idList
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
App
>
list
=
appMapper
.
selectByExample
(
example
);
List
<
App
>
list
=
null
;
try
{
list
=
appMapper
.
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
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteAppByIds
(
String
ids
)
{
public
int
batchDeleteAppByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_APP
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
appMapperEx
.
batchDeleteAppByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
appMapperEx
.
batchDeleteAppByIds
(
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
;
}
public
List
<
App
>
findAppByUserId
(
String
userId
)
{
public
List
<
App
>
findAppByUserId
(
String
userId
)
throws
Exception
{
List
<
UserBusiness
>
roleList
=
userBusinessService
.
findRoleByUserId
(
userId
);
String
roles
=
null
;
if
(
roleList
!=
null
&&
roleList
.
size
()>
0
&&
roleList
.
get
(
0
)!=
null
){
...
...
@@ -162,10 +277,19 @@ public class AppService {
* @param numberList
* @return
*/
public
List
<
App
>
findAppByNumber
(
List
<
String
>
numberList
)
{
public
List
<
App
>
findAppByNumber
(
List
<
String
>
numberList
)
throws
Exception
{
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andNumberIn
(
numberList
);
return
appMapper
.
selectByExample
(
example
);
List
<
App
>
list
=
null
;
try
{
list
=
appMapper
.
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
;
}
}
src/main/java/com/jsh/erp/service/depot/DepotComponent.java
View file @
42835c94
...
...
@@ -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 @
42835c94
...
...
@@ -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
);
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadComponent.java
View file @
42835c94
...
...
@@ -19,16 +19,16 @@ public class DepotHeadComponent implements ICommonQuery {
private
DepotHeadService
depotHeadService
;
@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
getDepotHeadList
(
map
);
}
private
List
<?>
getDepotHeadList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getDepotHeadList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
String
subType
=
StringUtil
.
getInfo
(
search
,
"subType"
);
...
...
@@ -41,7 +41,7 @@ public class DepotHeadComponent 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
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
String
subType
=
StringUtil
.
getInfo
(
search
,
"subType"
);
...
...
@@ -53,27 +53,27 @@ public class DepotHeadComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
depotHeadService
.
insertDepotHead
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
depotHeadService
.
updateDepotHead
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
depotHeadService
.
deleteDepotHead
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
depotHeadService
.
batchDeleteDepotHead
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
depotHeadService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
42835c94
This diff is collapsed.
Click to expand it.
src/main/java/com/jsh/erp/service/depotItem/DepotItemComponent.java
View file @
42835c94
...
...
@@ -19,16 +19,16 @@ public class DepotItemComponent implements ICommonQuery {
private
DepotItemService
depotItemService
;
@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
getDepotItemList
(
map
);
}
private
List
<?>
getDepotItemList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getDepotItemList
(
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"
));
...
...
@@ -38,7 +38,7 @@ public class DepotItemComponent 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"
));
...
...
@@ -47,27 +47,27 @@ public class DepotItemComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
depotItemService
.
insertDepotItem
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
depotItemService
.
updateDepotItem
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
depotItemService
.
deleteDepotItem
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
depotItemService
.
batchDeleteDepotItem
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
depotItemService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
42835c94
This diff is collapsed.
Click to expand it.
src/main/java/com/jsh/erp/service/functions/FunctionsComponent.java
View file @
42835c94
...
...
@@ -21,16 +21,16 @@ public class FunctionsComponent implements ICommonQuery {
private
FunctionsService
functionsService
;
@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
getFunctionsList
(
map
);
}
private
List
<?>
getFunctionsList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getFunctionsList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
...
@@ -39,7 +39,7 @@ public class FunctionsComponent 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"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
...
@@ -47,27 +47,27 @@ public class FunctionsComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
functionsService
.
insertFunctions
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
functionsService
.
updateFunctions
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
functionsService
.
deleteFunctions
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
functionsService
.
batchDeleteFunctions
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
functionsService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/functions/FunctionsService.java
View file @
42835c94
...
...
@@ -2,11 +2,14 @@ package com.jsh.erp.service.functions;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.DepotItem
;
import
com.jsh.erp.datasource.entities.Functions
;
import
com.jsh.erp.datasource.entities.FunctionsExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.mappers.FunctionsMapper
;
import
com.jsh.erp.datasource.mappers.FunctionsMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
...
...
@@ -36,92 +39,205 @@ public class FunctionsService {
@Resource
private
LogService
logService
;
public
Functions
getFunctions
(
long
id
)
{
return
functionsMapper
.
selectByPrimaryKey
(
id
);
public
Functions
getFunctions
(
long
id
)
throws
Exception
{
Functions
result
=
null
;
try
{
result
=
functionsMapper
.
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
<
Functions
>
getFunctions
()
{
public
List
<
Functions
>
getFunctions
()
throws
Exception
{
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
functionsMapper
.
selectByExample
(
example
);
List
<
Functions
>
list
=
null
;
try
{
list
=
functionsMapper
.
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
<
Functions
>
select
(
String
name
,
String
type
,
int
offset
,
int
rows
)
{
return
functionsMapperEx
.
selectByConditionFunctions
(
name
,
type
,
offset
,
rows
);
public
List
<
Functions
>
select
(
String
name
,
String
type
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
Functions
>
list
=
null
;
try
{
list
=
functionsMapperEx
.
selectByConditionFunctions
(
name
,
type
,
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
countFunctions
(
String
name
,
String
type
)
{
return
functionsMapperEx
.
countsByFunctions
(
name
,
type
);
public
Long
countFunctions
(
String
name
,
String
type
)
throws
Exception
{
Long
result
=
null
;
try
{
result
=
functionsMapperEx
.
countsByFunctions
(
name
,
type
);
}
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
insertFunctions
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertFunctions
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
Functions
depot
=
JSONObject
.
parseObject
(
beanJson
,
Functions
.
class
);
return
functionsMapper
.
insertSelective
(
depot
);
int
result
=
0
;
try
{
result
=
functionsMapper
.
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
updateFunctions
(
String
beanJson
,
Long
id
)
{
public
int
updateFunctions
(
String
beanJson
,
Long
id
)
throws
Exception
{
Functions
depot
=
JSONObject
.
parseObject
(
beanJson
,
Functions
.
class
);
depot
.
setId
(
id
);
return
functionsMapper
.
updateByPrimaryKeySelective
(
depot
);
int
result
=
0
;
try
{
result
=
functionsMapper
.
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
deleteFunctions
(
Long
id
)
{
return
functionsMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteFunctions
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
functionsMapper
.
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
batchDeleteFunctions
(
String
ids
)
{
public
int
batchDeleteFunctions
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
functionsMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
functionsMapper
.
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
{
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andIdNotEqualTo
(
id
).
andNameEqualTo
(
name
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
Functions
>
list
=
functionsMapper
.
selectByExample
(
example
);
return
list
.
size
();
List
<
Functions
>
list
=
null
;
try
{
list
=
functionsMapper
.
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
<
Functions
>
getRoleFunctions
(
String
pNumber
)
{
public
List
<
Functions
>
getRoleFunctions
(
String
pNumber
)
throws
Exception
{
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andPnumberEqualTo
(
pNumber
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
Functions
>
list
=
functionsMapper
.
selectByExample
(
example
);
List
<
Functions
>
list
=
null
;
try
{
list
=
functionsMapper
.
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
<
Functions
>
findRoleFunctions
(
String
pnumber
){
public
List
<
Functions
>
findRoleFunctions
(
String
pnumber
)
throws
Exception
{
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andPnumberEqualTo
(
pnumber
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
List
<
Functions
>
list
=
functionsMapper
.
selectByExample
(
example
);
List
<
Functions
>
list
=
null
;
try
{
list
=
functionsMapper
.
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
<
Functions
>
findByIds
(
String
functionsIds
){
public
List
<
Functions
>
findByIds
(
String
functionsIds
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
functionsIds
);
FunctionsExample
example
=
new
FunctionsExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andIdIn
(
idList
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort asc"
);
List
<
Functions
>
list
=
functionsMapper
.
selectByExample
(
example
);
List
<
Functions
>
list
=
null
;
try
{
list
=
functionsMapper
.
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
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteFunctionsByIds
(
String
ids
)
{
public
int
batchDeleteFunctionsByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_FUNCTIONS
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
functionsMapperEx
.
batchDeleteFunctionsByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
functionsMapperEx
.
batchDeleteFunctionsByIds
(
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
;
}
}
src/main/java/com/jsh/erp/service/inOutItem/InOutItemComponent.java
View file @
42835c94
...
...
@@ -19,16 +19,16 @@ public class InOutItemComponent implements ICommonQuery {
private
InOutItemService
inOutItemService
;
@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
getFunctionsList
(
map
);
}
private
List
<?>
getFunctionsList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getFunctionsList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
...
@@ -38,7 +38,7 @@ public class InOutItemComponent 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"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
...
@@ -47,27 +47,27 @@ public class InOutItemComponent implements ICommonQuery {
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
inOutItemService
.
insertInOutItem
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
inOutItemService
.
updateInOutItem
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
inOutItemService
.
deleteInOutItem
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
inOutItemService
.
batchDeleteInOutItem
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
inOutItemService
.
checkIsNameExist
(
id
,
name
);
}
...
...
Prev
1
2
3
4
Next
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