|
|
@@ -1,46 +1,37 @@
|
|
|
package com.yami.shop.service.xsb.impl;
|
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.yami.shop.bean.app.param.OrderRefundExpressParam;
|
|
|
import com.yami.shop.bean.dto.OrderRefundDto;
|
|
|
-import com.yami.shop.bean.enums.*;
|
|
|
+import com.yami.shop.bean.enums.OrderStatus;
|
|
|
+import com.yami.shop.bean.enums.RefundStatusEnum;
|
|
|
+import com.yami.shop.bean.enums.RefundType;
|
|
|
+import com.yami.shop.bean.enums.ReturnMoneyStsType;
|
|
|
import com.yami.shop.bean.model.*;
|
|
|
import com.yami.shop.bean.vo.xsb.OmsOrderRefundSkuVo;
|
|
|
-import com.yami.shop.bean.vo.xsb.RefundOrderPushStatusVo;
|
|
|
import com.yami.shop.bean.vo.xsb.RefundOrderPushVo;
|
|
|
import com.yami.shop.common.bean.smqjh.OrderRefundCancelVo;
|
|
|
import com.yami.shop.common.bean.smqjh.OrderRefundExpressParamVo;
|
|
|
-import com.yami.shop.common.bean.smqjh.Result;
|
|
|
import com.yami.shop.common.config.Constant;
|
|
|
-import com.yami.shop.common.enums.SMQJHResultCode;
|
|
|
import com.yami.shop.common.exception.GlobalException;
|
|
|
import com.yami.shop.common.util.Arith;
|
|
|
-import com.yami.shop.common.util.HttpUtil;
|
|
|
import com.yami.shop.common.util.R;
|
|
|
import com.yami.shop.common.util.RefundSnUtils;
|
|
|
import com.yami.shop.dao.*;
|
|
|
-import com.yami.shop.service.*;
|
|
|
+import com.yami.shop.service.OrderRefundService;
|
|
|
+import com.yami.shop.service.OrderService;
|
|
|
import com.yami.shop.service.xsb.XSBRefundOrderService;
|
|
|
import com.yami.shop.utils.CullenUtils;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import ma.glasnost.orika.MapperFacade;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
-import javax.validation.Valid;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -53,8 +44,8 @@ import java.util.Objects;
|
|
|
@AllArgsConstructor
|
|
|
public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
|
|
|
- @Autowired
|
|
|
- private SkuMapper skuMapper;//商品sku
|
|
|
+// @Autowired
|
|
|
+// private SkuMapper skuMapper;//商品sku
|
|
|
@Autowired
|
|
|
private ShopDetailMapper shopDetailMapper;//门店详情信息
|
|
|
@Autowired
|
|
|
@@ -87,12 +78,12 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public R<String> applyAfterSales(RefundOrderPushVo refundOrderPushVo) {
|
|
|
+ public R<String> applyAfterSales(RefundOrderPushVo refundOrderPushVo,String logId) {
|
|
|
R<String> stringR = checkParameter(refundOrderPushVo);
|
|
|
if (!stringR.isSuccess()){
|
|
|
return stringR;
|
|
|
}
|
|
|
- log.info("渠道推送申请退款参数:{}",refundOrderPushVo);
|
|
|
+ log.info("【"+logId+"】"+"渠道推送申请退款参数:{}",refundOrderPushVo);
|
|
|
List<OrderRefundSku> orderRefundSkuList = new ArrayList<>();
|
|
|
List<OmsOrderRefundSkuVo> omsOrderRefundSkuVos = refundOrderPushVo.getOrderRefundSkuList();
|
|
|
for (OmsOrderRefundSkuVo omsOrderRefundSkuVo : omsOrderRefundSkuVos) {
|
|
|
@@ -149,7 +140,7 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
.eq(OrderRefund::getOrderId, order.getOrderId())
|
|
|
.in(OrderRefund::getReturnMoneySts, returnMoneySts));
|
|
|
|
|
|
- log.info("渠道推送申请退款:已存在退款订单数量{}", count);
|
|
|
+ log.info("【"+logId+"】"+"渠道推送申请退款:已存在退款订单数量{}", count);
|
|
|
if (count > 0) {
|
|
|
// 处理已存在退款的情况
|
|
|
return R.FAIL("渠道推送申请退款:该订单已有退款正在进行中");
|
|
|
@@ -202,9 +193,9 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
BigDecimal refundTotalMoney=BigDecimal.ZERO;
|
|
|
for (OrderRefundSku orderRefundSku : orderRefundSkuList) {
|
|
|
int mul = (int) Arith.mul(orderRefundSku.getSkuPrice(), 100)*orderRefundSku.getProductCount();
|
|
|
- log.info("转换金额为:"+mul);
|
|
|
+ log.info("【"+logId+"】"+"转换金额为:"+mul);
|
|
|
BigDecimal bigDecimal = Arith.fenToYuan((long) mul, 2);
|
|
|
- log.info("转换后金额为:"+mul);
|
|
|
+ log.info("【"+logId+"】"+"转换后金额为:"+mul);
|
|
|
refundTotalMoney= refundTotalMoney.add(bigDecimal);
|
|
|
}
|
|
|
// //计算退款订单金额 整单退款需要退运费
|
|
|
@@ -230,6 +221,7 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
newOrderRefund.setFreightAmount(refundOrderPushVo.getFreightAmount().setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
newOrderRefund.setOffsetPoints(0L);
|
|
|
newOrderRefund.setChannelType(refundOrderPushVo.getChannelType());
|
|
|
+ log.info("【"+logId+"】"+"添加退款信息:"+JSONObject.toJSONString(newOrderRefund));
|
|
|
OrderRefund orderRefund = orderRefundService.applyRefund(newOrderRefund);
|
|
|
if (!orderRefundSkuList.isEmpty()) {
|
|
|
orderRefundSkuList.forEach(c -> {
|
|
|
@@ -245,7 +237,7 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
addOrderRefundRecord(orderRefund.getRefundId(), 2, 2, "渠道推送申请退款:你的服务单已申请成功,待商家审核");
|
|
|
|
|
|
//创建海博退款单
|
|
|
- log.info("渠道推送申请退款:创建海博退款单,生成海博退款单信息{}", orderRefund);
|
|
|
+ log.info("【"+logId+"】"+"渠道推送申请退款:创建海博退款单,生成海博退款单信息{}", orderRefund);
|
|
|
orderRefundService.createRefundOrder(orderRefund.getOrderNumber(), orderRefund.getRefundSn());
|
|
|
|
|
|
return R.SUCCESS(newOrderRefund.getRefundSn());
|
|
|
@@ -293,8 +285,9 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
* 用户撤销退货退款申请
|
|
|
*/
|
|
|
@Override
|
|
|
- public R<String> cancel(OrderRefundCancelVo orderRefundCancelVo) {
|
|
|
+ public R<String> cancel(OrderRefundCancelVo orderRefundCancelVo,String logId) {
|
|
|
OrderRefundDto orderRefund = orderRefundService.getOrderRefundByRefundSn(orderRefundCancelVo.getRefundSn());
|
|
|
+ log.info("【"+logId+"】"+"接收第三方取消退款订单申请推送,退款订单{}", JSONObject.toJSONString(orderRefund));
|
|
|
if (Objects.isNull(orderRefund)) {
|
|
|
throw new GlobalException("撤销失败 退款订单不存在");
|
|
|
}
|
|
|
@@ -314,7 +307,7 @@ public class XSBRefundOrderServiceImpl implements XSBRefundOrderService {
|
|
|
// 查看订单是否还有处于处理中的退款单,如果没有则修改订单退款状态为关闭状态
|
|
|
Order order = orderService.getOrderByOrderNumber(orderRefund.getOrderNumber());
|
|
|
|
|
|
-
|
|
|
+ log.info("【"+logId+"】"+"接收第三方取消退款订单申请推送,订单{}", JSONObject.toJSONString(order));
|
|
|
if (!Objects.equals(orderRefund.getUserId(),orderRefundCancelVo.getUserId().toString())) {
|
|
|
throw new GlobalException("申请失败,您没有此权限");
|
|
|
}
|