| | |
| | | /// 保留骑手已接单、骑手已取货 |
| | | /// 变量前缀商户 骑手 买家 |
| | | |
| | | /* ========== 商户相关状态 ========== */ |
| | | /** |
| | | * 商户:买家下单提醒 |
| | | * 商户收到新订单通知 |
| | | */ |
| | | MERCHANT_ORDER_SUBMITTED(0, "订单已提交"), |
| | | |
| | | // /** |
| | | // * 商户:支付成功通知 |
| | | // * 订单支付成功通知商户 |
| | | // */ |
| | | // MERCHANT_PAYMENT_SUCCESS(1, "支付成功"), |
| | | |
| | | /** |
| | | * 商户:商家已接单 |
| | | * 商户:新接单 |
| | | * 商户确认接单通知 |
| | | */ |
| | | MERCHANT_ACCEPTED(2, "商家已接单"), |
| | | MERCHANT_ACCEPTED(2, "新接单"), |
| | | |
| | | /** |
| | | * 商户:商家已备货 |
| | |
| | | |
| | | |
| | | /* ========== 买家相关状态 ========== */ |
| | | /** |
| | | * 买家:订单状态变化通知 |
| | | * 订单状态更新通知买家 |
| | | */ |
| | | BUYER_ORDER_STATUS_CHANGED(7, "商品已送达"), |
| | | |
| | | /** |
| | | * 买家:订单已完成 |
| | |
| | | */ |
| | | BUYER_ORDER_DELIVERED(13, "订单送达"); |
| | | |
| | | // /* ========== 商户相关状态 ========== */ |
| | | // /** |
| | | // * 商户:买家下单提醒 |
| | | // * 商户收到新订单通知 |
| | | // */ |
| | | // MERCHANT_ORDER_SUBMITTED(0, "订单已提交"), |
| | | // |
| | | //// /** |
| | | //// * 商户:支付成功通知 |
| | | //// * 订单支付成功通知商户 |
| | | //// */ |
| | | //// MERCHANT_PAYMENT_SUCCESS(1, "支付成功"), |
| | | // |
| | | // /** |
| | | // * 商户:商家已接单 |
| | | // * 商户确认接单通知 |
| | | // */ |
| | | // MERCHANT_ACCEPTED(2, "商家已接单"), |
| | | // |
| | | // /** |
| | | // * 商户:商家已备货 |
| | | // * 商户完成备货通知 |
| | | // */ |
| | | // MERCHANT_PREPARED(4, "商家已备货"), |
| | | // |
| | | // |
| | | // /* ========== 骑手相关状态 ========== */ |
| | | // //加一个骑手取消接单 |
| | | // RIDER_CANCEL_ACCEPT(14, "骑手取消接单"), |
| | | // /** |
| | | // * 骑手:有待接单 |
| | | // * 骑手端有待接订单通知 |
| | | // */ |
| | | // RIDER_PENDING_ACCEPTANCE(3, "骑手已接单"), |
| | | // |
| | | // /** |
| | | // * 骑手:骑手已取货 |
| | | // * 骑手取货完成通知 |
| | | // */ |
| | | // RIDER_PICKED_UP(6, "骑手已取货"), |
| | | // |
| | | // /** |
| | | // * 骑手:骑手已到店 |
| | | // * 骑手到达商户店铺通知 |
| | | // */ |
| | | // RIDER_ARRIVED(5, "骑手已到店"), |
| | | // |
| | | // /** |
| | | // * 骑手:订单已取消 |
| | | // * 订单取消通知骑手 |
| | | // */ |
| | | // RIDER_ORDER_CANCELLED(9, "订单已取消"), |
| | | // |
| | | // /** |
| | | // * 骑手:配送超时提醒 |
| | | // * 距离最晚送达时间不足提醒,包括不足1小时和不足30分钟两种情况 |
| | | // * 系统后台提供的定时提醒状态,在订单创建后59分钟和29分钟时触发 |
| | | // */ |
| | | // RIDER_DELIVERY_WARNING(10, "配送超时提醒"), |
| | | // |
| | | // |
| | | // /* ========== 买家相关状态 ========== */ |
| | | // /** |
| | | // * 买家:订单状态变化通知 |
| | | // * 订单状态更新通知买家 |
| | | // */ |
| | | // BUYER_ORDER_STATUS_CHANGED(7, "商品已送达"), |
| | | // |
| | | // /** |
| | | // * 买家:订单已完成 |
| | | // * 订单完成通知买家 |
| | | // */ |
| | | // BUYER_ORDER_COMPLETED(8, "订单已完成"), |
| | | // |
| | | // /** |
| | | // * 买家:订单送达通知 |
| | | // * 订单送达通知买家 |
| | | // */ |
| | | // BUYER_ORDER_DELIVERED(13, "订单送达"); |
| | | |
| | | /** |
| | | * 反向映射,提升查找速度 |
| | | */ |
| | |
| | | @ApiOperation("商户端:用店铺id 获取下单订单消息") |
| | | public R<List<MesMsgRecordQueryOrderDto>> getPendingOrders(@RequestParam Long shopId) { |
| | | try { |
| | | String content = MsgStatusEnum.MERCHANT_ORDER_SUBMITTED.getValue(); |
| | | String content = MsgStatusEnum.MERCHANT_ACCEPTED.getValue(); |
| | | List<MesMsgRecordQueryOrderDto> res = mesMsgRecordService.queryorderPending(shopId, content); |
| | | return R.success(res); |
| | | } catch (Exception e) { |
| | |
| | | @ApiOperation("商户端:用店铺id 获取订单送达消息") |
| | | public R<List<MesMsgRecordQueryOrderDto>> getDeliveredOrders(@RequestParam Long shopId) { |
| | | try { |
| | | String content = MsgStatusEnum.BUYER_ORDER_STATUS_CHANGED.getValue(); |
| | | String content = MsgStatusEnum.BUYER_ORDER_DELIVERED.getValue(); |
| | | List<MesMsgRecordQueryOrderDto> res = mesMsgRecordService.queryorderPending(shopId, content); |
| | | return R.success(res); |
| | | } catch (Exception e) { |
| | |
| | | public void setBuyerStatusOrderSubmitted(String buyerId, String buyerName, String orderNo, Long shopId, String riderId, String riderName) { |
| | | MesMsgRecord record = new MesMsgRecord(); |
| | | record.setOrderNo(orderNo); |
| | | record.setContent(MsgStatusEnum.MERCHANT_ORDER_SUBMITTED.getValue()); // 使用枚举的描述作为消息内容 |
| | | record.setContentKey(String.valueOf(MsgStatusEnum.MERCHANT_ORDER_SUBMITTED.getKey()));// 使用枚举的描述作为消息内容key |
| | | record.setContent(MsgStatusEnum.MERCHANT_ACCEPTED.getValue()); // 使用枚举的描述作为消息内容 |
| | | record.setContentKey(String.valueOf(MsgStatusEnum.MERCHANT_ACCEPTED.getKey()));// 使用枚举的描述作为消息内容key |
| | | record.setBuyerId(buyerId != null ? buyerId : ""); // 处理空值情况 |
| | | record.setMsgType(MesTypeEnum.ORDER.getKey()); // 订单消息类型为2 |
| | | record.setIsRead(MesReadEnum.UNREAD.getKey()); // 默认未读 0 |
| | |
| | | public void setBuyerStatusOrderDelivered(String buyerId, String buyerName, String orderNo, Long shopId, String riderId, String riderName) { |
| | | MesMsgRecord record = new MesMsgRecord(); |
| | | record.setOrderNo(orderNo); |
| | | record.setContent(MsgStatusEnum.BUYER_ORDER_STATUS_CHANGED.getValue()); // 使用枚举的描述作为消息内容 |
| | | record.setContentKey(String.valueOf(MsgStatusEnum.BUYER_ORDER_STATUS_CHANGED.getKey()));// 使用枚举的描述作为消息内容key |
| | | record.setContent(MsgStatusEnum.BUYER_ORDER_DELIVERED.getValue()); // 使用枚举的描述作为消息内容 |
| | | record.setContentKey(String.valueOf(MsgStatusEnum.BUYER_ORDER_DELIVERED.getKey()));// 使用枚举的描述作为消息内容key |
| | | record.setBuyerId(buyerId != null ? buyerId : ""); // 处理空值情况 |
| | | record.setMsgType(MesTypeEnum.ORDER.getKey()); // 订单消息类型为2 |
| | | record.setIsRead(MesReadEnum.UNREAD.getKey()); // 默认未读 0 |
| | |
| | | public void setBuyerStatusOrderDelivered(String buyerId, String buyerName, String orderNo, Long shopId, MsgStatusEnum content, String riderId, String riderName) { |
| | | //content只能设置为如下 "商品已送达" "订单已完成" "订单送达" |
| | | if (content == null || |
| | | (!content.equals(MsgStatusEnum.BUYER_ORDER_STATUS_CHANGED) && |
| | | ( |
| | | !content.equals(MsgStatusEnum.BUYER_ORDER_COMPLETED) && |
| | | !content.equals(MsgStatusEnum.BUYER_ORDER_DELIVERED))) { |
| | | throw new IllegalArgumentException("content只能设置为如下 \"商品已送达\" \"订单已完成\" \"订单送达\""); |
| | |
| | | public void setSellerStatusOrderDelivered(String buyerId, String buyerName, String orderNo, Long shopId, MsgStatusEnum content, String riderId, String riderName) { |
| | | //content只能为 "订单已提交" "商家已接单" 商家已备货" |
| | | if (content == null || |
| | | (content != MsgStatusEnum.MERCHANT_ORDER_SUBMITTED && |
| | | ( |
| | | content != MsgStatusEnum.MERCHANT_ACCEPTED && |
| | | content != MsgStatusEnum.MERCHANT_PREPARED)) { |
| | | throw new IllegalArgumentException("content只能为 \"订单已提交\" \"商家已接单\" 商家已备货\""); |
| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.modules.message.common.MesTypeEnum; |
| | | import com.oying.modules.message.common.MsgStatusEnum; |
| | | import com.oying.modules.message.service.MesMsgRecordService; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import com.oying.modules.sh.domain.dto.OrderOperationLogQueryCriteria; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.mapper.OrderMapper; |
| | | import com.oying.modules.sh.mapper.OrderOperationLogMapper; |
| | | import com.oying.modules.sh.service.OrderOperationLogService; |
| | | import com.oying.utils.*; |
| | | import com.oying.utils.enums.OrderStatusEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.modules.sh.service.OrderOperationLogService; |
| | | import com.oying.modules.sh.domain.dto.OrderOperationLogQueryCriteria; |
| | | import com.oying.modules.sh.mapper.OrderOperationLogMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author lixin |
| | |
| | | resources.setSnapshotData(JSON.toJSONString(map)); |
| | | resources.setOperationTime(time); |
| | | orderOperationLogMapper.insert(resources); |
| | | mesMsgRecordService.insertOrderMsg(response.getOrder(), MsgStatusEnum.MERCHANT_ORDER_SUBMITTED, MesTypeEnum.ORDER); |
| | | mesMsgRecordService.insertOrderMsg(response.getOrder(), MsgStatusEnum.MERCHANT_ACCEPTED, MesTypeEnum.ORDER); |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), statusEnum.getKey(), statusEnum.getValue()); |
| | | } |
| | | |