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

优化日志的记录

parent 47c90a0e
...@@ -94,10 +94,11 @@ public class SerialNumberService { ...@@ -94,10 +94,11 @@ public class SerialNumberService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertSerialNumber(String beanJson, HttpServletRequest request)throws Exception { public int insertSerialNumber(String beanJson, HttpServletRequest request)throws Exception {
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class); SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, BusinessConstants.LOG_OPERATION_TYPE_ADD, request); logService.insertLog("序列号", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
int result=0; int result=0;
try{ try{
result=serialNumberMapper.insertSelective(serialNumber); result=serialNumberMapper.insertSelective(serialNumber);
logService.insertLog("序列号", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -105,12 +106,14 @@ public class SerialNumberService { ...@@ -105,12 +106,14 @@ public class SerialNumberService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateSerialNumber(String beanJson, Long id) throws Exception{ public int updateSerialNumber(String beanJson, Long id, HttpServletRequest request) throws Exception{
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class); SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
serialNumber.setId(id); serialNumber.setId(id);
int result=0; int result=0;
try{ try{
result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber); result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
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);
} }
...@@ -118,10 +121,12 @@ public class SerialNumberService { ...@@ -118,10 +121,12 @@ public class SerialNumberService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteSerialNumber(Long id)throws Exception { public int deleteSerialNumber(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=serialNumberMapper.deleteByPrimaryKey(id); result=serialNumberMapper.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);
} }
...@@ -129,13 +134,14 @@ public class SerialNumberService { ...@@ -129,13 +134,14 @@ public class SerialNumberService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSerialNumber(String ids)throws Exception { public int batchDeleteSerialNumber(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
SerialNumberExample example = new SerialNumberExample(); SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=serialNumberMapper.deleteByExample(example); result=serialNumberMapper.deleteByExample(example);
logService.insertLog("序列号", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -246,7 +252,7 @@ public class SerialNumberService { ...@@ -246,7 +252,7 @@ public class SerialNumberService {
* */ * */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) throws Exception{ public SerialNumberEx addSerialNumber(SerialNumberEx serialNumberEx) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,BusinessConstants.LOG_OPERATION_TYPE_ADD, logService.insertLog("序列号",BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(serialNumberEx==null){ if(serialNumberEx==null){
return null; return null;
...@@ -276,7 +282,7 @@ public class SerialNumberService { ...@@ -276,7 +282,7 @@ public class SerialNumberService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public SerialNumberEx updateSerialNumber(SerialNumberEx serialNumberEx)throws Exception { public SerialNumberEx updateSerialNumber(SerialNumberEx serialNumberEx)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(serialNumberEx==null){ if(serialNumberEx==null){
...@@ -454,7 +460,7 @@ public class SerialNumberService { ...@@ -454,7 +460,7 @@ public class SerialNumberService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark)throws Exception { public void batAddSerialNumber(String materialName, String serialNumberPrefix, Integer batAddTotal, String remark)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER, logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_BATCH_ADD).append(batAddTotal).append(BusinessConstants.LOG_DATA_UNIT).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_BATCH_ADD).append(batAddTotal).append(BusinessConstants.LOG_DATA_UNIT).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(StringUtil.isNotEmpty(materialName)){ if(StringUtil.isNotEmpty(materialName)){
...@@ -505,7 +511,7 @@ public class SerialNumberService { ...@@ -505,7 +511,7 @@ public class SerialNumberService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSerialNumberByIds(String ids) throws Exception{ public int batchDeleteSerialNumberByIds(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();
......
...@@ -58,18 +58,18 @@ public class SupplierComponent implements ICommonQuery { ...@@ -58,18 +58,18 @@ public class SupplierComponent 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 supplierService.updateSupplier(beanJson, id); return supplierService.updateSupplier(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return supplierService.deleteSupplier(id); return supplierService.deleteSupplier(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return supplierService.batchDeleteSupplier(ids); return supplierService.batchDeleteSupplier(ids, request);
} }
@Override @Override
......
...@@ -133,6 +133,7 @@ public class SupplierService { ...@@ -133,6 +133,7 @@ public class SupplierService {
int result=0; int result=0;
try{ try{
result=supplierMapper.insertSelective(supplier); result=supplierMapper.insertSelective(supplier);
logService.insertLog("商家", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -140,7 +141,7 @@ public class SupplierService { ...@@ -140,7 +141,7 @@ public class SupplierService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateSupplier(String beanJson, Long id)throws Exception { public int updateSupplier(String beanJson, Long id, HttpServletRequest request)throws Exception {
Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class); Supplier supplier = JSONObject.parseObject(beanJson, Supplier.class);
if(supplier.getBeginneedpay() == null) { if(supplier.getBeginneedpay() == null) {
supplier.setBeginneedpay(BigDecimal.ZERO); supplier.setBeginneedpay(BigDecimal.ZERO);
...@@ -152,6 +153,8 @@ public class SupplierService { ...@@ -152,6 +153,8 @@ public class SupplierService {
int result=0; int result=0;
try{ try{
result=supplierMapper.updateByPrimaryKeySelective(supplier); result=supplierMapper.updateByPrimaryKeySelective(supplier);
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);
} }
...@@ -159,10 +162,12 @@ public class SupplierService { ...@@ -159,10 +162,12 @@ public class SupplierService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteSupplier(Long id)throws Exception { public int deleteSupplier(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=supplierMapper.deleteByPrimaryKey(id); result=supplierMapper.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);
} }
...@@ -170,13 +175,14 @@ public class SupplierService { ...@@ -170,13 +175,14 @@ public class SupplierService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSupplier(String ids) throws Exception{ public int batchDeleteSupplier(String ids, HttpServletRequest request) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
SupplierExample example = new SupplierExample(); SupplierExample example = new SupplierExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=supplierMapper.deleteByExample(example); result=supplierMapper.deleteByExample(example);
logService.insertLog("商家", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -197,7 +203,7 @@ public class SupplierService { ...@@ -197,7 +203,7 @@ public class SupplierService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn)throws Exception{ public int updateAdvanceIn(Long supplierId, BigDecimal advanceIn)throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, logService.insertLog("商家",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierId).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierId).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
Supplier supplier=null; Supplier supplier=null;
...@@ -275,7 +281,7 @@ public class SupplierService { ...@@ -275,7 +281,7 @@ public class SupplierService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchSetEnable(Boolean enabled, String supplierIDs)throws Exception { public int batchSetEnable(Boolean enabled, String supplierIDs)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, logService.insertLog("商家",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierIDs).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(supplierIDs).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
List<Long> ids = StringUtil.strToLongList(supplierIDs); List<Long> ids = StringUtil.strToLongList(supplierIDs);
...@@ -318,7 +324,7 @@ public class SupplierService { ...@@ -318,7 +324,7 @@ public class SupplierService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public BaseResponseInfo importExcel(List<Supplier> mList) throws Exception { public BaseResponseInfo importExcel(List<Supplier> mList) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, 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();
...@@ -339,7 +345,7 @@ public class SupplierService { ...@@ -339,7 +345,7 @@ public class SupplierService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSupplierByIds(String ids)throws Exception { public int batchDeleteSupplierByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER, 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();
......
...@@ -50,18 +50,18 @@ public class SystemConfigComponent implements ICommonQuery { ...@@ -50,18 +50,18 @@ public class SystemConfigComponent 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 systemConfigService.updateSystemConfig(beanJson, id); return systemConfigService.updateSystemConfig(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return systemConfigService.deleteSystemConfig(id); return systemConfigService.deleteSystemConfig(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return systemConfigService.batchDeleteSystemConfig(ids); return systemConfigService.batchDeleteSystemConfig(ids, request);
} }
@Override @Override
......
...@@ -87,6 +87,7 @@ public class SystemConfigService { ...@@ -87,6 +87,7 @@ public class SystemConfigService {
int result=0; int result=0;
try{ try{
result=systemConfigMapper.insertSelective(systemConfig); result=systemConfigMapper.insertSelective(systemConfig);
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 SystemConfigService { ...@@ -94,12 +95,14 @@ public class SystemConfigService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateSystemConfig(String beanJson, Long id) throws Exception{ public int updateSystemConfig(String beanJson, Long id, HttpServletRequest request) throws Exception{
SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class); SystemConfig systemConfig = JSONObject.parseObject(beanJson, SystemConfig.class);
systemConfig.setId(id); systemConfig.setId(id);
int result=0; int result=0;
try{ try{
result=systemConfigMapper.updateByPrimaryKeySelective(systemConfig); result=systemConfigMapper.updateByPrimaryKeySelective(systemConfig);
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 SystemConfigService { ...@@ -107,10 +110,12 @@ public class SystemConfigService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteSystemConfig(Long id)throws Exception { public int deleteSystemConfig(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=systemConfigMapper.deleteByPrimaryKey(id); result=systemConfigMapper.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 SystemConfigService { ...@@ -118,13 +123,14 @@ public class SystemConfigService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSystemConfig(String ids)throws Exception { public int batchDeleteSystemConfig(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
SystemConfigExample example = new SystemConfigExample(); SystemConfigExample example = new SystemConfigExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=systemConfigMapper.deleteByExample(example); result=systemConfigMapper.deleteByExample(example);
logService.insertLog("系统配置", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -145,7 +151,7 @@ public class SystemConfigService { ...@@ -145,7 +151,7 @@ public class SystemConfigService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSystemConfigByIds(String ids)throws Exception { public int batchDeleteSystemConfigByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG, 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 TenantComponent implements ICommonQuery { ...@@ -49,18 +49,18 @@ public class TenantComponent 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 tenantService.updateTenant(beanJson, id); return tenantService.updateTenant(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return tenantService.deleteTenant(id); return tenantService.deleteTenant(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return tenantService.batchDeleteTenant(ids); return tenantService.batchDeleteTenant(ids, request);
} }
@Override @Override
......
...@@ -83,7 +83,7 @@ public class TenantService { ...@@ -83,7 +83,7 @@ public class TenantService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateTenant(String beanJson, Long id)throws Exception { public int updateTenant(String beanJson, Long id, HttpServletRequest request)throws Exception {
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class); Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
int result=0; int result=0;
try{ try{
...@@ -96,7 +96,7 @@ public class TenantService { ...@@ -96,7 +96,7 @@ public class TenantService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteTenant(Long id)throws Exception { public int deleteTenant(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result= tenantMapper.deleteByPrimaryKey(id); result= tenantMapper.deleteByPrimaryKey(id);
...@@ -107,7 +107,7 @@ public class TenantService { ...@@ -107,7 +107,7 @@ public class TenantService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteTenant(String ids)throws Exception { public int batchDeleteTenant(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
TenantExample example = new TenantExample(); TenantExample example = new TenantExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
......
...@@ -48,18 +48,18 @@ public class UnitComponent implements ICommonQuery { ...@@ -48,18 +48,18 @@ public class UnitComponent 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 unitService.updateUnit(beanJson, id); return unitService.updateUnit(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return unitService.deleteUnit(id); return unitService.deleteUnit(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return unitService.batchDeleteUnit(ids); return unitService.batchDeleteUnit(ids, request);
} }
@Override @Override
......
...@@ -89,6 +89,7 @@ public class UnitService { ...@@ -89,6 +89,7 @@ public class UnitService {
int result=0; int result=0;
try{ try{
result=unitMapper.insertSelective(unit); result=unitMapper.insertSelective(unit);
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 UnitService { ...@@ -96,12 +97,14 @@ public class UnitService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateUnit(String beanJson, Long id)throws Exception { public int updateUnit(String beanJson, Long id, HttpServletRequest request)throws Exception {
Unit unit = JSONObject.parseObject(beanJson, Unit.class); Unit unit = JSONObject.parseObject(beanJson, Unit.class);
unit.setId(id); unit.setId(id);
int result=0; int result=0;
try{ try{
result=unitMapper.updateByPrimaryKeySelective(unit); result=unitMapper.updateByPrimaryKeySelective(unit);
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 UnitService { ...@@ -109,10 +112,12 @@ public class UnitService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteUnit(Long id)throws Exception { public int deleteUnit(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=unitMapper.deleteByPrimaryKey(id); result=unitMapper.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 UnitService { ...@@ -120,13 +125,14 @@ public class UnitService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUnit(String ids) throws Exception{ public int batchDeleteUnit(String ids, HttpServletRequest request) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
UnitExample example = new UnitExample(); UnitExample example = new UnitExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=unitMapper.deleteByExample(example); result=unitMapper.deleteByExample(example);
logService.insertLog("计量单位", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -146,7 +152,7 @@ public class UnitService { ...@@ -146,7 +152,7 @@ public class UnitService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUnitByIds(String ids)throws Exception { public int batchDeleteUnitByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_UNIT, 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();
......
...@@ -50,18 +50,18 @@ public class UserComponent implements ICommonQuery { ...@@ -50,18 +50,18 @@ public class UserComponent 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 userService.updateUser(beanJson, id); return userService.updateUser(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return userService.deleteUser(id); return userService.deleteUser(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return userService.batchDeleteUser(ids); return userService.batchDeleteUser(ids, request);
} }
@Override @Override
......
...@@ -120,6 +120,7 @@ public class UserService { ...@@ -120,6 +120,7 @@ public class UserService {
int result=0; int result=0;
try{ try{
result=userMapper.insertSelective(user); result=userMapper.insertSelective(user);
logService.insertLog("用户", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -135,12 +136,14 @@ public class UserService { ...@@ -135,12 +136,14 @@ public class UserService {
* @return int * @return int
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateUser(String beanJson, Long id) throws Exception{ public int updateUser(String beanJson, Long id, HttpServletRequest request) throws Exception{
User user = JSONObject.parseObject(beanJson, User.class); User user = JSONObject.parseObject(beanJson, User.class);
user.setId(id); user.setId(id);
int result=0; int result=0;
try{ try{
result=userMapper.updateByPrimaryKeySelective(user); result=userMapper.updateByPrimaryKeySelective(user);
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);
} }
...@@ -156,7 +159,7 @@ public class UserService { ...@@ -156,7 +159,7 @@ public class UserService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateUserByObj(User user) throws Exception{ public int updateUserByObj(User user) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(user.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
int result=0; int result=0;
...@@ -178,7 +181,7 @@ public class UserService { ...@@ -178,7 +181,7 @@ public class UserService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int resetPwd(String md5Pwd, Long id) throws Exception{ public int resetPwd(String md5Pwd, Long id) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User user = new User(); User user = new User();
...@@ -194,10 +197,12 @@ public class UserService { ...@@ -194,10 +197,12 @@ public class UserService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteUser(Long id)throws Exception { public int deleteUser(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result= userMapper.deleteByPrimaryKey(id); result= userMapper.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);
} }
...@@ -205,13 +210,14 @@ public class UserService { ...@@ -205,13 +210,14 @@ public class UserService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUser(String ids)throws Exception { public int batchDeleteUser(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
UserExample example = new UserExample(); UserExample example = new UserExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result= userMapper.deleteByExample(example); result= userMapper.deleteByExample(example);
logService.insertLog("用户", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -307,7 +313,7 @@ public class UserService { ...@@ -307,7 +313,7 @@ public class UserService {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE, throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG); ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else { } else {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, logService.insertLog("用户",
BusinessConstants.LOG_OPERATION_TYPE_ADD, BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名 //检查用户名和登录名
...@@ -438,7 +444,7 @@ public class UserService { ...@@ -438,7 +444,7 @@ public class UserService {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE, throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG); ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else { } else {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名 //检查用户名和登录名
...@@ -586,7 +592,7 @@ public class UserService { ...@@ -586,7 +592,7 @@ public class UserService {
* */ * */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void batDeleteUser(String ids) throws Exception{ public void batDeleteUser(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER, 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 idsArray[]=ids.split(","); String idsArray[]=ids.split(",");
......
...@@ -46,18 +46,18 @@ public class UserBusinessComponent implements ICommonQuery { ...@@ -46,18 +46,18 @@ public class UserBusinessComponent 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 userBusinessService.updateUserBusiness(beanJson, id); return userBusinessService.updateUserBusiness(beanJson, id, request);
} }
@Override @Override
public int delete(Long id)throws Exception { public int delete(Long id, HttpServletRequest request)throws Exception {
return userBusinessService.deleteUserBusiness(id); return userBusinessService.deleteUserBusiness(id, request);
} }
@Override @Override
public int batchDelete(String ids)throws Exception { public int batchDelete(String ids, HttpServletRequest request)throws Exception {
return userBusinessService.batchDeleteUserBusiness(ids); return userBusinessService.batchDeleteUserBusiness(ids, request);
} }
@Override @Override
......
...@@ -72,6 +72,7 @@ public class UserBusinessService { ...@@ -72,6 +72,7 @@ public class UserBusinessService {
int result=0; int result=0;
try{ try{
result=userBusinessMapper.insertSelective(userBusiness); result=userBusinessMapper.insertSelective(userBusiness);
logService.insertLog("关联关系", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -79,12 +80,14 @@ public class UserBusinessService { ...@@ -79,12 +80,14 @@ public class UserBusinessService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateUserBusiness(String beanJson, Long id) throws Exception { public int updateUserBusiness(String beanJson, Long id, HttpServletRequest request) throws Exception {
UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class); UserBusiness userBusiness = JSONObject.parseObject(beanJson, UserBusiness.class);
userBusiness.setId(id); userBusiness.setId(id);
int result=0; int result=0;
try{ try{
result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness); result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
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);
} }
...@@ -92,10 +95,12 @@ public class UserBusinessService { ...@@ -92,10 +95,12 @@ public class UserBusinessService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteUserBusiness(Long id)throws Exception { public int deleteUserBusiness(Long id, HttpServletRequest request)throws Exception {
int result=0; int result=0;
try{ try{
result=userBusinessMapper.deleteByPrimaryKey(id); result=userBusinessMapper.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);
} }
...@@ -103,13 +108,14 @@ public class UserBusinessService { ...@@ -103,13 +108,14 @@ public class UserBusinessService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUserBusiness(String ids)throws Exception { public int batchDeleteUserBusiness(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids); List<Long> idList = StringUtil.strToLongList(ids);
UserBusinessExample example = new UserBusinessExample(); UserBusinessExample example = new UserBusinessExample();
example.createCriteria().andIdIn(idList); example.createCriteria().andIdIn(idList);
int result=0; int result=0;
try{ try{
result=userBusinessMapper.deleteByExample(example); result=userBusinessMapper.deleteByExample(example);
logService.insertLog("关联关系", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
...@@ -175,7 +181,7 @@ public class UserBusinessService { ...@@ -175,7 +181,7 @@ public class UserBusinessService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateBtnStr(Long userBusinessId, String btnStr) throws Exception{ public int updateBtnStr(Long userBusinessId, String btnStr) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS, logService.insertLog("关联关系",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(userBusinessId).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
UserBusiness userBusiness = new UserBusiness(); UserBusiness userBusiness = new UserBusiness();
...@@ -220,7 +226,7 @@ public class UserBusinessService { ...@@ -220,7 +226,7 @@ public class UserBusinessService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUserBusinessByIds(String ids) throws Exception{ public int batchDeleteUserBusinessByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS, 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();
......
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