|
@@ -2,6 +2,7 @@ package com.yami.shop.api.controller;
|
|
|
|
|
|
import cn.hutool.core.lang.Snowflake;
|
|
import cn.hutool.core.lang.Snowflake;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.yami.shop.bean.app.dto.ApiOrderRefundDto;
|
|
import com.yami.shop.bean.app.dto.ApiOrderRefundDto;
|
|
@@ -29,11 +30,13 @@ import com.yami.shop.delivery.comment.api.paotui.model.response.OrderStatusRespo
|
|
import com.yami.shop.delivery.comment.service.TransportManagerService;
|
|
import com.yami.shop.delivery.comment.service.TransportManagerService;
|
|
import com.yami.shop.security.api.util.SecurityUtils;
|
|
import com.yami.shop.security.api.util.SecurityUtils;
|
|
import com.yami.shop.service.*;
|
|
import com.yami.shop.service.*;
|
|
|
|
+import com.yami.shop.service.hb.IHBOrderService;
|
|
import com.yami.shop.utils.CullenUtils;
|
|
import com.yami.shop.utils.CullenUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import ma.glasnost.orika.MapperFacade;
|
|
import ma.glasnost.orika.MapperFacade;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -46,6 +49,7 @@ import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/p/orderRefund")
|
|
@RequestMapping("/p/orderRefund")
|
|
//@RequestMapping("/orderRefund")
|
|
//@RequestMapping("/orderRefund")
|
|
@@ -89,6 +93,7 @@ public class OrderRefundController {
|
|
@Autowired
|
|
@Autowired
|
|
private SkuService skuService;
|
|
private SkuService skuService;
|
|
|
|
|
|
|
|
+
|
|
@GetMapping("getIsDistribution")
|
|
@GetMapping("getIsDistribution")
|
|
@ApiOperation(value = "获取是否在配送中")
|
|
@ApiOperation(value = "获取是否在配送中")
|
|
public ResponseEntity<Boolean> getIsDistribution( String orderNumber){
|
|
public ResponseEntity<Boolean> getIsDistribution( String orderNumber){
|
|
@@ -128,6 +133,7 @@ public class OrderRefundController {
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@ApiOperation(value = "申请退款(再次提交)", notes = "申请退款(再次提交)")
|
|
@ApiOperation(value = "申请退款(再次提交)", notes = "申请退款(再次提交)")
|
|
public ResponseEntity<String> applyAgain(@Valid @RequestBody OrderRefundParam orderRefundParam) {
|
|
public ResponseEntity<String> applyAgain(@Valid @RequestBody OrderRefundParam orderRefundParam) {
|
|
|
|
+ log.info("小程序(再次提交)申请退款参数:{}", JSONObject.toJSONString(orderRefundParam));
|
|
Long refundId = orderRefundParam.getRefundId();
|
|
Long refundId = orderRefundParam.getRefundId();
|
|
CullenUtils.validateDataThrowException(refundId==null,"请输入旧退款订单ID...");
|
|
CullenUtils.validateDataThrowException(refundId==null,"请输入旧退款订单ID...");
|
|
List<OrderRefundSku> orderRefundSkuList = orderRefundParam.getOrderRefundSkuList();
|
|
List<OrderRefundSku> orderRefundSkuList = orderRefundParam.getOrderRefundSkuList();
|
|
@@ -266,6 +272,7 @@ public class OrderRefundController {
|
|
newOrderRefund.setReturnMoneySts(ReturnMoneyStsType.APPLY.value());
|
|
newOrderRefund.setReturnMoneySts(ReturnMoneyStsType.APPLY.value());
|
|
newOrderRefund.setApplyTime(new Date());
|
|
newOrderRefund.setApplyTime(new Date());
|
|
newOrderRefund.setUpdateTime(new Date());
|
|
newOrderRefund.setUpdateTime(new Date());
|
|
|
|
+ log.info( "申请退款申请,生成退款单信息{}", newOrderRefund);
|
|
OrderRefund orderRefund = orderRefundService.applyRefund(newOrderRefund);
|
|
OrderRefund orderRefund = orderRefundService.applyRefund(newOrderRefund);
|
|
if (!orderRefundSkuList.isEmpty()){
|
|
if (!orderRefundSkuList.isEmpty()){
|
|
orderRefundSkuList.forEach(c->{
|
|
orderRefundSkuList.forEach(c->{
|
|
@@ -276,6 +283,11 @@ public class OrderRefundController {
|
|
|
|
|
|
orderRefundService.removeById(refundId);
|
|
orderRefundService.removeById(refundId);
|
|
orderRefundSkuMapper.delete(new LambdaQueryWrapper<OrderRefundSku>().eq(OrderRefundSku::getOrderRefundId,refundId));
|
|
orderRefundSkuMapper.delete(new LambdaQueryWrapper<OrderRefundSku>().eq(OrderRefundSku::getOrderRefundId,refundId));
|
|
|
|
+
|
|
|
|
+ //创建海博退款单
|
|
|
|
+ log.info( "创建海博退款单,生成海博退款单信息{}", orderRefund);
|
|
|
|
+ orderRefundService.createRefundOrder(orderRefund.getOrderNumber(),orderRefund.getRefundSn());
|
|
|
|
+
|
|
return ResponseEntity.ok(newOrderRefund.getRefundSn());
|
|
return ResponseEntity.ok(newOrderRefund.getRefundSn());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -284,6 +296,8 @@ public class OrderRefundController {
|
|
@ApiOperation(value = "申请退款", notes = "申请退款")
|
|
@ApiOperation(value = "申请退款", notes = "申请退款")
|
|
public ResponseEntity<String> apply(@Valid @RequestBody OrderRefundParam orderRefundParam) {
|
|
public ResponseEntity<String> apply(@Valid @RequestBody OrderRefundParam orderRefundParam) {
|
|
|
|
|
|
|
|
+ log.info("小程序申请退款参数:{}", JSONObject.toJSONString(orderRefundParam));
|
|
|
|
+
|
|
List<OrderRefundSku> orderRefundSkuList = orderRefundParam.getOrderRefundSkuList();
|
|
List<OrderRefundSku> orderRefundSkuList = orderRefundParam.getOrderRefundSkuList();
|
|
CullenUtils.validateDataThrowException(orderRefundSkuList.isEmpty(),"退款商品不能为空...");
|
|
CullenUtils.validateDataThrowException(orderRefundSkuList.isEmpty(),"退款商品不能为空...");
|
|
|
|
|
|
@@ -476,6 +490,11 @@ public class OrderRefundController {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //创建海博退款单
|
|
|
|
+ log.info( "创建海博退款单,生成海博退款单信息{}", orderRefund);
|
|
|
|
+ orderRefundService.createRefundOrder(orderRefund.getOrderNumber(),orderRefund.getRefundSn());
|
|
|
|
+
|
|
// if(StringUtils.isNotEmpty(order.getQnhOrderId())){
|
|
// if(StringUtils.isNotEmpty(order.getQnhOrderId())){
|
|
// //取消牵牛花订单
|
|
// //取消牵牛花订单
|
|
// createQNHOrder(order,newOrderRefund.getRefundSn());
|
|
// createQNHOrder(order,newOrderRefund.getRefundSn());
|