Commit c9e95124 authored by chenjiuping's avatar chenjiuping

Merge remote-tracking branch 'origin/dev' into dev

parents 5a05a369 60557476
......@@ -100,7 +100,7 @@ public interface OrderApprovalMapper extends AbstractMapper<OrderApprovalDO> {
OrderApprovalDO itemApprovalCount(@Param("orderItemId") Long orderItemId, @Param("orderId") Long orderId, @Param("types") List<Integer> types);
@ResultType(OrderSpecialApplyVO.class)
@ResultType(Integer.class)
@Select({
"<script>",
"select",
......
......@@ -3833,7 +3833,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
// "</when>",
// "</script>"
// })
StatisticsOrderVO statisticsMyOrder(@Param("query") OrderQueryDTO query);
StatisticsOrderVO statisticsMyOrder(@Param("query") OrderQueryVO query);
/**
......@@ -4844,38 +4844,38 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
// "where whl.dest_warehouse_id = #{query.destWarehouseId} ",
// "))",
// "</when>",
" <if test=\"query.startWarehouseId !=null and query.destWarehouseId !=null \">\n" +
" <if test=\"query.startWarehouseIds !=null and query.destWarehouseIds !=null \">\n" +
" and (o.line_id in(\n" +
" select whl.id\n" +
" from ecw_warehouse_line whl\n" +
" where whl.start_warehouse_id in\n" +
" <foreach item='warehouseId' collection='query.startWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{warehouseId}\n" +
" </foreach>\n" +
"\n" +
" and whl.dest_warehouse_id in\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{destWarehouseId}\n" +
" </foreach>\n" +
"\n" +
" ))\n" +
" </if>\n" +
" <if test=\"query.startWarehouseId !=null and query.destWarehouseId==null\">\n" +
" <if test=\"query.startWarehouseIds !=null and query.destWarehouseIds==null\">\n" +
" and (o.line_id in(\n" +
" select whl.id\n" +
" from ecw_warehouse_line whl\n" +
" where whl.start_warehouse_id in\n" +
" <foreach item='warehouseId' collection='query.startWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{warehouseId}\n" +
" </foreach>\n" +
" ))\n" +
" </if>\n" +
" <if test=\"query.startWarehouseId ==null and query.destWarehouseId !=null \">\n" +
" <if test=\"query.startWarehouseIds ==null and query.destWarehouseIds !=null \">\n" +
" and (o.line_id in(\n" +
" select whl.id\n" +
" from ecw_warehouse_line whl\n" +
" where whl.dest_warehouse_id in\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{destWarehouseId}\n" +
" </foreach>\n" +
"\n" +
......@@ -4919,7 +4919,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"</script>"
})
StatisticsOrderVO statisticsMyWarehouseIn(@Param("query") OrderQueryDTO query);
StatisticsOrderVO statisticsMyWarehouseIn(@Param("query") OrderQueryVO query);
@ResultType(StatisticsOrderVO.class)
@Select({
......@@ -5766,38 +5766,38 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
// "where whl.dest_warehouse_id = #{query.destWarehouseId} ",
// "))",
// "</when>",
" <if test=\"query.startWarehouseId !=null and query.destWarehouseId !=null \">\n" +
" <if test=\"query.startWarehouseIds !=null and query.destWarehouseIds !=null \">\n" +
" and (o.line_id in(\n" +
" select whl.id\n" +
" from ecw_warehouse_line whl\n" +
" where whl.start_warehouse_id in\n" +
" <foreach item='warehouseId' collection='query.startWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{warehouseId}\n" +
" </foreach>\n" +
"\n" +
" and whl.dest_warehouse_id in\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{destWarehouseId}\n" +
" </foreach>\n" +
"\n" +
" ))\n" +
" </if>\n" +
" <if test=\"query.startWarehouseId !=null and query.destWarehouseId==null\">\n" +
" <if test=\"query.startWarehouseIds !=null and query.destWarehouseIds==null\">\n" +
" and (o.line_id in(\n" +
" select whl.id\n" +
" from ecw_warehouse_line whl\n" +
" where whl.start_warehouse_id in\n" +
" <foreach item='warehouseId' collection='query.startWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{warehouseId}\n" +
" </foreach>\n" +
" ))\n" +
" </if>\n" +
" <if test=\"query.startWarehouseId ==null and query.destWarehouseId !=null \">\n" +
" <if test=\"query.startWarehouseIds ==null and query.destWarehouseIds !=null \">\n" +
" and (o.line_id in(\n" +
" select whl.id\n" +
" from ecw_warehouse_line whl\n" +
" where whl.dest_warehouse_id in\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseId' open='(' separator=',' close=')'>\n" +
" <foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>\n" +
" #{destWarehouseId}\n" +
" </foreach>\n" +
"\n" +
......@@ -5841,7 +5841,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"</script>"
})
StatisticsOrderVO statisticsMyPickUp(@Param("query") OrderQueryDTO query);
StatisticsOrderVO statisticsMyPickUp(@Param("query") OrderQueryVO query);
@ResultType(OrderDO.class)
@Select({
......
......@@ -314,7 +314,7 @@ public interface OrderQueryService {
List<OrderDO> getOrderChildren(List<Long> orderIds);
StatisticsOrderVO statisticsOrder(OrderQueryVO query);
StatisticsOrderVO statisticsMyOrder(OrderQueryDTO query) ;
StatisticsOrderVO statisticsMyOrder(OrderQueryVO query) ;
void exportOrderExcel(HttpServletResponse response, OrderQueryVO query) throws IOException;
......
......@@ -28,6 +28,7 @@ import cn.iocoder.yudao.module.depository.dto.LogisticsInfoDto;
import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO;
import cn.iocoder.yudao.module.ecw.api.customer.CustomerApi;
import cn.iocoder.yudao.module.ecw.api.unit.UnitApi;
import cn.iocoder.yudao.module.ecw.api.unit.dto.UnitRespDto;
import cn.iocoder.yudao.module.ecw.dal.dataobject.country.CountryDO;
......@@ -146,6 +147,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
private final CurrencyApi currencyApi;
private final OrderQueryService orderQueryService;
private final UnitApi unitApi;
private final CustomerApi customerApi;
private final OrderOperateLogService orderOperateLogService;
......@@ -1419,6 +1421,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderTimeDO.setRemarksZh(orderAirTimeEnum.getRemarksZh());
orderTimeDO.setRemarksEn(orderAirTimeEnum.getRemarksEn());
orderTimeDO.setMark(1);
// 空运出仓动态更新时,需要同步更新订单的收发客户的首次成交状态
OrderConsignorDO orderConsignorDO = orderConsignorService.getOrderConsignorByOrderId(orderDO.getOrderId());
customerApi.fillFirstDealTimeIfNull(orderConsignorDO.getCustomerId(), businessTime);
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOrderConsigneeByOrderId(orderDO.getOrderId());
if (Objects.nonNull(orderConsigneeDO)) {
customerApi.fillFirstDealTimeIfNull(orderConsigneeDO.getCustomerId(), businessTime);
}
break;
case AIR_CUSTOMS_IN_PROGRESS:
orderTimeDO.setRemarksZh(String.format(orderAirTimeEnum.getRemarksZh(), reasonZh));
......@@ -1584,6 +1593,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderTimeDO.setMark(1); // 装柜字体标红
orderTimeDO.setRemarksZh(String.format(orderSeaTimeEnum.getRemarksZh(), Objects.nonNull(estTime) ? DateUtil.formatDateTime(estTime) : ""));
orderTimeDO.setRemarksEn(String.format(orderSeaTimeEnum.getRemarksEn(), Objects.nonNull(estTime) ? DateUtil.formatDateTime(estTime) : ""));
// 海运装柜动态更新时,需要同步更新订单的收发客户的首次成交状态
OrderConsignorDO orderConsignorDO = orderConsignorService.getOrderConsignorByOrderId(orderDO.getOrderId());
customerApi.fillFirstDealTimeIfNull(orderConsignorDO.getCustomerId(), businessTime);
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOrderConsigneeByOrderId(orderDO.getOrderId());
if (Objects.nonNull(orderConsigneeDO)) {
customerApi.fillFirstDealTimeIfNull(orderConsigneeDO.getCustomerId(), businessTime);
}
break;
case SEA_CUSTOMS_PASS_SEA:
orderTimeDO.setRemarksZh(String.format(orderSeaTimeEnum.getRemarksZh(), Objects.nonNull(estTime) ? DateUtil.formatDateTime(estTime) : ""));
......
......@@ -1767,8 +1767,8 @@ public class OrderQueryServiceImpl implements OrderQueryService {
}
@Override
public StatisticsOrderVO statisticsMyOrder(OrderQueryDTO query) {
caseStatus(query.getStatus(), query);
public StatisticsOrderVO statisticsMyOrder(OrderQueryVO query) {
// caseStatus(query.getStatus(), query);
StatisticsOrderVO vo = orderMapper.statisticsMyOrder(query);
if (Objects.nonNull(vo)) {
vo.setTotalVolume(new BigDecimal(vo.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
......
......@@ -607,6 +607,11 @@ public class OrderCargoControlServiceImpl extends AbstractService<OrderCargoCont
}
Date now = new Date();
OrderDO orderDO = orderService.getById(orderCargoControlApplyVO.getOrderId());
// TODO 待确认具体拦截哪些审批任务
int count = orderApprovalMapper.processingItemApproval(null, orderCargoControlApplyVO.getOrderId(), Arrays.asList(orderCargoControlApplyVO.getApplyType(), 14));
if (count > 0){
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
OrderCargoControlReleaseInfoDto releaseInfoDto = this.getOrderCargoControlReleaseInfo(orderCargoControlApplyVO.getOrderId());
orderCargoControlApplyVO.setOrderNo(releaseInfoDto.getOrderNo());
orderCargoControlApplyVO.setPickQuantity(releaseInfoDto.getPickQuantity());
......
......@@ -560,6 +560,14 @@ public class OrderQueryVO {
@ApiModelProperty(value = "报关类别:我司全代:1,自单代报:2,混合报关:3")
private List<Integer> customsTypes;
@ApiModelProperty(value = "产品备案属性:1有牌,2无牌,3中性,4混牌")
private List<Integer> productRecords;
@ApiModelProperty(value = "客户经理ids")
private List<Long> salesmanIds;
@ApiModelProperty(value = "渠道ids")
private List<Long> channelIds;
@ApiModelProperty(value = "审核类型(字典 order_approval_type) 0 为正常")
private List<Integer> auditTypeList;
......
......@@ -341,6 +341,7 @@
<if test="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<if test="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
......@@ -422,6 +423,40 @@
))
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsTypes' >
#{customsType}
</foreach>
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
#{customsType}
</foreach>
</if>
</if>
<if test="query.productRecords != null and query.productRecords.size()>0">
<if test="query.productRecords != null and query.productRecords.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecords' >
#{productRecord}
</foreach>
</if>
<if test="query.productRecords != null and query.productRecords.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecords' open='(' separator=',' close=')'>
#{productRecord}
</foreach>
</if>
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
......@@ -585,14 +620,14 @@
</sql>
<sql id="myOrderQuerySql">
<!-- <if test="query.status != null">-->
<!-- AND o.`status` = #{query.status}-->
<!-- </if>-->
<!-- <if test="query.status != null">-->
<!-- AND o.`status` = #{query.status}-->
<!-- </if>-->
<if test="query.statusList != null and query.statusList.size()>0">
<if test="query.statusList != null and query.statusList != '' and query.statusList.size()==1 ">
AND o.`status` =
<foreach item='status' index="index" collection='query.statusList' >
<foreach item='status' index="index" collection='query.statusList'>
#{status}
</foreach>
</if>
......@@ -606,49 +641,50 @@
</if>
<if test="query.salesmanId != null and query.creator">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` = #{query.creator})
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where
cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ) or o.`creator` =
#{query.creator})
</if>
<if test="query.customsType != null">
AND o.`customs_type` = #{query.customsType}
</if>
<if test="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<!-- <if test="query.customsType != null">-->
<!-- AND o.`customs_type` = #{query.customsType}-->
<!-- </if>-->
<!-- <if test="query.productRecord != null">-->
<!-- AND o.`product_record` = #{query.productRecord}-->
<!-- </if>-->
<if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsTypes' >
<foreach item='customsType' index="index" collection='query.customsTypes'>
#{customsType}
</foreach>
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=','
close=')'>
#{customsType}
</foreach>
</if>
</if>
<if test="query.productRecords != null and query.productRecords.size()>0">
<if test="query.productRecord != null and query.productRecord.size()>0">
<if test="query.productRecord != null and query.productRecord != '' and query.productRecord.size()==1 ">
<if test="query.productRecords != null and query.productRecords.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecord' >
<foreach item='productRecord' index="index" collection='query.productRecords'>
#{productRecord}
</foreach>
</if>
<if test="query.productRecord != null and query.productRecord != '' and query.productRecord.size()>1 ">
<if test="query.productRecords != null and query.productRecords.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecord' open='(' separator=',' close=')'>
<foreach item='productRecord' index="index" collection='query.productRecords' open='(' separator=','
close=')'>
#{productRecord}
</foreach>
</if>
</if>
<if test="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
......@@ -656,81 +692,54 @@
<if test="query.warehouseType != null">
AND o.`warehouse_type` = #{query.warehouseType}
</if>
<!-- <if test="query.warehouseTypes != null and query.warehouseTypes.size()>0">-->
<!-- <if test="query.warehouseTypes != null and query.warehouseTypes.size()==1 ">-->
<!-- AND o.`warehouse_type` =-->
<!-- <foreach item='warehouseType' index="index" collection='query.warehouseTypes' >-->
<!-- #{warehouseType}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.warehouseTypes != null and query.warehouseTypes.size()>1 ">-->
<!-- AND o.`warehouse_type` in-->
<!-- <foreach item='warehouseType' index="index" collection='query.warehouseTypes' open='(' separator=',' close=')'>-->
<!-- #{warehouseType}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="query.objectiveId != null and query.objectiveId.size() != 0">-->
<!-- <if test="query.objectiveIds != null and query.objectiveIds.size()==1 ">-->
<!-- AND ob.`objective_id` =-->
<!-- <foreach item='objectiveId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>-->
<!-- #{objectiveId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.objectiveIds != null and query.objectiveIds.size()>1 ">-->
<!-- AND ob.`objective_id` in-->
<!-- <foreach item='objectiveId' index='index' collection='query.objectiveIds' open='(' separator=',' close=')'>-->
<!-- #{objectiveId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">-->
<!-- AND ob.`objective_country_id` in-->
<!-- <foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>-->
<!-- #{destCountryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>-->
<!-- #{warehouseId}-->
<!-- </foreach>-->
<!-- and whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test="query.startWarehouseId !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseId==null or query.destWarehouseIds.size() == 0) ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>-->
<!-- #{warehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<if test="query.channelIds != null and query.channelIds.size()>0">
<if test="query.channelIds != null and query.channelIds.size()==1 ">
AND o.`channel_id` =
<foreach item='channelId' index="index" collection='query.channelIds'>
#{channelId}
</foreach>
</if>
<if test="query.channelIds != null and query.channelIds.size()>1 ">
AND o.`channel_id` in
<foreach item='channelId' index="index" collection='query.channelIds' open='(' separator=',' close=')'>
#{channelId}
</foreach>
</if>
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>0">
<if test="query.salesmanIds != null and query.salesmanIds.size()==1 ">
AND (o.`salesman_id` =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
))
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>1 ">
AND (o.`salesman_id` in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in (select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
)
)
</if>
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
......@@ -739,7 +748,8 @@
from ecw_order_item oi
where oi.deleted = 0 and
((oi.warehouse_in_info is null and oi.express_no like concat('%',concat(#{query.number},'%')))
or (oi.warehouse_in_info is not null and oi.warehouse_in_info ->> '$.expressNo' like concat("%",concat(#{query.number},"%"))))))
or (oi.warehouse_in_info is not null and oi.warehouse_in_info ->> '$.expressNo' like
concat("%",concat(#{query.number},"%"))))))
</if>
<if test="query.notNumber != null and query.notNumber != '' ">
AND o.`number` not like concat("%",concat(#{query.notNumber},"%"))
......@@ -796,8 +806,10 @@
AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}
</if>
<if test="query.beginOutboundTime != null and query.endOutboundTime != null ">
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and #{query.endOutboundTime})
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join
ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and
#{query.endOutboundTime})
</if>
<if test="query.beginLoadTime != null and query.endLoadTime != null ">
AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
......@@ -820,8 +832,10 @@
concat("%",concat(#{query.searchKey},"%"))
</if>
<if test="query.numberKey != null and query.numberKey != '' ">
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,''),IFNULL(o.`parent_number`,''), IFNULL(o.`initial_parent_order_no`,'')
,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,'')) like concat("%",concat(#{query.numberKey},"%"))
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,''),IFNULL(o.`parent_number`,''),
IFNULL(o.`initial_parent_order_no`,'')
,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,'')) like
concat("%",concat(#{query.numberKey},"%"))
</if>
<if test="query.prodKey != null and query.prodKey != '' ">
and (o.order_id in(
......@@ -880,58 +894,59 @@
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0 and (oi.`prod_title_zh` = #{query.notEqProdKey} or oi.`prod_title_en` = #{query.notEqProdKey}
where oi.deleted = 0 and (oi.`prod_title_zh` = #{query.notEqProdKey} or oi.`prod_title_en` =
#{query.notEqProdKey}
or pt.`title_zh` = #{query.notEqProdKey} or pt.`title_en` = #{query.notEqProdKey}
or pb.`title_zh` = #{query.notEqProdKey} or pb.`title_en` = #{query.notEqProdKey})
))
</if>
<!-- <if test="query.objectiveId != null and query.objectiveId.size() != 0">-->
<!-- AND ob.`objective_id` in-->
<!-- <foreach item='orderId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>-->
<!-- #{orderId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.destCountryId != null ">-->
<!-- AND ob.`objective_country_id` in-->
<!-- <foreach item='destCountryId' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>-->
<!-- #{destCountryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId != null and query.destWarehouseId != null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{startWarehouseId}-->
<!-- </foreach>-->
<!-- and whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId != null and query.destWarehouseId == null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{startWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId == null and query.destWarehouseId != null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test="query.objectiveId != null and query.objectiveId.size() != 0">-->
<!-- AND ob.`objective_id` in-->
<!-- <foreach item='orderId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>-->
<!-- #{orderId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.destCountryId != null ">-->
<!-- AND ob.`objective_country_id` in-->
<!-- <foreach item='destCountryId' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>-->
<!-- #{destCountryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId != null and query.destWarehouseId != null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{startWarehouseId}-->
<!-- </foreach>-->
<!-- and whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId != null and query.destWarehouseId == null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.start_warehouse_id in-->
<!-- <foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{startWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<!-- <if test = "query.startWarehouseId == null and query.destWarehouseId != null ">-->
<!-- and (o.line_id in(-->
<!-- select whl.id-->
<!-- from ecw_warehouse_line whl-->
<!-- where whl.dest_warehouse_id in-->
<!-- <foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>-->
<!-- #{destWarehouseId}-->
<!-- </foreach>-->
<!-- ))-->
<!-- </if>-->
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -1631,18 +1646,18 @@
</if>
<if test="query.customsType != null and query.customsType.size()>0">
<if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsType != null and query.customsType != '' and query.customsType.size()==1 ">
<if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsType' >
<foreach item='customsType' index="index" collection='query.customsTypes' >
#{customsType}
</foreach>
</if>
<if test="query.customsType != null and query.customsType != '' and query.customsType.size()>1 ">
<if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsType' open='(' separator=',' close=')'>
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
#{customsType}
</foreach>
</if>
......@@ -1650,18 +1665,18 @@
</if>
<if test="query.productRecord != null and query.productRecord.size()>0">
<if test="query.productRecords != null and query.productRecords.size()>0">
<if test="query.productRecord != null and query.productRecord != '' and query.productRecord.size()==1 ">
<if test="query.productRecords != null and query.productRecords.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecord' >
<foreach item='productRecord' index="index" collection='query.productRecords' >
#{productRecord}
</foreach>
</if>
<if test="query.productRecord != null and query.productRecord != '' and query.productRecord.size()>1 ">
<if test="query.productRecords != null and query.productRecords.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecord' open='(' separator=',' close=')'>
<foreach item='productRecord' index="index" collection='query.productRecords' open='(' separator=',' close=')'>
#{productRecord}
</foreach>
</if>
......@@ -1674,6 +1689,54 @@
<if test="query.channelId != null">
AND o.`channel_id` = #{query.channelId}
</if>
<if test="query.channelIds != null and query.channelIds.size()>0">
<if test="query.channelIds != null and query.channelIds.size()==1 ">
AND o.`channel_id` =
<foreach item='channelId' index="index" collection='query.channelIds'>
#{channelId}
</foreach>
</if>
<if test="query.channelIds != null and query.channelIds.size()>1 ">
AND o.`channel_id` in
<foreach item='channelId' index="index" collection='query.channelIds' open='(' separator=',' close=')'>
#{channelId}
</foreach>
</if>
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>0">
<if test="query.salesmanIds != null and query.salesmanIds.size()==1 ">
AND (o.`salesman_id` =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
))
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>1 ">
AND (o.`salesman_id` in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in (select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
)
)
</if>
</if>
<if test="query.number != null and query.number != '' ">
AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
......@@ -2337,6 +2400,87 @@
</foreach>
))
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsTypes' >
#{customsType}
</foreach>
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
#{customsType}
</foreach>
</if>
</if>
<if test="query.productRecords != null and query.productRecords.size()>0">
<if test="query.productRecords != null and query.productRecords.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecords' >
#{productRecord}
</foreach>
</if>
<if test="query.productRecords != null and query.productRecords.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecords' open='(' separator=',' close=')'>
#{productRecord}
</foreach>
</if>
</if>
<if test="query.channelIds != null and query.channelIds.size()>0">
<if test="query.channelIds != null and query.channelIds.size()==1 ">
AND o.`channel_id` =
<foreach item='channelId' index="index" collection='query.channelIds'>
#{channelId}
</foreach>
</if>
<if test="query.channelIds != null and query.channelIds.size()>1 ">
AND o.`channel_id` in
<foreach item='channelId' index="index" collection='query.channelIds' open='(' separator=',' close=')'>
#{channelId}
</foreach>
</if>
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>0">
<if test="query.salesmanIds != null and query.salesmanIds.size()==1 ">
AND (o.`salesman_id` =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
))
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>1 ">
AND (o.`salesman_id` in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in (select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
)
)
</if>
</if>
<if test="query.number != null and query.number != '' ">
AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi
......@@ -2920,9 +3064,88 @@
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
))
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsTypes' >
#{customsType}
</foreach>
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
#{customsType}
</foreach>
</if>
</if>
<if test="query.productRecords != null and query.productRecords.size()>0">
))
<if test="query.productRecords != null and query.productRecords.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecords' >
#{productRecord}
</foreach>
</if>
<if test="query.productRecords != null and query.productRecords.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecords' open='(' separator=',' close=')'>
#{productRecord}
</foreach>
</if>
</if>
<if test="query.channelIds != null and query.channelIds.size()>0">
<if test="query.channelIds != null and query.channelIds.size()==1 ">
AND o.`channel_id` =
<foreach item='channelId' index="index" collection='query.channelIds'>
#{channelId}
</foreach>
</if>
<if test="query.channelIds != null and query.channelIds.size()>1 ">
AND o.`channel_id` in
<foreach item='channelId' index="index" collection='query.channelIds' open='(' separator=',' close=')'>
#{channelId}
</foreach>
</if>
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>0">
<if test="query.salesmanIds != null and query.salesmanIds.size()==1 ">
AND (o.`salesman_id` =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service =
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
))
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>1 ">
AND (o.`salesman_id` in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
or
o.`customer_id` in (select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and
cus.customer_service in
<foreach item='salesmanId' index="index" collection='query.salesmanIds'>
#{salesmanId}
</foreach>
)
)
</if>
</if>
<if test="query.number != null and query.number != '' ">
AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
......@@ -3979,6 +4202,84 @@
<if test="query.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>0">
<if test="query.customsTypes != null and query.customsTypes.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsTypes' >
#{customsType}
</foreach>
</if>
<if test="query.customsTypes != null and query.customsTypes.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsTypes' open='(' separator=',' close=')'>
#{customsType}
</foreach>
</if>
</if>
<if test="query.productRecords != null and query.productRecords.size()>0">
<if test="query.productRecords != null and query.productRecords.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecords' >
#{productRecord}
</foreach>
</if>
<if test="query.productRecords != null and query.productRecords.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecords' open='(' separator=',' close=')'>
#{productRecord}
</foreach>
</if>
</if>
<if test="query.channelIds != null and query.channelIds.size()>0">
<if test="query.channelIds != null and query.channelIds.size()==1 ">
AND o.`channel_id` =
<foreach item='channelId' index="index" collection='query.channelIds' >
#{channelId}
</foreach>
</if>
<if test="query.channelIds != null and query.channelIds.size()>1 ">
AND o.`channel_id` in
<foreach item='channelId' index="index" collection='query.channelIds' open='(' separator=',' close=')'>
#{channelId}
</foreach>
</if>
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>0">
<if test="query.salesmanIds != null and query.salesmanIds.size()==1 ">
AND (o.`salesman_id` =
<foreach item='salesmanId' index="index" collection='query.salesmanIds' >
#{salesmanId}
</foreach>
or
o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service =
<foreach item='salesmanId' index="index" collection='query.salesmanIds' >
#{salesmanId}
</foreach> ))
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size()>1 ">
AND (o.`salesman_id` in
<foreach item='salesmanId' index="index" collection='query.salesmanIds' >
#{salesmanId}
</foreach>
or
o.`customer_id` in (select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service in
<foreach item='salesmanId' index="index" collection='query.salesmanIds' >
#{salesmanId}
</foreach> ))
</if>
</if>
<if test="query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
......@@ -4988,604 +5289,7 @@
(SELECT u.dept_id FROM system_user u WHERE u.id = o.creator) IN
<foreach item='deptId' collection='query.deptIdList' open='(' close=')' separator=','> #{deptId} </foreach>)
</if>
<if test = "query.pdaStartWareIds != null and query.pdaStartWareIds != '' ">
AND FIND_IN_SET(ew_start.`id`, #{query.pdaStartWareIds})
</if>
<if test = "query.pdaDestWareIds != null and query.pdaDestWareIds != '' ">
AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})
</if>
<if test = "query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<!-- <if test = "query.isExternalWarehouse != null">-->
<!-- AND o.`is_external_warehouse` = #{query.isExternalWarehouse}-->
<!-- </if>-->
<if test="query.isExternalWarehouse != null and query.isExternalWarehouse.size()>0">
<if test="query.isExternalWarehouse != null and query.isExternalWarehouse != '' and query.isExternalWarehouse.size()==1 ">
AND o.`is_external_warehouse` =
<foreach item='isExternalWarehouse' index="index" collection='query.isExternalWarehouse' >
#{isExternalWarehouse}
</foreach>
</if>
<if test="query.isExternalWarehouse != null and query.isExternalWarehouse != '' and query.isExternalWarehouse.size()>1 ">
AND o.`is_external_warehouse` in
<foreach item='isExternalWarehouse' index="index" collection='query.isExternalWarehouse' open='(' separator=',' close=')'>
#{isExternalWarehouse}
</foreach>
</if>
</if>
<!-- <if test="query.status != null and query.status.size()>0">-->
<!-- <if test="query.status != null and query.status != '' and query.status.size()==1 ">-->
<!-- AND o.`status` =-->
<!-- <foreach item='status' index="index" collection='query.status' >-->
<!-- #{status}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="query.status != null and query.status != '' and query.status.size()>1 ">-->
<!-- AND o.`status` in-->
<!-- <foreach item='status' index="index" collection='query.status' open='(' separator=',' close=')'>-->
<!-- #{status}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </if>-->
<!-- <if test = "query.status != null">-->
<!-- AND o.`status` = #{query.status}-->
<!-- </if>-->
<if test="query.statusList != null and query.statusList.size()>0">
<if test="query.statusList != null and query.statusList != '' and query.statusList.size()==1 ">
AND o.`status` =
<foreach item='status' index="index" collection='query.statusList' >
#{status}
</foreach>
</if>
<if test="query.statusList != null and query.statusList != '' and query.statusList.size()>1 ">
AND o.`status` in
<foreach item='status' index="index" collection='query.statusList' open='(' separator=',' close=')'>
#{status}
</foreach>
</if>
</if>
<!-- <if test = "query.abnormalState != null">-->
<!-- <choose>-->
<!-- <when test = "query.abnormalState != 0">-->
<!-- <choose>-->
<!-- <when test = "query.abnormalState != -1">-->
<!-- AND o.`abnormal_state` = #{query.abnormalState}-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- AND o.`abnormal_state` != 0-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- AND o.`abnormal_state` = 0-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </if>-->
<if test="query.abnormalState != null and query.abnormalState.size()>0">
<if test="query.abnormalState != null and query.abnormalState != '' and query.abnormalState.size()==1 ">
<foreach item='abnormalState' index="index" collection='query.abnormalState' >
<choose>
<when test="abnormalState != '0'">
<choose>
<when test="abnormalState != '-1'">
AND o.`abnormal_state` = #{abnormalState}
</when>
<otherwise>
AND o.`abnormal_state` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`abnormal_state` = 0
</otherwise>
</choose>
</foreach>
</if>
<if test="query.abnormalState != null and query.abnormalState != '' and query.abnormalState.size()>1 ">
AND (1!=1
<foreach item='abnormalState' index="index" collection='query.abnormalState'>
<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>
<if test = "query.inWarehouseState != null">
AND o.`in_warehouse_state` = #{query.inWarehouseState}
</if>
<if test = "query.shipmentState != null">
AND o.`shipment_State` = #{query.shipmentState}
</if>
<!-- <if test = "query.auditType != null">-->
<!-- <choose>-->
<!-- <when test = 'query.auditType != 0'>-->
<!-- <choose>-->
<!-- <when test = 'query.auditType != -1'>-->
<!-- AND o.`audit_type` = #{query.auditType}-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- AND o.`audit_type` != 0-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- AND o.`audit_type` = 0-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- </if>-->
<if test="query.auditType != null and query.auditType.size()>0">
<if test="query.auditType != null and query.auditType != '' and query.auditType.size()==1 ">
<foreach item='auditType' index="index" collection='query.auditType' >
<choose>
<when test="auditType != 0">
<choose>
<when test="auditType != -1">
AND o.`audit_type` = #{auditType}
</when>
<otherwise>
AND o.`audit_type` != 0
</otherwise>
</choose>
</when>
<otherwise>
AND o.`audit_type` = 0
</otherwise>
</choose>
</foreach>
</if>
</if>
<if test = "query.salesmanId != null ">
AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
<!-- <if test = "query.customsType != null">-->
<!-- AND o.`customs_type` = #{query.customsType}-->
<!-- </if>-->
<if test="query.customsType != null and query.customsType.size()>0">
<if test="query.customsType != null and query.customsType != '' and query.customsType.size()==1 ">
AND o.`customs_type` =
<foreach item='customsType' index="index" collection='query.customsType' >
#{customsType}
</foreach>
</if>
<if test="query.customsType != null and query.customsType != '' and query.customsType.size()>1 ">
AND o.`customs_type` in
<foreach item='customsType' index="index" collection='query.customsType' open='(' separator=',' close=')'>
#{customsType}
</foreach>
</if>
</if>
<!-- <if test = "query.productRecord != null">-->
<!-- AND o.`product_record` = #{query.productRecord}-->
<!-- </if>-->
<if test="query.productRecord != null and query.productRecord.size()>0">
<if test="query.productRecord != null and query.productRecord != '' and query.productRecord.size()==1 ">
AND o.`product_record` =
<foreach item='productRecord' index="index" collection='query.productRecord' >
#{productRecord}
</foreach>
</if>
<if test="query.productRecord != null and query.productRecord != '' and query.productRecord.size()>1 ">
AND o.`product_record` in
<foreach item='productRecord' index="index" collection='query.productRecord' open='(' separator=',' close=')'>
#{productRecord}
</foreach>
</if>
</if>
<if test = "query.transportId != null">
AND o.`transport_id` = #{query.transportId}
</if>
<if test = "query.channelId != null">
AND o.`channel_id` = #{query.channelId}
</if>
<if test="query.warehouseType != null and query.warehouseType.size()>0">
<if test="query.warehouseType != null and query.warehouseType != '' and query.warehouseType.size()==1 ">
AND o.`warehouse_type` =
<foreach item='warehouseType' index="index" collection='query.warehouseType' >
#{warehouseType}
</foreach>
</if>
<if test="query.warehouseType != null and query.warehouseType != '' and query.warehouseType.size()>1 ">
AND o.`warehouse_type` in
<foreach item='warehouseType' index="index" collection='query.warehouseType' open='(' separator=',' close=')'>
#{warehouseType}
</foreach>
</if>
</if>
<if test = "query.number != null and query.number != '' ">
AND (o.`number` like concat('%',concat(#{query.number},'%'))
or
o.order_id in
(select distinct oi.order_id from ecw_order_item oi
where oi.deleted = 0 and
((oi.warehouse_in_info is null and oi.express_no like concat('%',concat(#{query.number},'%')))
or
(oi.warehouse_in_info is not null and oi.warehouse_in_info ->> '$.expressNo' like concat('%',concat(#{query.number},'%'))))))
</if>
<if test = "query.notNumber != null and query.notNumber != '' ">
AND o.`number` not like concat('%',concat(#{query.notNumber},'%'))
AND
o.order_id not in
(select distinct oi.order_id from ecw_order_item oi
where oi.deleted = 0 and
((oi.warehouse_in_info is null and oi.express_no like concat('%',concat(#{query.notNumber},'%')))
or
(oi.warehouse_in_info is not null and oi.warehouse_in_info ->> '$.expressNo' like concat('%',concat(#{query.notNumber},'%')))))
</if>
<if test = "query.marks != null and query.marks != '' ">
AND o.`marks` like concat('%',concat(#{query.marks},'%'))
</if>
<if test = "query.departureId != null ">
AND de.`departure_id` = #{query.departureId}
</if>
<!-- <if test = "query.objectiveId != null ">-->
<!-- AND ob.`objective_id` = #{query.objectiveId}-->
<!-- </if>-->
<if test="query.objectiveId != null and query.objectiveId.size() != 0">
AND ob.`objective_id` in
<foreach item='orderId' index='index' collection='query.objectiveId' open='(' separator=',' close=')'>
#{orderId}
</foreach>
</if>
<if test="query.destCountryId != null ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test = "query.consignorId != null ">
AND nor.`customer_id` = #{query.consignorId}
</if>
<if test = "query.consignorPhone != null and query.consignorPhone != '' ">
AND nor.`phone` = #{query.consignorPhone}
</if>
<if test = "query.consigneeId != null ">
AND nee.`customer_id` = #{query.consigneeId}
</if>
<if test = "query.consigneePhone != null and query.consigneePhone != '' ">
AND nee.`phone` = #{query.consigneePhone}
</if>
<if test = "query.isCargoControl != null ">
AND o.`is_cargo_control` = #{query.isCargoControl}
</if>
<if test = "query.orderNo != null and query.orderNo != '' ">
AND o.`order_no` like concat('%',concat(#{query.orderNo},'%'))
</if>
<if test = "query.orderIdList != null and query.orderIdList.size() != 0">
AND o.`order_id` in
<foreach item='orderId' index='index' collection='query.orderIdList' open='(' separator=',' close=')'>#{orderId}</foreach>
</if>
<if test = "query.tidanNo != null and query.tidanNo != '' ">
AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))
</if>
<if test = "query.customerId != null">
AND o.`customer_id` = #{query.customerId}
</if>
<if test = "query.beginRucangTime != null and query.endRucangTime != null ">
AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})
</if>
<if test = "query.beginQingguanTime != null and query.endQingguanTime != null ">
AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}
</if>
<if test = "query.beginDaogangTime != null and query.endDaogangTime != null ">
AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}
</if>
<if test = "query.beginPreLoadTime != null and query.endPreLoadTime != null ">
AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}
</if>
<if test = "query.beginOutboundTime != null and query.endOutboundTime != null ">
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and #{query.endOutboundTime})
</if>
<if test = "query.beginLoadTime != null and query.endLoadTime != null ">
AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
</if>
<if test = "query.beginUnloadTime != null and query.endUnloadTime != null ">
AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}
</if>
<if test = "query.beginTakeTime != null and query.endTakeTime != null ">
AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}
</if>
<if test = "query.beginSplitTime != null and query.endSplitTime != null ">
AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}
</if>
<if test = "query.beginCreateTime != null and query.endCreateTime != null ">
AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test = "query.beginPickTime != null and query.endPickTime != null ">
AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})
</if>
<if test = "query.beginPickUpTime != null and query.endPickUpTime != null ">
AND o.order_no in(select distinct op.order_id from ecw_order_pickup op where op.deleted = 0 and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime})
</if>
<if test = "query.beginWarehouseInTime != null and query.endWarehouseInTime != null ">
AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime})
</if>
<if test = "query.creator != null and query.creator != '' ">
AND o.`creator` = #{query.creator} and (o.user_id is null or o.user_id = 0)
</if>
<if test = "query.searchKey != null and query.searchKey != '' ">
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(nee.`name`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.searchKey},'%'))
</if>
<if test = "query.consignorKey != null and query.consignorKey != '' ">
AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) like concat('%',concat(#{query.consignorKey},'%'))
OR nor.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consignorKey},'%'))))
</if>
<if test = "query.notConsignorKey != null and query.notConsignorKey != '' ">
AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) not like concat('%',concat(#{query.notConsignorKey},'%'))
AND nor.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsignorKey},'%'))))
</if>
<if test = "query.consigneeKey != null and query.consigneeKey != '' ">
AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) like concat('%',concat(#{query.consigneeKey},'%'))
OR nee.customer_id in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.consigneeKey},'%'))))
</if>
<if test = "query.notConsigneeKey != null and query.notConsigneeKey != '' ">
AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) not like concat('%',concat(#{query.notConsigneeKey},'%'))
AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))
</if>
<if test = "query.numberKey != null and query.numberKey != '' ">
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,''), IFNULL(o.`parent_number`,''), IFNULL(o.`initial_parent_order_no`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(o.`no_charge_record`,'')) like concat('%',concat(#{query.numberKey},'%'))
</if>
<if test = "query.notNumberKey != null and query.notNumberKey != '' ">
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`old_numbers`,''), IFNULL(o.`parent_number`,''), IFNULL(o.`initial_parent_order_no`,'') ,IFNULL(o.`marks`,''),IFNULL(o.`tidan_no`,''),IFNULL(o.`container_number`,''),IFNULL(o.`no_charge_record`,'')) not like concat('%',concat(#{query.notNumberKey},'%'))
</if>
<if test = "query.eqNumberKey != null and query.eqNumberKey != '' ">
AND (o.`order_no` = #{query.eqNumberKey}
or (o.`old_numbers` is not null and o.`old_numbers` != '' and o.`old_numbers` = #{query.eqNumberKey})
or (o.`parent_number` is not null and o.`parent_number` != '' and o.`parent_number` = #{query.eqNumberKey})
or (o.`marks` is not null and o.`marks` != '' and o.`marks` = #{query.eqNumberKey})
or (o.`tidan_no` is not null and o.`tidan_no` != '' and o.`tidan_no` = #{query.eqNumberKey})
or (o.`container_number` is not null and o.`container_number` != '' and o.`container_number` = #{query.eqNumberKey})
or (o.`no_charge_record` is not null and o.`no_charge_record` != '' and o.`no_charge_record` = #{query.eqNumberKey})
or (o.`initial_parent_order_no` is not null and o.`initial_parent_order_no` != '' and o.`initial_parent_order_no` = #{query.eqNumberKey}))
</if>
<if test = "query.notEqNumberKey != null and query.notEqNumberKey != '' ">
AND o.`order_no` != #{query.notEqNumberKey}
AND (o.`old_numbers` is null or o.`old_numbers` = '' or o.`old_numbers` != #{query.notEqNumberKey})
AND (o.`parent_number` is null or o.`parent_number` = '' or o.`parent_number` != #{query.notEqNumberKey})
AND (o.`marks` is null or o.`marks` = '' or o.`marks` != #{query.notEqNumberKey})
AND (o.`tidan_no` is null or o.`tidan_no` = '' or o.`tidan_no` != #{query.notEqNumberKey})
AND (o.`container_number` is null or o.`container_number` = '' or o.`container_number` != #{query.notEqNumberKey})
AND (o.`no_charge_record` is null or o.`no_charge_record` = '' or o.`no_charge_record` != #{query.notEqNumberKey})
AND (o.`initial_parent_order_no` is null or o.`initial_parent_order_no` = '' or o.`initial_parent_order_no` != #{query.notEqNumberKey})
</if>
<if test = "query.prodKey != null and query.prodKey != '' ">
and (o.order_id in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0
and concat(IFNULL(oi.`prod_title_zh`,''),IFNULL(oi.`prod_title_en`,''),IFNULL(pt.`title_zh`,''),IFNULL(pt.`title_en`,''),IFNULL(pb.`title_zh`,''),IFNULL(pb.`title_en`,''))
like concat('%',concat(#{query.prodKey},'%'))
))
</if>
<if test = "query.notProdKey != null and query.notProdKey != '' ">
and (o.order_id not in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0 and concat(IFNULL(oi.`prod_title_zh`,''),IFNULL(oi.`prod_title_en`,''),IFNULL(pt.`title_zh`,''),IFNULL(pt.`title_en`,''),IFNULL(pb.`title_zh`,''),IFNULL(pb.`title_en`,'')) ,
like concat('%',concat(#{query.notProdKey},'%'))
))
</if>
<if test = "query.eqProdKey != null and query.eqProdKey != '' ">
and (o.order_id in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0
and (oi.`prod_title_zh` = #{query.eqProdKey} or oi.`prod_title_en` = #{query.eqProdKey}
or pt.`title_zh` = #{query.eqProdKey} or pt.`title_en` = #{query.eqProdKey}
or pb.`title_zh` = #{query.eqProdKey} or pb.`title_en` = #{query.eqProdKey})
))
</if>
<if test = "query.notEqProdKey != null and query.notEqProdKey != '' ">
and (o.order_id not in(
select oi.order_id
from ecw_order_item oi
left join ecw_product p
on oi.prod_id = p.id
left join ecw_product_type pt
on pt.id = oi.prod_type
left join ecw_product_brank pb
on pb.id = oi.brand
where oi.deleted = 0
and (oi.`prod_title_zh` = #{query.notEqProdKey} or oi.`prod_title_en` = #{query.notEqProdKey} ,
or pt.`title_zh` = #{query.notEqProdKey} or pt.`title_en` = #{query.notEqProdKey}
or pb.`title_zh` = #{query.notEqProdKey} or pb.`title_en` = #{query.notEqProdKey})
))
</if>
<if test = "query.startWarehouseId != null and query.destWarehouseId != null ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>
#{startWarehouseId}
</foreach>
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
))
</if>
<if test = "query.startWarehouseId != null and query.destWarehouseId == null ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='startWarehouseId' index='index' collection='query.startWarehouseId' open='(' separator=',' close=')'>
#{startWarehouseId}
</foreach>
))
</if>
<if test = "query.startWarehouseId == null and query.destWarehouseId != null ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.dest_warehouse_id in
<foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
))
</if>
<if test = "query.airShipment != null and query.airShipment == 1">
AND o.`status` = 5 AND o.air_shipment = 1 and abnormal_state = 0 and audit_type = 0
</if>
<if test = "query.airShipment != null and query.airShipment == 2">
AND o.`status` = 5 AND o.air_shipment = 2
</if>
<if test = "query.airShipment != null and query.airShipment == 3">
AND o.`status` = 5 AND o.air_shipment = 3
</if>
<if test = "query.airShipment != null and query.airShipment == 4">
AND o.`status` = 5 AND o.air_shipment = 4
</if>
<if test = "query.airShipment != null and query.airShipment == 10">
AND o.`status` = 5 AND o.air_shipment in(2,3,4)
</if>
<if test = "query.airShipment != null and query.airShipment == 11">
AND o.`status` = 5 AND o.air_shipment in(1,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test = "query.airShipment != null and query.airShipment == 12">
AND o.`status` = 5 AND o.air_shipment in(2,3) and abnormal_state = 0 and audit_type = 0
</if>
<if test = "query.airShipment != null and query.airShipment == 20">
AND o.`status` = 5 AND o.air_shipment in(0,2,3,4) and abnormal_state = 0 and audit_type = 0
</if>
<if test = "query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
<if test = "query.isNeat == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</if>
<!-- <if test = "query.type != null and query.type != '' and query.type == 0 ">-->
<!-- AND (o.type is null or o.type = '' or o.type = '0')-->
<!-- </if>-->
<!-- <if test = "query.type == 1 ">-->
<!-- AND FIND_IN_SET(1, o.type)-->
<!-- </if>-->
<!-- <if test = "query.type == 2 ">-->
<!-- AND FIND_IN_SET(2, o.type)-->
<!-- </if>-->
<if test="query.type != null and query.type != '' and query.type.size()>0 ">
<if test="query.type != null and query.type != '' and query.type.size()>1 ">
<!-- AND o.type in-->
<!-- <foreach item='type' collection='query.type' open='(' separator=',' close=')'>-->
<!-- ${type}-->
<!-- -->
<!-- </foreach>-->
AND (1!=1
<foreach item='type' index="index" collection='query.type' >
<if test="type == 0 ">
OR (o.type is null or o.type = '' or o.type = '0')
</if>
<if test="type == 1 ">
OR FIND_IN_SET(1, o.type)
</if>
<if test="type == 2 ">
OR FIND_IN_SET(2, o.type)
</if>
</foreach>
)
</if>
<if test="query.type != null and query.type != '' and query.type.size()==1 ">
<foreach item='type' index="index" collection='query.type' >
<if test="type == 0 ">
AND (o.type is null or o.type = '' or o.type = '0')
</if>
<if test="type == 1 ">
AND FIND_IN_SET(1, o.type)
</if>
<if test="type == 2 ">
AND FIND_IN_SET(2, o.type)
</if>
</foreach>
<!-- <if test="query.type != null and query.type != '' and query.type == 0 ">-->
<!-- AND (o.type is null or o.type = '' or o.type = '0')-->
<!-- -->
<!-- </if>-->
<!-- <if test="query.type == 1 ">-->
<!-- AND FIND_IN_SET(1, o.type)-->
<!-- </if>-->
<!-- <if test="query.type == 2 ">-->
<!-- AND FIND_IN_SET(2, o.type)-->
<!-- </if>-->
</if>
</if>
<if test = "query.customerDetailId != null">
AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or nee.`customer_id` = #{query.customerDetailId})
</if>
<if test = "query.userType == 2 ">
</if>
<include refid="myOrderQuery"/>
</select>
......
......@@ -731,7 +731,7 @@ public class OrderController {
@GetMapping("/dept/statistics")
@ApiOperation("参数查询获得部门订单统计")
public CommonResult<StatisticsOrderVO> statisticsDeptOrder(OrderQueryDTO query) {
public CommonResult<StatisticsOrderVO> statisticsDeptOrder(OrderQueryVO query) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); // 获取当前登录用户ID
query.setUserType(UserTypeEnum.ADMIN.getValue());
// query.setSalesmanId(salesmanId);
......@@ -761,7 +761,7 @@ public class OrderController {
@GetMapping("/my/statistics")
@ApiOperation("参数查询获得我的订单统计")
public CommonResult<StatisticsOrderVO> statisticsMyOrder(OrderQueryDTO query) {
public CommonResult<StatisticsOrderVO> statisticsMyOrder(OrderQueryVO query) {
Long salesmanId = SecurityFrameworkUtils.getLoginUserId(); // 获取当前登录用户ID
query.setUserType(UserTypeEnum.ADMIN.getValue());
// query.setSalesmanId(salesmanId);
......@@ -772,7 +772,7 @@ public class OrderController {
@GetMapping("/statistics")
@ApiOperation("参数查询订单管理统计")
public CommonResult<StatisticsOrderVO> statisticsOrder(OrderQueryDTO query) {
public CommonResult<StatisticsOrderVO> statisticsOrder(OrderQueryVO query) {
return success(orderQueryService.statisticsMyOrder(query));
}
......
......@@ -146,6 +146,7 @@ public class OrderCargoControlController {
@PutMapping("/update/apply")
@ApiOperation("控货业务审批申请")
@Idempotent(timeout = 10)
public CommonResult<Boolean> orderCargoControlApply(@Valid @RequestBody OrderCargoControlApplyVO orderCargoControlApplyVO) {
orderCargoControlService.orderCargoControlApply(orderCargoControlApplyVO);
return success(true);
......
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