Commit 846addd2 authored by m1991's avatar m1991

Merge remote-tracking branch 'origin/master'

parents 85e8c202 a5d3d44d
...@@ -44,7 +44,12 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -44,7 +44,12 @@ public interface UsersMapper extends BaseMapper<User> {
List<User> getList(Map<String, Object> map); List<User> getList(Map<String, Object> map);
List<User> findAll(); /**
* 获取所有的非普通用户列表
*
* @return 非普通用户列表
*/
List<User> findAllNotZeroUser();
User findByName(String name); User findByName(String name);
...@@ -54,6 +59,7 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -54,6 +59,7 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 获取用户信息 * 获取用户信息
*
* @return 用户信息 * @return 用户信息
*/ */
User getUserById(@Param("id") Long id); User getUserById(@Param("id") Long id);
...@@ -113,7 +119,8 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -113,7 +119,8 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 用户注册 * 用户注册
* @param userId *
* @param userId
* @param inviteCode * @param inviteCode
* @param beInvitedCode * @param beInvitedCode
* @param userLevel * @param userLevel
...@@ -155,7 +162,6 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -155,7 +162,6 @@ public interface UsersMapper extends BaseMapper<User> {
List<User> getByLevel(@Param("userLevel") Integer userLevel); List<User> getByLevel(@Param("userLevel") Integer userLevel);
/** /**
*
* @param * @param
* @return * @return
*/ */
...@@ -164,6 +170,7 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -164,6 +170,7 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 用户邀请码查询用户数据 * 用户邀请码查询用户数据
*
* @param inviteCode * @param inviteCode
* @return * @return
*/ */
...@@ -171,6 +178,7 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -171,6 +178,7 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 根据用户的推荐人邀请码 查询上级用户的id * 根据用户的推荐人邀请码 查询上级用户的id
*
* @param beInvitedCode * @param beInvitedCode
* @return * @return
*/ */
...@@ -180,14 +188,16 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -180,14 +188,16 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 获取所有的空投用户 * 获取所有的空投用户
* 且注册时间为一月之前 * 且注册时间为一月之前
*
* @return * @return
*/ */
List<User> getAerialDeliveryUserBeforOneMonth(@Param("before") String before, List<User> getAerialDeliveryUserBeforOneMonth(@Param("before") String before,
@Param("now") String now ); @Param("now") String now);
/** /**
* 随机获取一条小于当前id的用户 即: 比当前用户早注册的用户 * 随机获取一条小于当前id的用户 即: 比当前用户早注册的用户
*
* @param id * @param id
* @return * @return
*/ */
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
where where
p.user_id=u.user_id p.user_id=u.user_id
and p.`year_month` = #{yearMonth} and p.`year_month` = #{yearMonth}
order by p.`growth_rate` desc,u.create_time desc order by p.`growth_rate` desc,u.create_time desc,p.award_money desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null"> <if test="yearMonth != null">
`year_month` = #{yearMonth} `year_month` = #{yearMonth}
</if> </if>
order by month_team_performance desc order by month_team_performance desc
limit 20 limit 20
...@@ -146,8 +146,9 @@ ...@@ -146,8 +146,9 @@
from from
<include refid="table"/> <include refid="table"/>
<where> <where>
user_level != 0
<if test="yearMonth != null"> <if test="yearMonth != null">
`year_month` = #{yearMonth} and `year_month` = #{yearMonth}
</if> </if>
order by month_team_performance desc order by month_team_performance desc
limit 20 limit 20
......
...@@ -151,9 +151,14 @@ ...@@ -151,9 +151,14 @@
</where> </where>
</select> </select>
<!--查询全部--> <select id="findAllNotZeroUser" resultType="cn.wisenergy.model.app.User">
<select id="findAll" resultType="cn.wisenergy.model.app.User"> select
select * from User <include refid="cols_all"/>
from
<include refid="table"/>
<where>
user_level !=0
</where>
</select> </select>
<!--查询用户--> <!--查询用户-->
...@@ -225,7 +230,7 @@ ...@@ -225,7 +230,7 @@
</where> </where>
</select> </select>
<select id="InvitedCode2" resultType="cn.wisenergy.model.app.User" parameterType="string"> <select id="InvitedCode2" resultType="cn.wisenergy.model.app.User" parameterType="string">
select select
* *
from from
...@@ -376,15 +381,16 @@ ...@@ -376,15 +381,16 @@
where where
be_invited_code = '1' be_invited_code = '1'
and DATE_FORMAT(create_time,'%Y-%m-%d') and DATE_FORMAT(create_time,'%Y-%m-%d')
BETWEEN #{before} AND #{now} BETWEEN #{before} AND #{now}
</select> </select>
<select id="randOneGetUserByUserId" resultType="cn.wisenergy.model.app.User" > <select id="randOneGetUserByUserId" resultType="cn.wisenergy.model.app.User">
SELECT SELECT
<include refid="cols_all"/> <include refid="cols_all"/>
FROM <include refid="table"/> FROM
WHERE id &lt; #{id} <include refid="table"/>
ORDER BY RAND() LIMIT 1 WHERE id &lt; #{id}
ORDER BY RAND() LIMIT 1
</select> </select>
</mapper> </mapper>
...@@ -65,16 +65,13 @@ public class AccountManager { ...@@ -65,16 +65,13 @@ public class AccountManager {
//1、计算返佣金额 //1、计算返佣金额
BigDecimal bigDecimal = orderInfo.getPayment().multiply(memberPercent.getPercent()); BigDecimal bigDecimal = orderInfo.getPayment().multiply(memberPercent.getPercent());
BigDecimal extractMoney = accountInfo.getExtractMoney().add(bigDecimal); BigDecimal extractMoney = accountInfo.getExtractMoney().add(bigDecimal);
extractMoney.setScale(2, RoundingMode.HALF_UP); accountInfo.setExtractMoney(extractMoney.setScale(2, RoundingMode.HALF_UP));
accountInfo.setExtractMoney(extractMoney);
BigDecimal performanceMonth = accountInfo.getEarningsMonth().add(bigDecimal); BigDecimal performanceMonth = accountInfo.getEarningsMonth().add(bigDecimal);
performanceMonth.setScale(2, RoundingMode.HALF_UP); accountInfo.setEarningsMonth(performanceMonth.setScale(2, RoundingMode.HALF_UP));
accountInfo.setEarningsMonth(performanceMonth);
BigDecimal performanceTotal = accountInfo.getEarningsMonth().add(bigDecimal); BigDecimal performanceTotal = accountInfo.getEarningsMonth().add(bigDecimal);
performanceTotal.setScale(2, RoundingMode.HALF_UP); accountInfo.setEarningsTotal(performanceTotal.setScale(2, RoundingMode.HALF_UP));
accountInfo.setEarningsTotal(performanceTotal);
//2、修改订单返佣状态:已返佣 1 //2、修改订单返佣状态:已返佣 1
orderInfo.setRebateStatus(RebateStatusEnum.ALREADY_REBATE.getCode()); orderInfo.setRebateStatus(RebateStatusEnum.ALREADY_REBATE.getCode());
...@@ -127,10 +124,10 @@ public class AccountManager { ...@@ -127,10 +124,10 @@ public class AccountManager {
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean updateOrSavePrize(List<TeamPerformanceSortVo> listVo, List<AccountInfo> accountInfoList, public Boolean updateOrSavePrize(List<TeamPerformanceSortVo> listVo, List<AccountInfo> accountInfoList,
List<ProgressPrize> prizes) { List<ProgressPrize> prizes, int flag) {
Date date = new Date(); Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, PATTERN); String yearMonth = DateUtil.convertDateToStr(date, PATTERN);
//构造一个map key:userId value progressPrize //构造一个map key:userId value progressPrize
Map<String, ProgressPrize> map = new HashMap<>(32); Map<String, ProgressPrize> map = new HashMap<>(32);
for (ProgressPrize progressPrize : prizes) { for (ProgressPrize progressPrize : prizes) {
...@@ -179,8 +176,9 @@ public class AccountManager { ...@@ -179,8 +176,9 @@ public class AccountManager {
addList.add(progress); addList.add(progress);
} }
} }
List<ProgressPrize> deleteList = new ArrayList<>(prizes);
//剩余的是要删除的
List<ProgressPrize> deleteList = new ArrayList<>(prizes);
for (ProgressPrize updatePrize : updateList) { for (ProgressPrize updatePrize : updateList) {
int count = progressPrizeMapper.edit(updatePrize); int count = progressPrizeMapper.edit(updatePrize);
if (count == 0) { if (count == 0) {
...@@ -212,7 +210,12 @@ public class AccountManager { ...@@ -212,7 +210,12 @@ public class AccountManager {
tradeRecord.setUserId(accountInfo.getUserId()); tradeRecord.setUserId(accountInfo.getUserId());
tradeRecord.setTradeType(TradeRecordEnum.PROGRESS_PRIZE.getCode()); tradeRecord.setTradeType(TradeRecordEnum.PROGRESS_PRIZE.getCode());
tradeRecord.setTradeNo(null); tradeRecord.setTradeNo(null);
tradeRecord.setStatus(TradeStatusEnum.ALREADY_SETTLE_ACCOUNTS.getCode()); if (flag == 1) {
tradeRecord.setStatus(TradeStatusEnum.NO_SETTLE_ACCOUNTS.getCode());
} else {
tradeRecord.setStatus(TradeStatusEnum.ALREADY_SETTLE_ACCOUNTS.getCode());
}
int count = recordMapper.add(tradeRecord); int count = recordMapper.add(tradeRecord);
if (count == 0) { if (count == 0) {
return false; return false;
...@@ -260,7 +263,7 @@ public class AccountManager { ...@@ -260,7 +263,7 @@ public class AccountManager {
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean updateAccountAddRecordAddPrize(List<AccountInfo> accountInfoList, List<TradeRecord> recordList, public Boolean updateAccountAddRecordAddPrize(List<AccountInfo> accountInfoList, List<TradeRecord> recordList,
List<ProgressPrize> prizeList) { List<ProgressPrize> prizeList) {
//更新月收益 //更新月收益
if (!CollectionUtils.isEmpty(accountInfoList)) { if (!CollectionUtils.isEmpty(accountInfoList)) {
......
...@@ -143,15 +143,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -143,15 +143,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//key 不存在,加入集合 //key 不存在,加入集合
map.put(userId, payMoney); map.put(userId, payMoney);
} }
//累加订单成交额
totalMoney = totalMoney.add(orderInfo.getPayment()); totalMoney = totalMoney.add(orderInfo.getPayment());
} }
//累计用户和上级用户-团队业绩 //累计用户和上级用户-团队业绩
Map<String, Double> tempMap = new HashMap<>(); Map<String, Double> tempMap = new HashMap<>();
//遍历订单
for (Map.Entry<String, Double> entity : map.entrySet()) { for (Map.Entry<String, Double> entity : map.entrySet()) {
String userId = entity.getKey(); String userId = entity.getKey();
//1)、统计当前用户月度业绩 //1)、统计当前用户月度业绩
...@@ -223,14 +219,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -223,14 +219,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return R.ok(1, false); return R.ok(1, false);
} }
return R.ok(0, true); return R.ok(0, true);
} }
/** /**
* 获取用户的商机信息 * 获取用户的上级列表
* *
* @param userId 用户id * @param userId 用户id
* @return * @return 用户的上级列表
*/ */
@Override @Override
public List<User> getByList(String userId) { public List<User> getByList(String userId) {
...@@ -268,20 +263,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -268,20 +263,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
Double twentyTotal = teamPerformanceMapper.countTwenty(yearMonth); Double twentyTotal = teamPerformanceMapper.countTwenty(yearMonth);
List<AccountInfo> accountInfoList = new ArrayList<>(); List<AccountInfo> accountInfoList = new ArrayList<>();
List<TradeRecord> tradeRecordList = new ArrayList<>(); List<TradeRecord> tradeRecordList = new ArrayList<>();
List<ProgressPrize> prizeList=new ArrayList<>(); List<ProgressPrize> prizeList = new ArrayList<>();
for (TeamPerformance user : list) { for (TeamPerformance user : list) {
//用户是普通用户的,不计算最大进步奖
if (user.getUserLevel().equals(UserLevelEnum.NORMAL_USER.getCode())) {
continue;
}
//获取最大进步奖 百分比 //获取最大进步奖 百分比
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(), 3); MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(),
MemberPercentEnum.MONTH_BEST_AWARD.getCode());
//计算收益 //计算收益
double userTeamPerformance = user.getMonthTeamPerformance().doubleValue(); double userTeamPerformance = user.getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue(); double percent = memberPercent.getPercent().doubleValue();
double income = Math.floor(number * 3980 * percent * userTeamPerformance / twentyTotal); double income = Math.floor(number * 3980 * percent * userTeamPerformance / twentyTotal);
//获取账户信息 //获取账户信息
...@@ -316,7 +306,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -316,7 +306,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
} }
//更新账户信息,添加交易流水记录 //更新账户信息,添加交易流水记录
boolean bool = accountManager.updateAccountAddRecordAddPrize(accountInfoList, tradeRecordList,prizeList); boolean bool = accountManager.updateAccountAddRecordAddPrize(accountInfoList, tradeRecordList, prizeList);
if (!bool) { if (!bool) {
return R.ok(1, false); return R.ok(1, false);
} }
...@@ -326,27 +316,22 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -326,27 +316,22 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//3、集合不为空 不是业绩开始的第一个月 //3、集合不为空 不是业绩开始的第一个月
//获取用户列表 //获取用户列表
List<User> userList = usersMapper.findAll(); List<User> userList = usersMapper.findAllNotZeroUser();
if (CollectionUtils.isEmpty(userList)) { if (CollectionUtils.isEmpty(userList)) {
return R.ok(0, true); return R.ok(0, true);
} }
//4计算每个用户本月的业绩增长率 //4计算每个用户本月的业绩增长率 如果集合大于20 ,取前二十名,小于,取全部
List<TeamPerformanceSortVo> listVo = progressPrizeStatistics(userList); List<TeamPerformanceSortVo> listVo = progressPrizeStatistics(userList);
//5、如果集合大于20 ,取前二十名,小于,取全部
if (listVo.size() >= TWENTY) { if (listVo.size() >= TWENTY) {
//取排名前20的
listVo.subList(0, TWENTY); listVo.subList(0, TWENTY);
}
//计算前20的总业绩 //5、计算前20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum(); double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
totalPerformanceIncome(listVo, number, total); boolean bool = totalPerformanceIncome(listVo, number, total);
return R.ok(0, true); if (!bool) {
} else { return R.ok(1, false);
//计算用户数少于20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
totalPerformanceIncome(listVo, number, total);
} }
return R.ok(0, true); return R.ok(0, true);
} }
...@@ -358,7 +343,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -358,7 +343,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
if (null != user && !StringUtils.isBlank(user.getBeInvitedCode())) { if (null != user && !StringUtils.isBlank(user.getBeInvitedCode())) {
User userInfo = usersMapper.getByBeInvitedCode(user.getBeInvitedCode()); User userInfo = usersMapper.getByBeInvitedCode(user.getBeInvitedCode());
if (null != userInfo) { if (null != userInfo) {
if(userInfo.getBeInvitedCode().equals(userInfo.getInviteCode())){ if (userInfo.getBeInvitedCode().equals(userInfo.getInviteCode())) {
return; return;
} }
getUser(list, userInfo.getUserId()); getUser(list, userInfo.getUserId());
...@@ -371,7 +356,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -371,7 +356,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
* *
* @param totalMoney 月金额总额 * @param totalMoney 月金额总额
* @param userList 用户列表 * @param userList 用户列表
* @return * @return true or false
*/ */
private boolean monthlyIncome(BigDecimal totalMoney, List<User> userList) { private boolean monthlyIncome(BigDecimal totalMoney, List<User> userList) {
double total = totalMoney.doubleValue(); double total = totalMoney.doubleValue();
...@@ -497,7 +482,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -497,7 +482,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
* @param number 个人业绩 * @param number 个人业绩
* @param total 总业绩 * @param total 总业绩
*/ */
private void totalPerformanceIncome(List<TeamPerformanceSortVo> listVo, double number, double total) { private boolean totalPerformanceIncome(List<TeamPerformanceSortVo> listVo, double number, double total) {
//要更新的账户列表 //要更新的账户列表
List<AccountInfo> updateAccountList = new ArrayList<>(); List<AccountInfo> updateAccountList = new ArrayList<>();
...@@ -533,6 +518,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -533,6 +518,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
List<ProgressPrize> prizes = progressPrizeMapper.getByYearMonth(yearMonth); List<ProgressPrize> prizes = progressPrizeMapper.getByYearMonth(yearMonth);
//修改或保存最大进步奖信息 //修改或保存最大进步奖信息
accountManager.updateOrSavePrize(listVo, updateAccountList, prizes); // flag 1: 日定时任务 2:月定时任务
int flag = 1;
return accountManager.updateOrSavePrize(listVo, updateAccountList, prizes, flag);
} }
} }
...@@ -221,11 +221,6 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -221,11 +221,6 @@ public class MonthTaskServiceImpl implements MonthTaskService {
List<TradeRecord> tradeRecordList = new ArrayList<>(); List<TradeRecord> tradeRecordList = new ArrayList<>();
List<ProgressPrize> prizeList = new ArrayList<>(); List<ProgressPrize> prizeList = new ArrayList<>();
for (TeamPerformance user : list) { for (TeamPerformance user : list) {
//用户是普通用户的,不计算最大进步奖
if (user.getUserLevel().equals(UserLevelEnum.NORMAL_USER.getCode())) {
continue;
}
//获取最大进步奖 百分比 //获取最大进步奖 百分比
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(), 3); MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(), 3);
...@@ -234,10 +229,8 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -234,10 +229,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
double percent = memberPercent.getPercent().doubleValue(); double percent = memberPercent.getPercent().doubleValue();
double income = Math.floor(number * 3980 * percent * userTeamPerformance / twentyTotal); double income = Math.floor(number * 3980 * percent * userTeamPerformance / twentyTotal);
//获取账户信息 //获取账户信息 用户月收益 =其他收益+最大进步奖收益
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId()); AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
//用户月收益 =其他收益+最大进步奖收益
BigDecimal earningsMonth = accountInfo.getEarningsMonth().add(BigDecimal.valueOf(income)); BigDecimal earningsMonth = accountInfo.getEarningsMonth().add(BigDecimal.valueOf(income));
accountInfo.setEarningsMonth(earningsMonth.setScale(2, RoundingMode.HALF_UP)); accountInfo.setEarningsMonth(earningsMonth.setScale(2, RoundingMode.HALF_UP));
...@@ -266,7 +259,7 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -266,7 +259,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
} }
//更新账户信息,添加交易流水记录 //更新账户信息,添加交易流水记录
boolean bool = accountManager.updateAccountAddRecordAddPrize(accountInfoList, tradeRecordList,prizeList); boolean bool = accountManager.updateAccountAddRecordAddPrize(accountInfoList, tradeRecordList, prizeList);
if (!bool) { if (!bool) {
return R.ok(1, false); return R.ok(1, false);
} }
...@@ -276,27 +269,22 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -276,27 +269,22 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//3、集合不为空 不是业绩开始的第一个月 //3、集合不为空 不是业绩开始的第一个月
//获取用户列表 //获取用户列表
List<User> userList = usersMapper.findAll(); List<User> userList = usersMapper.findAllNotZeroUser();
if (CollectionUtils.isEmpty(userList)) { if (CollectionUtils.isEmpty(userList)) {
return R.ok(0, true); return R.ok(0, true);
} }
//4计算每个用户本月的业绩增长率 //4计算每个用户本月的业绩增长率 如果集合大于20 ,取前二十名,小于,取全部
List<TeamPerformanceSortVo> listVo = progressPrizeStatistics(userList); List<TeamPerformanceSortVo> listVo = progressPrizeStatistics(userList);
//5、如果集合大于20 ,取前二十名,小于,取全部
if (listVo.size() >= TWENTY) { if (listVo.size() >= TWENTY) {
//取排名前20的
listVo.subList(0, TWENTY); listVo.subList(0, TWENTY);
}
//计算前20的总业绩 //5、计算前20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum(); double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
totalPerformanceIncome(listVo, number, total); boolean bool = totalPerformanceIncome(listVo, number, total);
return R.ok(0, true); if (!bool) {
} else { return R.ok(1, false);
//计算用户数少于20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
totalPerformanceIncome(listVo, number, total);
} }
return R.ok(0, true); return R.ok(0, true);
} }
...@@ -554,7 +542,7 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -554,7 +542,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
* @param number 个人业绩 * @param number 个人业绩
* @param total 总业绩 * @param total 总业绩
*/ */
private void totalPerformanceIncome(List<TeamPerformanceSortVo> listVo, double number, double total) { private boolean totalPerformanceIncome(List<TeamPerformanceSortVo> listVo, double number, double total) {
//要更新的账户列表 //要更新的账户列表
List<AccountInfo> updateAccountList = new ArrayList<>(); List<AccountInfo> updateAccountList = new ArrayList<>();
...@@ -590,6 +578,8 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -590,6 +578,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
List<ProgressPrize> prizes = progressPrizeMapper.getByYearMonth(yearMonth); List<ProgressPrize> prizes = progressPrizeMapper.getByYearMonth(yearMonth);
//修改或保存最大进步奖信息 //修改或保存最大进步奖信息
accountManager.updateOrSavePrize(listVo, updateAccountList, prizes); // flag 1: 日定时任务 2:月定时任务
int flag = 2;
return accountManager.updateOrSavePrize(listVo, updateAccountList, prizes,flag);
} }
} }
\ No newline at end of file
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