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
7e20ea9c
Commit
7e20ea9c
authored
Mar 26, 2019
by
qiankunpingtai
Browse files
完善日志记录功能
parent
0ecb5102
Changes
17
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/constants/BusinessConstants.java
View file @
7e20ea9c
...
@@ -140,8 +140,16 @@ public class BusinessConstants {
...
@@ -140,8 +140,16 @@ public class BusinessConstants {
* 新增、修改、删除
* 新增、修改、删除
* */
* */
public
static
final
String
LOG_OPERATION_TYPE_ADD
=
"新增"
;
public
static
final
String
LOG_OPERATION_TYPE_ADD
=
"新增"
;
public
static
final
String
LOG_OPERATION_TYPE_BATCH_ADD
=
"批量新增"
;
public
static
final
String
LOG_OPERATION_TYPE_EDIT
=
"修改,id:"
;
public
static
final
String
LOG_OPERATION_TYPE_EDIT
=
"修改,id:"
;
public
static
final
String
LOG_OPERATION_TYPE_DELETE
=
"删除,id:"
;
public
static
final
String
LOG_OPERATION_TYPE_DELETE
=
"删除,id:"
;
public
static
final
String
LOG_OPERATION_TYPE_IMPORT
=
"导入"
;
/**
* 数据数量单位
* 条
* */
public
static
final
String
LOG_DATA_UNIT
=
"条"
;
/**
/**
* 模块中文名称
* 模块中文名称
* 模块对应的标识
* 模块对应的标识
...
@@ -186,6 +194,8 @@ public class BusinessConstants {
...
@@ -186,6 +194,8 @@ public class BusinessConstants {
public
static
final
String
LOG_INTERFACE_NAME_ACCOUNT_ITEM
=
"accountItem"
;
public
static
final
String
LOG_INTERFACE_NAME_ACCOUNT_ITEM
=
"accountItem"
;
public
static
final
String
LOG_MODULE_NAME_SERIAL_NUMBER
=
"序列号"
;
public
static
final
String
LOG_MODULE_NAME_SERIAL_NUMBER
=
"序列号"
;
public
static
final
String
LOG_INTERFACE_NAME_SERIAL_NUMBER
=
"serialNumber"
;
public
static
final
String
LOG_INTERFACE_NAME_SERIAL_NUMBER
=
"serialNumber"
;
public
static
final
String
LOG_MODULE_NAME_ORGANIZATION
=
"机构"
;
public
static
final
String
LOG_INTERFACE_NAME_ORGANIZATION
=
"organization"
;
...
...
src/main/java/com/jsh/erp/controller/AccountItemController.java
View file @
7e20ea9c
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.service.accountItem.AccountItemService
;
import
com.jsh.erp.service.accountItem.AccountItemService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.*
;
import
com.jsh.erp.utils.*
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
...
src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
7e20ea9c
...
@@ -40,8 +40,6 @@ public class DepotHeadController {
...
@@ -40,8 +40,6 @@ public class DepotHeadController {
@Resource
@Resource
private
DepotHeadService
depotHeadService
;
private
DepotHeadService
depotHeadService
;
@Resource
private
LogService
logService
;
/**
/**
* 批量设置状态-审核或者反审核
* 批量设置状态-审核或者反审核
...
@@ -435,7 +433,7 @@ public class DepotHeadController {
...
@@ -435,7 +433,7 @@ public class DepotHeadController {
@RequestParam
(
"updated"
)
String
updated
,
HttpServletRequest
request
)
throws
Exception
{
@RequestParam
(
"updated"
)
String
updated
,
HttpServletRequest
request
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
depotHeadService
.
addDepotHeadAndDetail
(
beanJson
,
inserted
,
deleted
,
updated
);
depotHeadService
.
addDepotHeadAndDetail
(
beanJson
,
inserted
,
deleted
,
updated
);
logService
.
insertLog
(
"depotHead"
,
"新增"
,
request
);
return
result
;
return
result
;
}
}
/**
/**
...
...
src/main/java/com/jsh/erp/controller/SupplierController.java
View file @
7e20ea9c
...
@@ -11,6 +11,7 @@ import jxl.Workbook;
...
@@ -11,6 +11,7 @@ import jxl.Workbook;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -375,8 +376,8 @@ public class SupplierController {
...
@@ -375,8 +376,8 @@ public class SupplierController {
importFun
(
supplierFile
);
importFun
(
supplierFile
);
response
.
sendRedirect
(
"../pages/manage/member.html"
);
response
.
sendRedirect
(
"../pages/manage/member.html"
);
}
}
public
String
importFun
(
MultipartFile
supplierFile
){
public
String
importFun
(
MultipartFile
supplierFile
){
BaseResponseInfo
info
=
new
BaseResponseInfo
();
BaseResponseInfo
info
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
String
message
=
"成功"
;
String
message
=
"成功"
;
...
...
src/main/java/com/jsh/erp/service/CommonQueryManager.java
View file @
7e20ea9c
...
@@ -78,7 +78,7 @@ public class CommonQueryManager {
...
@@ -78,7 +78,7 @@ public class CommonQueryManager {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insert
(
String
apiName
,
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insert
(
String
apiName
,
String
beanJson
,
HttpServletRequest
request
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
"新增"
,
request
);
logService
.
insertLog
(
apiName
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
request
);
return
container
.
getCommonQuery
(
apiName
).
insert
(
beanJson
,
request
);
return
container
.
getCommonQuery
(
apiName
).
insert
(
beanJson
,
request
);
}
}
return
0
;
return
0
;
...
@@ -94,7 +94,8 @@ public class CommonQueryManager {
...
@@ -94,7 +94,8 @@ public class CommonQueryManager {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@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
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
"更新,id:"
+
id
,
request
);
logService
.
insertLog
(
apiName
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
id
).
toString
(),
request
);
return
container
.
getCommonQuery
(
apiName
).
update
(
beanJson
,
id
);
return
container
.
getCommonQuery
(
apiName
).
update
(
beanJson
,
id
);
}
}
return
0
;
return
0
;
...
@@ -109,7 +110,8 @@ public class CommonQueryManager {
...
@@ -109,7 +110,8 @@ public class CommonQueryManager {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
delete
(
String
apiName
,
Long
id
,
HttpServletRequest
request
)
{
public
int
delete
(
String
apiName
,
Long
id
,
HttpServletRequest
request
)
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
logService
.
insertLog
(
apiName
,
"删除,id:"
+
id
,
request
);
logService
.
insertLog
(
apiName
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
id
).
toString
(),
request
);
return
container
.
getCommonQuery
(
apiName
).
delete
(
id
);
return
container
.
getCommonQuery
(
apiName
).
delete
(
id
);
}
}
return
0
;
return
0
;
...
...
src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
7e20ea9c
...
@@ -309,7 +309,8 @@ public class AccountService {
...
@@ -309,7 +309,8 @@ public class AccountService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAmountIsDefault
(
Boolean
isDefault
,
Long
accountId
)
{
public
int
updateAmountIsDefault
(
Boolean
isDefault
,
Long
accountId
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT
,
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
+
accountId
,((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT
,
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
+
accountId
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
Account
account
=
new
Account
();
Account
account
=
new
Account
();
account
.
setIsdefault
(
isDefault
);
account
.
setIsdefault
(
isDefault
);
AccountExample
example
=
new
AccountExample
();
AccountExample
example
=
new
AccountExample
();
...
...
src/main/java/com/jsh/erp/service/accountItem/AccountItemService.java
View file @
7e20ea9c
...
@@ -2,11 +2,13 @@ package com.jsh.erp.service.accountItem;
...
@@ -2,11 +2,13 @@ package com.jsh.erp.service.accountItem;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItem
;
import
com.jsh.erp.datasource.entities.AccountItemExample
;
import
com.jsh.erp.datasource.entities.AccountItemExample
;
import
com.jsh.erp.datasource.mappers.AccountItemMapper
;
import
com.jsh.erp.datasource.mappers.AccountItemMapper
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
import
com.jsh.erp.datasource.mappers.AccountItemMapperEx
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.datasource.vo.AccountItemVo4List
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.ErpInfo
;
import
com.jsh.erp.utils.ErpInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -14,6 +16,8 @@ import org.slf4j.LoggerFactory;
...
@@ -14,6 +16,8 @@ import org.slf4j.LoggerFactory;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -31,6 +35,8 @@ public class AccountItemService {
...
@@ -31,6 +35,8 @@ public class AccountItemService {
@Resource
@Resource
private
AccountItemMapperEx
accountItemMapperEx
;
private
AccountItemMapperEx
accountItemMapperEx
;
@Resource
private
LogService
logService
;
public
AccountItem
getAccountItem
(
long
id
)
{
public
AccountItem
getAccountItem
(
long
id
)
{
return
accountItemMapper
.
selectByPrimaryKey
(
id
);
return
accountItemMapper
.
selectByPrimaryKey
(
id
);
...
@@ -97,7 +103,10 @@ public class AccountItemService {
...
@@ -97,7 +103,10 @@ public class AccountItemService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
,
String
listType
)
throws
DataAccessException
{
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
,
String
listType
)
throws
DataAccessException
{
//转为json
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ACCOUNT_ITEM
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
",headerId:"
).
append
(
headerId
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//转为json
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
insertedJson
=
JSONArray
.
parseArray
(
inserted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
JSONArray
deletedJson
=
JSONArray
.
parseArray
(
deleted
);
JSONArray
updatedJson
=
JSONArray
.
parseArray
(
updated
);
JSONArray
updatedJson
=
JSONArray
.
parseArray
(
updated
);
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
7e20ea9c
...
@@ -14,6 +14,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
...
@@ -14,6 +14,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
import
com.jsh.erp.datasource.vo.DepotHeadVo4List
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4List
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount
;
import
com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount
;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.supplier.SupplierService
;
import
com.jsh.erp.service.supplier.SupplierService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
...
@@ -22,6 +23,8 @@ import org.slf4j.Logger;
...
@@ -22,6 +23,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -51,6 +54,8 @@ public class DepotHeadService {
...
@@ -51,6 +54,8 @@ public class DepotHeadService {
private
SerialNumberService
serialNumberService
;
private
SerialNumberService
serialNumberService
;
@Resource
@Resource
DepotItemMapperEx
depotItemMapperEx
;
DepotItemMapperEx
depotItemMapperEx
;
@Resource
private
LogService
logService
;
public
DepotHead
getDepotHead
(
long
id
)
{
public
DepotHead
getDepotHead
(
long
id
)
{
...
@@ -143,6 +148,9 @@ public class DepotHeadService {
...
@@ -143,6 +148,9 @@ public class DepotHeadService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetStatus
(
String
status
,
String
depotHeadIDs
)
{
public
int
batchSetStatus
(
String
status
,
String
depotHeadIDs
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
depotHeadIDs
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
depotHeadIDs
);
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
depotHeadIDs
);
DepotHead
depotHead
=
new
DepotHead
();
DepotHead
depotHead
=
new
DepotHead
();
depotHead
.
setStatus
(
status
);
depotHead
.
setStatus
(
status
);
...
@@ -269,6 +277,9 @@ public class DepotHeadService {
...
@@ -269,6 +277,9 @@ public class DepotHeadService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
addDepotHeadAndDetail
(
String
beanJson
,
String
inserted
,
String
deleted
,
String
updated
)
throws
Exception
{
public
void
addDepotHeadAndDetail
(
String
beanJson
,
String
inserted
,
String
deleted
,
String
updated
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_HEAD
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
/**处理单据主表数据*/
/**处理单据主表数据*/
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
//判断用户是否已经登录过,登录过不再处理
//判断用户是否已经登录过,登录过不再处理
...
@@ -309,6 +320,9 @@ public class DepotHeadService {
...
@@ -309,6 +320,9 @@ public class DepotHeadService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateDepotHeadAndDetail
(
Long
id
,
String
beanJson
,
String
inserted
,
String
deleted
,
String
updated
,
BigDecimal
preTotalPrice
)
throws
Exception
{
public
void
updateDepotHeadAndDetail
(
Long
id
,
String
beanJson
,
String
inserted
,
String
deleted
,
String
updated
,
BigDecimal
preTotalPrice
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
id
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
/**更新单据主表信息*/
/**更新单据主表信息*/
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
DepotHead
depotHead
=
JSONObject
.
parseObject
(
beanJson
,
DepotHead
.
class
);
//判断用户是否已经登录过,登录过不再处理
//判断用户是否已经登录过,登录过不再处理
...
@@ -337,6 +351,9 @@ public class DepotHeadService {
...
@@ -337,6 +351,9 @@ public class DepotHeadService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
deleteDepotHeadAndDetail
(
Long
id
)
throws
Exception
{
public
void
deleteDepotHeadAndDetail
(
Long
id
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
id
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//查询单据主表信息
//查询单据主表信息
DepotHead
depotHead
=
getDepotHead
(
id
);
DepotHead
depotHead
=
getDepotHead
(
id
);
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
...
@@ -368,6 +385,9 @@ public class DepotHeadService {
...
@@ -368,6 +385,9 @@ public class DepotHeadService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
batchDeleteDepotHeadAndDetail
(
String
ids
)
throws
Exception
{
public
void
batchDeleteDepotHeadAndDetail
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_HEAD
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
StringUtil
.
isNotEmpty
(
ids
)){
if
(
StringUtil
.
isNotEmpty
(
ids
)){
String
[]
headIds
=
ids
.
split
(
","
);
String
[]
headIds
=
ids
.
split
(
","
);
for
(
int
i
=
0
;
i
<
headIds
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
headIds
.
length
;
i
++){
...
...
src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
7e20ea9c
...
@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotItemMapper;
...
@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotItemMapper;
import
com.jsh.erp.datasource.mappers.DepotItemMapperEx
;
import
com.jsh.erp.datasource.mappers.DepotItemMapperEx
;
import
com.jsh.erp.datasource.mappers.SerialNumberMapperEx
;
import
com.jsh.erp.datasource.mappers.SerialNumberMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
...
@@ -21,6 +22,8 @@ import org.slf4j.LoggerFactory;
...
@@ -21,6 +22,8 @@ import org.slf4j.LoggerFactory;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -54,6 +57,8 @@ public class DepotItemService {
...
@@ -54,6 +57,8 @@ public class DepotItemService {
SerialNumberService
serialNumberService
;
SerialNumberService
serialNumberService
;
@Resource
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
DepotItem
getDepotItem
(
long
id
)
{
public
DepotItem
getDepotItem
(
long
id
)
{
return
depotItemMapper
.
selectByPrimaryKey
(
id
);
return
depotItemMapper
.
selectByPrimaryKey
(
id
);
...
@@ -224,6 +229,10 @@ public class DepotItemService {
...
@@ -224,6 +229,10 @@ public class DepotItemService {
* */
* */
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
)
throws
Exception
{
public
String
saveDetials
(
String
inserted
,
String
deleted
,
String
updated
,
Long
headerId
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_DEPOT_ITEM
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//查询单据主表信息
//查询单据主表信息
DepotHead
depotHead
=
depotHeadMapper
.
selectByPrimaryKey
(
headerId
);
DepotHead
depotHead
=
depotHeadMapper
.
selectByPrimaryKey
(
headerId
);
//获得当前操作人
//获得当前操作人
...
...
src/main/java/com/jsh/erp/service/log/LogService.java
View file @
7e20ea9c
...
@@ -138,6 +138,8 @@ public class LogService {
...
@@ -138,6 +138,8 @@ public class LogService {
moduleName
=
BusinessConstants
.
LOG_MODULE_NAME_ACCOUNT_ITEM
;
break
;
moduleName
=
BusinessConstants
.
LOG_MODULE_NAME_ACCOUNT_ITEM
;
break
;
case
BusinessConstants
.
LOG_INTERFACE_NAME_SERIAL_NUMBER
:
case
BusinessConstants
.
LOG_INTERFACE_NAME_SERIAL_NUMBER
:
moduleName
=
BusinessConstants
.
LOG_MODULE_NAME_SERIAL_NUMBER
;
break
;
moduleName
=
BusinessConstants
.
LOG_MODULE_NAME_SERIAL_NUMBER
;
break
;
case
BusinessConstants
.
LOG_INTERFACE_NAME_ORGANIZATION
:
moduleName
=
BusinessConstants
.
LOG_MODULE_NAME_ORGANIZATION
;
break
;
}
}
return
moduleName
;
return
moduleName
;
}
}
...
...
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
7e20ea9c
package
com.jsh.erp.service.material
;
package
com.jsh.erp.service.material
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.DepotEx
;
import
com.jsh.erp.datasource.entities.DepotEx
;
import
com.jsh.erp.datasource.entities.Material
;
import
com.jsh.erp.datasource.entities.Material
;
import
com.jsh.erp.datasource.entities.MaterialExample
;
import
com.jsh.erp.datasource.entities.MaterialExample
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
com.jsh.erp.datasource.mappers.MaterialMapper
;
import
com.jsh.erp.datasource.mappers.MaterialMapper
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -29,6 +33,8 @@ public class MaterialService {
...
@@ -29,6 +33,8 @@ public class MaterialService {
private
MaterialMapper
materialMapper
;
private
MaterialMapper
materialMapper
;
@Resource
@Resource
private
MaterialMapperEx
materialMapperEx
;
private
MaterialMapperEx
materialMapperEx
;
@Resource
private
LogService
logService
;
public
Material
getMaterial
(
long
id
)
{
public
Material
getMaterial
(
long
id
)
{
return
materialMapper
.
selectByPrimaryKey
(
id
);
return
materialMapper
.
selectByPrimaryKey
(
id
);
...
@@ -141,6 +147,9 @@ public class MaterialService {
...
@@ -141,6 +147,9 @@ public class MaterialService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetEnable
(
Boolean
enabled
,
String
materialIDs
)
{
public
int
batchSetEnable
(
Boolean
enabled
,
String
materialIDs
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
materialIDs
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
materialIDs
);
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
materialIDs
);
Material
material
=
new
Material
();
Material
material
=
new
Material
();
material
.
setEnabled
(
enabled
);
material
.
setEnabled
(
enabled
);
...
@@ -177,8 +186,11 @@ public class MaterialService {
...
@@ -177,8 +186,11 @@ public class MaterialService {
}
}
return
resList
;
return
resList
;
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
BaseResponseInfo
importExcel
(
List
<
Material
>
mList
)
throws
Exception
{
public
BaseResponseInfo
importExcel
(
List
<
Material
>
mList
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_IMPORT
).
append
(
mList
.
size
()).
append
(
BusinessConstants
.
LOG_DATA_UNIT
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
BaseResponseInfo
info
=
new
BaseResponseInfo
();
BaseResponseInfo
info
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
try
{
try
{
...
...
src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
View file @
7e20ea9c
...
@@ -10,12 +10,15 @@ import com.jsh.erp.datasource.mappers.MaterialCategoryMapper;
...
@@ -10,12 +10,15 @@ import com.jsh.erp.datasource.mappers.MaterialCategoryMapper;
import
com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx
;
import
com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
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.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -32,6 +35,8 @@ public class MaterialCategoryService {
...
@@ -32,6 +35,8 @@ public class MaterialCategoryService {
private
MaterialCategoryMapperEx
materialCategoryMapperEx
;
private
MaterialCategoryMapperEx
materialCategoryMapperEx
;
@Resource
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
private
LogService
logService
;
public
MaterialCategory
getMaterialCategory
(
long
id
)
{
public
MaterialCategory
getMaterialCategory
(
long
id
)
{
return
materialCategoryMapper
.
selectByPrimaryKey
(
id
);
return
materialCategoryMapper
.
selectByPrimaryKey
(
id
);
...
@@ -113,6 +118,9 @@ public class MaterialCategoryService {
...
@@ -113,6 +118,9 @@ public class MaterialCategoryService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
addMaterialCategory
(
MaterialCategory
mc
)
throws
Exception
{
public
int
addMaterialCategory
(
MaterialCategory
mc
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL_CATEGORY
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
mc
==
null
){
if
(
mc
==
null
){
return
0
;
return
0
;
}
}
...
@@ -138,7 +146,9 @@ public class MaterialCategoryService {
...
@@ -138,7 +146,9 @@ public class MaterialCategoryService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteMaterialCategoryByIds
(
String
ids
)
throws
Exception
{
public
int
batchDeleteMaterialCategoryByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL_CATEGORY
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//更新时间
//更新时间
Date
updateDate
=
new
Date
();
Date
updateDate
=
new
Date
();
//更新人
//更新人
...
@@ -153,6 +163,9 @@ public class MaterialCategoryService {
...
@@ -153,6 +163,9 @@ public class MaterialCategoryService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
editMaterialCategory
(
MaterialCategory
mc
)
{
public
int
editMaterialCategory
(
MaterialCategory
mc
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_MATERIAL_CATEGORY
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
mc
.
getId
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
mc
.
getParentid
()==
null
){
if
(
mc
.
getParentid
()==
null
){
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
mc
.
setParentid
(
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_PARENT_ID
);
mc
.
setParentid
(
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_PARENT_ID
);
...
...
src/main/java/com/jsh/erp/service/organization/OrganizationService.java
View file @
7e20ea9c
...
@@ -10,12 +10,15 @@ import com.jsh.erp.datasource.mappers.OrganizationMapper;
...
@@ -10,12 +10,15 @@ import com.jsh.erp.datasource.mappers.OrganizationMapper;
import
com.jsh.erp.datasource.mappers.OrganizationMapperEx
;
import
com.jsh.erp.datasource.mappers.OrganizationMapperEx
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
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.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -38,6 +41,8 @@ public class OrganizationService {
...
@@ -38,6 +41,8 @@ public class OrganizationService {
private
OrganizationMapperEx
organizationMapperEx
;
private
OrganizationMapperEx
organizationMapperEx
;
@Resource
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
private
LogService
logService
;
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertOrganization
(
String
beanJson
,
HttpServletRequest
request
)
{
public
int
insertOrganization
(
String
beanJson
,
HttpServletRequest
request
)
{
Organization
organization
=
JSONObject
.
parseObject
(
beanJson
,
Organization
.
class
);
Organization
organization
=
JSONObject
.
parseObject
(
beanJson
,
Organization
.
class
);
...
@@ -62,6 +67,9 @@ public class OrganizationService {
...
@@ -62,6 +67,9 @@ public class OrganizationService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
addOrganization
(
Organization
org
)
throws
Exception
{
public
int
addOrganization
(
Organization
org
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ORGANIZATION
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//新增时间
//新增时间
Date
date
=
new
Date
();
Date
date
=
new
Date
();
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
...
@@ -88,6 +96,9 @@ public class OrganizationService {
...
@@ -88,6 +96,9 @@ public class OrganizationService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
editOrganization
(
Organization
org
)
throws
Exception
{
public
int
editOrganization
(
Organization
org
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ORGANIZATION
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
org
.
getId
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//修改时间
//修改时间
org
.
setUpdateTime
(
new
Date
());
org
.
setUpdateTime
(
new
Date
());
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
...
@@ -161,6 +172,9 @@ public class OrganizationService {
...
@@ -161,6 +172,9 @@ public class OrganizationService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteOrganizationByIds
(
String
ids
)
throws
Exception
{
public
int
batchDeleteOrganizationByIds
(
String
ids
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_ORGANIZATION
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
String
[]
idArray
=
ids
.
split
(
","
);
return
organizationMapperEx
.
batchDeleteOrganizationByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
return
organizationMapperEx
.
batchDeleteOrganizationByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
...
...
src/main/java/com/jsh/erp/service/serialNumber/SerialNumberService.java
View file @
7e20ea9c
...
@@ -43,12 +43,8 @@ public class SerialNumberService {
...
@@ -43,12 +43,8 @@ public class SerialNumberService {
@Resource
@Resource
private
MaterialMapper
materialMapper
;
private
MaterialMapper
materialMapper
;
@Resource
@Resource
private
DepotItemService
depotItemService
;
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
@Resource
private
DepotItemMapperEx
depotItemMapperEx
;
@Resource
private
LogService
logService
;
private
LogService
logService
;
...
@@ -174,7 +170,8 @@ public class SerialNumberService {
...
@@ -174,7 +170,8 @@ public class SerialNumberService {
* */
* */
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
SerialNumberEx
addSerialNumber
(
SerialNumberEx
serialNumberEx
)
{
public
SerialNumberEx
addSerialNumber
(
SerialNumberEx
serialNumberEx
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SERIAL_NUMBER
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SERIAL_NUMBER
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
serialNumberEx
==
null
){
if
(
serialNumberEx
==
null
){
return
null
;
return
null
;
}
}
...
@@ -198,6 +195,9 @@ public class SerialNumberService {
...
@@ -198,6 +195,9 @@ public class SerialNumberService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
SerialNumberEx
updateSerialNumber
(
SerialNumberEx
serialNumberEx
)
{
public
SerialNumberEx
updateSerialNumber
(
SerialNumberEx
serialNumberEx
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SERIAL_NUMBER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
serialNumberEx
.
getId
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
serialNumberEx
==
null
){
if
(
serialNumberEx
==
null
){
return
null
;
return
null
;
}
}
...
@@ -352,6 +352,9 @@ public class SerialNumberService {
...
@@ -352,6 +352,9 @@ public class SerialNumberService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
batAddSerialNumber
(
String
materialName
,
String
serialNumberPrefix
,
Integer
batAddTotal
,
String
remark
)
{
public
void
batAddSerialNumber
(
String
materialName
,
String
serialNumberPrefix
,
Integer
batAddTotal
,
String
remark
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SERIAL_NUMBER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_BATCH_ADD
).
append
(
batAddTotal
).
append
(
BusinessConstants
.
LOG_DATA_UNIT
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
if
(
StringUtil
.
isNotEmpty
(
materialName
)){
if
(
StringUtil
.
isNotEmpty
(
materialName
)){
//查询商品id
//查询商品id
Long
materialId
=
checkMaterialName
(
materialName
);
Long
materialId
=
checkMaterialName
(
materialName
);
...
...
src/main/java/com/jsh/erp/service/supplier/SupplierService.java
View file @
7e20ea9c
package
com.jsh.erp.service.supplier
;
package
com.jsh.erp.service.supplier
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Supplier
;
import
com.jsh.erp.datasource.entities.Supplier
;
import
com.jsh.erp.datasource.entities.SupplierExample
;
import
com.jsh.erp.datasource.entities.SupplierExample
;
import
com.jsh.erp.datasource.mappers.SupplierMapper
;
import
com.jsh.erp.datasource.mappers.SupplierMapper
;
import
com.jsh.erp.datasource.mappers.SupplierMapperEx
;
import
com.jsh.erp.datasource.mappers.SupplierMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -28,6 +32,8 @@ public class SupplierService {
...
@@ -28,6 +32,8 @@ public class SupplierService {
@Resource
@Resource
private
SupplierMapperEx
supplierMapperEx
;
private
SupplierMapperEx
supplierMapperEx
;
@Resource
private
LogService
logService
;
public
Supplier
getSupplier
(
long
id
)
{
public
Supplier
getSupplier
(
long
id
)
{
return
supplierMapper
.
selectByPrimaryKey
(
id
);
return
supplierMapper
.
selectByPrimaryKey
(
id
);
...
@@ -81,6 +87,9 @@ public class SupplierService {
...
@@ -81,6 +87,9 @@ public class SupplierService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateAdvanceIn
(
Long
supplierId
,
BigDecimal
advanceIn
){
public
int
updateAdvanceIn
(
Long
supplierId
,
BigDecimal
advanceIn
){
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SUPPLIER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
supplierId
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
Supplier
supplier
=
supplierMapper
.
selectByPrimaryKey
(
supplierId
);
Supplier
supplier
=
supplierMapper
.
selectByPrimaryKey
(
supplierId
);
if
(
supplier
!=
null
){
if
(
supplier
!=
null
){
supplier
.
setAdvancein
(
supplier
.
getAdvancein
().
add
(
advanceIn
));
//增加预收款的金额,可能增加的是负值
supplier
.
setAdvancein
(
supplier
.
getAdvancein
().
add
(
advanceIn
));
//增加预收款的金额,可能增加的是负值
...
@@ -121,6 +130,9 @@ public class SupplierService {
...
@@ -121,6 +130,9 @@ public class SupplierService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchSetEnable
(
Boolean
enabled
,
String
supplierIDs
)
{
public
int
batchSetEnable
(
Boolean
enabled
,
String
supplierIDs
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SUPPLIER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
supplierIDs
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
supplierIDs
);
List
<
Long
>
ids
=
StringUtil
.
strToLongList
(
supplierIDs
);
Supplier
supplier
=
new
Supplier
();
Supplier
supplier
=
new
Supplier
();
supplier
.
setEnabled
(
enabled
);
supplier
.
setEnabled
(
enabled
);
...
@@ -140,8 +152,11 @@ public class SupplierService {
...
@@ -140,8 +152,11 @@ public class SupplierService {
public
List
<
Supplier
>
findByAll
(
String
supplier
,
String
type
,
String
phonenum
,
String
telephone
,
String
description
)
{
public
List
<
Supplier
>
findByAll
(
String
supplier
,
String
type
,
String
phonenum
,
String
telephone
,
String
description
)
{
return
supplierMapperEx
.
findByAll
(
supplier
,
type
,
phonenum
,
telephone
,
description
);
return
supplierMapperEx
.
findByAll
(
supplier
,
type
,
phonenum
,
telephone
,
description
);
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
BaseResponseInfo
importExcel
(
List
<
Supplier
>
mList
)
throws
Exception
{
public
BaseResponseInfo
importExcel
(
List
<
Supplier
>
mList
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_SUPPLIER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_IMPORT
).
append
(
mList
.
size
()).
append
(
BusinessConstants
.
LOG_DATA_UNIT
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
BaseResponseInfo
info
=
new
BaseResponseInfo
();
BaseResponseInfo
info
=
new
BaseResponseInfo
();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
try
{
try
{
...
...
src/main/java/com/jsh/erp/service/user/UserService.java
View file @
7e20ea9c
...
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.mappers.UserMapperEx;
...
@@ -13,6 +13,7 @@ import com.jsh.erp.datasource.mappers.UserMapperEx;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNodeEx
;
import
com.jsh.erp.datasource.vo.TreeNodeEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.utils.ExceptionCodeConstants
;
import
com.jsh.erp.utils.ExceptionCodeConstants
;
import
com.jsh.erp.utils.JshException
;
import
com.jsh.erp.utils.JshException
;
...
@@ -44,6 +45,8 @@ public class UserService {
...
@@ -44,6 +45,8 @@ public class UserService {
private
UserMapperEx
userMapperEx
;
private
UserMapperEx
userMapperEx
;
@Resource
@Resource
private
OrgaUserRelService
orgaUserRelService
;
private
OrgaUserRelService
orgaUserRelService
;
@Resource
private
LogService
logService
;
public
User
getUser
(
long
id
)
{
public
User
getUser
(
long
id
)
{
return
userMapper
.
selectByPrimaryKey
(
id
);
return
userMapper
.
selectByPrimaryKey
(
id
);
...
@@ -109,6 +112,9 @@ public class UserService {
...
@@ -109,6 +112,9 @@ public class UserService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateUserByObj
(
User
user
)
{
public
int
updateUserByObj
(
User
user
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_MODULE_NAME_USER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
user
.
getId
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
return
userMapper
.
updateByPrimaryKeySelective
(
user
);
return
userMapper
.
updateByPrimaryKeySelective
(
user
);
}
}
/**
/**
...
@@ -122,6 +128,9 @@ public class UserService {
...
@@ -122,6 +128,9 @@ public class UserService {
*/
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
resetPwd
(
String
md5Pwd
,
Long
id
)
{
public
int
resetPwd
(
String
md5Pwd
,
Long
id
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_MODULE_NAME_USER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
id
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
user
=
new
User
();
User
user
=
new
User
();
user
.
setId
(
id
);
user
.
setId
(
id
);
user
.
setPassword
(
md5Pwd
);
user
.
setPassword
(
md5Pwd
);
...
@@ -208,6 +217,9 @@ public class UserService {
...
@@ -208,6 +217,9 @@ public class UserService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
addUserAndOrgUserRel
(
UserEx
ue
)
throws
Exception
{
public
void
addUserAndOrgUserRel
(
UserEx
ue
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_MODULE_NAME_USER
,
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
,
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//检查用户名和登录名
//检查用户名和登录名
checkUserNameAndLoginName
(
ue
);
checkUserNameAndLoginName
(
ue
);
//新增用户信息
//新增用户信息
...
@@ -262,6 +274,9 @@ public class UserService {
...
@@ -262,6 +274,9 @@ public class UserService {
}
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
updateUserAndOrgUserRel
(
UserEx
ue
)
throws
Exception
{
public
void
updateUserAndOrgUserRel
(
UserEx
ue
)
throws
Exception
{
logService
.
insertLog
(
BusinessConstants
.
LOG_MODULE_NAME_USER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
ue
.
getId
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
//检查用户名和登录名
//检查用户名和登录名
checkUserNameAndLoginName
(
ue
);
checkUserNameAndLoginName
(
ue
);
//更新用户信息
//更新用户信息
...
@@ -390,6 +405,9 @@ public class UserService {
...
@@ -390,6 +405,9 @@ public class UserService {
* */
* */
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
batDeleteUser
(
String
ids
)
{
public
void
batDeleteUser
(
String
ids
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_MODULE_NAME_USER
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_DELETE
).
append
(
ids
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
String
idsArray
[]=
ids
.
split
(
","
);
String
idsArray
[]=
ids
.
split
(
","
);
int
i
=
userMapperEx
.
batDeleteOrUpdateUser
(
idsArray
,
BusinessConstants
.
USER_STATUS_DELETE
);
int
i
=
userMapperEx
.
batDeleteOrUpdateUser
(
idsArray
,
BusinessConstants
.
USER_STATUS_DELETE
);
if
(
i
<
1
){
if
(
i
<
1
){
...
...
src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java
View file @
7e20ea9c
package
com.jsh.erp.service.userBusiness
;
package
com.jsh.erp.service.userBusiness
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.entities.UserBusinessExample
;
import
com.jsh.erp.datasource.entities.UserBusinessExample
;
import
com.jsh.erp.datasource.mappers.UserBusinessMapper
;
import
com.jsh.erp.datasource.mappers.UserBusinessMapper
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -20,6 +24,8 @@ public class UserBusinessService {
...
@@ -20,6 +24,8 @@ public class UserBusinessService {
@Resource
@Resource
private
UserBusinessMapper
userBusinessMapper
;
private
UserBusinessMapper
userBusinessMapper
;
@Resource
private
LogService
logService
;
public
UserBusiness
getUserBusiness
(
long
id
)
{
public
UserBusiness
getUserBusiness
(
long
id
)
{
return
userBusinessMapper
.
selectByPrimaryKey
(
id
);
return
userBusinessMapper
.
selectByPrimaryKey
(
id
);
...
@@ -96,6 +102,9 @@ public class UserBusinessService {
...
@@ -96,6 +102,9 @@ public class UserBusinessService {
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateBtnStr
(
Long
userBusinessId
,
String
btnStr
)
{
public
int
updateBtnStr
(
Long
userBusinessId
,
String
btnStr
)
{
logService
.
insertLog
(
BusinessConstants
.
LOG_INTERFACE_NAME_USER_BUSINESS
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
userBusinessId
).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
UserBusiness
userBusiness
=
new
UserBusiness
();
UserBusiness
userBusiness
=
new
UserBusiness
();
userBusiness
.
setBtnstr
(
btnStr
);
userBusiness
.
setBtnstr
(
btnStr
);
UserBusinessExample
example
=
new
UserBusinessExample
();
UserBusinessExample
example
=
new
UserBusinessExample
();
...
...
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