no message
This commit is contained in:
parent
7c07a7951c
commit
435f63560f
|
|
@ -33,13 +33,13 @@ public enum WxMsgEnum {
|
||||||
WARN_ORDER("", "0RSuVHHP_okErJ1acQmIirBU7TrQYR0xPBgBHyt_azA"),
|
WARN_ORDER("", "0RSuVHHP_okErJ1acQmIirBU7TrQYR0xPBgBHyt_azA"),
|
||||||
|
|
||||||
/** 默认工单处理提醒 **/
|
/** 默认工单处理提醒 **/
|
||||||
DEFAULT_HANDLE_ORDER("", "dnjTqmqr7OsnOXJR_SikVOyDJbbVjdfiDXCHbs4xDfM"),
|
DEFAULT_HANDLE_ORDER("", "HZ1R0FU7Zn6C-bxG3X6yPmbyLf-ej02Dit9oKtfbSS4"),
|
||||||
/** 超时消息通知 */
|
/** 超时消息通知 */
|
||||||
// OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"),
|
// OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"),
|
||||||
/** 今日单消息通知 */
|
/** 今日单消息通知 */
|
||||||
// TODAY_ORDER("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
// TODAY_ORDER("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
||||||
/** 明日单通知 工单处理提醒*/
|
/** 明日单通知 工单处理提醒*/
|
||||||
TOMORROW_ORDER("", "HZ1R0FU7Zn6C-bxG3X6yPubwn-jGgQHhi16Q57R2S5g");
|
TOMORROW_ORDER("", "HZ1R0FU7Zn6C-bxG3X6yPmbyLf-ej02Dit9oKtfbSS4");
|
||||||
/** 不同意排单通知 */
|
/** 不同意排单通知 */
|
||||||
// NOT_AGREE_PLAIN("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
// NOT_AGREE_PLAIN("", "yqd3p4qsqn1RiyUb8kO4dPqoGKipRQg_y99nGw0jtLE"),
|
||||||
/** 不同意完单通知 */
|
/** 不同意完单通知 */
|
||||||
|
|
|
||||||
|
|
@ -263,9 +263,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimeRange(LocalTime now) {
|
public boolean isInTimeRange(LocalTime now,int hour,int minute) {
|
||||||
LocalTime start = LocalTime.of(12, 34, 59); // 17:29:59
|
LocalTime start = LocalTime.of(hour, minute-1, 59); // 17:29:59
|
||||||
LocalTime end = LocalTime.of(12, 35, 59); // 17:30:59
|
LocalTime end = LocalTime.of(hour, minute, 59); // 17:30:59
|
||||||
return !now.isBefore(start) && !now.isAfter(end);
|
return !now.isBefore(start) && !now.isAfter(end);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -329,7 +329,8 @@ public class OrderServiceImpl implements OrderService {
|
||||||
Date todayStart = DateUtils.truncate(order.getExpectTimeStart(), Calendar.DATE);
|
Date todayStart = DateUtils.truncate(order.getExpectTimeStart(), Calendar.DATE);
|
||||||
// 2. 增加 1 天
|
// 2. 增加 1 天
|
||||||
Date tomorrowStart = DateUtils.addDays(todayStart, 1);
|
Date tomorrowStart = DateUtils.addDays(todayStart, 1);
|
||||||
log.info("订单开始前一个小时 订单号:[{}]时间:{} 当前时间 {} 是否为同一时间{}", order.getId(),oneHourTime,now,now.equals(oneHourTime));
|
log.info("订单开始前一个小时 订单号:[{}]时间:{} 当前时间 {} 是否为同一时间小时{} 分钟{}", order.getId(),oneHourTime,now,oneHourTime.getHours(),oneHourTime.getMinutes());
|
||||||
|
LocalTime currentTime = LocalTime.now(); // 当前系统时间
|
||||||
if (overTime.before(now)) {
|
if (overTime.before(now)) {
|
||||||
log.info("订单[{}]待上门状态超时30分钟", order.getId());
|
log.info("订单[{}]待上门状态超时30分钟", order.getId());
|
||||||
OrderTimeoutRecord record = new OrderTimeoutRecord(order.getId(), order.getWorkerId(), order.getDeptId(), order.getOrderStatus());
|
OrderTimeoutRecord record = new OrderTimeoutRecord(order.getId(), order.getWorkerId(), order.getDeptId(), order.getOrderStatus());
|
||||||
|
|
@ -346,31 +347,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
// 消息组装。
|
// 消息组装。
|
||||||
Map<String, Object> paramsNew = new HashMap<>();
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
// 订单编号
|
// 订单编号
|
||||||
paramsNew.put("thing13", "您有1条订单超时未上门/未服务");
|
paramsNew.put("thing9", "您有1条订单超时未上门/未服务");
|
||||||
// 名称
|
// 名称
|
||||||
paramsNew.put("thing7", "进入【我的订单--待上门】处理");
|
paramsNew.put("thing10", "进入【我的订单--待上门】处理");
|
||||||
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
|
||||||
paramsNew.put("thing9", address.getName());
|
|
||||||
// 预约时间
|
|
||||||
paramsNew.put("time27", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
|
||||||
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.ONEHOUR_ORDER, paramsNew);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (now.after(oneHourTime)){
|
|
||||||
log.info("订单[{}]约一小时上门服务", order.getId());
|
|
||||||
try {
|
|
||||||
// 推送公众号通知数据。
|
|
||||||
Worker worker = workerService.selectById(order.getWorkerId());
|
|
||||||
OrderMaster orderMaster = orderMasterService.selectById(order.getOrderMasterId());
|
|
||||||
// 消息组装。
|
|
||||||
Map<String, Object> paramsNew = new HashMap<>();
|
|
||||||
// 订单编号
|
|
||||||
paramsNew.put("thing9", "您有1条订单约一小时上门或服务");
|
|
||||||
// 名称
|
|
||||||
paramsNew.put("thing10", "进入【我的订单--待上门】查看和准备");
|
|
||||||
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
||||||
paramsNew.put("thing2", address.getName());
|
paramsNew.put("thing2", address.getName());
|
||||||
// 预约时间
|
// 预约时间
|
||||||
|
|
@ -381,10 +360,31 @@ public class OrderServiceImpl implements OrderService {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isInTimeRange(currentTime,oneHourTime.getHours(),oneHourTime.getMinutes())){
|
||||||
|
log.info("订单[{}]约一小时上门服务", order.getId());
|
||||||
|
try {
|
||||||
|
// 推送公众号通知数据。
|
||||||
|
Worker worker = workerService.selectById(order.getWorkerId());
|
||||||
|
OrderMaster orderMaster = orderMasterService.selectById(order.getOrderMasterId());
|
||||||
|
// 消息组装。
|
||||||
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
|
// 订单编号
|
||||||
|
paramsNew.put("thing13", "您有1条订单约1小时后上门/服务");
|
||||||
|
// 名称
|
||||||
|
paramsNew.put("thing7", "进入【我的订单--待上门】查看和准备");
|
||||||
|
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
||||||
|
paramsNew.put("thing9", address.getName());
|
||||||
|
// 预约时间
|
||||||
|
paramsNew.put("time27", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||||
|
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.ONEHOUR_ORDER, paramsNew);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
//TODO: 需要定时
|
//TODO: 需要定时
|
||||||
LocalTime currentTime = LocalTime.now(); // 当前系统时间
|
log.info("明日订单时间{} 是否小于明日时间{} 是否为17:50{}",tomorrowStart,now.before(tomorrowStart),isInTimeRange(currentTime,14,45));
|
||||||
log.info("明日订单时间{} 是否小于明日时间{} 是否为17:50{}",tomorrowStart,now.before(tomorrowStart),isInTimeRange(currentTime));
|
if(now.before(tomorrowStart)&&isInTimeRange(currentTime,14,55)){
|
||||||
if(now.before(tomorrowStart)&&isInTimeRange(currentTime)){
|
|
||||||
log.info("订单[{}]明日订单通知", order.getId());
|
log.info("订单[{}]明日订单通知", order.getId());
|
||||||
try {
|
try {
|
||||||
// 推送公众号通知数据。
|
// 推送公众号通知数据。
|
||||||
|
|
@ -400,7 +400,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
paramsNew.put("character_string23", "进入见详情");
|
paramsNew.put("character_string23", "进入见详情");
|
||||||
// 预约时间
|
// 预约时间
|
||||||
paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||||
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.DEFAULT_HANDLE_ORDER, paramsNew);
|
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.TOMORROW_ORDER, paramsNew);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue