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

优化日志的记录

parent 47c90a0e
......@@ -151,55 +151,6 @@ public class BusinessConstants {
* 条
* */
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 {
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
} else {
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId);
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId, request);
}
return result;
}
......@@ -431,7 +431,7 @@ public class DepotHeadController {
HttpServletRequest request) throws Exception{
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
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;
}
/**
......
......@@ -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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
} catch (Exception e) {
......
......@@ -72,7 +72,6 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insert(String apiName, String beanJson, HttpServletRequest request) throws Exception{
if (StringUtil.isNotEmpty(apiName)) {
logService.insertLog(apiName, BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
return container.getCommonQuery(apiName).insert(beanJson, request);
}
return 0;
......@@ -88,9 +87,7 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int update(String apiName, String beanJson, Long id, HttpServletRequest request)throws Exception {
if (StringUtil.isNotEmpty(apiName)) {
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, request);
}
return 0;
}
......@@ -104,9 +101,7 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int delete(String apiName, Long id, HttpServletRequest request)throws Exception {
if (StringUtil.isNotEmpty(apiName)) {
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, request);
}
return 0;
}
......@@ -120,8 +115,7 @@ public class CommonQueryManager {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDelete(String apiName, String ids, HttpServletRequest request)throws Exception {
if (StringUtil.isNotEmpty(apiName)) {
logService.insertLog(apiName, "批量删除,id集:" + ids, request);
return container.getCommonQuery(apiName).batchDelete(ids);
return container.getCommonQuery(apiName).batchDelete(ids, request);
}
return 0;
}
......
......@@ -50,7 +50,7 @@ public interface ICommonQuery {
* @param beanJson
* @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 {
* @param id
* @return
*/
int delete(Long id) throws Exception;
int delete(Long id, HttpServletRequest request) throws Exception;
/**
* 批量删除数据
......@@ -66,7 +66,7 @@ public interface ICommonQuery {
* @param ids
* @return
*/
int batchDelete(String ids) throws Exception;
int batchDelete(String ids, HttpServletRequest request) throws Exception;
/**
* 查询名称是否存在
......
......@@ -52,18 +52,18 @@ public class AccountComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return accountService.updateAccount(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return accountService.updateAccount(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return accountService.deleteAccount(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return accountService.deleteAccount(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return accountService.batchDeleteAccount(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return accountService.batchDeleteAccount(ids, request);
}
@Override
......
......@@ -122,6 +122,7 @@ public class AccountService {
int result=0;
try{
result = accountMapper.insertSelective(account);
logService.insertLog("账户", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -129,12 +130,14 @@ public class AccountService {
}
@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.setId(id);
int result=0;
try{
result = accountMapper.updateByPrimaryKeySelective(account);
logService.insertLog("账户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -142,10 +145,12 @@ public class AccountService {
}
@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;
try{
result = accountMapper.deleteByPrimaryKey(id);
logService.insertLog("账户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -153,13 +158,14 @@ public class AccountService {
}
@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);
AccountExample example = new AccountExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result = accountMapper.deleteByExample(example);
logService.insertLog("账户", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -421,7 +427,7 @@ public class AccountService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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());
Account account = new Account();
account.setIsdefault(isDefault);
......@@ -437,7 +443,7 @@ public class AccountService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
......
......@@ -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
......
......@@ -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();
......
......@@ -52,18 +52,18 @@ public class AccountItemComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return accountItemService.updateAccountItem(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return accountItemService.updateAccountItem(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return accountItemService.deleteAccountItem(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return accountItemService.deleteAccountItem(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return accountItemService.batchDeleteAccountItem(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return accountItemService.batchDeleteAccountItem(ids, request);
}
@Override
......
......@@ -95,6 +95,7 @@ public class AccountItemService {
int result=0;
try{
result = accountItemMapper.insertSelective(accountItem);
logService.insertLog("财务明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -102,12 +103,14 @@ public class AccountItemService {
}
@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.setId(id);
int result=0;
try{
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -115,10 +118,12 @@ public class AccountItemService {
}
@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;
try{
result = accountItemMapper.deleteByPrimaryKey(id);
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -126,13 +131,14 @@ public class AccountItemService {
}
@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);
AccountItemExample example = new AccountItemExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result = accountItemMapper.deleteByExample(example);
logService.insertLog("财务明细", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -184,7 +190,7 @@ public class AccountItemService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//转为json
......@@ -257,7 +263,7 @@ public class AccountItemService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
......
......@@ -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
......
......@@ -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);
......
......@@ -59,18 +59,18 @@ public class DepotHeadComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return depotHeadService.updateDepotHead(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return depotHeadService.updateDepotHead(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return depotHeadService.deleteDepotHead(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return depotHeadService.deleteDepotHead(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return depotHeadService.batchDeleteDepotHead(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return depotHeadService.batchDeleteDepotHead(ids, request);
}
@Override
......
......@@ -142,6 +142,7 @@ public class DepotHeadService {
int result=0;
try{
result=depotHeadMapper.insert(depotHead);
logService.insertLog("单据", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -149,7 +150,7 @@ public class DepotHeadService {
}
@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;
try{
dh = depotHeadMapper.selectByPrimaryKey(id);
......@@ -164,6 +165,8 @@ public class DepotHeadService {
int result=0;
try{
result = depotHeadMapper.updateByPrimaryKey(depotHead);
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -171,10 +174,12 @@ public class DepotHeadService {
}
@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;
try{
result = depotHeadMapper.deleteByPrimaryKey(id);
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -182,13 +187,14 @@ public class DepotHeadService {
}
@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);
DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result = depotHeadMapper.deleteByExample(example);
logService.insertLog("单据", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -209,7 +215,7 @@ public class DepotHeadService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
......@@ -469,8 +475,9 @@ public class DepotHeadService {
* @return java.lang.String
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId,
HttpServletRequest request) throws Exception {
logService.insertLog("单据",
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
/**处理单据主表数据*/
......@@ -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 */
if(depotHead.getLinknumber()!=null) {
DepotHead depotHeadOrders = new DepotHead();
......@@ -523,8 +530,8 @@ public class DepotHeadService {
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated,
BigDecimal preTotalPrice, Long tenantId)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request)throws Exception {
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
/**更新单据主表信息*/
......@@ -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 {
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息
......@@ -604,7 +611,7 @@ public class DepotHeadService {
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(StringUtil.isNotEmpty(ids)){
......@@ -616,7 +623,7 @@ public class DepotHeadService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
......
......@@ -52,18 +52,18 @@ public class DepotItemComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return depotItemService.updateDepotItem(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return depotItemService.updateDepotItem(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return depotItemService.deleteDepotItem(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return depotItemService.deleteDepotItem(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return depotItemService.batchDeleteDepotItem(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return depotItemService.batchDeleteDepotItem(ids, request);
}
@Override
......
......@@ -107,6 +107,7 @@ public class DepotItemService {
int result =0;
try{
result=depotItemMapper.insertSelective(depotItem);
logService.insertLog("单据明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.readFail(logger, e);
}
......@@ -114,12 +115,14 @@ public class DepotItemService {
}
@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.setId(id);
int result =0;
try{
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.readFail(logger, e);
}
......@@ -127,10 +130,12 @@ public class DepotItemService {
}
@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;
try{
result=depotItemMapper.deleteByPrimaryKey(id);
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -138,13 +143,14 @@ public class DepotItemService {
}
@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);
DepotItemExample example = new DepotItemExample();
example.createCriteria().andIdIn(idList);
int result =0;
try{
result=depotItemMapper.deleteByExample(example);
logService.insertLog("单据明细", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -284,8 +290,8 @@ public class DepotItemService {
* 这里重点重申一下:BasicNumber=OperNumber*ratio
* */
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{
logService.insertLog("单据明细",
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息
......@@ -330,7 +336,7 @@ public class DepotItemService {
userInfo);
}
}
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
this.deleteDepotItem(tempDeletedJson.getLong("Id"), request);
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
......@@ -598,7 +604,7 @@ public class DepotItemService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
......
......@@ -51,18 +51,18 @@ public class FunctionsComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return functionsService.updateFunctions(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return functionsService.updateFunctions(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return functionsService.deleteFunctions(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return functionsService.deleteFunctions(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return functionsService.batchDeleteFunctions(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return functionsService.batchDeleteFunctions(ids, request);
}
@Override
......
......@@ -88,6 +88,7 @@ public class FunctionsService {
int result=0;
try{
result=functionsMapper.insertSelective(depot);
logService.insertLog("功能", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -95,12 +96,14 @@ public class FunctionsService {
}
@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);
depot.setId(id);
int result=0;
try{
result=functionsMapper.updateByPrimaryKeySelective(depot);
logService.insertLog("功能",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -108,10 +111,12 @@ public class FunctionsService {
}
@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;
try{
result=functionsMapper.deleteByPrimaryKey(id);
logService.insertLog("功能",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -119,13 +124,14 @@ public class FunctionsService {
}
@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);
FunctionsExample example = new FunctionsExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result=functionsMapper.deleteByExample(example);
logService.insertLog("功能", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
......@@ -189,7 +195,7 @@ public class FunctionsService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
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(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
......
......@@ -52,18 +52,18 @@ public class InOutItemComponent implements ICommonQuery {
}
@Override
public int update(String beanJson, Long id)throws Exception {
return inOutItemService.updateInOutItem(beanJson, id);
public int update(String beanJson, Long id, HttpServletRequest request)throws Exception {
return inOutItemService.updateInOutItem(beanJson, id, request);
}
@Override
public int delete(Long id)throws Exception {
return inOutItemService.deleteInOutItem(id);
public int delete(Long id, HttpServletRequest request)throws Exception {
return inOutItemService.deleteInOutItem(id, request);
}
@Override
public int batchDelete(String ids)throws Exception {
return inOutItemService.batchDeleteInOutItem(ids);
public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return inOutItemService.batchDeleteInOutItem(ids, request);
}
@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