|
|
@@ -992,69 +992,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 使用推广者的优惠码增加上下级
|
|
|
- */
|
|
|
- private void addDistributeCouponCode(Long userId, String couponExCode) {
|
|
|
- UserDistributeShared userDistributeShared = userDistributeSharedMapper.selectOne(Wrappers.lambdaQuery(UserDistributeShared.class)
|
|
|
- .eq(UserDistributeShared::getUserId, userId).last("limit 1"));
|
|
|
- if (userDistributeShared == null) {
|
|
|
- CouponDistributePopularize couponDistributePopularize = couponDistributePopularizeMapper.selectOne(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getExCode, couponExCode).last("limit 1"));
|
|
|
- Optional.ofNullable(couponDistributePopularize).ifPresent(popularize -> {
|
|
|
- try {
|
|
|
- Long sharedId;
|
|
|
- //是否是普通推广专属关联
|
|
|
- if (popularize.getIsGeneral()) {
|
|
|
- sharedId = popularize.getUserId();
|
|
|
- } else {
|
|
|
- UserDistribute userDistribute = userDistributeMapper.selectById(popularize.getDistributeId());
|
|
|
- if (userDistribute == null || !userDistribute.getDeleted()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- sharedId = userDistribute.getUserId();
|
|
|
- }
|
|
|
- if (sharedId.equals(userId)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- UserDistributeShared ud = new UserDistributeShared();
|
|
|
- ud.setUserId(userId);
|
|
|
- ud.setSharedId(sharedId);
|
|
|
- ud.setRemark("优惠码");
|
|
|
- userDistributeSharedMapper.insert(ud);
|
|
|
- log.info("userId:{}使用优惠码:{}与推广用户sharedId:{}建立关系", userId, couponExCode, sharedId);
|
|
|
- } catch (DuplicateKeyException e) {
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存转账记录
|
|
|
- */
|
|
|
- public void saveTransferRecord(Long userId, String donNo, String account, String name, BigDecimal money, BigDecimal points, String type, Integer scope, String body, String error) throws Exception {
|
|
|
- TransferAccountsRecord record = new TransferAccountsRecord();
|
|
|
- JSONObject re = Jsons.parseObject(body, JSONObject.class);
|
|
|
- JSONObject response = Jsons.parseObject(re.get("alipay_fund_trans_uni_transfer_response"), JSONObject.class);
|
|
|
- String transactionId = response.getStr("order_id");
|
|
|
- String transDate = response.getStr("trans_date");
|
|
|
- record.setUserId(userId);
|
|
|
- record.setAccount(account);
|
|
|
- record.setName(name);
|
|
|
- record.setMoney(money);
|
|
|
- record.setType(type);
|
|
|
- record.setScope(scope);
|
|
|
- Optional.ofNullable(error).ifPresent(msg -> {
|
|
|
- record.setErrorMsg(msg);
|
|
|
- record.setStatus(0);
|
|
|
- });
|
|
|
- record.setPoints(points);
|
|
|
- record.setTransferOutNo(donNo);
|
|
|
- record.setTransactionId(transactionId);
|
|
|
- Optional.ofNullable(transDate).ifPresent(transferTime -> record.setTransferTime(DateTime.of(transferTime, "yyyy-MM-dd HH:mm:ss")));
|
|
|
- transferAccountsRecordMapper.insert(record);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param orderDon 续费订单
|
|
|
* @param afterSku 续费之后的规格
|