Commit f6d924c5 by 胡博文

Merge branch 'feature/aplipay-coupon-bowen-1105' into 'master'

Feature/aplipay coupon bowen 1105

See merge request !128
parents e2cca81f 227d3fd7
......@@ -35,6 +35,14 @@ public class CouponCodeVerificationDto extends CouponCodeBaseDto {
private String channel;
/**
*
*/
private String tradeChannel;
private String tradeNo;
/**
* 会员编号
*/
private String memberId;
......
......@@ -35,6 +35,11 @@ public class PaysuccessNoticeMessage {
* 订单金额
*/
private Integer total_fee;
/**
* 第三方交易流水 (支付宝、微信)
*/
private String thirdPartTradeNo;
/**
* 营业员编号
*/
......
package cn.freemud.enums;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CouponTradeChannelEnum
* @Package cn.freemud.enums
* @Description:
* @author: bowen.hu
* @date: 2021-10-20 15:36
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/
public enum CouponTradeChannelEnum {
WX_TRADE_CHANNEL("WX_TRADE_CHANNEL", "1", "微信交易渠道"),
OTHER_TRADE_CHANNEL("WX_TRADE_CHANNEL", "", "其他交易渠道"),
ALIPAY_TRADE_CHANNEL("ZHIFUBAO_TRADE_CHANNEL", "2", "支付宝渠道");
private String tradeChannel;
private String orderClient;
private String desc;
CouponTradeChannelEnum(String tradeChannel, String orderClient, String desc) {
this.tradeChannel = tradeChannel;
this.orderClient = orderClient;
this.desc = desc;
}
public String getTradeChannel() {
return tradeChannel;
}
public String getOrderClient() {
return orderClient;
}
public String getDesc() {
return desc;
}
public static String getCouponChannel(String orderClient) {
CouponTradeChannelEnum[] values = CouponTradeChannelEnum.values();
for (CouponTradeChannelEnum tradeChannelEnum : values) {
if (tradeChannelEnum.getOrderClient().equals(orderClient)) {
return tradeChannelEnum.getTradeChannel();
}
}
return CouponTradeChannelEnum.OTHER_TRADE_CHANNEL.getTradeChannel();
}
}
......@@ -135,6 +135,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
* @param couponReqType
*/
private BaseResponse commonMethodVerification(CouponCodeVerificationTransDto couponCodeVerificationTransDto, List<AccountBeanV1> accountList, OrderBeanV1 orderBean, CouponReqType couponReqType) {
//orderBean.getOrderClient();
String couponChannel = CouponTradeChannelEnum.getCouponChannel(orderBean.getOrderClient());
for (AccountBeanV1 accountBean : accountList) {
List<CouponCodeVerificationProductDto> products = new ArrayList<>();
//商品券核销核销参数
......@@ -177,7 +180,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
|| OrderAccountType.FREIGHT_COUPON.getCode().equals(accountBean.getType())
|| OrderAccountType.DISCOUNT_COUPON.getCode().equals(accountBean.getType())) {
CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(activityChannelEnum,
CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto (activityChannelEnum,
// 这里是活动code
accountBean.getAccountId(), orderBean.getOid(), orderBean.getCompanyId(),
orderBean.getShopId(), orderBean.getUserId(), products, accountBean.getPrice().intValue(), couponReqType);
......@@ -188,6 +191,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
couponCodeVerificationDto.setOrderDiscountAmount(Math.abs(accountBean.getPrice()));
// 核销券新增参数:组织机构ID
couponCodeVerificationDto.setChannel_ids(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
couponCodeVerificationDto.setTradeNo(orderBean.getThirdPartTradeNo());
couponCodeVerificationDto.setTradeChannel(couponChannel);
boolean ok = false;
Exception lastException = null;
CouponCodeResponseDto couponCodeResponseDto = null;
......
......@@ -557,7 +557,7 @@ public class MallOrderServiceImpl implements MallOrderService {
//支付回掉成功标记
redisCache.save(RedisKeyConstant.KGD_PAYMENT_CALLBACK_FMID + message.getOut_trade_no(), message.getOut_trade_no(), 10L, TimeUnit.MINUTES);
if (message.getSource() != null && message.getSource().equals(PaySuccessSource.OUTSIDE.getSource())) {
verificationCoupon(message.getTrans_id());
verificationCoupon(message.getTrans_id(), message.getThirdPartTradeNo());
}
orderIds.add(orderBean.getOid());
......@@ -967,7 +967,7 @@ public class MallOrderServiceImpl implements MallOrderService {
return afterSalesOrderExtInfoVo;
}
private String verificationCoupon(String transId) {
private String verificationCoupon(String transId, String thirdTradeNo) {
String orderId = redisCache.getValue(RedisUtil.getPaymentTransIdOrderKey(transId));
if (StringUtils.isNotBlank(orderId)) {
transId = orderId;
......@@ -977,6 +977,7 @@ public class MallOrderServiceImpl implements MallOrderService {
return refundFaileMessage("mallOrderService order query fail" + queryOrderByIdResponseDto);
}
OrderBeanV1 orderBean = new OrderBeanV1();
orderBean.setThirdPartTradeNo(thirdTradeNo);
if (1 == queryOrderByIdResponseDto.getData().size()) {
orderBean = queryOrderByIdResponseDto.getData().get(0);
} else {
......
......@@ -513,7 +513,7 @@ public class OrderServiceImpl implements Orderservice {
//支付回调成功标记
redisCache.save(RedisKeyConstant.KGD_PAYMENT_CALLBACK_FMID + message.getOut_trade_no(), message.getOut_trade_no(), 10L, TimeUnit.MINUTES);
if (message.getSource() != null && message.getSource().equals(PaySuccessSource.OUTSIDE.getSource())) {
verificationCoupon(message.getTrans_id());
verificationCoupon(message.getTrans_id(), message.getThirdPartTradeNo());
}
return sendPaySuccessNoticeMessage();
}
......@@ -588,6 +588,7 @@ public class OrderServiceImpl implements Orderservice {
message.setTerminalId(newMessage.getAppId());
message.setRuleId(newMessage.getRuleId());
message.setSource(PaySuccessSource.OUTSIDE.getSource());
message.setThirdPartTradeNo(message.getThirdPartTradeNo());
String res = orderAdapterService.paySuccessCallback(message);
JSONObject jsonObject = JSONObject.parseObject(res);
if (jsonObject.containsKey("code")) {
......@@ -601,7 +602,7 @@ public class OrderServiceImpl implements Orderservice {
return orderAdapter.newSendPayFailedMessage();
}
private String verificationCoupon(String transId) {
private String verificationCoupon(String transId, String thirdPartTradeNo) {
String orderId = redisCache.getValue(RedisUtil.getPaymentTransIdOrderKey(transId));
if (StringUtils.isNotBlank(orderId)) {
transId = orderId;
......@@ -619,6 +620,7 @@ public class OrderServiceImpl implements Orderservice {
orderBean = orderBeans.get(0);
}
}
orderBean.setThirdPartTradeNo(thirdPartTradeNo);
//核销券
BaseResponse baseResponse = couponActivityService.verificationCoupon(orderBean, CouponReqType.WRITEOFF);
return "核销券码返回结果" + baseResponse.getCode() + "," + baseResponse.getMessage();
......
......@@ -38,6 +38,11 @@ public class OrderBeanV1 {
* 是否是父订单
*/
private Boolean isParent;
/**
* 第三方交易流水 (微信单号)
*/
private String thirdPartTradeNo;
/**
* 操作人
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment