Commit 79a6efd6 authored by licc's avatar licc

定数任务优化

parent b56b10bd
......@@ -55,4 +55,10 @@ public interface MemberPercentMapper extends BaseMapper<MemberPercent> {
* @return 列表
*/
List<MemberPercent> getList(Map<String,Object> map);
/**
* 获取黄金等级及以上月度肥料比例之和
* @return
*/
Double getGoldUpSum();
}
......@@ -71,7 +71,6 @@
</delete>
<select id="getByLevelAndType" resultType="cn.wisenergy.model.app.MemberPercent">
select
<include refid="cols_all"/>
......@@ -98,4 +97,14 @@
limit #{startNum},#{endNum}
</select>
<select id="getGoldUpSum" resultType="java.lang.Double">
select sum(percent)
from
<include refid="table"/>
<where>
type=2
and user_level>3
</where>
</select>
</mapper>
......@@ -360,16 +360,11 @@ public class DayTaskServiceImpl implements DayTaskService {
public void getUser(List<User> list, String userId) {
User user = usersMapper.getByUserId(userId);
list.add(user);
if (null != user && !StringUtils.isBlank(user.getBeInvitedCode())) {
if (null != user && !StringUtils.isBlank(user.getBeInvitedCode()) &&
!"1".equals(user.getBeInvitedCode()) && !"88888888".equals(user.getBeInvitedCode())) {
user = usersMapper.getByBeInvitedCode(user.getBeInvitedCode());
if (null != user) {
//todo 被邀请码=1 或 888888
if (user.getBeInvitedCode().equals(user.getInviteCode())) {
return;
}
getUser(list, user.getUserId());
}
list.add(user);
getUser(list, user.getUserId());
}
}
......
......@@ -178,9 +178,13 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List<User> userList = usersMapper.getAllGoldUser();
if (CollectionUtils.isEmpty(userList)) {
//添加月度肥料剩余奖金 todo /3980/12*3980*(黄金以上比列相加)
//获取黄金以上等级月度肥料收益比列之和
Double memberSum = memberPercentMapper.getGoldUpSum();
//添加月度肥料剩余奖金 总业绩 /3980/12*3980*(黄金以上比列相加)
double manureMoney = Math.floor(totalMoney.doubleValue() / 3980 / 12 * 3980 * memberSum);
MonthManure monthManure = new MonthManure();
monthManure.setManureAward(totalMoney.doubleValue());
monthManure.setManureAward(manureMoney);
monthManure.setYearMonth(yearMonth);
int count = monthManureMapper.add(monthManure);
if (count == 0) {
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.User;
import cn.wisenergy.service.app.DayTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -10,6 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author 86187
*/
......@@ -40,4 +44,11 @@ public class DayTaskController {
public R<Boolean> growAward() {
return dayTaskService.progressPrizeCount();
}
@ApiOperation(value = "获取用户的上级", notes = "获取用户的上级", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "用户userId", dataType = "String")
@GetMapping("/getByList")
public List<User> growAward(String userId) {
return dayTaskService.getByList(userId);
}
}
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