huangzhiguo пре 1 година
родитељ
комит
45e092dc98

+ 10 - 4
src/main/java/com/caimei/modules/user/dao/CmPortraitDao.java

@@ -44,7 +44,7 @@ public interface CmPortraitDao extends CrudDao<CmPortrait> {
      * @param clubSales
      * @param clubSales
      * @return
      * @return
      */
      */
-    List<clubData> getNewClubInfo(CmClubSales clubSales);
+    List<ClubData> getNewClubInfo(CmClubSales clubSales);
 
 
     /**
     /**
      * 新注册机构Id
      * 新注册机构Id
@@ -57,14 +57,14 @@ public interface CmPortraitDao extends CrudDao<CmPortrait> {
      * @param clubSales
      * @param clubSales
      * @return
      * @return
      */
      */
-    List<clubData> getClubRemark(CmClubSales clubSales);
+    List<ClubData> getClubRemark(CmClubSales clubSales);
 
 
     /**
     /**
      * 游客咨询记录
      * 游客咨询记录
      * @param clubSales
      * @param clubSales
      * @return
      * @return
      */
      */
-    List<clubData> getClubVisitorRemark(CmClubSales clubSales);
+    List<ClubData> getClubVisitorRemark(CmClubSales clubSales);
 
 
     /**
     /**
      * 用户活跃信息日期
      * 用户活跃信息日期
@@ -76,5 +76,11 @@ public interface CmPortraitDao extends CrudDao<CmPortrait> {
      * 日期下用户活跃费分类数据
      * 日期下用户活跃费分类数据
      * @return
      * @return
      */
      */
-    List<clubData> getActiveInfo(@Param("time") String time, @Param("serviceProviderId") Integer serviceProviderId);
+    List<ClubData> getActiveInfo(@Param("time") String time, @Param("serviceProviderId") Integer serviceProviderId);
+
+    /**
+     * 机构活跃信息
+     * @return
+     */
+    List<ClubData> getClubActive();
 }
 }

+ 2 - 2
src/main/java/com/caimei/modules/user/entity/clubData.java → src/main/java/com/caimei/modules/user/entity/ClubData.java

@@ -6,7 +6,7 @@ package com.caimei.modules.user.entity;
  * @author : hzg
  * @author : hzg
  * @date : 2023/11/27
  * @date : 2023/11/27
  */
  */
