no message

This commit is contained in:
cb 2025-10-30 09:35:05 +08:00
parent 77008d11da
commit aa7b8c7a5d
6 changed files with 125 additions and 1 deletions

View File

@ -94,6 +94,10 @@ public class AfterServiceRecord extends BaseEntity
@Excel(name = "客户是否同意上门重做方案0-未处理1-同意2-不同意") @Excel(name = "客户是否同意上门重做方案0-未处理1-同意2-不同意")
private Integer customerAgreeRedo; private Integer customerAgreeRedo;
/** 客户操作时间 */
@Excel(name = "客户操作时间")
private Date customerOperationTime;
/** 重做/补做完成时间 */ /** 重做/补做完成时间 */
@Excel(name = "重做/补做完成时间") @Excel(name = "重做/补做完成时间")
private Date redoCompleteTime; private Date redoCompleteTime;

View File

@ -91,6 +91,14 @@ public interface AfterServiceRecordMapper {
*/ */
List<AfterServiceRecord> selectWorkerResendTimeoutRecords(); List<AfterServiceRecord> selectWorkerResendTimeoutRecords();
/**
* 查询退货发货超时的售后记录
* 查询退货发货时间超过6天且师傅未确认收货的售后记录
*
* @return 超时的售后记录列表
*/
List<AfterServiceRecord> selectReturnShipTimeoutRecords();
/** /**
* 批量更新售后状态当客户最终确认为1时将售后状态设置为1 * 批量更新售后状态当客户最终确认为1时将售后状态设置为1
* *

View File

@ -1,5 +1,6 @@
package com.ghy.order.quartz; package com.ghy.order.quartz;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.utils.DateUtils; import com.ghy.common.utils.DateUtils;
import com.ghy.order.domain.AfterServiceRecord; import com.ghy.order.domain.AfterServiceRecord;
import com.ghy.order.service.IAfterServiceRecordService; import com.ghy.order.service.IAfterServiceRecordService;
@ -189,4 +190,71 @@ public class AfterServiceTimeoutTask {
log.info("师傅重发补发超时处理完成,共处理{}条记录", timeoutRecords.size()); log.info("师傅重发补发超时处理完成,共处理{}条记录", timeoutRecords.size());
} }
/**
* 定时任务自动处理超时的师傅确认收货
* 每天凌晨2点执行查询退货发货时间超过6天且师傅未确认收货的售后记录
* 自动调用师傅确认收货方法进行退款处理
*/
@Scheduled(cron = "0 0 2 * * ?")
public void autoConfirmReceiveTask() {
try {
log.info("开始执行自动确认收货定时任务");
// 查询退货发货时间超过6天且师傅未确认收货的售后记录
List<AfterServiceRecord> timeoutRecords = afterServiceRecordService.selectReturnShipTimeoutRecords();
if (timeoutRecords == null || timeoutRecords.isEmpty()) {
log.info("没有找到需要自动确认收货的超时记录");
return;
}
log.info("找到{}条需要自动确认收货的超时记录", timeoutRecords.size());
int successCount = 0;
int failCount = 0;
// 循环处理每条超时记录
for (AfterServiceRecord record : timeoutRecords) {
try {
log.info("开始自动确认收货售后记录ID{},退货发货时间:{}",
record.getId(), record.getReturnShipTime());
// 创建参数对象
AfterServiceRecord param = new AfterServiceRecord();
param.setId(record.getId());
// 调用师傅确认收货方法
AjaxResult result = afterServiceRecordService.workerConfirmReceive(param);
// if (result.isSuccess()) {
// successCount++;
// // 标记为自动处理
// record.setIsAutoProcessed(1);
// record.setAutoProcessTime(new Date());
// record.setUpdateTime(new Date());
// afterServiceRecordService.updateAfterServiceRecord(record);
// log.info("自动确认收货成功售后记录ID{}", record.getId());
// } else {
// failCount++;
// log.error("自动确认收货失败售后记录ID{},错误信息:{}",
// record.getId(), result.getMsg());
// }
} catch (Exception e) {
failCount++;
log.error("自动确认收货异常售后记录ID{},错误:{}",
record.getId(), e.getMessage(), e);
}
}
log.info("自动确认收货定时任务执行完成,总记录数:{},成功:{},失败:{}",
timeoutRecords.size(), successCount, failCount);
} catch (Exception e) {
log.error("自动确认收货定时任务执行异常:{}", e.getMessage(), e);
}
}
} }

View File

