Commit f9243d9b authored by lanbaoming's avatar lanbaoming

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

parents 2d320dc2 ee0bfece
......@@ -150,14 +150,16 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
"GROUP BY r1.title_zh",
"</when>",
"<when test = 'type == 2'>",
"AND w.guojia=#{regionId}",
"AND w.guojia in (${regionId})",
"GROUP BY w.shi",
"</when>",
"<when test = 'type == 3'>",
"AND w.shi=#{regionId}",
"<if test= 'regionId != null and regionId != \"\" '>",
"AND w.shi in (${regionId})",
"</if>",
"GROUP BY w.title_zh",
"</when>",
"</script>"
})
List<WarehouseTreeRegionVO> getRegionList(@Param("type") Integer type, @Param("regionId") Integer regionId);
List<WarehouseTreeRegionVO> getRegionList(@Param("type") Integer type, @Param("regionId") String regionId);
}
......@@ -171,5 +171,5 @@ public interface WarehouseService {
List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType);
List<WarehouseTreeRegionVO> getRegionList(Integer type, Integer regionId);
List<WarehouseTreeRegionVO> getRegionList(Integer type, String regionId);
}
......@@ -514,7 +514,10 @@ public class WarehouseServiceImpl implements WarehouseService {
}
@Override
public List<WarehouseTreeRegionVO> getRegionList(Integer type, Integer regionId) {
public List<WarehouseTreeRegionVO> getRegionList(Integer type, String regionId) {
if(regionId.equals("")){
return new ArrayList();
}
List<WarehouseTreeRegionVO> list = warehouseMapper.getRegionList(type,regionId);
return list;
}
......
......@@ -101,7 +101,7 @@ public class WarehouseController {
}
@GetMapping("/getRegionList")
public CommonResult<List<WarehouseTreeRegionVO>> getRegionList(@RequestParam(value = "type", required = false) Integer type,Integer regionId){
public CommonResult<List<WarehouseTreeRegionVO>> getRegionList(@RequestParam(value = "type", required = false) Integer type,String regionId){
List<WarehouseTreeRegionVO> list = warehouseService.getRegionList(type,regionId);
return success(list);
}
......
......@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dto.OrderExportBackDTO;
import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.order.dto.OrderQueryDTO;
import cn.iocoder.yudao.module.order.dto.SearchBackDto;
import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionStatisticsExcelVo;
......@@ -645,8 +646,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
List<OrderBackPageVO> orderList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query);
List<OrderBackPageVO> orderList1(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryDTO query);
long orderCount(@Param("query") OrderQueryVO query);
long orderCount1(@Param("query") OrderQueryDTO query);
List<OrderExcelVO> exportOrderExcelList(@Param("start")int start, @Param("size") int size,@Param("query") OrderQueryVO query);
......@@ -1075,8 +1080,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
List<OrderBackPageVO> deptOrderList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query);
List<OrderBackPageVO> deptOrderList1(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryDTO query);
long deptOrderCount(@Param("query") OrderQueryVO query);
long deptOrderCount1(@Param("query") OrderQueryDTO query);
@ResultType(OrderBackPageVO.class)
@Select({
"<script>",
......@@ -3431,97 +3440,28 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</script>"
})
StatisticsOrderVO statisticsOrder(@Param("query") OrderQueryVO query);
/**
* 获取异常单统计
*
* @param query
* @return
*/
List<OrderExceptionStatisticsExcelVo> getOrderExceptionStatisticsList(@Param("query") OrderQueryVO query);
/**
* 重货统计
*
* @param query
* @return
*/
List<OrderHeavyExcelVo> getHeavyOrderExcelList(@Param("query") OrderQueryVO query);
/**
* 退仓统计
*
* @param query
* @return
*/
List<OrderReturnOrderExcelVo> getReturnOrderExcelList(@Param("query") OrderQueryVO query);
/**
* 售后赔付
*
* @param query
* @return
*/
List<OrderSaleRepayExcelVo> getSaleRepayExcelList(@Param("query") OrderQueryVO query);
/**
* 报关数据
*
* @param query
* @return
*/
List<OrderCustomsDatasExcelVo> getCustomsDatasExcelList(@Param("query") OrderQueryVO query);
/**
* 出货量
*
* @param query
* @return
*/
List<OrderShipDataExcelVo> getShipDatasExcelList(@Param("query") OrderQueryVO query);
/**
* 预付运费
*
* @param query
* @return
*/
List<OrderShipFeeExcelVo> getShipFeeExcelList(@Param("query") OrderQueryVO query);
@ResultType(OrderDO.class)
@Select({
"<script>",
"SELECT",
"o.*",
"FROM",
"ecw_order o ",
"WHERE",
"o.`status` = 20",
"and o.`deleted` = 0",
"and o.`commission_payable` = 0",
"and o.order_id in(select distinct oi.order_id from ecw_order_item oi where oi.deleted = 0 and oi.`warehouse_in_info` is not null and oi.`warehouse_in_info`->>'$.cartonsNum' > 0 and oi.commission_type > 0)",
"</script>"
})
List<OrderDO> commissionOrderList();
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(wi.cartons_num, 0)) as total_num, ",
"SUM(IFNULL(wi.volume, 0)) as total_volume, ",
"SUM(IFNULL(wi.weight, 0)) as total_weight, ",
"SUM(IFNULL(wi.quantity_all, 0)) as order_quantity ",
"from ecw_order_warehouse_in wi ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.cartonsNum'), 0)) as total_num, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.volume'), 0)) as total_volume, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.weight'), 0)) as total_weight, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, it.warehouse_in_info->>'$.quantityAll'), 0)) as order_quantity, ",
"SUM(IFNULL(it.w_volume,0)) as total_w_volume, ",
"SUM(IFNULL(it.v_weight,0)) as total_v_weight, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_weight > it.min_metering_weight ,it.charge_weight,it.min_metering_weight)), 0)) as total_charge_weight, ",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_volume > it.min_metering_volume,it.charge_volume,it.min_metering_volume)), 0)) as total_charge_volume,",
"SUM(IFNULL(IF(it.warehouse_in_info is null, 0, IF(it.charge_quantity > it.min_metering_quantity,it.charge_quantity,it.min_metering_quantity)), 0)) as total_charge_quantity",
"from ecw_order_item it ",
"left join ecw_order o ",
"ON wi.order_id = o.order_id ",
"ON it.order_id = o.order_id and it.deleted = 0",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and wi.deleted = 0",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 ",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
......@@ -3631,15 +3571,6 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND ob.`objective_id` = #{query.objectiveId}",
"</when>",
......@@ -3673,7 +3604,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"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})",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
......@@ -3710,10 +3641,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"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})",
"</when>",
"<when test = 'query.beginWarehouseInTime != null and query.endWarehouseInTime != null '>",
"AND wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}",
"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})",
"</when>",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"AND o.`creator` = #{query.creator} and (o.user_id is null or o.user_id = 0)",
"</when>",
"<when 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},'%'))",
......@@ -3735,10 +3666,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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},'%'))",
"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},'%'))",
"</when>",
"<when 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},'%'))",
"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},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
......@@ -3753,6 +3684,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when 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})",
......@@ -3871,6 +3803,15 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.isNeat == true '>",
" AND o.sum_num = o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.customerDetailId != null'>",
"AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or nee.`customer_id` = #{query.customerDetailId})",
"</when>",
......@@ -3878,22 +3819,98 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"</script>"
})
StatisticsOrderVO statisticsWarehouseIn(@Param("query") OrderQueryVO query);
StatisticsOrderVO statisticsMyOrder(@Param("query") OrderQueryDTO query);
/**
* 获取异常单统计
*
* @param query
* @return
*/
List<OrderExceptionStatisticsExcelVo> getOrderExceptionStatisticsList(@Param("query") OrderQueryVO query);
/**
* 重货统计
*
* @param query
* @return
*/
List<OrderHeavyExcelVo> getHeavyOrderExcelList(@Param("query") OrderQueryVO query);
/**
* 退仓统计
*
* @param query
* @return
*/
List<OrderReturnOrderExcelVo> getReturnOrderExcelList(@Param("query") OrderQueryVO query);
/**
* 售后赔付
*
* @param query
* @return
*/
List<OrderSaleRepayExcelVo> getSaleRepayExcelList(@Param("query") OrderQueryVO query);
/**
* 报关数据
*
* @param query
* @return
*/
List<OrderCustomsDatasExcelVo> getCustomsDatasExcelList(@Param("query") OrderQueryVO query);
/**
* 出货量
*
* @param query
* @return
*/
List<OrderShipDataExcelVo> getShipDatasExcelList(@Param("query") OrderQueryVO query);
/**
* 预付运费
*
* @param query
* @return
*/
List<OrderShipFeeExcelVo> getShipFeeExcelList(@Param("query") OrderQueryVO query);
@ResultType(OrderDO.class)
@Select({
"<script>",
"SELECT",
"o.*",
"FROM",
"ecw_order o ",
"WHERE",
"o.`status` = 20",
"and o.`deleted` = 0",
"and o.`commission_payable` = 0",
"and o.order_id in(select distinct oi.order_id from ecw_order_item oi where oi.deleted = 0 and oi.`warehouse_in_info` is not null and oi.`warehouse_in_info`->>'$.cartonsNum' > 0 and oi.commission_type > 0)",
"</script>"
})
List<OrderDO> commissionOrderList();
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(op.pick_num, 0)) as total_num",
"from ecw_order_pickup op",
"SUM(IFNULL(wi.cartons_num, 0)) as total_num, ",
"SUM(IFNULL(wi.volume, 0)) as total_volume, ",
"SUM(IFNULL(wi.weight, 0)) as total_weight, ",
"SUM(IFNULL(wi.quantity_all, 0)) as order_quantity ",
"from ecw_order_warehouse_in wi ",
"left join ecw_order o ",
"ON op.order_id = o.order_no ",
"ON wi.order_id = o.order_id ",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and op.deleted = 0",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and wi.deleted = 0",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
......@@ -4003,6 +4020,15 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND ob.`objective_id` = #{query.objectiveId}",
"</when>",
......@@ -4036,7 +4062,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"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})",
"AND wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
......@@ -4069,7 +4095,12 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<when 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})",
"</when>",
"and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime}",
"<when 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})",
"</when>",
"<when test = 'query.beginWarehouseInTime != null and query.endWarehouseInTime != null '>",
"AND wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}",
"</when>",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
......@@ -4093,10 +4124,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"AND nee.customer_id not in (select c.id from ecw_customer c where c.number like concat('%',concat(#{query.notConsigneeKey},'%'))))",
"</when>",
"<when 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},'%'))",
"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},'%'))",
"</when>",
"<when 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},'%'))",
"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},'%'))",
"</when>",
"<when test = 'query.eqNumberKey != null and query.eqNumberKey != \"\" '>",
"AND (o.`order_no` = #{query.eqNumberKey}",
......@@ -4105,16 +4136,17 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"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.`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}))",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.prodKey != null and query.prodKey != \"\" '>",
"and (o.order_id in(",
......@@ -4235,7 +4267,1099 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"</when>",
"</script>"
})
StatisticsOrderVO statisticsPickUp(@Param("query") OrderQueryVO query);
StatisticsOrderVO statisticsWarehouseIn(@Param("query") OrderQueryVO query);
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(wi.cartons_num, 0)) as total_num, ",
"SUM(IFNULL(wi.volume, 0)) as total_volume, ",
"SUM(IFNULL(wi.weight, 0)) as total_weight, ",
"SUM(IFNULL(wi.quantity_all, 0)) as order_quantity ",
"from ecw_order_warehouse_in wi ",
"left join ecw_order o ",
"ON wi.order_id = o.order_id ",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and wi.deleted = 0",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
"<when test= 'query.deptIdList != null and query.deptIdList.size() > 0'>",
"AND (o.dept_id IN",
"<foreach item='deptId' collection='query.deptIdList' open='(' close=')' separator=','> #{deptId} </foreach>",
" or ",
"(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>)",
"</when>",
"<when test = 'query.pdaStartWareIds != null and query.pdaStartWareIds != \"\" '>",
"AND FIND_IN_SET(ew_start.`id`, #{query.pdaStartWareIds})",
"</when>",
"<when test = 'query.pdaDestWareIds != null and query.pdaDestWareIds != \"\" '>",
"AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})",
"</when>",
"<when test = 'query.packageType != null and query.packageType != \"\" '>",
"AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')",
"</when>",
"<when test = 'query.isExternalWarehouse != null'>",
"AND o.`is_external_warehouse` = #{query.isExternalWarehouse}",
"</when>",
"<when test = 'query.status != null'>",
"AND o.`status` = #{query.status}",
"</when>",
"<when 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>",
"</when>",
"<when test = 'query.inWarehouseState != null'>",
"AND o.`in_warehouse_state` = #{query.inWarehouseState}",
"</when>",
"<when test = 'query.shipmentState != null'>",
"AND o.`shipment_State` = #{query.shipmentState}",
"</when>",
"<when 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>",
"</when>",
"<when 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} ))",
"</when>",
"<when test = 'query.customsType != null'>",
"AND o.`customs_type` = #{query.customsType}",
"</when>",
"<when test = 'query.productRecord != null'>",
"AND o.`product_record` = #{query.productRecord}",
"</when>",
"<when test = 'query.transportId != null'>",
"AND o.`transport_id` = #{query.transportId}",
"</when>",
"<when test = 'query.channelId != null'>",
"AND o.`channel_id` = #{query.channelId}",
"</when>",
"<when test = 'query.warehouseType != null'>",
"AND o.`warehouse_type` = #{query.warehouseType}",
"</when>",
"<when 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},'%'))))))",
"</when>",
"<when 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},'%')))))",
"</when>",
"<when test = 'query.marks != null and query.marks != \"\" '>",
"AND o.`marks` like concat('%',concat(#{query.marks},'%'))",
"</when>",
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
"<when test = 'query.type != null and query.type != \"\" and query.type == 0 '>",
"AND (o.type is null or o.type = '' or o.type = '0')",
"</when>",
"<when test = 'query.type == 1 '>",
"AND FIND_IN_SET(1, o.type)",
"</when>",
"<when test = 'query.type == 2 '>",
"AND FIND_IN_SET(2, o.type)",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND ob.`objective_id` = #{query.objectiveId}",
"</when>",
"<when test = 'query.consignorId != null '>",
"AND nor.`customer_id` = #{query.consignorId} ",
"</when>",
"<when test = 'query.consignorPhone != null and query.consignorPhone != \"\" '>",
"AND nor.`phone` = #{query.consignorPhone} ",
"</when>",
"<when test = 'query.consigneeId != null '>",
"AND nee.`customer_id` = #{query.consigneeId}",
"</when>",
"<when test = 'query.consigneePhone != null and query.consigneePhone != \"\" '>",
"AND nee.`phone` = #{query.consigneePhone} ",
"</when>",
"<when test = 'query.isCargoControl != null '>",
"AND o.`is_cargo_control` = #{query.isCargoControl}",
"</when>",
"<when test = 'query.orderNo != null and query.orderNo != \"\" '>",
"AND o.`order_no` like concat('%',concat(#{query.orderNo},'%'))",
"</when>",
"<when 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> ",
"</when>",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"AND wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
"</when>",
"<when test = 'query.beginDaogangTime != null and query.endDaogangTime != null '>",
"AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}",
"</when>",
"<when test = 'query.beginPreLoadTime != null and query.endPreLoadTime != null '>",
"AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginLoadTime != null and query.endLoadTime != null '>",
"AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}",
"</when>",
"<when test = 'query.beginUnloadTime != null and query.endUnloadTime != null '>",
"AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}",
"</when>",
"<when test = 'query.beginTakeTime != null and query.endTakeTime != null '>",
"AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}",
"</when>",
"<when test = 'query.beginSplitTime != null and query.endSplitTime != null '>",
"AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when 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})",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginWarehouseInTime != null and query.endWarehouseInTime != null '>",
"AND wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime}",
"</when>",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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}))",
"</when>",
"<when 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.`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})",
"</when>",
"<when 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},'%'))",
"))",
"</when>",
"<when 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},'%'))",
"))",
"</when>",
"<when 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})",
"))",
"</when>",
"<when 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})",
"))",
"</when>",
"<when 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 = #{query.startWarehouseId} and whl.dest_warehouse_id = #{query.destWarehouseId} ",
"))",
"</when>",
"<when 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 = #{query.startWarehouseId} ",
"))",
"</when>",
"<when 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 = #{query.destWarehouseId} ",
"))",
"</when>",
"<when 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 ",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 2'>",
"AND o.`status` = 5 AND o.air_shipment = 2",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 3'>",
"AND o.`status` = 5 AND o.air_shipment = 3",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 4'>",
"AND o.`status` = 5 AND o.air_shipment = 4",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 10'>",
"AND o.`status` = 5 AND o.air_shipment in(2,3,4)",
"</when>",
"<when 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 ",
"</when>",
"<when 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 ",
"</when>",
"<when 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 ",
"</when>",
"<when test = 'query.isNeat == false '>",
" AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.isNeat == true '>",
" AND o.sum_num = o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.customerDetailId != null'>",
"AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or nee.`customer_id` = #{query.customerDetailId})",
"</when>",
"<when test = 'query.userType == 2 '>",
"</when>",
"</script>"
})
StatisticsOrderVO statisticsMyWarehouseIn(@Param("query") OrderQueryDTO query);
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(op.pick_num, 0)) as total_num",
"from ecw_order_pickup op",
"left join ecw_order o ",
"ON op.order_id = o.order_no ",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and op.deleted = 0",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
"<when test= 'query.deptIdList != null and query.deptIdList.size() > 0'>",
"AND (o.dept_id IN",
"<foreach item='deptId' collection='query.deptIdList' open='(' close=')' separator=','> #{deptId} </foreach>",
" or ",
"(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>)",
"</when>",
"<when test = 'query.pdaStartWareIds != null and query.pdaStartWareIds != \"\" '>",
"AND FIND_IN_SET(ew_start.`id`, #{query.pdaStartWareIds})",
"</when>",
"<when test = 'query.pdaDestWareIds != null and query.pdaDestWareIds != \"\" '>",
"AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})",
"</when>",
"<when test = 'query.packageType != null and query.packageType != \"\" '>",
"AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')",
"</when>",
"<when test = 'query.isExternalWarehouse != null'>",
"AND o.`is_external_warehouse` = #{query.isExternalWarehouse}",
"</when>",
"<when test = 'query.status != null'>",
"AND o.`status` = #{query.status}",
"</when>",
"<when 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>",
"</when>",
"<when test = 'query.inWarehouseState != null'>",
"AND o.`in_warehouse_state` = #{query.inWarehouseState}",
"</when>",
"<when test = 'query.shipmentState != null'>",
"AND o.`shipment_State` = #{query.shipmentState}",
"</when>",
"<when 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>",
"</when>",
"<when 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} ))",
"</when>",
"<when test = 'query.customsType != null'>",
"AND o.`customs_type` = #{query.customsType}",
"</when>",
"<when test = 'query.productRecord != null'>",
"AND o.`product_record` = #{query.productRecord}",
"</when>",
"<when test = 'query.transportId != null'>",
"AND o.`transport_id` = #{query.transportId}",
"</when>",
"<when test = 'query.channelId != null'>",
"AND o.`channel_id` = #{query.channelId}",
"</when>",
"<when test = 'query.warehouseType != null'>",
"AND o.`warehouse_type` = #{query.warehouseType}",
"</when>",
"<when 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},'%'))))))",
"</when>",
"<when 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},'%')))))",
"</when>",
"<when test = 'query.marks != null and query.marks != \"\" '>",
"AND o.`marks` like concat('%',concat(#{query.marks},'%'))",
"</when>",
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
"<when test = 'query.objectiveId != null '>",
"AND ob.`objective_id` = #{query.objectiveId}",
"</when>",
"<when test = 'query.consignorId != null '>",
"AND nor.`customer_id` = #{query.consignorId} ",
"</when>",
"<when test = 'query.consignorPhone != null and query.consignorPhone != \"\" '>",
"AND nor.`phone` = #{query.consignorPhone} ",
"</when>",
"<when test = 'query.consigneeId != null '>",
"AND nee.`customer_id` = #{query.consigneeId}",
"</when>",
"<when test = 'query.consigneePhone != null and query.consigneePhone != \"\" '>",
"AND nee.`phone` = #{query.consigneePhone} ",
"</when>",
"<when test = 'query.isCargoControl != null '>",
"AND o.`is_cargo_control` = #{query.isCargoControl}",
"</when>",
"<when test = 'query.orderNo != null and query.orderNo != \"\" '>",
"AND o.`order_no` like concat('%',concat(#{query.orderNo},'%'))",
"</when>",
"<when 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> ",
"</when>",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"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})",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
"</when>",
"<when test = 'query.beginDaogangTime != null and query.endDaogangTime != null '>",
"AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}",
"</when>",
"<when test = 'query.beginPreLoadTime != null and query.endPreLoadTime != null '>",
"AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginLoadTime != null and query.endLoadTime != null '>",
"AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}",
"</when>",
"<when test = 'query.beginUnloadTime != null and query.endUnloadTime != null '>",
"AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}",
"</when>",
"<when test = 'query.beginTakeTime != null and query.endTakeTime != null '>",
"AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}",
"</when>",
"<when test = 'query.beginSplitTime != null and query.endSplitTime != null '>",
"AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when 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})",
"</when>",
"and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime}",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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}))",
"</when>",
"<when 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})",
"</when>",
"<when 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},'%'))",
"))",
"</when>",
"<when 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},'%'))",
"))",
"</when>",
"<when 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})",
"))",
"</when>",
"<when 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})",
"))",
"</when>",
"<when 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 = #{query.startWarehouseId} and whl.dest_warehouse_id = #{query.destWarehouseId} ",
"))",
"</when>",
"<when 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 = #{query.startWarehouseId} ",
"))",
"</when>",
"<when 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 = #{query.destWarehouseId} ",
"))",
"</when>",
"<when 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 ",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 2'>",
"AND o.`status` = 5 AND o.air_shipment = 2",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 3'>",
"AND o.`status` = 5 AND o.air_shipment = 3",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 4'>",
"AND o.`status` = 5 AND o.air_shipment = 4",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 10'>",
"AND o.`status` = 5 AND o.air_shipment in(2,3,4)",
"</when>",
"<when 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 ",
"</when>",
"<when 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 ",
"</when>",
"<when 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 ",
"</when>",
"<when test = 'query.isNeat == false '>",
" AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.isNeat == true '>",
" AND o.sum_num = o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.customerDetailId != null'>",
"AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or nee.`customer_id` = #{query.customerDetailId})",
"</when>",
"<when test = 'query.userType == 2 '>",
"</when>",
"</script>"
})
StatisticsOrderVO statisticsPickUp(@Param("query") OrderQueryVO query);
@ResultType(StatisticsOrderVO.class)
@Select({
"<script>",
"select ",
"SUM(IFNULL(op.pick_num, 0)) as total_num",
"from ecw_order_pickup op",
"left join ecw_order o ",
"ON op.order_id = o.order_no ",
"left join ecw_order_departure de on de.order_id = o.order_id ",
"left join ecw_order_objective ob on ob.order_id = o.order_id ",
"left join ecw_order_consignor nor on nor.order_id = o.order_id ",
"left join ecw_order_consignee nee on nee.order_id = o.order_id ",
"left join ecw_channel channel on channel.channel_id = o.channel_id ",
"where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10 and op.deleted = 0",
"<when test = 'query.deptId != null '>",
"AND o.dept_id = #{query.deptId} ",
"</when>",
"<when test= 'query.deptIdList != null and query.deptIdList.size() > 0'>",
"AND (o.dept_id IN",
"<foreach item='deptId' collection='query.deptIdList' open='(' close=')' separator=','> #{deptId} </foreach>",
" or ",
"(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>)",
"</when>",
"<when test = 'query.pdaStartWareIds != null and query.pdaStartWareIds != \"\" '>",
"AND FIND_IN_SET(ew_start.`id`, #{query.pdaStartWareIds})",
"</when>",
"<when test = 'query.pdaDestWareIds != null and query.pdaDestWareIds != \"\" '>",
"AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})",
"</when>",
"<when test = 'query.packageType != null and query.packageType != \"\" '>",
"AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')",
"</when>",
"<when test = 'query.isExternalWarehouse != null'>",
"AND o.`is_external_warehouse` = #{query.isExternalWarehouse}",
"</when>",
"<when test = 'query.status != null'>",
"AND o.`status` = #{query.status}",
"</when>",
"<when 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>",
"</when>",
"<when test = 'query.inWarehouseState != null'>",
"AND o.`in_warehouse_state` = #{query.inWarehouseState}",
"</when>",
"<when test = 'query.shipmentState != null'>",
"AND o.`shipment_State` = #{query.shipmentState}",
"</when>",
"<when 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>",
"</when>",
"<when 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} ))",
"</when>",
"<when test = 'query.customsType != null'>",
"AND o.`customs_type` = #{query.customsType}",
"</when>",
"<when test = 'query.productRecord != null'>",
"AND o.`product_record` = #{query.productRecord}",
"</when>",
"<when test = 'query.transportId != null'>",
"AND o.`transport_id` = #{query.transportId}",
"</when>",
"<when test = 'query.channelId != null'>",
"AND o.`channel_id` = #{query.channelId}",
"</when>",
"<when test = 'query.warehouseType != null'>",
"AND o.`warehouse_type` = #{query.warehouseType}",
"</when>",
"<when 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},'%'))))))",
"</when>",
"<when 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},'%')))))",
"</when>",
"<when test = 'query.marks != null and query.marks != \"\" '>",
"AND o.`marks` like concat('%',concat(#{query.marks},'%'))",
"</when>",
"<when test = 'query.departureId != null '>",
"AND de.`departure_id` = #{query.departureId}",
"</when>",
// "<when test = 'query.objectiveId != null '>",
// "AND ob.`objective_id` = #{query.objectiveId}",
// "</when>",
"<when test= 'query.objectiveId != null and query.objectiveId.size() > 0'>",
"AND ob.`objective_id` IN",
"<foreach item='objectiveId' collection='query.objectiveId' open='(' close=')' separator=','> #{objectiveId} </foreach>",
"</when>",
"<when test = 'query.consignorId != null '>",
"AND nor.`customer_id` = #{query.consignorId} ",
"</when>",
"<when test = 'query.consignorPhone != null and query.consignorPhone != \"\" '>",
"AND nor.`phone` = #{query.consignorPhone} ",
"</when>",
"<when test = 'query.consigneeId != null '>",
"AND nee.`customer_id` = #{query.consigneeId}",
"</when>",
"<when test = 'query.consigneePhone != null and query.consigneePhone != \"\" '>",
"AND nee.`phone` = #{query.consigneePhone} ",
"</when>",
"<when test = 'query.isCargoControl != null '>",
"AND o.`is_cargo_control` = #{query.isCargoControl}",
"</when>",
"<when test = 'query.orderNo != null and query.orderNo != \"\" '>",
"AND o.`order_no` like concat('%',concat(#{query.orderNo},'%'))",
"</when>",
"<when 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> ",
"</when>",
"<when test = 'query.tidanNo != null and query.tidanNo != \"\" '>",
"AND o.`tidan_no` like concat('%',concat(#{query.tidanNo},'%'))",
"</when>",
"<when test = 'query.customerId != null'>",
"AND o.`customer_id` = #{query.customerId}",
"</when>",
"<when test = 'query.beginRucangTime != null and query.endRucangTime != null '>",
// "AND o.`rucang_time` between #{query.beginRucangTime} and #{query.endRucangTime}",
"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})",
"</when>",
"<when test = 'query.beginQingguanTime != null and query.endQingguanTime != null '>",
"AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}",
"</when>",
"<when test = 'query.beginDaogangTime != null and query.endDaogangTime != null '>",
"AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}",
"</when>",
"<when test = 'query.beginPreLoadTime != null and query.endPreLoadTime != null '>",
"AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}",
"</when>",
"<when 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})",
"</when>",
"<when test = 'query.beginLoadTime != null and query.endLoadTime != null '>",
"AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}",
"</when>",
"<when test = 'query.beginUnloadTime != null and query.endUnloadTime != null '>",
"AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}",
"</when>",
"<when test = 'query.beginTakeTime != null and query.endTakeTime != null '>",
"AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}",
"</when>",
"<when test = 'query.beginSplitTime != null and query.endSplitTime != null '>",
"AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}",
"</when>",
"<when test = 'query.beginCreateTime != null and query.endCreateTime != null '>",
"AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}",
"</when>",
"<when 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})",
"</when>",
"and op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime}",
"<when test = 'query.creator != null and query.creator != \"\" '>",
"AND o.`creator` = #{query.creator}",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))))",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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},'%'))",
"</when>",
"<when 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}))",
"</when>",
"<when 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})",
"</when>",
"<when 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},'%'))",
"))",
"</when>",
"<when 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},'%'))",
"))",
"</when>",
"<when 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})",
"))",
"</when>",
"<when 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})",
"))",
"</when>",
"<when 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 = #{query.startWarehouseId} and whl.dest_warehouse_id = #{query.destWarehouseId} ",
"))",
"</when>",
"<when 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 = #{query.startWarehouseId} ",
"))",
"</when>",
"<when 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 = #{query.destWarehouseId} ",
"))",
"</when>",
"<when 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 ",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 2'>",
"AND o.`status` = 5 AND o.air_shipment = 2",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 3'>",
"AND o.`status` = 5 AND o.air_shipment = 3",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 4'>",
"AND o.`status` = 5 AND o.air_shipment = 4",
"</when>",
"<when test = 'query.airShipment != null and query.airShipment == 10'>",
"AND o.`status` = 5 AND o.air_shipment in(2,3,4)",
"</when>",
"<when 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 ",
"</when>",
"<when 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 ",
"</when>",
"<when 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 ",
"</when>",
"<when test = 'query.isNeat == false '>",
" AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.isNeat == true '>",
" AND o.sum_num = o.cost->>'$.totalNum' ",
"</when>",
"<when test = 'query.customerDetailId != null'>",
"AND (o.`customer_id` = #{query.customerDetailId} or nor.`customer_id` = #{query.customerDetailId} or nee.`customer_id` = #{query.customerDetailId})",
"</when>",
"<when test = 'query.userType == 2 '>",
"</when>",
"</script>"
})
StatisticsOrderVO statisticsMyPickUp(@Param("query") OrderQueryDTO query);
@ResultType(OrderDO.class)
@Select({
......
package cn.iocoder.yudao.module.order.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
public class OrderQueryDTO {
@ApiModelProperty(value = "OrderId列表,通过多个orderId查询订单时使用")
private List<Long> orderIdList;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "快递单号")
private String number;
@ApiModelProperty(value = "反向搜索快递单号不包含的数据")
private String notNumber;
@ApiModelProperty(value = "提单编号")
private String tidanNo;
@ApiModelProperty(value = "父编号")
private String parentNumber;
/**
* 父订单id
*/
@ApiModelProperty(value = "父订单id")
private Long parentOrderId;
/**
* 初始母订单id
*/
@ApiModelProperty(value = "初始母订单id")
private Long initialParentOrderId;
@ApiModelProperty(value = "初始母订单编号")
private String initialParentOrderNo;
@ApiModelProperty(value = "旧编号")
private String oldNumbers;
@ApiModelProperty(value = "货柜自编号")
private String containerNumber;
@ApiModelProperty(value = "运输方式id")
private Integer transportId;
@ApiModelProperty(value = "线路ID")
private Long lineId;
@ApiModelProperty(value = "渠道ID")
private Long channelId;
@ApiModelProperty(value = "订单类型筛选条件:0 普通订单 1 集运服务 2 海外仓")
private String type;
@ApiModelProperty(value = "订单类型:1 普货 2 重货 3 泡货")
private Integer orderType;
@ApiModelProperty(value = "下单会员id")
private Long userId;
@ApiModelProperty(value = "客户经理ID")
private Long salesmanId;
@ApiModelProperty(value = "客户经理所属部门ID")
private Long deptId;
@ApiModelProperty(value = "客户经理所属部门ID集合")
private List<Long> deptIdList;
@ApiModelProperty(value = "唛头")
private String marks;
@ApiModelProperty(value = "产品备案属性:1有牌,2无牌,3中性,4混牌")
private Integer productRecord;
@ApiModelProperty(value = "是否控货")
private Boolean isCargoControl;
@ApiModelProperty(value = "0 控货中;1 已放完货;2 部分控货 3 放货中(此状态值为组合状态,当已放完货,但未全部复核完毕时为此状态,仅供查询条件传参使用)")
private Integer cargoControlStatus;
@ApiModelProperty(value = "报关类别:我司全代:1,自单代报:2,混合报关:3")
private Integer customsType;
@ApiModelProperty(value = "上传文件")
private String upFile;
@ApiModelProperty(value = "付款类型")
private Integer payType;
@ApiModelProperty(value = "订单状态详情见字典:order_status")
private Integer status;
@ApiModelProperty(value = "订单异常状态(字典 order_abnormal_state)")
private Integer abnormalState;
@ApiModelProperty(value = "订单入仓状态(字典 order_warehouse_in_status)")
private Integer inWarehouseState;
@ApiModelProperty(value = "订单出货状态(字典 order_shipment_state)")
private Integer shipmentState;
@ApiModelProperty(value = "上次订单主状态值")
private Integer oldStatus;
@ApiModelProperty(value = "上次订单入仓状态值")
private Integer oldInWarehouseState;
@ApiModelProperty(value = "上次订单出货状态值")
private Integer oldShipmentState;
@ApiModelProperty(value = "是否被删掉 1 删掉;0正常")
private Boolean isDel;
@ApiModelProperty(value = "代收金额")
private BigDecimal collectionProxy;
@ApiModelProperty(value = "代收货币ID")
private Integer collectionProxyCurrency;
@ApiModelProperty(value = "是否代收货款收款 0为否 1为是")
private Boolean isCollection;
@ApiModelProperty(value = "重货体积")
private String wVolume;
@ApiModelProperty(value = "泡货重量")
private String vWeight;
@ApiModelProperty(value = "重货标准基数")
private BigDecimal weightUnit;
@ApiModelProperty(value = "泡货标准基数")
private BigDecimal volumeUnit;
@ExcelProperty("原重货标准基数")
@ApiModelProperty(value = "原重货标准基数")
private BigDecimal orgWeightUnit;
@ExcelProperty("原重货标准基数")
@ApiModelProperty(value = "原泡货标准基数")
private BigDecimal orgVolumeUnit;
@ApiModelProperty(value = "计算使用的重货标准基数")
private BigDecimal useWeightUnit;
@ApiModelProperty(value = "计算使用的泡货标准基数")
private BigDecimal useVolumeUnit;
@ApiModelProperty(value = "入仓类型")
private Integer warehouseType;
@ApiModelProperty(value = "是否发送过入仓短信 已发送:1,未发送:0")
private Boolean sendsms;
@ApiModelProperty(value = "单证资料")
private String documentsFile;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "调仓始发仓")
private Long adjustToStartWarehouseId;
/**
* 调仓目的仓
*/
@ApiModelProperty(value = "调仓目的仓id")
private Long adjustToDestWarehouseId;
@ApiModelProperty(value = "入仓数量")
private Integer sumQuantity;
@ApiModelProperty(value = "入仓件数")
private Integer sumNum;
@ApiModelProperty(value = "入仓体积")
private BigDecimal sumVolume;
@ApiModelProperty(value = "入仓重量")
private BigDecimal sumWeight;
@ApiModelProperty(value = "重货比")
private BigDecimal weightRatio;
@ApiModelProperty(value = "发货人的客户id")
private Long customerId;
@ApiModelProperty(value = "客户详情页-客户id")
private Long customerDetailId;
@ApiModelProperty(value = "用户优惠劵ids")
private String couponCustomerIds;
@ApiModelProperty(value = "库域ID")
private Long wareId;
@ApiModelProperty(value = "始发仓ID串,eg: 1,2,3")
private String pdaStartWareIds;
@ApiModelProperty(value = "目的仓ID串,eg: 1,2,3")
private String pdaDestWareIds;
@ApiModelProperty(value = "库区ID")
private Long areaId;
@ApiModelProperty(value = "库位ID")
private Long locationId;
@ApiModelProperty(value = "仓位名称,多个用(,)号隔开")
private String locationName;
@ApiModelProperty(value = "航空公司id")
private Long airlineCompany;
@ApiModelProperty(value = "船公司id")
private Long shippingCompany;
@ApiModelProperty(value = "清关证书:0 否 1 是")
private Boolean customsClearCert;
@ApiModelProperty(value = "出单方式:1 电放 2 正本")
private Integer issuingMethod;
@ApiModelProperty(value = "是否拆包:0 否 1 是")
private Boolean isUnpack;
@ApiModelProperty(value = "是否单票立刻转运:0 否 1 是")
private Boolean isSingleTicketTransport;
@ApiModelProperty(value = "费用清单")
private String cost;
@ApiModelProperty(value = "付款人: 1 发货人 2 收货人 3 自定义")
private Integer drawee;
@ApiModelProperty(value = "自定义付款人信息")
private String customDrawee;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始送货时间")
private Date beginDeliveryDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束送货时间")
private Date endDeliveryDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始入仓时间")
private Date beginRucangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束入仓时间")
private Date endRucangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始入仓记录时间")
private Date beginWarehouseInTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束入仓记录时间")
private Date endWarehouseInTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始到港时间")
private Date beginDaogangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束到港时间")
private Date endDaogangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始清关时间")
private Date beginQingguanTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束清关时间")
private Date endQingguanTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始已预装时间")
private Date beginPreLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束已预装时间")
private Date endPreLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始已装柜时间")
private Date beginLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始出仓时间")
private Date beginOutboundTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束出仓时间")
private Date endOutboundTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始理货时间")
private Date beginTallyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束理货时间")
private Date endTallyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始出货时间")
private Date beginShippingTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束出货时间")
private Date endShippingTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束已装柜时间")
private Date endLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始已卸柜时间")
private Date beginUnloadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束已卸柜时间")
private Date endUnloadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始提货时间")
private Date beginTakeTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束提货时间")
private Date endTakeTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始提货记录时间")
private Date beginPickUpTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束提货记录时间")
private Date endPickUpTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始拆单时间")
private Date beginSplitTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束拆单时间")
private Date endSplitTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始放货时间")
private Date beginPickTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束放货时间")
private Date endPickTime;
@ApiModelProperty(value = "包装类型ids")
private String packageType;
@ApiModelProperty(value = "包装备注")
private String packageRemarks;
@ApiModelProperty(value = "是否双清:1 客户自清 2 我司双清")
private Integer doubleClear;
@ApiModelProperty(value = "装箱单url")
private String packingListUrl;
@ApiModelProperty(value = "语言")
private Integer lang;
@ApiModelProperty(value = "始发地id")
private Long departureId;
@ApiModelProperty(value = "目的地id")
private List<Long> objectiveId;
@ApiModelProperty(value = "始发仓ID")
private Long startWarehouseId;
@ApiModelProperty(value = "目的仓ID")
private List<Long> destWarehouseId;
/**
* 目的国
*/
@ApiModelProperty(value = "目的国id")
private List<Long> destCountryId ;
@ApiModelProperty(value = "发货客户ID")
private Long consignorId;
@ApiModelProperty(value = "发货客户联系人ID")
private Long consignorContactsId;
@ApiModelProperty(value = "发货客户联系人IDs")
private Collection<Long> consignorContactsIds;
@ApiModelProperty(value = "收货人手机号")
private String consignorPhone;
@ApiModelProperty(value = "收货客户id")
private Long consigneeId;
@ApiModelProperty(value = "收货客户联系人id")
private Long consigneeContactsId;
@ApiModelProperty(value = "收货客户联系人ids")
private Collection<Long> consigneeContactsIds;
@ApiModelProperty(value = "收货人手机号")
private String consigneePhone;
@ApiModelProperty(value = "控货人手机号")
private String cargoControlPhone;
@ApiModelProperty(value = "创建者", required = true)
private String creator;
@ApiModelProperty(value = "发货人姓名、手机号搜索")
private String consignorKey;
@ApiModelProperty(value = "发货人姓名、手机号反向搜索不包含的数据")
private String notConsignorKey;
@ApiModelProperty(value = "收货人姓名、手机号搜索")
private String consigneeKey;
@ApiModelProperty(value = "收货人姓名、手机号反向搜索不包含的数据")
private String notConsigneeKey;
@ApiModelProperty(value = "编号关键字搜索(包括订单号,麦头,收货人姓名电话)")
private String searchKey;
@ApiModelProperty(value = "编号搜索(包括订单号,麦头,提单号)")
private String numberKey;
@ApiModelProperty(value = "反向编号搜索(包括订单号,麦头,提单号)不包含的数据")
private String notNumberKey;
@ApiModelProperty(value = "编号搜索强等于(包括订单号,麦头,提单号)")
private String eqNumberKey;
@ApiModelProperty(value = "编号搜索强不等于(包括订单号,麦头,提单号)")
private String notEqNumberKey;
@ApiModelProperty(value = "商品搜索(商品类型、品名或品牌)")
private String prodKey;
@ApiModelProperty(value = "商品反向搜索(商品类型、品名或品牌)不包含的数据")
private String notProdKey;
@ApiModelProperty(value = "商品搜索强等于(商品类型、品名或品牌)")
private String eqProdKey;
@ApiModelProperty(value = "商品搜索强不等于(商品类型、品名或品牌)")
private String notEqProdKey;
@ApiModelProperty(value = "是否齐货")
private Boolean isNeat;
@ApiModelProperty(value = "审核类型(字典 order_approval_type) 0 为正常")
private Integer auditType;
@ApiModelProperty(value = "审核结果")
private String auditResult;
@ApiModelProperty(value = "是否外部仓")
private Boolean isExternalWarehouse;
@ApiModelProperty(value = "目的港清关:1 我司 2 客户")
private Integer portDestCustomsClear;
@ApiModelProperty(value = "发货方式:1 多票 2 单票")
private Integer deliveryWay;
@ApiModelProperty(value = "空运可出货状态:0 默认值 1 待出 2 可出 3 备货中 4 已备货 10 可出、备货中、已备货 11 待出、可出、备货中、已备货 12 可出、备货中")
private Integer airShipment;
/**
* 端口 {@link }
*/
@ApiModelProperty(value = "端口(默认管理端)")
private Integer userType = 2;
@ApiModelProperty(value = "是否显示关联订单状态")
private Boolean isDisplayGuanlianStatus = false;
@ApiModelProperty(value = "内部转换状态字段")
private Integer asStatus;
public void setStatus(Integer status) {
this.status = status;
this.asStatus = status;
if (Objects.nonNull(this.asStatus) && asStatus > 10000) {
combinedState(this.asStatus, this.transportId);
}
}
public void setTransportId(Integer transportId) {
this.transportId = transportId;
if (Objects.nonNull(transportId) && Objects.nonNull(this.asStatus)) {
combinedState(this.asStatus, this.transportId);
}
}
private void combinedState(Integer asStatus, Integer transportId) {
switch (asStatus) {
case 12325:
this.status = 12;
this.shipmentState = 325;
break;
case 10501:
// 空运待出
this.status = 5;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.airShipment = 1;
this.auditType = 0;
this.abnormalState = 0;
break;
case 10502:
// 空运可出
this.status = 5;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.airShipment = 12; // 可出、备货中
break;
case 10503:
// 空运已备货
this.status = 5;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.airShipment = 4; // 已备货
break;
case 10504:
// 待排单
this.status = 5;
if (Objects.nonNull(transportId) && transportId == 3) {
// 空运无需判断备货状态 可出、备货中、已备货
this.airShipment = 10;
}else {
// 兼容空运已入仓的可出、备货中、已备货,且无异常无审批,海运的已入仓无异常无审批
this.airShipment = 20;
}
this.auditType = 0;
this.abnormalState = 0;
break;
case 132411:
// 空运已出货
this.status = 32;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.shipmentState = 411;
break;
case 132412:
// 空运已出仓
this.status = 32;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.shipmentState = 412;
break;
case 132409:
// 空运已理货
this.status = 32;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.shipmentState = 409;
break;
case 118428:
// 空运已到港
this.status = 18;
this.transportId = 3; // 空运待出查询,只查空运的订单
this.shipmentState = 428;
break;
}
}
public void setShipmentState(Integer shipmentState) {
if (Objects.nonNull(shipmentState)) {
this.shipmentState = shipmentState;
}
}
}
......@@ -153,11 +153,16 @@ public interface OrderQueryService {
List<OrderDO> getOrderList(OrderQueryVO query);
PageResult<OrderBackPageVO> orderPage(OrderQueryVO query, PageVO page);
PageResult<OrderBackPageVO> myOrderPage(OrderQueryDTO query, PageVO page);
long orderCount(OrderQueryVO query);
PageResult<OrderBackPageVO> deptOrderPage(OrderQueryVO query, PageVO page);
PageResult<OrderBackPageVO> deptOrderPage1(OrderQueryDTO query, PageVO page);
PageResult<OrderBackPageVO> myIssuedOrderPage(OrderQueryVO query, PageVO page);
/**
......@@ -307,6 +312,7 @@ public interface OrderQueryService {
List<OrderDO> getOrderChildren(List<Long> orderIds);
StatisticsOrderVO statisticsOrder(OrderQueryVO query);
StatisticsOrderVO statisticsMyOrder(OrderQueryDTO query) ;
void exportOrderExcel(HttpServletResponse response, OrderQueryVO query) throws IOException;
......
......@@ -875,6 +875,20 @@ public class OrderQueryServiceImpl implements OrderQueryService {
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public PageResult<OrderBackPageVO> myOrderPage(OrderQueryDTO query, PageVO page) {
if (Objects.isNull(query.getLang())) {
query.setLang(I18nMessage.getLang());
}
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
long total = orderMapper.orderCount1(query);
log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<OrderBackPageVO> list = orderMapper.orderList1(start, size, query);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public long orderCount(OrderQueryVO query) {
return orderMapper.orderCount(query);
......@@ -892,6 +906,18 @@ public class OrderQueryServiceImpl implements OrderQueryService {
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public PageResult<OrderBackPageVO> deptOrderPage1(OrderQueryDTO query, PageVO page) {
query.setLang(I18nMessage.getLang());
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
long total = orderMapper.deptOrderCount1(query);
log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<OrderBackPageVO> list = orderMapper.deptOrderList1(start, size, query);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public PageResult<OrderBackPageVO> myIssuedOrderPage(OrderQueryVO query, PageVO page) {
query.setLang(I18nMessage.getLang());
......@@ -1480,6 +1506,61 @@ public class OrderQueryServiceImpl implements OrderQueryService {
return vo;
}
@Override
public StatisticsOrderVO statisticsMyOrder(OrderQueryDTO query) {
StatisticsOrderVO vo = orderMapper.statisticsMyOrder(query);
if (Objects.nonNull(vo)) {
vo.setTotalVolume(new BigDecimal(vo.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(vo.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWVolume(new BigDecimal(vo.getTotalWVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalVWeight(new BigDecimal(vo.getTotalVWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalChargeVolume(new BigDecimal(vo.getTotalChargeVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalChargeWeight(new BigDecimal(vo.getTotalChargeWeight()).setScale(2, RoundingMode.HALF_UP).toString());
} else {
vo = new StatisticsOrderVO();
}
if (Objects.nonNull(query.getBeginWarehouseInTime()) && Objects.nonNull(query.getEndWarehouseInTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO warehouseInVO = orderMapper.statisticsMyWarehouseIn(query);
if (Objects.nonNull(warehouseInVO)) {
vo.setTotalNum(warehouseInVO.getTotalNum());
vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
} else {
vo.setTotalNum(0);
vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(0);
}
}
if (Objects.nonNull(query.getBeginRucangTime()) && Objects.nonNull(query.getEndRucangTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO warehouseInVO = orderMapper.statisticsMyWarehouseIn(query);
if (Objects.nonNull(warehouseInVO)) {
vo.setTotalNum(warehouseInVO.getTotalNum());
vo.setTotalVolume(new BigDecimal(warehouseInVO.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(new BigDecimal(warehouseInVO.getTotalWeight()).setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(warehouseInVO.getOrderQuantity());
} else {
vo.setTotalNum(0);
vo.setTotalVolume(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setTotalWeight(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP).toString());
vo.setOrderQuantity(0);
}
}
if (Objects.nonNull(query.getBeginPickUpTime()) && Objects.nonNull(query.getEndPickUpTime())) {
// 入仓记录统计时,实测入仓数据替换为入仓记录中的和值
StatisticsOrderVO pickUpVO = orderMapper.statisticsMyPickUp(query);
if (Objects.nonNull(pickUpVO)) {
vo.setTotalNum(pickUpVO.getTotalNum());
} else {
vo.setTotalNum(0);
}
}
return vo;
}
@Override
public void exportOrderExcel(HttpServletResponse response, OrderQueryVO query) throws IOException {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT);
......
......@@ -763,6 +763,131 @@
limit #{start}, #{size}
</select>
<select id="orderList1" resultType="cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO">
select o.order_id,
o.package_type as advance_type,
o.package_remarks,
o.number,
o.order_no,
o.tidan_no,
o.type,
o.order_type,
o.air_shipment,
IFNULL((select SUM(IF(it.charge_volume > it.min_metering_volume, it.charge_volume, it.min_metering_volume)) FROM
ecw_order_item it WHERE it.order_id = o.order_id and it.deleted = 0 and it.warehouse_in_info IS NOT NULL), 0) as
w_volume,
IFNULL((select SUM(IF( it.charge_weight > it.min_metering_weight, it.charge_weight, it.min_metering_weight))
FROM ecw_order_item it WHERE it.order_id = o.order_id and it.deleted = 0 and it.warehouse_in_info IS NOT NULL),
0) as v_weight,
o.customs_type,
if(#{query.customerDetailId} is not null and #{query.customerDetailId} > 0, (select min(owi.`in_time`) from
ecw_order_warehouse_in owi where owi.deleted = 0 and owi.order_id = o.order_id ), o.rucang_time ) as
rucang_time,
o.cost,
o.parent_number,
o.parent_order_id,
o.initial_parent_order_id,
if(#{query.lang} = 0, de.departure ->> '$.titleZh', de.departure ->> '$.titleEn') as departure_name,
if(#{query.lang} = 0, ob.objective ->> '$.titleZh', ob.objective ->> '$.titleEn') as objective_name,
de.departure_id,
ob.objective_id,
o.adjust_to_start_warehouse_id,
(SELECT IF(0 = 0, ew_start_adjust.title_zh, ew_start_adjust.title_en) FROM ecw_warehouse ew_start_adjust WHERE
ew_start_adjust.id = o.adjust_to_start_warehouse_id) AS adjust_to_start_warehouse_name,
o.adjust_to_dest_warehouse_id,
(SELECT IF(0 = 0, ew_dest_adjust.title_zh, ew_dest_adjust.title_en) FROM ecw_warehouse ew_dest_adjust WHERE
ew_dest_adjust.id = o.adjust_to_dest_warehouse_id) AS adjust_to_dest_warehouse_name,
o.dest_adjust_to_start_warehouse_id,
(SELECT IF(0 = 0, ew_start_adjust.title_zh, ew_start_adjust.title_en) FROM ecw_warehouse ew_start_adjust WHERE
ew_start_adjust.id = o.dest_adjust_to_start_warehouse_id) AS dest_adjust_to_start_warehouse_name,
o.dest_adjust_to_dest_warehouse_id,
(SELECT IF(0 = 0, ew_dest_adjust.title_zh, ew_dest_adjust.title_en) FROM ecw_warehouse ew_dest_adjust WHERE
ew_dest_adjust.id = o.dest_adjust_to_dest_warehouse_id) AS dest_adjust_to_dest_warehouse_name,
w.start_warehouse_name,
w.dst_warehouse_name,
w.start_warehouse_id,
w.dst_warehouse_id,
o.marks,
o.salesman_id,
o.status,
o.abnormal_state,
o.in_warehouse_state,
o.shipment_state,
o.audit_type,
o.audit_result,
o.guan_lian_order_status,
o.transport_id,
(select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
ccp.status in(1,2,3,4) ) as release_num,
o.is_cargo_control,
o.cargo_control_status,
o.cost ->> '$.totalNum' as total_num,
o.sum_num,
o.sum_volume,
o.sum_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
o.is_external_warehouse,
o.exception_reason,
o.is_exception,
o.create_time,
o.load_time,
(select su.nickname from system_user su where su.deleted = 0 and su.id = o.salesman_id) as salesman_name,
(select min(wi.`in_time`) from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.order_id = o.order_id ) as
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.name as consignor_name,
nor.name_en as consignor_name_en,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nee.name as consignee_name,
nee.name_en as consignee_name_en,
nee.phone as consignee_phone,
nee.country_code as consignee_country_code,
if(#{query.lang} = 0, channel.name_zh, channel.name_en) as channel_name,
o.update_time,
#{query.lang} as lang
from ecw_order o
left join (
SELECT
ewl.id AS line_id,
ew_start.id AS start_warehouse_id,
ew_dest.id AS dst_warehouse_id,
ew_start.title_zh AS start_title_zh,
IF( #{query.lang} = 0, ew_dest.title_zh, ew_dest.title_en ) AS dst_warehouse_name,
IF( #{query.lang} = 0, ew_start.title_zh, ew_start.title_en ) AS start_warehouse_name
FROM
ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
) w ON w.line_id = o.line_id
left join ecw_order_departure de on de.order_id = o.order_id
left join ecw_order_objective ob on ob.order_id = o.order_id
left join ecw_order_consignor nor on nor.order_id = o.order_id
left join ecw_order_consignee nee on nee.order_id = o.order_id
left join ecw_channel channel on channel.channel_id = o.channel_id
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<if test="query.deptId != null ">
AND o.dept_id = #{query.deptId}
</if>
<if test="query.deptIdList != null and query.deptIdList.size() > 0">
AND (o.dept_id IN
<foreach item="deptId" collection="query.deptIdList" open="(" close=")" separator=",">
#{deptId}
</foreach>
or
(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>
<include refid="myOrderQuery"/>
order by o.order_id desc
limit #{start}, #{size}
</select>
<select id="orderCount" resultType="java.lang.Long">
select count(1)
from ecw_order o
......@@ -775,20 +900,447 @@
<if test="query.deptId != null ">
AND o.dept_id = #{query.deptId}
</if>
<if test="query.deptIdList != null and query.deptIdList.size() > 0">
AND (o.dept_id IN
<foreach item="deptId" collection="query.deptIdList" open="(" close=")" separator=",">
#{deptId}
<if test="query.deptIdList != null and query.deptIdList.size() > 0">
AND (o.dept_id IN
<foreach item="deptId" collection="query.deptIdList" open="(" close=")" separator=",">
#{deptId}
</foreach>
or
(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>
<include refid="orderQuery"/>
</select>
<select id="orderCount1" resultType="java.lang.Long">
select count(1)
from ecw_order o
left join ecw_order_departure de on de.order_id = o.order_id
left join ecw_order_objective ob on ob.order_id = o.order_id
left join ecw_order_consignor nor on nor.order_id = o.order_id
left join ecw_order_consignee nee on nee.order_id = o.order_id
left join ecw_channel channel on channel.channel_id = o.channel_id
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<if test="query.deptId != null ">
AND o.dept_id = #{query.deptId}
</if>
<if test="query.deptIdList != null and query.deptIdList.size() > 0">
AND (o.dept_id IN
<foreach item="deptId" collection="query.deptIdList" open="(" close=")" separator=",">
#{deptId}
</foreach>
or
(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>
<include refid="myOrderQuery"/>
</select>
<sql id="myOrderQuery">
<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.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.isExternalWarehouse != null">
AND o.`is_external_warehouse` = #{query.isExternalWarehouse}
</if>
<if test="query.status != null">
AND o.`status` = #{query.status}
</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.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.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.productRecord != null">
AND o.`product_record` = #{query.productRecord}
</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 o.`warehouse_type` = #{query.warehouseType}
</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 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.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</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.containerNumber != null and query.containerNumber != '' ">
AND o.`container_number` = #{query.containerNumber}
</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.`status` > 5 AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
</if>
<if test="query.beginUnloadTime != null and query.endUnloadTime != null ">
AND o.`status` > 5 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.cargoControlStatus != null and query.cargoControlStatus != 3'>
AND o.`cargo_control_status` = #{query.cargoControlStatus}
</if>
<if test = 'query.cargoControlStatus != null and query.cargoControlStatus == 3'>
AND o.`cargo_control_status` = 1 AND (select count(1) from ecw_order_cargo_control_pick ccp2 where ccp2.order_id = o.order_id and ccp2.status = 1) > 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})
</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.size() !=0 ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id = #{query.startWarehouseId}
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
or
(SELECT u.dept_id FROM system_user u WHERE u.id = o.creator) IN
<foreach item="deptId" collection="query.deptIdList" open="(" close=")" separator=",">
#{deptId}
))
</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 = #{query.startWarehouseId}
))
</if>
<if test="query.startWarehouseId == null and query.destWarehouseId !=null and query.destWarehouseId.size() != 0 ">
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>
<include refid="orderQuery"/>
</select>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</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 == true ">
AND o.sum_num = o.cost->>'$.totalNum'
</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 ">
AND ((o.user_id is not null AND o.user_id > 0 AND o.`status` != 0) or o.user_id is null or o.user_id = 0)
</if>
</sql>
<sql id="orderQuery">
<if test="query.type != null and query.type != '' and query.type == 0 ">
......@@ -1650,6 +2202,117 @@
limit #{start}, #{size}
</select>
<select id="deptOrderList1" resultType="cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO">
select o.order_id,
o.package_type as advance_type,
o.package_remarks,
o.number,
o.order_no,
o.tidan_no,
o.type,
o.order_type,
o.air_shipment,
IFNULL((select SUM(IF(it.charge_volume > it.min_metering_volume, it.charge_volume, it.min_metering_volume)) FROM
ecw_order_item it WHERE it.order_id = o.order_id and it.deleted = 0 and it.warehouse_in_info IS NOT NULL), 0) as
w_volume,
IFNULL((select SUM(IF( it.charge_weight > it.min_metering_weight, it.charge_weight, it.min_metering_weight))
FROM ecw_order_item it WHERE it.order_id = o.order_id and it.deleted = 0 and it.warehouse_in_info IS NOT NULL),
0) as v_weight,
o.customs_type,
if(#{query.customerDetailId} is not null and #{query.customerDetailId} > 0, (select min(owi.`in_time`) from
ecw_order_warehouse_in owi where owi.deleted = 0 and owi.order_id = o.order_id ), o.rucang_time ) as
rucang_time,
o.cost,
o.parent_number,
o.parent_order_id,
o.initial_parent_order_id,
if(#{query.lang} = 0, de.departure ->> '$.titleZh', de.departure ->> '$.titleEn') as departure_name,
if(#{query.lang} = 0, ob.objective ->> '$.titleZh', ob.objective ->> '$.titleEn') as objective_name,
de.departure_id,
ob.objective_id,
o.adjust_to_start_warehouse_id,
(SELECT IF(0 = 0, ew_start_adjust.title_zh, ew_start_adjust.title_en) FROM ecw_warehouse ew_start_adjust WHERE
ew_start_adjust.id = o.adjust_to_start_warehouse_id) AS adjust_to_start_warehouse_name,
o.adjust_to_dest_warehouse_id,
(SELECT IF(0 = 0, ew_dest_adjust.title_zh, ew_dest_adjust.title_en) FROM ecw_warehouse ew_dest_adjust WHERE
ew_dest_adjust.id = o.adjust_to_dest_warehouse_id) AS adjust_to_dest_warehouse_name,
o.dest_adjust_to_start_warehouse_id,
(SELECT IF(0 = 0, ew_start_adjust.title_zh, ew_start_adjust.title_en) FROM ecw_warehouse ew_start_adjust WHERE
ew_start_adjust.id = o.dest_adjust_to_start_warehouse_id) AS dest_adjust_to_start_warehouse_name,
o.dest_adjust_to_dest_warehouse_id,
(SELECT IF(0 = 0, ew_dest_adjust.title_zh, ew_dest_adjust.title_en) FROM ecw_warehouse ew_dest_adjust WHERE
ew_dest_adjust.id = o.dest_adjust_to_dest_warehouse_id) AS dest_adjust_to_dest_warehouse_name,
w.start_warehouse_name,
w.dst_warehouse_name,
w.start_warehouse_id,
w.dst_warehouse_id,
o.marks,
o.salesman_id,
o.status,
o.abnormal_state,
o.in_warehouse_state,
o.shipment_state,
o.audit_type,
o.audit_result,
o.guan_lian_order_status,
o.transport_id,
(select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
ccp.status in(1,2,3,4) ) as release_num,
o.is_cargo_control,
o.cargo_control_status,
o.cost ->> '$.totalNum' as total_num,
o.sum_num,
o.sum_volume,
o.sum_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
o.is_external_warehouse,
o.exception_reason,
o.is_exception,
o.create_time,
o.load_time,
(select su.nickname from system_user su where su.deleted = 0 and su.id = o.salesman_id) as salesman_name,
(select min(wi.`in_time`) from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.order_id = o.order_id ) as
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.name as consignor_name,
nor.name_en as consignor_name_en,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nee.name as consignee_name,
nee.name_en as consignee_name_en,
nee.phone as consignee_phone,
nee.country_code as consignee_country_code,
if(#{query.lang} = 0, channel.name_zh, channel.name_en) as channel_name,
o.update_time,
#{query.lang} as lang
from ecw_order o
left join (
SELECT
ewl.id AS line_id,
ew_start.id AS start_warehouse_id,
ew_dest.id AS dst_warehouse_id,
ew_start.title_zh AS start_title_zh,
IF( #{query.lang} = 0, ew_dest.title_zh, ew_dest.title_en ) AS dst_warehouse_name,
IF( #{query.lang} = 0, ew_start.title_zh, ew_start.title_en ) AS start_warehouse_name
FROM
ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
) w ON w.line_id = o.line_id
left join ecw_order_departure de on de.order_id = o.order_id
left join ecw_order_objective ob on ob.order_id = o.order_id
left join ecw_order_consignor nor on nor.order_id = o.order_id
left join ecw_order_consignee nee on nee.order_id = o.order_id
left join ecw_channel channel on channel.channel_id = o.channel_id
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
AND o.dept_id = #{query.deptId}
<include refid="myOrderQuery"/>
order by o.order_id desc
limit #{start}, #{size}
</select>
<select id="deptOrderCount" resultType="java.lang.Long">
select count(1)
from ecw_order o
......@@ -1663,6 +2326,19 @@
<include refid="orderQuery"/>
</select>
<select id="deptOrderCount1" resultType="java.lang.Long">
select count(1)
from ecw_order o
left join ecw_order_departure de on de.order_id = o.order_id
left join ecw_order_objective ob on ob.order_id = o.order_id
left join ecw_order_consignor nor on nor.order_id = o.order_id
left join ecw_order_consignee nee on nee.order_id = o.order_id
left join ecw_channel channel on channel.channel_id = o.channel_id
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
AND o.dept_id = #{query.deptId}
<include refid="myOrderQuery"/>
</select>
<select id="appMyIssuedOrderList" resultType="cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO">
select o.order_id,
o.package_type as advance_type,
......
......@@ -27,10 +27,7 @@ import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.order.convert.order.OrderConvert;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.order.dto.OrderExportBackDTO;
import cn.iocoder.yudao.module.order.dto.PackingListDto;
import cn.iocoder.yudao.module.order.dto.SearchBackDto;
import cn.iocoder.yudao.module.order.dto.*;
import cn.iocoder.yudao.module.order.enums.OrderTempLateEnum;
import cn.iocoder.yudao.module.order.enums.TransportTypeShortEnum;
import cn.iocoder.yudao.module.order.service.order.OrderBusinessService;
......@@ -308,9 +305,9 @@ public class OrderController {
@GetMapping("/page")
@ApiOperation("获得订单分页")
// @PreAuthorize("@ss.hasPermission('ecw:order:query')")
public CommonResult<PageResult<OrderBackPageVO>> getOrderPage(OrderQueryVO query, PageVO page) {
public CommonResult<PageResult<OrderBackPageVO>> getOrderPage(OrderQueryDTO query, PageVO page) {
query.setUserType(UserTypeEnum.ADMIN.getValue());
PageResult<OrderBackPageVO> pageResult = orderQueryService.orderPage(query, page);
PageResult<OrderBackPageVO> pageResult = orderQueryService.myOrderPage(query, page);
return success(pageResult);
}
......@@ -326,12 +323,12 @@ public class OrderController {
@GetMapping("/my/page")
@ApiOperation("获得我的订单分页")
public CommonResult<PageResult<OrderBackPageVO>> myOrderPage(OrderQueryVO query, PageVO page) {
public CommonResult<PageResult<OrderBackPageVO>> myOrderPage(OrderQueryDTO query, PageVO page) {
Long salesmanId = SecurityFrameworkUtils.getLoginUserId(); // 获取当前登录用户ID
query.setUserType(UserTypeEnum.ADMIN.getValue());
// query.setSalesmanId(salesmanId);
query.setCreator(String.valueOf(salesmanId));
PageResult<OrderBackPageVO> pageResult = orderQueryService.orderPage(query, page);
PageResult<OrderBackPageVO> pageResult = orderQueryService.myOrderPage(query, page);
return success(pageResult);
}
......@@ -339,11 +336,11 @@ public class OrderController {
@GetMapping("/dept-order-page")
@ApiOperation("部门订单分页")
// @PreAuthorize("@ss.hasPermission('ecw:order:query')")
public CommonResult<PageResult<OrderBackPageVO>> getDeptOrderPage(OrderQueryVO query, PageVO page) {
public CommonResult<PageResult<OrderBackPageVO>> getDeptOrderPage(OrderQueryDTO query, PageVO page) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
query.setUserType(UserTypeEnum.ADMIN.getValue());
query.setDeptId(Objects.isNull(loginUser) ? 0L : loginUser.getDeptId());
PageResult<OrderBackPageVO> pageResult = orderQueryService.deptOrderPage(query, page);
PageResult<OrderBackPageVO> pageResult = orderQueryService.deptOrderPage1(query, page);
return success(pageResult);
}
......@@ -716,12 +713,12 @@ public class OrderController {
@GetMapping("/dept/statistics")
@ApiOperation("参数查询获得部门订单统计")
public CommonResult<StatisticsOrderVO> statisticsDeptOrder(OrderQueryVO query) {
public CommonResult<StatisticsOrderVO> statisticsDeptOrder(OrderQueryDTO query) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); // 获取当前登录用户ID
query.setUserType(UserTypeEnum.ADMIN.getValue());
// query.setSalesmanId(salesmanId);
query.setDeptId(Objects.isNull(loginUser) || Objects.isNull(loginUser.getDeptId()) ? 0L : loginUser.getDeptId());
return success(orderQueryService.statisticsOrder(query));
return success(orderQueryService.statisticsMyOrder(query));
}
@GetMapping("/data/scope/statistics")
......@@ -746,19 +743,19 @@ public class OrderController {
@GetMapping("/my/statistics")
@ApiOperation("参数查询获得我的订单统计")
public CommonResult<StatisticsOrderVO> statisticsMyOrder(OrderQueryVO query) {
public CommonResult<StatisticsOrderVO> statisticsMyOrder(OrderQueryDTO query) {
Long salesmanId = SecurityFrameworkUtils.getLoginUserId(); // 获取当前登录用户ID
query.setUserType(UserTypeEnum.ADMIN.getValue());
// query.setSalesmanId(salesmanId);
query.setCreator(String.valueOf(salesmanId));
return success(orderQueryService.statisticsOrder(query));
return success(orderQueryService.statisticsMyOrder(query));
}
@GetMapping("/statistics")
@ApiOperation("参数查询订单管理统计")
public CommonResult<StatisticsOrderVO> statisticsOrder(OrderQueryVO query) {
return success(orderQueryService.statisticsOrder(query));
public CommonResult<StatisticsOrderVO> statisticsOrder(OrderQueryDTO query) {
return success(orderQueryService.statisticsMyOrder(query));
}
......
package cn.iocoder.yudao.module.product.dto;
import cn.iocoder.yudao.module.product.vo.productPrice.LineChannelVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
import java.util.List;
@ApiModel("复制价格入参DTO")
@Data
public class CopyProductPriceDto {
......@@ -14,4 +18,8 @@ public class CopyProductPriceDto {
@ApiModelProperty("商品id")
private String productId ;
@ApiModelProperty(value = "线路渠道列表", required = true)
@Size(min = 1)
private List<LineChannelVo> lineChannelList;
}
......@@ -3306,16 +3306,23 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
//列出要复制的商品价格
List<ProductPriceDO> productPriceDOList = this.productPriceMapper.selectList(new LambdaQueryWrapper<ProductPriceDO>().in(ProductPriceDO::getId, ids));
if(productPriceDOList.size()>0){
productPriceDOList.forEach(p->{
ProductPriceAirCreateReqVO createReqVO = new ProductPriceAirCreateReqVO() ;
BeanUtils.copyProperties(p,createReqVO);
createReqVO.setProductId(Long.parseLong(dto.getProductId()) );
List<LineChannelVo> lineChannelList = createReqVO.getLineChannelList();
ProductDO productDO = checkUpdateStatus(lineChannelList, createReqVO.getProductId());
LineChannelVo vo = new LineChannelVo();
vo.setShippingChannelId(p.getShippingChannelId());
vo.setLineId(p.getWarehouseLineId());
List<LineChannelVo> lineChannelList = new ArrayList<>();
lineChannelList.add(vo);
createReqVO.setLineChannelList(lineChannelList);
//ProductDO productDO = checkUpdateStatus(lineChannelList, createReqVO.getProductId());
ProductDO productDO = productService.getProduct(createReqVO.getProductId());
WarehouseLineSearchVO searchVO = new WarehouseLineSearchVO();
List<WarehouseLineDO> warehouseLineList = warehouseService.openedRouterList(searchVO);
List<ProductDO> productList = Collections.singletonList(productDO);
//商品线路保存在redis。更新成功后移除
batchSaveKeyInCache(productList, lineChannelList);
......@@ -3323,6 +3330,9 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
createReqVO.setSync(true);
createReqVO.setBatch(false);
batchUpdateAir(createReqVO, warehouseLineList, productList);
});
}
}
......
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