Commit 066fe581 authored by zhengyi's avatar zhengyi

订单动态多值查询bug修复

parent 8e7bcdb1
...@@ -637,20 +637,20 @@ public class OrderQueryVO { ...@@ -637,20 +637,20 @@ public class OrderQueryVO {
@ApiModelProperty(value = "动态查询审核类型(字典 order_approval_type) 0 为正常") @ApiModelProperty(value = "动态查询审核类型(字典 order_approval_type) 0 为正常")
private List<Integer> dynamicAuditTypeList; private List<Integer> dynamicAuditTypeList;
@ApiModelProperty(value = "动态查询订单异常状态(字典 order_abnormal_state)") // @ApiModelProperty(value = "动态查询订单异常状态(字典 order_abnormal_state)")
private List<Integer> dynamicAbnormalStateList; // private List<Integer> dynamicAbnormalStateList;
//
@ApiModelProperty(value = "动态查询订单入仓状态(字典 order_warehouse_in_status)") // @ApiModelProperty(value = "动态查询订单入仓状态(字典 order_warehouse_in_status)")
private List<Integer> dynamicInWarehouseStateList; // private List<Integer> dynamicInWarehouseStateList;
//
@ApiModelProperty(value = "动态查询订单出货状态(字典 order_shipment_state)") // @ApiModelProperty(value = "动态查询订单出货状态(字典 order_shipment_state)")
private List<Integer> dynamicShipmentStateList; // private List<Integer> dynamicShipmentStateList;
//
@ApiModelProperty(value = "动态查询空运可出货状态:0 默认值 1 待出 2 可出 3 备货中 4 已备货 10 可出、备货中、已备货 11 待出、可出、备货中、已备货 12 可出、备货中") // @ApiModelProperty(value = "动态查询空运可出货状态:0 默认值 1 待出 2 可出 3 备货中 4 已备货 10 可出、备货中、已备货 11 待出、可出、备货中、已备货 12 可出、备货中")
private List<Integer> dynamicAirShipmentList; // private List<Integer> dynamicAirShipmentList;
//
@ApiModelProperty(value = "动态查询运输方式") // @ApiModelProperty(value = "动态查询运输方式")
private List<Integer> dynamicTransportIdList; // private List<Integer> dynamicTransportIdList;
@ApiModelProperty(value = "动态查询状态字段") @ApiModelProperty(value = "动态查询状态字段")
...@@ -675,33 +675,18 @@ public class OrderQueryVO { ...@@ -675,33 +675,18 @@ 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)) { this.dynamicStatusList = asStatusList;
this.dynamicStatusList = new ArrayList<>();
for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId);
}
}
} }
public void setStatusString(String statusString) { public void setStatusString(String statusString) {
if (StringUtils.isNotBlank(statusString)) { if (StringUtils.isNotBlank(statusString)) {
this.asStatusList = Arrays.stream(statusString.split(StrUtil.COMMA)).map(Integer::parseInt).collect(Collectors.toList()); this.dynamicStatusList = Arrays.stream(statusString.split(StrUtil.COMMA)).map(Integer::parseInt).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(this.asStatusList)) {
this.dynamicStatusList = new ArrayList<>();
for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId);
}
}
} }
} }
public void setStatusList(List<Integer> statusList) { public void setStatusList(List<Integer> statusList) {
this.statusList = statusList; this.statusList = statusList;
this.asStatusList = statusList; this.dynamicStatusList = statusList;
if (CollectionUtil.isNotEmpty(this.asStatusList)) {
this.dynamicStatusList = new ArrayList<>();
for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId);
}
}
} }
public void setTransportId(Integer transportId) { public void setTransportId(Integer transportId) {
...@@ -709,12 +694,6 @@ public class OrderQueryVO { ...@@ -709,12 +694,6 @@ public class OrderQueryVO {
if (Objects.nonNull(transportId) && Objects.nonNull(this.asStatus)) { if (Objects.nonNull(transportId) && Objects.nonNull(this.asStatus)) {
combinedState(this.asStatus, this.transportId); combinedState(this.asStatus, this.transportId);
} }
if (Objects.nonNull(transportId) && CollectionUtil.isNotEmpty(this.asStatusList)) {
this.dynamicStatusList = new ArrayList<>();
for (Integer asStatus : asStatusList) {
combinedStateList(asStatus, this.transportId);
}
}
} }
private void combinedState(Integer asStatus, Integer transportId) { private void combinedState(Integer asStatus, Integer transportId) {
...@@ -783,195 +762,68 @@ public class OrderQueryVO { ...@@ -783,195 +762,68 @@ 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.dynamicShipmentStateList)){ // if (!this.dynamicStatusList.contains(12325)) {
this.dynamicShipmentStateList = new ArrayList<>(); // this.dynamicStatusList.add(12325);
} // }
if (!this.dynamicStatusList.contains(12)) { // break;
this.dynamicStatusList.add(12); // case 10501:
} // // 空运待出
if (!this.dynamicShipmentStateList.contains(325)) { // if (!this.dynamicStatusList.contains(10501)) {
this.dynamicShipmentStateList.add(325); // this.dynamicStatusList.add(10501);
} // }
break; // break;
case 10501: // case 10502:
// 空运待出 // // 空运可出
if (Objects.isNull(this.dynamicAirShipmentList)){ // if (!this.dynamicStatusList.contains(10502)) {
this.dynamicAirShipmentList = new ArrayList<>(); // this.dynamicStatusList.add(10502);
} // }
if (Objects.isNull(this.dynamicAuditTypeList)){ // break;
this.dynamicAuditTypeList = new ArrayList<>(); // case 10503:
} // // 空运已备货
if (Objects.isNull(this.dynamicAbnormalStateList)){ // if (!this.dynamicStatusList.contains(10503)) {
this.dynamicAbnormalStateList = new ArrayList<>(); // this.dynamicStatusList.add(10503);
} // }
if (Objects.isNull(this.dynamicTransportIdList)) { // break;
this.dynamicTransportIdList = new ArrayList<>(); // case 10504:
} // // 待排单
if (!this.dynamicStatusList.contains(5)) { // if (!this.dynamicStatusList.contains(10504)) {
this.dynamicStatusList.add(5); // this.dynamicStatusList.add(10504);
} // }
if (!this.dynamicAirShipmentList.contains(1)) { //
this.dynamicAirShipmentList.add(1); // break;
} // case 132411:
if (!this.dynamicAuditTypeList.contains(0)) { // // 空运已出货
this.dynamicAuditTypeList.add(0); // if (!this.dynamicStatusList.contains(132411)) {
} // this.dynamicStatusList.add(132411);
if (!this.dynamicAbnormalStateList.contains(0)) { // }
this.dynamicAbnormalStateList.add(0); //
} // break;
if (!this.dynamicTransportIdList.contains(3)) { // case 132412:
this.dynamicTransportIdList.add(3); // 空运待出查询,只查空运的订单 // // 空运已出仓
} // if (!this.dynamicStatusList.contains(132412)) {
break; // this.dynamicStatusList.add(132412);
case 10502: // }
// 空运可出 // break;
if (Objects.isNull(this.dynamicAirShipmentList)){ // case 132409:
this.dynamicAirShipmentList = new ArrayList<>(); // if (!this.dynamicStatusList.contains(132409)) {
} // this.dynamicStatusList.add(132409);
if (Objects.isNull(this.dynamicTransportIdList)) { // }
this.dynamicTransportIdList = new ArrayList<>(); // break;
} // case 118428:
if (!this.dynamicStatusList.contains(5)) { // // 空运已到港
this.dynamicStatusList.add(5); // if (!this.dynamicStatusList.contains(118428)) {
} // this.dynamicStatusList.add(118428);
if (!this.dynamicAirShipmentList.contains(12)) { // }
this.dynamicAirShipmentList.add(12); // break;
} // default:
if (!this.dynamicTransportIdList.contains(3)) { // if (!this.dynamicStatusList.contains(asStatus)) {
this.dynamicTransportIdList.add(3); // 空运可出查询,只查空运的订单 // this.dynamicStatusList.add(asStatus);
} // }
break; // }
case 10503: // }
// 空运已备货
if (Objects.isNull(this.dynamicAirShipmentList)){
this.dynamicAirShipmentList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicTransportIdList)) {
this.dynamicTransportIdList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(5)) {
this.dynamicStatusList.add(5);
}
if (!this.dynamicAirShipmentList.contains(4)) {
this.dynamicAirShipmentList.add(4);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已备货查询,只查空运的订单
}
break;
case 10504:
// 待排单
if (Objects.isNull(this.dynamicAirShipmentList)){
this.dynamicAirShipmentList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicAuditTypeList)){
this.dynamicAuditTypeList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicAbnormalStateList)){
this.dynamicAbnormalStateList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(5)) {
this.dynamicStatusList.add(5);
}
if (!this.dynamicAuditTypeList.contains(0)) {
this.dynamicAuditTypeList.add(0);
}
if (!this.dynamicAbnormalStateList.contains(0)) {
this.dynamicAbnormalStateList.add(0);
}
if (Objects.nonNull(transportId) && transportId == 3) {
// 空运无需判断备货状态 可出、备货中、已备货
if (!this.dynamicAirShipmentList.contains(10)) {
this.dynamicAirShipmentList.add(10);
}
}else {
// 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批
if (!this.dynamicAirShipmentList.contains(20)) {
this.dynamicAirShipmentList.add(20);
}
}
break;
case 132411:
// 空运已出货
if (Objects.isNull(this.dynamicShipmentStateList)){
this.dynamicShipmentStateList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicTransportIdList)) {
this.dynamicTransportIdList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(32)) {
this.dynamicStatusList.add(32);
}
if (!this.dynamicShipmentStateList.contains(411)) {
this.dynamicShipmentStateList.add(411);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已出货查询,只查空运的订单
}
break;
case 132412:
// 空运已出仓
if (Objects.isNull(this.dynamicShipmentStateList)){
this.dynamicShipmentStateList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicTransportIdList)) {
this.dynamicTransportIdList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(32)) {
this.dynamicStatusList.add(32);
}
if (!this.dynamicShipmentStateList.contains(412)) {
this.dynamicShipmentStateList.add(412);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已出仓查询,只查空运的订单
}
break;
case 132409:
// 空运已理货
if (Objects.isNull(this.dynamicShipmentStateList)){
this.dynamicShipmentStateList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicTransportIdList)) {
this.dynamicTransportIdList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(32)) {
this.dynamicStatusList.add(32);
}
if (!this.dynamicShipmentStateList.contains(409)) {
this.dynamicShipmentStateList.add(409);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已理货查询,只查空运的订单
}
break;
case 118428:
// 空运已到港
if (Objects.isNull(this.dynamicShipmentStateList)){
this.dynamicShipmentStateList = new ArrayList<>();
}
if (Objects.isNull(this.dynamicTransportIdList)) {
this.dynamicTransportIdList = new ArrayList<>();
}
if (!this.dynamicStatusList.contains(32)) {
this.dynamicStatusList.add(32);
}
if (!this.dynamicShipmentStateList.contains(428)) {
this.dynamicShipmentStateList.add(428);
}
if (!this.dynamicTransportIdList.contains(3)) {
this.dynamicTransportIdList.add(3); // 空运已到港查询,只查空运的订单
}
break;
default:
if (!this.dynamicStatusList.contains(asStatus)) {
this.dynamicStatusList.add(asStatus);
}
}
}
public void setShipmentState(Integer shipmentState) { public void setShipmentState(Integer shipmentState) {
......
...@@ -143,106 +143,47 @@ ...@@ -143,106 +143,47 @@
<sql id="dynamicQuery"> <sql id="dynamicQuery">
<if test="query.dynamicStatusList != null and query.dynamicStatusList.size()>0"> <if test="query.dynamicStatusList != null and query.dynamicStatusList.size()>0">
AND (1 != 1 AND (1 != 1
<if test="query.dynamicStatusList.size()==1 "> <foreach item='status' index="index" collection='query.dynamicStatusList'>
or o.`status` =
<foreach item='status' index="index" collection='query.dynamicStatusList' >
#{status}
</foreach>
</if>
<if test="query.dynamicStatusList.size()>1 ">
or o.`status` in
<foreach item='status' index="index" collection='query.dynamicStatusList' open='(' separator=',' close=')'>
#{status}
</foreach>
</if>
<if test="query.dynamicShipmentStateList != null and query.dynamicShipmentStateList.size()>0">
<if test="query.dynamicShipmentStateList.size()==1 ">
or o.`shipment_State` =
<foreach item='shipmentState' index="index" collection='query.dynamicShipmentStateList' >
#{shipmentState}
</foreach>
</if>
<if test="query.dynamicShipmentStateList.size()>1 ">
or 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">
or 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> <choose>
<when test="airShipment == 1"> <when test="status == 12325">
or (o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0) or (o.`status` = 12 and o.`shipment_State` = 325)
</when> </when>
<when test="airShipment == 2"> <when test="status == 10501">
or (o.`status` = 5 AND o.air_shipment = 2) or (o.`status` = 5 AND o.air_shipment = 1 and o.abnormal_state = 0 and o.audit_type = 0 and o.transport_id = 3)
</when> </when>
<when test="airShipment == 3"> <when test="status == 10502">
or (o.`status` = 5 AND o.air_shipment = 3) or (o.`status` = 5 AND o.air_shipment in(2,3) and o.abnormal_state = 0 and o.audit_type = 0 and o.transport_id = 3)
</when> </when>
<when test="airShipment == 4"> <when test="status == 10503">
or (o.`status` = 5 AND o.air_shipment = 4) or (o.`status` = 5 AND o.air_shipment = 4 and o.transport_id = 3)
</when> </when>
<when test="airShipment == 10"> <when test="status == 10504">
or (o.`status` = 5 AND o.air_shipment in(2,3,4)) or (
</when> o.`status` = 5 and o.abnormal_state = 0 and o.audit_type = 0
<when test="airShipment == 11"> and (
or (o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0) (o.transport_id = 3 AND o.air_shipment in(2,3,4))
</when> or
<when test="airShipment == 12"> (o.transport_id = 1 AND o.air_shipment in(0,2,3,4))
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> </when>
</choose> <when test="status == 132411">
</foreach> or (o.`status` = 32 AND o.shipment_State = 411 and o.transport_id = 3)
</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> </when>
<otherwise> <when test="status == 132412">
OR o.`abnormal_state` != 0 or (o.`status` = 32 AND o.shipment_State = 412 and o.transport_id = 3)
</otherwise>
</choose>
</when> </when>
<otherwise> <when test="status == 132409">
OR o.`abnormal_state` = 0 or (o.`status` = 32 AND o.shipment_State = 409 and o.transport_id = 3)
</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> </when>
<otherwise> <when test="status == 118428">
or o.`audit_type` != 0 or (o.`status` = 32 AND o.shipment_State = 428 and o.transport_id = 3)
</otherwise>
</choose>
</when> </when>
<otherwise> <otherwise>
or o.`audit_type` = 0 or o.`status` = #{status}
</otherwise> </otherwise>
</choose> </choose>
</foreach> </foreach>
</if>
) )
</if> </if>
</sql> </sql>
......
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