This commit is contained in:
杨旭 2025-04-19 15:00:34 +08:00
parent 7d65a5d640
commit ebd00f134e
17 changed files with 323 additions and 74 deletions

View File

@ -1,8 +1,8 @@
package com.tmerclub.cloud.api.delivery.feign;
import com.tmerclub.cloud.api.delivery.dto.CalculateAndGetDeliverInfoDTO;
import com.tmerclub.cloud.api.delivery.vo.ShopTransportVO;
import com.tmerclub.cloud.common.local.dto.CurOderReturnsDTO;
import com.tmerclub.cloud.common.order.vo.TransportVO;
import com.tmerclub.cloud.common.order.vo.UserDeliveryInfoVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
@ -17,6 +17,7 @@ public interface DeliveryFeignClient {
/**
* 计算运费并计算获取配送信息
*
* @param param 用户地址和订单信息
* @return void
*/
@ -24,6 +25,7 @@ public interface DeliveryFeignClient {
/**
* 获取店铺运费模板列表
*
* @param shopId 店铺id
* @return 运费模板列表
*/
@ -31,6 +33,7 @@ public interface DeliveryFeignClient {
/**
* 根据id列表获取运费模板
*
* @param transportIds
* @return
*/
@ -38,6 +41,7 @@ public interface DeliveryFeignClient {
/**
* 判断用户地址是否包含在配送范围内
*
* @param deliveryTemplateId
* @param userId
* @param addrId
@ -47,8 +51,9 @@ public interface DeliveryFeignClient {
/**
* 检查配送范围
*
* @param deliveryTemplateId 运费模板id
* @param addrId 用户地址id
* @param addrId 用户地址id
* @return
*/
ServerResponseEntity<Boolean> checkDeliveryRange(Long deliveryTemplateId,
@ -57,10 +62,17 @@ public interface DeliveryFeignClient {
/**
* 获取商品物流模板
*
* @param deliveryTemplateId
* @return
*/
TransportVO getTransportAndAllItemsById(Long deliveryTemplateId);
void curOderReturns();
/**
* 球杆订单退货
*
* @param curOderReturnsDTO 订单信息
* @return 结果
*/
ServerResponseEntity<String> curOderReturns(CurOderReturnsDTO curOderReturnsDTO);
}

View File

@ -1,4 +1,3 @@
package com.tmerclub.cloud.api.user.feign;
import com.tmerclub.cloud.api.payment.vo.ShopAccountDetailVO;
@ -11,17 +10,20 @@ import com.tmerclub.cloud.api.user.vo.UserPayInfoVO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 充值信息
*
* @author tmerclub
*/
public interface UserBalanceLogFeignClient {
/**
* 获取充值金额
*
* @param balanceLogId 充值记录id
* @return
*/
@ -29,6 +31,7 @@ public interface UserBalanceLogFeignClient {
/**
* 获取充值记录是否已经支付
*
* @param balanceLogId 充值记录id
* @return
*/
@ -37,6 +40,7 @@ public interface UserBalanceLogFeignClient {
/**
* 余额支付记录
*
* @param balancePayBO 记录信息
* @return
*/
@ -44,6 +48,7 @@ public interface UserBalanceLogFeignClient {
/**
* 余额退款记录 + 执行退款
*
* @param balanceRefundBO 记录信息
* @return
*/
@ -51,6 +56,7 @@ public interface UserBalanceLogFeignClient {
/**
* 分页获取余额充值财务对账信息
*
* @param financeDetailDTO
* @return
*/
@ -58,6 +64,7 @@ public interface UserBalanceLogFeignClient {
/**
* 获取余额充值财务对账信息
*
* @param financeDetailDTO
* @return
*/
@ -65,6 +72,7 @@ public interface UserBalanceLogFeignClient {
/**
* 获取平台财务信息
*
* @param startTime
* @param endTime
* @return
@ -74,6 +82,7 @@ public interface UserBalanceLogFeignClient {
/**
* 获取用户充值购买会员财务信息
*
* @param startTime
* @param endTime
* @param financeType
@ -89,6 +98,7 @@ public interface UserBalanceLogFeignClient {
/**
* 获取用户充值购买会员财务信息
*
* @param startTime
* @param endTime
* @param financeType
@ -100,8 +110,18 @@ public interface UserBalanceLogFeignClient {
/**
* 扣减用户余额更新余额支付记录为支付成功
*
* @param payId
* @return
*/
ServerResponseEntity<Void> updateToOrderPaySuccess(Long payId);
/**
* 出售球杆更新用户余额
*
* @param userId 用户id
* @param money 金额单位分
* @return 结果
*/
ServerResponseEntity<Void> sellCueUpdateBalance(Long userId, Long money);
}

View File

@ -8,17 +8,19 @@ package com.tmerclub.cloud.common.local.constant;
**/
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, "价格不满意(已退回)"),
RECEIPT_EVALUATION_AND_BACK(10, "评估失败(已退回)");
FINISH_DELIVERY(3, "已发货"),
FINISH_RECEIPT(4, "已收货(评估中)"),
EVALUATION_SUCCESS(5, "评估成功(给出价格)"),
EVALUATION_FAIL(6, "评估失败(退回)"),
EVALUATION_FAIL_FILLED_RETURN_ADDRESS(7, "评估失败用户已填写回邮地址"),
EVALUATION_FAIL_COMPLETED(8, "评估失败(已退回)"),
EVALUATION_SUCCESS_PAY(9, "价格满意(结束)"),
EVALUATION_SUCCESS_PRICE_DISCONTENT(10, "价格不满意(已填写回邮地址)"),
EVALUATION_SUCCESS_COMPLETED(11, "价格不满意(已完成)");
private final Integer num;

View File

@ -0,0 +1,34 @@
package com.tmerclub.cloud.common.local.dto;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 球杆订单退货物流业务对象
*
* @author: frank
* @create: 2025-04-18
**/
@Data
public class CurOderReturnsDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 订单ID
*/
private Long orderId;
/**
* 网点id
*/
private Long outletConfigId;
/**
* 打印机id
*/
private Long printerId;
/**
* 订单地址id
*/
private Long orderAddrId;
}

View File

@ -3,9 +3,11 @@ package com.tmerclub.cloud.cuerecycle.controller.admin;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.cuerecycle.manager.CreateOrderManager;
import com.tmerclub.cloud.cuerecycle.mapper.CueOrderFlawMapper;
import com.tmerclub.cloud.cuerecycle.model.dto.CueOrderDTO;
import com.tmerclub.cloud.cuerecycle.model.dto.CueOrderFlawDTO;
import com.tmerclub.cloud.cuerecycle.model.dto.CueRetractedDTO;
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderFlawVO;
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
import com.tmerclub.cloud.cuerecycle.service.CueOrderService;
@ -31,6 +33,8 @@ public class CueOrderController {
CueOrderService cueOrderService;
@Resource
CueOrderFlawMapper cueOrderFlawMapper;
@Resource
CreateOrderManager createOrderManager;
/**
* 分页查询
@ -91,4 +95,16 @@ public class CueOrderController {
}
/**
* 球杆退回
*
* @param cueRetractedDTO 退回参数
* @return 结果
*/
@PutMapping("/cueRetracted")
@Operation(summary = "球杆退回", description = "球杆退回")
public ServerResponseEntity<Void> cueRetracted(@Valid @RequestParam CueRetractedDTO cueRetractedDTO) {
createOrderManager.cueRetracted(cueRetractedDTO);
return ServerResponseEntity.success();
}
}

View File

@ -3,7 +3,8 @@ package com.tmerclub.cloud.cuerecycle.controller.app;
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.dto.CueAgreeOrderDTO;
import com.tmerclub.cloud.cuerecycle.model.dto.CueFillAddrDTO;
import com.tmerclub.cloud.cuerecycle.model.dto.CueSaveMailingDTO;
import com.tmerclub.cloud.cuerecycle.model.vo.AppCueOrderVO;
import com.tmerclub.cloud.cuerecycle.service.CueOrderService;
@ -34,9 +35,9 @@ public class CueOrderController {
* @param createOrderDTO 创建订单参数
* @return ServerResponseEntity<CueOrderVO>
*/
@Operation(summary = "创建订单", description = "创建订单")
@PostMapping("/createOrder")
public ServerResponseEntity<Void> createOrder(@Valid @RequestBody CreateOrderDTO createOrderDTO) {
@Operation(summary = "创建订单", description = "创建订单")
public ServerResponseEntity<Long> createOrder(@Valid @RequestBody CreateOrderDTO createOrderDTO) {
// 防止重复提交 TODO不清楚为啥不好使
// boolean cad = RedisUtil.cad(OrderCacheNames.ORDER_CONFIRM_UUID_KEY + CacheNames.UNION + createOrderDTO.getUserId(), String.valueOf(createOrderDTO.getUserId()));
// if (!cad) {
@ -48,7 +49,7 @@ public class CueOrderController {
Long flawPrice = createOrderManager.addFlawItem(orderId, createOrderDTO);
// 向商城order插入信息
createOrderManager.saveOrderToMall(orderId, createOrderDTO.getProductPrice() - flawPrice, createOrderDTO);
return ServerResponseEntity.success();
return ServerResponseEntity.success(orderId);
}
/**
@ -71,28 +72,36 @@ public class CueOrderController {
* @return 结果
*/
@PostMapping("/saveMailing")
@Operation(summary = "邮寄填写订单", description = "邮寄填写订单")
public ServerResponseEntity<Void> saveMailing(@Valid @RequestBody CueSaveMailingDTO cueSaveMailingDTO) {
int update = cueOrderService.saveMailing(cueSaveMailingDTO);
return update > 0 ? ServerResponseEntity.success() : ServerResponseEntity.showFailMsg("提交失败");
}
// 同意回收
/**
* 同意回收
*
* @param cueAgreeOrderDTO 同意回收参数
* @return 结果
*/
@PostMapping("/agreeOrder")
public ServerResponseEntity<Void> agreeOrder(@RequestBody CreateOrderDTO createOrderDTO) {
createOrderManager.agreeOrder(createOrderDTO);
@Operation(summary = "同意回收", description = "同意回收")
public ServerResponseEntity<Void> agreeOrder(@Valid @RequestBody CueAgreeOrderDTO cueAgreeOrderDTO) {
createOrderManager.agreeOrder(cueAgreeOrderDTO);
return ServerResponseEntity.success();
}
/**
* 拒绝回收
* 填写不合格或不满意回邮地址
*
* @param cueRefuseOrderDTO 拒绝订单入参
* @param cueFillAddrDTO 回邮地址入参
* @return 结果
*/
@PostMapping("/refuseOrder")
public ServerResponseEntity<Void> refuseOrder(@RequestBody CueRefuseOrderDTO cueRefuseOrderDTO) {
createOrderManager.refuseOrder(cueRefuseOrderDTO);
@PostMapping("/fillAddr")
@Operation(summary = "填写回邮地址", description = "填写回邮地址")
public ServerResponseEntity<Void> fillAddr(@Valid @RequestBody CueFillAddrDTO cueFillAddrDTO) {
createOrderManager.fillAddr(cueFillAddrDTO);
return ServerResponseEntity.success();
}
}

View File

@ -8,8 +8,10 @@ import com.tmerclub.cloud.api.delivery.feign.DeliveryFeignClient;
import com.tmerclub.cloud.api.order.feign.OrderAddrFeignClient;
import com.tmerclub.cloud.api.order.feign.OrderFeignClient;
import com.tmerclub.cloud.api.user.feign.UserAddrFeignClient;
import com.tmerclub.cloud.api.user.feign.UserBalanceLogFeignClient;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.local.constant.CueOrderStatus;
import com.tmerclub.cloud.common.local.dto.CurOderReturnsDTO;
import com.tmerclub.cloud.common.local.dto.SaveOrderToMallDTO;
import com.tmerclub.cloud.common.order.vo.OrderAddrVO;
import com.tmerclub.cloud.common.order.vo.UserAddrVO;
@ -18,9 +20,7 @@ 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.dto.*;
import com.tmerclub.cloud.cuerecycle.model.vo.CueOrderVO;
import com.tmerclub.cloud.cuerecycle.service.CueFlawService;
import jakarta.annotation.Resource;
@ -50,13 +50,15 @@ public class CreateOrderManager {
@DubboReference
CouponFeignClient couponFeignClient;
@DubboReference
private OrderFeignClient orderFeignClient;
@DubboReference
DeliveryFeignClient deliveryFeignClient;
@DubboReference
UserAddrFeignClient userAddrFeignClient;
@DubboReference
OrderAddrFeignClient orderAddrFeignClient;
@DubboReference
UserBalanceLogFeignClient userBalanceLogFeignClient;
@DubboReference
OrderFeignClient orderFeignClient;
/**
* 保存订单信息
@ -120,9 +122,9 @@ public class CreateOrderManager {
orderFeignClient.updateOrderMall(mallOrderId, orderStatus);
}
public void agreeOrder(CreateOrderDTO createOrderDTO) {
public void agreeOrder(CueAgreeOrderDTO cueAgreeOrderDTO) {
// 查询订单信息
CueOrderVO cueOrderVO = cueOrderMapper.getById(createOrderDTO.getOrderId());
CueOrderVO cueOrderVO = cueOrderMapper.getById(cueAgreeOrderDTO.getOrderId());
if (ObjectUtil.isNull(cueOrderVO)) {
throw new LuckException("订单不存在,请检查!");
}
@ -131,14 +133,14 @@ public class CreateOrderManager {
throw new LuckException("状态已变更,请检查!");
}
CueOrder cueOrder = new CueOrder();
cueOrder.setOrderId(createOrderDTO.getOrderId());
cueOrder.setOrderType(createOrderDTO.getOrderType());
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_SUCCESS_AND_PAY.value());
cueOrder.setOrderId(cueAgreeOrderDTO.getOrderId());
cueOrder.setOrderType(cueAgreeOrderDTO.getOrderType());
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_SUCCESS_PAY.value());
cueOrder.setUpdateTime(DateUtil.date());
cueOrder.setFinallyTime(DateUtil.date());
cueOrder.setIsPayed(1);
// 根据回收类型进行不同操作
switch (createOrderDTO.getOrderType()) {
switch (cueAgreeOrderDTO.getOrderType()) {
case 1:
// 回收
cueOrder.setPayType(1);
@ -158,6 +160,7 @@ public class CreateOrderManager {
switch (cueOrder.getPayType()) {
case 1:
// 余额支付 直接向用户账户打款
userBalanceLogFeignClient.sellCueUpdateBalance(cueOrderVO.getUserId(), cueOrderVO.getActualAmount());
break;
case 2:
// 代金卷支付
@ -170,24 +173,28 @@ public class CreateOrderManager {
this.updateOrderMall(cueOrderVO.getMallOrderId(), CueOrderStatus.EVALUATION_FAIL.value());
}
public void refuseOrder(CueRefuseOrderDTO cueRefuseOrderDTO) {
Long orderId = cueRefuseOrderDTO.getOrderId();
/**
* 填写回邮地址
*
* @param cueFillAddrDTO 订单信息
*/
public void fillAddr(CueFillAddrDTO cueFillAddrDTO) {
Long orderId = cueFillAddrDTO.getOrderId();
// 查询订单信息
CueOrderVO cueOrderVO = cueOrderMapper.getById(orderId);
if (ObjectUtil.isNull(cueOrderVO)) {
throw new LuckException("订单不存在,请检查!");
}
// 两种情况会导致退 5不合格退款 6价格不满意退款
// 两种情况会导致退 5不合格 6价格不满意
// 检查当前状态
if (!Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value()) || !Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.RECEIPT_EVALUATION.value())) {
if (!Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_FAIL.value()) || !Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())) {
throw new LuckException("状态已变更,请检查!");
}
CueOrder cueOrder = new CueOrder();
cueOrder.setOrderId(orderId);
// 需要向order_addr插入一条数据
ServerResponseEntity<UserAddrVO> userAddrVO = userAddrFeignClient.cueGetUserAddrByAddrId(cueRefuseOrderDTO.getAddrId(), cueOrderVO.getUserId());
ServerResponseEntity<UserAddrVO> userAddrVO = userAddrFeignClient.cueGetUserAddrByAddrId(cueFillAddrDTO.getAddrId(), cueOrderVO.getUserId());
if (userAddrVO.isSuccess()) {
// 将地址信息插入到order_addr中
OrderAddrVO orderAddrVO = BeanUtil.toBean(userAddrVO, OrderAddrVO.class);
@ -197,14 +204,50 @@ public class CreateOrderManager {
cueOrder.setOrderAddrId(longServerResponseEntity.getData());
}
}
if(Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())){
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_FAIL.value());
}else{
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_FAIL.value());
if (Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS.value())) {
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_SUCCESS_PRICE_DISCONTENT.value());
} else {
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_SUCCESS_COMPLETED.value());
}
cueOrder.setUpdateTime(DateUtil.date());
cueOrderMapper.update(cueOrder);
this.updateOrderMall(cueOrderVO.getMallOrderId(), CueOrderStatus.EVALUATION_FAIL.value());
this.updateOrderMall(cueOrderVO.getMallOrderId(), cueOrder.getOrderStatus());
}
/**
* 后管操作球杆退回
*
* @param cueRetractedDTO 订单信息
*/
public void cueRetracted(CueRetractedDTO cueRetractedDTO) {
CueOrderVO cueOrderVO = cueOrderMapper.getById(cueRetractedDTO.getOrderId());
if (ObjectUtil.isNull(cueOrderVO)) {
throw new LuckException("订单不存在,请检查!");
}
if (!Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_FAIL_FILLED_RETURN_ADDRESS.value()) || !Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_SUCCESS_PRICE_DISCONTENT.value())) {
throw new LuckException("状态已变更,请检查!");
}
CueOrder cueOrder = new CueOrder();
cueOrder.setOrderId(cueRetractedDTO.getOrderId());
cueOrder.setOutletConfigId(cueRetractedDTO.getOutletConfigId());
cueOrder.setPrinterId(cueRetractedDTO.getPrinterId());
CurOderReturnsDTO curOderReturnsDTO = new CurOderReturnsDTO();
curOderReturnsDTO.setOrderId(cueOrderVO.getMallOrderId());
curOderReturnsDTO.setOutletConfigId(cueRetractedDTO.getOutletConfigId());
curOderReturnsDTO.setPrinterId(cueRetractedDTO.getPrinterId());
curOderReturnsDTO.setOrderAddrId(cueOrderVO.getOrderAddrId());
ServerResponseEntity<String> stringServerResponseEntity = deliveryFeignClient.curOderReturns(curOderReturnsDTO);
if (stringServerResponseEntity.isSuccess()) {
cueOrder.setBackTrackingNumber(stringServerResponseEntity.getData());
}
// 判断状态
if (Objects.equals(cueOrderVO.getOrderStatus(), CueOrderStatus.EVALUATION_FAIL_FILLED_RETURN_ADDRESS.value())) {
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_FAIL_COMPLETED.value());
} else {
cueOrder.setOrderStatus(CueOrderStatus.EVALUATION_SUCCESS_COMPLETED.value());
}
cueOrderMapper.update(cueOrder);
}
}

View File

@ -144,4 +144,8 @@ public class CueOrder extends BaseModel implements Serializable {
* 用户退货打印机id
*/
private Long printerId;
/**
* 退货物流单号
*/
private String backTrackingNumber;
}

View File

@ -0,0 +1,34 @@
package com.tmerclub.cloud.cuerecycle.model.dto;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 同意回收业务对象
*
* @author: frank
* @create: 2025-04-18
**/
@Data
public class CueAgreeOrderDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 订单ID
*/
@NotNull(message = "订单ID不能为空")
private Long orderId;
/**
* 地址ID
*/
@NotNull(message = "地址ID不能为空")
private Long addrId;
/**
* 类型1-回收2-置换3-寄售
*/
@NotNull(message = "类型不能为空")
private Integer orderType;
}

View File

@ -1,5 +1,6 @@
package com.tmerclub.cloud.cuerecycle.model.dto;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
@ -12,13 +13,17 @@ import java.io.Serializable;
* @create: 2025-04-18
**/
@Data
public class CueRefuseOrderDTO implements Serializable {
public class CueFillAddrDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 订单ID
*/
@NotNull(message = "订单ID不能为空")
private Long orderId;
/**
* 地址ID
*/
@NotNull(message = "地址ID不能为空")
private Long addrId;
}

View File

@ -0,0 +1,35 @@
package com.tmerclub.cloud.cuerecycle.model.dto;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 后管操作球杆退回业务对象
*
* @author: frank
* @create: 2025-04-18
**/
@Data
public class CueRetractedDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 订单ID
*/
@NotNull(message = "订单ID不能为空")
private Long orderId;
/**
* 用户退货网点ids
*/
@NotNull(message = "网点不能为空")
private Long outletConfigId;
/**
* 用户退货打印机id
*/
@NotNull(message = "打印机不能为空")
private Long printerId;
}

View File

@ -137,4 +137,9 @@ public class CueOrderVO extends BaseVO implements Serializable {
* 寄出单号
*/
private String sendNumber;
/**
* 用户退款地址id
*/
private Long orderAddrId;
}

View File

@ -134,10 +134,10 @@ public class CueOrderServiceImpl implements CueOrderService {
@Override
public int saveMailing(CueSaveMailingDTO cueSaveMailingDTO) {
// 修改系统订单的状态
createOrderManager.updateOrderMall(cueSaveMailingDTO.getMallOrderId(), CueOrderStatus.PENDING_DELIVERY.value());
createOrderManager.updateOrderMall(cueSaveMailingDTO.getMallOrderId(), CueOrderStatus.FINISH_DELIVERY.value());
// 修改回收单状态
CueOrder cueOrder = BeanUtil.toBean(cueSaveMailingDTO, CueOrder.class);
cueOrder.setOrderStatus(CueOrderStatus.PENDING_DELIVERY.value());
cueOrder.setOrderStatus(CueOrderStatus.FINISH_DELIVERY.value());
cueOrder.setDeliveryTime(DateUtil.date());
return cueOrderMapper.update(cueOrder);
}

View File

@ -35,7 +35,7 @@
<sql id="Vo_Column_List">
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,send_number
create_time,update_time,is_payed,pay_type,pay_time,delivery_time,finally_time,mall_order_id,send_number,order_addr_id
</sql>
<select id="list" resultMap="cueOrderVOMap">
@ -205,6 +205,9 @@
<if test="printerId != null">
printer_id = #{printerId},
</if>
<if test="backTrackingNumber != null and backTrackingNumber != ''">
back_tracking_number = #{backTrackingNumber},
</if>
</set>
where
order_id = #{orderId}

View File

@ -1,4 +1,3 @@
package com.tmerclub.cloud.delivery.feign;
import com.tmerclub.cloud.api.delivery.dto.CalculateAndGetDeliverInfoDTO;
@ -8,6 +7,7 @@ import com.tmerclub.cloud.api.delivery.feign.DeliveryFeignClient;
import com.tmerclub.cloud.api.delivery.vo.ShopTransportVO;
import com.tmerclub.cloud.api.user.feign.UserAddrFeignClient;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.common.local.dto.CurOderReturnsDTO;
import com.tmerclub.cloud.common.order.vo.*;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.util.BeanUtil;
@ -15,6 +15,8 @@ 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 com.tmerclub.cloud.order.model.OrderAddr;
import com.tmerclub.cloud.order.service.OrderAddrService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.slf4j.Logger;
@ -33,24 +35,19 @@ import java.util.stream.Collectors;
@DubboService
public class DeliveryFeignController implements DeliveryFeignClient {
private static final Logger logger = LoggerFactory.getLogger(DeliveryFeignController.class);
private static final long TWO = -2;
@Autowired
DeliveryPrintManager deliveryPrintManager;
@DubboReference
private UserAddrFeignClient userAddrFeignClient;
@Autowired
private TransportService transportService;
@Autowired
private DeliveryOrderService deliveryOrderService;
@Autowired
private DeliveryManager deliveryManager;
@Autowired
DeliveryPrintManager deliveryPrintManager;
private static final long TWO = -2;
private OrderAddrService orderAddrService;
@Override
public ServerResponseEntity<UserDeliveryInfoVO> calculateAndGetDeliverInfo(CalculateAndGetDeliverInfoDTO param) {
@ -131,18 +128,22 @@ public class DeliveryFeignController implements DeliveryFeignClient {
}
@Override
public void curOderReturns() {
public ServerResponseEntity<String> curOderReturns(CurOderReturnsDTO curOderReturnsDTO) {
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
// 网点id
deliveryOrderDTO.setOutletConfigId(1L);
deliveryOrderDTO.setOutletConfigId(curOderReturnsDTO.getOutletConfigId());
// 打印机id
deliveryOrderDTO.setPrinterId(1L);
deliveryOrderDTO.setPrinterId(curOderReturnsDTO.getPrinterId());
// 根据订单地址id查询详情
OrderAddr orderAddr = orderAddrService.getById(curOderReturnsDTO.getOrderAddrId());
// 收件人姓名
deliveryOrderDTO.setConsignee("张三");
deliveryOrderDTO.setConsignee(orderAddr.getConsignee());
// 收件人手机号
deliveryOrderDTO.setMobile("13144611867");
deliveryOrderDTO.setMobile(orderAddr.getMobile());
// 订单地址id
deliveryOrderDTO.setOrderAddrId(2504170000012003L);//-;
deliveryOrderDTO.setOrderAddrId(curOderReturnsDTO.getOrderAddrId());
// 物流订单项
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
@ -151,7 +152,8 @@ public class DeliveryFeignController implements DeliveryFeignClient {
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
deliveryOrderDTO.setOrderId(1L);
String kuaidinum = deliveryPrintManager.deliveryPrint(deliveryOrderDTO, 1, 2);
String trackingNumber = deliveryPrintManager.deliveryPrint(deliveryOrderDTO, 1, 2);
return ServerResponseEntity.success(trackingNumber);
}
}

View File

@ -42,7 +42,12 @@ public enum RechargeTypeEnum {
/**
* 提现
*/
WITHDRAW(7);
WITHDRAW(7),
/**
* 出售球杆
*/
SELL(8),
;
private final Integer num;

View File

@ -1,7 +1,8 @@
package com.tmerclub.cloud.user.feign;
import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.api.order.constant.FinanceType;
import com.tmerclub.cloud.api.payment.constant.PaySysType;
import com.tmerclub.cloud.api.payment.vo.ShopAccountDetailVO;
import com.tmerclub.cloud.api.platform.feign.ConfigFeignClient;
import com.tmerclub.cloud.api.user.bo.BalancePayBO;
@ -23,15 +24,13 @@ import com.tmerclub.cloud.user.constant.DistributedIdKey;
import com.tmerclub.cloud.user.constant.RechargeIoTypeEnum;
import com.tmerclub.cloud.user.constant.RechargeTypeEnum;
import com.tmerclub.cloud.user.service.UserBalanceLogService;
import com.tmerclub.cloud.user.service.UserExtensionService;
import com.tmerclub.cloud.user.service.UserLevelLogService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* 充值信息
@ -49,6 +48,8 @@ public class UserBalanceLogFeignController implements UserBalanceLogFeignClient
private SegmentManager segmentManager;
@DubboReference
private ConfigFeignClient configFeignClient;
@Autowired
private UserExtensionService userExtensionService;
@Override
public ServerResponseEntity<Long> getPayAmount(Long rechargeLogId) {
@ -142,4 +143,23 @@ public class UserBalanceLogFeignController implements UserBalanceLogFeignClient
return ServerResponseEntity.success();
}
@Override
public ServerResponseEntity<Void> sellCueUpdateBalance(Long userId, Long money) {
// 修改余额
userExtensionService.updateBatchUserBalanceByUserIds(Collections.singletonList(userId), money, DateUtil.date());
// 创建日志
List<MongoUserBalanceLogBO> userBalanceLogs = new ArrayList<>(Constant.INITIAL_CAPACITY);
List<Long> userBalanceLogIds = segmentManager.listSegmentId(DistributedIdKey.tmerclub_USER_BALANCE_LOG, 1);
MongoUserBalanceLogBO userBalanceLog = new MongoUserBalanceLogBO();
userBalanceLog.setBalanceLogId(userBalanceLogIds.get(0));
userBalanceLog.setUserId(userId);
userBalanceLog.setChangeBalance(money);
userBalanceLog.setPaySysType(PaySysType.DEFAULT.value());
userBalanceLog.setIoType(RechargeIoTypeEnum.INCOME.value());
userBalanceLog.setType(RechargeTypeEnum.SELL.value());
userBalanceLogs.add(userBalanceLog);
userBalanceLogService.saveBatchToMongodb(userBalanceLogs);
return ServerResponseEntity.success();
}
}