Browse Source

feat: 求职人员统计增加月份查询

zhangying 9 months ago
parent
commit
efbe32246b

+ 6 - 6
src/main/java/com/hz/employmentsite/controller/statistics/StatisticsController.java

@@ -78,8 +78,8 @@ public class StatisticsController {
      * 查询各个年龄段的求职人员数量
      * 查询各个年龄段的求职人员数量
      */
      */
     @GetMapping("/jobUserCountByAgeRange")
     @GetMapping("/jobUserCountByAgeRange")
-    public BaseResponse findJobUserCountByAgeRange() {
-        List<AgeRangeJobUserCount> result = statisticsService.findJobUserCountByAgeRange();
+    public BaseResponse findJobUserCountByAgeRange(@RequestParam(required = false) String year, @RequestParam(required = false) String month) {
+        List<AgeRangeJobUserCount> result = statisticsService.findJobUserCountByAgeRange(year, month);
         return RespGenerstor.success(result);
         return RespGenerstor.success(result);
     }
     }
 
 
@@ -87,8 +87,8 @@ public class StatisticsController {
      * 查询各重点人员类别在各学历的分布情况
      * 查询各重点人员类别在各学历的分布情况
      */
      */
     @GetMapping("/jobUserCountByPersonType")
     @GetMapping("/jobUserCountByPersonType")
-    public BaseResponse findJobUserCountByPersonType() {
-        List<PersonTypeJobUserCount> result = statisticsService.findJobUserCountByPersonType();
+    public BaseResponse findJobUserCountByPersonType(@RequestParam(required = false) String year, @RequestParam(required = false) String month) {
+        List<PersonTypeJobUserCount> result = statisticsService.findJobUserCountByPersonType(year, month);
         return RespGenerstor.success(result);
         return RespGenerstor.success(result);
     }
     }
 
 
@@ -96,8 +96,8 @@ public class StatisticsController {
      * 查询各区县的普通失业人员与就业困难人员情况
      * 查询各区县的普通失业人员与就业困难人员情况
      */
      */
     @GetMapping("/jobUserByRegionAndDifficulty")
     @GetMapping("/jobUserByRegionAndDifficulty")
-    public BaseResponse findJobUserByRegionAndDifficulty() {
-        List<RegionJobUserCount> result = statisticsService.findJobUserByRegionAndDifficulty();
+    public BaseResponse findJobUserByRegionAndDifficulty(@RequestParam(required = false) String year, @RequestParam(required = false) String month) {
+        List<RegionJobUserCount> result = statisticsService.findJobUserByRegionAndDifficulty(year, month);
         return RespGenerstor.success(result);
         return RespGenerstor.success(result);
     }
     }
 
 

+ 4 - 4
src/main/java/com/hz/employmentsite/mapper/cquery/StatisticsCQuery.java

@@ -40,22 +40,22 @@ public interface StatisticsCQuery {
     /**
     /**
      * 查询各年龄段的求职人员数量
      * 查询各年龄段的求职人员数量
      */
      */
-    List<AgeRangeJobUserCount> findJobUserCountByAgeRange();
+    List<AgeRangeJobUserCount> findJobUserCountByAgeRange(@Param("year") String year, @Param("month") String month);
 
 
     /**
     /**
      * 查询各重点人员类别在各学历的分布情况
      * 查询各重点人员类别在各学历的分布情况
      */
      */
-    List<PersonTypeJobUserCount> findJobUserCountByPersonType();
+    List<PersonTypeJobUserCount> findJobUserCountByPersonType(@Param("year") String year, @Param("month") String month);
 
 
     /**
     /**
      * 查询各县区的未就业的求职人员清空
      * 查询各县区的未就业的求职人员清空
      */
      */
-    List<RegionJobUserCount> findJobUserByRegionAndStatus();
+    List<RegionJobUserCount> findJobUserByRegionAndStatus(@Param("year") String year, @Param("month") String month);
 
 
     /**
     /**
      * 查询各县区的就业困难人员情况(特殊重点人员类别)
      * 查询各县区的就业困难人员情况(特殊重点人员类别)
      */
      */
-    List<RegionJobUserCount> findJobUserByRegionAndPersonType();
+    List<RegionJobUserCount> findJobUserByRegionAndPersonType(@Param("year") String year, @Param("month") String month);
 
 
     /**
     /**
      * 查询年度添加的企业数量
      * 查询年度添加的企业数量

+ 7 - 7
src/main/java/com/hz/employmentsite/services/impl/statistics/StatisticsServiceImpl.java

@@ -288,16 +288,16 @@ public class StatisticsServiceImpl implements StatisticsService {
      * 查询各年龄段的求职人员数量
      * 查询各年龄段的求职人员数量
      */
      */
     @Override
     @Override
-    public List<AgeRangeJobUserCount> findJobUserCountByAgeRange() {
-        return statisticsCQuery.findJobUserCountByAgeRange();
+    public List<AgeRangeJobUserCount> findJobUserCountByAgeRange(String year, String month) {
+        return statisticsCQuery.findJobUserCountByAgeRange(year, month);
     }
     }
 
 
     /**
     /**
      * 查询各重点人员类别在各学历的分布情况
      * 查询各重点人员类别在各学历的分布情况
      */
      */
     @Override
     @Override
-    public List<PersonTypeJobUserCount> findJobUserCountByPersonType() {
-        List<PersonTypeJobUserCount> result = statisticsCQuery.findJobUserCountByPersonType();
+    public List<PersonTypeJobUserCount> findJobUserCountByPersonType(String year, String month) {
+        List<PersonTypeJobUserCount> result = statisticsCQuery.findJobUserCountByPersonType(year, month);
 
 
         // 从 result 中获取到不重复所有的学历ID与名称值
         // 从 result 中获取到不重复所有的学历ID与名称值
         Map<Integer, String> cultureRankToNameMap = new HashMap<>();
         Map<Integer, String> cultureRankToNameMap = new HashMap<>();
@@ -342,9 +342,9 @@ public class StatisticsServiceImpl implements StatisticsService {
      * 查询县区的失业人员与就业困难人数情况
      * 查询县区的失业人员与就业困难人数情况
      */
      */
     @Override
     @Override
-    public List<RegionJobUserCount> findJobUserByRegionAndDifficulty() {
-        List<RegionJobUserCount> regionCountList = statisticsCQuery.findJobUserByRegionAndStatus();
-        List<RegionJobUserCount> difficultyCountList = statisticsCQuery.findJobUserByRegionAndPersonType();
+    public List<RegionJobUserCount> findJobUserByRegionAndDifficulty(String year, String month) {
+        List<RegionJobUserCount> regionCountList = statisticsCQuery.findJobUserByRegionAndStatus(year, month);
+        List<RegionJobUserCount> difficultyCountList = statisticsCQuery.findJobUserByRegionAndPersonType(year, month);
 
 
         // 解析两个查询结果
         // 解析两个查询结果
         regionCountList.forEach(item -> {
         regionCountList.forEach(item -> {

+ 3 - 3
src/main/java/com/hz/employmentsite/services/service/statistics/StatisticsService.java

@@ -37,15 +37,15 @@ public interface StatisticsService {
     /**
     /**
      * 查询各年龄段的求职人员数量
      * 查询各年龄段的求职人员数量
      */
      */
-    List<AgeRangeJobUserCount> findJobUserCountByAgeRange();
+    List<AgeRangeJobUserCount> findJobUserCountByAgeRange(String year, String month);
 
 
     /**
     /**
      * 查询各重点人员类别在各学历的分布情况
      * 查询各重点人员类别在各学历的分布情况
      */
      */
-    List<PersonTypeJobUserCount> findJobUserCountByPersonType();
+    List<PersonTypeJobUserCount> findJobUserCountByPersonType(String year, String month);
 
 
     /**
     /**
      * 查询县区的失业人员与就业困难人数情况
      * 查询县区的失业人员与就业困难人数情况
      */
      */
-    List<RegionJobUserCount> findJobUserByRegionAndDifficulty();
+    List<RegionJobUserCount> findJobUserByRegionAndDifficulty(String year, String month);
 }
 }

+ 29 - 1
src/main/resources/mapping/cquery/StatisticsCQuery.xml

@@ -186,6 +186,14 @@
             COUNT(1) AS jobUserCount
             COUNT(1) AS jobUserCount
         FROM
         FROM
             pc_jobuser
             pc_jobuser
+        WHERE
+            1=1
+            <if test="year!='' and year!=null">
+                and YEAR(CreateTime) = #{year}
+            </if>
+            <if test="month!='' and month!=null">
+                and MONTH(CreateTime) = #{month}
+            </if>
         GROUP BY
         GROUP BY
             AgeRange,
             AgeRange,
             Sex
             Sex
@@ -209,6 +217,12 @@
                 AND culture.DictionaryCode = 'HighestDegree'
                 AND culture.DictionaryCode = 'HighestDegree'
         WHERE
         WHERE
             CultureRank IS NOT NULL
             CultureRank IS NOT NULL
+            <if test="year!='' and year!=null">
+                and YEAR(jobuser.CreateTime) = #{year}
+            </if>
+            <if test="month!='' and month!=null">
+                and MONTH(jobuser.CreateTime) = #{month}
+            </if>
         GROUP BY
         GROUP BY
             jobuser.KeyPersonTypeID,
             jobuser.KeyPersonTypeID,
             KeyTypeName,
             KeyTypeName,
@@ -227,6 +241,14 @@
             pc_jobuser jobUser
             pc_jobuser jobUser
                 LEFT JOIN pc_site site ON jobUser.SiteID = site.SiteID
                 LEFT JOIN pc_site site ON jobUser.SiteID = site.SiteID
                 LEFT JOIN area_code area ON site.RegionCode = area.`code`
                 LEFT JOIN area_code area ON site.RegionCode = area.`code`
+        WHERE
+            1=1
+            <if test="year!='' and year!=null">
+                and YEAR(jobUser.CreateTime) = #{year}
+            </if>
+            <if test="month!='' and month!=null">
+                and MONTH(jobUser.CreateTime) = #{month}
+            </if>
         GROUP BY
         GROUP BY
             site.RegionCode,
             site.RegionCode,
             RegionName
             RegionName
@@ -244,7 +266,13 @@
                 LEFT JOIN pc_site site ON jobUser.SiteID = site.SiteID
                 LEFT JOIN pc_site site ON jobUser.SiteID = site.SiteID
                 LEFT JOIN area_code area ON site.RegionCode = area.`code`
                 LEFT JOIN area_code area ON site.RegionCode = area.`code`
         WHERE
         WHERE
-                jobUser.KeyPersonTypeID IN (13,14,15,16,17,18,19,20,21,22,23,24)
+            jobUser.KeyPersonTypeID IN (13,14,15,16,17,18,19,20,21,22,23,24)
+            <if test="year!='' and year!=null">
+                and YEAR(jobUser.CreateTime) = #{year}
+            </if>
+            <if test="month!='' and month!=null">
+                and MONTH(jobUser.CreateTime) = #{month}
+            </if>
         GROUP BY
         GROUP BY
             site.RegionCode,
             site.RegionCode,
             RegionName
             RegionName

+ 6 - 6
vue/src/api/statistics/index.ts

@@ -54,12 +54,12 @@ export function getYearSystemDataCount(params: any) {
 /**
 /**
  * 查询各个年龄段的求职人员数量
  * 查询各个年龄段的求职人员数量
  */
  */
-export function getJobUserCountByAgeRange() {
+export function getJobUserCountByAgeRange(year: any, month: any) {
   return request<object>(
   return request<object>(
     {
     {
       url: 'statistics/jobUserCountByAgeRange',
       url: 'statistics/jobUserCountByAgeRange',
       method: 'get',
       method: 'get',
-      params: {},
+      params: {year, month},
     },
     },
     {
     {
       isNew: true,
       isNew: true,
@@ -70,12 +70,12 @@ export function getJobUserCountByAgeRange() {
 /**
 /**
  * 查询各重点人员类别在各学历的分布情况
  * 查询各重点人员类别在各学历的分布情况
  */
  */
-export function getJobUserCountByPersonType() {
+export function getJobUserCountByPersonType(year: any, month: any) {
   return request<object>(
   return request<object>(
     {
     {
       url: 'statistics/jobUserCountByPersonType',
       url: 'statistics/jobUserCountByPersonType',
       method: 'get',
       method: 'get',
-      params: {},
+      params: {year, month},
     },
     },
     {
     {
       isNew: true,
       isNew: true,
@@ -86,12 +86,12 @@ export function getJobUserCountByPersonType() {
 /**
 /**
  * 查询各区县的普通失业人员与就业困难人员情况
  * 查询各区县的普通失业人员与就业困难人员情况
  */
  */
-export function getJobUserByRegionAndDifficulty() {
+export function getJobUserByRegionAndDifficulty(year: any, month: any) {
   return request<object>(
   return request<object>(
     {
     {
       url: 'statistics/jobUserByRegionAndDifficulty',
       url: 'statistics/jobUserByRegionAndDifficulty',
       method: 'get',
       method: 'get',
-      params: {},
+      params: {year, month},
     },
     },
     {
     {
       isNew: true,
       isNew: true,

+ 51 - 3
vue/src/views/statistics/JobUserCount.vue

@@ -1,5 +1,25 @@
 <template>
 <template>
   <div class="card-search">
   <div class="card-search">
+    <!-- 查询表单 -->
+    <a-form
+      ref="formRef"
+      name="advanced_search"
+      class="ant-advanced-search-form"
+      :model="searchParams"
+    >
+      <a-row :gutter="24">
+        <a-col :span="6">
+          <a-form-item label="查询月份" :label-col="{span:6}" name="reportDate">
+            <a-date-picker format="YYYY-MM" picker="month" v-model:value="pickerDate" :allow-clear="false"
+                           @change="pickerDateChange"/>
+          </a-form-item>
+        </a-col>
+        <a-col :span="6" style="text-align: left">
+          <a-button type="primary" html-type="submit" @click="searchTypeChange" :loading="searchLoading">查询</a-button>
+          <a-button style="margin: 0 8px" @click="onReset">重置</a-button>
+        </a-col>
+      </a-row>
+    </a-form>
     <!-- 操作按钮 -->
     <!-- 操作按钮 -->
     <a-row class="edit-operation" style="margin-bottom: 20px">
     <a-row class="edit-operation" style="margin-bottom: 20px">
       <a-col :span="24" class="flex-space-between">
       <a-col :span="24" class="flex-space-between">
@@ -59,7 +79,13 @@ import {
   getJobUserCountByPersonType
   getJobUserCountByPersonType
 } from "@/api/statistics";
 } from "@/api/statistics";
 import {initDataSetBarImageTable, initStackBarImageTable} from "@/utils/echartsUtil";
 import {initDataSetBarImageTable, initStackBarImageTable} from "@/utils/echartsUtil";
+import dayjs from "dayjs";
 
 
+// 查询条件
+const searchParams = reactive({
+  year: "",
+  month: ""
+})
 // 查询方法类型
 // 查询方法类型
 const searchType = ref("ageRange");
 const searchType = ref("ageRange");
 // 查询加载
 // 查询加载
@@ -116,11 +142,12 @@ const regionTableColumns = [
     title: '就业困难人数', dataIndex: 'difficultyCount', key: 'keyTypeName', align: "center"
     title: '就业困难人数', dataIndex: 'difficultyCount', key: 'keyTypeName', align: "center"
   },
   },
 ]
 ]
+const pickerDate = ref<any>();
 
 
 // 查询各年龄段求职人员数量
 // 查询各年龄段求职人员数量
 async function ageRangeOnSearch() {
 async function ageRangeOnSearch() {
   searchLoading.value = true;
   searchLoading.value = true;
-  await getJobUserCountByAgeRange().then((result: any) => {
+  await getJobUserCountByAgeRange(searchParams.year, searchParams.month).then((result: any) => {
     // 保存原始数据
     // 保存原始数据
     ageRangeJobUserData.originalList = result;
     ageRangeJobUserData.originalList = result;
 
 
@@ -186,7 +213,7 @@ async function ageRangeOnSearch() {
 // 查询各重点人员类别在各学历的分布情况
 // 查询各重点人员类别在各学历的分布情况
 async function personTypeOnSearch() {
 async function personTypeOnSearch() {
   searchLoading.value = true;
   searchLoading.value = true;
-  await getJobUserCountByPersonType().then((result: any) => {
+  await getJobUserCountByPersonType(searchParams.year, searchParams.month).then((result: any) => {
     // 保存原始数据
     // 保存原始数据
     personTypeJobUserData.originalList = result;
     personTypeJobUserData.originalList = result;
 
 
@@ -268,7 +295,7 @@ async function personTypeOnSearch() {
 // 查询各区县正常失业人员与就业困难人员情况
 // 查询各区县正常失业人员与就业困难人员情况
 async function regionDifficultyOnSearch() {
 async function regionDifficultyOnSearch() {
   searchLoading.value = true;
   searchLoading.value = true;
-  await getJobUserByRegionAndDifficulty().then((result: any) => {
+  await getJobUserByRegionAndDifficulty(searchParams.year, searchParams.month).then((result: any) => {
     // 保存原始数据
     // 保存原始数据
     regionJobUserData.originalList = result;
     regionJobUserData.originalList = result;
     regionJobUserData.tableList = result;
     regionJobUserData.tableList = result;
@@ -303,6 +330,27 @@ function searchTypeChange() {
   }
   }
 }
 }
 
 
+// 日期变更事件
+function pickerDateChange(date: any, dateStr: string) {
+  console.log(date);
+  if (dateStr) {
+    const strings = dateStr.split('-');
+    searchParams.year = strings[0];
+    searchParams.month = strings[1];
+    searchTypeChange();
+  } else {
+    searchParams.year = "";
+    searchParams.month = "";
+  }
+}
+
+function onReset() {
+  pickerDate.value = "";
+  searchParams.year = "";
+  searchParams.month = "";
+  searchTypeChange();
+}
+
 onMounted(() => {
 onMounted(() => {
   searchTypeChange();
   searchTypeChange();
 })
 })