Преглед изворни кода

工作台添加活跃用户统计

yin_yu820 пре 18 часа
родитељ
комит
980047e0bb

+ 12 - 1
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/dp/DpController.java

@@ -83,6 +83,17 @@ public class DpController {
         return ResponseEntity.ok (map);
     }
 
+    /**
+     * 活跃用户统计
+     */
+    @ApiLog("活跃用户统计")
+    @ApiOperation(value = "活跃用户统计")
+    @GetMapping("InfoStatistics_Login")
+    public ResponseEntity<HashMap<String, Object>> InfoStatistics_Login(String date) throws Exception {
+        HashMap<String, Object> map=enterpriseInfoService.InfoStatistics_Login(date);
+        return ResponseEntity.ok (map);
+    }
+
     /**
      * 首页登录
      */
@@ -98,7 +109,7 @@ public class DpController {
             userDTO.setLoginIp ( ServletUtil.getClientIP ( RequestUtils.getRequest ( ) ) );
             userService.updateUserLoginInfo ( userDTO );
             String id= UUID.randomUUID().toString().replace("-","");
-            userService.getloginstr(id,"首页访问",userDTO.getId(),userDTO.getLoginDate());
+            userService.getloginstr(id,"首页访问",userDTO.getId(),userDTO.getLoginDate(),userDTO.getLoginIp());
         }
         return ResponseEntity.ok ("首页访问");
     }

+ 7 - 0
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/mapper/EnterpriseInfoMapper.java

