Commit 531164a7 authored by 332784038@qq.com's avatar 332784038@qq.com

订单动态多参数查询bug修复

parent 644b7db7
...@@ -634,6 +634,28 @@ public class OrderQueryVO { ...@@ -634,6 +634,28 @@ public class OrderQueryVO {
@ApiModelProperty(value = "0 控货中;1 已放完货;2 部分控货 3 放货中(此状态值为组合状态,当已放完货,但未全部复核完毕时为此状态,仅供查询条件传参使用)") @ApiModelProperty(value = "0 控货中;1 已放完货;2 部分控货 3 放货中(此状态值为组合状态,当已放完货,但未全部复核完毕时为此状态,仅供查询条件传参使用)")
private List<Integer> cargoControlStatusList; private List<Integer> cargoControlStatusList;
@ApiModelProperty(value = "动态查询审核类型(字典 order_approval_type) 0 为正常")
private List<Integer> dynamicAuditTypeList;
@ApiModelProperty(value = "动态查询订单异常状态(字典 order_abnormal_state)")
private List<Integer> dynamicAbnormalStateList;
@ApiModelProperty(value = "动态查询订单入仓状态(字典 order_warehouse_in_status)")
private List<Integer> dynamicInWarehouseStateList;
@ApiModelProperty(value = "动态查询订单出货状态(字典 order_shipment_state)")
private List<Integer> dynamicShipmentStateList;
@ApiModelProperty(value = "动态查询空运可出货状态:0 默认值 1 待出 2 可出 3 备货中 4 已备货 10 可出、备货中、已备货 11 待出、可出、备货中、已备货 12 可出、备货中")
private List<Integer> dynamicAirShipmentList;
@ApiModelProperty(value = "动态查询运输方式")
private List<Integer> dynamicTransportIdList;
@ApiModelProperty(value = "动态查询状态字段")
private List<Integer> dynamicStatusList;
@ApiModelProperty(value = "内部转换状态字段") @ApiModelProperty(value = "内部转换状态字段")
private List<Integer> asStatusList; private List<Integer> asStatusList;
...@@ -654,7 +676,7 @@ public class OrderQueryVO { ...@@ -654,7 +676,7 @@ public class OrderQueryVO {
public void setAsStatusList(List<Integer> asStatusList) { public void setAsStatusList(List<Integer> asStatusList) {
this.asStatusList = asStatusList; this.asStatusList = asStatusList;
if (CollectionUtil.isNotEmpty(this.asStatusList)) { if (CollectionUtil.isNotEmpty(this.asStatusList)) {
this.statusList = new ArrayList<>(); this.dynamicStatusList = new ArrayList<>();
for (Integer asStatus : asStatusList) { for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId); combinedStateList(asStatus, this.transportId);
} }
...@@ -764,154 +786,168 @@ public class OrderQueryVO { ...@@ -764,154 +786,168 @@ public class OrderQueryVO {
private void combinedStateList(Integer asStatus, Integer transportId) { private void combinedStateList(Integer asStatus, Integer transportId) {
switch (asStatus) { switch (asStatus) {
case 12325: case 12325:
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.dynamicShipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.dynamicShipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(12)) { if (!this.dynamicStatusList.contains(12)) {
this.statusList.add(12); this.dynamicStatusList.add(12);
} }
if (!this.shipmentStateList.contains(325)) { if (!this.dynamicShipmentStateList.contains(325)) {
this.shipmentStateList.add(325); this.dynamicShipmentStateList.add(325);
} }
break; break;
case 10501: case 10501:
// 空运待出 // 空运待出
if (Objects.isNull(this.airShipmentList)){ if (Objects.isNull(this.dynamicAirShipmentList)){
this.airShipmentList = new ArrayList<>(); this.dynamicAirShipmentList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicAuditTypeList)){
this.dynamicAuditTypeList = new ArrayList<>();
} }
if (Objects.isNull(this.auditTypeList)){ if (Objects.isNull(this.dynamicAbnormalStateList)){
this.auditTypeList = new ArrayList<>(); this.dynamicAbnormalStateList = new ArrayList<>();
} }
if (Objects.isNull(this.abnormalStateList)){ if (!this.dynamicStatusList.contains(5)) {
this.abnormalStateList = new ArrayList<>(); this.dynamicStatusList.add(5);
} }
if (!this.statusList.contains(5)) { if (!this.dynamicAirShipmentList.contains(1)) {
this.statusList.add(5); this.dynamicAirShipmentList.add(1);
} }
if (!this.airShipmentList.contains(1)) { if (!this.dynamicAuditTypeList.contains(0)) {
this.airShipmentList.add(1); this.dynamicAuditTypeList.add(0);
} }
if (!this.auditTypeList.contains(0)) { if (!this.dynamicAbnormalStateList.contains(0)) {
this.auditTypeList.add(0); this.dynamicAbnormalStateList.add(0);
} }
if (!this.abnormalStateList.contains(0)) { if (!this.dynamicTransportIdList.contains(3)) {
this.abnormalStateList.add(0); this.dynamicTransportIdList.add(3); // 空运待出查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 10502: case 10502:
// 空运可出 // 空运可出
if (Objects.isNull(this.airShipmentList)){ if (Objects.isNull(this.dynamicAirShipmentList)){
this.airShipmentList = new ArrayList<>(); this.dynamicAirShipmentList = new ArrayList<>();
} }
if (!this.statusList.contains(5)) { if (!this.dynamicStatusList.contains(5)) {
this.statusList.add(5); this.dynamicStatusList.add(5);
} }
if (!this.airShipmentList.contains(12)) { if (!this.dynamicAirShipmentList.contains(12)) {
this.airShipmentList.add(12); this.dynamicAirShipmentList.add(12);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运可出查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 10503: case 10503:
// 空运已备货 // 空运已备货
if (Objects.isNull(this.airShipmentList)){ if (Objects.isNull(this.dynamicAirShipmentList)){
this.airShipmentList = new ArrayList<>(); this.dynamicAirShipmentList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(5)) {
this.dynamicStatusList.add(5);
} }
if (!this.statusList.contains(5)) { if (!this.dynamicAirShipmentList.contains(4)) {
this.statusList.add(5); this.dynamicAirShipmentList.add(4);
} }
if (!this.airShipmentList.contains(4)) { if (!this.dynamicTransportIdList.contains(3)) {
this.airShipmentList.add(4); this.dynamicTransportIdList.add(3); // 空运已备货查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 10504: case 10504:
// 待排单 // 待排单
if (Objects.isNull(this.airShipmentList)){ if (Objects.isNull(this.dynamicAirShipmentList)){
this.airShipmentList = new ArrayList<>(); this.dynamicAirShipmentList = new ArrayList<>();
} }
if (Objects.isNull(this.auditTypeList)){ if (Objects.isNull(this.dynamicAuditTypeList)){
this.auditTypeList = new ArrayList<>(); this.dynamicAuditTypeList = new ArrayList<>();
} }
if (Objects.isNull(this.abnormalStateList)){ if (Objects.isNull(this.dynamicAbnormalStateList)){
this.abnormalStateList = new ArrayList<>(); this.dynamicAbnormalStateList = new ArrayList<>();
} }
if (!this.statusList.contains(5)) { if (!this.dynamicStatusList.contains(5)) {
this.statusList.add(5); this.dynamicStatusList.add(5);
} }
if (!this.auditTypeList.contains(0)) { if (!this.dynamicAuditTypeList.contains(0)) {
this.auditTypeList.add(0); this.dynamicAuditTypeList.add(0);
} }
if (!this.abnormalStateList.contains(0)) { if (!this.dynamicAbnormalStateList.contains(0)) {
this.abnormalStateList.add(0); this.dynamicAbnormalStateList.add(0);
} }
if (Objects.nonNull(transportId) && transportId == 3) { if (Objects.nonNull(transportId) && transportId == 3) {
// 空运无需判断备货状态 可出、备货中、已备货 // 空运无需判断备货状态 可出、备货中、已备货
if (!this.airShipmentList.contains(10)) { if (!this.dynamicAirShipmentList.contains(10)) {
this.airShipmentList.add(10); this.dynamicAirShipmentList.add(10);
} }
}else { }else {
// 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批 // 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批
if (!this.airShipmentList.contains(20)) { if (!this.dynamicAirShipmentList.contains(20)) {
this.airShipmentList.add(20); this.dynamicAirShipmentList.add(20);
} }
} }
break; break;
case 132411: case 132411:
// 空运已出货 // 空运已出货
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.dynamicShipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.dynamicShipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(32)) { if (!this.dynamicStatusList.contains(32)) {
this.statusList.add(32); this.dynamicStatusList.add(32);
} }
if (!this.shipmentStateList.contains(411)) { if (!this.dynamicShipmentStateList.contains(411)) {
this.shipmentStateList.add(411); this.dynamicShipmentStateList.add(411);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已出货查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 132412: case 132412:
// 空运已出仓 // 空运已出仓
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.dynamicShipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.dynamicShipmentStateList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(32)) {
this.dynamicStatusList.add(32);
} }
if (!this.statusList.contains(32)) { if (!this.dynamicShipmentStateList.contains(412)) {
this.statusList.add(32); this.dynamicShipmentStateList.add(412);
} }
if (!this.shipmentStateList.contains(412)) { if (!this.dynamicTransportIdList.contains(3)) {
this.shipmentStateList.add(412); this.dynamicTransportIdList.add(3); // 空运已出仓查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 132409: case 132409:
// 空运已理货 // 空运已理货
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.dynamicShipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.dynamicShipmentStateList = new ArrayList<>();
} }
if (!this.statusList.contains(32)) { if (!this.dynamicStatusList.contains(32)) {
this.statusList.add(32); this.dynamicStatusList.add(32);
} }
if (!this.shipmentStateList.contains(409)) { if (!this.dynamicShipmentStateList.contains(409)) {
this.shipmentStateList.add(409); this.dynamicShipmentStateList.add(409);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已理货查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
case 118428: case 118428:
// 空运已到港 // 空运已到港
if (Objects.isNull(this.shipmentStateList)){ if (Objects.isNull(this.dynamicShipmentStateList)){
this.shipmentStateList = new ArrayList<>(); this.dynamicShipmentStateList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(32)) {
this.dynamicStatusList.add(32);
} }
if (!this.statusList.contains(32)) { if (!this.dynamicShipmentStateList.contains(428)) {
this.statusList.add(32); this.dynamicShipmentStateList.add(428);
} }
if (!this.shipmentStateList.contains(428)) { if (!this.dynamicTransportIdList.contains(3)) {
this.shipmentStateList.add(428); this.dynamicTransportIdList.add(3); // 空运已到港查询,只查空运的订单
} }
// this.transportId = 3; // 空运待出查询,只查空运的订单
break; break;
default: default:
if (!this.statusList.contains(asStatus)) { if (!this.dynamicStatusList.contains(asStatus)) {
this.statusList.add(asStatus); this.dynamicStatusList.add(asStatus);
} }
} }
} }
......
...@@ -140,8 +140,115 @@ ...@@ -140,8 +140,115 @@
<include refid="myOrderQuery"> <include refid="myOrderQuery">
</include> </include>
</select> </select>
<sql id="dynamicQuery">
<if test="query.dynamicStatusList != null and query.dynamicStatusList.size()>0">
AND (1 != 1
<if test="query.dynamicStatusList.size()==1 ">
or o.`status` =
<foreach item='status' index="index" collection='query.statusList' >
#{status}
</foreach>
</if>
<if test="query.dynamicStatusList.size()>1 ">
or o.`status` in
<foreach item='status' index="index" collection='query.statusList' open='(' separator=',' close=')'>
#{status}
</foreach>
</if>
<if test="query.dynamicShipmentStateList != null and query.dynamicShipmentStateList.size()>0">
<if test="query.dynamicShipmentStateList.size()==1 ">
AND o.`shipment_State` =
<foreach item='shipmentState' index="index" collection='query.dynamicShipmentStateList' >
#{shipmentState}
</foreach>
</if>
<if test="query.dynamicShipmentStateList.size()>1 ">
AND o.`shipment_State` in
<foreach item='shipmentState' index="index" collection='query.dynamicShipmentStateList' open='(' separator=',' close=')'>
#{shipmentState}
</foreach>
</if>
</if>
<if test="query.dynamicTransportIdList != null and query.dynamicTransportIdList.size() > 0">
o.`transport_id` in
<foreach item='transportId' index='index' collection='query.dynamicTransportIdList' open='(' separator=',' close=')'>
#{transportId}
</foreach>
</if>
<if test="query.dynamicAirShipmentList != null and query.dynamicAirShipmentList.size() > 0">
<foreach item='airShipment' index="index" collection='query.dynamicAirShipmentList'>
<choose>
<when test="airShipment == 1">
or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 2">
or (o.`status` = 5 AND o.air_shipment = 2)
</when>
<when test="airShipment == 3">
or (o.`status` = 5 AND o.air_shipment = 3)
</when>
<when test="airShipment == 4">
or (o.`status` = 5 AND o.air_shipment = 4)
</when>
<when test="airShipment == 10">
or (o.`status` = 5 AND o.air_shipment in(2,3,4))
</when>
<when test="airShipment == 11">
or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 12">
or (o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0)
</when>
<when test="airShipment == 20">
or (o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0)
</when>
</choose>
</foreach>
</if>
<if test="query.dynamicAbnormalStateList != null and query.dynamicAbnormalStateList.size()>0">
<foreach item='abnormalState' index="index" collection='query.dynamicAbnormalStateList'>
<choose>
<when test="abnormalState != '0'">
<choose>
<when test="abnormalState != '-1'">
OR o.`abnormal_state` = #{abnormalState}
</when>
<otherwise>
OR o.`abnormal_state` != 0
</otherwise>
</choose>
</when>
<otherwise>
OR o.`abnormal_state` = 0
</otherwise>
</choose>
</foreach>
</if>
<if test="query.dynamicAuditTypeList != null and query.dynamicAuditTypeList.size()>0">
<foreach item='auditType' index="index" collection='query.dynamicAuditTypeList'>
<choose>
<when test="auditType != 0">
<choose>
<when test="auditType != -1">
or o.`audit_type` = #{auditType}
</when>
<otherwise>
or o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
or o.`audit_type` = 0
</otherwise>
</choose>
</foreach>
</if>
)
</if>
</sql>
<sql id="orderQuerySql"> <sql id="orderQuerySql">
<include refid="dynamicQuery"/>
<if test="query.isNeat == false "> <if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if> </if>
...@@ -367,7 +474,6 @@ ...@@ -367,7 +474,6 @@
#{shipmentState} #{shipmentState}
</foreach> </foreach>
</if> </if>
<if test="query.shipmentStateList != null and query.shipmentStateList.size()>1 "> <if test="query.shipmentStateList != null and query.shipmentStateList.size()>1 ">
AND o.`shipment_State` in AND o.`shipment_State` in
<foreach item='shipmentState' index="index" collection='query.shipmentStateList' open='(' separator=',' close=')'> <foreach item='shipmentState' index="index" collection='query.shipmentStateList' open='(' separator=',' close=')'>
...@@ -742,6 +848,7 @@ ...@@ -742,6 +848,7 @@
</sql> </sql>
<sql id="myOrderQuerySql"> <sql id="myOrderQuerySql">
<include refid="dynamicQuery"/>
<if test="query.isNeat == false "> <if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if> </if>
...@@ -1690,6 +1797,7 @@ ...@@ -1690,6 +1797,7 @@
</select> </select>
<sql id="myOrderQuery"> <sql id="myOrderQuery">
<include refid="dynamicQuery"/>
<if test="query.isNeat == false "> <if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if> </if>
...@@ -2486,6 +2594,7 @@ ...@@ -2486,6 +2594,7 @@
<sql id="orderQuery"> <sql id="orderQuery">
<include refid="dynamicQuery"/>
<if test="query.isNeat == false "> <if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if> </if>
...@@ -3433,6 +3542,7 @@ ...@@ -3433,6 +3542,7 @@
</sql> </sql>
<sql id="issuedOrderQuery"> <sql id="issuedOrderQuery">
<include refid="dynamicQuery"/>
<if test="query.isNeat == false "> <if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if> </if>
...@@ -5073,6 +5183,7 @@ ...@@ -5073,6 +5183,7 @@
<include refid="appOrderQurey"/> <include refid="appOrderQurey"/>
</select> </select>
<sql id="appOrderQurey"> <sql id="appOrderQurey">
<include refid="dynamicQuery"/>
<if test="query.isNeat == false "> <if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment