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
ae416e8f
Commit
ae416e8f
authored
Apr 17, 2019
by
qiankunpingtai
Browse files
异常封装之应用信息后台修改
parent
afcf2edb
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/AppController.java
View file @
ae416e8f
...
@@ -48,7 +48,7 @@ public class AppController {
...
@@ -48,7 +48,7 @@ public class AppController {
* @return
* @return
*/
*/
@GetMapping
(
value
=
"/findAppByUserId"
)
@GetMapping
(
value
=
"/findAppByUserId"
)
public
JSONObject
findAppByUserId
(
@RequestParam
(
"userId"
)
String
userId
,
HttpServletRequest
request
)
{
public
JSONObject
findAppByUserId
(
@RequestParam
(
"userId"
)
String
userId
,
HttpServletRequest
request
)
throws
Exception
{
List
<
UserBusiness
>
roleList
=
userBusinessService
.
findRoleByUserId
(
userId
);
List
<
UserBusiness
>
roleList
=
userBusinessService
.
findRoleByUserId
(
userId
);
String
roles
=
null
;
String
roles
=
null
;
if
(
roleList
!=
null
&&
roleList
.
size
()>
0
&&
roleList
.
get
(
0
)!=
null
){
if
(
roleList
!=
null
&&
roleList
.
size
()>
0
&&
roleList
.
get
(
0
)!=
null
){
...
@@ -109,7 +109,7 @@ public class AppController {
...
@@ -109,7 +109,7 @@ public class AppController {
}
}
@GetMapping
(
value
=
"/findDesk"
)
@GetMapping
(
value
=
"/findDesk"
)
public
JSONObject
findDesk
(
HttpServletRequest
request
)
{
public
JSONObject
findDesk
(
HttpServletRequest
request
)
throws
Exception
{
JSONObject
obj
=
new
JSONObject
();
JSONObject
obj
=
new
JSONObject
();
List
<
App
>
dockList
=
appService
.
findDock
();
List
<
App
>
dockList
=
appService
.
findDock
();
JSONArray
dockArray
=
new
JSONArray
();
JSONArray
dockArray
=
new
JSONArray
();
...
@@ -160,7 +160,7 @@ public class AppController {
...
@@ -160,7 +160,7 @@ public class AppController {
*/
*/
@PostMapping
(
value
=
"/findRoleAPP"
)
@PostMapping
(
value
=
"/findRoleAPP"
)
public
JSONArray
findRoleAPP
(
@RequestParam
(
"UBType"
)
String
type
,
@RequestParam
(
"UBKeyId"
)
String
keyId
,
public
JSONArray
findRoleAPP
(
@RequestParam
(
"UBType"
)
String
type
,
@RequestParam
(
"UBKeyId"
)
String
keyId
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
JSONArray
arr
=
new
JSONArray
();
JSONArray
arr
=
new
JSONArray
();
try
{
try
{
List
<
App
>
dataListApp
=
appService
.
findRoleAPP
();
List
<
App
>
dataListApp
=
appService
.
findRoleAPP
();
...
@@ -229,7 +229,7 @@ public class AppController {
...
@@ -229,7 +229,7 @@ public class AppController {
*/
*/
@PostMapping
(
value
=
"/uploadImg"
)
@PostMapping
(
value
=
"/uploadImg"
)
public
BaseResponseInfo
uploadImg
(
MultipartFile
fileInfo
,
@RequestParam
(
"fileInfoName"
)
String
fileName
,
public
BaseResponseInfo
uploadImg
(
MultipartFile
fileInfo
,
@RequestParam
(
"fileInfoName"
)
String
fileName
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
try
{
if
(
fileInfo
!=
null
)
{
if
(
fileInfo
!=
null
)
{
...
...
src/main/java/com/jsh/erp/service/app/AppComponent.java
View file @
ae416e8f
...
@@ -19,16 +19,16 @@ public class AppComponent implements ICommonQuery {
...
@@ -19,16 +19,16 @@ public class AppComponent implements ICommonQuery {
private
AppService
appService
;
private
AppService
appService
;
@Override
@Override
public
Object
selectOne
(
String
condition
)
{
public
Object
selectOne
(
String
condition
)
throws
Exception
{
return
null
;
return
null
;
}
}
@Override
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
getAppList
(
map
);
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
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
@@ -37,7 +37,7 @@ public class AppComponent implements ICommonQuery {
...
@@ -37,7 +37,7 @@ public class AppComponent implements ICommonQuery {
}
}
@Override
@Override
public
Long
counts
(
Map
<
String
,
String
>
map
)
{
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
String
type
=
StringUtil
.
getInfo
(
search
,
"type"
);
...
@@ -45,27 +45,27 @@ public class AppComponent implements ICommonQuery {
...
@@ -45,27 +45,27 @@ public class AppComponent implements ICommonQuery {
}
}
@Override
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
appService
.
insertApp
(
beanJson
,
request
);
return
appService
.
insertApp
(
beanJson
,
request
);
}
}
@Override
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
appService
.
updateApp
(
beanJson
,
id
);
return
appService
.
updateApp
(
beanJson
,
id
);
}
}
@Override
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
appService
.
deleteApp
(
id
);
return
appService
.
deleteApp
(
id
);
}
}
@Override
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
appService
.
batchDeleteApp
(
ids
);
return
appService
.
batchDeleteApp
(
ids
);
}
}
@Override
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
0
;
return
0
;
}
}
...
...
src/main/java/com/jsh/erp/service/app/AppService.java
View file @
ae416e8f
...
@@ -2,12 +2,14 @@ package com.jsh.erp.service.app;
...
@@ -2,12 +2,14 @@ package com.jsh.erp.service.app;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
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.App
;
import
com.jsh.erp.datasource.entities.AppExample
;
import
com.jsh.erp.datasource.entities.AppExample
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.mappers.AppMapper
;
import
com.jsh.erp.datasource.mappers.AppMapper
;
import
com.jsh.erp.datasource.mappers.AppMapperEx
;
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.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
...
@@ -40,11 +42,19 @@ public class AppService {
...
@@ -40,11 +42,19 @@ public class AppService {
@Resource
@Resource
private
UserBusinessService
userBusinessService
;
private
UserBusinessService
userBusinessService
;
public
List
<
App
>
findDock
(){
public
List
<
App
>
findDock
()
throws
Exception
{
AppExample
example
=
new
AppExample
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andZlEqualTo
(
"dock"
).
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andZlEqualTo
(
"dock"
).
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
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
;
return
list
;
}
}
/**
/**
...
@@ -55,86 +65,191 @@ public class AppService {
...
@@ -55,86 +65,191 @@ public class AppService {
* @Param: null
* @Param: null
* @return
* @return
*/
*/
public
List
<
App
>
findDesk
(){
public
List
<
App
>
findDesk
()
throws
Exception
{
AppExample
example
=
new
AppExample
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andZlEqualTo
(
"desk"
).
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andZlEqualTo
(
"desk"
).
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
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
;
return
list
;
}
}
public
App
getApp
(
long
id
)
{
public
App
getApp
(
long
id
)
throws
Exception
{
return
appMapper
.
selectByPrimaryKey
(
id
);
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
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
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
)
{
public
List
<
App
>
select
(
String
name
,
String
type
,
int
offset
,
int
rows
)
throws
Exception
{
return
appMapperEx
.
selectByConditionApp
(
name
,
type
,
offset
,
rows
);
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
)
{
public
Long
countApp
(
String
name
,
String
type
)
throws
Exception
{
return
appMapperEx
.
countsByApp
(
name
,
type
);
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
)
@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
);
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
)
@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
app
=
JSONObject
.
parseObject
(
beanJson
,
App
.
class
);
app
.
setId
(
id
);
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
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteApp
(
Long
id
)
{
public
int
deleteApp
(
Long
id
)
throws
Exception
{
return
appMapper
.
deleteByPrimaryKey
(
id
);
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
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteApp
(
String
ids
)
{
public
int
batchDeleteApp
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AppExample
example
=
new
AppExample
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
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
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
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
;
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
);
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
AppExample
example
=
new
AppExample
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andZlEqualTo
(
type
).
andEnabledEqualTo
(
true
).
andIdIn
(
idList
)
example
.
createCriteria
().
andZlEqualTo
(
type
).
andEnabledEqualTo
(
true
).
andIdIn
(
idList
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
example
.
setOrderByClause
(
"Sort"
);
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
;
return
list
;
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@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
,
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_APP
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
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
);
List
<
UserBusiness
>
roleList
=
userBusinessService
.
findRoleByUserId
(
userId
);
String
roles
=
null
;
String
roles
=
null
;
if
(
roleList
!=
null
&&
roleList
.
size
()>
0
&&
roleList
.
get
(
0
)!=
null
){
if
(
roleList
!=
null
&&
roleList
.
size
()>
0
&&
roleList
.
get
(
0
)!=
null
){
...
@@ -162,10 +277,19 @@ public class AppService {
...
@@ -162,10 +277,19 @@ public class AppService {
* @param numberList
* @param numberList
* @return
* @return
*/
*/
public
List
<
App
>
findAppByNumber
(
List
<
String
>
numberList
)
{
public
List
<
App
>
findAppByNumber
(
List
<
String
>
numberList
)
throws
Exception
{
AppExample
example
=
new
AppExample
();
AppExample
example
=
new
AppExample
();
example
.
createCriteria
().
andEnabledEqualTo
(
true
).
andNumberIn
(
numberList
);
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/userBusiness/UserBusinessComponent.java
View file @
ae416e8f
...
@@ -41,12 +41,12 @@ public class UserBusinessComponent implements ICommonQuery {
...
@@ -41,12 +41,12 @@ public class UserBusinessComponent implements ICommonQuery {
}
}
@Override
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
return
userBusinessService
.
insertUserBusiness
(
beanJson
,
request
);
return
userBusinessService
.
insertUserBusiness
(
beanJson
,
request
);
}
}
@Override
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
public
int
update
(
String
beanJson
,
Long
id
)
throws
Exception
{
return
userBusinessService
.
updateUserBusiness
(
beanJson
,
id
);
return
userBusinessService
.
updateUserBusiness
(
beanJson
,
id
);
}
}
...
...
src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java
View file @
ae416e8f
...
@@ -64,7 +64,7 @@ public class UserBusinessService {
...
@@ -64,7 +64,7 @@ public class UserBusinessService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertUserBusiness
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertUserBusiness
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
UserBusiness
userBusiness
=
JSONObject
.
parseObject
(
beanJson
,
UserBusiness
.
class
);
UserBusiness
userBusiness
=
JSONObject
.
parseObject
(
beanJson
,
UserBusiness
.
class
);
int
inserts
=
userBusinessMapper
.
insertSelective
(
userBusiness
);
int
inserts
=
userBusinessMapper
.
insertSelective
(
userBusiness
);
// 更新应用权限
// 更新应用权限
...
@@ -75,7 +75,7 @@ public class UserBusinessService {
...
@@ -75,7 +75,7 @@ public class UserBusinessService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateUserBusiness
(
String
beanJson
,
Long
id
)
{
public
int
updateUserBusiness
(
String
beanJson
,
Long
id
)
throws
Exception
{
UserBusiness
userBusiness
=
JSONObject
.
parseObject
(
beanJson
,
UserBusiness
.
class
);
UserBusiness
userBusiness
=
JSONObject
.
parseObject
(
beanJson
,
UserBusiness
.
class
);
userBusiness
.
setId
(
id
);
userBusiness
.
setId
(
id
);
int
updates
=
userBusinessMapper
.
updateByPrimaryKeySelective
(
userBusiness
);
int
updates
=
userBusinessMapper
.
updateByPrimaryKeySelective
(
userBusiness
);
...
@@ -187,7 +187,7 @@ public class UserBusinessService {
...
@@ -187,7 +187,7 @@ public class UserBusinessService {
* @param functionIds
* @param functionIds
* @return
* @return
*/
*/
public
int
insertOrUpdateAppValue
(
String
type
,
String
keyId
,
String
functionIds
)
{
public
int
insertOrUpdateAppValue
(
String
type
,
String
keyId
,
String
functionIds
)
throws
Exception
{
int
updates
=
0
;
int
updates
=
0
;
...
...
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