diff --git a/wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java b/wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
index 2843c9f61328e03215f58a8ccceefd7a7dccc5f8..3b9b960fc12999a2dc51c598b840a230193231c1 100644
--- a/wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
+++ b/wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
@@ -5,11 +5,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author 86187
  */
-public interface TeamPerformanceMapper  extends BaseMapper<TeamPerformance> {
+public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
 
     int add(TeamPerformance teamPerformance);
 
@@ -17,13 +18,46 @@ public interface TeamPerformanceMapper  extends BaseMapper<TeamPerformance> {
 
     int delById(@Param("id") Integer id);
 
-    TeamPerformance getByUserIdAndTime(@Param("userId") String userId,@Param("yearMonth") Date yearMonth);
+    /**
+     * 用户id和时间获取用户月业绩
+     *
+     * @param userId    用户id
+     * @param yearMonth 时间
+     * @return 用户月业绩
+     */
+    TeamPerformance getByUserIdAndTime(@Param("userId") String userId, @Param("yearMonth") Date yearMonth);
 
     /**
-     * 统计
+     * 统计 等级月业绩和
+     *
      * @param userLevel 等级
      * @param yearMonth 年月
-     * @return  等级总金额
+     * @return 等级总金额
      */
     Double countTeamMoney(@Param("userLevel") Integer userLevel, @Param("yearMonth") Date yearMonth);
+
+    /**
+     * 获取时间前的 月业绩列表
+     *
+     * @param yearMonth 时间
+     * @return 月业绩列表
+     */
+    List<TeamPerformance> getByBeforeTime(@Param("yearMonth") Date yearMonth);
+
+    /**
+     * 根据时间统计 所有用户业绩和
+     *
+     * @param yearMonth 时间
+     * @return 所有用户业绩和
+     */
+    Double countByTime(@Param("yearMonth") Date yearMonth);
+
+    /**
+     * 月业绩排名前20人 业绩和
+     * @param yearMonth 时间
+     * @return 业绩和
+     */
+    Double countTwenty(@Param("yearMonth") Date yearMonth);
+
+    List<TeamPerformance> userTwenty(@Param("yearMonth") Date yearMonth);
 }
diff --git a/wisenergy-mapper/src/main/resources/mapper/TeamPerformanceMapper.xml b/wisenergy-mapper/src/main/resources/mapper/TeamPerformanceMapper.xml
index 9a0550ff9047c5fb41cee17d046fe9aa0b661400..31f7108d5e0002d656fb17a5ddb3346960e06b4c 100644
--- a/wisenergy-mapper/src/main/resources/mapper/TeamPerformanceMapper.xml
+++ b/wisenergy-mapper/src/main/resources/mapper/TeamPerformanceMapper.xml
@@ -106,4 +106,62 @@
         </where>
     </select>
 
+    <select id="getByBeforeTime" resultType="cn.wisenergy.model.app.TeamPerformance">
+        select
+        <include refid="cols_all"/>
+        from
+        <include refid="table"/>
+        <where>
+            <if test="yearMonth != null">
+                year_month &lt; #{yearMonth}
+            </if>
+        </where>
+    </select>
+
+    <select id="countByTime" resultType="java.lang.Double">
+        select
+        sum(month_team_performance)
+        from
+        <include refid="table"/>
+        <where>
+            <if test="yearMonth != null">
+                AND(
+                YEAR(year_month) = YEAR(#{yearMonth})
+                AND MONTH(year_month) = MONTH(#{yearMonth}))
+            </if>
+        </where>
+    </select>
+
+    <select id="countTwenty" resultType="java.lang.Double">
+        select
+        sum(month_team_performance)
+        from
+        <include refid="table"/>
+        <where>
+            <if test="yearMonth != null">
+                AND(
+                YEAR(year_month) = YEAR(#{yearMonth})
+                AND MONTH(year_month) = MONTH(#{yearMonth}))
+            </if>
+            order by month_team_performance desc
+            limit 20
+        </where>
+    </select>
+
+    <select id="userTwenty" resultType="cn.wisenergy.model.app.TeamPerformance">
+        select
+        <include refid="cols_all"/>
+        from
+        <include refid="table"/>
+        <where>
+            <if test="yearMonth != null">
+                AND(
+                YEAR(year_month) = YEAR(#{yearMonth})
+                AND MONTH(year_month) = MONTH(#{yearMonth}))
+            </if>
+            order by month_team_performance desc
+            limit 20
+        </where>
+    </select>
+
 </mapper>
\ No newline at end of file
diff --git a/wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml b/wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
index c2e109701d679ce8f55278c62ac15fc9a327c5bd..fc9c7f171b282004fb9d43590635c4327cef062c 100644
--- a/wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+++ b/wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
@@ -13,16 +13,6 @@
         <result column="fans_id" property="fansId"/>
         <result column="invite_code" property="inviteCode"/>
         <result column="be_invited_code" property="beInvitedCode"/>
-<!--        <result column="team_members_num" property="teamMembersNum"/>-->
-<!--        <result column="normal_user_num" property="normalUserNum"/>-->
-<!--        <result column="seedling_num" property="seedlingNum"/>-->
-<!--        <result column="bronze_tree_num" property="bronzeTreeNum"/>-->
-<!--        <result column="silver_tree_num" property="silverTreeNum"/>-->
-<!--        <result column="gold_tree_num" property="goldTreeNum"/>-->
-<!--        <result column="farmer_num" property="farmerNum"/>-->
-<!--        <result column="forest_start_num" property="forestStartNum"/>-->
-<!--        <result column="partner_num" property="partnerNum"/>-->
-<!--        <result column="referrer_num" property="referrerNum"/>-->
         <result column="create_time" property="createTime"/>
         <result column="update_time" property="updateTime"/>
     </resultMap>
@@ -36,66 +26,6 @@
         <include refid="cols_exclude_id"/>
     </sql>
 
-<!--    <sql id="cols_exclude_id">-->
-<!--        user_id,password, user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code,-->
-<!--        be_invited_code,team_members_num,normal_user_num,seedling_num,bronze_tree_num,silver_tree_num,-->
-<!--        gold_tree_num,farmer_num,forest_start_num,partner_num,referrer_num,create_time,update_time-->
-<!--    </sql>-->
-
-<!--    <sql id="vals">-->
-<!--        #{userId},#{password},#{userLevel},#{crossBorderLine},#{idCardNumber},#{fansNickname},#{fansId},#{inviteCode},-->
-<!--        #{beInvitedCode}, #{teamMembersNum},#{normalUserNum},#{seedlingNum},#{bronzeTreeNum},#{silverTreeNum},-->
-<!--        #{goldTreeNum}, #{farmerNum},#{forestStartNum},#{partnerNum},#{referrerNum},now(),now()-->
-<!--    </sql>-->
-
-<!--    <sql id="updateCondition">-->
-<!--        <if test="userId != null">user_id = #{userId},</if>-->
-<!--        <if test="password != null">password =#{password},</if>-->
-<!--        <if test="userLevel != null">user_level =#{userLevel},</if>-->
-<!--        <if test="crossBorderLine != null">cross_border_line =#{crossBorderLine},</if>-->
-<!--        <if test="idCardNumber != null">id_card_number = #{idCardNumber},</if>-->
-<!--        <if test="fansNickname != null">fans_nickname =#{fansNickname},</if>-->
-<!--        <if test="fansId != null">fans_id =#{fansId},</if>-->
-<!--        <if test="inviteCode != null">invite_code =#{inviteCode},</if>-->
-<!--        <if test="beInvitedCode != null">be_invited_code = #{beInvitedCode},</if>-->
-<!--        <if test="teamMembersNum != null">team_members_num = #{teamMembersNum},</if>-->
-<!--        <if test="normalUserNum != null">normal_user_num = #{normalUserNum},</if>-->
-<!--        <if test="seedlingNum != null">seedling_num = #{seedlingNum},</if>-->
-<!--        <if test="bronzeTreeNum != null">bronze_tree_num = #{bronzeTreeNum},</if>-->
-<!--        <if test="silverTreeNum != null">silver_tree_num = #{silverTreeNum},</if>-->
-<!--        <if test="goldTreeNum != null">gold_tree_num = #{goldTreeNum},</if>-->
-<!--        <if test="farmerNum != null">farmer_num = #{farmerNum},</if>-->
-<!--        <if test="forestStartNum != null">forest_start_num = #{forestStartNum},</if>-->
-<!--        <if test="partnerNum != null">partner_num = #{partnerNum},</if>-->
-<!--        <if test="referrerNum != null">referrer_num = #{referrerNum},</if>-->
-<!--        update_time =now()-->
-<!--    </sql>-->
-
-<!--    <sql id="criteria">-->
-<!--        <if test="id != null">id = #{id}</if>-->
-<!--        <if test="userId != null">and user_id = #{userId}</if>-->
-<!--        <if test="password != null">and password =#{password}</if>-->
-<!--        <if test="userLevel != null">and user_level =#{userLevel}</if>-->
-<!--        <if test="crossBorderLine != null">and cross_border_line =#{crossBorderLine}</if>-->
-<!--        <if test="idCardNumber != null">and id_card_number = #{idCardNumber}</if>-->
-<!--        <if test="fansNickname != null">and fans_nickname =#{fansNickname}</if>-->
-<!--        <if test="fansId != null">and fans_id =#{fansId}</if>-->
-<!--        <if test="inviteCode != null">and invite_code =#{inviteCode}</if>-->
-<!--        <if test="beInvitedCode != null">and be_invited_code = #{beInvitedCode}</if>-->
-<!--        <if test="teamMembersNum != null">and team_members_num = #{teamMembersNum}</if>-->
-<!--        <if test="normalUserNum != null">and normal_user_num = #{normalUserNum}</if>-->
-<!--        <if test="seedlingNum != null">and seedling_num = #{seedlingNum}</if>-->
-<!--        <if test="bronzeTreeNum != null">and bronze_tree_num = #{bronzeTreeNum}</if>-->
-<!--        <if test="silverTreeNum != null">and silver_tree_num = #{silverTreeNum}</if>-->
-<!--        <if test="goldTreeNum != null">and gold_tree_num = #{goldTreeNum}</if>-->
-<!--        <if test="farmerNum != null">and farmer_num = #{farmerNum}</if>-->
-<!--        <if test="forestStartNum != null">and forest_start_num = #{forestStartNum}</if>-->
-<!--        <if test="partnerNum != null">and partner_num = #{partnerNum}</if>-->
-<!--        <if test="referrerNum != null">and referrer_num = #{referrerNum}</if>-->
-<!--        <if test="createTime != null">and create_time &gt;= #{createTime}</if>-->
-<!--        <if test="updateTime != null">and #{updateTime} &gt;= update_time</if>-->
-<!--    </sql>-->
-
     <sql id="cols_exclude_id">
         user_id,password, user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code,
         be_invited_code,create_time,update_time
diff --git a/wisenergy-model/src/main/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java b/wisenergy-model/src/main/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java
new file mode 100644
index 0000000000000000000000000000000000000000..8df9e9750ba4ad8bb48fee91be7ac5e8e2da9921
--- /dev/null
+++ b/wisenergy-model/src/main/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java
@@ -0,0 +1,14 @@
+package cn.wisenergy.model.vo;
+
+import cn.wisenergy.model.app.TeamPerformance;
+import lombok.Data;
+
+/**
+ * @author 86187
+ */
+@Data
+public class TeamPerformanceSortVo {
+    private Double growthRate;
+
+    private TeamPerformance teamPerformance;
+}
diff --git a/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java b/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
index fb8b6cffa558db3ea41f90fc04dfb144dd3e6206..639fafdfcc08c05b65e471351dfb2d95defadad7 100644
--- a/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
+++ b/wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
@@ -37,5 +37,18 @@ public interface AccountService {
      */
     R<Boolean> performanceCount(List<OrderInfo> list);
 
+    /**
+     * 获取用户的商机信息
+     *
+     * @param userId 用户id
+     * @return 用户商机列表
+     */
     List<User> getByList(String userId);
+
+
+    /**
+     * 进步奖收益统计
+     * @return true or false
+     */
+    R<Boolean> progressPrizeCount ();
 }
diff --git a/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java b/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
index 7ae64d46e1fb8dc61a19367e7d8f65f7a444a2df..39a59ee63eac3a4edb61de61057c3c29a10c0d6d 100644
--- a/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+++ b/wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
@@ -6,21 +6,21 @@ import cn.wisenergy.mapper.MemberPercentMapper;
 import cn.wisenergy.mapper.TeamPerformanceMapper;
 import cn.wisenergy.mapper.UsersMapper;
 import cn.wisenergy.model.app.*;
+import cn.wisenergy.model.vo.TeamPerformanceSortVo;
 import cn.wisenergy.service.Manager.PublicManager;
 import cn.wisenergy.service.app.AccountService;
 import cn.wisenergy.service.Manager.AccountManager;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 
+import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 
 /**
@@ -185,6 +185,95 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
         return list;
     }
 
+    @Override
+    public R<Boolean> progressPrizeCount() {
+        log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.method");
+
+        //1、判断当前月是否是业绩开始的第一个月
+        List<TeamPerformance> teamPerformances = teamPerformanceMapper.getByBeforeTime(new Date());
+
+        //2、集合为空 是业绩开始的第一个月
+        if (CollectionUtils.isEmpty(teamPerformances)) {
+            //获取当月所有人业绩总额
+            Double totalMoney = teamPerformanceMapper.countByTime(new Date());
+            double number = Math.floor(totalMoney / 3980 / 12);
+            if (number != 0) {
+                //获取月业绩前20用户
+                List<TeamPerformance> list = teamPerformanceMapper.userTwenty(new Date());
+                if (CollectionUtils.isEmpty(list)) {
+                    return R.ok(0, true);
+                }
+
+                //获取20名进步最大的月业绩和
+                Double twentyTotal = teamPerformanceMapper.countTwenty(new Date());
+                for (TeamPerformance user : list) {
+                    //获取最大进步奖 百分比
+                    MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(user.getUserLevel(), 3);
+
+                    //计算收益
+                    double userTeamPerformance = user.getMonthTeamPerformance().doubleValue();
+                    double percent = memberPercent.getPercent().doubleValue();
+
+                    double income = number * 3980 * percent * userTeamPerformance / twentyTotal;
+
+                    //获取账户信息
+                    AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
+                    accountInfo.setPerformanceMonth(new BigDecimal(income));
+
+                    //更新用户账户表
+                    accountMapper.updateById(accountInfo);
+
+                }
+            }
+            return R.ok(0, true);
+        }
+
+        //3、集合不为空 不是业绩开始的第一个月
+        //获取用户列表
+        List<User> userList = usersMapper.findAll();
+        if (CollectionUtils.isEmpty(userList)) {
+            return R.ok(0, true);
+        }
+
+        //遍历 计算业绩增长率
+        List<TeamPerformanceSortVo> listVo = new ArrayList<>();
+        for (User user : userList) {
+            TeamPerformanceSortVo teamVo = new TeamPerformanceSortVo();
+            double growthRate;
+            //获取当月业绩
+            TeamPerformance teamPerformance = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), new Date());
+
+            //获取上月业绩
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(new Date());
+            cal.add(Calendar.MONTH, -1);
+            Date date = cal.getTime();
+            TeamPerformance lastMonth = teamPerformanceMapper.getByUserIdAndTime(user.getUserId(), date);
+            if (null == teamPerformance || null == lastMonth) {
+                growthRate = 0.00;
+            } else {
+                double month = teamPerformance.getMonthTeamPerformance().doubleValue();
+                double last = lastMonth.getMonthTeamPerformance().doubleValue();
+                if (last >= month) {
+                    growthRate = 0.00;
+                } else {
+                    growthRate = (month - last) / month;
+                }
+            }
+            teamVo.setGrowthRate(growthRate);
+            teamVo.setTeamPerformance(teamPerformance);
+            listVo.add(teamVo);
+        }
+
+        //对集合进行排序
+        listVo.sort(Comparator.comparing(TeamPerformanceSortVo::getGrowthRate).reversed());
+
+        //取排名前20的
+        listVo.subList(0, 20);
+        return R.ok(0,true);
+
+    }
+
     public void getUser(List<User> list, String userId) {
         User user = usersMapper.getByUserId(userId);
         list.add(user);