-public class clubData {
+public class ClubData {
     /**
     /**
      * 机构id
      * 机构id
      */
      */
@@ -20,7 +20,7 @@ public class clubData {
      */
      */
     private Integer number;
     private Integer number;
     /**
     /**
-     * activeStatus
+     * 活跃状态 0:活跃、1:不活跃
      */
      */
     private Integer activeStatus;
     private Integer activeStatus;
 
 

+ 21 - 1
src/main/java/com/caimei/modules/user/entity/CmClubSales.java

@@ -14,7 +14,7 @@ public class CmClubSales {
     private Integer spID;
     private Integer spID;
     // 日期类别 1日 2月 3半年 4全年
     // 日期类别 1日 2月 3半年 4全年
     private Integer dateType;
     private Integer dateType;
-    // 数据类型 0新注册机构统计 1机构咨询记录统计 2机构活跃趋势 3初始状态
+    // 数据类型 0新注册机构统计、1机构咨询记录统计、2机构活跃趋势、3机构活跃占比、4初始状态
     private Integer type;
     private Integer type;
     // 开始时间
     // 开始时间
     private String startTime;
     private String startTime;
@@ -22,6 +22,10 @@ public class CmClubSales {
     private String endTime;
     private String endTime;
     // 值 name - value
     // 值 name - value
     private ArrayList<OrderPortrait> portrait;
     private ArrayList<OrderPortrait> portrait;
+    // 机构活跃总数
+    private Integer clubProportionTotal;
+    // 机构活跃
+    private ArrayList<OrderPortrait> clubProportion;
     // 机构咨询记录内圈数据
     // 机构咨询记录内圈数据
     private ArrayList<OrderPortrait> internalPortrait;
     private ArrayList<OrderPortrait> internalPortrait;
     // 新注册机构总数量
     // 新注册机构总数量
@@ -84,6 +88,22 @@ public class CmClubSales {
         this.portrait = portrait;
         this.portrait = portrait;
     }
     }
 
 
+    public Integer getClubProportionTotal() {
+        return clubProportionTotal;
+    }
+
+    public void setClubProportionTotal(Integer clubProportionTotal) {
+        this.clubProportionTotal = clubProportionTotal;
+    }
+
+    public ArrayList<OrderPortrait> getClubProportion() {
+        return clubProportion;
+    }
+
+    public void setClubProportion(ArrayList<OrderPortrait> clubProportion) {
+        this.clubProportion = clubProportion;
+    }
+
     public ArrayList<OrderPortrait> getInternalPortrait() {
     public ArrayList<OrderPortrait> getInternalPortrait() {
         return internalPortrait;
         return internalPortrait;
     }
     }

+ 36 - 13
src/main/java/com/caimei/modules/user/service/ClubPortraitService.java

@@ -6,7 +6,6 @@ import com.caimei.modules.user.entity.*;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.MathUtil;
 import com.thinkgem.jeesite.common.utils.ObjectUtils;
 import com.thinkgem.jeesite.common.utils.ObjectUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.utils.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -560,17 +559,17 @@ public class ClubPortraitService {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
         // 新注册机构
         // 新注册机构
-        if (0 == clubSales.getType() || 3 == clubSales.getType()) {
+        if (0 == clubSales.getType() || 4 == clubSales.getType()) {
 
 
             int spClub = 0, unSpClub = 0;
             int spClub = 0, unSpClub = 0;
             ArrayList<OrderPortrait> orderPortraits = new ArrayList<>();
             ArrayList<OrderPortrait> orderPortraits = new ArrayList<>();
             OrderPortrait orderPortrait = new OrderPortrait();
             OrderPortrait orderPortrait = new OrderPortrait();
-            List<clubData> clubList = cmPortraitDao.getNewClubInfo(clubSales);
+            List<ClubData> clubList = cmPortraitDao.getNewClubInfo(clubSales);
             int length = clubList.size();
             int length = clubList.size();
             NumberFormat instance = NumberFormat.getInstance();
             NumberFormat instance = NumberFormat.getInstance();
             instance.setMaximumFractionDigits(2);
             instance.setMaximumFractionDigits(2);
             if (length != 0) {
             if (length != 0) {
-                for (clubData club : clubList) {
+                for (ClubData club : clubList) {
                     if ( null == club.getSpID() || 1342 == club.getSpID()) {
                     if ( null == club.getSpID() || 1342 == club.getSpID()) {
                         // 未分配协销结构与
                         // 未分配协销结构与
                         spClub++;
                         spClub++;
@@ -605,11 +604,11 @@ public class ClubPortraitService {
             clubSales.setEndTime(endTime);
             clubSales.setEndTime(endTime);
         }
         }
         // 机构咨询记录
         // 机构咨询记录
-        if (1 == clubSales.getType() || 3 == clubSales.getType()) {
+        if (1 == clubSales.getType() || 4 == clubSales.getType()) {
             // 机构咨询记录
             // 机构咨询记录
-            List<clubData> clubRemark = cmPortraitDao.getClubRemark(clubSales);
+            List<ClubData> clubRemark = cmPortraitDao.getClubRemark(clubSales);
             // 游客咨询记录
             // 游客咨询记录
-            List<clubData> clubVisitorRemark = cmPortraitDao.getClubVisitorRemark(clubSales);
+            List<ClubData> clubVisitorRemark = cmPortraitDao.getClubVisitorRemark(clubSales);
             // 新注册机构
             // 新注册机构
             List<Integer> clubIdList = cmPortraitDao.getNewClubId(clubSales);
             List<Integer> clubIdList = cmPortraitDao.getNewClubId(clubSales);
             int total = 0;
             int total = 0;
@@ -625,7 +624,7 @@ public class ClubPortraitService {
                 int fillClub = 0, fillRemark = 0 ;
                 int fillClub = 0, fillRemark = 0 ;
                 // 未填写过机构数、咨询记录数
                 // 未填写过机构数、咨询记录数
                 int unFillClub = 0;
                 int unFillClub = 0;
-                for (clubData remark : clubRemark) {
+                for (ClubData remark : clubRemark) {
                     total += remark.getNumber();
                     total += remark.getNumber();
                     clubRemarkNumber += remark.getNumber();
                     clubRemarkNumber += remark.getNumber();
                     for (Integer clubId : clubIdList) {
                     for (Integer clubId : clubIdList) {
@@ -657,7 +656,7 @@ public class ClubPortraitService {
                 orderPortrait = new OrderPortrait();
                 orderPortrait = new OrderPortrait();
             }
             }
             if (clubVisitorRemark.size() != 0) {
             if (clubVisitorRemark.size() != 0) {
-                for (clubData tourist : clubVisitorRemark) {
+                for (ClubData tourist : clubVisitorRemark) {
                     total += tourist.getNumber();
                     total += tourist.getNumber();
                     touristRemarkNumber += tourist.getNumber();
                     touristRemarkNumber += tourist.getNumber();
                 }
                 }
@@ -682,7 +681,7 @@ public class ClubPortraitService {
             clubSales.setPortrait(orderPortraits);
             clubSales.setPortrait(orderPortraits);
         }
         }
         // 机构活跃
         // 机构活跃
-        if (2 == clubSales.getType() || 3 == clubSales.getType()) {
+        if (2 == clubSales.getType() || 4 == clubSales.getType()) {
             if (expty) {
             if (expty) {
                 // 默认前一周
                 // 默认前一周
                 calendar.setTime(date);
                 calendar.setTime(date);
@@ -704,17 +703,17 @@ public class ClubPortraitService {
             for (String activeDate : activeDateList) {
             for (String activeDate : activeDateList) {
                 names.add(activeDate);
                 names.add(activeDate);
                 // 该天用户活跃数据
                 // 该天用户活跃数据
-                List<clubData> activeInfo = cmPortraitDao.getActiveInfo(activeDate, clubSales.getSpID());
+                List<ClubData> activeInfo = cmPortraitDao.getActiveInfo(activeDate, clubSales.getSpID());
                 Integer activeNumber = 0;
                 Integer activeNumber = 0;
                 Integer unActiveNumber = 0;
                 Integer unActiveNumber = 0;
                 if (null != activeInfo && activeInfo.size() > 0) {
                 if (null != activeInfo && activeInfo.size() > 0) {
                     // 活跃数据
                     // 活跃数据
-                    List<clubData> activeClubList = activeInfo.stream().filter(ac -> ac.getActiveStatus().equals(0)).collect(Collectors.toList());
+                    List<ClubData> activeClubList = activeInfo.stream().filter(ac -> ac.getActiveStatus().equals(0)).collect(Collectors.toList());
                     if (null != activeClubList && activeClubList.size() > 0) {
                     if (null != activeClubList && activeClubList.size() > 0) {
                         activeNumber = activeClubList.get(0).getNumber();
                         activeNumber = activeClubList.get(0).getNumber();
                     }
                     }
                     // 不活跃数据
                     // 不活跃数据
-                    List<clubData> unActiveClubList = activeInfo.stream().filter(ac -> ac.getActiveStatus().equals(1)).collect(Collectors.toList());
+                    List<ClubData> unActiveClubList = activeInfo.stream().filter(ac -> ac.getActiveStatus().equals(1)).collect(Collectors.toList());
                     if (null != unActiveClubList && unActiveClubList.size() > 0) {
                     if (null != unActiveClubList && unActiveClubList.size() > 0) {
                         unActiveNumber = unActiveClubList.get(0).getNumber();
                         unActiveNumber = unActiveClubList.get(0).getNumber();
                     }
                     }
@@ -726,6 +725,30 @@ public class ClubPortraitService {
             clubSales.setValues(active);
             clubSales.setValues(active);
             clubSales.setValues1(unActive);
             clubSales.setValues1(unActive);
         }
         }
+        // 机构活跃占比
+        if (3 == clubSales.getType() || 4 == clubSales.getType()) {
+            ArrayList<OrderPortrait> orderPortraits = new ArrayList<>();
+            OrderPortrait orderPortrait = new OrderPortrait();
+            List<ClubData> clubActive = cmPortraitDao.getClubActive();
+            int active = 0, unActive = 0, max = 0;
+            for (ClubData clubData : clubActive) {
+                max += clubData.getNumber();
+                if (0 == clubData.getActiveStatus()) {
+                    active += clubData.getNumber();
+                } else {
+                    unActive += clubData.getNumber();
+                }
+            }
+            orderPortrait.setName("活跃机构 " + MathUtil.mul(MathUtil.div(active, max, 2), 100) + "%" + active + " 个");
+            orderPortrait.setValue(active);
+            orderPortraits.add(orderPortrait);
+            orderPortrait = new OrderPortrait();
+            orderPortrait.setName("不活跃机构 " + MathUtil.mul(MathUtil.div(unActive, max, 2), 100) + "%" + unActive + " 个");
+            orderPortrait.setValue(unActive);
+            orderPortraits.add(orderPortrait);
+            clubSales.setClubProportionTotal(max);
+            clubSales.setClubProportion(orderPortraits);
+        }
         try {
         try {
             clubSales.setStartTime(dateFormat.format(dateFormat.parse(clubSales.getStartTime())));;
             clubSales.setStartTime(dateFormat.format(dateFormat.parse(clubSales.getStartTime())));;
             clubSales.setEndTime(dateFormat.format(dateFormat.parse(clubSales.getEndTime())));;
             clubSales.setEndTime(dateFormat.format(dateFormat.parse(clubSales.getEndTime())));;

+ 9 - 0
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -1848,6 +1848,7 @@ public class AgencyController extends BaseController {
             ArrDate newClub = new ArrDate();
             ArrDate newClub = new ArrDate();
             ArrDate remarks = new ArrDate();
             ArrDate remarks = new ArrDate();
             ArrDate active = new ArrDate();
             ArrDate active = new ArrDate();
+            ArrDate clubProportion = new ArrDate();
             // 新注册机构
             // 新注册机构
             newClub.setClubInfo(clubSales.getPortrait());
             newClub.setClubInfo(clubSales.getPortrait());
             if (clubSales.getTotal() == null) {
             if (clubSales.getTotal() == null) {
@@ -1872,6 +1873,14 @@ public class AgencyController extends BaseController {
             } else {
             } else {
                 map.put("remarks", remarks);
                 map.put("remarks", remarks);
             }
             }
+            // 机构活跃饼图
+            clubProportion.setClubInfo(clubSales.getClubProportion());
+            if (null == clubSales.getClubProportionTotal() || clubSales.getClubProportionTotal() ==  0) {
+                map.put("clubProportion", null);
+            } else {
+                map.put("clubProportion", clubProportion);
+            }
+            // 机构活跃线型图
             active.setName(clubSales.getNames());
             active.setName(clubSales.getNames());
             active.setValue(clubSales.getValues());
             active.setValue(clubSales.getValues());
             active.setValue1(clubSales.getValues1());
             active.setValue1(clubSales.getValues1());

+ 15 - 4
src/main/resources/mappings/modules/user/CmPortraitMapper.xml

@@ -178,7 +178,7 @@
         FROM serviceprovider WHERE organizeID = 0  AND openId IS NOT NULL AND openId != '' AND status = 90 AND serviceProviderID != 1342
         FROM serviceprovider WHERE organizeID = 0  AND openId IS NOT NULL AND openId != '' AND status = 90 AND serviceProviderID != 1342
     </select>
     </select>
 
 
-    <select id="getNewClubInfo" resultType="com.caimei.modules.user.entity.clubData">
+    <select id="getNewClubInfo" resultType="com.caimei.modules.user.entity.ClubData">
         SELECT
         SELECT
         c.clubID,
         c.clubID,
         c.spID
         c.spID
@@ -209,7 +209,7 @@
         </where>
         </where>
     </select>
     </select>
 
 
-    <select id="getClubRemark" resultType="com.caimei.modules.user.entity.clubData">
+    <select id="getClubRemark" resultType="com.caimei.modules.user.entity.ClubData">
         SELECT clubId as clubID, SUM(num) as number FROM
         SELECT clubId as clubID, SUM(num) as number FROM
         (
         (
         SELECT
         SELECT
@@ -249,7 +249,7 @@
         ) b group by b.clubId
         ) b group by b.clubId
     </select>
     </select>
 
 
-    <select id="getClubVisitorRemark" resultType="com.caimei.modules.user.entity.clubData">
+    <select id="getClubVisitorRemark" resultType="com.caimei.modules.user.entity.ClubData">
         SELECT
         SELECT
         clubId,
         clubId,
         COUNT(id) as number
         COUNT(id) as number
@@ -284,7 +284,7 @@
         order by addTime asc
         order by addTime asc
     </select>
     </select>
 
 
-    <select id="getActiveInfo" resultType="com.caimei.modules.user.entity.clubData">
+    <select id="getActiveInfo" resultType="com.caimei.modules.user.entity.ClubData">
         SELECT
         SELECT
             coas.activeStatus as activeStatus,
             coas.activeStatus as activeStatus,
             COUNT(coas.id) as number
             COUNT(coas.id) as number
@@ -301,4 +301,15 @@
         </where>
         </where>
         GROUP BY coas.activeStatus
         GROUP BY coas.activeStatus
     </select>
     </select>
+
+    <select id="getClubActive" resultType="com.caimei.modules.user.entity.ClubData">
+        SELECT
+            coas.activeStatus AS activeStatus,
+            COUNT(c.clubId) AS number
+        FROM cm_organ_active_system coas
+                 LEFT JOIN club c ON coas.userId = c.userId
+                 LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId
+        WHERE coas.stage = 0
+        GROUP BY coas.activeStatus
+    </select>
 </mapper>
 </mapper>

+ 14 - 0
src/main/webapp/WEB-INF/views/modules/userNew/cmClubSales.jsp

@@ -103,6 +103,20 @@
         </div>
         </div>
     </div>
     </div>
     <div class="flex-content">
     <div class="flex-content">
+        <div class="flex-box clubProportion">
+            <div class="box-title">
+                <H4 class="H_tag">机构活跃占比</H4>
+                <a id="clubActiceDetails" href="javaScript: void(0)">详情></a>
+            </div>
+            <div class="box-eachts">
+                <div class="eachts-data" id="clubProportion" style="">
+                    <!-- keyWordsEacths表 -->
+                </div>
+                <div class="eachts-none" id="clubProportionNone">
+                    <p>暂无数据</p>
+                </div>
+            </div>
+        </div>
         <div class="flex-box max">
         <div class="flex-box max">
             <div class="box-title">
             <div class="box-title">
                 <H4 class="H_tag">机构活跃趋势</H4>
                 <H4 class="H_tag">机构活跃趋势</H4>

+ 4 - 1
src/main/webapp/static/modules/cmClubSales/cmClubSales.css

@@ -24,7 +24,10 @@
     border-radius: 10px;
     border-radius: 10px;
 }
 }
 .flex-content .flex-box.max{
 .flex-content .flex-box.max{
-    width:1415px;
+    width: 60%;
+}
+.flex-content .flex-box.clubProportion{
+    width: 21.5%;
 }
 }
 .flex-content .flex-box.box1{
 .flex-content .flex-box.box1{
     width: 1415px;
     width: 1415px;

+ 1 - 0
src/main/webapp/static/modules/cmClubSales/cmClubSales.js

@@ -11,6 +11,7 @@ $(function(){
     getClubSalesEacthsData(0,1);
     getClubSalesEacthsData(0,1);
     getClubSalesEacthsData(1,1);
     getClubSalesEacthsData(1,1);
     getClubSalesEacthsData(2,1);
     getClubSalesEacthsData(2,1);
+    getClubSalesEacthsData(3,1);
     // 点击筛选新注册机构统计数据
     // 点击筛选新注册机构统计数据
     $('#clubTabs').children("a").each(function (index) {
     $('#clubTabs').children("a").each(function (index) {
         $(this).click(function () {
         $(this).click(function () {

+ 73 - 1
src/main/webapp/static/modules/cmClubSales/cmClubSalesEachs.js

@@ -166,11 +166,19 @@ const  getClubSalesEacthsData = function (type,dateType) {
                             setClubActiveData(type,data)
                             setClubActiveData(type,data)
                         }
                         }
                         break;
                         break;
+                    case 3:
+                        if(!data.clubProportion){
+                            $('#clubProportionNone').show();
+                            $('#clubProportion').hide();
+                        }else{
+                            clubProportion(type,data)
+                        }
+                        break;
                 }
                 }
                 defaultParams.startTime = '';
                 defaultParams.startTime = '';
                 defaultParams.endTime = '';
                 defaultParams.endTime = '';
             } else {
             } else {
-                console.log('机构订单图表数据异常')
+                console.log('机构-协销图表数据异常')
             }
             }
         }
         }
     });
     });
@@ -256,6 +264,25 @@ const setClubActiveData = function (type,data) {
     }
     }
     getClubActiveEacths(clubMap[type].fn, clubMap[type].id, clubMap[type].name, clubMap[type].active, clubMap[type].unActive);
     getClubActiveEacths(clubMap[type].fn, clubMap[type].id, clubMap[type].name, clubMap[type].active, clubMap[type].unActive);
 }
 }
+// 设置新注册机构统计数据
+const clubProportion = function (type,data) {
+    const clubMap = {
+        3:{ // 新注册机构统计
+            fn:function () {
+                $('.eachts-total').show();
+                $('#clubProportionNone').hide();
+                $('#clubProportion').show();
+            },
+            id:'clubProportion',
+            series:{
+                name:'机构活跃占比',
+                color:['#3aa0ff','#36cbcb','#fad337','#4dcb73','#f2637b','#975fe4'],
+                seriesData: data.clubProportion.clubInfo
+            },
+        }
+    }
+    getclubProportionEacths(clubMap[type].fn,clubMap[type].id,clubMap[type].series);
+}
 // 基于准备好的dom,初始化echarts实例
 // 基于准备好的dom,初始化echarts实例
 const getClubEacths = function (handleFn,id,data) {
 const getClubEacths = function (handleFn,id,data) {
     // 基于准备好的dom,初始化echarts实例
     // 基于准备好的dom,初始化echarts实例
@@ -419,3 +446,48 @@ const getClubActiveEacths = function (handleFn, id, data, active, unActive) {
     myChart.setOption(option);
     myChart.setOption(option);
     window.onresize = myChart.resize;//移动适配
     window.onresize = myChart.resize;//移动适配
 };
 };
+
+// 基于准备好的dom,初始化echarts实例
+const getclubProportionEacths = function (handleFn,id,data) {
+    // 基于准备好的dom,初始化echarts实例
+    handleFn();
+    const myChart = echarts.init(document.getElementById(id));
+    const option = {
+        tooltip: {
+            trigger: 'item'
+        },
+        legend: {
+            orient: 'vertical',
+            bottom: '0%',
+            textStyle: {
+                fontSize: 14,
+                color:'#333333'
+            },
+        },
+        color:data.color,
+        series: [
+            {
+                name: data.name,
+                type: 'pie',
+                radius: ['50%', '70%'],
+                center: ['50%', '50%'],
+                avoidLabelOverlap: false,
+                emphasis: {
+                    itemStyle: {
+                        shadowBlur: 10,
+                        shadowOffsetX: 0,
+                        shadowColor: 'rgba(0, 0, 0, 0.5)'
+                    }
+                },
+                label: {
+                    show: false,
+                    position: 'center'
+                },
+                data:data.seriesData
+            }
+        ]
+    };
+    // 使用刚指定的配置项和数据显示图表。
+    myChart.setOption(option);
+    window.onresize = myChart.resize;//移动适配
+};