统一订单状态

This commit is contained in:
LIONCITYS\lioncity
2020-11-27 23:37:27 +08:00
parent 104400f5cd
commit b9872d4db8
4 changed files with 46 additions and 43 deletions

View File

@ -15,7 +15,8 @@ public enum OrderLogEnum {
PINK_ORDER_FAIL_1("ORDER_EXIST","订单生成失败,你已经参加该团了,请先支付订单"), PINK_ORDER_FAIL_1("ORDER_EXIST","订单生成失败,你已经参加该团了,请先支付订单"),
PINK_ORDER_FAIL_2("ORDER_EXIST","订单生成失败,你已经在该团内不能再参加了"), PINK_ORDER_FAIL_2("ORDER_EXIST","订单生成失败,你已经在该团内不能再参加了"),
REFUND_ORDER_SUCCESS("refund_price","退款成功"), REFUND_ORDER_SUCCESS("refund_price_success","退款成功"),
ORDER_EDIT("order_edit","订单改价"),
REMOVE_ORDER("remove_order","删除订单"), REMOVE_ORDER("remove_order","删除订单"),
EVAL_ORDER("order_eval","用户评价"), EVAL_ORDER("order_eval","用户评价"),
REFUND_ORDER_APPLY("apply_refund","用户申请退款"), REFUND_ORDER_APPLY("apply_refund","用户申请退款"),

View File

@ -16,35 +16,21 @@ import java.util.Date;
*/ */
@Data @Data
public class YxOrderNowOrderStatusDto implements Serializable { public class YxOrderNowOrderStatusDto implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@JsonFormat( private Date cacheKeyCreateOrder;
pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8" @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
) private Date paySuccess;
private Date cache_key_create_order; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date deliveryGoods;
@JsonFormat( @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8" private Date orderVerific;
) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date pay_success; private Date userTakeDelivery;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@JsonFormat( private Date checkOrderOver;
pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8" @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
) private Date applyRefund;
private Date delivery_goods; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date refundOrderSuccess;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8"
)
private Date order_verific;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8"
)
private Date user_take_delivery;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8"
)
private Date check_order_over;
private int size; private int size;
} }

View File

@ -687,11 +687,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
price.doubleValue(), price.doubleValue(),
NumberUtil.add(price,userQueryVo.getNowMoney()).doubleValue(), NumberUtil.add(price,userQueryVo.getNowMoney()).doubleValue(),
"订单退款到余额"+price+"",orderQueryVo.getId().toString()); "订单退款到余额"+price+"",orderQueryVo.getId().toString());
orderStatusService.create(orderQueryVo.getId(),"order_edit","退款给用户:"+price +"");
} }
orderStatusService.create(orderQueryVo.getId(),OrderLogEnum.REFUND_ORDER_SUCCESS.getValue(),"退款给用户:"+price +"");
TemplateBean templateBean = TemplateBean.builder() TemplateBean templateBean = TemplateBean.builder()
.orderId(orderQueryVo.getOrderId()) .orderId(orderQueryVo.getOrderId())
.price(orderQueryVo.getPayPrice().toString()) .price(orderQueryVo.getPayPrice().toString())
@ -750,7 +749,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
yxStoreOrderMapper.updateById(storeOrder); yxStoreOrderMapper.updateById(storeOrder);
//增加状态 //增加状态
orderStatusService.create(orderQueryVo.getId(),"delivery_goods", orderStatusService.create(orderQueryVo.getId(),OrderLogEnum.DELIVERY_GOODS.getValue(),
"已发货 快递公司:"+expressQueryVo.getName()+"快递单号:" +deliveryId); "已发货 快递公司:"+expressQueryVo.getName()+"快递单号:" +deliveryId);
//模板消息发布事件 //模板消息发布事件
@ -810,7 +809,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
yxStoreOrderMapper.updateById(storeOrder); yxStoreOrderMapper.updateById(storeOrder);
//增加状态 //增加状态
orderStatusService.create(storeOrder.getId(),"order_edit","修改实际支付金额"); orderStatusService.create(storeOrder.getId(),OrderLogEnum.ORDER_EDIT.getValue(),"修改实际支付金额");
} }

View File

@ -151,22 +151,39 @@ public class StoreOrderController {
yxOrderNowOrderStatusDto.setSize(dtoList.size()); yxOrderNowOrderStatusDto.setSize(dtoList.size());
dtoList.forEach(dto -> { dtoList.forEach(dto -> {
if (OrderLogEnum.CREATE_ORDER.getDesc().equals(dto.getChangeType())) { if (OrderLogEnum.CREATE_ORDER.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setCache_key_create_order(dto.getChangeTime()); yxOrderNowOrderStatusDto.setCacheKeyCreateOrder(dto.getChangeTime());
} }
if (OrderLogEnum.PAY_ORDER_SUCCESS.getDesc().equals(dto.getChangeType())) { if (OrderLogEnum.PAY_ORDER_SUCCESS.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setPay_success(dto.getChangeTime()); yxOrderNowOrderStatusDto.setPaySuccess(dto.getChangeTime());
} }
if (OrderLogEnum.DELIVERY_GOODS.getDesc().equals(dto.getChangeType())) { if (OrderLogEnum.DELIVERY_GOODS.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setDelivery_goods(dto.getChangeTime()); yxOrderNowOrderStatusDto.setDeliveryGoods(dto.getChangeTime());
} }
if (OrderLogEnum.TAKE_ORDER_DELIVERY.getDesc().equals(dto.getChangeType())) { if (OrderLogEnum.TAKE_ORDER_DELIVERY.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setUser_take_delivery(dto.getChangeTime()); yxOrderNowOrderStatusDto.setUserTakeDelivery(dto.getChangeTime());
yxOrderNowOrderStatusDto.setOrder_verific(dto.getChangeTime()); yxOrderNowOrderStatusDto.setOrderVerific(dto.getChangeTime());
} }
if (OrderLogEnum.EVAL_ORDER.getDesc().equals(dto.getChangeType())) { if (OrderLogEnum.EVAL_ORDER.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setCheck_order_over(dto.getChangeTime()); yxOrderNowOrderStatusDto.setCheckOrderOver(dto.getChangeTime());
} }
}); });
statusList = new ArrayList<>();
statusList.add(OrderLogEnum.REFUND_ORDER_APPLY.getValue());
statusList.add(OrderLogEnum.REFUND_ORDER_SUCCESS.getValue());
orderStatusLogList = yxStoreOrderStatusService.list(new LambdaQueryWrapper<YxStoreOrderStatus>().eq(YxStoreOrderStatus::getOid, id).in(YxStoreOrderStatus::getChangeType, statusList).orderByDesc(YxStoreOrderStatus::getChangeTime));
dtoList = getOrderStatusDto(orderStatusLogList);
dtoList.forEach(dto -> {
if (OrderLogEnum.REFUND_ORDER_APPLY.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setApplyRefund(dto.getChangeTime());
}
if (OrderLogEnum.REFUND_ORDER_SUCCESS.getDesc().equals(dto.getChangeType())) {
yxOrderNowOrderStatusDto.setRefundOrderSuccess(dto.getChangeTime());
}
});
return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK); return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK);
} }
public List<YxStoreOrderStatusDto> getOrderStatusDto(List<YxStoreOrderStatus> orderStatusLogList) { public List<YxStoreOrderStatusDto> getOrderStatusDto(List<YxStoreOrderStatus> orderStatusLogList) {
@ -258,7 +275,7 @@ public class StoreOrderController {
yxStoreOrderService.saveOrUpdate(resources); yxStoreOrderService.saveOrUpdate(resources);
yxStoreOrderStatusService.create(resources.getId(),"order_edit", yxStoreOrderStatusService.create(resources.getId(),OrderLogEnum.ORDER_EDIT.getValue(),
"修改订单价格为:" + resources.getPayPrice()); "修改订单价格为:" + resources.getPayPrice());
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }