Commit 72fc0552 authored by licc's avatar licc

月度肥料接口实现

parent dcaeace6
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.Rebate;
import cn.wisenergy.model.app.MemberPercent;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 86187
*/
public interface RebateMapper extends BaseMapper<Rebate> {
public interface MemberPercentMapper extends BaseMapper<MemberPercent> {
/**
*
* @param rebate 入参
* @param memberpercent 入参
* @return 1
*/
int add(Rebate rebate);
int add(MemberPercent memberpercent);
/**
* 编辑
* @param rebate 入参
* @param memberpercent 入参
* @return 1
*/
int edit(Rebate rebate);
int edit(MemberPercent memberpercent);
/**
* 删除
......@@ -34,6 +34,8 @@ public interface RebateMapper extends BaseMapper<Rebate> {
* @param userLevel 会员等级
* @return 返佣比例
*/
Rebate getByLevel(@Param("userLevel") Integer userLevel);
MemberPercent getByLevel(@Param("userLevel") Integer userLevel);
MemberPercent getByLevelAndType(@Param("userLevel") Integer userLevel,@Param("type") Integer type);
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.shopZx;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.TargetType;
import java.util.List;
import java.util.Map;
/**
* Created by m1991 on 2021/2/24 14:50
......
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.TeamPerformance;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* @author 86187
*/
public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
int add(TeamPerformance teamPerformance);
int edit(TeamPerformance teamPerformance);
int delById(@Param("id") Integer id);
TeamPerformance getByUserIdAndTime(@Param("userId") String userId,@Param("yearMonth") Date yearMonth);
/**
* 统计
* @param userLevel 等级
* @param yearMonth 年月
* @return 等级总金额
*/
Double countTeamMoney(@Param("userLevel") Integer userLevel, @Param("yearMonth") Date yearMonth);
}
......@@ -62,4 +62,10 @@ public interface UsersMapper extends BaseMapper<User> {
*/
User getByBeInvitedCode(@Param("beInvitedCode") String beInvitedCode);
/**
* 获取黄金树以上会员用户
* @return
*/
List<User> getAllGoldUser();
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.RebateMapper">
<resultMap id="userMap" type="cn.wisenergy.model.app.Rebate">
<mapper namespace="cn.wisenergy.mapper.MemberPercentMapper">
<resultMap id="userMap" type="cn.wisenergy.model.app.MemberPercent">
<id column="id" property="id"/>
<result column="user_level" property="userLevel"/>
<result column="type" property="type"/>
<result column="percent" property="percent"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
rebate
member_percent
</sql>
<sql id="cols_all">
......@@ -20,15 +21,16 @@
</sql>
<sql id="cols_exclude_id">
user_level,percent,create_time,update_time
user_level,type,percent,create_time,update_time
</sql>
<sql id="vals">
#{userLevel},#{percent},now(),now()
#{userLevel},#{type},#{percent},now(),now()
</sql>
<sql id="updateCondition">
<if test="userLevel != null">user_level = #{userLevel},</if>
<if test="type != null">type = #{type},</if>
<if test="percent != null">percent =#{percent},</if>
update_time =now()
</sql>
......@@ -36,12 +38,13 @@
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="userLevel != null">and user_level = #{userLevel}</if>
<if test="type != null">and type = #{type}</if>
<if test="percent != null">and percent =#{percent}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.Rebate" keyProperty="id" useGeneratedKeys="true">
<insert id="add" parameterType="cn.wisenergy.model.app.MemberPercent" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
......@@ -50,7 +53,7 @@
)
</insert>
<update id="edit" parameterType="cn.wisenergy.model.app.Rebate">
<update id="edit" parameterType="cn.wisenergy.model.app.MemberPercent">
UPDATE
<include refid="table"/>
<set>
......@@ -67,7 +70,7 @@
where id = #{id}
</delete>
<select id="getByLevel" resultType="cn.wisenergy.model.app.Rebate">
<select id="getByLevel" resultType="cn.wisenergy.model.app.MemberPercent">
select
<include refid="cols_all"/>
from
......@@ -77,4 +80,15 @@
</where>
</select>
<select id="getByLevelAndType" resultType="cn.wisenergy.model.app.MemberPercent">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
user_level=#{userLevel}
and type=#{type}
</where>
</select>
</mapper>
......@@ -48,7 +48,7 @@
<!--</insert>-->
<!--资讯内容倒叙查询-->
<select id="selectAll" parameterType="cn.wisenergy.model.app.shopZx" >
<select id="selectAll" parameterType="cn.wisenergy.model.app.shopZx" resultType="cn.wisenergy.model.app.shopZx">
select zxid as zxid,zxUrl as zxUrl,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.TeamPerformanceMapper">
<resultMap id="monthMap" type="cn.wisenergy.model.app.TeamPerformance">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="user_level" property="userLevel"/>
<result column="year_month" property="yearMonth"/>
<result column="month_team_performance" property="monthTeamPerformance"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
team_performance
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
user_id,user_level,year_month,month_team_performance,create_time,update_time
</sql>
<sql id="vals">
#{userId},#{userLevel},#{yearMonth},#{monthTeamPerformance},now(),now()
</sql>
<sql id="updateCondition">
<if test="userId != null">month_manure_total = #{userId},</if>
<if test="userLevel != null">user_level = #{userLevel},</if>
<if test="yearMonth != null">year_month =#{yearMonth},</if>
<if test="monthTeamPerformance != null">month_team_performance =#{monthTeamPerformance},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="userId != null">and month_manure_total = #{userId}</if>
<if test="userLevel != null">and user_level = #{userLevel}</if>
<if test="yearMonth != null">and year_month =#{yearMonth}</if>
<if test="monthTeamPerformance != null">and month_team_performance =#{monthTeamPerformance}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.TeamPerformance" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<update id="edit" parameterType="cn.wisenergy.model.app.TeamPerformance">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
<delete id="delById" parameterType="java.lang.Integer">
delete from
<include refid="table"/>
where id = #{id}
</delete>
<select id="getByUserIdAndTime" resultType="cn.wisenergy.model.app.TeamPerformance">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
<if test="userId != null">
user_id = #{userId}
</if>
<if test="yearMonth != null">
AND(
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if>
</where>
</select>
<select id="countTeamMoney" resultType="java.lang.Double">
select
sum(month_team_performance)
from
<include refid="table"/>
<where>
<if test="userLevel != null">
user_level = #{userLevel}
</if>
<if test="yearMonth != null">
AND(
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -166,6 +166,16 @@
</where>
</select>
<select id="getAllGoldUser" resultType="cn.wisenergy.model.app.User">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
user_level >3
</where>
</select>
<!--用户添加-->
<insert id="save">
insert into user(user_id,password) value (#{userId},#{password})
......
......@@ -10,13 +10,14 @@ import java.util.Date;
/**
* @author 86187
* @ Description: 返佣表实体类
* @ Description: 会员等级优惠百分比
* @ Author : 86187
* @ Date : 2021/2/22 11:05
*/
@Data
@ApiModel("Rebate")
public class Rebate implements Serializable {
@ApiModel("MemberPercent")
public class MemberPercent implements Serializable {
private static final long serialVersionUID = -3829843983637924282L;
/**
* 返佣id
*/
......@@ -28,6 +29,11 @@ public class Rebate implements Serializable {
*/
@ApiModelProperty(name = "userLevel", value = "用户会员等级")
private Integer userLevel;
/**
* 会员等级百分比类型:1:返佣 2:月度肥料 3:月度最大进步奖 4:运营中心补贴
*/
@ApiModelProperty(name = "type", value = "会员等级百分比类型:1:返佣 2:月度肥料 3:月度最大进步奖 4:运营中心补贴")
private Integer type;
/**
* 等级对应的返佣比例
......
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author 86187
* @ Description: 团队业绩实体类
* @ Author : 86187
* @ Date : 2021/2/26 16:31
*/
@Data
@ApiModel("TeamPerformance")
public class TeamPerformance implements Serializable {
private static final long serialVersionUID = 3124781800304763059L;
/**
* 主键id
*/
@ApiModelProperty(value = "主键id", name = "id")
private Integer id;
/**
* 用户id
*/
@ApiModelProperty(value = "用户id", name = "userId")
private String userId;
/**
* 用户等级
*/
@ApiModelProperty(value = "用户等级", name = "userLevel")
private Integer userLevel;
/**
* 年-月
*/
@ApiModelProperty(value = "年-月", name = "yearMonth")
private Date yearMonth;
/**
* 本月团队业绩
*/
@ApiModelProperty(value = "本月团队业绩", name = "monthTeamPerformance")
private BigDecimal monthTeamPerformance;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", name = "createTime")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间", name = "updateTime")
private Date updateTime;
}
......@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
......@@ -67,7 +68,7 @@ public class shopZx extends Model<shopZx> implements Serializable{
* 资讯数据创建时间
*/
@ApiModelProperty(name = "zxDate", value = "资讯数据创建时间")
private Data zxDate;
private Date zxDate;
/**
* 图片存放地址
......@@ -80,81 +81,4 @@ public class shopZx extends Model<shopZx> implements Serializable{
*/
@ApiModelProperty(name = "zxAddress", value = "用户发布地址")
private String zxAddress;
public Data getZxDate() {
return zxDate;
}
public void setZxDate(Data zxDate) {
this.zxDate = zxDate;
}
public Integer getZxid() {
return zxid;
}
public void setZxid(Integer zxid) {
this.zxid = zxid;
}
public String getZxUrl() {
return zxUrl;
}
public void setZxUrl(String zxUrl) {
this.zxUrl = zxUrl;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public Integer getZxLikes() {
return zxLikes;
}
public void setZxLikes(Integer zxLikes) {
this.zxLikes = zxLikes;
}
public String getZxName() {
return zxName;
}
public void setZxName(String zxName) {
this.zxName = zxName;
}
public Integer getZxShenHe() {
return zxShenHe;
}
public void setZxShenHe(Integer zxShenHe) {
this.zxShenHe = zxShenHe;
}
public String getZxField() {
return zxField;
}
public void setZxField(String zxField) {
this.zxField = zxField;
}
@Override
public String toString() {
return "shopzx{" +
"zxid=" + zxid +
", zxUrl=" + zxUrl +
", userid=" + userid +
", zxLikes=" + zxLikes +
", zxName=" + zxName +
", zxShenHe=" + zxShenHe +
", zxField=" + zxField +
"}";
}
}
package cn.wisenergy.service.common;
package cn.wisenergy.service.Manager;
import cn.wisenergy.mapper.AccountMapper;
import cn.wisenergy.mapper.OrderMapper;
import cn.wisenergy.mapper.TeamPerformanceMapper;
import cn.wisenergy.mapper.TradeRecordMapper;
import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.model.app.OrderInfo;
import cn.wisenergy.model.app.Rebate;
import cn.wisenergy.model.app.TradeRecord;
import cn.wisenergy.model.app.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
/**
* @author 86187
......@@ -33,15 +32,21 @@ public class AccountManager {
@Autowired
private TradeRecordMapper recordMapper;
@Autowired
private TeamPerformanceMapper teamPerformanceMapper;
@Transactional(rollbackFor = Exception.class)
public Boolean updateOrderAddMoney(OrderInfo orderInfo, AccountInfo accountInfo, Rebate rebate) {
public Boolean updateOrderAddMoney(OrderInfo orderInfo, AccountInfo accountInfo, MemberPercent memberpercent) {
//1、计算返佣金额
BigDecimal bigDecimal = orderInfo.getPayment().multiply(rebate.getPercent());
BigDecimal bigDecimal = orderInfo.getPayment().multiply(memberpercent.getPercent());
BigDecimal extractMoney = accountInfo.getExtractMoney().add(bigDecimal);
accountInfo.setExtractMoney(extractMoney);
BigDecimal performanceMonth = accountInfo.getPerformanceMonth().add(extractMoney);
BigDecimal performanceMonth = accountInfo.getPerformanceMonth().add(bigDecimal);
accountInfo.setPerformanceMonth(performanceMonth);
BigDecimal performanceTotal = accountInfo.getPerformanceTotal().add(bigDecimal);
accountInfo.setPerformanceMonth(performanceTotal);
//2、修改订单返佣状态:已返佣 1
orderInfo.setRebateStatus(1);
......@@ -52,6 +57,9 @@ public class AccountManager {
//3、增加账户可用金额
int sum = accountMapper.updateById(accountInfo);
if(sum ==0){
return false;
}
//4、添加交易流水记录
TradeRecord tradeRecord = new TradeRecord();
......@@ -65,4 +73,11 @@ public class AccountManager {
return true;
}
@Transactional(rollbackFor = Exception.class)
public void updateAccountPerformanceMonth(List<TeamPerformance> list) {
for (TeamPerformance teamPerformance : list) {
teamPerformanceMapper.updateById(teamPerformance);
}
}
}
package cn.wisenergy.service.Manager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author 86187
* @ Description: 账户管理公共类
* @ Author : 86187
* @ Date : 2021/2/23 10:43
*/
@Component
@Slf4j
public class PublicManager {
public boolean isThisMonth(Date time, String pattern) {
Date date = new Date(time.getTime());
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
//参数时间
String param = sdf.format(date);
//当前时间
String now = sdf.format(new Date());
if (param.equals(now)) {
return true;
}
return false;
}
}
......@@ -30,7 +30,7 @@ public interface AccountService {
R<AccountInfo> getByUserId(String userId);
/**
* 业绩统计
* 收益和业绩统计
*
* @param list 订单信息
* @return true or false
......
......@@ -9,6 +9,7 @@ import java.util.List;
* @ Description: 用户接口
* @ Author : 86187
* @ Date : 2021/1/6 16:08
* @author 86187
*/
public interface UserService {
......@@ -27,6 +28,4 @@ public interface UserService {
*/
User getByUserId(String userId);
R<List<User>> test();
}
......@@ -2,14 +2,13 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.AccountMapper;
import cn.wisenergy.mapper.RebateMapper;
import cn.wisenergy.mapper.MemberPercentMapper;
import cn.wisenergy.mapper.TeamPerformanceMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.model.app.OrderInfo;
import cn.wisenergy.model.app.Rebate;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.*;
import cn.wisenergy.service.Manager.PublicManager;
import cn.wisenergy.service.app.AccountService;
import cn.wisenergy.service.common.AccountManager;
import cn.wisenergy.service.Manager.AccountManager;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
......@@ -18,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -36,11 +37,19 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
private AccountMapper accountMapper;
@Autowired
private RebateMapper rebateMapper;
private MemberPercentMapper memberPercentMapper;
@Autowired
private AccountManager accountManager;
@Autowired
private PublicManager publicManager;
@Autowired
private TeamPerformanceMapper teamPerformanceMapper;
private static final String PATTERN = "yyyy-mm";
@Override
public R<Boolean> orderRebate(List<OrderInfo> list) {
log.info("shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}", list.size());
......@@ -67,13 +76,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
//获取返佣比例
Rebate rebate = rebateMapper.getByLevel(user.getUserLevel());
if (null == rebate) {
MemberPercent memberpercent = memberPercentMapper.getByLevel(user.getUserLevel());
if (null == memberpercent) {
continue;
}
//修改订单状态为已返佣,账户可用金额增加
accountManager.updateOrderAddMoney(orderInfo, accountInfo, rebate);
accountManager.updateOrderAddMoney(orderInfo, accountInfo, memberpercent);
}
}
return R.ok(0, true);
......@@ -92,9 +101,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return R.ok(0, true);
}
//计算当月所有订单成交额
BigDecimal totalMoney = new BigDecimal(0);
for (OrderInfo orderInfo : list) {
boolean bool = publicManager.isThisMonth(orderInfo.getCreateTime(), PATTERN);
if (bool && orderInfo.getMonthlyTaskStatus() == 0) {
totalMoney = totalMoney.add(orderInfo.getPayment());
}
}
//遍历订单
for (OrderInfo orderInfo : list) {
//订单状态创建时间,小于当前时间
//订单状态创建时间,小于当前时间 订单当月处理状态 :未处理
long createTime = orderInfo.getCreated().getTime();
long time = System.currentTimeMillis();
if (orderInfo.getMonthlyTaskStatus() == 0 && createTime <= time) {
......@@ -104,24 +122,52 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
continue;
}
//获取当前用户的上级用户列表
List<User> userList=getByList(user.getUserId());
if(CollectionUtils.isEmpty(userList)){
List<TeamPerformance> teamPerformances = new ArrayList<>();
//获取团队业绩信息
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), new Date());
if (null == teamPerformance) {
continue;
}
//1、统计当前用户月度业绩
BigDecimal userCount = teamPerformance.getMonthTeamPerformance().add(orderInfo.getPayment());
teamPerformance.setMonthTeamPerformance(userCount);
teamPerformances.add(teamPerformance);
//2、获取当前用户的上级用户列表
List<User> userList = getByList(user.getUserId());
if (CollectionUtils.isEmpty(userList)) {
continue;
}
//获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
if (null == accountInfo) {
for (User userInfo : userList) {
//3、统计当前用户上级月度绩效
TeamPerformance team = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), new Date());
if (null == team) {
continue;
}
//1、统计当前用户月度绩效
BigDecimal monthCount = team.getMonthTeamPerformance().add(orderInfo.getPayment());
team.setMonthTeamPerformance(monthCount);
teamPerformances.add(team);
}
//修改订单状态为已返佣,账户可用金额增加
//4、更新账户月度绩效
accountManager.updateAccountPerformanceMonth(teamPerformances);
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List<User> userList = usersMapper.getAllGoldUser();
for (User user : userList) {
boolean bool = monthlyIncome(totalMoney, user);
if (!bool) {
continue;
}
}
}
return R.ok(0, true);
}
/**
......@@ -147,4 +193,46 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
getUser(list, userInfo.getUserId());
}
}
private boolean monthlyIncome(BigDecimal totalMoney, User user) {
double total = totalMoney.doubleValue();
BigDecimal money;
//当月所有人订单成交总金额/3980/12 向下整
double moneyMonth = Math.floor(total / 3980 / 12);
if (moneyMonth != 0) {
//获取等级优惠百分比
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(), 2);
if (null != memberPercent) {
//获取本月团队总金额
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), new Date());
//获取该等级团队总金额
Double teamTotal = teamPerformanceMapper.countTeamMoney(user.getUserLevel(), new Date());
if (null != teamPerformance && null != teamTotal) {
double month = teamPerformance.getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue();
//计算收益
double income = moneyMonth * 3980 * percent * month / teamTotal;
//获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
BigDecimal bigDecimal = new BigDecimal(income);
BigDecimal performanceMonth = accountInfo.getPerformanceMonth().add(bigDecimal);
accountInfo.setPerformanceMonth(performanceMonth);
BigDecimal performanceTotal = accountInfo.getPerformanceTotal().add(bigDecimal);
accountInfo.setPerformanceMonth(performanceTotal);
//更新月收益
int count = accountMapper.updateById(accountInfo);
if (count != 0) {
return true;
}
}
}
}
return false;
}
}
......@@ -35,8 +35,4 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return usersMapper.getByUserId(userId);
}
@Override
public R<List<User>> test() {
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment