|
@@ -3,6 +3,7 @@ package com.txz.cif.service.impl;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.txz.cif.constants.MyConstants;
|
|
|
import com.txz.cif.core.AbstractService;
|
|
@@ -167,6 +168,28 @@ public class RedEnvelopeServiceImpl extends AbstractService<RedEnvelope> impleme
|
|
|
ret.add(ppRedEnvelope);
|
|
|
}
|
|
|
}
|
|
|
+ // 直推红包
|
|
|
+ try {
|
|
|
+ //判断当前用户是否第一次下单
|
|
|
+ Condition c = new Condition(RedEnvelope.class);
|
|
|
+ c.createCriteria().andEqualTo("userId",userId.getUserId());
|
|
|
+ int count = countByCondition(c);
|
|
|
+ if (count == 0){
|
|
|
+ com.txz.operating.result.Result<ConfigDTO> openRedEnvelopeRate = operatingConfigDubboServiceClient.getConfigByCode("invited_amount");
|
|
|
+ log.info("operatingConfigDubboServiceClient.getConfigByCode openRedEnvelopeRate:" + JSONObject.toJSONString(openRedEnvelopeRate));
|
|
|
+ String amountStr = openRedEnvelopeRate.getData().getValueInfo();
|
|
|
+ BigDecimal amount = new BigDecimal(amountStr).setScale(2, RoundingMode.DOWN);
|
|
|
+ // 直推红包
|
|
|
+ addRedEnvelope(RedEnvelopeParam.builder()
|
|
|
+ .amount(amount).bizType(BizTypeEnum.PROMOTION_COMMISSION.getKey())
|
|
|
+ .orderNo(userId.getOrderNo())
|
|
|
+ .userIds(CollUtil.newArrayList(OrderParam.builder().userId(user.getPid()).orderNo(userId.getOrderNo()).build()))
|
|
|
+ .transTime(DateUtil.date())
|
|
|
+ .build());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("直推红包新增异常", e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|