Commit b799883f authored by Smile's avatar Smile

需求 后台-集运-追加包裹

parent c1ea5ef3
...@@ -648,11 +648,15 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -648,11 +648,15 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
List<OrderBackPageVO> myOrderPageList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query); List<OrderBackPageVO> myOrderPageList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query);
List<OrderBackPageVO> myConsOrderPageList(@Param("start") int start, @Param("size") int size, @Param("query") OrderQueryVO query);
long orderCount(@Param("query") OrderQueryVO query); long orderCount(@Param("query") OrderQueryVO query);
long myOrderCount(@Param("query") OrderQueryVO query); long myOrderCount(@Param("query") OrderQueryVO query);
long myConsOrderCount(@Param("query") OrderQueryVO query);
List<OrderExcelVO> exportOrderExcelList(@Param("start")int start, @Param("size") int size,@Param("query") OrderQueryVO query); List<OrderExcelVO> exportOrderExcelList(@Param("start")int start, @Param("size") int size,@Param("query") OrderQueryVO query);
/** /**
......
...@@ -1156,11 +1156,11 @@ public class OrderQueryServiceImpl implements OrderQueryService { ...@@ -1156,11 +1156,11 @@ public class OrderQueryServiceImpl implements OrderQueryService {
query.setLang(I18nMessage.getLang()); query.setLang(I18nMessage.getLang());
} }
IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page); IPage<OrderBackPageVO> mpPage = MyBatisUtils.buildPage(page);
long total = orderMapper.myOrderCount(query); long total = orderMapper.myConsOrderCount(query);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
List<OrderBackPageVO> list = orderMapper.myOrderPageList(start, size, query); List<OrderBackPageVO> list = orderMapper.myConsOrderPageList(start, size, query);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
......
...@@ -1775,6 +1775,163 @@ ...@@ -1775,6 +1775,163 @@
limit #{start}, #{size} limit #{start}, #{size}
</select> </select>
<select id="myConsOrderPageList" resultType="cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO"
parameterType="cn.iocoder.yudao.module.order.vo.order.OrderQueryVO">
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.pick_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.release_num,
o.release_ratio,
o.is_cargo_control,
o.cargo_control_status,
o.cost ->> '$.totalNum' as total_num,
o.pick_state,
o.pick_ratio,
o.pick_num,
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_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,
o.unload_time,
o.customer_id,
(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.customer_id as consignor_customer_id,
if(nor.customer_id is not null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer
u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
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.customer_id as consignee_customer_id,
if(nee.customer_id is not null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer
u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
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,
c.name as customer_name,
c.customer_service,
su.nickname as customer_service_name,
#{query.lang} as lang
from ecw_order o
left join ecw_customer c on o.customer_id = c.id
left join system_user su on su.id = c.customer_service
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 and nor.deleted = 0
left join ecw_order_consignee nee on nee.order_id = o.order_id and nee.deleted = 0
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.transfer_source is not null and o.transfer_price_confirmation_status is not null
<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"/>
GROUP BY o.order_id
order by o.order_id desc
limit #{start}, #{size}
</select>
<select id="orderCount" resultType="java.lang.Long"> <select id="orderCount" resultType="java.lang.Long">
select count(1) select count(1)
from ecw_order o from ecw_order o
...@@ -1829,6 +1986,34 @@ ...@@ -1829,6 +1986,34 @@
<include refid="myOrderQuery"/> <include refid="myOrderQuery"/>
</select> </select>
<select id="myConsOrderCount" 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 and nor.deleted = 0
left join ecw_order_consignee nee on nee.order_id = o.order_id and nee.deleted = 0
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.transfer_source is not null and o.transfer_price_confirmation_status is not null
<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"> <sql id="myOrderQuery">
<include refid="dynamicQuery"/> <include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' "> <if test="query.packageType != null and query.packageType != '' ">
......
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