优化删除日志功能
This commit is contained in:
@@ -143,9 +143,6 @@ public class AccountController {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 批量删除账户信息
|
||||
* create time: 2019/3/29 10:49
|
||||
* @Param: ids
|
||||
@@ -156,13 +153,6 @@ public class AccountController {
|
||||
required =false,defaultValue=BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
|
||||
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/10 10:19
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 出于兼容性考虑,没有传递删除类型时,默认为正常删除
|
||||
*/
|
||||
int i=0;
|
||||
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
|
||||
i= accountService.batchDeleteAccountByIdsNormal(ids);
|
||||
|
||||
@@ -77,8 +77,6 @@ public class MaterialExtendService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public String saveDetials(String inserted, String deleted, String updated, String sortList, Long materialId) throws Exception {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
logService.insertLog("商品价格扩展",
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
//转为json
|
||||
JSONArray insertedJson = JSONArray.parseArray(inserted);
|
||||
JSONArray deletedJson = JSONArray.parseArray(deleted);
|
||||
@@ -249,9 +247,6 @@ public class MaterialExtendService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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(",");
|
||||
int result = 0;
|
||||
try{
|
||||
|
||||
@@ -61,6 +61,19 @@ public class AccountService {
|
||||
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{
|
||||
AccountExample example = new AccountExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -442,8 +455,13 @@ public class AccountService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteAccountByIds(String ids) throws Exception{
|
||||
logService.insertLog("账户",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -55,6 +55,19 @@ public class AccountHeadService {
|
||||
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{
|
||||
AccountHeadExample example = new AccountHeadExample();
|
||||
List<AccountHead> list=null;
|
||||
@@ -268,8 +281,13 @@ public class AccountHeadService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteAccountHeadByIds(String ids)throws Exception {
|
||||
logService.insertLog("财务",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -52,6 +53,19 @@ public class DepotService {
|
||||
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 {
|
||||
DepotExample example = new DepotExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -195,8 +209,13 @@ public class DepotService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteDepotByIds(String ids)throws Exception {
|
||||
logService.insertLog("仓库",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -60,7 +60,6 @@ public class DepotHeadService {
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
|
||||
public DepotHead getDepotHead(long id)throws Exception {
|
||||
DepotHead result=null;
|
||||
try{
|
||||
@@ -590,9 +589,6 @@ public class DepotHeadService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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)){
|
||||
String [] headIds=ids.split(",");
|
||||
for(int i=0;i<headIds.length;i++){
|
||||
@@ -602,9 +598,6 @@ public class DepotHeadService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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();
|
||||
String [] idArray=ids.split(",");
|
||||
int result=0;
|
||||
|
||||
@@ -110,7 +110,6 @@ public class DepotItemService {
|
||||
int result =0;
|
||||
try{
|
||||
result=depotItemMapper.insertSelective(depotItem);
|
||||
logService.insertLog("单据明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@@ -124,8 +123,6 @@ public class DepotItemService {
|
||||
int result =0;
|
||||
try{
|
||||
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||
logService.insertLog("单据明细",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
@@ -137,8 +134,6 @@ public class DepotItemService {
|
||||
int result =0;
|
||||
try{
|
||||
result=depotItemMapper.deleteByPrimaryKey(id);
|
||||
logService.insertLog("单据明细",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -153,7 +148,6 @@ public class DepotItemService {
|
||||
int result =0;
|
||||
try{
|
||||
result=depotItemMapper.deleteByExample(example);
|
||||
logService.insertLog("单据明细", "批量删除,id集:" + ids, request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -294,9 +288,6 @@ public class DepotItemService {
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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;
|
||||
try{
|
||||
@@ -609,9 +600,6 @@ public class DepotItemService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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();
|
||||
String [] idArray=ids.split(",");
|
||||
int result =0;
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -50,6 +51,19 @@ public class FunctionsService {
|
||||
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 {
|
||||
FunctionsExample example = new FunctionsExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -84,11 +98,12 @@ public class FunctionsService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
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;
|
||||
try{
|
||||
result=functionsMapper.insertSelective(depot);
|
||||
logService.insertLog("功能", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
result=functionsMapper.insertSelective(functions);
|
||||
logService.insertLog("功能",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(functions.getName()).toString(),request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
@@ -195,8 +210,13 @@ public class FunctionsService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteFunctionsByIds(String ids)throws Exception {
|
||||
logService.insertLog("功能",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,6 +52,19 @@ public class InOutItemService {
|
||||
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 {
|
||||
InOutItemExample example = new InOutItemExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -171,8 +185,13 @@ public class InOutItemService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteInOutItemByIds(String ids)throws Exception {
|
||||
logService.insertLog("收支项目",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -75,6 +75,19 @@ public class MaterialService {
|
||||
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{
|
||||
MaterialExample example = new MaterialExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -592,8 +605,13 @@ public class MaterialService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterialByIds(String ids) throws Exception{
|
||||
logService.insertLog("商品",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -52,6 +52,19 @@ public class MaterialCategoryService {
|
||||
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 {
|
||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||
List<MaterialCategory> list=null;
|
||||
@@ -212,7 +225,7 @@ public class MaterialCategoryService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int addMaterialCategory(MaterialCategory mc) throws Exception {
|
||||
logService.insertLog("商品类型",
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(mc.getName()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
if(mc==null){
|
||||
return 0;
|
||||
@@ -245,8 +258,13 @@ public class MaterialCategoryService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteMaterialCategoryByIds(String ids) throws Exception {
|
||||
logService.insertLog("商品类型",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
//更新时间
|
||||
Date updateDate =new Date();
|
||||
@@ -268,13 +286,12 @@ public class MaterialCategoryService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int editMaterialCategory(MaterialCategory mc) throws Exception{
|
||||
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());
|
||||
if(mc.getParentid()==null){
|
||||
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
|
||||
mc.setParentid(BusinessConstants.MATERIAL_CATEGORY_ROOT_PARENT_ID);
|
||||
}
|
||||
|
||||
//检查商品类型编号是否已存在
|
||||
checkMaterialCategorySerialNo(mc);
|
||||
//更新时间
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -50,6 +51,19 @@ public class OrganizationService {
|
||||
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)
|
||||
public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception {
|
||||
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
||||
@@ -106,7 +120,7 @@ public class OrganizationService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int addOrganization(Organization org) throws Exception{
|
||||
logService.insertLog("机构",
|
||||
BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(org.getOrgFullName()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
//新增时间
|
||||
Date date=new Date();
|
||||
@@ -141,7 +155,7 @@ public class OrganizationService {
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int editOrganization(Organization org)throws Exception {
|
||||
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());
|
||||
//修改时间
|
||||
org.setUpdateTime(new Date());
|
||||
@@ -240,8 +254,13 @@ public class OrganizationService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteOrganizationByIds(String ids) throws Exception{
|
||||
logService.insertLog("机构",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,6 +55,19 @@ public class PersonService {
|
||||
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 {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -190,8 +204,13 @@ public class PersonService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeletePersonByIds(String ids)throws Exception {
|
||||
logService.insertLog("经手人",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,6 +49,19 @@ public class RoleService {
|
||||
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 {
|
||||
RoleExample example = new RoleExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -172,8 +186,13 @@ public class RoleService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteRoleByIds(String ids) throws Exception{
|
||||
logService.insertLog("序列号",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -59,6 +59,19 @@ public class SerialNumberService {
|
||||
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 {
|
||||
SerialNumberExample example = new SerialNumberExample();
|
||||
List<SerialNumber> list=null;
|
||||
@@ -511,8 +524,13 @@ public class SerialNumberService {
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSerialNumberByIds(String ids) throws Exception{
|
||||
logService.insertLog("序列号",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -63,6 +63,19 @@ public class SupplierService {
|
||||
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 {
|
||||
SupplierExample example = new SupplierExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -346,8 +359,13 @@ public class SupplierService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSupplierByIds(String ids)throws Exception {
|
||||
logService.insertLog("商家",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,6 +52,19 @@ public class UnitService {
|
||||
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 {
|
||||
UnitExample example = new UnitExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -153,8 +167,13 @@ public class UnitService {
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteUnitByIds(String ids)throws Exception {
|
||||
logService.insertLog("计量单位",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
@@ -66,6 +66,19 @@ public class UserService {
|
||||
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 {
|
||||
UserExample example = new UserExample();
|
||||
example.createCriteria().andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
|
||||
@@ -605,8 +618,13 @@ public class UserService {
|
||||
* */
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void batDeleteUser(String ids) throws Exception{
|
||||
logService.insertLog("用户",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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());
|
||||
String idsArray[]=ids.split(",");
|
||||
int result =0;
|
||||
|
||||
Reference in New Issue
Block a user