@@ -50,6 +50,13 @@ public interface EnterpriseInfoMapper extends BaseMapper<EnterpriseInfo> {
     int getInfoStatistics5();
     List<HashMap<String, Object>> getInfoStatistics6();
 
+    int getInfoStatistics_Login1(String date);
+    HashMap<String, Object> getInfoStatistics_Login2(String date);
+    int getInfoStatistics_Login3(String date);
+    HashMap<String, Object> getInfoStatistics_Login4(String date);
+    int getInfoStatistics_Login5(String date);
+    HashMap<String, Object> getInfoStatistics_Login6(String date);
+
     List<HashMap<String, Object>> getAreaList();
     List<HashMap<String, Object>> getHyList();
     List<HashMap<String, Object>> getIndustryChainList();

+ 84 - 0
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/mapper/xml/EnterpriseInfoMapper.xml

@@ -221,6 +221,90 @@
         SELECT * from (SELECT industry,COUNT(*) as cc from ly_enterprise_info where del_flag=0  GROUP BY industry)c ORDER BY cc desc
     </select>
 
+<!--    某一天的活跃游客-->
+    <select id="getInfoStatistics_Login1" resultType="integer">
+        SELECT
+            COUNT(*) AS todayc
+        FROM
+            ( SELECT remote_addr FROM sys_login_log
+              WHERE type = 1 AND title='首页访问' and create_by is null AND DATE( create_date ) = #{date}
+        GROUP BY remote_addr ) c;
+    </select>
+
+<!--某一天的活跃用户(不含游客),企业用户,挂钩干部,办理部门,大走访办公室,系统管理员-->
+    <select id="getInfoStatistics_Login2" resultType="map">
+        SELECT
+            IFNULL(sum(IF(true,1,0)),0) as 'allcount',
+            IFNULL(sum(IF(b.role_id='38a14f1f42ed424eab4cb5d489596b0d',1,0)),0) as 'qycount',
+            IFNULL(sum(IF(b.role_id='1915280292672946177',1,0)),0) as 'gggbcount',
+            IFNULL(sum(IF(b.role_id='1910175949166673921',1,0)),0) as 'blbmcount',
+            IFNULL(sum(IF(b.role_id='1910175386924417025',1,0)),0) as 'dzfbgscount',
+            IFNULL(sum(IF(b.role_id='17bac1f980264e3e8193bc965538e2c6',1,0)),0) as 'admincount'
+        FROM
+            ( SELECT create_by FROM sys_login_log
+              WHERE type = 1 AND title='首页访问' and create_by is not null AND DATE( create_date ) = #{date}
+        GROUP BY create_by ) c
+            left join sys_user_role b on c.create_by=b.	user_id
+    </select>
+
+
+    <!--    某月的活跃游客-->
+    <select id="getInfoStatistics_Login3" resultType="integer">
+        SELECT
+            COUNT(*) AS todayc
+        FROM
+            ( SELECT remote_addr FROM sys_login_log
+              WHERE type = 1 AND title='首页访问' and create_by is null AND MONTH( create_date ) = MONTH( #{date}) AND YEAR( create_date ) = YEAR( #{date})
+        GROUP BY remote_addr ) c;
+    </select>
+
+    <!--某月的活跃用户(不含游客),企业用户,挂钩干部,办理部门,大走访办公室,系统管理员-->
+    <select id="getInfoStatistics_Login4" resultType="map">
+        SELECT
+            IFNULL(sum(IF(true,1,0)),0) as 'allcount',
+                IFNULL(sum(IF(b.role_id='38a14f1f42ed424eab4cb5d489596b0d',1,0)),0) as 'qycount',
+                IFNULL(sum(IF(b.role_id='1915280292672946177',1,0)),0) as 'gggbcount',
+                IFNULL(sum(IF(b.role_id='1910175949166673921',1,0)),0) as 'blbmcount',
+                IFNULL(sum(IF(b.role_id='1910175386924417025',1,0)),0) as 'dzfbgscount',
+                IFNULL(sum(IF(b.role_id='17bac1f980264e3e8193bc965538e2c6',1,0)),0) as 'admincount'
+        FROM
+            ( SELECT create_by FROM sys_login_log
+              WHERE type = 1 AND title='首页访问' and create_by is not null AND MONTH( create_date ) = MONTH(#{date}) AND YEAR( create_date ) = YEAR(#{date})
+        GROUP BY create_by ) c
+            left join sys_user_role b on c.create_by=b.	user_id
+    </select>
+
+    <!-- 截止到某天的活跃游客-->
+    <select id="getInfoStatistics_Login5" resultType="integer">
+        SELECT
+        COUNT(*) AS todayc
+        FROM
+        ( SELECT remote_addr FROM sys_login_log
+        WHERE type = 1 AND title='首页访问' and create_by is null AND create_date &lt;= #{date}
+        GROUP BY remote_addr ) c;
+    </select>
+
+    <!--截止到某天的活跃用户(不含游客),企业用户,走访服务企业用户,挂钩干部,办理部门,大走访办公室,系统管理员-->
+    <select id="getInfoStatistics_Login6" resultType="map">
+        SELECT
+        IFNULL(sum(IF(true,1,0)),0) as 'allcount',
+        IFNULL(sum(IF(b.role_id='38a14f1f42ed424eab4cb5d489596b0d',1,0)),0) as 'qycount',
+        IFNULL(sum(IF(b.role_id='38a14f1f42ed424eab4cb5d489596b0d' and e.des14 is not null,1,0)),0) as 'zfqycount',
+        IFNULL(sum(IF(b.role_id='1915280292672946177',1,0)),0) as 'gggbcount',
+        IFNULL(sum(IF(b.role_id='1910175949166673921',1,0)),0) as 'blbmcount',
+        IFNULL(sum(IF(b.role_id='1910175386924417025',1,0)),0) as 'dzfbgscount',
+        IFNULL(sum(IF(b.role_id='17bac1f980264e3e8193bc965538e2c6',1,0)),0) as 'admincount'
+
+        FROM
+        ( SELECT create_by FROM sys_login_log
+        WHERE type = 1 AND title='首页访问' and create_by is not null and create_date &lt;= #{date}
+        GROUP BY create_by ) c
+        left join sys_user_role b on c.create_by=b.	user_id
+        left join sys_user d on c.create_by=d.id
+        left join ly_enterprise_info e on e.phone=d.login_name
+    </select>
+
+
     <select id="getAreaList" resultType="map">
         SELECT des1 FROM `ly_enterprise_info` where del_flag=0 group By des1
     </select>

+ 28 - 0
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/enterpriseinfo/service/EnterpriseInfoService.java

@@ -144,6 +144,34 @@ public class EnterpriseInfoService extends ServiceImpl<EnterpriseInfoMapper, Ent
         return aa;
     }
 
+    public HashMap<String, Object> InfoStatistics_Login(String date) {
+        HashMap<String, Object> aa=new HashMap<>();
+        //某一天的活跃游客
+        int todaytouristcount=baseMapper.getInfoStatistics_Login1 (date);
+        // 某一天的活跃用户(不含游客),企业用户,挂钩干部,办理部门,大走访办公室,系统管理员
+        HashMap<String, Object> todays=baseMapper.getInfoStatistics_Login2 (date);
+        todays.put("todayc",todaytouristcount);
+
+
+        //某月的活跃游客
+        int monthtouristcount=baseMapper.getInfoStatistics_Login3 (date);
+        //某月的活跃用户(不含游客),企业用户,挂钩干部,办理部门,大走访办公室,系统管理员
+        HashMap<String, Object> months=baseMapper.getInfoStatistics_Login4 (date);
+        months.put("monthc",monthtouristcount);
+
+        //截止到某天的活跃游客
+        int totodaytouristcount=baseMapper.getInfoStatistics_Login5 (date+" 23:59:59");
+        // 截止到某天的活跃用户(不含游客),企业用户,走访服务企业用户,挂钩干部,办理部门,大走访办公室,系统管理员
+        HashMap<String, Object> totodays=baseMapper.getInfoStatistics_Login6 (date+" 23:59:59");
+        totodays.put("totodayc",totodaytouristcount);
+
+        aa.put("tadays",todays);
+        aa.put("months",months);
+        aa.put("totodays",totodays);
+
+        return aa;
+    }
+
     public HashMap<String, Object> getInfoStatistics() {
         HashMap<String, Object> aa=new HashMap<>();
 

+ 8 - 0
jp-ui/src/api/bigScreen/bigScreenApi.js

@@ -166,6 +166,14 @@ export default {
         })
     },
 
+    InfoStatistics_Login: function (params) {
+        return request({
+            url: '/dp/dp/InfoStatistics_Login',
+            method: 'get',
+            params: params
+        })
+    },
+
     InfoStatistics_industry: function (params) {
         return request({
             url: '/dp/dp/InfoStatistics_industry',

+ 105 - 9
jp-ui/src/views/modules/sys/dashboard/analysis/index.vue

@@ -37,26 +37,53 @@
         </div>
       </div>
       <div class="main-2">
-        <div class="main-periphery">
+        <div class="main-periphery" style="height: 34%;margin-left: 0%;">
           <div style="height: 25%"></div>
-          <div class="main-periphery-font" style="height: 30%; color: #063e2a">
-            今天活跃数
+          <div class="main-periphery-font" style="height: 43%; color: #063e2a;text-decoration: underline;margin-left: 4%;">
+
+            <el-date-picker
+              v-model="todaystr"
+              type="date"
+              size="small"
+              format="MM月dd日"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              cell-class-name="dateP"
+              @change="changeTime"
+              placeholder="请选择日期">
+            </el-date-picker>
+
           </div>
-          <div class="main-periphery-numerical" style="height: 45%; color: #028455">
-            {{ pageInfo.todayc }}
+          <div class="main-periphery-numerical" style="height: 45%; color: #028455;font-size: 15px;margin-left: 8%;">
+            <!-- {{ pageInfo.todayc }} -->
+            活跃用户数 {{pageInfo3.tadays.allcount+pageInfo3.tadays.todayc}} 个 ,其中企业用户 {{pageInfo3.tadays.qycount}} 个 ,游客 {{pageInfo3.tadays.todayc}} 个
+
           </div>
         </div>
 
-        <div class="main-periphery">
+        <div class="main-periphery" style="height: 33%;">
           <div style="height: 25%"></div>
           <div class="main-periphery-font" style="height: 30%; color: #063e2a">
-            当月活跃数
+            5月份
           </div>
-          <div class="main-periphery-numerical" style="height: 45%; color: #028455">
-            {{ pageInfo.samemonthc }}
+          <div class="main-periphery-numerical" style="height: 45%; color: #028455;font-size: 15px;">
+            <!-- {{ pageInfo.samemonthc }} -->
+            活跃用户数 {{pageInfo3.months.allcount+pageInfo3.months.monthc}} 个, 其中企业用户 {{pageInfo3.months.qycount}} 个 ,游客 {{pageInfo3.months.monthc}} 个
+
+
           </div>
         </div>
 
+        <div class="main-periphery" style="height: 33%;">
+          <div style="height: 25%"></div>
+          <div class="main-periphery-font" style="height: 30%; color: #063e2a">
+            截止到5月22日
+          </div>
+          <div class="main-periphery-numerical" style="height: 45%; color: #028455;font-size: 15px;">
+            活跃用户数 {{pageInfo3.totodays.allcount+pageInfo3.totodays.totodayc}} 个 ,其中企业用户 {{pageInfo3.totodays.qycount}} 个 ,走访服务企业 {{pageInfo3.totodays.zfqycount}} 个,游客 {{pageInfo3.totodays.totodayc}} 个
+
+
+          </div>
+        </div>
 
       </div>
 
@@ -379,6 +406,37 @@
         isBottom5: false,
         isBottom6: false,
         pageInfo: {},
+        pageInfo3: {
+            "months": {
+                "gggbcount": 0,
+                "blbmcount": 0,
+                "dzfbgscount": 0,
+                "monthc": 0,
+                "qycount": 0,
+                "admincount": 0,
+                "allcount": 0
+            },
+            "totodays": {
+                "gggbcount": 0,
+                "blbmcount": 0,
+                "dzfbgscount": 0,
+                "totodayc": 0,
+                "qycount": 0,
+                "admincount": 0,
+                "allcount": 0,
+                "zfqycount": 0
+            },
+            "tadays": {
+                "gggbcount": 0,
+                "blbmcount": 0,
+                "dzfbgscount": 0,
+                "qycount": 0,
+                "admincount": 0,
+                "allcount": 0,
+                "todayc": 0
+            }
+        },
+        todaystr: "",
         pageInfo2: [{
           industry: '',
           cc: ''
@@ -460,6 +518,20 @@
     },
     activated() {
 
+      // 获取当前日期和时间
+      const now = new Date();
+
+      // 获取年份、月份、日期、小时、分钟和秒
+      const year = now.getFullYear();
+      const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始
+      const day = String(now.getDate()).padStart(2, '0');
+
+      // 组合成所需的格式
+      const formattedDate = `${year}-${month}-${day} 23:59:59`;
+
+      console.log(formattedDate); // 输出类似于 "2025-05-23 23:59:59"
+
+      this.todaystr=formattedDate;
       this.changeColor();
       this.getPageInfo();
       this.getMenuList();
@@ -620,6 +692,14 @@
           this.pageInfo = data;
         });
 
+        let str=this.todaystr.substring(0,10)
+        //添加活跃用户汇总
+        bigScreenService.InfoStatistics_Login({date:str}).then(({
+          data
+        }) => {
+          this.pageInfo3 = data;
+        });
+
         bigScreenService.InfoStatistics_industry({}).then(({
           data
         }) => {
@@ -706,6 +786,17 @@
           });
         });
       },
+      changeTime(){
+
+        let str=this.todaystr.substring(0,10)
+        //添加活跃用户汇总
+        bigScreenService.InfoStatistics_Login({date:str}).then(({
+          data
+        }) => {
+          this.pageInfo3 = data;
+        });
+        console.log(this.todaystr)
+      },
 
       changeColor() {
         this.textColor1 = "#FF1C1C";
@@ -948,6 +1039,11 @@
     color: #fff;
   }
 
+  .dateP{
+    background-color: aqua;
+    color: #00ff7f;
+  }
+
   @keyframes myMove {
     0% {
       transform: translateX(0%);