|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.miaxis.common.core.domain.entity.SysDictData;
|
|
|
import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
+import com.miaxis.common.utils.StringUtils;
|
|
|
import com.miaxis.extension.domain.WxExtensionIncome;
|
|
|
import com.miaxis.extension.mapper.WxExtensionIncomeMapper;
|
|
|
import com.miaxis.extension.service.IWxExtensionIncomeService;
|
|
@@ -13,6 +14,7 @@ import com.miaxis.spread.domain.WxSpreadRelation;
|
|
|
import com.miaxis.spread.service.IWxSpreadRelationService;
|
|
|
import com.miaxis.system.service.ISysDictDataService;
|
|
|
import com.miaxis.system.service.ISysDictTypeService;
|
|
|
+import com.miaxis.system.service.ISysUserService;
|
|
|
import com.miaxis.user.service.IUserInfoService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -43,6 +45,8 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
|
|
|
|
private final IUserInfoService userInfoService;
|
|
|
|
|
|
+ private final ISysUserService sysUserService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询分成收益列表
|
|
|
*
|
|
@@ -81,24 +85,35 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
|
|
|
|
|
|
List<UserInfo> userInfos = new ArrayList<>();
|
|
|
dictDatas.forEach(d -> {
|
|
|
+ //给上级分发佣金和业绩
|
|
|
if ("一级".equals(d.getDictLabel())){
|
|
|
- //给上级分发佣金和业绩
|
|
|
UserInfo userInfo = userInfoService.getOne(new QueryWrapper<UserInfo>().eq("openid",oneRelation.getParentOpenid()));
|
|
|
userInfo.setProfitPrice(userInfo.getProfitPrice()+(total*Integer.parseInt(d.getDictValue()))/100);
|
|
|
userInfo.setAchievement(userInfo.getAchievement()+total);
|
|
|
userInfos.add(userInfo);
|
|
|
}
|
|
|
+ //给上级分发增加业绩
|
|
|
+ if ("驾校".equals(d.getDictLabel())){
|
|
|
+ UserInfo userInfo = userInfoService.getOne(new QueryWrapper<UserInfo>().eq("openid",openid));
|
|
|
+ //如果该充值人员绑定了驾校
|
|
|
+ if (!StringUtils.isEmpty(userInfo.getSchoolName())){
|
|
|
+ sysUserService.updateSysUserByNickName(userInfo.getSchoolName(),total);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- List<UserInfo> upUserInfos = wxSpreadRelationService.getWxSpreadRelationList(oneRelation.getParentOpenid());
|
|
|
- if (!upUserInfos.isEmpty()) {
|
|
|
- upUserInfos.stream().forEach(userInfo -> {
|
|
|
- userInfo.setAchievement(userInfo.getAchievement() + total);
|
|
|
- userInfos.add(userInfo);
|
|
|
- });
|
|
|
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
+ //对二级以上的人业绩
|
|
|
+ List<UserInfo> upUserInfos = wxSpreadRelationService.getWxSpreadRelationList(oneRelation.getParentOpenid());
|
|
|
+ if (!upUserInfos.isEmpty()) {
|
|
|
+ upUserInfos.stream().forEach(userInfo -> {
|
|
|
+ userInfo.setAchievement(userInfo.getAchievement() + total);
|
|
|
+ userInfos.add(userInfo);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//保存分成收益信息
|
|
|
userInfoService.updateBatchById(userInfos);
|
|
|
}
|