|
|
@ -14,6 +14,7 @@ import co.yixiang.event.TemplateEvent; |
|
|
|
import co.yixiang.event.TemplateListenEnum; |
|
|
|
import co.yixiang.event.TemplateListenEnum; |
|
|
|
import co.yixiang.exception.ErrorRequestException; |
|
|
|
import co.yixiang.exception.ErrorRequestException; |
|
|
|
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; |
|
|
|
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.YxStoreOrder; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; |
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo; |
|
|
|
import co.yixiang.modules.order.service.YxStoreOrderService; |
|
|
|
import co.yixiang.modules.order.service.YxStoreOrderService; |
|
|
@ -71,6 +72,8 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM |
|
|
|
private final StoreAfterSalesItemMapper storeAfterSalesItemMapper; |
|
|
|
private final StoreAfterSalesItemMapper storeAfterSalesItemMapper; |
|
|
|
private final StoreAfterSalesStatusMapper storeAfterSalesStatusMapper; |
|
|
|
private final StoreAfterSalesStatusMapper storeAfterSalesStatusMapper; |
|
|
|
private final IGenerator generator; |
|
|
|
private final IGenerator generator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final WeixinPayService weixinPayService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ApplicationEventPublisher publisher; |
|
|
|
private ApplicationEventPublisher publisher; |
|
|
|
|
|
|
|
|
|
|
@ -95,7 +98,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM |
|
|
|
BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getTruePrice(), cartInfo.getCartNum()); |
|
|
|
BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getTruePrice(), cartInfo.getCartNum()); |
|
|
|
//商品优惠总金额
|
|
|
|
//商品优惠总金额
|
|
|
|
BigDecimal commodityDiscountAmount; |
|
|
|
BigDecimal commodityDiscountAmount; |
|
|
|
if (totalAmountOfGoods.compareTo(BigDecimal.ZERO)==0){ |
|
|
|
if (totalAmountOfGoods.compareTo(BigDecimal.ZERO)==0){ //仅仅用了积分,订单金额是0
|
|
|
|
commodityDiscountAmount=new BigDecimal(0); |
|
|
|
commodityDiscountAmount=new BigDecimal(0); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice()); |
|
|
|
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 storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setChangeType(2); |
|
|
|
storeAfterSalesStatus.setChangeType(2); //发货
|
|
|
|
storeAfterSalesStatus.setChangeMessage("售后订单生成"); |
|
|
|
storeAfterSalesStatus.setChangeMessage("用户退货单已发货生成"); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setOperator("用户操作"); |
|
|
|
storeAfterSalesStatus.setOperator("用户操作"); |
|
|
|
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); |
|
|
|
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); |
|
|
@ -336,9 +339,9 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Object salesCheck(Long salesId, String orderCode, Integer approvalStatus, String consignee, String phoneNumber, String address) { |
|
|
|
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)); |
|
|
|
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()); |
|
|
|
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue()); |
|
|
|
if (storeAfterSales.getServiceType() == 1) { |
|
|
|
if (storeAfterSales.getServiceType() == 1) { //退货退款
|
|
|
|
if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) { |
|
|
|
if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) { |
|
|
|
throw new ErrorRequestException("请输入收货人信息"); |
|
|
|
throw new ErrorRequestException("请输入收货人信息"); |
|
|
|
} |
|
|
|
} |
|
|
@ -350,23 +353,30 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM |
|
|
|
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setChangeType(1); |
|
|
|
storeAfterSalesStatus.setChangeType(1); |
|
|
|
storeAfterSalesStatus.setChangeMessage("平台审核成功"); |
|
|
|
storeAfterSalesStatus.setChangeMessage("平台审核已通过"); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setOperator("admin"); |
|
|
|
storeAfterSalesStatus.setOperator("admin"); |
|
|
|
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); |
|
|
|
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.setState(AfterSalesStatusEnum.STATUS_1.getValue()); |
|
|
|
storeAfterSales.setSalesState(2); |
|
|
|
storeAfterSales.setSalesState(2); |
|
|
|
//操作记录
|
|
|
|
//操作记录
|
|
|
|
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setChangeType(4); |
|
|
|
storeAfterSalesStatus.setChangeType(4); |
|
|
|
storeAfterSalesStatus.setChangeMessage("平台审核失败"); |
|
|
|
storeAfterSalesStatus.setChangeMessage("平台审核未通过"); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setOperator("admin"); |
|
|
|
storeAfterSalesStatus.setOperator("admin"); |
|
|
|
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); |
|
|
|
storeAfterSalesStatusMapper.insert(storeAfterSalesStatus); |
|
|
|
|
|
|
|
|
|
|
|
this.makeMoney(storeAfterSales.getId(),storeAfterSales.getOrderCode()); |
|
|
|
this.makeMoney(storeAfterSales.getId(),storeAfterSales.getOrderCode()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return baseMapper.updateById(storeAfterSales) > 0; |
|
|
|
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 storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode).eq(StoreAfterSales::getId, salesId)); |
|
|
|
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue()); |
|
|
|
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_3.getValue()); |
|
|
|
baseMapper.updateById(storeAfterSales); |
|
|
|
baseMapper.updateById(storeAfterSales); |
|
|
|
//操作记录
|
|
|
|
//操作记录/
|
|
|
|
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
StoreAfterSalesStatus storeAfterSalesStatus = new StoreAfterSalesStatus(); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId()); |
|
|
|
storeAfterSalesStatus.setChangeType(3); |
|
|
|
storeAfterSalesStatus.setChangeType(3); /** 操作类型 0售后订单生成 1后台审核成功 2用户发货 3打款 4审核失败 5用户撤销*/ |
|
|
|
storeAfterSalesStatus.setChangeMessage("平台打款成功"); |
|
|
|
storeAfterSalesStatus.setChangeMessage("平台打款成功"); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now())); |
|
|
|
storeAfterSalesStatus.setOperator("admin"); |
|
|
|
storeAfterSalesStatus.setOperator("admin"); |
|
|
|