优化日志的记录

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

@@ -52,18 +52,18 @@ public class DepotComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return depotService.updateDepot(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return depotService.updateDepot(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return depotService.deleteDepot(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return depotService.deleteDepot(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return depotService.batchDeleteDepot(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return depotService.batchDeleteDepot(ids, request);
}
@Override

View File

@@ -103,6 +103,7 @@ public class DepotService {
int result=0;
try{
result=depotMapper.insertSelective(depot);
logService.insertLog("仓库", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -110,12 +111,14 @@ public class DepotService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateDepot(String beanJson, Long id) throws Exception{
public int updateDepot(String beanJson, Long id, HttpServletRequest request) throws Exception{
Depot depot = JSONObject.parseObject(beanJson, Depot.class);
depot.setId(id);
int result=0;
try{
result= depotMapper.updateByPrimaryKeySelective(depot);
logService.insertLog("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -123,10 +126,12 @@ public class DepotService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteDepot(Long id)throws Exception {
public int deleteDepot(Long id, HttpServletRequest request)throws Exception {
int result=0;
try{
result= depotMapper.deleteByPrimaryKey(id);
logService.insertLog("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -134,13 +139,14 @@ public class DepotService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepot(String ids) throws Exception{
public int batchDeleteDepot(String ids, HttpServletRequest request) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids);
DepotExample example = new DepotExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result= depotMapper.deleteByExample(example);
logService.insertLog("仓库", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
@@ -196,7 +202,7 @@ public class DepotService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,
logService.insertLog("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
@@ -272,7 +278,7 @@ public class DepotService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateDepotIsDefault(Boolean isDefault, Long depotID) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotID,
logService.insertLog("仓库",BusinessConstants.LOG_OPERATION_TYPE_EDIT+depotID,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
Depot depot = new Depot();
depot.setIsDefault(isDefault);