|
@@ -2,7 +2,6 @@ package com.miaxis.extension.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.miaxis.common.core.domain.Response;
|
|
|
import com.miaxis.common.core.domain.entity.SysDictData;
|
|
|
import com.miaxis.extension.domain.WxExtensionIncome;
|
|
|
import com.miaxis.extension.mapper.WxExtensionIncomeMapper;
|
|
@@ -15,7 +14,6 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -52,18 +50,18 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
|
|
|
|
/**
|
|
|
* 新增收益信息
|
|
|
- * @param sourceId 订单id
|
|
|
- * @param sourceOpenid 用户openid
|
|
|
- * @param sourcePrice 订单金额
|
|
|
+ * @param outTradeNo 商户订单号
|
|
|
+ * @param openid 用户openid
|
|
|
+ * @param total 订单金额
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public void addExtensionIncomeBySourceId(Long sourceId, String sourceOpenid, Integer sourcePrice) {
|
|
|
+ public void addExtensionIncomeBySourceId(String outTradeNo, String openid, Integer total) {
|
|
|
|
|
|
//查找一二级绑定关系
|
|
|
- WxSpreadRelation oneRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", sourceOpenid));
|
|
|
+ WxSpreadRelation oneRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", openid));
|
|
|
if (oneRelation == null){
|
|
|
- log.info(sourceOpenid+": 此用户不存在绑定关系");
|
|
|
+ log.info(openid+": 此用户不存在绑定关系");
|
|
|
}
|
|
|
|
|
|
WxSpreadRelation twoRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", oneRelation.getParentOpenid()));
|
|
@@ -75,24 +73,24 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
|
dictDatas.forEach(d -> {
|
|
|
if ("一级".equals(d.getDictLabel())){
|
|
|
WxExtensionIncome income = new WxExtensionIncome();
|
|
|
- income.setSourceId(sourceId);
|
|
|
+ income.setOutTradeNo(outTradeNo);
|
|
|
income.setBeneficiaryOpenid(oneRelation.getParentOpenid());
|
|
|
- income.setSourceOpenid(sourceOpenid);
|
|
|
+ income.setSourceOpenid(openid);
|
|
|
income.setHierarchy("1");
|
|
|
income.setPercentage(Integer.parseInt(d.getDictValue()));
|
|
|
- income.setProfitPrice((sourcePrice*Integer.parseInt(d.getDictValue()))/100);
|
|
|
+ income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
|
|
|
extensionIncomes.add(income);
|
|
|
}
|
|
|
|
|
|
if (twoRelation != null){
|
|
|
if ("二级".equals(d.getDictLabel())){
|
|
|
WxExtensionIncome income = new WxExtensionIncome();
|
|
|
- income.setSourceId(sourceId);
|
|
|
+ income.setOutTradeNo(outTradeNo);
|
|
|
income.setBeneficiaryOpenid(twoRelation.getParentOpenid());
|
|
|
- income.setSourceOpenid(sourceOpenid);
|
|
|
+ income.setSourceOpenid(openid);
|
|
|
income.setHierarchy("2");
|
|
|
income.setPercentage(Integer.parseInt(d.getDictValue()));
|
|
|
- income.setProfitPrice((sourcePrice*Integer.parseInt(d.getDictValue()))/100);
|
|
|
+ income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
|
|
|
extensionIncomes.add(income);
|
|
|
}
|
|
|
}
|