Commit b186ae16 authored by 季圣华's avatar 季圣华
Browse files

优化日志的记录

parent 47c90a0e
...@@ -151,55 +151,6 @@ public class BusinessConstants { ...@@ -151,55 +151,6 @@ public class BusinessConstants {
* 条 * 条
* */ * */
public static final String LOG_DATA_UNIT = "条"; public static final String LOG_DATA_UNIT = "条";
/**
* 模块中文名称
* 模块对应的标识
* */
public static final String LOG_MODULE_NAME_USER= "用户";
public static final String LOG_INTERFACE_NAME_USER= "user";
public static final String LOG_MODULE_NAME_ROLE= "角色";
public static final String LOG_INTERFACE_NAME_ROLE= "role";
public static final String LOG_MODULE_NAME_APP= "应用";
public static final String LOG_INTERFACE_NAME_APP= "app";
public static final String LOG_MODULE_NAME_DEPOT= "仓库";
public static final String LOG_INTERFACE_NAME_DEPOT= "depot";
public static final String LOG_MODULE_NAME_FUNCTIONS= "功能";
public static final String LOG_INTERFACE_NAME_FUNCTIONS= "functions";
public static final String LOG_MODULE_NAME_IN_OUT_ITEM= "收支项目";
public static final String LOG_INTERFACE_NAME_IN_OUT_ITEM= "inOutItem";
public static final String LOG_MODULE_NAME_UNIT= "计量单位";
public static final String LOG_INTERFACE_NAME_UNIT= "unit";
public static final String LOG_MODULE_NAME_PERSON= "经手人";
public static final String LOG_INTERFACE_NAME_PERSON= "person";
public static final String LOG_MODULE_NAME_USER_BUSINESS= "关联关系";
public static final String LOG_INTERFACE_NAME_USER_BUSINESS= "userBusiness";
public static final String LOG_MODULE_NAME_SYSTEM_CONFIG= "系统配置";
public static final String LOG_INTERFACE_NAME_SYSTEM_CONFIG= "systemConfig";
public static final String LOG_MODULE_NAME_MATERIAL_PROPERTY= "商品属性";
public static final String LOG_INTERFACE_NAME_MATERIAL_PROPERTY= "materialProperty";
public static final String LOG_MODULE_NAME_ACCOUNT= "账户";
public static final String LOG_INTERFACE_NAME_ACCOUNT= "account";
public static final String LOG_MODULE_NAME_SUPPLIER= "商家";
public static final String LOG_INTERFACE_NAME_SUPPLIER= "supplier";
public static final String LOG_MODULE_NAME_MATERIAL_CATEGORY= "商品类型";
public static final String LOG_INTERFACE_NAME_MATERIAL_CATEGORY= "materialCategory";
public static final String LOG_MODULE_NAME_MATERIAL= "商品";
public static final String LOG_INTERFACE_NAME_MATERIAL= "material";
public static final String LOG_MODULE_NAME_DEPOT_HEAD= "单据";
public static final String LOG_INTERFACE_NAME_DEPOT_HEAD= "depotHead";
public static final String LOG_MODULE_NAME_DEPOT_ITEM= "单据明细";
public static final String LOG_INTERFACE_NAME_DEPOT_ITEM= "depotItem";
public static final String LOG_MODULE_NAME_ACCOUNT_HEAD= "财务";
public static final String LOG_INTERFACE_NAME_ACCOUNT_HEAD= "accountHead";
public static final String LOG_MODULE_NAME_ACCOUNT_ITEM= "财务明细";
public static final String LOG_INTERFACE_NAME_ACCOUNT_ITEM= "accountItem";
public static final String LOG_MODULE_NAME_SERIAL_NUMBER= "序列号";
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";
public static final String TYPE_NAME_ROLE_APP = "RoleAPP";
public static final String TYPE_NAME_ROLE_FUNCTIONS = "RoleFunctions";
/** /**
* 删除类型 * 删除类型
......
...@@ -404,7 +404,7 @@ public class DepotHeadController { ...@@ -404,7 +404,7 @@ public class DepotHeadController {
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE, throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG); ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
} else { } else {
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId); depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId, request);
} }
return result; return result;
} }
...@@ -431,7 +431,7 @@ public class DepotHeadController { ...@@ -431,7 +431,7 @@ public class DepotHeadController {
HttpServletRequest request) throws Exception{ HttpServletRequest request) throws Exception{
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString()); Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
depotHeadService.updateDepotHeadAndDetail(id,beanJson,inserted,deleted,updated,preTotalPrice,tenantId); depotHeadService.updateDepotHeadAndDetail(id,beanJson,inserted,deleted,updated,preTotalPrice,tenantId,request);
return result; return result;
} }
/** /**
......
...@@ -120,7 +120,7 @@ public class UserController { ...@@ -120,7 +120,7 @@ public class UserController {
} }
} }
} }
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
} catch (Exception e) { } catch (Exception e) {
......
...@@ -72,7 +72,6 @@ public class CommonQueryManager { ...@@ -72,7 +72,6 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insert(String apiName, String beanJson, HttpServletRequest request) throws Exception{ public int insert(String apiName, String beanJson, HttpServletRequest request) throws Exception{
if (StringUtil.isNotEmpty(apiName)) { if (StringUtil.isNotEmpty(apiName)) {
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;
...@@ -88,9 +87,7 @@ public class CommonQueryManager { ...@@ -88,9 +87,7 @@ 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)throws Exception { public int update(String apiName, String beanJson, Long id, HttpServletRequest request)throws Exception {
if (StringUtil.isNotEmpty(apiName)) { if (StringUtil.isNotEmpty(apiName)) {
logService.insertLog(apiName, return container.getCommonQuery(apiName).update(beanJson, id, request);
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
return container.getCommonQuery(apiName).update(beanJson, id);
} }
return 0; return 0;
} }
...@@ -104,9 +101,7 @@ public class CommonQueryManager { ...@@ -104,9 +101,7 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int delete(String apiName, Long id, HttpServletRequest request)throws Exception { public int delete(String apiName, Long id, HttpServletRequest request)throws Exception {
if (StringUtil.isNotEmpty(apiName)) { if (StringUtil.isNotEmpty(apiName)) {
logService.insertLog(apiName, return container.getCommonQuery(apiName).delete(id, request);
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
return container.getCommonQuery(apiName).delete(id);
} }
return 0; return 0;
} }
...@@ -120,8 +115,7 @@ public class CommonQueryManager { ...@@ -120,8 +115,7 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDelete(String apiName, String ids, HttpServletRequest request)throws Exception { public int batchDelete(String apiName, String ids, HttpServletRequest request)throws Exception {
if (StringUtil.isNotEmpty(apiName)) { if (StringUtil.isNotEmpty(apiName)) {
logService.insertLog(apiName, "批量删除,id集:" + ids, request); return container.getCommonQuery(apiName).batchDelete(ids, request);
return container.getCommonQuery(apiName).batchDelete(ids);
} }
return 0; return 0;
} }
......
...@@ -50,7 +50,7 @@ public interface ICommonQuery { ...@@ -50,7 +50,7 @@ public interface ICommonQuery {
* @param beanJson * @param beanJson
* @return * @return
*/ */
int update(String beanJson, Long id) throws Exception; int update(String beanJson, Long id, HttpServletRequest request) throws Exception;
/** /**
* 删除数据 * 删除数据
...@@ -58,7 +58,7 @@ public interface ICommonQuery { ...@@ -58,7 +58,7 @@ public interface ICommonQuery {
* @param id * @param id
* @return * @return
*/ */
int delete(Long id) throws Exception; int delete(Long id, HttpServletRequest request) throws Exception;
/** /**
* 批量删除数据 * 批量删除数据
...@@ -66,7 +66,7 @@ public interface ICommonQuery { ...@@ -66,7 +66,7 @@ public interface ICommonQuery {
* @param ids * @param ids
* @return * @return
*/ */
int batchDelete(String ids) throws Exception; int batchDelete(String ids, HttpServletRequest request) throws Exception;
/** /**
* 查询名称是否存在 * 查询名称是否存在
......
...@@ -52,18 +52,18 @@ public class AccountComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class AccountComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return accountService.updateAccount(beanJson, id); return accountService.updateAccount(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return accountService.deleteAccount(id); return accountService.deleteAccount(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return accountService.batchDeleteAccount(ids); return accountService.batchDeleteAccount(ids, request);
} }
@Override @Override
......
...@@ -122,6 +122,7 @@ public class AccountService { ...@@ -122,6 +122,7 @@ public class AccountService {
int result=0; int result=0;
try{ try{
result = accountMapper.insertSelective(account); result = accountMapper.insertSelective(account);
logService.insertLog("账户", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -129,12 +130,14 @@ public class AccountService { ...@@ -129,12 +130,14 @@ public class AccountService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAccount(String beanJson, Long id)throws Exception { public int updateAccount(String beanJson, Long id, HttpServletRequest request)throws Exception {
Account account = JSONObject.parseObject(beanJson, Account.class); Account account = JSONObject.parseObject(beanJson, Account.class);
account.setId(id); account.setId(id);
int result=0; int result=0;
try{ try{
result = accountMapper.updateByPrimaryKeySelective(account); result = accountMapper.updateByPrimaryKeySelective(account);
logService.insertLog("账户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -142,10 +145,12 @@ public class AccountService { ...@@ -142,10 +145,12 @@ public class AccountService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteAccount(Long id) throws Exception{ public int deleteAccount(Long id, HttpServletRequest request) throws Exception{
int result=0; int result=0;
try{ try{
result = accountMapper.deleteByPrimaryKey(id); result = accountMapper.deleteByPrimaryKey(id);
logService.insertLog("账户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -153,13 +158,14 @@ public class AccountService { ...@@ -153,13 +158,14 @@ public class AccountService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccount(String ids)throws Exception { public int batchDeleteAccount(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
AccountExample example = new AccountExample(); AccountExample example = new AccountExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result = accountMapper.deleteByExample(example); result = accountMapper.deleteByExample(example);
logService.insertLog("账户", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -421,7 +427,7 @@ public class AccountService { ...@@ -421,7 +427,7 @@ public class AccountService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAmountIsDefault(Boolean isDefault, Long accountId) throws Exception{ public int updateAmountIsDefault(Boolean isDefault, Long accountId) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId, logService.insertLog("账户",BusinessConstants.LOG_OPERATION_TYPE_EDIT+accountId,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
Account account = new Account(); Account account = new Account();
account.setIsdefault(isDefault); account.setIsdefault(isDefault);
...@@ -437,7 +443,7 @@ public class AccountService { ...@@ -437,7 +443,7 @@ public class AccountService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountByIds(String ids) throws Exception{ public int batchDeleteAccountByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT, logService.insertLog("账户",
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();
......
...@@ -54,18 +54,18 @@ public class AccountHeadComponent implements ICommonQuery { ...@@ -54,18 +54,18 @@ public class AccountHeadComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return accountHeadService.updateAccountHead(beanJson, id); return accountHeadService.updateAccountHead(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return accountHeadService.deleteAccountHead(id); return accountHeadService.deleteAccountHead(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return accountHeadService.batchDeleteAccountHead(ids); return accountHeadService.batchDeleteAccountHead(ids, request);
} }
@Override @Override
......
...@@ -102,6 +102,7 @@ public class AccountHeadService { ...@@ -102,6 +102,7 @@ public class AccountHeadService {
int result=0; int result=0;
try{ try{
result = accountHeadMapper.insertSelective(accountHead); result = accountHeadMapper.insertSelective(accountHead);
logService.insertLog("财务", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -109,12 +110,14 @@ public class AccountHeadService { ...@@ -109,12 +110,14 @@ public class AccountHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @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 accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
accountHead.setId(id); accountHead.setId(id);
int result=0; int result=0;
try{ try{
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead); result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
logService.insertLog("财务",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -122,10 +125,12 @@ public class AccountHeadService { ...@@ -122,10 +125,12 @@ public class AccountHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @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; int result=0;
try{ try{
result = accountHeadMapper.deleteByPrimaryKey(id); result = accountHeadMapper.deleteByPrimaryKey(id);
logService.insertLog("财务",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -133,13 +138,14 @@ public class AccountHeadService { ...@@ -133,13 +138,14 @@ public class AccountHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @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); List<Long> idList = StringUtil.strToLongList(ids);
AccountHeadExample example = new AccountHeadExample(); AccountHeadExample example = new AccountHeadExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result = accountHeadMapper.deleteByExample(example); result = accountHeadMapper.deleteByExample(example);
logService.insertLog("财务", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -257,7 +263,7 @@ public class AccountHeadService { ...@@ -257,7 +263,7 @@ public class AccountHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountHeadByIds(String ids)throws Exception { 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(), 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();
......
...@@ -52,18 +52,18 @@ public class AccountItemComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class AccountItemComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return accountItemService.updateAccountItem(beanJson, id); return accountItemService.updateAccountItem(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return accountItemService.deleteAccountItem(id); return accountItemService.deleteAccountItem(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return accountItemService.batchDeleteAccountItem(ids); return accountItemService.batchDeleteAccountItem(ids, request);
} }
@Override @Override
......
...@@ -95,6 +95,7 @@ public class AccountItemService { ...@@ -95,6 +95,7 @@ public class AccountItemService {
int result=0; int result=0;
try{ try{
result = accountItemMapper.insertSelective(accountItem); result = accountItemMapper.insertSelective(accountItem);
logService.insertLog("财务明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -102,12 +103,14 @@ public class AccountItemService { ...@@ -102,12 +103,14 @@ public class AccountItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAccountItem(String beanJson, Long id)throws Exception { public int updateAccountItem(String beanJson, Long id, HttpServletRequest request)throws Exception {
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class); AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
accountItem.setId(id); accountItem.setId(id);
int result=0; int result=0;
try{ try{
result = accountItemMapper.updateByPrimaryKeySelective(accountItem); result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -115,10 +118,12 @@ public class AccountItemService { ...@@ -115,10 +118,12 @@ public class AccountItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteAccountItem(Long id)throws Exception { public int deleteAccountItem(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result = accountItemMapper.deleteByPrimaryKey(id); result = accountItemMapper.deleteByPrimaryKey(id);
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -126,13 +131,14 @@ public class AccountItemService { ...@@ -126,13 +131,14 @@ public class AccountItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountItem(String ids)throws Exception { public int batchDeleteAccountItem(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
AccountItemExample example = new AccountItemExample(); AccountItemExample example = new AccountItemExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result = accountItemMapper.deleteByExample(example); result = accountItemMapper.deleteByExample(example);
logService.insertLog("财务明细", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -184,7 +190,7 @@ public class AccountItemService { ...@@ -184,7 +190,7 @@ 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 Exception { public String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM, logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//转为json //转为json
...@@ -257,7 +263,7 @@ public class AccountItemService { ...@@ -257,7 +263,7 @@ public class AccountItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountItemByIds(String ids) throws Exception{ public int batchDeleteAccountItemByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM, logService.insertLog("财务明细",
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();
......
...@@ -52,18 +52,18 @@ public class DepotComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class DepotComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return depotService.updateDepot(beanJson, id); return depotService.updateDepot(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return depotService.deleteDepot(id); return depotService.deleteDepot(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return depotService.batchDeleteDepot(ids); return depotService.batchDeleteDepot(ids, request);
} }
@Override @Override
......
...@@ -103,6 +103,7 @@ public class DepotService { ...@@ -103,6 +103,7 @@ public class DepotService {
int result=0; int result=0;
try{ try{
result=depotMapper.insertSelective(depot); result=depotMapper.insertSelective(depot);
logService.insertLog("仓库", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -110,12 +111,14 @@ public class DepotService { ...@@ -110,12 +111,14 @@ public class DepotService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @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 depot = JSONObject.parseObject(beanJson, Depot.class);
depot.setId(id); depot.setId(id);
int result=0; int result=0;
try{ try{
result= depotMapper.updateByPrimaryKeySelective(depot); result= depotMapper.updateByPrimaryKeySelective(depot);
logService.insertLog("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -123,10 +126,12 @@ public class DepotService { ...@@ -123,10 +126,12 @@ public class DepotService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @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; int result=0;
try{ try{
result= depotMapper.deleteByPrimaryKey(id); result= depotMapper.deleteByPrimaryKey(id);
logService.insertLog("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -134,13 +139,14 @@ public class DepotService { ...@@ -134,13 +139,14 @@ public class DepotService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @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); List<Long> idList = StringUtil.strToLongList(ids);
DepotExample example = new DepotExample(); DepotExample example = new DepotExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result= depotMapper.deleteByExample(example); result= depotMapper.deleteByExample(example);
logService.insertLog("仓库", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -196,7 +202,7 @@ public class DepotService { ...@@ -196,7 +202,7 @@ public class DepotService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIds(String ids)throws Exception { 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(), 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();
...@@ -272,7 +278,7 @@ public class DepotService { ...@@ -272,7 +278,7 @@ public class DepotService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateDepotIsDefault(Boolean isDefault, Long depotID) throws Exception{ 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()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
Depot depot = new Depot(); Depot depot = new Depot();
depot.setIsDefault(isDefault); depot.setIsDefault(isDefault);
......
...@@ -59,18 +59,18 @@ public class DepotHeadComponent implements ICommonQuery { ...@@ -59,18 +59,18 @@ public class DepotHeadComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return depotHeadService.updateDepotHead(beanJson, id); return depotHeadService.updateDepotHead(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return depotHeadService.deleteDepotHead(id); return depotHeadService.deleteDepotHead(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return depotHeadService.batchDeleteDepotHead(ids); return depotHeadService.batchDeleteDepotHead(ids, request);
} }
@Override @Override
......
...@@ -142,6 +142,7 @@ public class DepotHeadService { ...@@ -142,6 +142,7 @@ public class DepotHeadService {
int result=0; int result=0;
try{ try{
result=depotHeadMapper.insert(depotHead); result=depotHeadMapper.insert(depotHead);
logService.insertLog("单据", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -149,7 +150,7 @@ public class DepotHeadService { ...@@ -149,7 +150,7 @@ public class DepotHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateDepotHead(String beanJson, Long id) throws Exception{ public int updateDepotHead(String beanJson, Long id, HttpServletRequest request) throws Exception{
DepotHead dh=null; DepotHead dh=null;
try{ try{
dh = depotHeadMapper.selectByPrimaryKey(id); dh = depotHeadMapper.selectByPrimaryKey(id);
...@@ -164,6 +165,8 @@ public class DepotHeadService { ...@@ -164,6 +165,8 @@ public class DepotHeadService {
int result=0; int result=0;
try{ try{
result = depotHeadMapper.updateByPrimaryKey(depotHead); result = depotHeadMapper.updateByPrimaryKey(depotHead);
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -171,10 +174,12 @@ public class DepotHeadService { ...@@ -171,10 +174,12 @@ public class DepotHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteDepotHead(Long id)throws Exception { public int deleteDepotHead(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result = depotHeadMapper.deleteByPrimaryKey(id); result = depotHeadMapper.deleteByPrimaryKey(id);
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -182,13 +187,14 @@ public class DepotHeadService { ...@@ -182,13 +187,14 @@ public class DepotHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotHead(String ids)throws Exception { public int batchDeleteDepotHead(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
DepotHeadExample example = new DepotHeadExample(); DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result = depotHeadMapper.deleteByExample(example); result = depotHeadMapper.deleteByExample(example);
logService.insertLog("单据", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -209,7 +215,7 @@ public class DepotHeadService { ...@@ -209,7 +215,7 @@ public class DepotHeadService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchSetStatus(String status, String depotHeadIDs)throws Exception { public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHeadIDs).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHeadIDs).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
List<Long> ids = StringUtil.strToLongList(depotHeadIDs); List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
...@@ -469,8 +475,9 @@ public class DepotHeadService { ...@@ -469,8 +475,9 @@ public class DepotHeadService {
* @return java.lang.String * @return java.lang.String
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception { public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId,
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, HttpServletRequest request) throws Exception {
logService.insertLog("单据",
BusinessConstants.LOG_OPERATION_TYPE_ADD, BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
/**处理单据主表数据*/ /**处理单据主表数据*/
...@@ -494,7 +501,7 @@ public class DepotHeadService { ...@@ -494,7 +501,7 @@ public class DepotHeadService {
} }
} }
/**入库和出库处理单据子表信息*/ /**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId); depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId, request);
/**如果关联单据号非空则更新订单的状态为2 */ /**如果关联单据号非空则更新订单的状态为2 */
if(depotHead.getLinknumber()!=null) { if(depotHead.getLinknumber()!=null) {
DepotHead depotHeadOrders = new DepotHead(); DepotHead depotHeadOrders = new DepotHead();
...@@ -523,8 +530,8 @@ public class DepotHeadService { ...@@ -523,8 +530,8 @@ 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, public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated,
BigDecimal preTotalPrice, Long tenantId)throws Exception { BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
/**更新单据主表信息*/ /**更新单据主表信息*/
...@@ -546,7 +553,7 @@ public class DepotHeadService { ...@@ -546,7 +553,7 @@ public class DepotHeadService {
} }
} }
/**入库和出库处理单据子表信息*/ /**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId); depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId,request);
} }
/** /**
...@@ -559,7 +566,7 @@ public class DepotHeadService { ...@@ -559,7 +566,7 @@ 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, logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息 //查询单据主表信息
...@@ -604,7 +611,7 @@ public class DepotHeadService { ...@@ -604,7 +611,7 @@ 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, logService.insertLog("单据",
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());
if(StringUtil.isNotEmpty(ids)){ if(StringUtil.isNotEmpty(ids)){
...@@ -616,7 +623,7 @@ public class DepotHeadService { ...@@ -616,7 +623,7 @@ public class DepotHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotHeadByIds(String ids)throws Exception { public int batchDeleteDepotHeadByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD, logService.insertLog("单据",
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();
......
...@@ -52,18 +52,18 @@ public class DepotItemComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class DepotItemComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return depotItemService.updateDepotItem(beanJson, id); return depotItemService.updateDepotItem(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return depotItemService.deleteDepotItem(id); return depotItemService.deleteDepotItem(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return depotItemService.batchDeleteDepotItem(ids); return depotItemService.batchDeleteDepotItem(ids, request);
} }
@Override @Override
......
...@@ -107,6 +107,7 @@ public class DepotItemService { ...@@ -107,6 +107,7 @@ public class DepotItemService {
int result =0; int result =0;
try{ try{
result=depotItemMapper.insertSelective(depotItem); result=depotItemMapper.insertSelective(depotItem);
logService.insertLog("单据明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
...@@ -114,12 +115,14 @@ public class DepotItemService { ...@@ -114,12 +115,14 @@ public class DepotItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateDepotItem(String beanJson, Long id)throws Exception { public int updateDepotItem(String beanJson, Long id, HttpServletRequest request)throws Exception {
DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class); DepotItem depotItem = JSONObject.parseObject(beanJson, DepotItem.class);
depotItem.setId(id); depotItem.setId(id);
int result =0; int result =0;
try{ try{
result=depotItemMapper.updateByPrimaryKeySelective(depotItem); result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
...@@ -127,10 +130,12 @@ public class DepotItemService { ...@@ -127,10 +130,12 @@ public class DepotItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteDepotItem(Long id)throws Exception { public int deleteDepotItem(Long id, HttpServletRequest request)throws Exception {
int result =0; int result =0;
try{ try{
result=depotItemMapper.deleteByPrimaryKey(id); result=depotItemMapper.deleteByPrimaryKey(id);
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -138,13 +143,14 @@ public class DepotItemService { ...@@ -138,13 +143,14 @@ public class DepotItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotItem(String ids)throws Exception { public int batchDeleteDepotItem(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
DepotItemExample example = new DepotItemExample(); DepotItemExample example = new DepotItemExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result =0; int result =0;
try{ try{
result=depotItemMapper.deleteByExample(example); result=depotItemMapper.deleteByExample(example);
logService.insertLog("单据明细", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -284,8 +290,8 @@ public class DepotItemService { ...@@ -284,8 +290,8 @@ public class DepotItemService {
* 这里重点重申一下:BasicNumber=OperNumber*ratio * 这里重点重申一下:BasicNumber=OperNumber*ratio
* */ * */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{ public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM, logService.insertLog("单据明细",
BusinessConstants.LOG_OPERATION_TYPE_ADD, BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息 //查询单据主表信息
...@@ -330,7 +336,7 @@ public class DepotItemService { ...@@ -330,7 +336,7 @@ public class DepotItemService {
userInfo); userInfo);
} }
} }
this.deleteDepotItem(tempDeletedJson.getLong("Id")); this.deleteDepotItem(tempDeletedJson.getLong("Id"), request);
bf.append(tempDeletedJson.getLong("Id")); bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){ if(i<(deletedJson.size()-1)){
bf.append(","); bf.append(",");
...@@ -598,7 +604,7 @@ public class DepotItemService { ...@@ -598,7 +604,7 @@ public class DepotItemService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotItemByIds(String ids)throws Exception { public int batchDeleteDepotItemByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM, logService.insertLog("单据明细",
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();
......
...@@ -51,18 +51,18 @@ public class FunctionsComponent implements ICommonQuery { ...@@ -51,18 +51,18 @@ public class FunctionsComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return functionsService.updateFunctions(beanJson, id); return functionsService.updateFunctions(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return functionsService.deleteFunctions(id); return functionsService.deleteFunctions(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return functionsService.batchDeleteFunctions(ids); return functionsService.batchDeleteFunctions(ids, request);
} }
@Override @Override
......
...@@ -88,6 +88,7 @@ public class FunctionsService { ...@@ -88,6 +88,7 @@ public class FunctionsService {
int result=0; int result=0;
try{ try{
result=functionsMapper.insertSelective(depot); result=functionsMapper.insertSelective(depot);
logService.insertLog("功能", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -95,12 +96,14 @@ public class FunctionsService { ...@@ -95,12 +96,14 @@ public class FunctionsService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateFunctions(String beanJson, Long id) throws Exception{ public int updateFunctions(String beanJson, Long id, HttpServletRequest request) throws Exception{
Functions depot = JSONObject.parseObject(beanJson, Functions.class); Functions depot = JSONObject.parseObject(beanJson, Functions.class);
depot.setId(id); depot.setId(id);
int result=0; int result=0;
try{ try{
result=functionsMapper.updateByPrimaryKeySelective(depot); result=functionsMapper.updateByPrimaryKeySelective(depot);
logService.insertLog("功能",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -108,10 +111,12 @@ public class FunctionsService { ...@@ -108,10 +111,12 @@ public class FunctionsService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteFunctions(Long id)throws Exception { public int deleteFunctions(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=functionsMapper.deleteByPrimaryKey(id); result=functionsMapper.deleteByPrimaryKey(id);
logService.insertLog("功能",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -119,13 +124,14 @@ public class FunctionsService { ...@@ -119,13 +124,14 @@ public class FunctionsService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteFunctions(String ids)throws Exception { public int batchDeleteFunctions(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
FunctionsExample example = new FunctionsExample(); FunctionsExample example = new FunctionsExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=functionsMapper.deleteByExample(example); result=functionsMapper.deleteByExample(example);
logService.insertLog("功能", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -189,7 +195,7 @@ public class FunctionsService { ...@@ -189,7 +195,7 @@ public class FunctionsService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteFunctionsByIds(String ids)throws Exception { public int batchDeleteFunctionsByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS, logService.insertLog("功能",
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();
......
...@@ -52,18 +52,18 @@ public class InOutItemComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class InOutItemComponent implements ICommonQuery {
} }
@Override @Override
public int update(String beanJson, Long id)throws Exception { public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return inOutItemService.updateInOutItem(beanJson, id); return inOutItemService.updateInOutItem(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return inOutItemService.deleteInOutItem(id); return inOutItemService.deleteInOutItem(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return inOutItemService.batchDeleteInOutItem(ids); return inOutItemService.batchDeleteInOutItem(ids, request);
} }
@Override @Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment