给单据增加查询条件

This commit is contained in:
季圣华
2021-07-15 01:21:01 +08:00
parent 9b1312bf90
commit 6a4b4e27be
6 changed files with 50 additions and 8 deletions

View File

@@ -271,7 +271,7 @@ public class DepotHeadController {
String rows = body.getRows(); String rows = body.getRows();
Long billsNumLimit = Long.parseLong(redisService.getObjectFromSessionByKey(request,"billsNumLimit").toString()); Long billsNumLimit = Long.parseLong(redisService.getObjectFromSessionByKey(request,"billsNumLimit").toString());
Long tenantId = redisService.getTenantId(request); Long tenantId = redisService.getTenantId(request);
Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null,null); Long count = depotHeadService.countDepotHead(null,null,null,null,null,null,null,null,null,null,null);
if(count>= billsNumLimit) { if(count>= billsNumLimit) {
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE, throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG); ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);

View File

@@ -27,6 +27,9 @@ public interface DepotHeadMapperEx {
@Param("beginTime") String beginTime, @Param("beginTime") String beginTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("organId") Long organId,
@Param("creator") Long creator,
@Param("depotId") Long depotId,
@Param("depotArray") String[] depotArray, @Param("depotArray") String[] depotArray,
@Param("offset") Integer offset, @Param("offset") Integer offset,
@Param("rows") Integer rows); @Param("rows") Integer rows);
@@ -40,6 +43,9 @@ public interface DepotHeadMapperEx {
@Param("beginTime") String beginTime, @Param("beginTime") String beginTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("organId") Long organId,
@Param("creator") Long creator,
@Param("depotId") Long depotId,
@Param("depotArray") String[] depotArray); @Param("depotArray") String[] depotArray);
String findMaterialsListByHeaderId( String findMaterialsListByHeaderId(

View File

@@ -39,7 +39,11 @@ public class DepotHeadComponent implements ICommonQuery {
String beginTime = StringUtil.getInfo(search, "beginTime"); String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime"); String endTime = StringUtil.getInfo(search, "endTime");
String materialParam = StringUtil.getInfo(search, "materialParam"); String materialParam = StringUtil.getInfo(search, "materialParam");
return depotHeadService.select(type, subType, roleType, status, number, beginTime, endTime, materialParam, QueryUtils.offset(map), QueryUtils.rows(map)); Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
return depotHeadService.select(type, subType, roleType, status, number, beginTime, endTime, materialParam,
organId, creator, depotId, QueryUtils.offset(map), QueryUtils.rows(map));
} }
@Override @Override
@@ -53,7 +57,11 @@ public class DepotHeadComponent implements ICommonQuery {
String beginTime = StringUtil.getInfo(search, "beginTime"); String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime"); String endTime = StringUtil.getInfo(search, "endTime");
String materialParam = StringUtil.getInfo(search, "materialParam"); String materialParam = StringUtil.getInfo(search, "materialParam");
return depotHeadService.countDepotHead(type, subType, roleType, status, number, beginTime, endTime, 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"));
return depotHeadService.countDepotHead(type, subType, roleType, status, number, beginTime, endTime, materialParam,
organId, creator, depotId);
} }
@Override @Override

View File

@@ -104,8 +104,8 @@ public class DepotHeadService {
} }
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String status, String number, String beginTime, String endTime, public List<DepotHeadVo4List> select(String type, String subType, String roleType, String status, String number, String beginTime, String endTime,
String materialParam, int offset, int rows)throws Exception { String materialParam, Long organId, Long creator, Long depotId, int offset, int rows)throws Exception {
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>(); List<DepotHeadVo4List> resList = new ArrayList<>();
List<DepotHeadVo4List> list=new ArrayList<>(); List<DepotHeadVo4List> list=new ArrayList<>();
try{ try{
String depotIds = depotService.findDepotStrByCurrentUser(); String depotIds = depotService.findDepotStrByCurrentUser();
@@ -115,7 +115,8 @@ public class DepotHeadService {
Map<Long,String> accountMap = accountService.getAccountMap(); Map<Long,String> accountMap = accountService.getAccountMap();
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME); endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotArray, offset, rows); list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, creatorArray, status, number, beginTime, endTime,
materialParam, organId, creator, depotId, depotArray, offset, rows);
if (null != list) { if (null != list) {
for (DepotHeadVo4List dh : list) { for (DepotHeadVo4List dh : list) {
if(accountMap!=null && StringUtil.isNotEmpty(dh.getAccountIdList()) && StringUtil.isNotEmpty(dh.getAccountMoneyList())) { if(accountMap!=null && StringUtil.isNotEmpty(dh.getAccountIdList()) && StringUtil.isNotEmpty(dh.getAccountMoneyList())) {
@@ -153,7 +154,7 @@ public class DepotHeadService {
} }
public Long countDepotHead(String type, String subType, String roleType, String status, String number, String beginTime, String endTime, public Long countDepotHead(String type, String subType, String roleType, String status, String number, String beginTime, String endTime,
String materialParam) throws Exception{ String materialParam, Long organId, Long creator, Long depotId) throws Exception{
Long result=null; Long result=null;
try{ try{
String depotIds = depotService.findDepotStrByCurrentUser(); String depotIds = depotService.findDepotStrByCurrentUser();
@@ -161,7 +162,8 @@ public class DepotHeadService {
String [] creatorArray = getCreatorArray(roleType); String [] creatorArray = getCreatorArray(roleType);
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME); beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME); endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, status, number, beginTime, endTime, materialParam, depotArray); result=depotHeadMapperEx.countsByDepotHead(type, subType, creatorArray, status, number, beginTime, endTime,
materialParam, organId, creator, depotId, depotArray);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }

View File

@@ -93,6 +93,14 @@ public class StringUtil {
} }
} }
public static Long parseStrLong(String str) {
if (StringUtil.isNotEmpty(str)) {
return Long.parseLong(str);
} else {
return null;
}
}
public static List<UUID> listToUUID(List<String> listStrs) { public static List<UUID> listToUUID(List<String> listStrs) {
if (listStrs != null && listStrs.size() > 0) { if (listStrs != null && listStrs.size() > 0) {
List<UUID> uuidList = new ArrayList<UUID>(); List<UUID> uuidList = new ArrayList<UUID>();

View File

@@ -74,6 +74,15 @@
<bind name="bindKey" value="'%'+materialParam+'%'"/> <bind name="bindKey" value="'%'+materialParam+'%'"/>
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}) and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if> </if>
<if test="organId != null">
and dh.organ_id=#{organId}
</if>
<if test="creator != null">
and dh.creator=#{creator}
</if>
<if test="depotId != null">
and di.depot_id=#{depotId}
</if>
<if test="depotArray != null and depotArray !=''"> <if test="depotArray != null and depotArray !=''">
and di.depot_id in ( and di.depot_id in (
<foreach collection="depotArray" item="depotId" separator=","> <foreach collection="depotArray" item="depotId" separator=",">
@@ -124,6 +133,15 @@
<bind name="bindKey" value="'%'+materialParam+'%'"/> <bind name="bindKey" value="'%'+materialParam+'%'"/>
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}) and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if> </if>
<if test="organId != null">
and dh.organ_id=#{organId}
</if>
<if test="creator != null">
and dh.creator=#{creator}
</if>
<if test="depotId != null">
and di.depot_id=#{depotId}
</if>
<if test="depotArray != null and depotArray !=''"> <if test="depotArray != null and depotArray !=''">
and di.depot_id in ( and di.depot_id in (
<foreach collection="depotArray" item="depotId" separator=","> <foreach collection="depotArray" item="depotId" separator=",">