修复支付 导出最新sql
This commit is contained in:
@ -29,7 +29,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-pay-api</artifactId>
|
||||
<artifactId>yshop-module-pay-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
@ -35,7 +36,7 @@ public class AppOrderAfterSalesController {
|
||||
@PreAuthenticated
|
||||
@PostMapping("/applyForAfterSales")
|
||||
@Operation(summary = "申请售后")
|
||||
public CommonResult<Boolean> applyForAfterSales(@RequestBody AppStoreAfterSalesParam storeAfterSalesParam) {
|
||||
public CommonResult<Boolean> applyForAfterSales(@Valid @RequestBody AppStoreAfterSalesParam storeAfterSalesParam) {
|
||||
Long uid = getLoginUserId();
|
||||
appStoreAfterSalesService.applyForAfterSales(uid, storeAfterSalesParam);
|
||||
return success(true);
|
||||
@ -100,13 +101,7 @@ public class AppOrderAfterSalesController {
|
||||
Boolean revoke = appStoreAfterSalesService.revoke(key, uid, id);
|
||||
return success(revoke);
|
||||
}
|
||||
//
|
||||
// @PreAuthenticated
|
||||
// @GetMapping(value = "/yxExpress")
|
||||
// @Operation(summary = "查询快递")
|
||||
// public ApiResult<List<YxExpress>> getYxExpresss(YxExpressQueryCriteria criteria) {
|
||||
// return ApiResult.ok(yxExpressService.queryAll(criteria));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@PreAuthenticated
|
||||
|
@ -3,6 +3,7 @@ package co.yixiang.yshop.module.order.controller.app.afterorder.param;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -20,7 +21,7 @@ public class AppStoreAfterSalesParam {
|
||||
/**
|
||||
* 服务类型 0仅退款1退货退款
|
||||
*/
|
||||
@NotBlank
|
||||
//@NotBlank
|
||||
private Integer serviceType;
|
||||
|
||||
/**
|
||||
@ -42,7 +43,7 @@ public class AppStoreAfterSalesParam {
|
||||
/**
|
||||
* 商品数据
|
||||
*/
|
||||
@NotBlank
|
||||
//@NotNull
|
||||
private List<AppProsuctParam> productParamList;
|
||||
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
StoreOrderDO yxStoreOrder = storeOrderMapper.selectOne(Wrappers.<StoreOrderDO>lambdaQuery()
|
||||
.eq(StoreOrderDO::getOrderId, storeAfterSalesParam.getOrderCode())
|
||||
.eq(StoreOrderDO::getUid, userId));
|
||||
System.out.println("storeAfterSalesParam:"+storeAfterSalesParam);
|
||||
afterOrderRedisDAO.set(userId,storeAfterSalesParam.getOrderCode(),yxStoreOrder.getStatus().toString());
|
||||
checkOrder(yxStoreOrder);
|
||||
//商品除去优惠后的总价格
|
||||
@ -162,10 +163,15 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
*/
|
||||
@Override
|
||||
public List<AppStoreOrderCartInfoVo> checkOrderDetails(String key) {
|
||||
List<StoreOrderCartInfoDO> yxStoreOrderCartInfos = storeOrderCartInfoMapper.selectList(Wrappers.<StoreOrderCartInfoDO>lambdaQuery().eq(StoreOrderCartInfoDO::getOid, key));
|
||||
StoreOrderDO yxStoreOrder = storeOrderMapper.selectById(key);
|
||||
List<StoreOrderCartInfoDO> yxStoreOrderCartInfos = storeOrderCartInfoMapper
|
||||
.selectList(Wrappers.<StoreOrderCartInfoDO>lambdaQuery().eq(StoreOrderCartInfoDO::getOrderId, key));
|
||||
if(yxStoreOrderCartInfos == null || yxStoreOrderCartInfos.isEmpty()){
|
||||
throw exception(STORE_ORDER_NOT_EXISTS);
|
||||
}
|
||||
StoreOrderDO yxStoreOrder = storeOrderMapper.selectById(yxStoreOrderCartInfos.get(0).getId());
|
||||
//查询 售后信息
|
||||
StoreAfterSalesDO storeAfterSales = this.baseMapper.selectOne(Wrappers.<StoreAfterSalesDO>lambdaQuery().eq(StoreAfterSalesDO::getOrderCode, yxStoreOrder.getOrderId()));
|
||||
StoreAfterSalesDO storeAfterSales = this.baseMapper.selectOne(Wrappers.<StoreAfterSalesDO>lambdaQuery()
|
||||
.eq(StoreAfterSalesDO::getOrderCode, yxStoreOrder.getOrderId()));
|
||||
List<AppStoreOrderCartInfoVo> yxStoreOrderCartInfoVos = new ArrayList<>();
|
||||
for (StoreOrderCartInfoDO yxStoreOrderCartInfo : yxStoreOrderCartInfos) {
|
||||
|
||||
@ -182,11 +188,14 @@ public class AppStoreAfterSalesServiceImpl extends ServiceImpl<StoreAfterSalesMa
|
||||
//商品优惠前总金额
|
||||
BigDecimal totalAmountOfGoods = NumberUtil.mul(cartInfo.getTruePrice(), cartInfo.getCartNum());
|
||||
//商品优惠总金额
|
||||
BigDecimal commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods, NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice());
|
||||
// BigDecimal commodityDiscountAmount = BigDecimal.ZERO;
|
||||
// if()
|
||||
BigDecimal commodityDiscountAmount = NumberUtil.mul(NumberUtil.div(totalAmountOfGoods,
|
||||
NumberUtil.sub(yxStoreOrder.getTotalPrice(), yxStoreOrder.getPayPostage())), yxStoreOrder.getCouponPrice());
|
||||
|
||||
yxStoreOrderCartInfoVo.setRefundablePrice(NumberUtil.sub(totalAmountOfGoods, commodityDiscountAmount));
|
||||
|
||||
yxStoreOrderCartInfoVo.setReasons(storeAfterSales.getReasons());
|
||||
//yxStoreOrderCartInfoVo.setReasons(storeAfterSales.getReasons());
|
||||
yxStoreOrderCartInfoVos.add(yxStoreOrderCartInfoVo);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,9 @@ import co.yixiang.yshop.module.order.enums.*;
|
||||
import co.yixiang.yshop.module.order.service.storeorder.dto.*;
|
||||
import co.yixiang.yshop.module.order.service.storeordercartinfo.StoreOrderCartInfoService;
|
||||
import co.yixiang.yshop.module.order.service.storeorderstatus.StoreOrderStatusService;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchantdetails.MerchantDetailsDO;
|
||||
import co.yixiang.yshop.module.pay.mq.producer.PayNoticeProducer;
|
||||
import co.yixiang.yshop.module.pay.service.merchantdetails.MerchantDetailsService;
|
||||
import co.yixiang.yshop.module.product.controller.app.cart.vo.AppStoreCartQueryVo;
|
||||
import co.yixiang.yshop.module.product.controller.app.product.vo.AppStoreProductRespVo;
|
||||
import co.yixiang.yshop.module.product.dal.dataobject.shippingtemplates.ShippingTemplatesDO;
|
||||
@ -70,7 +72,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -122,6 +126,8 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper,Store
|
||||
private WeixinNoticeProducer weixinNoticeProducer;
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
@Resource
|
||||
private MerchantDetailsService merchantDetailsService;
|
||||
|
||||
private static final String LOCK_KEY = "cart:check:stock:lock";
|
||||
private static final String STOCK_LOCK_KEY = "cart:do:stock:lock";
|
||||
@ -419,27 +425,44 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper,Store
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
switch (PayTypeEnum.toType(param.getPaytype())){
|
||||
case WEIXIN:
|
||||
if(AppFromEnum.WEIXIN_H5.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("3", "MWEB", "h5商品购买",
|
||||
if(AppFromEnum.H5.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("4", "MWEB", "h5商品购买",
|
||||
"h5商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
map.put("data",manager.getOrderInfo(payOrder));
|
||||
|
||||
Map<String, Object> payOrderInfo = manager.getOrderInfo(payOrder);
|
||||
MerchantDetailsDO merchantDetailsDO = merchantDetailsService.getMerchantDetails("4");
|
||||
//System.out.println("merchantDetailsDO:"+merchantDetailsDO);
|
||||
String url = merchantDetailsDO.getReturnUrl();
|
||||
|
||||
String newUrl = "";
|
||||
try {
|
||||
newUrl = String.format("%s%s", payOrderInfo.get("mweb_url"), "&redirect_url=" + URLEncoder.encode(url,"UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e.getMessage());
|
||||
// e.printStackTrace();
|
||||
}
|
||||
map.put("data",newUrl);
|
||||
} else if(AppFromEnum.ROUNTINE.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("3", "JSAPI", "小程序商品购买",
|
||||
"小程序商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
payOrder.setOpenid(memberUserDO.getWxProfile().getRoutineOpenid());
|
||||
|
||||
//System.out.println(manager.getOrderInfo(payOrder));
|
||||
payOrder.setOpenid(memberUserDO.getRoutineOpenid());
|
||||
// System.out.println("payOrder:"+manager.getOrderInfo(payOrder));
|
||||
//log.error();
|
||||
map.put("data",manager.getOrderInfo(payOrder));
|
||||
|
||||
}else if(AppFromEnum.APP.getValue().equals(param.getFrom())){
|
||||
//app支付
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("3", "APP", "APP商品购买",
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("5", "APP", "APP商品购买",
|
||||
"APP5商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
map.put("data",manager.getOrderInfo(payOrder));
|
||||
map.put("data",manager.app(payOrder));
|
||||
|
||||
}else{//公众号
|
||||
//detailId 是后台数据库添加当服务商id
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("3", "JSAPI", "公众号商品购买",
|
||||
"公众号商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
payOrder.setOpenid(memberUserDO.getWxProfile().getOpenid());
|
||||
payOrder.setOpenid(memberUserDO.getOpenid());
|
||||
map.put("data",manager.getOrderInfo(payOrder));
|
||||
}
|
||||
break;
|
||||
@ -448,11 +471,16 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper,Store
|
||||
map.put("status","ok");
|
||||
break;
|
||||
case ALI:
|
||||
//小程序支付
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "MINAPP", "小程序商品购买",
|
||||
"小程序商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
// payOrder.setOpenid(memberUserDO.getWxProfile().getOpenid());
|
||||
map.put("data",manager.getOrderInfo(payOrder));
|
||||
//h5支付
|
||||
if(AppFromEnum.H5.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "WAP", "支付宝H5商品购买",
|
||||
"h5商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
map.put("data",manager.toPay(payOrder));
|
||||
}else if(AppFromEnum.APP.getValue().equals(param.getFrom())){
|
||||
MerchantPayOrder payOrder = new MerchantPayOrder("1", "APP", "支付宝APP商品购买",
|
||||
"支付宝APP5商品购买", orderInfo.getPayPrice(), param.getUni());
|
||||
map.put("data",manager.app(payOrder));
|
||||
}
|
||||
|
||||
default:
|
||||
}
|
||||
@ -922,7 +950,7 @@ public class AppStoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper,Store
|
||||
refundOrder.setOrderDate(new Date());
|
||||
refundOrder.setRefundAmount(price);
|
||||
refundOrder.setRefundNo(refundNo);
|
||||
refundOrder.setTotalAmount(orderQueryVo.getTotalPrice());
|
||||
refundOrder.setTotalAmount(orderQueryVo.getPayPrice());
|
||||
refundOrder.setOutTradeNo(orderQueryVo.getOrderId());
|
||||
RefundResult refundResult = null;
|
||||
if(PayTypeEnum.WEIXIN.getValue().equals(orderQueryVo.getPayType())) {
|
||||
|
Reference in New Issue
Block a user