优化删除日志功能

This commit is contained in:
季圣华
2020-06-10 00:34:26 +08:00
parent 5168a11b1e
commit 753c865deb
18 changed files with 295 additions and 70 deletions

View File

@@ -143,9 +143,6 @@ public class AccountController {
} }
} }
/** /**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 批量删除账户信息 * 批量删除账户信息
* create time: 2019/3/29 10:49 * create time: 2019/3/29 10:49
* @Param: ids * @Param: ids
@@ -156,13 +153,6 @@ public class AccountController {
required =false,defaultValue=BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception { required =false,defaultValue=BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess(); JSONObject result = ExceptionConstants.standardSuccess();
/**
* create by: qiankunpingtai
* create time: 2019/4/10 10:19
* websitehttps://qiankunpingtai.cn
* description:
* 出于兼容性考虑,没有传递删除类型时,默认为正常删除
*/
int i=0; int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){ if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= accountService.batchDeleteAccountByIdsNormal(ids); i= accountService.batchDeleteAccountByIdsNormal(ids);

View File

@@ -77,8 +77,6 @@ public class MaterialExtendService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, String sortList, Long materialId) throws Exception { public String saveDetials(String inserted, String deleted, String updated, String sortList, Long materialId) throws Exception {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
logService.insertLog("商品价格扩展",
BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
//转为json //转为json
JSONArray insertedJson = JSONArray.parseArray(inserted); JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted); JSONArray deletedJson = JSONArray.parseArray(deleted);
@@ -249,9 +247,6 @@ public class MaterialExtendService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialExtendByIds(String ids, HttpServletRequest request) throws Exception{ public int batchDeleteMaterialExtendByIds(String ids, HttpServletRequest request) throws Exception{
logService.insertLog("商品价格扩展",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
int result = 0; int result = 0;
try{ try{

View File

@@ -61,6 +61,19 @@ public class AccountService {
return accountMapper.selectByPrimaryKey(id); return accountMapper.selectByPrimaryKey(id);
} }
public List<Account> getAccountListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Account> list = new ArrayList<>();
try{
AccountExample example = new AccountExample();
example.createCriteria().andIdIn(idList);
list = accountMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Account> getAccount() throws Exception{ public List<Account> getAccount() throws Exception{
AccountExample example = new AccountExample(); AccountExample example = new AccountExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -442,8 +455,13 @@ public class AccountService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountByIds(String ids) throws Exception{ public int batchDeleteAccountByIds(String ids) throws Exception{
logService.insertLog("账户", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Account> list = getAccountListByIds(ids);
for(Account account: list){
sb.append("[").append(account.getName()).append("]");
}
logService.insertLog("账户", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -55,6 +55,19 @@ public class AccountHeadService {
return result; return result;
} }
public List<AccountHead> getAccountHeadListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<AccountHead> list = new ArrayList<>();
try{
AccountHeadExample example = new AccountHeadExample();
example.createCriteria().andIdIn(idList);
list = accountHeadMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<AccountHead> getAccountHead() throws Exception{ public List<AccountHead> getAccountHead() throws Exception{
AccountHeadExample example = new AccountHeadExample(); AccountHeadExample example = new AccountHeadExample();
List<AccountHead> list=null; List<AccountHead> list=null;
@@ -268,8 +281,13 @@ public class AccountHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountHeadByIds(String ids)throws Exception { public int batchDeleteAccountHeadByIds(String ids)throws Exception {
logService.insertLog("财务", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<AccountHead> list = getAccountHeadListByIds(ids);
for(AccountHead accountHead: list){
sb.append("[").append(accountHead.getBillno()).append("]");
}
logService.insertLog("财务", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -20,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -52,6 +53,19 @@ public class DepotService {
return result; return result;
} }
public List<Depot> getDepotListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Depot> list = new ArrayList<>();
try{
DepotExample example = new DepotExample();
example.createCriteria().andIdIn(idList);
list = depotMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Depot> getDepot()throws Exception { public List<Depot> getDepot()throws Exception {
DepotExample example = new DepotExample(); DepotExample example = new DepotExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -195,8 +209,13 @@ public class DepotService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIds(String ids)throws Exception { public int batchDeleteDepotByIds(String ids)throws Exception {
logService.insertLog("仓库", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Depot> list = getDepotListByIds(ids);
for(Depot depot: list){
sb.append("[").append(depot.getName()).append("]");
}
logService.insertLog("仓库", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -60,7 +60,6 @@ public class DepotHeadService {
@Resource @Resource
private LogService logService; private LogService logService;
public DepotHead getDepotHead(long id)throws Exception { public DepotHead getDepotHead(long id)throws Exception {
DepotHead result=null; DepotHead result=null;
try{ try{
@@ -590,9 +589,6 @@ public class DepotHeadService {
*/ */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void batchDeleteDepotHeadAndDetail(String ids) throws Exception{ public void batchDeleteDepotHeadAndDetail(String ids) throws Exception{
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(StringUtil.isNotEmpty(ids)){ if(StringUtil.isNotEmpty(ids)){
String [] headIds=ids.split(","); String [] headIds=ids.split(",");
for(int i=0;i<headIds.length;i++){ for(int i=0;i<headIds.length;i++){
@@ -602,9 +598,6 @@ public class DepotHeadService {
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotHeadByIds(String ids)throws Exception { public int batchDeleteDepotHeadByIds(String ids)throws Exception {
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
int result=0; int result=0;

View File

@@ -110,7 +110,6 @@ public class DepotItemService {
int result =0; int result =0;
try{ try{
result=depotItemMapper.insertSelective(depotItem); result=depotItemMapper.insertSelective(depotItem);
logService.insertLog("单据明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
@@ -124,8 +123,6 @@ public class DepotItemService {
int result =0; int result =0;
try{ try{
result=depotItemMapper.updateByPrimaryKeySelective(depotItem); result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
@@ -137,8 +134,6 @@ public class DepotItemService {
int result =0; int result =0;
try{ try{
result=depotItemMapper.deleteByPrimaryKey(id); result=depotItemMapper.deleteByPrimaryKey(id);
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
@@ -153,7 +148,6 @@ public class DepotItemService {
int result =0; int result =0;
try{ try{
result=depotItemMapper.deleteByExample(example); result=depotItemMapper.deleteByExample(example);
logService.insertLog("单据明细", "批量删除,id集:" + ids, request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
@@ -294,9 +288,6 @@ public class DepotItemService {
* */ * */
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{ public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{
logService.insertLog("单据明细",
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息 //查询单据主表信息
DepotHead depotHead=null; DepotHead depotHead=null;
try{ try{
@@ -609,9 +600,6 @@ public class DepotItemService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotItemByIds(String ids)throws Exception { public int batchDeleteDepotItemByIds(String ids)throws Exception {
logService.insertLog("单据明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");
int result =0; int result =0;

View File

@@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -50,6 +51,19 @@ public class FunctionsService {
return result; return result;
} }
public List<Functions> getFunctionsListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Functions> list = new ArrayList<>();
try{
FunctionsExample example = new FunctionsExample();
example.createCriteria().andIdIn(idList);
list = functionsMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Functions> getFunctions()throws Exception { public List<Functions> getFunctions()throws Exception {
FunctionsExample example = new FunctionsExample(); FunctionsExample example = new FunctionsExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -84,11 +98,12 @@ public class FunctionsService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertFunctions(String beanJson, HttpServletRequest request)throws Exception { public int insertFunctions(String beanJson, HttpServletRequest request)throws Exception {
Functions depot = JSONObject.parseObject(beanJson, Functions.class); Functions functions = JSONObject.parseObject(beanJson, Functions.class);
int result=0; int result=0;
try{ try{
result=functionsMapper.insertSelective(depot); result=functionsMapper.insertSelective(functions);
logService.insertLog("功能", BusinessConstants.LOG_OPERATION_TYPE_ADD, request); logService.insertLog("功能",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(functions.getName()).toString(),request);
}catch(Exception e){ }catch(Exception e){
JshException.writeFail(logger, e); JshException.writeFail(logger, e);
} }
@@ -195,8 +210,13 @@ public class FunctionsService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteFunctionsByIds(String ids)throws Exception { public int batchDeleteFunctionsByIds(String ids)throws Exception {
logService.insertLog("功能", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Functions> list = getFunctionsListByIds(ids);
for(Functions functions: list){
sb.append("[").append(functions.getName()).append("]");
}
logService.insertLog("功能", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -51,6 +52,19 @@ public class InOutItemService {
return result; return result;
} }
public List<InOutItem> getInOutItemListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<InOutItem> list = new ArrayList<>();
try{
InOutItemExample example = new InOutItemExample();
example.createCriteria().andIdIn(idList);
list = inOutItemMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<InOutItem> getInOutItem()throws Exception { public List<InOutItem> getInOutItem()throws Exception {
InOutItemExample example = new InOutItemExample(); InOutItemExample example = new InOutItemExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -171,8 +185,13 @@ 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("收支项目", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<InOutItem> list = getInOutItemListByIds(ids);
for(InOutItem inOutItem: list){
sb.append("[").append(inOutItem.getName()).append("]");
}
logService.insertLog("收支项目", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -75,6 +75,19 @@ public class MaterialService {
return result; return result;
} }
public List<Material> getMaterialListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Material> list = new ArrayList<>();
try{
MaterialExample example = new MaterialExample();
example.createCriteria().andIdIn(idList);
list = materialMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Material> getMaterial() throws Exception{ public List<Material> getMaterial() throws Exception{
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -592,8 +605,13 @@ 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("商品", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Material> list = getMaterialListByIds(ids);
for(Material material: list){
sb.append("[").append(material.getName()).append("]");
}
logService.insertLog("商品", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -52,6 +52,19 @@ public class MaterialCategoryService {
return result; return result;
} }
public List<MaterialCategory> getMaterialCategoryListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<MaterialCategory> list = new ArrayList<>();
try{
MaterialCategoryExample example = new MaterialCategoryExample();
example.createCriteria().andIdIn(idList);
list = materialCategoryMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<MaterialCategory> getMaterialCategory()throws Exception { public List<MaterialCategory> getMaterialCategory()throws Exception {
MaterialCategoryExample example = new MaterialCategoryExample(); MaterialCategoryExample example = new MaterialCategoryExample();
List<MaterialCategory> list=null; List<MaterialCategory> list=null;
@@ -212,7 +225,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("商品类型", logService.insertLog("商品类型",
BusinessConstants.LOG_OPERATION_TYPE_ADD, new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(mc.getName()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(mc==null){ if(mc==null){
return 0; return 0;
@@ -245,8 +258,13 @@ 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("商品类型", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<MaterialCategory> list = getMaterialCategoryListByIds(ids);
for(MaterialCategory materialCategory: list){
sb.append("[").append(materialCategory.getName()).append("]");
}
logService.insertLog("商品类型", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//更新时间 //更新时间
Date updateDate =new Date(); Date updateDate =new Date();
@@ -268,13 +286,12 @@ 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("商品类型", logService.insertLog("商品类型",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(mc.getName()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
if(mc.getParentid()==null){ if(mc.getParentid()==null){
//没有给定父级目录的id默认设置父级目录为根目录的父目录 //没有给定父级目录的id默认设置父级目录为根目录的父目录
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID); mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
} }
//检查商品类型编号是否已存在 //检查商品类型编号是否已存在
checkMaterialCategorySerialNo(mc); checkMaterialCategorySerialNo(mc);
//更新时间 //更新时间

View File

@@ -24,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -50,6 +51,19 @@ public class OrganizationService {
return organizationMapper.selectByPrimaryKey(id); return organizationMapper.selectByPrimaryKey(id);
} }
public List<Organization> getOrganizationListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Organization> list = new ArrayList<>();
try{
OrganizationExample example = new OrganizationExample();
example.createCriteria().andIdIn(idList);
list = organizationMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception { public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception {
Organization organization = JSONObject.parseObject(beanJson, Organization.class); Organization organization = JSONObject.parseObject(beanJson, Organization.class);
@@ -106,7 +120,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("机构", logService.insertLog("机构",
BusinessConstants.LOG_OPERATION_TYPE_ADD, new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(org.getOrgFullName()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//新增时间 //新增时间
Date date=new Date(); Date date=new Date();
@@ -141,7 +155,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("机构", logService.insertLog("机构",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getId()).toString(), new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(org.getOrgFullName()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//修改时间 //修改时间
org.setUpdateTime(new Date()); org.setUpdateTime(new Date());
@@ -240,8 +254,13 @@ 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("机构", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Organization> list = getOrganizationListByIds(ids);
for(Organization organization: list){
sb.append("[").append(organization.getOrgFullName()).append("]");
}
logService.insertLog("机构", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -54,6 +55,19 @@ public class PersonService {
return result; return result;
} }
public List<Person> getPersonListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Person> list = new ArrayList<>();
try{
PersonExample example = new PersonExample();
example.createCriteria().andIdIn(idList);
list = personMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Person> getPerson()throws Exception { public List<Person> getPerson()throws Exception {
PersonExample example = new PersonExample(); PersonExample example = new PersonExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -190,8 +204,13 @@ 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("经手人", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Person> list = getPersonListByIds(ids);
for(Person person: list){
sb.append("[").append(person.getName()).append("]");
}
logService.insertLog("经手人", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -48,6 +49,19 @@ public class RoleService {
return result; return result;
} }
public List<Role> getRoleListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Role> list = new ArrayList<>();
try{
RoleExample example = new RoleExample();
example.createCriteria().andIdIn(idList);
list = roleMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Role> getRole()throws Exception { public List<Role> getRole()throws Exception {
RoleExample example = new RoleExample(); RoleExample example = new RoleExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -172,8 +186,13 @@ 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("序列号", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Role> list = getRoleListByIds(ids);
for(Role role: list){
sb.append("[").append(role.getName()).append("]");
}
logService.insertLog("角色", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -59,6 +59,19 @@ public class SerialNumberService {
return result; return result;
} }
public List<SerialNumber> getSerialNumberListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<SerialNumber> list = new ArrayList<>();
try{
SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdIn(idList);
list = serialNumberMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<SerialNumber> getSerialNumber()throws Exception { public List<SerialNumber> getSerialNumber()throws Exception {
SerialNumberExample example = new SerialNumberExample(); SerialNumberExample example = new SerialNumberExample();
List<SerialNumber> list=null; List<SerialNumber> list=null;
@@ -511,8 +524,13 @@ 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("序列号", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<SerialNumber> list = getSerialNumberListByIds(ids);
for(SerialNumber serialNumber: list){
sb.append("[").append(serialNumber.getSerialNumber()).append("]");
}
logService.insertLog("序列号", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -63,6 +63,19 @@ public class SupplierService {
return result; return result;
} }
public List<Supplier> getSupplierListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Supplier> list = new ArrayList<>();
try{
SupplierExample example = new SupplierExample();
example.createCriteria().andIdIn(idList);
list = supplierMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Supplier> getSupplier()throws Exception { public List<Supplier> getSupplier()throws Exception {
SupplierExample example = new SupplierExample(); SupplierExample example = new SupplierExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -346,8 +359,13 @@ 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("商家", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Supplier> list = getSupplierListByIds(ids);
for(Supplier supplier: list){
sb.append("[").append(supplier.getSupplier()).append("]");
}
logService.insertLog("商家", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -51,6 +52,19 @@ public class UnitService {
return result; return result;
} }
public List<Unit> getUnitListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<Unit> list = new ArrayList<>();
try{
UnitExample example = new UnitExample();
example.createCriteria().andIdIn(idList);
list = unitMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Unit> getUnit()throws Exception { public List<Unit> getUnit()throws Exception {
UnitExample example = new UnitExample(); UnitExample example = new UnitExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -153,8 +167,13 @@ 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("计量单位", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<Unit> list = getUnitListByIds(ids);
for(Unit unit: list){
sb.append("[").append(unit.getUname()).append("]");
}
logService.insertLog("计量单位", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser(); User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(","); String [] idArray=ids.split(",");

View File

@@ -66,6 +66,19 @@ public class UserService {
return result; return result;
} }
public List<User> getUserListByIds(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
List<User> list = new ArrayList<>();
try{
UserExample example = new UserExample();
example.createCriteria().andIdIn(idList);
list = userMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<User> getUser()throws Exception { public List<User> getUser()throws Exception {
UserExample example = new UserExample(); UserExample example = new UserExample();
example.createCriteria().andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL); example.createCriteria().andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
@@ -605,8 +618,13 @@ 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("用户", StringBuffer sb = new StringBuffer();
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(), sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<User> list = getUserListByIds(ids);
for(User user: list){
sb.append("[").append(user.getLoginName()).append("]");
}
logService.insertLog("用户", sb.toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
String idsArray[]=ids.split(","); String idsArray[]=ids.split(",");
int result =0; int result =0;