Commit 5ea1c059 authored by licc's avatar licc

账户表新增年月字段

parent 8d85fa25
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="user_level" property="userLevel"/> <result column="user_level" property="userLevel"/>
<result column="year_month" property="yearMonth"/>
<result column="extract_money" property="extractMoney"/> <result column="extract_money" property="extractMoney"/>
<result column="earnings_month" property="earningsMonth"/> <result column="earnings_month" property="earningsMonth"/>
<result column="performance_team" property="performanceTeam"/>
<result column="frozen_money" property="frozenMoney"/> <result column="frozen_money" property="frozenMoney"/>
<result column="earnings_total" property="earningsTotal"/> <result column="earnings_total" property="earningsTotal"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
user_id,user_level,extract_money,earnings_month,performance_team,frozen_money,earnings_total,create_time,update_time user_id,user_level,year_month,extract_money,earnings_month,frozen_money,earnings_total,create_time,update_time
</sql> </sql>
<sql id="vals"> <sql id="vals">
#{userId},#{userLevel},#{extractMoney},#{earningsMonth},#{performanceTeam},#{frozenMoney}, #{userId},#{userLevel},#{yearMonth},#{extractMoney},#{earningsMonth},#{frozenMoney},
#{earningsTotal},now(),now() #{earningsTotal},now(),now()
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
<if test="userId != null">user_id = #{userId},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="userLevel != null">user_level = #{userLevel},</if> <if test="userLevel != null">user_level = #{userLevel},</if>
<if test="yearMonth != null">year_month =#{yearMonth},</if>
<if test="extractMoney != null">extract_money =#{extractMoney},</if> <if test="extractMoney != null">extract_money =#{extractMoney},</if>
<if test="earningsMonth != null">earnings_month =#{earningsMonth},</if> <if test="earningsMonth != null">earnings_month =#{earningsMonth},</if>
<if test="performanceTeam != null">performance_team =#{performanceTeam},</if>
<if test="frozenMoney != null">frozen_money =#{frozenMoney},</if> <if test="frozenMoney != null">frozen_money =#{frozenMoney},</if>
<if test="earningsTotal != null">earnings_total =#{earningsTotal},</if> <if test="earningsTotal != null">earnings_total =#{earningsTotal},</if>
update_time =now() update_time =now()
...@@ -47,14 +47,15 @@ ...@@ -47,14 +47,15 @@
<if test="id != null">id = #{id}</if> <if test="id != null">id = #{id}</if>
<if test="userId != null">and user_id = #{userId}</if> <if test="userId != null">and user_id = #{userId}</if>
<if test="userLevel != null">and user_level = #{userLevel}</if> <if test="userLevel != null">and user_level = #{userLevel}</if>
<if test="yearMonth != null">and year_month =#{yearMonth}</if>
<if test="extractMoney != null">and extract_money =#{extractMoney}</if> <if test="extractMoney != null">and extract_money =#{extractMoney}</if>
<if test="earningsMonth != null">and earnings_month =#{earningsMonth}</if> <if test="earningsMonth != null">and earnings_month =#{earningsMonth}</if>
<if test="performanceTeam != null">and performance_team =#{performanceTeam}</if>
<if test="frozenMoney != null">and frozen_money =#{frozenMoney}</if> <if test="frozenMoney != null">and frozen_money =#{frozenMoney}</if>
<if test="earningsTotal != null">and earnings_total =#{earningsTotal}</if> <if test="earningsTotal != null">and earnings_total =#{earningsTotal}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if> <if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if> <if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql> </sql>
<insert id="add" parameterType="cn.wisenergy.model.app.AccountInfo" keyProperty="id" useGeneratedKeys="true"> <insert id="add" parameterType="cn.wisenergy.model.app.AccountInfo" keyProperty="id" useGeneratedKeys="true">
insert into insert into
<include refid="table"/> <include refid="table"/>
......
...@@ -36,6 +36,12 @@ public class AccountInfo implements Serializable { ...@@ -36,6 +36,12 @@ public class AccountInfo implements Serializable {
@ApiModelProperty(name = "userLevel", value = "用户等级") @ApiModelProperty(name = "userLevel", value = "用户等级")
private Integer userLevel; private Integer userLevel;
/**
* 年月
*/
@ApiModelProperty(name = "yearMonth", value = "年月")
private Date yearMonth;
/** /**
* 可提现金额 * 可提现金额
...@@ -49,11 +55,6 @@ public class AccountInfo implements Serializable { ...@@ -49,11 +55,6 @@ public class AccountInfo implements Serializable {
@ApiModelProperty(name = "earningsMonth", value = "本月收益") @ApiModelProperty(name = "earningsMonth", value = "本月收益")
private BigDecimal earningsMonth; private BigDecimal earningsMonth;
/**
* 本月团队业绩
*/
@ApiModelProperty(name = "performanceTeam", value = "本月团队业绩")
private BigDecimal performanceTeam;
/** /**
* 冻结金额 * 冻结金额
......
...@@ -111,7 +111,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -111,7 +111,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
} }
} }
//遍历订单 订单状态创建时间,小于当前时间 订单当月处理状态 :未处理 //遍历订单 订单状态创建时间,小于当前时间 订单当月任务处理状态 :未处理
for (OrderInfo orderInfo : list) { for (OrderInfo orderInfo : list) {
long createTime = orderInfo.getCreated().getTime(); long createTime = orderInfo.getCreated().getTime();
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
...@@ -159,6 +159,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -159,6 +159,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益 //5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List<User> userList = usersMapper.getAllGoldUser(); List<User> userList = usersMapper.getAllGoldUser();
if (CollectionUtils.isEmpty(userList)) {
return R.ok(0, true);
}
for (User user : userList) { for (User user : userList) {
monthlyIncome(totalMoney, user); monthlyIncome(totalMoney, user);
} }
...@@ -191,10 +194,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -191,10 +194,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//获取当月所有人业绩总额 //获取当月所有人业绩总额
Double totalMoney = teamPerformanceMapper.countByTime(new Date()); Double totalMoney = teamPerformanceMapper.countByTime(new Date());
double number = Math.floor(totalMoney / 3980 / 12);
//2、集合为空 是业绩开始的第一个月 //2、集合为空 是业绩开始的第一个月
if (CollectionUtils.isEmpty(teamPerformances)) { if (CollectionUtils.isEmpty(teamPerformances)) {
double number = Math.floor(totalMoney / 3980 / 12);
if (number != 0) { if (number != 0) {
//获取月业绩前20用户 //获取月业绩前20用户
List<TeamPerformance> list = teamPerformanceMapper.userTwenty(new Date()); List<TeamPerformance> list = teamPerformanceMapper.userTwenty(new Date());
...@@ -275,7 +277,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -275,7 +277,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//计算前20的总业绩 //计算前20的总业绩
double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum(); double total = listVo.stream().mapToDouble(TeamPerformanceSortVo::getMonthPerformance).sum();
double number = Math.floor(totalMoney / 3980 / 12);
if (listVo.size() >= 20) { if (listVo.size() >= 20) {
//取排名前20的 //取排名前20的
listVo.subList(0, 20); listVo.subList(0, 20);
......
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