v1.1 chargeProd和chargeRecord加上国家和货币代码

This commit is contained in:
2022-10-10 16:44:20 +08:00
parent 8a143eea33
commit 54fca0f6a6
6 changed files with 63 additions and 8 deletions

View File

@@ -9,6 +9,8 @@ public class ChargeProd {
private Byte prodStatus;
private String country;
private Long money;
private Integer changeGoldRate;
@@ -55,6 +57,14 @@ public class ChargeProd {
this.prodStatus = prodStatus;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public Long getMoney() {
return money;
}

View File

@@ -23,6 +23,12 @@ public class ChargeRecord {
private Long amount;
private String country;
private String localCurrencyCode;
private Long localAmount;
private Long totalGold;
private String clientIp;
@@ -129,6 +135,30 @@ public class ChargeRecord {
this.amount = amount;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getLocalCurrencyCode() {
return localCurrencyCode;
}
public void setLocalCurrencyCode(String localCurrencyCode) {
this.localCurrencyCode = localCurrencyCode;
}
public Long getLocalAmount() {
return localAmount;
}
public void setLocalAmount(Long localAmount) {
this.localAmount = localAmount;
}
public Long getTotalGold() {
return totalGold;
}

View File

@@ -75,7 +75,7 @@
</where>
</sql>
<sql id="Base_Column_List">
charge_prod_id, prod_name, prod_desc, prod_status, money, change_gold_rate, gift_gold_num,
charge_prod_id, prod_name, prod_desc, prod_status, country, money, change_gold_rate, gift_gold_num,
first_gift_gold_num, channel, seq_no, charge_gold_num
</sql>
<select id="selectByExample" resultMap="BaseResultMap"

View File

@@ -333,6 +333,15 @@
<if test="record.amount != null">
amount = #{record.amount,jdbcType=BIGINT},
</if>
<if test="record.country != null">
country = #{record.country,jdbcType=VARCHAR},
</if>
<if test="record.localCurrencyCode != null">
local_currency_ode = #{record.localCurrencyCode,jdbcType=VARCHAR},
</if>
<if test="record.localAmount != null">
local_amount = #{record.localAmount,jdbcType=BIGINT},
</if>
<if test="record.totalGold != null">
total_gold = #{record.totalGold,jdbcType=BIGINT},
</if>

View File

@@ -518,7 +518,7 @@ public class ChargeService extends BaseService {
// 加锁逻辑
int waitSecondTime = 10;
lockResult =
jedisLockService.lock(RedisKey.lock_joinpay_notify.getKey(orderNo), waitSecondTime * 1000);
jedisLockService.lock(RedisKey.lock_pay_callback_notify.getKey(orderNo), waitSecondTime * 1000);
if (org.apache.commons.lang3.StringUtils.isEmpty(lockResult)) {
log.warn("订单 {} 处理中,请稍候", orderNo);
return;
@@ -538,7 +538,7 @@ public class ChargeService extends BaseService {
throw new BusinessException("回调处理用户钱包和账单记录异常", e);
} finally {
if (org.apache.commons.lang3.StringUtils.isNotBlank(lockResult)) {
jedisLockService.unlock(RedisKey.lock_joinpay_notify.getKey(orderNo), lockResult);
jedisLockService.unlock(RedisKey.lock_pay_callback_notify.getKey(orderNo), lockResult);
}
}
}

View File

@@ -17,6 +17,7 @@ import com.accompany.payment.model.ChargeProd;
import com.accompany.payment.model.ChargeRecord;
import com.accompany.payment.service.ChargeProdService;
import com.accompany.payment.service.ChargeRecordService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.api.services.androidpublisher.model.ProductPurchase;
import lombok.extern.slf4j.Slf4j;
@@ -49,10 +50,6 @@ public class GooglePlayBillingService {
@Autowired
private UsersBaseService usersBaseService;
protected String getPayChannel() {
return Constant.ChargeChannel.google_play_billing;
}
public AppInnerPayRecordDTO placeOrder(Long uid, String chargeProdId, String clientIp, String deviceId) {
validMoneyLimit(uid, chargeProdId);
@@ -183,7 +180,16 @@ public class GooglePlayBillingService {
throw new ServiceException(BusiStatus.RECORD_NOT_EXIST);
}
chargeRecord.setPingxxChargeId(purchase.getOrderId());
Map profileMap = JSON.parseObject((String) purchase.get("obfuscatedExternalProfileId"));
String currencyCode = (String) profileMap.get("c");
Integer localAmount = (Integer) profileMap.get("a");
String countryCode = (String) purchase.get("regionCode");
String orderId = purchase.getOrderId();
chargeRecord.setPingxxChargeId(orderId);
chargeRecord.setCountry(countryCode);
chargeRecord.setLocalCurrencyCode(currencyCode);
chargeRecord.setLocalAmount(localAmount.longValue());
chargeService.updateAppPayData(chargeRecord);