球杆订单物流
This commit is contained in:
parent
6d93aa9155
commit
7da820e9a6
@ -103,4 +103,10 @@ public interface CouponFeignClient {
|
||||
* @return
|
||||
*/
|
||||
ServerResponseEntity<Integer> getStockByCouponId(Long couponId);
|
||||
|
||||
/**
|
||||
* 直接向用户发放代金卷
|
||||
* @return
|
||||
*/
|
||||
void sendUserCoupon(Long userId, Long reduceAmount);
|
||||
}
|
||||
|
@ -61,4 +61,6 @@ public interface DeliveryFeignClient {
|
||||
* @return
|
||||
*/
|
||||
TransportVO getTransportAndAllItemsById(Long deliveryTemplateId);
|
||||
|
||||
void curOderReturns();
|
||||
}
|
||||
|
@ -548,4 +548,6 @@ public interface OrderFeignClient {
|
||||
* 向商城订单写入球杆回收订单
|
||||
*/
|
||||
Long saveOrderToMall(SaveOrderToMallDTO saveOrderToMallDTO);
|
||||
|
||||
void updateOrderMall(Long mallOrderId, Integer orderStatus);
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
package com.tmerclub.cloud.api.user.feign;
|
||||
|
||||
import com.tmerclub.cloud.common.order.vo.UserAddrVO;
|
||||
@ -6,6 +5,7 @@ import com.tmerclub.cloud.common.response.ServerResponseEntity;
|
||||
|
||||
/**
|
||||
* 用户地址feign连接
|
||||
*
|
||||
* @author tmerclub
|
||||
* @date 2020/12/07
|
||||
*/
|
||||
@ -14,6 +14,7 @@ public interface UserAddrFeignClient {
|
||||
|
||||
/**
|
||||
* 根据地址id获取用户地址信息
|
||||
*
|
||||
* @param addrId 地址id
|
||||
* @return 用户地址信息
|
||||
*/
|
||||
@ -21,9 +22,18 @@ public interface UserAddrFeignClient {
|
||||
|
||||
/**
|
||||
* 根据用户id获取默认地址
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
ServerResponseEntity<UserAddrVO> getUserAddrByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据地址id获取用户地址信息
|
||||
*
|
||||
* @param addrId 地址id
|
||||
* @param userId 用户id
|
||||
* @return 用户地址信息
|
||||
*/
|
||||
ServerResponseEntity<UserAddrVO> cueGetUserAddrByAddrId(Long addrId, Long userId);
|
||||
}
|
||||
|
@ -170,6 +170,11 @@ public enum SendTypeEnum {
|
||||
*/
|
||||
PRODUCT_AUDIT_TO_SUPPLIER(1007, 3, "供应商端的商品审核结果提醒", "商品", "平台审核商品后"),
|
||||
|
||||
/**
|
||||
* 回收订单审核信息
|
||||
*/
|
||||
CUE_ORDER_AUDIT_RESULT(2001, 1, "回收订单审核信息", null, null)
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.tmerclub.cloud.common.local.constant;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*
|
||||
* @author: frank
|
||||
* @create: 2025-04-15
|
||||
**/
|
||||
public enum CueOrderStatus {
|
||||
|
||||
PENDING_AUDIT(0, "待审核"),
|
||||
AUDIT_PASS(1, "审核通过(待发货)"),
|
||||
AUDIT_FAIL(2, "审核拒绝"),
|
||||
PENDING_DELIVERY(3, "待发货(已发货)"),
|
||||
PENDING_RECEIPT(4, "已收货(评估中)"),
|
||||
RECEIPT_EVALUATION(5, "评估失败(退回)"),
|
||||
EVALUATION_SUCCESS(6, "评估成功(给出价格)"),
|
||||
EVALUATION_FAIL(7, "价格不满意(退回)"),
|
||||
EVALUATION_SUCCESS_AND_PAY(8, "价格满意(结束)"),
|
||||
EVALUATION_FAIL_AND_BACK(9, "价格不满意(已退回)");
|
||||
|
||||
|
||||
private final Integer num;
|
||||
private final String description;
|
||||
|
||||
CueOrderStatus(Integer num, String description) {
|
||||
this.num = num;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer value() {
|
||||
return num;
|
||||
}
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
|
||||
package com.tmerclub.cloud.config;
|
||||
|
||||
import com.tmerclub.cloud.common.rocketmq.config.RocketMqAdapter;
|
||||
import com.tmerclub.cloud.common.rocketmq.config.RocketMqConstant;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
/**
|
||||
* @author tmerclub
|
||||
* @date 2021/3/30
|
||||
*/
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
public class RocketMqConfig {
|
||||
|
||||
@Autowired
|
||||
private RocketMqAdapter rocketMqAdapter;
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate stockMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.STOCK_UNLOCK_TOPIC_BY_ORDER_ID);
|
||||
}
|
||||
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate couponMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.COUPON_UNLOCK_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderCancelTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_CANCEL_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderSubmitShopCartTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_SUBMIT_SHOP_CART);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderPurchaseNotifyShopTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_PURCHASE_NOTIFY_SHOP_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderNotifyServiceTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_NOTIFY_SERVICE_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate allinPayBalanceOrderSuccessTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ALLINPAY_BALANCE_ORDER_SUCCESS_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderReceiptTemplate() {
|
||||
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.ORDER_RECEIPT_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderSettledShopTemplate() {
|
||||
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.ORDER_SETTLED_SHOP_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundTemplate() {
|
||||
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.ORDER_REFUND_TOPIC);
|
||||
}
|
||||
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundPaymentTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_PAYMENT_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundShopTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_SHOP_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundSuccessSettlementTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_SUCCESS_SETTLEMENT_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate refundSuccessNotifySupplierTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_SUCCESS_SETTLEMENT_SUPPLIER_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundSuccessServiceTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_SUCCESS_SERVICE_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundSuccessStockTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_SUCCESS_STOCK_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate groupOrderCancelMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.GROUP_ORDER_CANCEL_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate seckillOrderCancelMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SECKILL_ORDER_CANCEL_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate seckillOrderRefundMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SECKILL_ORDER_REFUND_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate sendNotifyToShopTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SEND_NOTIFY_TO_SHOP_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate sendNotifyToUserTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SEND_NOTIFY_TO_USER_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate userScoreTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SCORE_UNLOCK_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate sendNotifyToUserExtensionTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SEND_NOTIFY_TO_USER_EXTENSION_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate stockBillLogTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.STOCK_BILL_LOG_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate stockBillLogPurchaseStorageTemplate() {
|
||||
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.STOCK_BILL_LOG_PURCHASE_STORAGE_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate outStockLogTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.OUT_STOCK_LOG_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderNotifyTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_NOTIFY_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderPreSaleFailSettlementTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_PRE_SALE_FAIL_SETTLEMENT_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate presaleOrderCanalMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.PRESALE_ORDER_CANAL_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundCancelMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_CANAL_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate comboOrderMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.COMBO_ORDER_TOPIC);
|
||||
}
|
||||
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate sendOrderToPurchaseNotifyToShopTemplate() {
|
||||
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.SEND_ORDER_TO_PURCHASE_NOTIFY_TO_SHOP_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderSettlementShopByAllinpayTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_SETTLED_SHOP_BY_ALLINPAY_TOPIC);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate orderRefundUpdateRefundStatusMqTemplate() {
|
||||
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_UPDATE_REFUND_STATUS);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public RocketMQTemplate addPurchaseAmountLogTemplate() {
|
||||
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.ADD_PURCHASE_AMOUNT_LOG_TOPIC);
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.tmerclub.cloud.cuerecycle.constant;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*
|
||||
* @author: frank
|
||||
* @create: 2025-04-15
|
||||
**/
|
||||
public enum CueOrderStatus {
|
||||
|
||||
|
||||
PENDING_AUDIT(0, "待审核"),
|
||||
AUDIT_PASS(1, "审核通过"),
|
||||
AUDIT_FAIL(2, "审核拒绝"),
|
||||
PENDING_DELIVERY(3, "待发货"),
|
||||
PENDING_RECEIPT(4, "待收货"),
|
||||
RECEIPT_EVALUATION(5, "已收货(评估中)"),
|
||||
EVALUATION_FAIL(6, "评估失败(退回)"),
|
||||
EVALUATION_SUCCESS(7, "评估成功"),
|
||||
COMPLETED(8, "已完成"),
|
||||
PRICE_UNSATISFIED(9, "价格不满意(退回)");
|
||||
|
||||
private final Integer num;
|
||||
private final String description;
|
||||
|
||||
public Integer value() {
|
||||
return num;
|
||||
}
|
||||
|
||||
CueOrderStatus(Integer num, String description) {
|
||||
this.num = num;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -1,21 +1,16 @@
|
||||
package com.tmerclub.cloud.cuerecycle.controller.app;
|
||||
|
||||
import com.tmerclub.cloud.common.cache.constant.CacheNames;
|
||||
import com.tmerclub.cloud.common.cache.constant.OrderCacheNames;
|
||||
import com.tmerclub.cloud.common.cache.util.RedisUtil;
|
||||
import com.tmerclub.cloud.common.response.ResponseEnum;
|
||||
import com.tmerclub.cloud.common.response.ServerResponseEntity;
|
||||
import com.tmerclub.cloud.cuerecycle.manager.CreateOrderManager;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CreateOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CueRefuseOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.AppCueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.service.CueOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 回收订单
|
||||
@ -54,4 +49,48 @@ public class CueOrderController {
|
||||
createOrderManager.saveOrderToMall(orderId, createOrderDTO.getProductPrice() - flawPrice, createOrderDTO);
|
||||
return ServerResponseEntity.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单id查询订单信息
|
||||
*
|
||||
* @param orderId 订单id
|
||||
* @return ServerResponseEntity<CueOrderVO>
|
||||
*/
|
||||
@GetMapping("/getOrderById")
|
||||
@Operation(summary = "根据订单id查询订单信息", description = "根据订单id查询订单信息")
|
||||
public ServerResponseEntity<AppCueOrderVO> getOrderById(@RequestParam("orderId") Long orderId) {
|
||||
AppCueOrderVO appCueOrderVO = cueOrderService.getByAppCueOrderId(orderId);
|
||||
return ServerResponseEntity.success(appCueOrderVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意预计价格
|
||||
*
|
||||
* @param createOrderDTO 入参
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/agreePrice")
|
||||
public ServerResponseEntity<Void> agreePrice(@RequestBody CreateOrderDTO createOrderDTO) {
|
||||
createOrderManager.agreePrice();
|
||||
return ServerResponseEntity.success();
|
||||
}
|
||||
|
||||
// 同意回收
|
||||
@PostMapping("/agreeOrder")
|
||||
public ServerResponseEntity<Void> agreeOrder(@RequestBody CreateOrderDTO createOrderDTO) {
|
||||
createOrderManager.agreeOrder(createOrderDTO);
|
||||
return ServerResponseEntity.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝回收
|
||||
*
|
||||
* @param cueRefuseOrderDTO 拒绝订单入参
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/refuseOrder")
|
||||
public ServerResponseEntity<Void> refuseOrder(@RequestBody CueRefuseOrderDTO cueRefuseOrderDTO) {
|
||||
createOrderManager.refuseOrder(cueRefuseOrderDTO);
|
||||
return ServerResponseEntity.success();
|
||||
}
|
||||
}
|
@ -2,15 +2,24 @@ package com.tmerclub.cloud.cuerecycle.manager;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.tmerclub.cloud.api.coupon.feign.CouponFeignClient;
|
||||
import com.tmerclub.cloud.api.delivery.feign.DeliveryFeignClient;
|
||||
import com.tmerclub.cloud.api.order.feign.OrderFeignClient;
|
||||
import com.tmerclub.cloud.api.user.feign.UserAddrFeignClient;
|
||||
import com.tmerclub.cloud.common.exception.LuckException;
|
||||
import com.tmerclub.cloud.common.local.constant.CueOrderStatus;
|
||||
import com.tmerclub.cloud.common.local.dto.SaveOrderToMallDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.constant.CueOrderStatus;
|
||||
import com.tmerclub.cloud.common.order.vo.UserAddrVO;
|
||||
import com.tmerclub.cloud.common.response.ServerResponseEntity;
|
||||
import com.tmerclub.cloud.cuerecycle.mapper.CueOrderFlawMapper;
|
||||
import com.tmerclub.cloud.cuerecycle.mapper.CueOrderMapper;
|
||||
import com.tmerclub.cloud.cuerecycle.model.CueOrder;
|
||||
import com.tmerclub.cloud.cuerecycle.model.CueOrderFlaw;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CreateOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CreateOrderFlawDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CueRefuseOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.service.CueFlawService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -18,6 +27,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 确认订单管理器
|
||||
*
|
||||
@ -35,7 +46,13 @@ public class CreateOrderManager {
|
||||
@Resource
|
||||
CueOrderFlawMapper cueOrderFlawMapper;
|
||||
@DubboReference
|
||||
CouponFeignClient couponFeignClient;
|
||||
@DubboReference
|
||||
private OrderFeignClient orderFeignClient;
|
||||
@DubboReference
|
||||
DeliveryFeignClient deliveryFeignClient;
|
||||
@DubboReference
|
||||
UserAddrFeignClient userAddrFeignClient;
|
||||
|
||||
/**
|
||||
* 保存订单信息
|
||||
@ -88,4 +105,92 @@ public class CreateOrderManager {
|
||||
cueOrder.setEstimatedAmount(estimatedAmount);
|
||||
cueOrderMapper.update(cueOrder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改mallOrder订单
|
||||
*
|
||||
* @param mallOrderId mallOrderId
|
||||
* @param orderStatus 状态
|
||||
*/
|
||||
public void updateOrderMall(Long mallOrderId, Integer orderStatus) {
|
||||
orderFeignClient.updateOrderMall(mallOrderId, orderStatus);
|
||||
}
|
||||
public void agreePrice(){
|
||||
deliveryFeignClient.curOderReturns();
|
||||
}
|
||||
|
||||
public void agreeOrder(CreateOrderDTO createOrderDTO) {
|
||||
// 查询订单信息
|
||||
CueOrderVO cueOrderVO = cueOrderMapper.getById(createOrderDTO.getOrderId());
|
||||
if (ObjectUtil.isNull(cueOrderVO)) {
|
||||
throw new LuckException("订单不存在,请检查!");
|
||||
}
|
||||
// 判断状态是否允许修改
|
||||
if (!Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())) {
|
||||
throw new LuckException("状态已变更,请检查!");
|
||||
}
|
||||
CueOrder cueOrder = new CueOrder();
|
||||
cueOrder.setOrderId(createOrderDTO.getOrderId());
|
||||
cueOrder.setOrderType(createOrderDTO.getOrderType());
|
||||
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_SUCCESS_AND_PAY.value());
|
||||
cueOrder.setUpdateTime(DateUtil.date());
|
||||
cueOrder.setFinallyTime(DateUtil.date());
|
||||
cueOrder.setIsPayed(1);
|
||||
// 根据回收类型进行不同操作
|
||||
switch (createOrderDTO.getOrderType()) {
|
||||
case 1:
|
||||
// 回收
|
||||
cueOrder.setPayType(1);
|
||||
break;
|
||||
case 2:
|
||||
// 置换
|
||||
cueOrder.setPayType(2);
|
||||
break;
|
||||
case 3:
|
||||
// 寄售
|
||||
cueOrder.setPayType(1);
|
||||
break;
|
||||
default:
|
||||
throw new LuckException("订单类型错误,请检查!");
|
||||
}
|
||||
// 根据支付方式进行不同操作
|
||||
switch (cueOrder.getPayType()) {
|
||||
case 1:
|
||||
// 余额支付 直接向用户账户打款
|
||||
break;
|
||||
case 2:
|
||||
// 代金卷支付
|
||||
couponFeignClient.sendUserCoupon(cueOrderVO.getUserId(), cueOrderVO.getVoucherAmount());
|
||||
break;
|
||||
default:
|
||||
throw new LuckException("支付方式错误,请检查!");
|
||||
}
|
||||
cueOrderMapper.update(cueOrder);
|
||||
this.updateOrderMall(cueOrderVO.getMallOrderId(), CueOrderStatus.EVALUATION_FAIL.value());
|
||||
}
|
||||
|
||||
public void refuseOrder(CueRefuseOrderDTO cueRefuseOrderDTO) {
|
||||
|
||||
Long orderId = cueRefuseOrderDTO.getOrderId();
|
||||
// 查询订单信息
|
||||
CueOrderVO cueOrderVO = cueOrderMapper.getById(orderId);
|
||||
if (ObjectUtil.isNull(cueOrderVO)) {
|
||||
throw new LuckException("订单不存在,请检查!");
|
||||
}
|
||||
// 判断状态是否允许修改
|
||||
if (!Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())) {
|
||||
throw new LuckException("状态已变更,请检查!");
|
||||
}
|
||||
// 需要向order_addr插入一条数据
|
||||
ServerResponseEntity<UserAddrVO> userAddrVOServerResponseEntity = userAddrFeignClient.cueGetUserAddrByAddrId(orderId, cueOrderVO.getUserId());
|
||||
if (userAddrVOServerResponseEntity.isSuccess()) {
|
||||
|
||||
}
|
||||
CueOrder cueOrder = new CueOrder();
|
||||
cueOrder.setOrderId(orderId);
|
||||
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_FAIL.value());
|
||||
cueOrder.setUpdateTime(DateUtil.date());
|
||||
cueOrderMapper.update(cueOrder);
|
||||
this.updateOrderMall(cueOrderVO.getMallOrderId(), CueOrderStatus.EVALUATION_FAIL.value());
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.tmerclub.cloud.cuerecycle.mapper;
|
||||
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CueOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.AppCueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.CueOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -32,6 +32,10 @@ public class CueOrder extends BaseModel implements Serializable {
|
||||
* 商品名称
|
||||
*/
|
||||
private String productName;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String productImages;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@ -53,7 +57,7 @@ public class CueOrder extends BaseModel implements Serializable {
|
||||
*/
|
||||
private Integer orderType;
|
||||
/**
|
||||
* 状态:0-待审核,1-审核通过,2-审核拒绝,3-待发货,4-待收货(已发货),5-已收货(评估中),6-评估失败(退回),7-评估成功,8-已完成,9-价格不满意(退回)
|
||||
* 0-待审核,1-审核通过(待发货),2-审核拒绝,3-待收货(已发货),4-已收货(评估中),5-评估失败(退回),6-评估成功(给出价格),7-价格不满意(退回),8-价格满意(结束),9-价格不满意(已退回)
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
@ -109,4 +113,13 @@ public class CueOrder extends BaseModel implements Serializable {
|
||||
* 商城订单id
|
||||
*/
|
||||
private Long mallOrderId;
|
||||
|
||||
/**
|
||||
* 寄售佣金
|
||||
*/
|
||||
private Long brokerage;
|
||||
/**
|
||||
* 服务费
|
||||
*/
|
||||
private Long serviceCharge;
|
||||
}
|
@ -17,6 +17,10 @@ public class CreateOrderDTO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
|
@ -38,7 +38,7 @@ public class CueOrderDTO implements Serializable {
|
||||
*/
|
||||
private Integer orderType;
|
||||
/**
|
||||
* 状态:0-待审核,1-审核通过,2-审核拒绝,3-待发货,4-待收货(已发货),5-已收货(评估中),6-评估失败(退回),7-评估成功,8-已完成,9-价格不满意(退回)
|
||||
* 状态:0-待审核,1-审核通过(待发货),2-审核拒绝,3-待收货(已发货),4-已收货(评估中),5-评估失败(退回),6-评估成功(给出价格),7-价格不满意(退回),8-价格满意(结束),9-价格不满意(已退回)
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
@ -89,5 +89,16 @@ public class CueOrderDTO implements Serializable {
|
||||
* 完成时间
|
||||
*/
|
||||
private Date finallyTime;
|
||||
|
||||
/**
|
||||
* 订单关联的商城订单ID
|
||||
*/
|
||||
private Long mallOrderId;
|
||||
/**
|
||||
* 寄售佣金
|
||||
*/
|
||||
private Long brokerage;
|
||||
/**
|
||||
* 服务费
|
||||
*/
|
||||
private Long serviceCharge;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.tmerclub.cloud.cuerecycle.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 拒绝回收业务对象
|
||||
*
|
||||
* @author: frank
|
||||
* @create: 2025-04-18
|
||||
**/
|
||||
@Data
|
||||
public class CueRefuseOrderDTO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
private Long addrId;
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package com.tmerclub.cloud.cuerecycle.model.vo;
|
||||
|
||||
import com.tmerclub.cloud.common.vo.BaseVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 回收订单视图对象
|
||||
*
|
||||
* @author : frank
|
||||
* @create : 2025-04-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppCueOrderVO extends BaseVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Schema(description = "主键ID")
|
||||
private Long orderId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
@Schema(description = "商品ID")
|
||||
private Long productId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description = "商品名称")
|
||||
private String productName;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
@Schema(description = "商品图片")
|
||||
private String productImages;
|
||||
/**
|
||||
* 类型:1-回收,2-置换,3-寄售
|
||||
*/
|
||||
@Schema(description = "类型:1-回收,2-置换,3-寄售")
|
||||
private Integer orderType;
|
||||
/**
|
||||
* 状态:0-待审核,1-审核通过(待发货),2-审核拒绝,3-待收货(已发货),4-已收货(评估中),5-评估失败(退回),6-评估成功(给出价格),7-价格不满意(退回),8-价格满意(结束),9-价格不满意(已退回)
|
||||
*/
|
||||
@Schema(description = "0-待审核,1-审核通过(待发货),2-审核拒绝,3-待收货(已发货),4-已收货(评估中),5-评估失败(退回),6-评估成功(给出价格),7-价格不满意(退回),8-价格满意(结束),9-价格不满意(已退回)")
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
* 预计金额
|
||||
*/
|
||||
@Schema(description = "预计金额")
|
||||
private Long estimatedAmount;
|
||||
/**
|
||||
* 评估金额
|
||||
*/
|
||||
@Schema(description = "评估金额")
|
||||
private Long actualAmount;
|
||||
/**
|
||||
* 代金卷金额
|
||||
*/
|
||||
@Schema(description = "代金卷金额")
|
||||
private Long voucherAmount;
|
||||
/**
|
||||
* 是否已支付,1.已支付0.未支付
|
||||
*/
|
||||
@Schema(description = "是否已支付,1.已支付0.未支付")
|
||||
private Integer isPayed;
|
||||
/**
|
||||
* 支付方式:1-余额,2-代金卷
|
||||
*/
|
||||
@Schema(description = "支付方式:1-余额,2-代金卷")
|
||||
private Integer payType;
|
||||
/**
|
||||
* 付款时间
|
||||
*/
|
||||
@Schema(description = "付款时间")
|
||||
private Date payTime;
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
@Schema(description = "发货时间")
|
||||
private Date deliveryTime;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Schema(description = "完成时间")
|
||||
private Date finallyTime;
|
||||
/**
|
||||
* 商城订单ID
|
||||
*/
|
||||
@Schema(description = "商城订单ID")
|
||||
private Long mallOrderId;
|
||||
/**
|
||||
* 寄售佣金
|
||||
*/
|
||||
@Schema(description = "寄售佣金")
|
||||
private Long brokerage;
|
||||
/**
|
||||
* 服务费
|
||||
*/
|
||||
@Schema(description = "服务费")
|
||||
private Long serviceCharge;
|
||||
}
|
@ -63,9 +63,9 @@ public class CueOrderVO extends BaseVO implements Serializable {
|
||||
@Schema(description = "类型:1-回收,2-置换,3-寄售")
|
||||
private Integer orderType;
|
||||
/**
|
||||
* 状态:0-待审核,1-审核通过,2-审核拒绝,3-待发货,4-待收货(已发货),5-已收货(评估中),6-评估失败(退回),7-评估成功,8-已完成,9-价格不满意(退回)
|
||||
* 状态:0-待审核,1-审核通过(待发货),2-审核拒绝,3-待收货(已发货),4-已收货(评估中),5-评估失败(退回),6-评估成功(给出价格),7-价格不满意(退回),8-价格满意(结束),9-价格不满意(已退回)
|
||||
*/
|
||||
@Schema(description = "状态:0-待审核,1-审核通过,2-审核拒绝,3-待发货,4-待收货(已发货),5-已收货(评估中),6-评估失败(退回),7-评估成功,8-已完成,9-价格不满意(退回)")
|
||||
@Schema(description = "0-待审核,1-审核通过(待发货),2-审核拒绝,3-待收货(已发货),4-已收货(评估中),5-评估失败(退回),6-评估成功(给出价格),7-价格不满意(退回),8-价格满意(结束),9-价格不满意(已退回)")
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
* 瑕疵图片,逗号隔开
|
||||
@ -127,4 +127,9 @@ public class CueOrderVO extends BaseVO implements Serializable {
|
||||
*/
|
||||
@Schema(description = "瑕疵项")
|
||||
private List<CueOrderFlawVO> flawList;
|
||||
/**
|
||||
* 商城订单ID
|
||||
*/
|
||||
@Schema(description = "商城订单ID")
|
||||
private Long mallOrderId;
|
||||
}
|
@ -3,6 +3,7 @@ package com.tmerclub.cloud.cuerecycle.service;
|
||||
import com.tmerclub.cloud.common.database.dto.PageDTO;
|
||||
import com.tmerclub.cloud.common.database.vo.PageVO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CueOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.AppCueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
|
||||
|
||||
/**
|
||||
@ -61,4 +62,12 @@ public interface CueOrderService {
|
||||
* @return 删除结果
|
||||
*/
|
||||
int delete(Long id);
|
||||
|
||||
/**
|
||||
* 根据订单ID获取回收订单详情
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
* @return 回收订单详情
|
||||
*/
|
||||
AppCueOrderVO getByAppCueOrderId(Long orderId);
|
||||
}
|
@ -2,18 +2,32 @@ package com.tmerclub.cloud.cuerecycle.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.tmerclub.cloud.common.database.util.PageUtil;
|
||||
import com.tmerclub.cloud.common.constant.Constant;
|
||||
import com.tmerclub.cloud.common.constant.SendTypeEnum;
|
||||
import com.tmerclub.cloud.common.database.dto.PageDTO;
|
||||
import com.tmerclub.cloud.common.database.util.PageUtil;
|
||||
import com.tmerclub.cloud.common.database.vo.PageVO;
|
||||
import com.tmerclub.cloud.cuerecycle.constant.CueOrderStatus;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CueOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.CueOrder;
|
||||
import com.tmerclub.cloud.common.exception.LuckException;
|
||||
import com.tmerclub.cloud.common.local.constant.CueOrderStatus;
|
||||
import com.tmerclub.cloud.common.order.vo.SendNotifyBO;
|
||||
import com.tmerclub.cloud.common.response.ResponseEnum;
|
||||
import com.tmerclub.cloud.common.rocketmq.config.RocketMqConstant;
|
||||
import com.tmerclub.cloud.cuerecycle.manager.CreateOrderManager;
|
||||
import com.tmerclub.cloud.cuerecycle.mapper.CueOrderMapper;
|
||||
import com.tmerclub.cloud.cuerecycle.model.CueOrder;
|
||||
import com.tmerclub.cloud.cuerecycle.model.dto.CueOrderDTO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.AppCueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
|
||||
import com.tmerclub.cloud.cuerecycle.service.CueOrderService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.client.producer.SendStatus;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -22,11 +36,16 @@ import java.util.Objects;
|
||||
* @author : frank
|
||||
* @create : 2025-04-15
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CueOrderServiceImpl implements CueOrderService {
|
||||
|
||||
@Resource
|
||||
CueOrderMapper cueOrderMapper;
|
||||
@Resource
|
||||
CreateOrderManager createOrderManager;
|
||||
@Resource
|
||||
private RocketMQTemplate sendNotifyToUserTemplate;
|
||||
|
||||
@Override
|
||||
public PageVO<CueOrderVO> page(PageDTO pageDTO, CueOrderDTO cueOrderDTO) {
|
||||
@ -51,6 +70,8 @@ public class CueOrderServiceImpl implements CueOrderService {
|
||||
cueOrder.setOrderId(cueOrderDTO.getOrderId());
|
||||
cueOrder.setOrderStatus(cueOrderDTO.getOrderStatus());
|
||||
cueOrder.setUpdateTime(DateUtil.date());
|
||||
// 发送消息
|
||||
syncSend(cueOrderDTO);
|
||||
return cueOrderMapper.update(cueOrder);
|
||||
}
|
||||
|
||||
@ -59,14 +80,38 @@ public class CueOrderServiceImpl implements CueOrderService {
|
||||
CueOrder cueOrder = new CueOrder();
|
||||
cueOrder.setOrderId(cueOrderDTO.getOrderId());
|
||||
cueOrder.setOrderStatus(cueOrderDTO.getOrderStatus());
|
||||
if(Objects.equals(cueOrderDTO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())){
|
||||
if (Objects.equals(cueOrderDTO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())) {
|
||||
cueOrder.setActualAmount(cueOrderDTO.getActualAmount());
|
||||
cueOrder.setVoucherAmount(cueOrderDTO.getVoucherAmount());
|
||||
// 寄售需要填写服务费和佣金
|
||||
if (cueOrderDTO.getOrderType().equals(3)) {
|
||||
cueOrder.setServiceCharge(cueOrderDTO.getServiceCharge());
|
||||
cueOrder.setBrokerage(cueOrderDTO.getBrokerage());
|
||||
} else {
|
||||
cueOrder.setVoucherAmount(cueOrderDTO.getVoucherAmount());
|
||||
}
|
||||
}
|
||||
cueOrder.setUpdateTime(DateUtil.date());
|
||||
// 发送消息
|
||||
syncSend(cueOrderDTO);
|
||||
return cueOrderMapper.update(cueOrder);
|
||||
}
|
||||
|
||||
private void syncSend(CueOrderDTO cueOrderDTO) {
|
||||
// 修改系统订单的状态
|
||||
createOrderManager.updateOrderMall(cueOrderDTO.getMallOrderId(), cueOrderDTO.getOrderStatus());
|
||||
// 发送消息
|
||||
List<SendNotifyBO> notifyList = new ArrayList<>(Constant.INITIAL_CAPACITY);
|
||||
SendNotifyBO sendNotifyBO = new SendNotifyBO();
|
||||
sendNotifyBO.setSendType(SendTypeEnum.CUE_ORDER_AUDIT_RESULT.getValue());
|
||||
sendNotifyBO.setUserId(cueOrderDTO.getUserId());
|
||||
sendNotifyBO.setShopId(Constant.PLATFORM_SHOP_ID);
|
||||
notifyList.add(sendNotifyBO);
|
||||
SendStatus sendStockStatus = sendNotifyToUserTemplate.syncSend(RocketMqConstant.SEND_NOTIFY_TO_USER_TOPIC, new GenericMessage<>(notifyList)).getSendStatus();
|
||||
if (!Objects.equals(sendStockStatus, SendStatus.SEND_OK)) {
|
||||
throw new LuckException(ResponseEnum.EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
CueOrderVO cueOrderVO = cueOrderMapper.getById(id);
|
||||
@ -75,4 +120,10 @@ public class CueOrderServiceImpl implements CueOrderService {
|
||||
cueOrder.setDeleted(1);
|
||||
return cueOrderMapper.update(cueOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppCueOrderVO getByAppCueOrderId(Long orderId) {
|
||||
CueOrderVO cueOrderVO = cueOrderMapper.getById(orderId);
|
||||
return BeanUtil.toBean(cueOrderVO, AppCueOrderVO.class);
|
||||
}
|
||||
}
|
@ -28,10 +28,11 @@
|
||||
<result property="deliveryTime" column="delivery_time"/>
|
||||
<result property="finallyTime" column="finally_time"/>
|
||||
<result property="finallyTime" column="finally_time"/>
|
||||
<result property="mallOrderId" column="mall_order_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Vo_Column_List">
|
||||
order_id,product_id,product_name,product_price,user_id,user_name,user_phone,order_type,order_status,flaw_img_url,evidence_of_payment,order_remark,estimated_amount,actual_amount,voucher_amount,deleted,create_time,update_time,is_payed,pay_type,pay_time,delivery_time,finally_time
|
||||
order_id,product_id,product_name,product_images,product_price,user_id,user_name,user_phone,order_type,order_status,flaw_img_url,evidence_of_payment,order_remark,estimated_amount,actual_amount,voucher_amount,deleted,create_time,update_time,is_payed,pay_type,pay_time,delivery_time,finally_time,mall_order_id
|
||||
</sql>
|
||||
|
||||
<select id="list" resultMap="cueOrderVOMap">
|
||||
@ -79,6 +80,7 @@
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="productName != null and productName != ''">product_name,</if>
|
||||
<if test="productImages != null and productImages != ''">product_images,</if>
|
||||
<if test="productPrice != null">product_price,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="userPhone != null and userPhone != ''">user_phone,</if>
|
||||
@ -101,6 +103,7 @@
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="productId != null">#{productId},</if>
|
||||
<if test="productName != null and productName != ''">#{productName},</if>
|
||||
<if test="productImages != null and productImages != ''">#{productImages},</if>
|
||||
<if test="productPrice != null">#{productPrice},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="userPhone != null and userPhone != ''">#{userPhone},</if>
|
||||
@ -175,7 +178,15 @@
|
||||
<if test="finallyTime != null">
|
||||
finally_time = #{finallyTime},
|
||||
</if>
|
||||
<if test="mallOrderId != null">mall_order_id = #{mallOrderId},</if>
|
||||
<if test="mallOrderId != null">
|
||||
mall_order_id = #{mallOrderId},
|
||||
</if>
|
||||
<if test="mallOrderId != null">
|
||||
service_charge = #{serviceCharge},
|
||||
</if>
|
||||
<if test="brokerage != null">
|
||||
brokerage = #{brokerage},
|
||||
</if>
|
||||
</set>
|
||||
where
|
||||
order_id = #{orderId}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
package com.tmerclub.cloud.coupon.feign;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.tmerclub.cloud.api.coupon.constant.CouponType;
|
||||
import com.tmerclub.cloud.api.coupon.constant.PutOnStatus;
|
||||
import com.tmerclub.cloud.api.coupon.dto.BindCouponDTO;
|
||||
import com.tmerclub.cloud.api.coupon.dto.ReceiveCouponDTO;
|
||||
@ -15,6 +15,7 @@ import com.tmerclub.cloud.common.security.AuthUserContext;
|
||||
import com.tmerclub.cloud.common.util.BeanUtil;
|
||||
import com.tmerclub.cloud.coupon.constant.CouponStatus;
|
||||
import com.tmerclub.cloud.coupon.constant.SuitableProdType;
|
||||
import com.tmerclub.cloud.coupon.dto.CouponDTO;
|
||||
import com.tmerclub.cloud.coupon.manager.CouponStockManager;
|
||||
import com.tmerclub.cloud.coupon.model.Coupon;
|
||||
import com.tmerclub.cloud.coupon.service.CouponService;
|
||||
@ -126,4 +127,26 @@ public class CouponFeignController implements CouponFeignClient {
|
||||
public ServerResponseEntity<Integer> getStockByCouponId(Long couponId) {
|
||||
return ServerResponseEntity.success(couponStockManager.getStockByCouponId(couponId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUserCoupon(Long userId, Long reduceAmount) {
|
||||
// 创建优惠卷
|
||||
CouponDTO couponDTO = new CouponDTO();
|
||||
couponDTO.setCouponName("球杆置换代金卷");
|
||||
couponDTO.setSuitableProdType(SuitableProdType.ALL_SPU.value());
|
||||
couponDTO.setLimitNum(1);
|
||||
couponDTO.setCashCondition(reduceAmount + 1);
|
||||
couponDTO.setCouponType(CouponType.C2M.value());
|
||||
couponDTO.setReduceAmount(reduceAmount);
|
||||
couponDTO.setPutonStatus(PutOnStatus.PUT_ON.value());
|
||||
couponDTO.setGetWay(1);
|
||||
couponDTO.setValidTimeType(1);
|
||||
couponDTO.setAfterReceiveDays(0);
|
||||
couponDTO.setValidDays(3652);
|
||||
couponDTO.setTotalStock(1);
|
||||
couponDTO.setStocks(1);
|
||||
Long save = couponService.save(couponDTO);
|
||||
// 绑定优惠卷
|
||||
couponService.batchBindCouponByCouponIds(Collections.singletonList(save), userId);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public interface CouponService {
|
||||
*
|
||||
* @param couponDTO
|
||||
*/
|
||||
void save(CouponDTO couponDTO);
|
||||
Long save(CouponDTO couponDTO);
|
||||
|
||||
/**
|
||||
* 更新优惠券
|
||||
|
@ -183,7 +183,7 @@ public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(CouponDTO couponDTO) {
|
||||
public Long save(CouponDTO couponDTO) {
|
||||
checkCoupon(couponDTO);
|
||||
Coupon coupon = BeanUtil.map(couponDTO, Coupon.class);
|
||||
coupon.setTotalStock(coupon.getStocks());
|
||||
@ -215,6 +215,8 @@ public class CouponServiceImpl implements CouponService {
|
||||
multiRedisStockManager.doCouponZone(multiDecrementBO, coupon.getTotalStock());
|
||||
// 删除商品缓存
|
||||
removeSpuCache(coupon.getShopId(), couponDTO.getSpuIds());
|
||||
|
||||
return coupon.getCouponId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,8 @@
|
||||
package com.tmerclub.cloud.delivery.feign;
|
||||
|
||||
import com.tmerclub.cloud.api.delivery.dto.CalculateAndGetDeliverInfoDTO;
|
||||
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
|
||||
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderItemDTO;
|
||||
import com.tmerclub.cloud.api.delivery.feign.DeliveryFeignClient;
|
||||
import com.tmerclub.cloud.api.delivery.vo.ShopTransportVO;
|
||||
import com.tmerclub.cloud.api.user.feign.UserAddrFeignClient;
|
||||
@ -10,6 +12,7 @@ import com.tmerclub.cloud.common.order.vo.*;
|
||||
import com.tmerclub.cloud.common.response.ServerResponseEntity;
|
||||
import com.tmerclub.cloud.common.util.BeanUtil;
|
||||
import com.tmerclub.cloud.delivery.manager.DeliveryManager;
|
||||
import com.tmerclub.cloud.delivery.manager.DeliveryPrintManager;
|
||||
import com.tmerclub.cloud.delivery.service.DeliveryOrderService;
|
||||
import com.tmerclub.cloud.delivery.service.TransportService;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@ -41,9 +44,10 @@ public class DeliveryFeignController implements DeliveryFeignClient {
|
||||
@Autowired
|
||||
private DeliveryOrderService deliveryOrderService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeliveryManager deliveryManager;
|
||||
@Autowired
|
||||
DeliveryPrintManager deliveryPrintManager;
|
||||
|
||||
private static final long TWO = -2;
|
||||
|
||||
@ -126,4 +130,28 @@ public class DeliveryFeignController implements DeliveryFeignClient {
|
||||
return transportService.getTransportAndAllItemsById(deliveryTemplateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void curOderReturns() {
|
||||
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
|
||||
// 网点id
|
||||
deliveryOrderDTO.setOutletConfigId(1L);
|
||||
// 打印机id
|
||||
deliveryOrderDTO.setPrinterId(1L);
|
||||
// 收件人姓名
|
||||
deliveryOrderDTO.setConsignee("张三");
|
||||
// 收件人手机号
|
||||
deliveryOrderDTO.setMobile("13144611867");
|
||||
// 订单地址id
|
||||
deliveryOrderDTO.setOrderAddrId(1L);
|
||||
// 物流订单项
|
||||
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
|
||||
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
|
||||
deliveryOrderItemDTO.setSpuName("球杆");
|
||||
deliveryOrderItemDTOList.add(deliveryOrderItemDTO);
|
||||
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
|
||||
deliveryOrderDTO.setOrderId(1L);
|
||||
|
||||
String kuaidinum = deliveryPrintManager.deliveryPrint(deliveryOrderDTO, 1, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.tmerclub.cloud.common.constant.Constant;
|
||||
import com.tmerclub.cloud.common.exception.LuckException;
|
||||
import com.tmerclub.cloud.common.i18n.LanguageEnum;
|
||||
import com.tmerclub.cloud.common.leaf.manager.SegmentManager;
|
||||
import com.tmerclub.cloud.common.local.constant.CueOrderStatus;
|
||||
import com.tmerclub.cloud.common.local.dto.SaveOrderToMallDTO;
|
||||
import com.tmerclub.cloud.common.order.bo.EsOrderBO;
|
||||
import com.tmerclub.cloud.common.order.bo.OrderIdWithRefundIdBO;
|
||||
@ -566,7 +567,7 @@ public class OrderFeignController implements OrderFeignClient {
|
||||
order.setUserId(saveOrderToMallDTO.getUserId());
|
||||
order.setTotal(saveOrderToMallDTO.getEstimatedAmount());
|
||||
order.setActualTotal(saveOrderToMallDTO.getEstimatedAmount());
|
||||
order.setStatus(OrderStatus.UNPAY.value());
|
||||
order.setStatus(CueOrderStatus.PENDING_AUDIT.value());
|
||||
order.setAllCount(1);
|
||||
order.setOrderType(OrderType.RECYCLE.value());
|
||||
order.setOrderId(segmentManager.getSegmentIdWithDateTime(DistributedIdKey.tmerclub_ORDER, order.getUserId()));
|
||||
@ -596,4 +597,12 @@ public class OrderFeignController implements OrderFeignClient {
|
||||
orderItemLangMapper.saveCueOrderItemLang(orderItemLang);
|
||||
return order.getOrderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrderMall(Long mallOrderId, Integer orderStatus) {
|
||||
Order order = new Order();
|
||||
order.setOrderId(mallOrderId);
|
||||
order.setStatus(orderStatus);
|
||||
orderMapper.updateCueOrder(order);
|
||||
}
|
||||
}
|
||||
|
@ -393,4 +393,5 @@ public interface OrderMapper {
|
||||
* @param order 参数
|
||||
*/
|
||||
void saveCueOrder(Order order);
|
||||
void updateCueOrder(Order order);
|
||||
}
|
||||
|
@ -1340,6 +1340,14 @@
|
||||
update `order` set `distribution_amount` = #{order.distributionAmount}
|
||||
where order_id = #{order.orderId}
|
||||
</update>
|
||||
<update id="updateCueOrder">
|
||||
update
|
||||
`order`
|
||||
set
|
||||
`cue_order` = #{status}
|
||||
where
|
||||
order_id = #{orderId}
|
||||
</update>
|
||||
|
||||
<select id="getUserFirstUserOrder" resultType="com.tmerclub.cloud.common.mongodb.bo.order.MongoOrderBO">
|
||||
SELECT IF(MIN(order_id) = #{orderId}, 1, 0) firstOrder
|
||||
|
@ -37,4 +37,9 @@ public class UserAddrFeignController implements UserAddrFeignClient {
|
||||
public ServerResponseEntity<UserAddrVO> getUserAddrByUserId(Long userId) {
|
||||
return ServerResponseEntity.success(userAddrService.getUserAddrByUserId(0L, userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponseEntity<UserAddrVO> cueGetUserAddrByAddrId(Long addrId, Long userId) {
|
||||
return ServerResponseEntity.success(userAddrService.getUserAddrByUserId(addrId, userId));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user