优化日志的记录

This commit is contained in:
季圣华
2019-11-19 20:35:26 +08:00
parent 47c90a0e26
commit b186ae1636
53 changed files with 415 additions and 386 deletions

View File

@@ -54,18 +54,18 @@ public class AccountHeadComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return accountHeadService.updateAccountHead(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return accountHeadService.updateAccountHead(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return accountHeadService.deleteAccountHead(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return accountHeadService.deleteAccountHead(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return accountHeadService.batchDeleteAccountHead(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return accountHeadService.batchDeleteAccountHead(ids, request);
}
@Override

View File

@@ -102,6 +102,7 @@ public class AccountHeadService {
int result=0;
try{
result = accountHeadMapper.insertSelective(accountHead);
logService.insertLog("财务", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -109,12 +110,14 @@ public class AccountHeadService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAccountHead(String beanJson, Long id)throws Exception {
public int updateAccountHead(String beanJson, Long id, HttpServletRequest request)throws Exception {
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
accountHead.setId(id);
int result=0;
try{
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
logService.insertLog("财务",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -122,10 +125,12 @@ public class AccountHeadService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteAccountHead(Long id)throws Exception {
public int deleteAccountHead(Long id, HttpServletRequest request)throws Exception {
int result=0;
try{
result = accountHeadMapper.deleteByPrimaryKey(id);
logService.insertLog("财务",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -133,13 +138,14 @@ public class AccountHeadService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountHead(String ids)throws Exception {
public int batchDeleteAccountHead(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
AccountHeadExample example = new AccountHeadExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result = accountHeadMapper.deleteByExample(example);
logService.insertLog("财务", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -257,7 +263,7 @@ public class AccountHeadService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountHeadByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD,
logService.insertLog("财务",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();