Commit ccf24950 authored by licc's avatar licc

优化设置邀请码

parent c0576166
......@@ -21,6 +21,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
......@@ -397,7 +398,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
double month = teamPerformance.getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue();
//计算收益
double income = (moneyMonth + lastMonthAward) * 3980 * percent * month / teamTotal;
double teamMoney = (moneyMonth + lastMonthAward) * 3980 * percent * month;
DecimalFormat df = new DecimalFormat("######0.00");
double income=Double.parseDouble(df.format(teamMoney/teamTotal));
//获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
......@@ -405,8 +408,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
BigDecimal performanceMonth = accountInfo.getEarningsMonth().add(bigDecimal);
accountInfo.setEarningsMonth(performanceMonth);
BigDecimal performanceTotal = accountInfo.getEarningsMonth().add(bigDecimal);
accountInfo.setEarningsMonth(performanceTotal);
BigDecimal performanceTotal = accountInfo.getEarningsTotal().add(bigDecimal);
accountInfo.setEarningsTotal(performanceTotal);
accountInfoList.add(accountInfo);
......@@ -526,5 +529,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
// flag 1: 日定时任务 2:月定时任务
int flag = 1;
return accountManager.updateOrSavePrize(listVo, updateAccountList, prizes, flag);
}
}
......@@ -320,7 +320,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
*
* @param totalMoney 月金额总额
* @param userList 用户列表
* @return
* @return true or false
*/
private boolean monthlyIncome(BigDecimal totalMoney, List<User> userList) {
//上月
......@@ -373,12 +373,12 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
BigDecimal bigDecimal = new BigDecimal(income);
BigDecimal bigDecimal = new BigDecimal(income).setScale(2,RoundingMode.HALF_UP);
BigDecimal performanceMonth = accountInfo.getEarningsMonth().add(bigDecimal);
accountInfo.setEarningsMonth(performanceMonth.setScale(2, RoundingMode.HALF_UP));
BigDecimal performanceTotal = accountInfo.getEarningsMonth().add(bigDecimal);
accountInfo.setEarningsMonth(performanceTotal.setScale(2, RoundingMode.HALF_UP));
BigDecimal performanceTotal = accountInfo.getEarningsTotal().add(bigDecimal);
accountInfo.setEarningsTotal(performanceTotal.setScale(2, RoundingMode.HALF_UP));
accountInfoList.add(accountInfo);
......
......@@ -274,8 +274,8 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
}
//判断用户是否有邀请码 1:无
if (!INVITE_CODE.equals(user.getInviteCode())) {
return R.error("尊敬的用户您好,您的邀请码已存在,不能修改!");
if (!INVITE_CODE.equals(user.getBeInvitedCode())) {
return R.error("尊敬的用户您好,您的推荐人邀请码已存在,不能修改!");
}
//2、根据邀请码,获取邀请人信息
......
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