Commit 1a8b4d89 authored by 乾坤平台's avatar 乾坤平台 Committed by 季圣华
Browse files

!41 全局修改物理删除为逻辑删除,同时修改查询语句过滤删除标识

Merge pull request !41 from 乾坤平台/master
parents 35c6f559 1f2cf8c3
...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.MaterialProperty; ...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.MaterialProperty;
import com.jsh.erp.datasource.entities.MaterialPropertyExample; import com.jsh.erp.datasource.entities.MaterialPropertyExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface MaterialPropertyMapperEx { public interface MaterialPropertyMapperEx {
...@@ -14,4 +15,6 @@ public interface MaterialPropertyMapperEx { ...@@ -14,4 +15,6 @@ public interface MaterialPropertyMapperEx {
@Param("rows") Integer rows); @Param("rows") Integer rows);
Long countsByMaterialProperty(@Param("name") String name); Long countsByMaterialProperty(@Param("name") String name);
int batchDeleteMaterialPropertyByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Person; ...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Person;
import com.jsh.erp.datasource.entities.PersonExample; import com.jsh.erp.datasource.entities.PersonExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface PersonMapperEx { public interface PersonMapperEx {
...@@ -17,4 +18,6 @@ public interface PersonMapperEx { ...@@ -17,4 +18,6 @@ public interface PersonMapperEx {
Long countsByPerson( Long countsByPerson(
@Param("name") String name, @Param("name") String name,
@Param("type") String type); @Param("type") String type);
int batchDeletePersonByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Role; ...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.datasource.entities.RoleExample; import com.jsh.erp.datasource.entities.RoleExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface RoleMapperEx { public interface RoleMapperEx {
...@@ -15,4 +16,6 @@ public interface RoleMapperEx { ...@@ -15,4 +16,6 @@ public interface RoleMapperEx {
Long countsByRole( Long countsByRole(
@Param("name") String name); @Param("name") String name);
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Supplier; ...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Supplier;
import com.jsh.erp.datasource.entities.SupplierExample; import com.jsh.erp.datasource.entities.SupplierExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface SupplierMapperEx { public interface SupplierMapperEx {
...@@ -30,4 +31,6 @@ public interface SupplierMapperEx { ...@@ -30,4 +31,6 @@ public interface SupplierMapperEx {
@Param("phonenum") String phonenum, @Param("phonenum") String phonenum,
@Param("telephone") String telephone, @Param("telephone") String telephone,
@Param("description") String description); @Param("description") String description);
int batchDeleteSupplierByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.SystemConfig; ...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.SystemConfig;
import com.jsh.erp.datasource.entities.SystemConfigExample; import com.jsh.erp.datasource.entities.SystemConfigExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface SystemConfigMapperEx { public interface SystemConfigMapperEx {
...@@ -15,4 +16,6 @@ public interface SystemConfigMapperEx { ...@@ -15,4 +16,6 @@ public interface SystemConfigMapperEx {
Long countsBySystemConfig( Long countsBySystemConfig(
@Param("companyName") String companyName); @Param("companyName") String companyName);
int batchDeleteSystemConfigByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Unit; ...@@ -4,6 +4,7 @@ import com.jsh.erp.datasource.entities.Unit;
import com.jsh.erp.datasource.entities.UnitExample; import com.jsh.erp.datasource.entities.UnitExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface UnitMapperEx { public interface UnitMapperEx {
...@@ -15,4 +16,6 @@ public interface UnitMapperEx { ...@@ -15,4 +16,6 @@ public interface UnitMapperEx {
Long countsByUnit( Long countsByUnit(
@Param("name") String name); @Param("name") String name);
int batchDeleteUnitByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }
\ No newline at end of file
package com.jsh.erp.datasource.mappers;
import org.apache.ibatis.annotations.Param;
import java.util.Date; /**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/29 15:09
*/
public interface UserBusinessMapperEx {
int batchDeleteUserBusinessByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
}
...@@ -7,6 +7,7 @@ import com.jsh.erp.datasource.mappers.*; ...@@ -7,6 +7,7 @@ import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.vo.AccountVo4InOutList; import com.jsh.erp.datasource.vo.AccountVo4InOutList;
import com.jsh.erp.datasource.vo.AccountVo4List; import com.jsh.erp.datasource.vo.AccountVo4List;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools; import com.jsh.erp.utils.Tools;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -45,6 +46,8 @@ public class AccountService { ...@@ -45,6 +46,8 @@ public class AccountService {
private AccountItemMapper accountItemMapper; private AccountItemMapper accountItemMapper;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private UserService userService;
public Account getAccount(long id) { public Account getAccount(long id) {
return accountMapper.selectByPrimaryKey(id); return accountMapper.selectByPrimaryKey(id);
...@@ -112,7 +115,8 @@ public class AccountService { ...@@ -112,7 +115,8 @@ public class AccountService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
AccountExample example = new AccountExample(); AccountExample example = new AccountExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Account> list = accountMapper.selectByExample(example); List<Account> list = accountMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -317,5 +321,13 @@ public class AccountService { ...@@ -317,5 +321,13 @@ public class AccountService {
example.createCriteria().andIdEqualTo(accountId); example.createCriteria().andIdEqualTo(accountId);
return accountMapper.updateByExampleSelective(account, example); return accountMapper.updateByExampleSelective(account, example);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
package com.jsh.erp.service.accountHead; package com.jsh.erp.service.accountHead;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.AccountHead; import com.jsh.erp.datasource.entities.AccountHead;
import com.jsh.erp.datasource.entities.AccountHeadExample; import com.jsh.erp.datasource.entities.AccountHeadExample;
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx; import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.AccountHeadMapper; import com.jsh.erp.datasource.mappers.AccountHeadMapper;
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx; import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools; import com.jsh.erp.utils.Tools;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -28,6 +35,10 @@ public class AccountHeadService { ...@@ -28,6 +35,10 @@ public class AccountHeadService {
@Resource @Resource
private AccountHeadMapperEx accountHeadMapperEx; private AccountHeadMapperEx accountHeadMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public AccountHead getAccountHead(long id) { public AccountHead getAccountHead(long id) {
return accountHeadMapper.selectByPrimaryKey(id); return accountHeadMapper.selectByPrimaryKey(id);
...@@ -87,7 +98,7 @@ public class AccountHeadService { ...@@ -87,7 +98,7 @@ public class AccountHeadService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
AccountHeadExample example = new AccountHeadExample(); AccountHeadExample example = new AccountHeadExample();
example.createCriteria().andIdNotEqualTo(id); example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<AccountHead> list = accountHeadMapper.selectByExample(example); List<AccountHead> list = accountHeadMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -122,5 +133,13 @@ public class AccountHeadService { ...@@ -122,5 +133,13 @@ public class AccountHeadService {
} }
return resList; return resList;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountHeadByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_HEAD,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
...@@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.AccountItem; import com.jsh.erp.datasource.entities.AccountItem;
import com.jsh.erp.datasource.entities.AccountItemExample; import com.jsh.erp.datasource.entities.AccountItemExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.AccountItemMapper; import com.jsh.erp.datasource.mappers.AccountItemMapper;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx; import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.datasource.vo.AccountItemVo4List; import com.jsh.erp.datasource.vo.AccountItemVo4List;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.ErpInfo; import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -22,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -22,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.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
...@@ -37,6 +40,8 @@ public class AccountItemService { ...@@ -37,6 +40,8 @@ public class AccountItemService {
private AccountItemMapperEx accountItemMapperEx; private AccountItemMapperEx accountItemMapperEx;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private UserService userService;
public AccountItem getAccountItem(long id) { public AccountItem getAccountItem(long id) {
return accountItemMapper.selectByPrimaryKey(id); return accountItemMapper.selectByPrimaryKey(id);
...@@ -83,7 +88,7 @@ public class AccountItemService { ...@@ -83,7 +88,7 @@ public class AccountItemService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
AccountItemExample example = new AccountItemExample(); AccountItemExample example = new AccountItemExample();
example.createCriteria().andIdNotEqualTo(id); example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<AccountItem> list = accountItemMapper.selectByExample(example); List<AccountItem> list = accountItemMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -135,10 +140,16 @@ public class AccountItemService { ...@@ -135,10 +140,16 @@ public class AccountItemService {
} }
} }
if (null != deletedJson) { if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) { for (int i = 0; i < deletedJson.size(); i++) {
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i)); JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
this.deleteAccountItem(tempDeletedJson.getLong("Id")); bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
} }
this.batchDeleteAccountItemByIds(bf.toString());
} }
if (null != updatedJson) { if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) { for (int i = 0; i < updatedJson.size(); i++) {
...@@ -168,5 +179,13 @@ public class AccountItemService { ...@@ -168,5 +179,13 @@ public class AccountItemService {
return null; return null;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountItemByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT_ITEM,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return accountItemMapperEx.batchDeleteAccountItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
package com.jsh.erp.service.app; package com.jsh.erp.service.app;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.App; import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.datasource.entities.AppExample; import com.jsh.erp.datasource.entities.AppExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.AppMapper; import com.jsh.erp.datasource.mappers.AppMapper;
import com.jsh.erp.datasource.mappers.AppMapperEx; import com.jsh.erp.datasource.mappers.AppMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -23,6 +30,10 @@ public class AppService { ...@@ -23,6 +30,10 @@ public class AppService {
private AppMapper appMapper; private AppMapper appMapper;
@Resource @Resource
private AppMapperEx appMapperEx; private AppMapperEx appMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public List<App> findDock(){ public List<App> findDock(){
AppExample example = new AppExample(); AppExample example = new AppExample();
...@@ -106,4 +117,13 @@ public class AppService { ...@@ -106,4 +117,13 @@ public class AppService {
List<App> list = appMapper.selectByExample(example); List<App> list = appMapper.selectByExample(example);
return list; return list;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAppByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_APP,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return appMapperEx.batchDeleteAppByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
package com.jsh.erp.service.depot; package com.jsh.erp.service.depot;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Depot; import com.jsh.erp.datasource.entities.Depot;
import com.jsh.erp.datasource.entities.DepotEx; import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.datasource.entities.DepotExample; import com.jsh.erp.datasource.entities.DepotExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.DepotMapper; import com.jsh.erp.datasource.mappers.DepotMapper;
import com.jsh.erp.datasource.mappers.DepotMapperEx; import com.jsh.erp.datasource.mappers.DepotMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -26,6 +33,10 @@ public class DepotService { ...@@ -26,6 +33,10 @@ public class DepotService {
@Resource @Resource
private DepotMapperEx depotMapperEx; private DepotMapperEx depotMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public Depot getDepot(long id) { public Depot getDepot(long id) {
return depotMapper.selectByPrimaryKey(id); return depotMapper.selectByPrimaryKey(id);
...@@ -78,7 +89,7 @@ public class DepotService { ...@@ -78,7 +89,7 @@ public class DepotService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
DepotExample example = new DepotExample(); DepotExample example = new DepotExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Depot> list = depotMapper.selectByExample(example); List<Depot> list = depotMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -102,5 +113,13 @@ public class DepotService { ...@@ -102,5 +113,13 @@ public class DepotService {
public List<DepotEx> getDepotList(Map<String, Object> parameterMap) { public List<DepotEx> getDepotList(Map<String, Object> parameterMap) {
return depotMapperEx.getDepotList(parameterMap); return depotMapperEx.getDepotList(parameterMap);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
...@@ -141,7 +141,7 @@ public class DepotHeadService { ...@@ -141,7 +141,7 @@ public class DepotHeadService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
DepotHeadExample example = new DepotHeadExample(); DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andIdNotEqualTo(id); example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotHead> list = depotHeadMapper.selectByExample(example); List<DepotHead> list = depotHeadMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -366,14 +366,14 @@ public class DepotHeadService { ...@@ -366,14 +366,14 @@ public class DepotHeadService {
if(depotItemList!=null&&depotItemList.size()>0){ if(depotItemList!=null&&depotItemList.size()>0){
for(DepotItem depotItem:depotItemList){ for(DepotItem depotItem:depotItemList){
//BasicNumber=OperNumber*ratio //BasicNumber=OperNumber*ratio
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),depotItem.getBasicnumber().intValue(),userInfo); serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
} }
} }
} }
/**删除单据子表数据*/ /**删除单据子表数据*/
depotItemMapperEx.deleteDepotItemByDepotHeadIds(new Long []{id}); depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long []{id});
/**删除单据主表信息*/ /**删除单据主表信息*/
deleteDepotHead(id); batchDeleteDepotHeadByIds(id.toString());
} }
/** /**
* create by: cjl * create by: cjl
...@@ -391,8 +391,17 @@ public class DepotHeadService { ...@@ -391,8 +391,17 @@ public class DepotHeadService {
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++){
deleteDepotHeadAndDetail(new Long(headIds[i])); deleteDepotHeadAndDetail(Long.valueOf(headIds[i]));
} }
} }
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotHeadByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return depotHeadMapperEx.batchDeleteDepotHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
...@@ -105,7 +105,7 @@ public class DepotItemService { ...@@ -105,7 +105,7 @@ public class DepotItemService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
DepotItemExample example = new DepotItemExample(); DepotItemExample example = new DepotItemExample();
example.createCriteria().andIdNotEqualTo(id); example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotItem> list = depotItemMapper.selectByExample(example); List<DepotItem> list = depotItemMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -248,6 +248,7 @@ public class DepotItemService { ...@@ -248,6 +248,7 @@ public class DepotItemService {
* 更新的需要判断货源是否充足 * 更新的需要判断货源是否充足
* */ * */
if (null != deletedJson) { if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) { for (int i = 0; i < deletedJson.size(); i++) {
//首先回收序列号,如果是调拨,不用处理序列号 //首先回收序列号,如果是调拨,不用处理序列号
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i)); JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
...@@ -265,12 +266,17 @@ public class DepotItemService { ...@@ -265,12 +266,17 @@ public class DepotItemService {
continue; continue;
} }
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){ if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),depotItem.getBasicnumber().intValue(), serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
new Date(),userInfo==null?null:userInfo.getId()); new Date(),userInfo==null?null:userInfo.getId());
} }
} }
this.deleteDepotItem(tempDeletedJson.getLong("Id")); this.deleteDepotItem(tempDeletedJson.getLong("Id"));
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
} }
this.batchDeleteDepotItemByIds(bf.toString());
} }
if (null != insertedJson) { if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) { for (int i = 0; i < insertedJson.size(); i++) {
...@@ -363,7 +369,7 @@ public class DepotItemService { ...@@ -363,7 +369,7 @@ public class DepotItemService {
if(material==null){ if(material==null){
continue; continue;
} }
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){ if(getCurrentInStock(depotItem.getMaterialid())<(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE, throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName())); String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
} }
...@@ -401,7 +407,7 @@ public class DepotItemService { ...@@ -401,7 +407,7 @@ public class DepotItemService {
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过 * 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */ * */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) { if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), depotItem.getBasicnumber().intValue(), serialNumberMapperEx.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
new Date(), userInfo == null ? null : userInfo.getId()); new Date(), userInfo == null ? null : userInfo.getId());
} }
/**收回序列号的时候释放库存*/ /**收回序列号的时候释放库存*/
...@@ -486,7 +492,7 @@ public class DepotItemService { ...@@ -486,7 +492,7 @@ public class DepotItemService {
} }
/**出库时处理序列号*/ /**出库时处理序列号*/
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){ if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(getCurrentInStock(depotItem.getMaterialid())<depotItem.getBasicnumber().intValue()){ if(getCurrentInStock(depotItem.getMaterialid())<(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE, throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName())); String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
} }
...@@ -536,5 +542,13 @@ public class DepotItemService { ...@@ -536,5 +542,13 @@ public class DepotItemService {
int outSum = findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId); int outSum = findByTypeAndMaterialId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId);
return (inSum-outSum); return (inSum-outSum);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotItemByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return depotItemMapperEx.batchDeleteDepotItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
package com.jsh.erp.service.functions; package com.jsh.erp.service.functions;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Functions; import com.jsh.erp.datasource.entities.Functions;
import com.jsh.erp.datasource.entities.FunctionsExample; import com.jsh.erp.datasource.entities.FunctionsExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.FunctionsMapper; import com.jsh.erp.datasource.mappers.FunctionsMapper;
import com.jsh.erp.datasource.mappers.FunctionsMapperEx; import com.jsh.erp.datasource.mappers.FunctionsMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -24,6 +31,10 @@ public class FunctionsService { ...@@ -24,6 +31,10 @@ public class FunctionsService {
@Resource @Resource
private FunctionsMapperEx functionsMapperEx; private FunctionsMapperEx functionsMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public Functions getFunctions(long id) { public Functions getFunctions(long id) {
return functionsMapper.selectByPrimaryKey(id); return functionsMapper.selectByPrimaryKey(id);
...@@ -70,7 +81,7 @@ public class FunctionsService { ...@@ -70,7 +81,7 @@ public class FunctionsService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
FunctionsExample example = new FunctionsExample(); FunctionsExample example = new FunctionsExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Functions> list = functionsMapper.selectByExample(example); List<Functions> list = functionsMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -99,4 +110,13 @@ public class FunctionsService { ...@@ -99,4 +110,13 @@ public class FunctionsService {
List<Functions> list = functionsMapper.selectByExample(example); List<Functions> list = functionsMapper.selectByExample(example);
return list; return list;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteFunctionsByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_FUNCTIONS,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return functionsMapperEx.batchDeleteFunctionsByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
package com.jsh.erp.service.inOutItem; package com.jsh.erp.service.inOutItem;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.InOutItem; import com.jsh.erp.datasource.entities.InOutItem;
import com.jsh.erp.datasource.entities.InOutItemExample; import com.jsh.erp.datasource.entities.InOutItemExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.InOutItemMapper; import com.jsh.erp.datasource.mappers.InOutItemMapper;
import com.jsh.erp.datasource.mappers.InOutItemMapperEx; import com.jsh.erp.datasource.mappers.InOutItemMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -24,6 +31,10 @@ public class InOutItemService { ...@@ -24,6 +31,10 @@ public class InOutItemService {
@Resource @Resource
private InOutItemMapperEx inOutItemMapperEx; private InOutItemMapperEx inOutItemMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public InOutItem getInOutItem(long id) { public InOutItem getInOutItem(long id) {
return inOutItemMapper.selectByPrimaryKey(id); return inOutItemMapper.selectByPrimaryKey(id);
...@@ -70,7 +81,7 @@ public class InOutItemService { ...@@ -70,7 +81,7 @@ public class InOutItemService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
InOutItemExample example = new InOutItemExample(); InOutItemExample example = new InOutItemExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<InOutItem> list = inOutItemMapper.selectByExample(example); List<InOutItem> list = inOutItemMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -85,4 +96,13 @@ public class InOutItemService { ...@@ -85,4 +96,13 @@ public class InOutItemService {
example.setOrderByClause("id desc"); example.setOrderByClause("id desc");
return inOutItemMapper.selectByExample(example); return inOutItemMapper.selectByExample(example);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteInOutItemByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_IN_OUT_ITEM,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return inOutItemMapperEx.batchDeleteInOutItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
...@@ -2,13 +2,11 @@ package com.jsh.erp.service.material; ...@@ -2,13 +2,11 @@ package com.jsh.erp.service.material;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.DepotEx; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.entities.Material;
import com.jsh.erp.datasource.entities.MaterialExample;
import com.jsh.erp.datasource.entities.MaterialVo4Unit;
import com.jsh.erp.datasource.mappers.MaterialMapper; import com.jsh.erp.datasource.mappers.MaterialMapper;
import com.jsh.erp.datasource.mappers.MaterialMapperEx; import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -20,10 +18,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -20,10 +18,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.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service @Service
public class MaterialService { public class MaterialService {
...@@ -35,6 +30,8 @@ public class MaterialService { ...@@ -35,6 +30,8 @@ public class MaterialService {
private MaterialMapperEx materialMapperEx; private MaterialMapperEx materialMapperEx;
@Resource @Resource
private LogService logService; private LogService logService;
@Resource
private UserService userService;
public Material getMaterial(long id) { public Material getMaterial(long id) {
return materialMapper.selectByPrimaryKey(id); return materialMapper.selectByPrimaryKey(id);
...@@ -120,7 +117,7 @@ public class MaterialService { ...@@ -120,7 +117,7 @@ public class MaterialService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
MaterialExample example = new MaterialExample(); MaterialExample example = new MaterialExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Material> list = materialMapper.selectByExample(example); List<Material> list = materialMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -211,4 +208,13 @@ public class MaterialService { ...@@ -211,4 +208,13 @@ public class MaterialService {
public List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap) { public List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap) {
return materialMapperEx.getMaterialEnableSerialNumberList(parameterMap); return materialMapperEx.getMaterialEnableSerialNumberList(parameterMap);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
package com.jsh.erp.service.materialProperty; package com.jsh.erp.service.materialProperty;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.MaterialProperty; import com.jsh.erp.datasource.entities.MaterialProperty;
import com.jsh.erp.datasource.entities.MaterialPropertyExample; import com.jsh.erp.datasource.entities.MaterialPropertyExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.MaterialPropertyMapper; import com.jsh.erp.datasource.mappers.MaterialPropertyMapper;
import com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx; import com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -24,6 +31,10 @@ public class MaterialPropertyService { ...@@ -24,6 +31,10 @@ public class MaterialPropertyService {
@Resource @Resource
private MaterialPropertyMapperEx materialPropertyMapperEx; private MaterialPropertyMapperEx materialPropertyMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public MaterialProperty getMaterialProperty(long id) { public MaterialProperty getMaterialProperty(long id) {
return materialPropertyMapper.selectByPrimaryKey(id); return materialPropertyMapper.selectByPrimaryKey(id);
...@@ -70,4 +81,14 @@ public class MaterialPropertyService { ...@@ -70,4 +81,14 @@ public class MaterialPropertyService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
return 0; return 0;
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialPropertyByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_MATERIAL_PROPERTY,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
...@@ -5,6 +5,7 @@ import com.jsh.erp.constants.BusinessConstants; ...@@ -5,6 +5,7 @@ import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.OrgaUserRelMapper; import com.jsh.erp.datasource.mappers.OrgaUserRelMapper;
import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx; import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.organization.OrganizationService; import com.jsh.erp.service.organization.OrganizationService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
...@@ -34,6 +35,8 @@ public class OrgaUserRelService { ...@@ -34,6 +35,8 @@ public class OrgaUserRelService {
private OrgaUserRelMapperEx orgaUserRelMapperEx; private OrgaUserRelMapperEx orgaUserRelMapperEx;
@Resource @Resource
private UserService userService; private UserService userService;
@Resource
private LogService logService;
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertOrgaUserRel(String beanJson, HttpServletRequest request) { public int insertOrgaUserRel(String beanJson, HttpServletRequest request) {
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class); OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
......
package com.jsh.erp.service.person; package com.jsh.erp.service.person;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Person; import com.jsh.erp.datasource.entities.Person;
import com.jsh.erp.datasource.entities.PersonExample; import com.jsh.erp.datasource.entities.PersonExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.PersonMapper; import com.jsh.erp.datasource.mappers.PersonMapper;
import com.jsh.erp.datasource.mappers.PersonMapperEx; import com.jsh.erp.datasource.mappers.PersonMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
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.Date;
import java.util.List; import java.util.List;
@Service @Service
...@@ -24,6 +31,10 @@ public class PersonService { ...@@ -24,6 +31,10 @@ public class PersonService {
@Resource @Resource
private PersonMapperEx personMapperEx; private PersonMapperEx personMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public Person getPerson(long id) { public Person getPerson(long id) {
return personMapper.selectByPrimaryKey(id); return personMapper.selectByPrimaryKey(id);
...@@ -70,7 +81,7 @@ public class PersonService { ...@@ -70,7 +81,7 @@ public class PersonService {
public int checkIsNameExist(Long id, String name) { public int checkIsNameExist(Long id, String name) {
PersonExample example = new PersonExample(); PersonExample example = new PersonExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name); example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Person> list = personMapper.selectByExample(example); List<Person> list = personMapper.selectByExample(example);
return list.size(); return list.size();
} }
...@@ -97,6 +108,13 @@ public class PersonService { ...@@ -97,6 +108,13 @@ public class PersonService {
return personMapper.selectByExample(example); return personMapper.selectByExample(example);
} }
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeletePersonByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_PERSON,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
} }
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