将查询单据信息的两个接口合并为一个

This commit is contained in:
季圣华
2019-06-03 21:33:26 +08:00
parent d2d7af27ac
commit 1c3ab2cb17
12 changed files with 54 additions and 146 deletions

View File

@@ -438,7 +438,7 @@ public class DepotHeadController {
JSONObject result = ExceptionConstants.standardSuccess();
if(("open").equals(mybatisPlusStatus)) {
Long billsNumLimit = Long.parseLong(request.getSession().getAttribute("billsNumLimit").toString());
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null);
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null);
if(count>= billsNumLimit) {
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);

View File

@@ -42,44 +42,6 @@ public class DepotItemController {
@Resource
private MaterialService materialService;
/**
* 根据材料信息获取
* @param materialParam 商品参数
* @param depotIds 拥有的仓库信息
* @param request
* @return
*/
@GetMapping(value = "/getHeaderIdByMaterial")
public BaseResponseInfo getHeaderIdByMaterial(@RequestParam("materialParam") String materialParam,
@RequestParam("depotIds") String depotIds,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<DepotItemVo4HeaderId> depotItemList = depotItemService.getHeaderIdByMaterial(materialParam, depotIds);
String allReturn = "";
if (depotItemList != null&&depotItemList.size()>0) {
for (DepotItemVo4HeaderId d : depotItemList) {
Long dl = d.getHeaderid(); //获取对象
allReturn = allReturn + dl.toString() + ",";
}
/**
* 2019-01-17修复depotItemList集合为空时程序异常
* */
allReturn = allReturn.substring(0, allReturn.length() - 1);
}
if (allReturn.equals("null")) {
allReturn = "";
}
res.code = 200;
res.data = allReturn;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 只根据商品id查询单据列表
* @param mId

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.datasource.entities;
public class DepotItemVo4HeaderId {
private Long headerid;
public Long getHeaderid() {
return headerid;
}
public void setHeaderid(Long headerid) {
this.headerid = headerid;
}
}

View File

@@ -24,7 +24,8 @@ public interface DepotHeadMapperEx {
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("dhIds") String dhIds,
@Param("materialParam") String materialParam,
@Param("depotIds") String depotIds,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@@ -34,7 +35,8 @@ public interface DepotHeadMapperEx {
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("dhIds") String dhIds);
@Param("materialParam") String materialParam,
@Param("depotIds") String depotIds);
Long getMaxId();

View File

@@ -27,10 +27,6 @@ public interface DepotItemMapperEx {
@Param("type") Integer type,
@Param("remark") String remark);
List<DepotItemVo4HeaderId> getHeaderIdByMaterial(
@Param("materialParam") String materialParam,
@Param("depotIds") String depotIds);
List<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(
@Param("mId") Long mId,
@Param("offset") Integer offset,

View File

@@ -35,9 +35,9 @@ public class DepotHeadComponent implements ICommonQuery {
String number = StringUtil.getInfo(search, "number");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String dhIds = StringUtil.getInfo(search, "dhIds");
String order = QueryUtils.order(map);
return depotHeadService.select(type, subType, number, beginTime, endTime, dhIds, QueryUtils.offset(map), QueryUtils.rows(map));
String materialParam = StringUtil.getInfo(search, "materialParam");
String depotIds = StringUtil.getInfo(search, "depotIds");
return depotHeadService.select(type, subType, number, beginTime, endTime, materialParam, depotIds, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
@@ -48,8 +48,9 @@ public class DepotHeadComponent implements ICommonQuery {
String number = StringUtil.getInfo(search, "number");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String dhIds = StringUtil.getInfo(search, "dhIds");
return depotHeadService.countDepotHead(type, subType, number, beginTime, endTime, dhIds);
String materialParam = StringUtil.getInfo(search, "materialParam");
String depotIds = StringUtil.getInfo(search, "depotIds");
return depotHeadService.countDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds);
}
@Override

View File

@@ -88,11 +88,12 @@ public class DepotHeadService {
return list;
}
public List<DepotHeadVo4List> select(String type, String subType, String number, String beginTime, String endTime, String dhIds, int offset, int rows)throws Exception {
public List<DepotHeadVo4List> select(String type, String subType, String number, String beginTime, String endTime,
String materialParam, String depotIds, int offset, int rows)throws Exception {
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
List<DepotHeadVo4List> list=null;
try{
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, dhIds, offset, rows);
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
@@ -127,10 +128,11 @@ public class DepotHeadService {
public Long countDepotHead(String type, String subType, String number, String beginTime, String endTime, String dhIds) throws Exception{
public Long countDepotHead(String type, String subType, String number, String beginTime, String endTime,
String materialParam, String depotIds) throws Exception{
Long result=null;
try{
result=depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, dhIds);
result=depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);

View File

@@ -188,19 +188,6 @@ public class DepotItemService {
return list==null?0:list.size();
}
public List<DepotItemVo4HeaderId> getHeaderIdByMaterial(String materialParam, String depotIds)throws Exception {
List<DepotItemVo4HeaderId> list =null;
try{
list = depotItemMapperEx.getHeaderIdByMaterial(materialParam, depotIds);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public List<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;