Commit 91f42d60 by zhanghj

V1.1.0--完善订单超时定时任务提醒

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@20455 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent d64ee16b
......@@ -24,7 +24,7 @@ public class QuartzConfig {
@Bean
public Trigger orderTimeoutRemindTaskDetailTrigger() {
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder
.cronSchedule("0 /5 * * * ?");
.cronSchedule("0 /2 * * * ?");
Trigger trigger = TriggerBuilder.newTrigger()
.forJob(orderTimeoutRemindTaskDetail())
.withIdentity("orderTimeoutRemindTask")
......
......@@ -56,50 +56,51 @@
2.roder_id 不是null,
a.若发送消息类型不是超时的
b.若发送消息类型是超时的,则比较是否是相同的技工,如果是相同的技工,比较重新指派时间和这个发送的时间大小 -->
select * from
(
SELECT
so.id, so.order_sn, so.car_owner, so.car_owner_phone, so.active_status, so.create_time,
so.canceled, so.mechanic_id, so.expect_install_time, so.reserve_install_time, so.reassign_mechanic_time,
sowm.order_id, sowm.msg_type, sowm.recevier, sowm.create_time as sendMsgTime,
su.public_openId
from sys_order so
LEFT JOIN sys_order_wechat_msg sowm on so.id = sowm.order_id
LEFT JOIN sys_user su on so.mechanic_id = su.id
SELECT
t1.*
FROM
(
SELECT
so.id,
so.order_sn,
so.car_owner,
so.car_owner_phone,
so.active_status,
so.create_time,
so.canceled,
so.mechanic_id,
so.expect_install_time,
so.reserve_install_time,
so.reassign_mechanic_time,
su.public_openId
FROM
sys_order so
LEFT JOIN sys_user su ON so.mechanic_id = su.id
WHERE
NOT EXISTS (
SELECT
sowm.order_id,
sowm.msg_type,
sowm.recevier,
sowm.create_time AS sendMsgTime
FROM
sys_order_wechat_msg sowm
WHERE
so.id = sowm.order_id
AND
sowm.msg_type = 6
)
AND so.active_status IN (6, 7)
AND so.canceled = 1
AND su.public_openId != ''
) t1
WHERE
su.public_openId != ''
and so.active_status in(6, 7)
and so.canceled = 1
) t1
WHERE
CASE
WHEN t1.order_id IS null
THEN
CASE
WHEN t1.active_status = 6 then t1.expect_install_time < now()
WHEN t1.active_status = 7 then t1.reserve_install_time < now()
END
WHEN t1.order_id is NOT NULL
THEN
CASE
WHEN t1.active_status = 6
THEN
CASE
WHEN t1.msg_type = 6
THEN
CASE
WHEN t1.mechanic_id != t1.recevier THEN t1.expect_install_time < now()
WHEN t1.mechanic_id = t1.recevier THEN t1.expect_install_time < now() AND t1.reassign_mechanic_time > t1.sendMsgTime
END
END
WHEN t1.active_status = 7
THEN
CASE
WHEN t1.msg_type = 6
THEN t1.reserve_install_time < now() and t1.mechanic_id != t1.recevier
END
END
END
CASE
WHEN t1.active_status = 6 THEN
t1.expect_install_time < now()
WHEN t1.active_status = 7 THEN
t1.reserve_install_time < now()
END
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!