@ -129,6 +129,14 @@ public interface IAfterServiceRecordService {
*/ */
List<AfterServiceRecord> selectWorkerResendTimeoutRecords(); List<AfterServiceRecord> selectWorkerResendTimeoutRecords();
/**
* 查询退货发货时间超过6天且师傅未确认收货的售后记录
* 用于定时任务自动处理师傅确认收货超时的情况
*
* @return 超时的售后记录列表
*/
List<AfterServiceRecord> selectReturnShipTimeoutRecords();
/** /**
* 师傅确认收货 * 师傅确认收货
* 师傅确认收到货物后根据同意处理方式决定是否执行退款 * 师傅确认收到货物后根据同意处理方式决定是否执行退款

View File

@ -36,6 +36,7 @@ import com.ghy.worker.service.WorkerService;
import com.huifu.adapay.core.exception.BaseAdaPayException; import com.huifu.adapay.core.exception.BaseAdaPayException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -585,6 +586,8 @@ public class AfterServiceRecordServiceImpl implements IAfterServiceRecordService
if (param.getUpdateBy() != null) { if (param.getUpdateBy() != null) {
afterServiceRecord.setUpdateBy(param.getUpdateBy()); afterServiceRecord.setUpdateBy(param.getUpdateBy());
} }
// 设置客户操作时间
afterServiceRecord.setCustomerOperationTime(new Date());
afterServiceRecordMapper.updateAfterServiceRecord(afterServiceRecord); afterServiceRecordMapper.updateAfterServiceRecord(afterServiceRecord);
log.info("商品售后-客户同意上门重做方案状态已更新:{}", param.getCustomerAgreeRedo()); log.info("商品售后-客户同意上门重做方案状态已更新:{}", param.getCustomerAgreeRedo());
return AjaxResult.success("客户同意方案状态已更新"); return AjaxResult.success("客户同意方案状态已更新");
@ -749,6 +752,7 @@ public class AfterServiceRecordServiceImpl implements IAfterServiceRecordService
} }
log.info("商品售后-客户同意处理方案"); log.info("商品售后-客户同意处理方案");
// 商品售后特殊处理客户同意且师傅选择即时退单退款时立即执行退款 // 商品售后特殊处理客户同意且师傅选择即时退单退款时立即执行退款
if (afterServiceRecord.getWorkerAgreeType() != null && afterServiceRecord.getWorkerAgreeType() == 1) { if (afterServiceRecord.getWorkerAgreeType() != null && afterServiceRecord.getWorkerAgreeType() == 1) {
log.info("商品售后-客户同意且师傅选择即时退单退款立即执行退款记录ID{}", param.getId()); log.info("商品售后-客户同意且师傅选择即时退单退款立即执行退款记录ID{}", param.getId());
@ -1258,6 +1262,8 @@ public class AfterServiceRecordServiceImpl implements IAfterServiceRecordService
} }
afterServiceRecord.setUpdateBy(param.getUpdateBy()); afterServiceRecord.setUpdateBy(param.getUpdateBy());
// 设置客户操作时间
afterServiceRecord.setCustomerOperationTime(new Date());
// 更新数据库 // 更新数据库
int result = afterServiceRecordMapper.updateAfterServiceRecord(afterServiceRecord); int result = afterServiceRecordMapper.updateAfterServiceRecord(afterServiceRecord);
@ -1590,4 +1596,17 @@ public class AfterServiceRecordServiceImpl implements IAfterServiceRecordService
} }
} }
/**
* 查询退货发货超时的售后记录
* 退货发货时间超过6天师傅未确认收货的记录
* @return 超时的售后记录列表
*/
@Override
public List<AfterServiceRecord> selectReturnShipTimeoutRecords() {
log.debug("查询退货发货超时的售后记录");
return afterServiceRecordMapper.selectReturnShipTimeoutRecords();
}
} }

View File

