no message
This commit is contained in:
parent
435f63560f
commit
0ca42dc14b
|
|
@ -11,4 +11,5 @@ public interface OrderService {
|
||||||
// 自动修改提现状态
|
// 自动修改提现状态
|
||||||
void autoChangeDrawCashStatus();
|
void autoChangeDrawCashStatus();
|
||||||
|
|
||||||
|
void timeOutOrder();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
// 消息组装。
|
// 消息组装。
|
||||||
Map<String, Object> paramsNew = new HashMap<>();
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
// 订单编号
|
// 订单编号
|
||||||
paramsNew.put("thing13", "您有1条订单约1小时后上门/服务");
|
paramsNew.put("thing13", "您有订单约1小时后上门/服务");
|
||||||
// 名称
|
// 名称
|
||||||
paramsNew.put("thing7", "进入【我的订单--待上门】查看和准备");
|
paramsNew.put("thing7", "进入【我的订单--待上门】查看和准备");
|
||||||
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
||||||
|
|
@ -384,7 +384,8 @@ public class OrderServiceImpl implements OrderService {
|
||||||
}
|
}
|
||||||
//TODO: 需要定时
|
//TODO: 需要定时
|
||||||
log.info("明日订单时间{} 是否小于明日时间{} 是否为17:50{}",tomorrowStart,now.before(tomorrowStart),isInTimeRange(currentTime,14,45));
|
log.info("明日订单时间{} 是否小于明日时间{} 是否为17:50{}",tomorrowStart,now.before(tomorrowStart),isInTimeRange(currentTime,14,45));
|
||||||
if(now.before(tomorrowStart)&&isInTimeRange(currentTime,14,55)){
|
if(isInTimeRange(currentTime,14,55)){
|
||||||
|
if(now.before(tomorrowStart)){
|
||||||
log.info("订单[{}]明日订单通知", order.getId());
|
log.info("订单[{}]明日订单通知", order.getId());
|
||||||
try {
|
try {
|
||||||
// 推送公众号通知数据。
|
// 推送公众号通知数据。
|
||||||
|
|
@ -406,6 +407,51 @@ public class OrderServiceImpl implements OrderService {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//是否有搁置单
|
||||||
|
if (ONE.equals(order.getShelveStatus())){
|
||||||
|
try {
|
||||||
|
// 推送公众号通知数据。
|
||||||
|
Worker worker = workerService.selectById(order.getWorkerId());
|
||||||
|
OrderMaster orderMaster = orderMasterService.selectById(order.getOrderMasterId());
|
||||||
|
// 消息组装。
|
||||||
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
|
// 订单编号
|
||||||
|
paramsNew.put("thing13", "您有《无法排单》需再次联系客户");
|
||||||
|
// 名称
|
||||||
|
paramsNew.put("thing7", "请进入【我的订单--搁置单】操作处理");
|
||||||
|
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
||||||
|
paramsNew.put("character_string23", "进入见详情");
|
||||||
|
// 预约时间
|
||||||
|
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);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//售后单
|
||||||
|
if(CollectionUtil.isNotEmpty(afterServiceRecord)){
|
||||||
|
try {
|
||||||
|
// 推送公众号通知数据。
|
||||||
|
Worker worker = workerService.selectById(order.getWorkerId());
|
||||||
|
OrderMaster orderMaster = orderMasterService.selectById(order.getOrderMasterId());
|
||||||
|
// 消息组装。
|
||||||
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
|
// 订单编号
|
||||||
|
paramsNew.put("thing13", "售后巡查,您或您下级售后单未完成");
|
||||||
|
// 名称
|
||||||
|
paramsNew.put("thing7", "请进入【我的订单--售后中】查看处理");
|
||||||
|
CustomerAddress address = customerAddressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
||||||
|
paramsNew.put("character_string23", "进入见详情");
|
||||||
|
// 预约时间
|
||||||
|
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);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 未超时的单
|
// 未超时的单
|
||||||
else if (order.getOrderStatus().equals(OrderStatus.SERVER.code())) {
|
else if (order.getOrderStatus().equals(OrderStatus.SERVER.code())) {
|
||||||
|
|
@ -713,4 +759,121 @@ public class OrderServiceImpl implements OrderService {
|
||||||
public void autoChangeDrawCashStatus() {
|
public void autoChangeDrawCashStatus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void timeOutOrder() {
|
||||||
|
List<OrderMaster> orderMasters = orderMasterService.selectByStatus(orderMasterTimeoutStatus);
|
||||||
|
log.info("超时巡查扫描到{}条未完成的主订单", orderMasters.size());
|
||||||
|
for (OrderMaster orderMaster : orderMasters) {
|
||||||
|
try {
|
||||||
|
timeOutOrder(orderMaster);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("主单超时定时任务执行:单号:{},错误原因:{}", orderMaster.getCode(), e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 查询符合超时的子单
|
||||||
|
List<OrderDetail> orders = orderDetailService.selectByStatus(timeoutOrderStatus);
|
||||||
|
log.info("超时巡查扫描到{}条未完成的子订单", orders.size());
|
||||||
|
for (OrderDetail order : orders) {
|
||||||
|
try {
|
||||||
|
timeOutOrder(order);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("子单超时定时任务执行:单号:{},错误原因:{}", order.getCode(), e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void timeOutOrder(OrderMaster order) {
|
||||||
|
log.info("超时巡查超时开始:单号:{}, 内容:{}", order.getCode(), order);
|
||||||
|
Date now = new Date();
|
||||||
|
// 待接单状态的超时逻辑
|
||||||
|
if (ZERO.equals(order.getOrderStatus())) {
|
||||||
|
log.info("超时巡查单号:{},状态:{},创建时间:{},更新时间:{}", order.getCode(), order.getOrderStatus(), order.getCreateTime(), order.getUpdateTime());
|
||||||
|
// 是否已经超时
|
||||||
|
boolean timeout = ONE.equals(order.getTimeout());
|
||||||
|
if (timeout){
|
||||||
|
try {
|
||||||
|
// 推送公众号通知数据。
|
||||||
|
// 消息组装。
|
||||||
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
|
// 订单编号
|
||||||
|
paramsNew.put("thing13", "超时巡查,您或您下级订单超时中");
|
||||||
|
// 名称
|
||||||
|
paramsNew.put("thing7", "超时巡查,您或您下级订单超时中");
|
||||||
|
|
||||||
|
paramsNew.put("character_string23", "进入见详情");
|
||||||
|
// 预约时间
|
||||||
|
paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||||
|
Worker worker = workerService.selectById(order.getWorkerId());
|
||||||
|
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.DEFAULT_HANDLE_ORDER, paramsNew);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未派单状态的超时逻辑
|
||||||
|
if (ONE.equals(order.getOrderStatus())) {
|
||||||
|
log.info("超时巡查单号:{},状态:{},创建时间:{},更新时间:{}", order.getCode(), order.getOrderStatus(), order.getCreateTime(), order.getUpdateTime());
|
||||||
|
boolean timeout = ONE.equals(order.getTimeout());
|
||||||
|
if (timeout) {
|
||||||
|
try {
|
||||||
|
// 推送公众号通知数据。
|
||||||
|
// 消息组装。
|
||||||
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
|
// 订单编号
|
||||||
|
paramsNew.put("thing13", "超时巡查,您或您下级订单超时中");
|
||||||
|
// 名称
|
||||||
|
paramsNew.put("thing7", "超时巡查,您或您下级订单超时中");
|
||||||
|
|
||||||
|
paramsNew.put("character_string23", "进入见详情");
|
||||||
|
// 预约时间
|
||||||
|
paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||||
|
Worker worker = workerService.selectById(order.getWorkerId());
|
||||||
|
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.DEFAULT_HANDLE_ORDER, paramsNew);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void timeOutOrder(OrderDetail order) {
|
||||||
|
log.info("超时巡查子单超时开始:单号:{}, 内容:{}", order.getCode(), order);
|
||||||
|
Date now = new Date();
|
||||||
|
// 是否超时
|
||||||
|
boolean timeout = ONE.equals(order.getTimeout());
|
||||||
|
// 超时扣款次数
|
||||||
|
if (timeout) {
|
||||||
|
log.info("超时巡查单号:{},状态:{},创建时间:{},更新时间:{}", order.getCode(), order.getOrderStatus(), order.getCreateTime(), order.getUpdateTime());
|
||||||
|
// 待上门超时
|
||||||
|
if (timeoutOrderStatus.contains(order.getOrderStatus())) {
|
||||||
|
try {
|
||||||
|
// 推送公众号通知数据。
|
||||||
|
// 消息组装。
|
||||||
|
Map<String, Object> paramsNew = new HashMap<>();
|
||||||
|
// 订单编号
|
||||||
|
paramsNew.put("thing13", "超时巡查,您或您下级订单超时中");
|
||||||
|
// 名称
|
||||||
|
paramsNew.put("thing7", "超时巡查,您或您下级订单超时中");
|
||||||
|
|
||||||
|
paramsNew.put("character_string23", "进入见详情");
|
||||||
|
// 预约时间
|
||||||
|
paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||||
|
Worker worker = workerService.selectById(order.getWorkerId());
|
||||||
|
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), worker.getWxOpenId(), WxMsgEnum.DEFAULT_HANDLE_ORDER, paramsNew);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,4 +46,15 @@ public class OrderTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超时巡查
|
||||||
|
*/
|
||||||
|
public void tineOutOrder() {
|
||||||
|
try {
|
||||||
|
orderService.timeOutOrder();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue