增加售后退款流程
This commit is contained in:
@@ -270,14 +270,16 @@ dubbo:
|
||||
bxg:
|
||||
shop:
|
||||
# API_URL: http://192.168.10.113:48080/bxgApp
|
||||
API_URL: http://675b568e.r6.cpolar.top
|
||||
API_URL: http://45288535.r5.cpolar.top
|
||||
SITE_URL: http://192.168.10.113:48080/bxgApp
|
||||
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
|
||||
ADMIN_API_URL: http://192.168.10.113:48080/bxg
|
||||
# 快递100 参数
|
||||
kuaidi100:
|
||||
enable: true
|
||||
key: mmbOboEj7168
|
||||
customer: A6D46C8A03A4127C78DF0E377D721702
|
||||
# key: mmbOboEj7168
|
||||
# customer: A6D46C8A03A4127C78DF0E377D721702
|
||||
key: JUIqcuah6354
|
||||
customer: 72E85D8E7C67AEDB980F46C2B4194C27
|
||||
secret: 13fcbe029263431293f5658cbf3259d3
|
||||
userid: 79978ee033e640dca101450508620182
|
||||
+3
@@ -75,6 +75,9 @@ public class AppStoreAfterSalesController {
|
||||
return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@AppLog(value = "查看售後详情", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/store/detail/{key}/{id}")
|
||||
|
||||
@@ -12,6 +12,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||
import co.yixiang.annotation.AnonymousAccess;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.enums.OrderInfoEnum;
|
||||
@@ -344,7 +345,8 @@ public class StoreOrderController {
|
||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
||||
if (!expressInfo.isSuccess()) {
|
||||
throw new BadRequestException(expressInfo.getReason());
|
||||
// throw new BadRequestException(expressInfo.getReason());
|
||||
throw new YshopException(expressInfo.getReason());
|
||||
}
|
||||
return new ResponseEntity<>(expressInfo, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package co.yixiang.modules.sales;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
|
||||
import co.yixiang.app.modules.order.param.ExpressParam;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
import co.yixiang.modules.mp.service.WeixinPayService;
|
||||
@@ -8,6 +11,8 @@ import co.yixiang.modules.sales.param.SalesCheckDto;
|
||||
import co.yixiang.modules.sales.param.YxStoreAfterSalesDto;
|
||||
import co.yixiang.modules.sales.service.StoreAfterSalesService;
|
||||
import co.yixiang.modules.sales.param.YxStoreAfterSalesQueryCriteria;
|
||||
import co.yixiang.tools.express.ExpressService;
|
||||
import co.yixiang.tools.express.dao.ExpressInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -40,6 +45,8 @@ public class StoreAfterSalesController {
|
||||
private final WeixinPayService weixinPayService;
|
||||
private final IGenerator generator;
|
||||
|
||||
private final ExpressService expressService;
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*/
|
||||
@@ -73,6 +80,15 @@ public class StoreAfterSalesController {
|
||||
public void download(HttpServletResponse response, YxStoreAfterSalesQueryCriteria criteria) throws IOException {
|
||||
storeAfterSalesService.download(generator.convert(storeAfterSalesService.queryAll(criteria), YxStoreAfterSalesDto.class), response);
|
||||
}
|
||||
@Log("获取物流信息")
|
||||
@PostMapping("/order/express")
|
||||
@ApiOperation(value = "获取物流信息", notes = "获取物流信息")
|
||||
public ResponseEntity<ExpressInfo> express(@RequestBody ExpressParam expressInfoDo) {
|
||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
||||
return new ResponseEntity<>(expressInfo,HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/sales/List")
|
||||
@Log("查询售后")
|
||||
@@ -82,6 +98,8 @@ public class StoreAfterSalesController {
|
||||
return new ResponseEntity<>(storeAfterSalesService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Log("新增售后")
|
||||
@ApiOperation("新增售后")
|
||||
|
||||
+21
-11
@@ -14,6 +14,7 @@ import co.yixiang.event.TemplateEvent;
|
||||
import co.yixiang.event.TemplateListenEnum;
|
||||
import co.yixiang.exception.ErrorRequestException;
|
||||
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
|
||||
import co.yixiang.modules.mp.service.WeixinPayService;
|
||||
import co.yixiang.modules.order.domain.YxStoreOrder;
|
||||
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||
@@ -71,6 +72,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
private final StoreAfterSalesItemMapper storeAfterSalesItemMapper;
|
||||
private final StoreAfterSalesStatusMapper storeAfterSalesStatusMapper;
|
||||
private final IGenerator generator;
|
||||
|
||||
private final WeixinPayService weixinPayService;
|
||||
@Autowired
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
@@ -95,7 +98,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getTruePrice(), cartInfo.getCartNum());
|
||||
//商品优惠总金额
|
||||
BigDecimal commodityDiscountAmount;
|
||||
if (totalAmountOfGoods.compareTo(BigDecimal.ZERO)==0){
|
||||
if (totalAmountOfGoods.compareTo(BigDecimal.ZERO)==0){ //仅仅用了积分,订单金额是0
|
||||
commodityDiscountAmount=new BigDecimal(0);
|
||||
}else {
|
||||
commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice());
|
||||
@@ -318,8 +321,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
//操作记录
|
||||
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
|
||||
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
|
||||
storeAfterSalesStatus.setChangeType(2);
|
||||
storeAfterSalesStatus.setChangeMessage("售后订单生成");
|
||||
storeAfterSalesStatus.setChangeType(2); //发货
|
||||
storeAfterSalesStatus.setChangeMessage("用户退货单已发货生成");
|
||||
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||
storeAfterSalesStatus.setOperator("用户操作");
|
||||
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
|
||||
@@ -336,9 +339,9 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
@Override
|
||||
public Object salesCheck(Long salesId, String orderCode, Integer approvalStatus, String consignee, String phoneNumber, String address) {
|
||||
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId));
|
||||
if (approvalStatus == 0) {
|
||||
if (approvalStatus == 0) { //同意申请
|
||||
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue());
|
||||
if (storeAfterSales.getServiceType() == 1) {
|
||||
if (storeAfterSales.getServiceType() == 1) { //退货退款
|
||||
if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) {
|
||||
throw new ErrorRequestException("请输入收货人信息");
|
||||
}
|
||||
@@ -350,23 +353,30 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
|
||||
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
|
||||
storeAfterSalesStatus.setChangeType(1);
|
||||
storeAfterSalesStatus.setChangeMessage("平台审核成功");
|
||||
storeAfterSalesStatus.setChangeMessage("平台审核已通过");
|
||||
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||
storeAfterSalesStatus.setOperator("admin");
|
||||
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
|
||||
} else {
|
||||
if (storeAfterSales.getServiceType() == 0){ //退款
|
||||
StoreAfterSales sales =this.makeMoney(storeAfterSales.getId(),storeAfterSales.getOrderCode());
|
||||
BigDecimal bigDecimal = new BigDecimal("100");
|
||||
int payPrice = bigDecimal.multiply(sales.getRefundAmount()).intValue();
|
||||
weixinPayService.refundOrder(orderCode, payPrice);
|
||||
}
|
||||
|
||||
} else { //拒绝申请
|
||||
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue());
|
||||
storeAfterSales.setSalesState(2);
|
||||
//操作记录
|
||||
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
|
||||
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
|
||||
storeAfterSalesStatus.setChangeType(4);
|
||||
storeAfterSalesStatus.setChangeMessage("平台审核失败");
|
||||
storeAfterSalesStatus.setChangeMessage("平台审核未通过");
|
||||
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||
storeAfterSalesStatus.setOperator("admin");
|
||||
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus);
|
||||
|
||||
this.makeMoney(storeAfterSales.getId(),storeAfterSales.getOrderCode());
|
||||
|
||||
}
|
||||
return baseMapper.updateById(storeAfterSales) > 0;
|
||||
}
|
||||
@@ -376,10 +386,10 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
|
||||
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId));
|
||||
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue());
|
||||
baseMapper.updateById(storeAfterSales);
|
||||
//操作记录
|
||||
//操作记录/
|
||||
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus();
|
||||
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
|
||||
storeAfterSalesStatus.setChangeType(3);
|
||||
storeAfterSalesStatus.setChangeType(3); /** 操作类型 0售后订单生成 1后台审核成功 2用户发货 3打款 4审核失败 5用户撤销*/
|
||||
storeAfterSalesStatus.setChangeMessage("平台打款成功");
|
||||
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||
storeAfterSalesStatus.setOperator("admin");
|
||||
|
||||
Reference in New Issue
Block a user