@ -26,6 +26,7 @@
<result property="originalRefund" column="original_refund" /> <result property="originalRefund" column="original_refund" />
<result property="refundApplyTime" column="refund_apply_time" /> <result property="refundApplyTime" column="refund_apply_time" />
<result property="customerAgreeRedo" column="customer_agree_redo" /> <result property="customerAgreeRedo" column="customer_agree_redo" />
<result property="customerOperationTime" column="customer_operation_time" />
<result property="redoCompleteTime" column="redo_complete_time" /> <result property="redoCompleteTime" column="redo_complete_time" />
<result property="redoCompleteRemark" column="redo_complete_remark" /> <result property="redoCompleteRemark" column="redo_complete_remark" />
<result property="redoCompleteImages" column="redo_complete_images" /> <result property="redoCompleteImages" column="redo_complete_images" />
@ -60,7 +61,7 @@
<sql id="selectAfterServiceRecordVo"> <sql id="selectAfterServiceRecordVo">
select id, customer_reason_type, customer_reason, order_detail_id, oper_type, worker_feedback_result, select id, customer_reason_type, customer_reason, order_detail_id, oper_type, worker_feedback_result,
worker_feedback_reason_type, worker_feedback_reason, worker_feedback_images, refund, agreed_refund, platform_refund, original_refund, worker_feedback_reason_type, worker_feedback_reason, worker_feedback_images, refund, agreed_refund, platform_refund, original_refund,
customer_final_check, create_by, create_time, update_by, update_time, remark, refund_apply_time, customer_agree_redo, customer_final_check, create_by, create_time, update_by, update_time, remark, refund_apply_time, customer_agree_redo, customer_operation_time,
redo_complete_time, redo_complete_remark, redo_complete_images, is_auto_processed, after_service_category, after_service_type, return_status, redo_complete_time, redo_complete_remark, redo_complete_images, is_auto_processed, after_service_category, after_service_type, return_status,
return_address, return_contact, return_phone, return_type, return_remark, return_images, return_tracking_number, return_ship_time, merchant_receive_time, worker_resend_plan, worker_resend_time, worker_resend_type, worker_resend_tracking_number, worker_receive_status, worker_agree_type, worker_receive_confirm, worker_resend_remark, worker_resend_images, return_address, return_contact, return_phone, return_type, return_remark, return_images, return_tracking_number, return_ship_time, merchant_receive_time, worker_resend_plan, worker_resend_time, worker_resend_type, worker_resend_tracking_number, worker_receive_status, worker_agree_type, worker_receive_confirm, worker_resend_remark, worker_resend_images,
customer_disagree_images, customer_disagree_reason, after_service_status, platform_handle_reason customer_disagree_images, customer_disagree_reason, after_service_status, platform_handle_reason
@ -113,6 +114,7 @@
<if test="platformRefund != null">platform_refund,</if> <if test="platformRefund != null">platform_refund,</if>
<if test="customerFinalCheck != null">customer_final_check,</if> <if test="customerFinalCheck != null">customer_final_check,</if>
<if test="customerAgreeRedo != null">customer_agree_redo,</if> <if test="customerAgreeRedo != null">customer_agree_redo,</if>
<if test="customerOperationTime != null">customer_operation_time,</if>
<if test="redoCompleteTime != null">redo_complete_time,</if> <if test="redoCompleteTime != null">redo_complete_time,</if>
<if test="redoCompleteRemark != null">redo_complete_remark,</if> <if test="redoCompleteRemark != null">redo_complete_remark,</if>
<if test="redoCompleteImages != null">redo_complete_images,</if> <if test="redoCompleteImages != null">redo_complete_images,</if>
@ -161,6 +163,7 @@
<if test="platformRefund != null">#{platformRefund},</if> <if test="platformRefund != null">#{platformRefund},</if>
<if test="customerFinalCheck != null">#{customerFinalCheck},</if> <if test="customerFinalCheck != null">#{customerFinalCheck},</if>
<if test="customerAgreeRedo != null">#{customerAgreeRedo},</if> <if test="customerAgreeRedo != null">#{customerAgreeRedo},</if>
<if test="customerOperationTime != null">#{customerOperationTime},</if>
<if test="redoCompleteTime != null">#{redoCompleteTime},</if> <if test="redoCompleteTime != null">#{redoCompleteTime},</if>
<if test="redoCompleteRemark != null">#{redoCompleteRemark},</if> <if test="redoCompleteRemark != null">#{redoCompleteRemark},</if>
<if test="redoCompleteImages != null">#{redoCompleteImages},</if> <if test="redoCompleteImages != null">#{redoCompleteImages},</if>
@ -215,6 +218,7 @@
<if test="platformRefund != null">platform_refund = #{platformRefund},</if> <if test="platformRefund != null">platform_refund = #{platformRefund},</if>
<if test="customerFinalCheck != null">customer_final_check = #{customerFinalCheck},</if> <if test="customerFinalCheck != null">customer_final_check = #{customerFinalCheck},</if>
<if test="customerAgreeRedo != null">customer_agree_redo = #{customerAgreeRedo},</if> <if test="customerAgreeRedo != null">customer_agree_redo = #{customerAgreeRedo},</if>
<if test="customerOperationTime != null">customer_operation_time = #{customerOperationTime},</if>
<if test="redoCompleteTime != null">redo_complete_time = #{redoCompleteTime},</if> <if test="redoCompleteTime != null">redo_complete_time = #{redoCompleteTime},</if>
<if test="redoCompleteRemark != null">redo_complete_remark = #{redoCompleteRemark},</if> <if test="redoCompleteRemark != null">redo_complete_remark = #{redoCompleteRemark},</if>
<if test="redoCompleteImages != null">redo_complete_images = #{redoCompleteImages},</if> <if test="redoCompleteImages != null">redo_complete_images = #{redoCompleteImages},</if>
@ -304,4 +308,17 @@
) )
</select> </select>
<!-- 查询退货发货超时的售后记录 -->
<!-- 倒计时客户操作后师傅6天未确认收货 -->
<select id="selectReturnShipTimeoutRecords" resultMap="AfterServiceRecordResult">
<include refid="selectAfterServiceRecordVo"/>
WHERE customer_operation_time IS NOT NULL
AND customer_operation_time &lt;= DATE_SUB(NOW(), INTERVAL 6 DAY)
AND (worker_receive_confirm IS NULL OR worker_receive_confirm = 0)
AND after_service_status = 0
AND after_service_category = 2
AND customer_final_check IS NULL
AND (is_auto_processed IS NULL OR is_auto_processed = 0)
</select>
</mapper> </mapper>