|
@@ -2,7 +2,6 @@ package com.miaxis.extension.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
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.common.core.domain.entity.SysDictData;
|
|
import com.miaxis.extension.domain.WxExtensionIncome;
|
|
import com.miaxis.extension.domain.WxExtensionIncome;
|
|
import com.miaxis.extension.mapper.WxExtensionIncomeMapper;
|
|
import com.miaxis.extension.mapper.WxExtensionIncomeMapper;
|
|
@@ -61,6 +60,9 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
@Override
|
|
@Override
|
|
public void addExtensionIncomeBySourceId(String outTradeNo, String openid, Integer total) {
|
|
public void addExtensionIncomeBySourceId(String outTradeNo, String openid, Integer total) {
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//查找一二级绑定关系
|
|
//查找一二级绑定关系
|
|
WxSpreadRelation oneRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", openid));
|
|
WxSpreadRelation oneRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", openid));
|
|
if (oneRelation == null){
|
|
if (oneRelation == null){
|
|
@@ -84,9 +86,8 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
|
|
income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
|
|
extensionIncomes.add(income);
|
|
extensionIncomes.add(income);
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (twoRelation != null){
|
|
|
|
- if ("二级".equals(d.getDictLabel())){
|
|
|
|
|
|
+ if ("二级".equals(d.getDictLabel())){
|
|
|
|
+ if (twoRelation != null){
|
|
WxExtensionIncome income = new WxExtensionIncome();
|
|
WxExtensionIncome income = new WxExtensionIncome();
|
|
income.setOutTradeNo(outTradeNo);
|
|
income.setOutTradeNo(outTradeNo);
|
|
income.setBeneficiaryOpenid(twoRelation.getParentOpenid());
|
|
income.setBeneficiaryOpenid(twoRelation.getParentOpenid());
|
|
@@ -97,12 +98,35 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
extensionIncomes.add(income);
|
|
extensionIncomes.add(income);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if ("销售".equals(d.getDictLabel())){
|
|
|
|
+ if (twoRelation != null){
|
|
|
|
+ //销售提成
|
|
|
|
+ List<WxSpreadRelation> wxSpreadRelationList = wxSpreadRelationService.getWxSpreadRelationList(twoRelation.getParentOpenid());
|
|
|
|
+ if (!wxSpreadRelationList.isEmpty()){
|
|
|
|
+ wxSpreadRelationList.stream().forEach(o->{
|
|
|
|
+ if (o.getSaleType() > 0){
|
|
|
|
+ WxExtensionIncome income = new WxExtensionIncome();
|
|
|
|
+ income.setOutTradeNo(outTradeNo);
|
|
|
|
+ income.setBeneficiaryOpenid(twoRelation.getParentOpenid());
|
|
|
|
+ income.setSourceOpenid(openid);
|
|
|
|
+ income.setHierarchy("3");
|
|
|
|
+ income.setPercentage(Integer.parseInt(d.getDictValue()));
|
|
|
|
+ income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
|
|
|
|
+ extensionIncomes.add(income);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
//保存分成收益信息
|
|
//保存分成收益信息
|
|
this.saveBatch(extensionIncomes);
|
|
this.saveBatch(extensionIncomes);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询收益列表
|
|
* 查询收益列表
|
|
* @param openid openid
|
|
* @param openid openid
|