Commit fcd5b3de authored by licc's avatar licc

优化月定时任务

parent cf86cd18
......@@ -348,6 +348,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
if (null != user && !StringUtils.isBlank(user.getBeInvitedCode())) {
User userInfo = usersMapper.getByBeInvitedCode(user.getBeInvitedCode());
if (null != userInfo) {
if(userInfo.getBeInvitedCode().equals(userInfo.getInviteCode())){
return;
}
getUser(list, userInfo.getUserId());
}
}
......
......@@ -81,8 +81,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
return R.ok(0, true);
}
Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, PATTERN);
String yearMonth = DateUtil.convertDateToStr(lastMonth, PATTERN);
//计算上月所有订单成交额
BigDecimal totalMoney = new BigDecimal(0);
......@@ -328,17 +327,17 @@ public class MonthTaskServiceImpl implements MonthTaskService {
private boolean monthlyIncome(BigDecimal totalMoney, List<User> userList) {
double total = totalMoney.doubleValue();
Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, PATTERN);
String lastMonth = DateUtil.convertDateToStr(date, PATTERN);
//当月所有人订单成交总金额/3980/12 向下取整
double moneyMonth = Math.floor(total / 3980 / 12);
List<AccountInfo> accountInfoList = new ArrayList<>();
List<TradeRecord> tradeRecordList = new ArrayList<>();
//获取上月未分配完的奖金
//获取上月未分配完的奖金
double lastMonthAward;
Date last = DateUtil.getLastMonth(new Date());
String yearMonthTime = DateUtil.convertDateToStr(last, PATTERN);
Date lastAndLast = DateUtil.convertStrToDate(lastMonth, "yyyy-MM-dd");
String yearMonthTime = DateUtil.convertDateToStr(lastAndLast, PATTERN);
MonthManure monthManure = monthManureMapper.queryByTime(yearMonthTime);
if (null == monthManure) {
lastMonthAward = 0.00;
......@@ -356,11 +355,11 @@ public class MonthTaskServiceImpl implements MonthTaskService {
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(),
MemberPercentEnum.MONTH_MANURE.getCode());
if (null != memberPercent) {
//获取月团队总金额
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), yearMonth);
//获取上月月团队总金额
TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), lastMonth);
//获取该等级团队总金额
Double teamTotal = teamPerformanceMapper.countTeamMoney(user.getUserLevel(), yearMonth);
//获取上月该等级团队总金额
Double teamTotal = teamPerformanceMapper.countTeamMoney(user.getUserLevel(), lastMonth);
if (null != teamPerformance && null != teamTotal) {
double month = teamPerformance.getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue();
......
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