给单据等其它模块优化接口
This commit is contained in:
@@ -1,137 +0,0 @@
|
||||
package com.jsh.erp.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author jishenghua 752718920 2018-10-7 15:25:58
|
||||
*/
|
||||
@Service
|
||||
public class CommonQueryManager {
|
||||
|
||||
@Resource
|
||||
private InterfaceContainer container;
|
||||
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
/**
|
||||
* 查询单条
|
||||
*
|
||||
* @param apiName 接口名称
|
||||
* @param id ID
|
||||
*/
|
||||
public Object selectOne(String apiName, Long id) throws Exception {
|
||||
if (StringUtil.isNotEmpty(apiName) && id!=null) {
|
||||
return container.getCommonQuery(apiName).selectOne(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param apiName
|
||||
* @param parameterMap
|
||||
* @return
|
||||
*/
|
||||
public List<?> select(String apiName, Map<String, String> parameterMap)throws Exception {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).select(parameterMap);
|
||||
}
|
||||
return new ArrayList<Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计数
|
||||
* @param apiName
|
||||
* @param parameterMap
|
||||
* @return
|
||||
*/
|
||||
public Long counts(String apiName, Map<String, String> parameterMap)throws Exception {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).counts(parameterMap);
|
||||
}
|
||||
return BusinessConstants.DEFAULT_LIST_NULL_NUMBER;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入
|
||||
* @param apiName
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insert(String apiName, JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).insert(obj, request);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param apiName
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int update(String apiName, JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).update(obj, request);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param apiName
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int delete(String apiName, Long id, HttpServletRequest request)throws Exception {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).delete(id, request);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param apiName
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteBatch(String apiName, String ids, HttpServletRequest request)throws Exception {
|
||||
if (StringUtil.isNotEmpty(apiName)) {
|
||||
return container.getCommonQuery(apiName).deleteBatch(ids, request);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在
|
||||
* @param apiName
|
||||
* @param id
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public int checkIsNameExist(String apiName, Long id, String name) throws Exception{
|
||||
if (StringUtil.isNotEmpty(apiName) && name!=null) {
|
||||
return container.getCommonQuery(apiName).checkIsNameExist(id, name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.jsh.erp.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用查询接口
|
||||
* 功能:1、单条查询 2、分页+搜索 3、查询数量
|
||||
*
|
||||
* @author jishenghua
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ICommonQuery {
|
||||
/**
|
||||
* 根据id查询明细。
|
||||
*
|
||||
* @param id 资源id
|
||||
* @return 资源
|
||||
*/
|
||||
Object selectOne(Long id) throws Exception;
|
||||
|
||||
/**
|
||||
* 自定义查询
|
||||
*
|
||||
* @param parameterMap 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<?> select(Map<String, String> parameterMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询数量
|
||||
*
|
||||
* @param parameterMap 查询参数
|
||||
* @return 查询结果
|
||||
*/
|
||||
Long counts(Map<String, String> parameterMap) throws Exception;
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
int insert(JSONObject obj, HttpServletRequest request) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新数据
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
int update(JSONObject obj, HttpServletRequest request) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int delete(Long id, HttpServletRequest request) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量删除数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int deleteBatch(String ids, HttpServletRequest request) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询名称是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int checkIsNameExist(Long id, String name) throws Exception;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.jsh.erp.service;
|
||||
|
||||
import com.jsh.erp.utils.AnnotationUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author jishenghua 2018-10-7 15:25:09
|
||||
*/
|
||||
@Service
|
||||
public class InterfaceContainer {
|
||||
private final Map<String, ICommonQuery> configComponentMap = new HashMap<>();
|
||||
|
||||
@Autowired(required = false)
|
||||
private synchronized void init(ICommonQuery[] configComponents) {
|
||||
for (ICommonQuery configComponent : configComponents) {
|
||||
ResourceInfo info = AnnotationUtils.getAnnotation(configComponent, ResourceInfo.class);
|
||||
if (info != null) {
|
||||
configComponentMap.put(info.value(), configComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ICommonQuery getCommonQuery(String apiName) {
|
||||
return configComponentMap.get(apiName);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.jsh.erp.service;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua 2018-10-7 15:25:39
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
public @interface ResourceInfo {
|
||||
String value();
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package com.jsh.erp.service.accountHead;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "accountHead_component")
|
||||
@AccountHeadResource
|
||||
public class AccountHeadComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private AccountHeadService accountHeadService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return accountHeadService.getAccountHead(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getAccountHeadList(map);
|
||||
}
|
||||
|
||||
private List<?> getAccountHeadList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String billNo = StringUtil.getInfo(search, "billNo");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
|
||||
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
|
||||
Long handsPersonId = StringUtil.parseStrLong(StringUtil.getInfo(search, "handsPersonId"));
|
||||
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
|
||||
String status = StringUtil.getInfo(search, "status");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String number = StringUtil.getInfo(search, "number");
|
||||
return accountHeadService.select(type, billNo, beginTime, endTime, organId, creator, handsPersonId,
|
||||
accountId, status, remark, number, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String billNo = StringUtil.getInfo(search, "billNo");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
|
||||
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
|
||||
Long handsPersonId = StringUtil.parseStrLong(StringUtil.getInfo(search, "handsPersonId"));
|
||||
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
|
||||
String status = StringUtil.getInfo(search, "status");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String number = StringUtil.getInfo(search, "number");
|
||||
return accountHeadService.countAccountHead(type, billNo, beginTime, endTime, organId, creator, handsPersonId,
|
||||
accountId, status, remark, number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return accountHeadService.insertAccountHead(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return accountHeadService.updateAccountHead(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return accountHeadService.deleteAccountHead(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return accountHeadService.batchDeleteAccountHead(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.accountHead;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "accountHead")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AccountHeadResource {
|
||||
}
|
||||
@@ -12,12 +12,12 @@ import com.jsh.erp.datasource.mappers.AccountMapper;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||
import com.jsh.erp.service.depotHead.DepotHeadService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
||||
import com.jsh.erp.service.supplier.SupplierService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
@@ -96,14 +96,15 @@ public class AccountHeadService {
|
||||
|
||||
public List<AccountHeadVo4ListEx> select(String type, String billNo, String beginTime, String endTime,
|
||||
Long organId, Long creator, Long handsPersonId, Long accountId, String status,
|
||||
String remark, String number, int offset, int rows) throws Exception{
|
||||
List<AccountHeadVo4ListEx> resList = new ArrayList<>();
|
||||
String remark, String number) throws Exception{
|
||||
List<AccountHeadVo4ListEx> list = new ArrayList<>();
|
||||
try{
|
||||
String [] creatorArray = getCreatorArray();
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo,
|
||||
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, number, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo,
|
||||
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, number);
|
||||
if (null != list) {
|
||||
for (AccountHeadVo4ListEx ah : list) {
|
||||
if(ah.getChangeAmount() != null) {
|
||||
@@ -127,29 +128,12 @@ public class AccountHeadService {
|
||||
if(ah.getBillTime() !=null) {
|
||||
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
||||
}
|
||||
resList.add(ah);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
public Long countAccountHead(String type, String billNo, String beginTime, String endTime,
|
||||
Long organId, Long creator, Long handsPersonId, Long accountId, String status,
|
||||
String remark, String number) throws Exception{
|
||||
Long result=null;
|
||||
try{
|
||||
String [] creatorArray = getCreatorArray();
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
result = accountHeadMapperEx.countsByAccountHead(type, creatorArray, billNo,
|
||||
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, number);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.jsh.erp.service.accountItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "accountItem_component")
|
||||
@AccountItemResource
|
||||
public class AccountItemComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private AccountItemService accountItemService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return accountItemService.getAccountItem(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getAccountItemList(map);
|
||||
}
|
||||
|
||||
private List<?> getAccountItemList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String order = QueryUtils.order(map);
|
||||
return accountItemService.select(name, type, remark, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
return accountItemService.countAccountItem(name, type, remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return accountItemService.insertAccountItem(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return accountItemService.updateAccountItem(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return accountItemService.deleteAccountItem(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return accountItemService.batchDeleteAccountItem(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return accountItemService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.accountItem;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "accountItem")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AccountItemResource {
|
||||
}
|
||||
@@ -46,16 +46,6 @@ public class AccountItemService {
|
||||
@Resource
|
||||
private DepotHeadService depotHeadService;
|
||||
|
||||
public AccountItem getAccountItem(long id)throws Exception {
|
||||
AccountItem result=null;
|
||||
try{
|
||||
result=accountItemMapper.selectByPrimaryKey(id);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<AccountItem> getAccountItem()throws Exception {
|
||||
AccountItemExample example = new AccountItemExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -78,71 +68,6 @@ public class AccountItemService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countAccountItem(String name, Integer type, String remark)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result = accountItemMapperEx.countsByAccountItem(name, type, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertAccountItem(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
AccountItem accountItem = JSONObject.parseObject(obj.toJSONString(), AccountItem.class);
|
||||
int result=0;
|
||||
try{
|
||||
result = accountItemMapper.insertSelective(accountItem);
|
||||
logService.insertLog("财务明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateAccountItem(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
AccountItem accountItem = JSONObject.parseObject(obj.toJSONString(), AccountItem.class);
|
||||
int result=0;
|
||||
try{
|
||||
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
|
||||
logService.insertLog("财务明细",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountItem.getId()).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteAccountItem(Long id, HttpServletRequest request)throws Exception {
|
||||
int result=0;
|
||||
try{
|
||||
result = accountItemMapper.deleteByPrimaryKey(id);
|
||||
logService.insertLog("财务明细",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteAccountItem(String ids, HttpServletRequest request)throws Exception {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
AccountItemExample example = new AccountItemExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
int result=0;
|
||||
try{
|
||||
result = accountItemMapper.deleteByExample(example);
|
||||
logService.insertLog("财务明细", "批量删除,id集:" + ids, request);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
AccountItemExample example = new AccountItemExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.jsh.erp.service.depotHead;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "depotHead_component")
|
||||
@DepotHeadResource
|
||||
public class DepotHeadComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private DepotHeadService depotHeadService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return depotHeadService.getDepotHead(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getDepotHeadList(map);
|
||||
}
|
||||
|
||||
private List<?> getDepotHeadList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String subType = StringUtil.getInfo(search, "subType");
|
||||
String hasDebt = StringUtil.getInfo(search, "hasDebt");
|
||||
String status = StringUtil.getInfo(search, "status");
|
||||
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
|
||||
String number = StringUtil.getInfo(search, "number");
|
||||
String linkApply = StringUtil.getInfo(search, "linkApply");
|
||||
String linkNumber = StringUtil.getInfo(search, "linkNumber");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String materialParam = StringUtil.getInfo(search, "materialParam");
|
||||
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
|
||||
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
|
||||
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
|
||||
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
return depotHeadService.select(type, subType, hasDebt, status, purchaseStatus, number, linkApply, linkNumber,
|
||||
beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String subType = StringUtil.getInfo(search, "subType");
|
||||
String hasDebt = StringUtil.getInfo(search, "hasDebt");
|
||||
String status = StringUtil.getInfo(search, "status");
|
||||
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
|
||||
String number = StringUtil.getInfo(search, "number");
|
||||
String linkApply = StringUtil.getInfo(search, "linkApply");
|
||||
String linkNumber = StringUtil.getInfo(search, "linkNumber");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String materialParam = StringUtil.getInfo(search, "materialParam");
|
||||
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
|
||||
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
|
||||
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
|
||||
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
return depotHeadService.countDepotHead(type, subType, hasDebt, status, purchaseStatus, number, linkApply, linkNumber,
|
||||
beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return depotHeadService.insertDepotHead(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return depotHeadService.updateDepotHead(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return depotHeadService.deleteDepotHead(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return depotHeadService.batchDeleteDepotHead(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.depotHead;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "depotHead")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DepotHeadResource {
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.ExcelUtils;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import jxl.Workbook;
|
||||
@@ -114,8 +115,8 @@ public class DepotHeadService {
|
||||
}
|
||||
|
||||
public List<DepotHeadVo4List> select(String type, String subType, String hasDebt, String status, String purchaseStatus, String number, String linkApply, String linkNumber,
|
||||
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark, int offset, int rows) throws Exception {
|
||||
List<DepotHeadVo4List> resList = new ArrayList<>();
|
||||
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark) throws Exception {
|
||||
List<DepotHeadVo4List> list = new ArrayList<>();
|
||||
try{
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
Long userId = userService.getUserId(request);
|
||||
@@ -132,9 +133,10 @@ public class DepotHeadService {
|
||||
Map<Long,String> accountMap = accountService.getAccountMap();
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
List<DepotHeadVo4List> list = depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, hasDebt,
|
||||
PageUtils.startPage();
|
||||
list = depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, hasDebt,
|
||||
statusArray, purchaseStatusArray, number, linkApply, linkNumber, beginTime, endTime,
|
||||
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark, offset, rows);
|
||||
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark);
|
||||
if (null != list) {
|
||||
List<Long> idList = new ArrayList<>();
|
||||
List<String> numberList = new ArrayList<>();
|
||||
@@ -221,35 +223,12 @@ public class DepotHeadService {
|
||||
dh.setTotalPrice(null);
|
||||
dh.setDiscountLastMoney(null);
|
||||
}
|
||||
resList.add(dh);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
public Long countDepotHead(String type, String subType, String hasDebt, String status, String purchaseStatus, String number, String linkApply, String linkNumber,
|
||||
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark) throws Exception{
|
||||
Long result=null;
|
||||
try{
|
||||
String [] depotArray = getDepotArray(subType);
|
||||
String [] creatorArray = getCreatorArray();
|
||||
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
||||
String [] purchaseStatusArray = StringUtil.isNotEmpty(purchaseStatus) ? purchaseStatus.split(",") : null;
|
||||
String [] organArray = getOrganArray(subType, purchaseStatus);
|
||||
//以销定购,查看全部数据
|
||||
creatorArray = StringUtil.isNotEmpty(purchaseStatus) ? null: creatorArray;
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, hasDebt,
|
||||
statusArray, purchaseStatusArray, number, linkApply, linkNumber, beginTime, endTime,
|
||||
materialParam, organId, organArray, creator, depotId, depotArray, accountId, remark);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.jsh.erp.service.depotItem;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "depotItem_component")
|
||||
@DepotItemResource
|
||||
public class DepotItemComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private DepotItemService depotItemService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return depotItemService.getDepotItem(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getDepotItemList(map);
|
||||
}
|
||||
|
||||
private List<?> getDepotItemList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String order = QueryUtils.order(map);
|
||||
return depotItemService.select(name, type, remark, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
return depotItemService.countDepotItem(name, type, remark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return depotItemService.insertDepotItem(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return depotItemService.updateDepotItem(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return depotItemService.deleteDepotItem(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return depotItemService.batchDeleteDepotItem(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return depotItemService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.depotItem;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "depotItem")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DepotItemResource {
|
||||
}
|
||||
@@ -125,8 +125,7 @@ public class MaterialService {
|
||||
if(StringUtil.isNotEmpty(mpList)){
|
||||
mpArr= mpList.split(",");
|
||||
}
|
||||
List<MaterialVo4Unit> resList = new ArrayList<>();
|
||||
List<MaterialVo4Unit> list =null;
|
||||
List<MaterialVo4Unit> list = new ArrayList<>();
|
||||
try{
|
||||
List<Long> idList = new ArrayList<>();
|
||||
if(StringUtil.isNotEmpty(categoryId)){
|
||||
@@ -148,13 +147,12 @@ public class MaterialService {
|
||||
m.setBigUnitInitialStock(getBigUnitStock(m.getInitialStock(), m.getUnitId()));
|
||||
m.setStock(currentStockMap.get(m.getId())!=null? currentStockMap.get(m.getId()): BigDecimal.ZERO);
|
||||
m.setBigUnitStock(getBigUnitStock(m.getStock(), m.getUnitId()));
|
||||
resList.add(m);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return resList;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.jsh.erp.service.orgaUserRel;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @Author: cjl
|
||||
* @Date: 2019/3/11 18:10
|
||||
*/
|
||||
@Service(value = "orgaUserRel_component")
|
||||
@OrgaUserRelResource
|
||||
public class OrgaUserRelComponent implements ICommonQuery {
|
||||
@Resource
|
||||
private OrgaUserRelService orgaUserRelService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return orgaUserRelService.getOrgaUserRel(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> parameterMap)throws Exception {
|
||||
return getOrgaUserRelList(parameterMap);
|
||||
}
|
||||
private List<?> getOrgaUserRelList(Map<String, String> map)throws Exception {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Long counts(Map<String, String> parameterMap)throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return orgaUserRelService.insertOrgaUserRel(obj,request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return orgaUserRelService.updateOrgaUserRel(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return orgaUserRelService.deleteOrgaUserRel(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return orgaUserRelService.batchDeleteOrgaUserRel(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.jsh.erp.service.orgaUserRel;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Description
|
||||
* 机构用户关系
|
||||
* @Author: cjl
|
||||
* @Date: 2019/3/11 18:11
|
||||
*/
|
||||
@ResourceInfo(value = "orgaUserRel")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OrgaUserRelResource {
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.jsh.erp.service.sequence;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @Author: jishenghua
|
||||
* @Date: 2021/3/16 16:33
|
||||
*/
|
||||
@Service(value = "sequence_component")
|
||||
@SequenceResource
|
||||
public class SequenceComponent implements ICommonQuery {
|
||||
@Resource
|
||||
private SequenceService sequenceService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return sequenceService.getSequence(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getSequenceList(map);
|
||||
}
|
||||
|
||||
private List<?> getSequenceList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
return sequenceService.select(name,QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
return sequenceService.countSequence(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return sequenceService.insertSequence(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return sequenceService.updateSequence(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return sequenceService.deleteSequence(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return sequenceService.batchDeleteSequence(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name) throws Exception{
|
||||
return sequenceService.checkIsNameExist(id, name);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.jsh.erp.service.sequence;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @Author: jishenghua
|
||||
* @Date: 2021/3/16 16:33
|
||||
*/
|
||||
@ResourceInfo(value = "sequence")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SequenceResource {
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.jsh.erp.service.serialNumber;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @Author: cjl
|
||||
* @Date: 2019/1/21 16:33
|
||||
*/
|
||||
@Service(value = "serialNumber_component")
|
||||
@SerialNumberResource
|
||||
public class SerialNumberComponent implements ICommonQuery {
|
||||
@Resource
|
||||
private SerialNumberService serialNumberService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return serialNumberService.getSerialNumber(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getSerialNumberList(map);
|
||||
}
|
||||
|
||||
private List<?> getSerialNumberList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String serialNumber = StringUtil.getInfo(search, "serialNumber");
|
||||
String materialName = StringUtil.getInfo(search, "materialName");
|
||||
return serialNumberService.select(serialNumber,materialName,QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String serialNumber = StringUtil.getInfo(search, "serialNumber");
|
||||
String materialName = StringUtil.getInfo(search, "materialName");
|
||||
return serialNumberService.countSerialNumber(serialNumber, materialName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return serialNumberService.insertSerialNumber(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return serialNumberService.updateSerialNumber(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return serialNumberService.deleteSerialNumber(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return serialNumberService.batchDeleteSerialNumber(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String serialNumber) throws Exception{
|
||||
return serialNumberService.checkIsNameExist(id, serialNumber);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.jsh.erp.service.serialNumber;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Description
|
||||
*
|
||||
* @Author: jishenghua
|
||||
* @Date: 2019/1/21 16:33
|
||||
*/
|
||||
@ResourceInfo(value = "serialNumber")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SerialNumberResource {
|
||||
}
|
||||
@@ -42,7 +42,6 @@ public class SerialNumberService {
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
|
||||
public SerialNumber getSerialNumber(long id)throws Exception {
|
||||
SerialNumber result=null;
|
||||
try{
|
||||
@@ -79,141 +78,30 @@ public class SerialNumberService {
|
||||
|
||||
public List<SerialNumberEx> select(String serialNumber, String materialName, Integer offset, Integer rows)throws Exception {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public Long countSerialNumber(String serialNumber,String materialName)throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertSerialNumber(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
int result=0;
|
||||
try{
|
||||
SerialNumberEx serialNumberEx = JSONObject.parseObject(obj.toJSONString(), SerialNumberEx.class);
|
||||
/**处理商品id*/
|
||||
serialNumberEx.setMaterialId(getSerialNumberMaterialIdByBarCode(serialNumberEx.getMaterialCode()));
|
||||
//删除标记,默认未删除
|
||||
serialNumberEx.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
|
||||
//已卖出,默认未否
|
||||
serialNumberEx.setIsSell(BusinessConstants.IS_SELL_HOLD);
|
||||
Date date=new Date();
|
||||
serialNumberEx.setCreateTime(date);
|
||||
serialNumberEx.setUpdateTime(date);
|
||||
User userInfo=userService.getCurrentUser();
|
||||
serialNumberEx.setCreator(userInfo==null?null:userInfo.getId());
|
||||
serialNumberEx.setUpdater(userInfo==null?null:userInfo.getId());
|
||||
result = serialNumberMapperEx.addSerialNumber(serialNumberEx);
|
||||
logService.insertLog("序列号",BusinessConstants.LOG_OPERATION_TYPE_ADD,
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateSerialNumber(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
SerialNumberEx serialNumberEx = JSONObject.parseObject(obj.toJSONString(), SerialNumberEx.class);
|
||||
int result=0;
|
||||
try{
|
||||
serialNumberEx.setMaterialId(getSerialNumberMaterialIdByBarCode(serialNumberEx.getMaterialCode()));
|
||||
Date date=new Date();
|
||||
serialNumberEx.setUpdateTime(date);
|
||||
User userInfo=userService.getCurrentUser();
|
||||
serialNumberEx.setUpdater(userInfo==null?null:userInfo.getId());
|
||||
result = serialNumberMapperEx.updateSerialNumber(serialNumberEx);
|
||||
logService.insertLog("序列号",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(serialNumberEx.getId()).toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int deleteSerialNumber(Long id, HttpServletRequest request)throws Exception {
|
||||
return batchDeleteSerialNumberByIds(id.toString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSerialNumber(String ids, HttpServletRequest request)throws Exception {
|
||||
return batchDeleteSerialNumberByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除序列号信息
|
||||
* create time: 2019/3/27 17:43
|
||||
* @Param: ids
|
||||
* @return
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSerialNumberByIds(String ids) throws Exception{
|
||||
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(",");
|
||||
int result=0;
|
||||
try{
|
||||
result = serialNumberMapperEx.batchDeleteSerialNumberByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int checkIsNameExist(Long id, String serialNumber)throws Exception {
|
||||
SerialNumberExample example = new SerialNumberExample();
|
||||
example.createCriteria().andIdNotEqualTo(id).andSerialNumberEqualTo(serialNumber).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<SerialNumber> list=null;
|
||||
try{
|
||||
list=serialNumberMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list==null?0:list.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品名称判断商品名称是否有效
|
||||
* @Param: materialName
|
||||
* @return Long 满足使用条件的商品的id
|
||||
*/
|
||||
public Long checkMaterialName(String materialName)throws Exception{
|
||||
if(StringUtil.isNotEmpty(materialName)) {
|
||||
List<Material> mlist=null;
|
||||
try{
|
||||
mlist = materialMapperEx.findByMaterialName(materialName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
if (mlist == null || mlist.size() < 1) {
|
||||
//商品名称不存在
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_EXISTS_CODE,
|
||||
ExceptionConstants.MATERIAL_NOT_EXISTS_MSG);
|
||||
}
|
||||
if (mlist.size() > 1) {
|
||||
//商品信息不唯一
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ONLY_CODE,
|
||||
ExceptionConstants.MATERIAL_NOT_ONLY_MSG);
|
||||
|
||||
}
|
||||
//获得唯一商品
|
||||
if (BusinessConstants.ENABLE_SERIAL_NUMBER_NOT_ENABLED.equals(mlist.get(0).getEnableSerialNumber())) {
|
||||
//商品未开启序列号
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_CODE,
|
||||
ExceptionConstants.MATERIAL_NOT_ENABLE_SERIAL_NUMBER_MSG);
|
||||
}
|
||||
return mlist.get(0).getId();
|
||||
}
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.jsh.erp.service.supplier;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "supplier_component")
|
||||
@SupplierResource
|
||||
public class SupplierComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private SupplierService supplierService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return supplierService.getSupplier(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getSupplierList(map);
|
||||
}
|
||||
|
||||
private List<?> getSupplierList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String supplier = StringUtil.getInfo(search, "supplier");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String phonenum = StringUtil.getInfo(search, "phonenum");
|
||||
String telephone = StringUtil.getInfo(search, "telephone");
|
||||
return supplierService.select(supplier, type, phonenum, telephone, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String supplier = StringUtil.getInfo(search, "supplier");
|
||||
String type = StringUtil.getInfo(search, "type");
|
||||
String phonenum = StringUtil.getInfo(search, "phonenum");
|
||||
String telephone = StringUtil.getInfo(search, "telephone");
|
||||
return supplierService.countSupplier(supplier, type, phonenum, telephone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return supplierService.insertSupplier(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return supplierService.updateSupplier(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return supplierService.deleteSupplier(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return supplierService.batchDeleteSupplier(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return supplierService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.supplier;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "supplier")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SupplierResource {
|
||||
}
|
||||
@@ -8,16 +8,11 @@ import com.jsh.erp.datasource.mappers.*;
|
||||
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.accountHead.AccountHeadService;
|
||||
import com.jsh.erp.service.depotHead.DepotHeadService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.ExcelUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import com.jsh.erp.utils.*;
|
||||
import jxl.Sheet;
|
||||
import jxl.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
@@ -96,11 +91,12 @@ public class SupplierService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, int offset, int rows) throws Exception{
|
||||
List<Supplier> resList = new ArrayList<Supplier>();
|
||||
public List<Supplier> select(String supplier, String type, String phonenum, String telephone) throws Exception{
|
||||
List<Supplier> list = new ArrayList<>();
|
||||
try{
|
||||
String [] creatorArray = depotHeadService.getCreatorArray();
|
||||
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray);
|
||||
for(Supplier s : list) {
|
||||
Integer supplierId = s.getId().intValue();
|
||||
String beginTime = Tools.getYearBegin();
|
||||
@@ -144,23 +140,11 @@ public class SupplierService {
|
||||
} else if(("供应商").equals(s.getType())) {
|
||||
s.setAllNeedPay(sum);
|
||||
}
|
||||
resList.add(s);
|
||||
}
|
||||
}catch(Exception e){
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
public Long countSupplier(String supplier, String type, String phonenum, String telephone) throws Exception{
|
||||
Long result=null;
|
||||
try{
|
||||
String [] creatorArray = depotHeadService.getCreatorArray();
|
||||
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, creatorArray);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.jsh.erp.service.systemConfig;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigResource;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "systemConfig_component")
|
||||
@SystemConfigResource
|
||||
public class SystemConfigComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return systemConfigService.getSystemConfig(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getSystemConfigList(map);
|
||||
}
|
||||
|
||||
private List<?> getSystemConfigList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String companyName = StringUtil.getInfo(search, "companyName");
|
||||
String order = QueryUtils.order(map);
|
||||
return systemConfigService.select(companyName, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String companyName = StringUtil.getInfo(search, "companyName");
|
||||
return systemConfigService.countSystemConfig(companyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return systemConfigService.insertSystemConfig(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return systemConfigService.updateSystemConfig(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return systemConfigService.deleteSystemConfig(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return systemConfigService.batchDeleteSystemConfig(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return systemConfigService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.systemConfig;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "systemConfig")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SystemConfigResource {
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.OSSException;
|
||||
import com.aliyun.oss.model.CopyObjectResult;
|
||||
import com.aliyun.oss.model.PutObjectRequest;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.SystemConfig;
|
||||
import com.jsh.erp.datasource.entities.SystemConfigExample;
|
||||
@@ -19,10 +18,7 @@ import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.platformConfig.PlatformConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.ExcelUtils;
|
||||
import com.jsh.erp.utils.FileUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -92,26 +88,17 @@ public class SystemConfigService {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public List<SystemConfig> select(String companyName, int offset, int rows)throws Exception {
|
||||
public List<SystemConfig> select(String companyName)throws Exception {
|
||||
List<SystemConfig> list=null;
|
||||
try{
|
||||
list=systemConfigMapperEx.selectByConditionSystemConfig(companyName, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list=systemConfigMapperEx.selectByConditionSystemConfig(companyName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countSystemConfig(String companyName)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=systemConfigMapperEx.countsBySystemConfig(companyName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertSystemConfig(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
SystemConfig systemConfig = JSONObject.parseObject(obj.toJSONString(), SystemConfig.class);
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.jsh.erp.service.unit;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "unit_component")
|
||||
@UnitResource
|
||||
public class UnitComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private UnitService unitService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return unitService.getUnit(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getUnitList(map);
|
||||
}
|
||||
|
||||
private List<?> getUnitList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String order = QueryUtils.order(map);
|
||||
return unitService.select(name, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
return unitService.countUnit(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return unitService.insertUnit(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return unitService.updateUnit(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return unitService.deleteUnit(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return unitService.batchDeleteUnit(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return unitService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.unit;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "unit")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface UnitResource {
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -80,26 +81,17 @@ public class UnitService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Unit> select(String name, int offset, int rows)throws Exception {
|
||||
public List<Unit> select(String name)throws Exception {
|
||||
List<Unit> list=null;
|
||||
try{
|
||||
list=unitMapperEx.selectByConditionUnit(name, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list=unitMapperEx.selectByConditionUnit(name);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countUnit(String name)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
result=unitMapperEx.countsByUnit(name);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertUnit(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Unit unit = JSONObject.parseObject(obj.toJSONString(), Unit.class);
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.jsh.erp.service.user;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
@Service(value = "user_component")
|
||||
@UserResource
|
||||
public class UserComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return userService.getUser(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getUserList(map);
|
||||
}
|
||||
|
||||
private List<?> getUserList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String userName = StringUtil.getInfo(search, "userName");
|
||||
String loginName = StringUtil.getInfo(search, "loginName");
|
||||
String order = QueryUtils.order(map);
|
||||
String filter = QueryUtils.filter(map);
|
||||
return userService.select(userName, loginName, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String userName = StringUtil.getInfo(search, "userName");
|
||||
String loginName = StringUtil.getInfo(search, "loginName");
|
||||
return userService.countUser(userName, loginName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return userService.insertUser(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return userService.updateUser(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return userService.deleteUser(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return userService.batchDeleteUser(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return userService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.user;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "user")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface UserResource {
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.jsh.erp.service.functions.FunctionService;
|
||||
import com.jsh.erp.service.platformConfig.PlatformConfigService;
|
||||
import com.jsh.erp.service.redis.RedisService;
|
||||
import com.jsh.erp.service.role.RoleService;
|
||||
import com.jsh.erp.utils.HttpClient;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.springframework.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -22,9 +22,6 @@ import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
|
||||
import com.jsh.erp.service.tenant.TenantService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.ExceptionCodeConstants;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.Tools;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -112,14 +109,15 @@ public class UserService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<UserEx> select(String userName, String loginName, int offset, int rows)throws Exception {
|
||||
public List<UserEx> select(String userName, String loginName)throws Exception {
|
||||
List<UserEx> list=null;
|
||||
try {
|
||||
//先校验是否登录,然后才能查询用户数据
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
Long userId = this.getUserId(request);
|
||||
if(userId!=null) {
|
||||
list = userMapperEx.selectByConditionUser(userName, loginName, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = userMapperEx.selectByConditionUser(userName, loginName);
|
||||
for (UserEx ue : list) {
|
||||
String userType = "";
|
||||
if (ue.getId().equals(ue.getTenantId())) {
|
||||
@@ -155,15 +153,7 @@ public class UserService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:30
|
||||
* @Param: beanJson
|
||||
* @Param: request
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertUser(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
User user = JSONObject.parseObject(obj.toJSONString(), User.class);
|
||||
@@ -185,15 +175,7 @@ public class UserService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:31
|
||||
* @Param: beanJson
|
||||
* @Param: id
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUser(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
User user = JSONObject.parseObject(obj.toJSONString(), User.class);
|
||||
@@ -207,14 +189,7 @@ public class UserService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:32
|
||||
* @Param: user
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int updateUserByObj(User user) throws Exception{
|
||||
logService.insertLog("用户",
|
||||
@@ -228,15 +203,7 @@ public class UserService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: cjl
|
||||
* description:
|
||||
* 添加事务控制
|
||||
* create time: 2019/1/11 14:33
|
||||
* @Param: md5Pwd
|
||||
* @Param: id
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int resetPwd(String md5Pwd, Long id) throws Exception{
|
||||
int result=0;
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "userBusiness_component")
|
||||
@UserBusinessResource
|
||||
public class UserBusinessComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return userBusinessService.getUserBusiness(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getUserBusinessList(map);
|
||||
}
|
||||
|
||||
private List<?> getUserBusinessList(Map<String, String> map)throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
return BusinessConstants.DEFAULT_LIST_NULL_NUMBER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception {
|
||||
return userBusinessService.insertUserBusiness(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return userBusinessService.updateUserBusiness(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return userBusinessService.deleteUserBusiness(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return userBusinessService.batchDeleteUserBusiness(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return userBusinessService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.userBusiness;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "userBusiness")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface UserBusinessResource {
|
||||
}
|
||||
Reference in New Issue
Block a user