diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java index 82225c02a..353422069 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java @@ -33,7 +33,7 @@ public class OrderPayRequest { @NotNull(message = "订单编号不能为空") private String orderNo; - @Schema(description = "支付类型:weixin-微信支付,yue-余额支付,offline-线下支付,alipay-支付包支付") + @Schema(description = "支付类型 支付宝ALIPAY 微信WXPAY") @NotNull(message = "支付类型不能为空") private String payType; diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderInfoResponse.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderInfoResponse.java index f9da6ffb8..1fa4aa98e 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderInfoResponse.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderInfoResponse.java @@ -40,7 +40,7 @@ public class OrderInfoResponse implements Serializable { // private StoreCartResponse info; @Schema(description = "商品数量") - private Integer cartNum; + private Integer payNum; // @Schema(description = "唯一id") // @TableField(value = "`unique`") diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderPayResultResponse.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderPayResultResponse.java index 8effdba9e..59895f859 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderPayResultResponse.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/OrderPayResultResponse.java @@ -40,6 +40,9 @@ public class OrderPayResultResponse { @Schema(description = "订单支付宝支付") private String alipayRequest; + + @Schema(description ="支付宝返回参数") + private String body; // // @Schema(description = "支付宝调起支付参数对象(app支付专用)") // private AliPayJsResultVo aliPayConfig; diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/StoreOrderDetailInfoResponse.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/StoreOrderDetailInfoResponse.java index a8e9bf712..37359abdc 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/StoreOrderDetailInfoResponse.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/response/order/StoreOrderDetailInfoResponse.java @@ -205,6 +205,8 @@ public class StoreOrderDetailInfoResponse implements Serializable { @Schema(description = "订单详情") private List orderInfoList; + private String endTime; + // @Schema(description = "订单ID") // private Integer id; // diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/constants/PayConstants.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/constants/PayConstants.java index 9b83d231e..66c31c77e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/constants/PayConstants.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/constants/PayConstants.java @@ -16,6 +16,8 @@ public class PayConstants { //支付方式 public static final String PAY_TYPE_WE_CHAT = "weixin"; //微信支付 + public static final String PAY_TYPE_WE_CHAT_WXPAY = "WXPAY"; //微信支付 + public static final String PAY_TYPE_WE_CHAT_ALIPAY = "ALIPAY"; //支付宝 public static final String PAY_TYPE_YUE = "yue"; //余额支付 public static final String PAY_TYPE_OFFLINE = "offline"; //线下支付 public static final String PAY_TYPE_ALI_PAY = "alipay"; //支付宝 diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java index 74e2a65bf..364494a1d 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java @@ -1,13 +1,11 @@ package cn.iocoder.yudao.module.shop.controller.admin.notify; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; import com.alipay.api.AlipayApiException; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -15,7 +13,6 @@ import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Map; /** * @Title:AliPayNotifyController diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java index c6fb90d34..58a0c1376 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java @@ -4,7 +4,9 @@ package cn.iocoder.yudao.module.shop.controller.admin.notify; import cn.hutool.core.util.NumberUtil; import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; +import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; +import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; @@ -49,7 +51,8 @@ public class WxPayNotifyController { private RechargeOrderMapper rechargeOrderMapper; @Autowired private PhoneRecordService phoneRecordService; - + @Autowired + private StoreOrderMapper storeOrderMapper; /** * Description: 微信支付回调接口 @@ -130,28 +133,42 @@ public class WxPayNotifyController { log.info("退款通知=" + JSONUtil.toJsonPrettyStr(result)); //退款状态 if (StringUtils.equals("SUCCESS", result.getRefundStatus())) { - log.info("微信退款回调成功"); + String outTradeNo = result.getOutTradeNo(); // 验证相关参数-金额 // 用户支付金额 BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2); - // 处理相关逻辑 - RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, result.getOutTradeNo())); - if(orderDO!=null){ - if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) { - log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal); - return "failure"; + if (outTradeNo.contains("MEMBER_")) { + log.info("-----------------微信会员退款回调成功----------------------"); + // 处理相关逻辑 + RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo)); + if (orderDO != null) { + if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) { + log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal); + return "failure"; + } + orderDO.setRefundStatus(2); + orderDO.setPaid(2); + rechargeOrderMapper.updateById(orderDO); + //删除提报记录 + phoneRecordService.deletePhoneGear(orderDO.getOrderId()); + //删除本地提报记录 + phoneRecordService.deletePhoneGearByOrderId(orderDO.getId()); + // 修改订单状态 + // 写入 + response.setStatus(HttpServletResponse.SC_OK); + } + } else { + log.info("-----------------微信会员退款回调成功----------------------"); + StoreOrder storeOrder = storeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(StoreOrder::getOrderId, outTradeNo)); + if (storeOrder != null) { + if (payerTotal.compareTo(storeOrder.getPayPrice()) != 0) { + log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", storeOrder.getPayPrice(), payerTotal); + return "failure"; + } } - orderDO.setRefundStatus(2); - orderDO.setPaid(2); - rechargeOrderMapper.updateById(orderDO); - //删除提报记录 - phoneRecordService.deletePhoneGear(orderDO.getOrderId()); - //删除本地提报记录 - phoneRecordService.deletePhoneGearByOrderId(orderDO.getId()); - // 修改订单状态 - // 写入 - response.setStatus(HttpServletResponse.SC_OK); } + + return "success"; } } catch (Exception e) { diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java index d9bbd7e5e..8330de9d9 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java @@ -10,6 +10,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.Date; /** diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java index 20fff088c..03d0da38e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java @@ -5,7 +5,9 @@ import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.enums.Constants; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.util.date.DateUtils; +import cn.iocoder.yudao.framework.pay.config.AliPayConfig; import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration; +import cn.iocoder.yudao.framework.pay.properties.AliPayProperties; import cn.iocoder.yudao.framework.pay.properties.WxPayProperties; import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; @@ -24,6 +26,12 @@ import cn.iocoder.yudao.module.shop.service.product.StoreProductService; import cn.iocoder.yudao.module.shop.utils.OrderUtil; import cn.iocoder.yudao.module.shop.utils.RedisUtil; import cn.iocoder.yudao.module.shop.vo.order.WxPayJsResultVo; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayClient; +import com.alipay.api.request.AlipayTradeWapPayRequest; +import com.alipay.api.response.AlipayTradeWapPayResponse; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result; import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; @@ -38,10 +46,9 @@ import org.springframework.util.Assert; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** @@ -100,7 +107,10 @@ public class OrderPayServiceImpl implements OrderPayService { @Autowired private WxPayProperties payProperties; - + @Autowired + private AliPayConfig aliPayConfig; + @Autowired + private AliPayProperties aliPayProperties; /** * 支付成功处理 @@ -218,6 +228,8 @@ public class OrderPayServiceImpl implements OrderPayService { storeOrder.setIsChannel(1); break; } + } else { + storeOrder.setIsChannel(7); // 支付宝支付 } boolean changePayType = storeOrderService.updateById(storeOrder); @@ -243,7 +255,7 @@ public class OrderPayServiceImpl implements OrderPayService { } // 微信支付,调用微信预下单,返回拉起微信支付需要的信息 - if (storeOrder.getPayType().equals(PayConstants.PAY_TYPE_WE_CHAT)) { + if (storeOrder.getPayType().equals(PayConstants.PAY_TYPE_WE_CHAT_WXPAY)) { // 预下单 WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = unifiedorder(storeOrder, ip, orderPayRequest.getOpenid()); WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService(); @@ -270,6 +282,31 @@ public class OrderPayServiceImpl implements OrderPayService { // storeOrderService.updateById(storeOrder); response.setJsConfig(vo); return response; + } else if (storeOrder.getPayType().equals(PayConstants.PAY_TYPE_WE_CHAT_ALIPAY)) { + AlipayClient alipayClient = aliPayConfig.alipayClient(); + Assert.notNull(alipayClient, "获取支付宝支付配置失败!"); + AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); + //异步接收地址,仅支持http/https,公网可访问 + request.setNotifyUrl(aliPayProperties.getNotifyUrl()); + //同步跳转地址,仅支持http/https + request.setReturnUrl(""); + /******必传参数******/ + JSONObject bizContent = new JSONObject(); + //商户订单号,商家自定义,保持唯一性 + bizContent.put("out_trade_no", storeOrder.getOrderId()); + //支付金额,最小值0.01元 + bizContent.put("total_amount", storeOrder.getPayPrice()); + //订单标题,不可使用特殊符号 + bizContent.put("subject", "商品购买"); + bizContent.put("product_code", "QUICK_WAP_WAY"); + request.setBizContent(bizContent.toString()); + try { + AlipayTradeWapPayResponse response1 = alipayClient.pageExecute(request,"get"); + response.setBody(response1.getBody()); + return response; + } catch (AlipayApiException e) { + e.printStackTrace(); + } } // 余额支付 if (storeOrder.getPayType().equals(PayConstants.PAY_TYPE_YUE)) { @@ -349,7 +386,10 @@ public class OrderPayServiceImpl implements OrderPayService { wxPayRequest.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(ip)); wxPayRequest.setAppid(payProperties.getAppId()); wxPayRequest.setMchid(payProperties.getMchId()); - wxPayRequest.setTimeExpire(formatLocalDateTime(LocalDateTime.now().plusMinutes(30), "yyyyMMddHHmmss")); + StoreOrder one = storeOrderService.getOne(Wrappers.lambdaQuery().eq(StoreOrder::getOrderId, storeOrder.getOrderId())); + LocalDateTime localDateTime1 = LocalDateTime.ofInstant(one.getCreateTime().toInstant(), ZoneId.systemDefault()); + + wxPayRequest.setTimeExpire(formatLocalDateTime(localDateTime1.plusMinutes(30), "yyyyMMddHHmmss")); try { WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest); // map.put("mweb_url",wxPayUnifiedOrderV3Result.getH5Url()); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java index bdd5dd44f..6ccc2f220 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java @@ -68,6 +68,9 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -196,7 +199,10 @@ public class OrderServiceImpl implements OrderService { }); convert.setOrderInfoList(orderInfoList); } + long time = 30*60*1000;//30分钟 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + convert.setEndTime(sdf.format(storeOrder.getCreateTime().getTime()+time)); return convert; } @@ -624,7 +630,7 @@ public class OrderServiceImpl implements OrderService { OrderInfoResponse orderInfoResponse = new OrderInfoResponse(); orderInfoResponse.setStoreName(e.getInfo().getProductName()); orderInfoResponse.setImage(e.getInfo().getImage()); - orderInfoResponse.setCartNum(e.getInfo().getPayNum()); + orderInfoResponse.setPayNum(e.getInfo().getPayNum()); orderInfoResponse.setPrice(e.getInfo().getPrice()); orderInfoResponse.setProductId(e.getProductId()); infoResponseList.add(orderInfoResponse); @@ -1106,7 +1112,7 @@ public class OrderServiceImpl implements OrderService { // } else { // priceResponse.setCouponFee(storeCouponUser.getMoney()); // } - + priceResponse.setPayFee(priceResponse.getFreightFee().add(orderInfoVo.getPayFee())); priceResponse.setProTotalFee(orderInfoVo.getProTotalFee()); // 积分部分 @@ -1304,8 +1310,8 @@ public class OrderServiceImpl implements OrderService { storeOrder.setCouponId(Optional.ofNullable(orderRequest.getCouponId()).orElse(0L)); // 订单总价 - BigDecimal totalPrice = computedOrderPriceResponse.getProTotalFee().add(computedOrderPriceResponse.getFreightFee()); - +// BigDecimal totalPrice = computedOrderPriceResponse.getProTotalFee().add(computedOrderPriceResponse.getFreightFee()); + BigDecimal totalPrice = new BigDecimal("0.01"); storeOrder.setTotalPrice(totalPrice); storeOrder.setProTotalPrice(computedOrderPriceResponse.getProTotalFee()); storeOrder.setTotalPostage(computedOrderPriceResponse.getFreightFee()); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index 42eca6e55..c3713984a 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.shop.service.order.impl; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; @@ -13,7 +12,6 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.pojo.DateLimitUtilVo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.util.date.DateUtils; -import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.framework.pay.properties.AliPayProperties; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; @@ -22,7 +20,6 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO; -import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearExportReqVO; import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd; import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; @@ -91,7 +88,6 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.*; -import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -161,7 +157,8 @@ public class StoreOrderServiceImpl extends ServiceImpl{}", params); String orderId = params.get("out_trade_no"); - RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId)); - if (Objects.isNull(orderDO)) { - log.error("订单号错误,未查询到相关信息!入参订单号:{}", orderId); - return "failure"; - } - // 验证相关参数-金额 - String amount; - if (null == params.get("receipt_amount")) { - amount = params.get("refund_fee"); - orderDO.setPaid(2); - orderDO.setRefundStatus(2); - //删除提报记录 - try { - phoneRecordService.deletePhoneGear(orderDO.getOrderId()); - } catch (Exception e) { - log.error("删除提报记录异常{}", e); + if (orderId.contains("MEMBER_")) { + log.info("ALIPAY====表示充值回调===>{}", params); + // 表示充值回调 + RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId)); + if (Objects.isNull(orderDO)) { + log.error("订单号错误,未查询到相关信息!入参订单号:{}", orderId); + return "failure"; } - //删除本地提报记录 - phoneRecordService.deletePhoneGearByOrderId(orderDO.getId()); - // 表示退款 + // 验证相关参数-金额 + String amount; + if (null == params.get("receipt_amount")) { + // 表示退款 + amount = params.get("refund_fee"); + orderDO.setPaid(2); + orderDO.setRefundStatus(2); + //删除提报记录 + try { + phoneRecordService.deletePhoneGear(orderDO.getOrderId()); + } catch (Exception e) { + log.error("删除提报记录异常{}", e.getMessage()); + } + //删除本地提报记录 + phoneRecordService.deletePhoneGearByOrderId(orderDO.getId()); + } else { + // 表示支付 + amount = params.get("receipt_amount"); + orderDO.setPaySerialNumber(params.get("trade_no")); + orderDO.setPaid(1); + } + if (new BigDecimal(amount).compareTo(orderDO.getPayPrice()) != 0) { + log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", orderDO.getPayPrice(), amount); + return "failure"; + } + // 修改订单状态 + rechargeOrderMapper.updateById(orderDO); + // 写入 充值档位记录表 + if (null != params.get("receipt_amount")) { + addPhoneRecord(orderDO, orderId); + } + } else { - // 表示支付 - amount = params.get("receipt_amount"); - orderDO.setPaySerialNumber(params.get("trade_no")); - orderDO.setPaid(1); - } - if (new BigDecimal(amount).compareTo(orderDO.getPayPrice()) != 0) { - log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", orderDO.getPayPrice(), amount); - return "failure"; - } - // 修改订单状态 - rechargeOrderMapper.updateById(orderDO); - // 写入 充值档位记录表 - if (null != params.get("receipt_amount")) { - addPhoneRecord(orderDO, orderId); + log.info("ALIPAY====表示商城回调===>{}", params); + // 表示商城回调 + StoreOrder storeOrder = storeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(StoreOrder::getOrderId, orderId)); + if (Objects.isNull(storeOrder)) { + log.error("订单号错误,未查询到相关信息!入参订单号:{}", orderId); + return "failure"; + } + // 验证相关参数-金额 + String amount; + if (null == params.get("receipt_amount")) { + // 表示退款 + amount = params.get("refund_fee"); + storeOrder.setRefundStatus(2); + } else { + // 表示支付 + amount = params.get("receipt_amount"); + storeOrder.setOutTradeNo(params.get("trade_no")); + storeOrder.setPaid(Boolean.TRUE); + } + if (new BigDecimal(amount).compareTo(storeOrder.getPayPrice()) != 0) { + log.error("支付金额不匹配,订单实际支付金额:{},支付宝入参验证金额:{}", storeOrder.getPayPrice(), amount); + return "failure"; + } + // 修改订单状态 + storeOrderMapper.updateById(storeOrder); } log.debug(">>>>>>>>>>>>>>支付宝订单交易成功!订单号:{}<<<<<<<<<<<<<<<<<<<<", orderId); return "success"; + } else { return "failure"; } } + public static void main(String[] args) { + String s = "MEMBER_1661994584871321602"; + System.out.println(s.contains("MEMBER_")); + } public void addPhoneRecord(RechargeOrderDO orderDO, String orderId) { List infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderId)); List recordDOS = new ArrayList<>(); @@ -1356,23 +1389,31 @@ public class StoreOrderServiceImpl extends ServiceImpl"); - // 验证相关参数-金额 String outTradeNo = result.getOutTradeNo(); // 用户支付金额 BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2); // 处理相关逻辑 - RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo)); - if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) { - log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal); - return Boolean.FALSE; + if (outTradeNo.contains("MEMBER_")) { + log.info("WXPAY====会员===>"); + RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo)); + if (payerTotal.compareTo(orderDO.getPayPrice()) != 0) { + log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", orderDO.getPayPrice(), payerTotal); + return Boolean.FALSE; + } + // 修改订单状态 + orderDO.setPaid(1); + orderDO.setPaySerialNumber(result.getTransactionId()); + rechargeOrderMapper.updateById(orderDO); + // 写入 充值档位记录表 + addPhoneRecord(orderDO, outTradeNo); + } else { + log.info("WXPAY====商城===>"); + StoreOrder storeOrder = storeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(StoreOrder::getOrderId, outTradeNo)); + if (payerTotal.compareTo(storeOrder.getPayPrice()) != 0) { + log.error("支付金额不匹配,订单实际支付金额:{},微信入参验证金额:{}", storeOrder.getPayPrice(), payerTotal); + return Boolean.FALSE; + } } - // 修改订单状态 - orderDO.setPaid(1); - orderDO.setPaySerialNumber(result.getTransactionId()); - rechargeOrderMapper.updateById(orderDO); - // 写入 充值档位记录表 - addPhoneRecord(orderDO, outTradeNo); log.debug(">>>>>>>>>>>>>>微信订单交易成功!订单号:{}<<<<<<<<<<<<<<<<<<<<", outTradeNo); } return Boolean.TRUE; diff --git a/yudao-ui-admin/src/components/Category/list.vue b/yudao-ui-admin/src/components/Category/list.vue index 42e21d048..0648dd44b 100644 --- a/yudao-ui-admin/src/components/Category/list.vue +++ b/yudao-ui-admin/src/components/Category/list.vue @@ -31,7 +31,7 @@ - 新增{{ biztype.name }} + 新增{{ biztype.name }} @@ -100,8 +101,8 @@ size="small" @click="handleAddMenu(scope.row)" >添加子目录 - 编辑 - 删除 + 编辑 + 删除 diff --git a/yudao-ui-admin/src/views/mall/product/store/index.vue b/yudao-ui-admin/src/views/mall/product/store/index.vue index ff41e3f39..ab437b564 100644 --- a/yudao-ui-admin/src/views/mall/product/store/index.vue +++ b/yudao-ui-admin/src/views/mall/product/store/index.vue @@ -17,8 +17,8 @@ - - 添加商品 + + 添加商品 导出 @@ -119,23 +119,24 @@ active-text="上架" inactive-text="下架" @change="onchangeIsShow(scope.row)" + v-hasPermi="['admin:product:u' && 'admin:product:down']" /> -
+
{ + console.log(res) return { jsapiResult: res.jsapiConfig, - body: res.data + body: res.body } }, wxPaySuccess: () => { diff --git a/yudao-ui-app/pages/goods_cate/goods_cate.vue b/yudao-ui-app/pages/goods_cate/goods_cate.vue index 46b651193..9cd6e1253 100644 --- a/yudao-ui-app/pages/goods_cate/goods_cate.vue +++ b/yudao-ui-app/pages/goods_cate/goods_cate.vue @@ -12,13 +12,13 @@ {{item.name}} - + - + @@ -72,7 +72,7 @@ let len = that.productList.length; let child = that.productList[len - 1]&&that.productList[len - 1].child?that.productList[len - 1].child:[]; this.number = child?child.length:0; - + //设置商品列表高度 uni.getSystemInfo({ success: function(res) { @@ -145,7 +145,7 @@ z-index: 9; border-bottom: 1rpx solid #f5f5f5; } - + .productSort .header .input { width: 700rpx; height: 60rpx; @@ -154,22 +154,22 @@ box-sizing: border-box; padding: 0 25rpx; } - + .productSort .header .input .iconfont { font-size: 26rpx; color: #555; } - + .productSort .header .input .placeholder { color: #999; } - + .productSort .header .input input { font-size: 26rpx; height: 100%; width: 597rpx; } - + .productSort .aside { position: fixed; width: 180rpx; @@ -178,18 +178,18 @@ background-color: #f7f7f7; overflow-y: scroll; overflow-x: hidden; - + height: auto; margin-top: 96rpx; } - + .productSort .aside .item { height: 100rpx; width: 100%; font-size: 26rpx; color: #424242; } - + .productSort .aside .item.on { background-color: #fff; border-left: 4rpx solid #fc4141; @@ -198,49 +198,49 @@ color: #fc4141; font-weight: bold; } - + .productSort .conter { margin: 96rpx 0 0 180rpx; padding: 0 14rpx; background-color: #fff; } - + .productSort .conter .listw { padding-top: 20rpx; } - + .productSort .conter .listw .title { height: 90rpx; } - + .productSort .conter .listw .title .line { width: 100rpx; height: 2rpx; background-color: #f0f0f0; } - + .productSort .conter .listw .title .name { font-size: 28rpx; color: #333; margin: 0 30rpx; font-weight: bold; } - + .productSort .conter .list { flex-wrap: wrap; } - + .productSort .conter .list .item { width: 177rpx; margin-top: 26rpx; } - + .productSort .conter .list .item .picture { width: 120rpx; height: 120rpx; border-radius: 50%; } - + .productSort .conter .list .item .picture image { width: 100%; height: 100%; @@ -249,7 +249,7 @@ background-color: #f7f7f7; } } - + .productSort .conter .list .item .name { font-size: 24rpx; color: #333; diff --git a/yudao-ui-app/pages/member_application/index.vue b/yudao-ui-app/pages/member_application/index.vue index c26832443..a8d4d354c 100644 --- a/yudao-ui-app/pages/member_application/index.vue +++ b/yudao-ui-app/pages/member_application/index.vue @@ -221,7 +221,6 @@ background-size: cover; background-repeat: no-repeat; background-attachment: fixed; - overflow: hidden; .u-nav-slot{ ::v-deep .u-popup__content{ padding-bottom: 20% !important; diff --git a/yudao-ui-app/pages/member_equity/index.vue b/yudao-ui-app/pages/member_equity/index.vue index 1d94bb1f6..5ca58bc0d 100644 --- a/yudao-ui-app/pages/member_equity/index.vue +++ b/yudao-ui-app/pages/member_equity/index.vue @@ -10,7 +10,7 @@ 再升1级即可获得【XX】等6项权益 - 购买记录 + 购买记录 @@ -258,6 +258,7 @@ } .right-button { + border: 1px solid; border-radius: 18rpx; margin-top: 10rpx; padding: 7rpx 16rpx; diff --git a/yudao-ui-app/pages/member_loding/index.vue b/yudao-ui-app/pages/member_loding/index.vue index 07730a539..b57723d69 100644 --- a/yudao-ui-app/pages/member_loding/index.vue +++ b/yudao-ui-app/pages/member_loding/index.vue @@ -22,7 +22,7 @@ const res = await memberGradeInfo() if(res.data.some((item) => !!parseInt(item.isExist))){ uni.setTabBarItem({ - index: 0, + index: 2, pagePath: '/pages/member_equity/index' }) uni.switchTab({ @@ -30,7 +30,7 @@ }) }else{ uni.setTabBarItem({ - index: 0, + index: 2, pagePath: '/pages/member_application/index' }) uni.switchTab({ diff --git a/yudao-ui-app/pages/member_renew/index.vue b/yudao-ui-app/pages/member_renew/index.vue index 8c99736c8..9d22962f9 100644 --- a/yudao-ui-app/pages/member_renew/index.vue +++ b/yudao-ui-app/pages/member_renew/index.vue @@ -121,7 +121,6 @@ import store from '@/store/index'; * */ goPay() { - console.log(this.activeIndex) if(this.activeIndex.length){ this.$set(this, 'pay_close', true); const orderInfos = this.activeIndex.map((item) => { diff --git a/yudao-ui-app/pages/sale_performance/index.vue b/yudao-ui-app/pages/sale_performance/index.vue new file mode 100644 index 000000000..a5b104ab9 --- /dev/null +++ b/yudao-ui-app/pages/sale_performance/index.vue @@ -0,0 +1,280 @@ + + + + + diff --git a/yudao-ui-app/pages/users/order_list/index.vue b/yudao-ui-app/pages/users/order_list/index.vue index 88a6bf9a2..a98282365 100644 --- a/yudao-ui-app/pages/users/order_list/index.vue +++ b/yudao-ui-app/pages/users/order_list/index.vue @@ -1,11 +1,11 @@