@ -668,7 +668,7 @@
`lawo`.`vehicle_route` AS vehicleRoute,
`lacr`.`indemnitor` AS `indemnitor`,
`lacr`.`reason` AS `reason`,
`lacr`.`money` AS `money`,
IFNUll(sum( `lacr`.`money`),0 ) AS `money`,
`lawo`.`id` AS `lawoId`,
`lawo`.`create_time` AS createTime,
`lawo`.`process_number` AS processNumber,
@ -821,6 +821,172 @@
group by lawo.id
ORDER BY lawo.create_time DESC
</select>
<select id= "exportAllListOwn" resultType= "com.logpm.aftersales.excel.AftersalesWorkOrderExcel" >
SELECT DISTINCT
CASE
lawo.work_order_type
WHEN 1 THEN
'货损'
WHEN 2 THEN
'少货'
WHEN 3 THEN
'窜货'
WHEN 4 THEN
'加急'
WHEN 5 THEN
'其他' ELSE '未知类型'
END workOrderTypeName,
CASE
lawo.discovery_node
WHEN 1 THEN
'提货环节'
WHEN 2 THEN
'发货环节'
WHEN 3 THEN
'干线卸车环节'
WHEN 4 THEN
'库内作业环节'
WHEN 5 THEN
'配送装车环节'
WHEN 6 THEN
'配送签收环节'
WHEN 7 THEN
'安装环节'
WHEN 7 THEN
'其他' ELSE '未知节点'
END discoveryNodeName,
lawo.work_order_number,
t.waybill_number AS waybillNumber,
t.order_code AS orderCode,
t.package_code AS packageCode,
t.brand_name AS brandName,
lawo.waybill_mall,
t.`first` AS `first`,
CASE
lawo.work_order_status
WHEN '10' THEN '待处理'
WHEN '20' THEN '处理中'
WHEN '30' THEN '已处理'
WHEN '40' THEN '待审核'
WHEN '50' THEN '已审核'
WHEN '60' THEN '超时未处理'
WHEN '70' THEN '客服介入中'
WHEN '80' THEN '仲裁中'
WHEN '90' THEN '理赔金额未出'
WHEN '21' THEN '处理结果已提交'
WHEN '100' THEN '申述中'
WHEN '110' THEN '已结束' ELSE '未知状态'
END workOrderStatusName,
lawo.processed_by,
GROUP_CONCAT(DISTINCT laprr.business_name),
lawo.create_time,
(lawo.create_time + INTERVAL 2 DAY),
lawo.update_time,
GROUP_CONCAT(DISTINCT lapr.result_type) AS resultTypes,
IFNULL( sum( lapr.money ), 0 ) AS totalAmountNum,
lawo.ceator,
IF(lawo.work_order_status = '80',lawo.update_time,'') AS '完结时间',
IF(lawo.work_order_status = '100','是','否') AS '是否申述',
lawo.process_number,
IF(lawo.work_order_status = '100',(SELECT CASE types_of
WHEN 0 THEN '待处理'
WHEN 1 THEN '成立'
WHEN 2 THEN '驳回'
WHEN 3 THEN '取消'
ELSE
'未知审核状态'
END aaa
FROM logpm_aftersales_appeal WHERE word_order_id = lawo.id AND is_deleted = 0 AND types_of != 3 ORDER BY create_time DESC LIMIT 1),'未申述') AS '申述状态'
FROM
logpm_aftersales_work_order lawo
LEFT JOIN logpm_aftersales_processor lap ON lawo.id = lap.work_order_id
AND lap.types_of = '2'
AND lap.conditions IN ( 1, 2 )
LEFT JOIN logpm_aftersales_completion_record lacr ON lacr.work_order_id = lawo.id
AND lacr.is_deleted = '0'
LEFT JOIN (SELECT
a.id,
group_concat( DISTINCT b.`first` SEPARATOR ',' ) AS `first`,
group_concat( DISTINCT b.secondary SEPARATOR ',' ) AS secondary,
group_concat( DISTINCT b.brand_name SEPARATOR ',' ) AS brand_name,
group_concat( DISTINCT b.package_code SEPARATOR ',' ) AS package_code,
group_concat( DISTINCT b.order_code SEPARATOR ',' ) AS order_code,
group_concat( DISTINCT b.waybill_number SEPARATOR ',' ) AS waybill_number
FROM
logpm_aftersales_work_order AS a
LEFT JOIN logpm_aftersales_abnormal_package AS b ON a.id = b.work_order_id
WHERE
a.is_deleted = 0
AND b.is_deleted = 0
GROUP BY
a.id) AS t ON t.id = lawo.id
LEFT JOIN logpm_aftersales_processing_results AS lapr ON lapr.work_order_id = lawo.id AND lapr.is_deleted = 0
LEFT JOIN logpm_aftersales_person_responsible AS laprr ON laprr.word_order_id = lawo.id
<where >
lawo.is_deleted = 0
<if test= "param.workOrderStatusNameS != null and param.workOrderStatusNameS != '' " > and lawo.work_order_status = #{param.workOrderStatusNameS } </if>
<if test= "param.id != null and param.id != '' " > and lawo.id = #{param.id } </if>
<if test= "param.workOrderType != null and param.workOrderType != '' " > and lawo.work_order_type = #{param.workOrderType } </if>
<if test= "param.initiationIdentification != null and param.initiationIdentification != '' " > and lawo.initiation_identification = #{param.initiationIdentification } </if>
<if test= "param.discoveryNode != null and param.discoveryNode != '' " > and lawo.discovery_node = #{param.discoveryNode } </if>
<if test= "param.workOrderNumber != null and param.workOrderNumber != '' " > and lawo.work_order_number like concat('%',#{param.workOrderNumber },'%') </if>
<if test= "param.waybillNumber != null and param.waybillNumber != '' " > and lawo.waybill_number like concat('%', #{param.waybillNumber },'%') </if>
<if test= "param.orderCode != null and param.orderCode != '' " > and lawo.order_code like concat('%', #{param.orderCode },'%') </if>
<if test= "param.trainNumber != null and param.trainNumber != '' " > and lawo.train_number like concat('%', #{param.trainNumber },'%') </if>
<if test= "param.vehicleRoute != null and param.vehicleRoute != '' " > and lawo.vehicle_route like concat('%', #{param.vehicleRoute },'%') </if>
<if test= "param.deliverGoodsTime != null " > and date_format(from_unixtime( lawo.deliver_goods_time),'%Y-%m-%d') = date_format(#{param.deliverGoodsTime },'%Y-%m-%d') </if>
<if test= "param.discoveryTime != null " > and date_format(from_unixtime(lawo.discovery_time),'%Y-%m-%d') = date_format( #{param.discoveryTime},'%Y-%m-%d') </if>
<if test= "param.warehousingTime != null " > and date_format(from_unixtime(lawo.warehousing_time),'%Y-%m-%d') = date_format( #{param.warehousingTime},'%Y-%m-%d') </if>
<if test= "param.deliveryTime != null " > and date_format(from_unixtime( lawo.delivery_time),'%Y-%m-%d') = date_format(#{param.deliveryTime} param.deliveryTime,'%Y-%m-%d') </if>
<if test= "param.auditTime != null " > and date_format(from_unixtime(lawo.audit_time),'%Y-%m-%d') = date_format(#{param.auditTime},'%Y-%m-%d') </if>
<if test= "param.entryTime != null " > and date_format(from_unixtime(lawo.entry_time),'%Y-%m-%d') = date_format(#{param.entryTime},'%Y-%m-%d') </if>
<if test= "param.overTime != null " > and date_format(from_unixtime(lawo.over_time),'%Y-%m-%d') = date_format(#{param.overTime}),'%Y-%m-%d') </if>
<if test= "param.waybillMall != null and param.waybillMall != '' " > and lawo.waybill_mall like concat('%', #{param.waybillMall },'%') </if>
<if test= "param.deliveryDriver != null and param.deliveryDriver != '' " > and lawo.delivery_driver = #{param.deliveryDriver } </if>
<if test= "param.customerServiceState != null and param.customerServiceState == 30 " > and lawo.work_order_status in ('40') </if>
<if test= "param.customerServiceState != null and param.customerServiceState == 40 " > and lawo.work_order_status in ('20') </if>
<if test= "param.customerServiceState != null and param.customerServiceState == 31 " > and lawo.work_order_status in ('30') </if>
<if test= "param.customerServiceState != null and param.customerServiceState == 60 " > and lawo.work_order_status in ('30') </if>
<if test= "param.customerServiceState != null and param.customerServiceState == 10 " > and lawo.work_order_status in ('70','80','100') </if>
<if test= "param.customerServiceId != null and param.customerServiceId != '' " > and lawo.customer_service_id = #{param.customerServiceId } </if>
<if test= "param.customerServiceName != null and param.customerServiceName != '' " > and lawo.customer_service_name like concat('%', #{param.customerServiceName },'%') </if>
<if test= "param.waybillMallId != null and param.waybillMallId != '' " > and lawo.waybill_mall_id = #{param.waybillMallId } </if>
<if test= "param.problemDescription != null and param.problemDescription != '' " > and lawo.problem_description = #{param.problemDescription} </if>
<if test= "param.warehouseId != null and param.warehouseId != '' and param.handleStatus != null " > and (lap.warehouse_id = #{param.warehouseId} OR lap.business_id = #{param.warehouseId}) </if>
<if test= "param.personResponsible != null and param.personResponsible != '' " > and lawo.person_responsible = #{param.personResponsible } </if>
<if test= "param.processNumber != null and param.processNumber != '' " > and lawo.process_number = #{param.processNumber } </if>
<if test= "param.reviewedBy != null and param.reviewedBy != '' " > and lawo.reviewed_by = #{param.reviewedBy } </if>
<if test= "param.operator != null and param.operator != '' " > and lawo.operator = #{param.operator } </if>
<if test= "param.responsiblePerson != null and param.responsiblePerson != '' " > and lawo.responsible_person = #{param.responsiblePerson } </if>
<if test= "param.processedBy != null and param.processedBy != '' " > and lawo.processed_by = #{param.processedBy} </if>
<if test= "param.investigationProcess != null and param.investigationProcess != '' " > and lawo.investigation_process = #{param.investigationProcess } </if>
<if test= "param.relatedWorkOrdersId != null and param.relatedWorkOrdersId != '' " > and lawo.related_work_orders_id = #{param.relatedWorkOrdersId } </if>
<if test= "param.workOrderStatus != null and param.workOrderStatus != ''" > and lawo.work_order_status in( #{param.workOrderStatus }) </if>
<if test= "param.customerIdentification != null and param.customerIdentification == 1 " >
and lawo.work_order_status IN ( '10', '20', '21', '30', '40', '50', '60', '70', '80', '90' ,'100','110')
</if>
<if test= "param.handleStatus != null and param.handleStatus == 40 " > and lawo.work_order_status in ('10') and lap.types_of = '2' and lap.processing_status in ('1') </if>
<if test= "param.handleStatus != null and param.handleStatus == 50 " > and lawo.work_order_status in ('20') and lap.types_of = '2' </if>
<if test= "param.handleStatus!= null and param.handleStatus == 30" > and lawo.work_order_status in (21,30) and lap.processing_status = '4' </if>
<if test= "param.handleStatus!= null and param.handleStatus == 10 " > and lap.types_of = '2' </if>
<if test= "param.handleStatus!= null and param.handleStatus == 20 " > and ((lawo.work_order_status in (80,100,70) OR lacr.warehouse_id=#{param.warehouseId})) </if>
<if test= "param.workOrderType != null and param.workOrderType != '' " > and lawo.work_order_type = #{param.workOrderType } </if>
<if test= "param.discoveryNode != null and param.discoveryNode != '' " > and lawo.discovery_node = #{param.discoveryNode } </if>
<if test= "param.workOrderNumber != null and param.workOrderNumber != '' " > and lawo.work_order_number like concat('%',#{param.workOrderNumber },'%') </if>
<if test= "param.trainNumber != null and param.trainNumber != '' " > and lawo.train_number like concat('%', #{param.trainNumber },'%') </if>
<if test= "param.vehicleRoute != null and param.vehicleRoute != '' " > and lawo.vehicle_route like concat('%', #{param.vehicleRoute },'%') </if>
<if test= "param.workOrderStatus != null and param.workOrderStatus != '' and param.handleStatus != 40 " > and lawo.work_order_status in ( #{param.workOrderStatus }) </if>
<if test= "param.customerServiceState!= null and param.customerServiceState == 80 " > and lawo.work_order_status in ('10') </if>
<if test= "param.first != null and param.first != '' " > and t.first like concat('%',#{param.first},'%') </if>
<if test= "param.secondary != null and param.secondary != '' " > and t.secondary like concat('%',#{param.secondary},'%') </if>
<if test= "param.brandName != null and param.brandName != '' " > and t.brand_name like concat('%',#{param.brandName},'%') </if>
<if test= "param.waybillNumber != null and param.waybillNumber != ''" > and t.waybill_number like concat('%',#{param.waybillNumber},'%') </if>
<if test= "param.packageCode != null and param.packageCode != ''" > and t.package_code like concat('%',#{param.packageCode},'%') </if>
</where>
group by lawo.id
ORDER BY lawo.create_time DESC
</select>
<update id= "updateFinanceTime" >