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

优化日志的记录

parent 47c90a0e
...@@ -89,6 +89,7 @@ public class InOutItemService { ...@@ -89,6 +89,7 @@ public class InOutItemService {
int result=0; int result=0;
try{ try{
result=inOutItemMapper.insertSelective(depot); result=inOutItemMapper.insertSelective(depot);
logService.insertLog("收支项目", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -96,12 +97,14 @@ public class InOutItemService { ...@@ -96,12 +97,14 @@ public class InOutItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateInOutItem(String beanJson, Long id)throws Exception { public int updateInOutItem(String beanJson, Long id, HttpServletRequest request)throws Exception {
InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class); InOutItem depot = JSONObject.parseObject(beanJson, InOutItem.class);
depot.setId(id); depot.setId(id);
int result=0; int result=0;
try{ try{
result=inOutItemMapper.updateByPrimaryKeySelective(depot); result=inOutItemMapper.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);
} }
...@@ -109,10 +112,12 @@ public class InOutItemService { ...@@ -109,10 +112,12 @@ public class InOutItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteInOutItem(Long id)throws Exception { public int deleteInOutItem(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=inOutItemMapper.deleteByPrimaryKey(id); result=inOutItemMapper.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);
} }
...@@ -120,13 +125,14 @@ public class InOutItemService { ...@@ -120,13 +125,14 @@ public class InOutItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteInOutItem(String ids)throws Exception { public int batchDeleteInOutItem(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
InOutItemExample example = new InOutItemExample(); InOutItemExample example = new InOutItemExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=inOutItemMapper.deleteByExample(example); result=inOutItemMapper.deleteByExample(example);
logService.insertLog("收支项目", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -164,7 +170,7 @@ public class InOutItemService { ...@@ -164,7 +170,7 @@ public class InOutItemService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteInOutItemByIds(String ids)throws Exception { public int batchDeleteInOutItemByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_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();
......
...@@ -61,18 +61,18 @@ public class LogComponent implements ICommonQuery { ...@@ -61,18 +61,18 @@ public class LogComponent 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 logService.updateLog(beanJson, id); return logService.updateLog(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return logService.deleteLog(id); return logService.deleteLog(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return logService.batchDeleteLog(ids); return logService.batchDeleteLog(ids, request);
} }
@Override @Override
......
...@@ -96,7 +96,7 @@ public class LogService { ...@@ -96,7 +96,7 @@ public class LogService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateLog(String beanJson, Long id)throws Exception { public int updateLog(String beanJson, Long id, HttpServletRequest request)throws Exception {
Log log = JSONObject.parseObject(beanJson, Log.class); Log log = JSONObject.parseObject(beanJson, Log.class);
log.setId(id); log.setId(id);
int result=0; int result=0;
...@@ -109,7 +109,7 @@ public class LogService { ...@@ -109,7 +109,7 @@ public class LogService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteLog(Long id)throws Exception { public int deleteLog(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=logMapper.deleteByPrimaryKey(id); result=logMapper.deleteByPrimaryKey(id);
...@@ -120,7 +120,7 @@ public class LogService { ...@@ -120,7 +120,7 @@ public class LogService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteLog(String ids)throws Exception { public int batchDeleteLog(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
LogExample example = new LogExample(); LogExample example = new LogExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
...@@ -148,64 +148,15 @@ public class LogService { ...@@ -148,64 +148,15 @@ public class LogService {
} }
} }
public String getModule(String apiName)throws Exception{ public void insertLog(String moduleName, String type, HttpServletRequest request)throws Exception{
String moduleName = null;
switch (apiName) {
case BusinessConstants.LOG_INTERFACE_NAME_USER:
moduleName = BusinessConstants.LOG_MODULE_NAME_USER; break;
case BusinessConstants.LOG_INTERFACE_NAME_ROLE:
moduleName = BusinessConstants.LOG_MODULE_NAME_ROLE; break;
case BusinessConstants.LOG_INTERFACE_NAME_APP:
moduleName =BusinessConstants.LOG_MODULE_NAME_APP; break;
case BusinessConstants.LOG_INTERFACE_NAME_DEPOT:
moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT; break;
case BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS:
moduleName = BusinessConstants.LOG_MODULE_NAME_FUNCTIONS; break;
case BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM:
moduleName = BusinessConstants.LOG_MODULE_NAME_IN_OUT_ITEM; break;
case BusinessConstants.LOG_INTERFACE_NAME_UNIT:
moduleName = BusinessConstants.LOG_MODULE_NAME_UNIT; break;
case BusinessConstants.LOG_INTERFACE_NAME_PERSON:
moduleName = BusinessConstants.LOG_MODULE_NAME_PERSON; break;
case BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS:
moduleName = BusinessConstants.LOG_MODULE_NAME_USER_BUSINESS; break;
case BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG:
moduleName = BusinessConstants.LOG_MODULE_NAME_SYSTEM_CONFIG; break;
case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY:
moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL_PROPERTY; break;
case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT:
moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT; break;
case BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER:
moduleName = BusinessConstants.LOG_MODULE_NAME_SUPPLIER; break;
case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY:
moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL_CATEGORY; break;
case BusinessConstants.LOG_INTERFACE_NAME_MATERIAL:
moduleName = BusinessConstants.LOG_MODULE_NAME_MATERIAL; break;
case BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD:
moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT_HEAD; break;
case BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM:
moduleName = BusinessConstants.LOG_MODULE_NAME_DEPOT_ITEM; break;
case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD:
moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT_HEAD; break;
case BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM:
moduleName = BusinessConstants.LOG_MODULE_NAME_ACCOUNT_ITEM; break;
case BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER:
moduleName = BusinessConstants.LOG_MODULE_NAME_SERIAL_NUMBER; break;
case BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION:
moduleName = BusinessConstants.LOG_MODULE_NAME_ORGANIZATION; break;
}
return moduleName;
}
public void insertLog(String apiName, String type, HttpServletRequest request)throws Exception{
Log log = new Log(); Log log = new Log();
log.setUserid(getUserId(request)); log.setUserid(getUserId(request));
log.setOperation(getModule(apiName)); log.setOperation(moduleName);
log.setClientip(getLocalIp(request)); log.setClientip(getLocalIp(request));
log.setCreatetime(new Date()); log.setCreatetime(new Date());
Byte status = 0; Byte status = 0;
log.setStatus(status); log.setStatus(status);
log.setContentdetails(type + getModule(apiName)); log.setContentdetails(type + moduleName);
try{ try{
logMapper.insertSelective(log); logMapper.insertSelective(log);
}catch(Exception e){ }catch(Exception e){
......
...@@ -56,18 +56,18 @@ public class MaterialComponent implements ICommonQuery { ...@@ -56,18 +56,18 @@ public class MaterialComponent 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 materialService.updateMaterial(beanJson, id); return materialService.updateMaterial(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return materialService.deleteMaterial(id); return materialService.deleteMaterial(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return materialService.batchDeleteMaterial(ids); return materialService.batchDeleteMaterial(ids, request);
} }
@Override @Override
......
...@@ -125,6 +125,7 @@ public class MaterialService { ...@@ -125,6 +125,7 @@ public class MaterialService {
int result =0; int result =0;
try{ try{
result= materialMapper.insertSelective(material); result= materialMapper.insertSelective(material);
logService.insertLog("商品", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -132,7 +133,7 @@ public class MaterialService { ...@@ -132,7 +133,7 @@ public class MaterialService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMaterial(String beanJson, Long id) throws Exception{ public int updateMaterial(String beanJson, Long id, HttpServletRequest request) throws Exception{
Material material = JSONObject.parseObject(beanJson, Material.class); Material material = JSONObject.parseObject(beanJson, Material.class);
material.setId(id); material.setId(id);
int res =0; int res =0;
...@@ -144,6 +145,8 @@ public class MaterialService { ...@@ -144,6 +145,8 @@ public class MaterialService {
} else { } else {
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空 materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空
} }
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);
} }
...@@ -152,10 +155,12 @@ public class MaterialService { ...@@ -152,10 +155,12 @@ public class MaterialService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMaterial(Long id)throws Exception { public int deleteMaterial(Long id, HttpServletRequest request)throws Exception {
int result =0; int result =0;
try{ try{
result= materialMapper.deleteByPrimaryKey(id); result= materialMapper.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);
} }
...@@ -163,13 +168,14 @@ public class MaterialService { ...@@ -163,13 +168,14 @@ public class MaterialService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterial(String ids)throws Exception { public int batchDeleteMaterial(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result =0; int result =0;
try{ try{
result= materialMapper.deleteByExample(example); result= materialMapper.deleteByExample(example);
logService.insertLog("商品", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -215,7 +221,7 @@ public class MaterialService { ...@@ -215,7 +221,7 @@ public class MaterialService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchSetEnable(Boolean enabled, String materialIDs)throws Exception { public int batchSetEnable(Boolean enabled, String materialIDs)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL, logService.insertLog("商品",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialIDs).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(materialIDs).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
List<Long> ids = StringUtil.strToLongList(materialIDs); List<Long> ids = StringUtil.strToLongList(materialIDs);
...@@ -292,7 +298,7 @@ public class MaterialService { ...@@ -292,7 +298,7 @@ public class MaterialService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public BaseResponseInfo importExcel(List<Material> mList) throws Exception { public BaseResponseInfo importExcel(List<Material> mList) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL, logService.insertLog("商品",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_IMPORT).append(mList.size()).append(BusinessConstants.LOG_DATA_UNIT).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
BaseResponseInfo info = new BaseResponseInfo(); BaseResponseInfo info = new BaseResponseInfo();
...@@ -324,7 +330,7 @@ public class MaterialService { ...@@ -324,7 +330,7 @@ public class MaterialService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIds(String ids) throws Exception{ public int batchDeleteMaterialByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL, 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 MaterialCategoryComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class MaterialCategoryComponent 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 materialCategoryService.updateMaterialCategory(beanJson, id); return materialCategoryService.updateMaterialCategory(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return materialCategoryService.deleteMaterialCategory(id); return materialCategoryService.deleteMaterialCategory(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return materialCategoryService.batchDeleteMaterialCategory(ids); return materialCategoryService.batchDeleteMaterialCategory(ids, request);
} }
@Override @Override
......
...@@ -118,6 +118,7 @@ public class MaterialCategoryService { ...@@ -118,6 +118,7 @@ public class MaterialCategoryService {
int result=0; int result=0;
try{ try{
result=materialCategoryMapper.insertSelective(materialCategory); result=materialCategoryMapper.insertSelective(materialCategory);
logService.insertLog("商品类型", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -125,12 +126,14 @@ public class MaterialCategoryService { ...@@ -125,12 +126,14 @@ public class MaterialCategoryService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMaterialCategory(String beanJson, Long id) throws Exception{ public int updateMaterialCategory(String beanJson, Long id, HttpServletRequest request) throws Exception{
MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class); MaterialCategory materialCategory = JSONObject.parseObject(beanJson, MaterialCategory.class);
materialCategory.setId(id); materialCategory.setId(id);
int result=0; int result=0;
try{ try{
result=materialCategoryMapper.updateByPrimaryKeySelective(materialCategory); result=materialCategoryMapper.updateByPrimaryKeySelective(materialCategory);
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);
} }
...@@ -138,10 +141,12 @@ public class MaterialCategoryService { ...@@ -138,10 +141,12 @@ public class MaterialCategoryService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMaterialCategory(Long id)throws Exception { public int deleteMaterialCategory(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=materialCategoryMapper.deleteByPrimaryKey(id); result=materialCategoryMapper.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);
} }
...@@ -149,13 +154,14 @@ public class MaterialCategoryService { ...@@ -149,13 +154,14 @@ public class MaterialCategoryService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialCategory(String ids)throws Exception { public int batchDeleteMaterialCategory(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
MaterialCategoryExample example = new MaterialCategoryExample(); MaterialCategoryExample example = new MaterialCategoryExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=materialCategoryMapper.deleteByExample(example); result=materialCategoryMapper.deleteByExample(example);
logService.insertLog("商品类型", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -204,7 +210,7 @@ public class MaterialCategoryService { ...@@ -204,7 +210,7 @@ public class MaterialCategoryService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int addMaterialCategory(MaterialCategory mc) throws Exception { public int addMaterialCategory(MaterialCategory mc) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY, logService.insertLog("商品类型",
BusinessConstants.LOG_OPERATION_TYPE_ADD, BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(mc==null){ if(mc==null){
...@@ -238,7 +244,7 @@ public class MaterialCategoryService { ...@@ -238,7 +244,7 @@ public class MaterialCategoryService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialCategoryByIds(String ids) throws Exception { public int batchDeleteMaterialCategoryByIds(String ids) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY, 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());
//更新时间 //更新时间
...@@ -260,7 +266,7 @@ public class MaterialCategoryService { ...@@ -260,7 +266,7 @@ public class MaterialCategoryService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int editMaterialCategory(MaterialCategory mc) throws Exception{ public int editMaterialCategory(MaterialCategory mc) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_CATEGORY, logService.insertLog("商品类型",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(mc.getParentid()==null){ if(mc.getParentid()==null){
......
...@@ -48,18 +48,18 @@ public class MaterialPropertyComponent implements ICommonQuery { ...@@ -48,18 +48,18 @@ public class MaterialPropertyComponent 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 materialPropertyService.updateMaterialProperty(beanJson, id); return materialPropertyService.updateMaterialProperty(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return materialPropertyService.deleteMaterialProperty(id); return materialPropertyService.deleteMaterialProperty(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return materialPropertyService.batchDeleteMaterialProperty(ids); return materialPropertyService.batchDeleteMaterialProperty(ids, request);
} }
@Override @Override
......
...@@ -87,6 +87,7 @@ public class MaterialPropertyService { ...@@ -87,6 +87,7 @@ public class MaterialPropertyService {
int result=0; int result=0;
try{ try{
result=materialPropertyMapper.insertSelective(materialProperty); result=materialPropertyMapper.insertSelective(materialProperty);
logService.insertLog("商品属性", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -94,12 +95,14 @@ public class MaterialPropertyService { ...@@ -94,12 +95,14 @@ public class MaterialPropertyService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMaterialProperty(String beanJson, Long id)throws Exception { public int updateMaterialProperty(String beanJson, Long id, HttpServletRequest request)throws Exception {
MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class); MaterialProperty materialProperty = JSONObject.parseObject(beanJson, MaterialProperty.class);
materialProperty.setId(id); materialProperty.setId(id);
int result=0; int result=0;
try{ try{
result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty); result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
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);
} }
...@@ -107,10 +110,12 @@ public class MaterialPropertyService { ...@@ -107,10 +110,12 @@ public class MaterialPropertyService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMaterialProperty(Long id)throws Exception { public int deleteMaterialProperty(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=materialPropertyMapper.deleteByPrimaryKey(id); result=materialPropertyMapper.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);
} }
...@@ -118,13 +123,14 @@ public class MaterialPropertyService { ...@@ -118,13 +123,14 @@ public class MaterialPropertyService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialProperty(String ids)throws Exception { public int batchDeleteMaterialProperty(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
MaterialPropertyExample example = new MaterialPropertyExample(); MaterialPropertyExample example = new MaterialPropertyExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=materialPropertyMapper.deleteByExample(example); result=materialPropertyMapper.deleteByExample(example);
logService.insertLog("商品属性", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -136,7 +142,7 @@ public class MaterialPropertyService { ...@@ -136,7 +142,7 @@ public class MaterialPropertyService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialPropertyByIds(String ids) throws Exception{ public int batchDeleteMaterialPropertyByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY, 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();
......
...@@ -49,18 +49,18 @@ public class MsgComponent implements ICommonQuery { ...@@ -49,18 +49,18 @@ public class MsgComponent 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 msgService.updateMsg(beanJson, id); return msgService.updateMsg(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return msgService.deleteMsg(id); return msgService.deleteMsg(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return msgService.batchDeleteMsg(ids); return msgService.batchDeleteMsg(ids, request);
} }
@Override @Override
......
...@@ -97,6 +97,7 @@ public class MsgService { ...@@ -97,6 +97,7 @@ public class MsgService {
int result=0; int result=0;
try{ try{
result=msgMapper.insertSelective(msg); result=msgMapper.insertSelective(msg);
logService.insertLog("消息", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]", logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
...@@ -107,12 +108,14 @@ public class MsgService { ...@@ -107,12 +108,14 @@ public class MsgService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMsg(String beanJson, Long id) throws Exception{ public int updateMsg(String beanJson, Long id, HttpServletRequest request) throws Exception{
Msg msg = JSONObject.parseObject(beanJson, Msg.class); Msg msg = JSONObject.parseObject(beanJson, Msg.class);
msg.setId(id); msg.setId(id);
int result=0; int result=0;
try{ try{
result=msgMapper.updateByPrimaryKeySelective(msg); result=msgMapper.updateByPrimaryKeySelective(msg);
logService.insertLog("消息",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]", logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
...@@ -123,10 +126,12 @@ public class MsgService { ...@@ -123,10 +126,12 @@ public class MsgService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMsg(Long id)throws Exception { public int deleteMsg(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=msgMapper.deleteByPrimaryKey(id); result=msgMapper.deleteByPrimaryKey(id);
logService.insertLog("消息",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]", logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
...@@ -137,13 +142,14 @@ public class MsgService { ...@@ -137,13 +142,14 @@ public class MsgService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMsg(String ids) throws Exception{ public int batchDeleteMsg(String ids, HttpServletRequest request) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
MsgExample example = new MsgExample(); MsgExample example = new MsgExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=msgMapper.deleteByExample(example); result=msgMapper.deleteByExample(example);
logService.insertLog("消息", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]", logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e); ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
...@@ -179,7 +185,7 @@ public class MsgService { ...@@ -179,7 +185,7 @@ public class MsgService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMsgByIds(String ids) throws Exception{ public int batchDeleteMsgByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, 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());
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
......
...@@ -45,18 +45,18 @@ public class OrgaUserRelComponent implements ICommonQuery { ...@@ -45,18 +45,18 @@ public class OrgaUserRelComponent 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 orgaUserRelService.updateOrgaUserRel(beanJson,id); return orgaUserRelService.updateOrgaUserRel(beanJson,id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return orgaUserRelService.deleteOrgaUserRel(id); return orgaUserRelService.deleteOrgaUserRel(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return orgaUserRelService.batchDeleteOrgaUserRel(ids); return orgaUserRelService.batchDeleteOrgaUserRel(ids, request);
} }
@Override @Override
......
...@@ -53,41 +53,47 @@ public class OrgaUserRelService { ...@@ -53,41 +53,47 @@ public class OrgaUserRelService {
int result=0; int result=0;
try{ try{
result=orgaUserRelMapper.insertSelective(orgaUserRel); result=orgaUserRelMapper.insertSelective(orgaUserRel);
logService.insertLog("用户与机构关系", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
return result; return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateOrgaUserRel(String beanJson, Long id) throws Exception{ public int updateOrgaUserRel(String beanJson, Long id, HttpServletRequest request) throws Exception{
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class); OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
orgaUserRel.setId(id); orgaUserRel.setId(id);
int result=0; int result=0;
try{ try{
result=orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel); result=orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel);
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);
} }
return result; return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteOrgaUserRel(Long id)throws Exception { public int deleteOrgaUserRel(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=orgaUserRelMapper.deleteByPrimaryKey(id); result=orgaUserRelMapper.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);
} }
return result; return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteOrgaUserRel(String ids)throws Exception { public int batchDeleteOrgaUserRel(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
OrgaUserRelExample example = new OrgaUserRelExample(); OrgaUserRelExample example = new OrgaUserRelExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=orgaUserRelMapper.deleteByExample(example); result=orgaUserRelMapper.deleteByExample(example);
logService.insertLog("用户与机构关系", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
......
...@@ -46,18 +46,18 @@ public class OrganizationComponent implements ICommonQuery { ...@@ -46,18 +46,18 @@ public class OrganizationComponent 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 organizationService.updateOrganization(beanJson,id); return organizationService.updateOrganization(beanJson,id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return organizationService.deleteOrganization(id); return organizationService.deleteOrganization(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return organizationService.batchDeleteOrganization(ids); return organizationService.batchDeleteOrganization(ids, request);
} }
@Override @Override
......
...@@ -56,41 +56,47 @@ public class OrganizationService { ...@@ -56,41 +56,47 @@ public class OrganizationService {
int result=0; int result=0;
try{ try{
result=organizationMapper.insertSelective(organization); result=organizationMapper.insertSelective(organization);
logService.insertLog("机构", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
return result; return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateOrganization(String beanJson, Long id)throws Exception { public int updateOrganization(String beanJson, Long id, HttpServletRequest request)throws Exception {
Organization organization = JSONObject.parseObject(beanJson, Organization.class); Organization organization = JSONObject.parseObject(beanJson, Organization.class);
organization.setId(id); organization.setId(id);
int result=0; int result=0;
try{ try{
result=organizationMapper.updateByPrimaryKeySelective(organization); result=organizationMapper.updateByPrimaryKeySelective(organization);
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);
} }
return result; return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteOrganization(Long id)throws Exception { public int deleteOrganization(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=organizationMapper.deleteByPrimaryKey(id); result=organizationMapper.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);
} }
return result; return result;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteOrganization(String ids)throws Exception { public int batchDeleteOrganization(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
OrganizationExample example = new OrganizationExample(); OrganizationExample example = new OrganizationExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=organizationMapper.deleteByExample(example); result=organizationMapper.deleteByExample(example);
logService.insertLog("机构", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -98,7 +104,7 @@ public class OrganizationService { ...@@ -98,7 +104,7 @@ public class OrganizationService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int addOrganization(Organization org) throws Exception{ public int addOrganization(Organization org) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION, logService.insertLog("机构",
BusinessConstants.LOG_OPERATION_TYPE_ADD, BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//新增时间 //新增时间
...@@ -133,7 +139,7 @@ public class OrganizationService { ...@@ -133,7 +139,7 @@ public class OrganizationService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int editOrganization(Organization org)throws Exception { public int editOrganization(Organization org)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION, logService.insertLog("机构",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//修改时间 //修改时间
...@@ -233,7 +239,7 @@ public class OrganizationService { ...@@ -233,7 +239,7 @@ public class OrganizationService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteOrganizationByIds(String ids) throws Exception{ public int batchDeleteOrganizationByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ORGANIZATION, 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 PersonComponent implements ICommonQuery { ...@@ -52,18 +52,18 @@ public class PersonComponent 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 personService.updatePerson(beanJson, id); return personService.updatePerson(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return personService.deletePerson(id); return personService.deletePerson(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return personService.batchDeletePerson(ids); return personService.batchDeletePerson(ids, request);
} }
@Override @Override
......
...@@ -92,6 +92,7 @@ public class PersonService { ...@@ -92,6 +92,7 @@ public class PersonService {
int result=0; int result=0;
try{ try{
result=personMapper.insertSelective(person); result=personMapper.insertSelective(person);
logService.insertLog("经手人", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -99,12 +100,14 @@ public class PersonService { ...@@ -99,12 +100,14 @@ public class PersonService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updatePerson(String beanJson, Long id)throws Exception { public int updatePerson(String beanJson, Long id, HttpServletRequest request)throws Exception {
Person person = JSONObject.parseObject(beanJson, Person.class); Person person = JSONObject.parseObject(beanJson, Person.class);
person.setId(id); person.setId(id);
int result=0; int result=0;
try{ try{
result=personMapper.updateByPrimaryKeySelective(person); result=personMapper.updateByPrimaryKeySelective(person);
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);
} }
...@@ -112,10 +115,12 @@ public class PersonService { ...@@ -112,10 +115,12 @@ public class PersonService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deletePerson(Long id)throws Exception { public int deletePerson(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=personMapper.deleteByPrimaryKey(id); result=personMapper.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);
} }
...@@ -123,13 +128,14 @@ public class PersonService { ...@@ -123,13 +128,14 @@ public class PersonService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeletePerson(String ids) throws Exception{ public int batchDeletePerson(String ids, HttpServletRequest request) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
PersonExample example = new PersonExample(); PersonExample example = new PersonExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=personMapper.deleteByExample(example); result=personMapper.deleteByExample(example);
logService.insertLog("经手人", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -183,7 +189,7 @@ public class PersonService { ...@@ -183,7 +189,7 @@ public class PersonService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeletePersonByIds(String ids)throws Exception { public int batchDeletePersonByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_PERSON, 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();
......
...@@ -49,18 +49,18 @@ public class RoleComponent implements ICommonQuery { ...@@ -49,18 +49,18 @@ public class RoleComponent 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 roleService.updateRole(beanJson, id); return roleService.updateRole(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return roleService.deleteRole(id); return roleService.deleteRole(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return roleService.batchDeleteRole(ids); return roleService.batchDeleteRole(ids, request);
} }
@Override @Override
......
...@@ -86,6 +86,7 @@ public class RoleService { ...@@ -86,6 +86,7 @@ public class RoleService {
int result=0; int result=0;
try{ try{
result=roleMapper.insertSelective(role); result=roleMapper.insertSelective(role);
logService.insertLog("角色", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -93,12 +94,14 @@ public class RoleService { ...@@ -93,12 +94,14 @@ public class RoleService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateRole(String beanJson, Long id) throws Exception{ public int updateRole(String beanJson, Long id, HttpServletRequest request) throws Exception{
Role role = JSONObject.parseObject(beanJson, Role.class); Role role = JSONObject.parseObject(beanJson, Role.class);
role.setId(id); role.setId(id);
int result=0; int result=0;
try{ try{
result=roleMapper.updateByPrimaryKeySelective(role); result=roleMapper.updateByPrimaryKeySelective(role);
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);
} }
...@@ -106,10 +109,12 @@ public class RoleService { ...@@ -106,10 +109,12 @@ public class RoleService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteRole(Long id)throws Exception { public int deleteRole(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=roleMapper.deleteByPrimaryKey(id); result=roleMapper.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);
} }
...@@ -117,13 +122,14 @@ public class RoleService { ...@@ -117,13 +122,14 @@ public class RoleService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteRole(String ids) throws Exception{ public int batchDeleteRole(String ids, HttpServletRequest request) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
RoleExample example = new RoleExample(); RoleExample example = new RoleExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=roleMapper.deleteByExample(example); result=roleMapper.deleteByExample(example);
logService.insertLog("角色", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -153,7 +159,7 @@ public class RoleService { ...@@ -153,7 +159,7 @@ public class RoleService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteRoleByIds(String ids) throws Exception{ public int batchDeleteRoleByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, 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();
......
...@@ -56,18 +56,18 @@ public class SerialNumberComponent implements ICommonQuery { ...@@ -56,18 +56,18 @@ public class SerialNumberComponent 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 serialNumberService.updateSerialNumber(beanJson, id); return serialNumberService.updateSerialNumber(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return serialNumberService.deleteSerialNumber(id); return serialNumberService.deleteSerialNumber(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return serialNumberService.batchDeleteSerialNumber(ids); return serialNumberService.batchDeleteSerialNumber(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