给商品相关的模块优化接口
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
package com.jsh.erp.service.material;
|
||||
|
||||
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 = "material_component")
|
||||
@MaterialResource
|
||||
public class MaterialComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialService materialService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialService.getMaterial(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String categoryId = StringUtil.getInfo(search, "categoryId");
|
||||
String materialParam = StringUtil.getInfo(search, "materialParam");
|
||||
String standard = StringUtil.getInfo(search, "standard");
|
||||
String model = StringUtil.getInfo(search, "model");
|
||||
String color = StringUtil.getInfo(search, "color");
|
||||
String brand = StringUtil.getInfo(search, "brand");
|
||||
String mfrs = StringUtil.getInfo(search, "mfrs");
|
||||
String materialOther = StringUtil.getInfo(search, "materialOther");
|
||||
String weight = StringUtil.getInfo(search, "weight");
|
||||
String expiryNum = StringUtil.getInfo(search, "expiryNum");
|
||||
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
|
||||
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
|
||||
String position = StringUtil.getInfo(search, "position");
|
||||
String enabled = StringUtil.getInfo(search, "enabled");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String mpList = StringUtil.getInfo(search, "mpList");
|
||||
return materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
|
||||
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String categoryId = StringUtil.getInfo(search, "categoryId");
|
||||
String materialParam = StringUtil.getInfo(search, "materialParam");
|
||||
String standard = StringUtil.getInfo(search, "standard");
|
||||
String model = StringUtil.getInfo(search, "model");
|
||||
String color = StringUtil.getInfo(search, "color");
|
||||
String brand = StringUtil.getInfo(search, "brand");
|
||||
String mfrs = StringUtil.getInfo(search, "mfrs");
|
||||
String materialOther = StringUtil.getInfo(search, "materialOther");
|
||||
String weight = StringUtil.getInfo(search, "weight");
|
||||
String expiryNum = StringUtil.getInfo(search, "expiryNum");
|
||||
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
|
||||
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
|
||||
String position = StringUtil.getInfo(search, "position");
|
||||
String enabled = StringUtil.getInfo(search, "enabled");
|
||||
String remark = StringUtil.getInfo(search, "remark");
|
||||
String mpList = StringUtil.getInfo(search, "mpList");
|
||||
return materialService.countMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
|
||||
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return materialService.insertMaterial(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialService.updateMaterial(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialService.deleteMaterial(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialService.batchDeleteMaterial(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return materialService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.material;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "material")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialResource {
|
||||
}
|
||||
@@ -18,10 +18,7 @@ import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.unit.UnitService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import com.jsh.erp.utils.ExcelUtils;
|
||||
import com.jsh.erp.utils.PinYinUtil;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import com.jsh.erp.utils.*;
|
||||
import jxl.Sheet;
|
||||
import jxl.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
@@ -122,7 +119,7 @@ public class MaterialService {
|
||||
public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
|
||||
String materialOther, String weight, String expiryNum, String enableSerialNumber,
|
||||
String enableBatchNumber, String position, String enabled, String remark, String categoryId,
|
||||
String mpList, int offset, int rows)
|
||||
String mpList)
|
||||
throws Exception{
|
||||
String[] mpArr = new String[]{};
|
||||
if(StringUtil.isNotEmpty(mpList)){
|
||||
@@ -135,8 +132,9 @@ public class MaterialService {
|
||||
if(StringUtil.isNotEmpty(categoryId)){
|
||||
idList = getListByParentId(Long.parseLong(categoryId));
|
||||
}
|
||||
PageUtils.startPage();
|
||||
list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
|
||||
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList, offset, rows);
|
||||
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
|
||||
if (null != list && list.size()>0) {
|
||||
Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
|
||||
Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
|
||||
@@ -159,24 +157,6 @@ public class MaterialService {
|
||||
return resList;
|
||||
}
|
||||
|
||||
public Long countMaterial(String materialParam, String standard, String model, String color, String brand, String mfrs,
|
||||
String materialOther, String weight, String expiryNum, String enableSerialNumber,
|
||||
String enableBatchNumber, String position, String enabled, String remark, String categoryId,
|
||||
String mpList)throws Exception {
|
||||
Long result =null;
|
||||
try{
|
||||
List<Long> idList = new ArrayList<>();
|
||||
if(StringUtil.isNotEmpty(categoryId)){
|
||||
idList = getListByParentId(Long.parseLong(categoryId));
|
||||
}
|
||||
result= materialMapperEx.countsByMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
|
||||
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterial(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
Material m = JSONObject.parseObject(obj.toJSONString(), Material.class);
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.jsh.erp.service.materialAttribute;
|
||||
|
||||
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 = "materialAttribute_component")
|
||||
@MaterialAttributeResource
|
||||
public class MaterialAttributeComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialAttributeService materialAttributeService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialAttributeService.getMaterialAttribute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String attributeName = StringUtil.getInfo(search, "attributeName");
|
||||
return materialAttributeService.select(attributeName, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String attributeField = StringUtil.getInfo(search, "attributeField");
|
||||
return materialAttributeService.countMaterialAttribute(attributeField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return materialAttributeService.insertMaterialAttribute(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialAttributeService.updateMaterialAttribute(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialAttributeService.deleteMaterialAttribute(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialAttributeService.batchDeleteMaterialAttribute(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return materialAttributeService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.materialAttribute;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2021-07-21 22:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "materialAttribute")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialAttributeResource {
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.MaterialAttributeMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -19,9 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class MaterialAttributeService {
|
||||
@@ -59,27 +58,17 @@ public class MaterialAttributeService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialAttribute> select(String attributeName, int offset, int rows)
|
||||
throws Exception{
|
||||
public List<MaterialAttribute> select(String attributeName) throws Exception{
|
||||
List<MaterialAttribute> list = new ArrayList<>();
|
||||
try{
|
||||
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countMaterialAttribute(String attributeField)throws Exception {
|
||||
Long result =null;
|
||||
try{
|
||||
result= 5L;
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialAttribute(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
MaterialAttribute m = JSONObject.parseObject(obj.toJSONString(), MaterialAttribute.class);
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.jsh.erp.service.materialCategory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.service.materialProperty.MaterialPropertyResource;
|
||||
import com.jsh.erp.service.materialProperty.MaterialPropertyService;
|
||||
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 = "materialCategory_component")
|
||||
@MaterialCategoryResource
|
||||
public class MaterialCategoryComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialCategoryService materialCategoryService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialCategoryService.getMaterialCategory(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialCategoryList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialCategoryList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
|
||||
String order = QueryUtils.order(map);
|
||||
return materialCategoryService.select(name, parentId, 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 parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
|
||||
return materialCategoryService.countMaterialCategory(name, parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialCategoryService.insertMaterialCategory(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialCategoryService.updateMaterialCategory(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialCategoryService.deleteMaterialCategory(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialCategoryService.batchDeleteMaterialCategory(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return materialCategoryService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.materialCategory;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "materialCategory")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialCategoryResource {
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.jsh.erp.service.materialCategory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.entities.Material;
|
||||
import com.jsh.erp.datasource.entities.MaterialCategory;
|
||||
import com.jsh.erp.datasource.entities.MaterialCategoryExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.MaterialCategoryMapper;
|
||||
import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
||||
@@ -13,6 +15,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;
|
||||
@@ -105,26 +108,17 @@ public class MaterialCategoryService {
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<MaterialCategory> select(String name, Integer parentId, int offset, int rows) throws Exception{
|
||||
public List<MaterialCategory> select(String name, Integer parentId) throws Exception{
|
||||
List<MaterialCategory> list=null;
|
||||
try{
|
||||
list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countMaterialCategory(String name, Integer parentId) throws Exception{
|
||||
Long result=null;
|
||||
try{
|
||||
result=materialCategoryMapperEx.countsByMaterialCategory(name, parentId);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialCategory(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
MaterialCategory materialCategory = JSONObject.parseObject(obj.toJSONString(), MaterialCategory.class);
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.jsh.erp.service.materialExtend;
|
||||
|
||||
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;
|
||||
|
||||
@Service(value = "material_extend")
|
||||
@MaterialExtendResource
|
||||
public class MaterialExtendComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialExtendService materialExtendService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialExtendService.getMaterialExtend(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialList(Map<String, String> map) throws Exception{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return materialExtendService.insertMaterialExtend(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialExtendService.updateMaterialExtend(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialExtendService.deleteMaterialExtend(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.materialExtend;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "materialExtend")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialExtendResource {
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.datasource.mappers.MaterialExtendMapper;
|
||||
import com.jsh.erp.datasource.mappers.MaterialExtendMapperEx;
|
||||
import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
@@ -41,8 +40,6 @@ public class MaterialExtendService {
|
||||
@Resource
|
||||
private MaterialExtendMapperEx materialExtendMapperEx;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.jsh.erp.service.materialProperty;
|
||||
|
||||
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 = "materialProperty_component")
|
||||
@MaterialPropertyResource
|
||||
public class MaterialPropertyComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialPropertyService materialPropertyService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialPropertyService.getMaterialProperty(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialPropertyList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialPropertyList(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String name = StringUtil.getInfo(search, "name");
|
||||
String order = QueryUtils.order(map);
|
||||
return materialPropertyService.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 materialPropertyService.countMaterialProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialPropertyService.insertMaterialProperty(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialPropertyService.updateMaterialProperty(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialPropertyService.deleteMaterialProperty(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialPropertyService.batchDeleteMaterialProperty(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return materialPropertyService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.materialProperty;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2018-10-7 15:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "materialProperty")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialPropertyResource {
|
||||
}
|
||||
@@ -12,6 +12,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;
|
||||
@@ -61,11 +62,12 @@ public class MaterialPropertyService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialProperty> select(String name, int offset, int rows)throws Exception {
|
||||
public List<MaterialProperty> select(String name)throws Exception {
|
||||
List<MaterialProperty> list=null;
|
||||
try{
|
||||
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||
list = materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = materialPropertyMapperEx.selectByConditionMaterialProperty(name);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
@@ -73,18 +75,6 @@ public class MaterialPropertyService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countMaterialProperty(String name)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
|
||||
result = materialPropertyMapperEx.countsByMaterialProperty(name);
|
||||
}
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialProperty(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.jsh.erp.service.serialNumber;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.service.material.MaterialResource;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
|
||||
Reference in New Issue
Block a user