Browse Source

feat: 求职人员地图按服务时间显示颜色

zhangying 8 months ago
parent
commit
209401e550

+ 2 - 0
src/main/java/com/hz/employmentsite/mapper/cquery/JobUserServiceCQuery.java

@@ -7,4 +7,6 @@ import java.util.List;
 
 public interface JobUserServiceCQuery {
     List<JobUserServiceVo> getList(@Param("jobUserID") String jobUserID, @Param("serviceID") String serviceID);
+
+    List<JobUserServiceVo> jobUserMapGetService(@Param("jobUserIDList") String jobUserIDList);
 }

+ 15 - 1
src/main/java/com/hz/employmentsite/services/impl/jobUserManager/JobUserServiceImpl.java

@@ -6,6 +6,7 @@ import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.mapper.*;
 import com.hz.employmentsite.mapper.cquery.JobHuntCQuery;
 import com.hz.employmentsite.mapper.cquery.JobUserCQuery;
+import com.hz.employmentsite.mapper.cquery.JobUserServiceCQuery;
 import com.hz.employmentsite.mapper.cquery.LabelCQuery;
 import com.hz.employmentsite.model.*;
 import com.hz.employmentsite.services.service.jobUserManager.JobUserService;
@@ -14,6 +15,7 @@ import com.hz.employmentsite.services.service.system.DictionaryService;
 import com.hz.employmentsite.util.*;
 import com.hz.employmentsite.vo.dataMap.JobUserMapVo;
 import com.hz.employmentsite.vo.jobUserManager.JobHuntVo;
+import com.hz.employmentsite.vo.jobUserManager.JobUserServiceVo;
 import com.hz.employmentsite.vo.jobUserManager.JobUserVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -68,6 +70,8 @@ public class JobUserServiceImpl implements JobUserService {
     private JobHuntCQuery jobHuntCQuery;
     @Autowired
     private JobUserServiceService jobUserServiceService;
+    @Autowired
+    private JobUserServiceCQuery jobUserServiceCQuery;
 
     @Override
     public PageInfo<JobUserVo> getList(Integer pageIndex, Integer pageSize,
@@ -866,9 +870,19 @@ public class JobUserServiceImpl implements JobUserService {
                             .filter(Objects::nonNull)
                             .collect(Collectors.groupingBy(JobHuntVo::getJobUserID))
                     : new HashMap<>();
-            // 填充求职意向数据
+            // 查询服务记录
+            List<JobUserServiceVo> jobUserServiceVos = jobUserServiceCQuery.jobUserMapGetService(stringUtils.ListToInSql(jobUserIDs));
+
             result.getList().forEach(jobUser -> {
                 if (jobUser != null && jobUser.getJobUserID() != null) {
+                    // 填充服务时间
+                    jobUser.setServiceTime(jobUserServiceVos
+                            .stream()
+                            .filter(service -> service.getJobUserID().equals(jobUser.getJobUserID()))
+                            .findFirst()
+                            .orElse(new JobUserServiceVo())
+                            .getServiceTime());
+                    // 填充求职意向数据
                     jobUser.setJobHuntList(jobHuntMap.getOrDefault(jobUser.getJobUserID(), new ArrayList<>()));
                 }
             });

+ 5 - 0
src/main/java/com/hz/employmentsite/vo/dataMap/JobUserMapVo.java

@@ -3,6 +3,7 @@ package com.hz.employmentsite.vo.dataMap;
 import com.hz.employmentsite.vo.jobUserManager.JobHuntVo;
 import lombok.Data;
 
+import java.util.Date;
 import java.util.List;
 
 @Data
@@ -31,6 +32,10 @@ public class JobUserMapVo {
 
     private Integer entryState;
 
+    private Date serviceTime;
+
+    private Integer jobStatusID;
+
     // JSON格式的列表数据
     private String labelList;
     private List<JobHuntVo> jobHuntList;

+ 1 - 0
src/main/resources/mapping/cquery/JobUserCQuery.xml

@@ -119,6 +119,7 @@
         jobuser.`Name`,
         jobuser.sex,
         jobuser.finishDate,
+        jobuser.jobStatusID,
         keytype.`Name` AS keyTypeName,
         TIMESTAMPDIFF(
         YEAR,

+ 53 - 0
src/main/resources/mapping/cquery/JobUserServiceCQuery.xml

@@ -83,4 +83,57 @@
         ORDER BY
             service.ServiceTime DESC
     </select>
+
+    <select id="jobUserMapGetService" resultType="com.hz.employmentsite.vo.jobUserManager.JobUserServiceVo">
+        SELECT
+            JobUserID,
+            ServiceTime
+        FROM
+            (
+                SELECT
+                    JobUserID,
+                    ServiceTime,
+                    ROW_NUMBER() OVER ( PARTITION BY JobUserID ORDER BY ServiceTime DESC ) AS rn
+                FROM
+                    (
+                        SELECT
+                            JobUserID,
+                            ServiceTime
+                        FROM
+                            pc_jobuser_service UNION
+                        SELECT
+                            JobUserID,
+                            CreateTime AS ServiceTime
+                        FROM
+                            pc_jobuser UNION
+                        SELECT
+                            jobUser.JobUserID,
+                            mgt.ModifyTime AS ServiceTime
+                        FROM
+                            pc_recommend_mgt mgt
+                                LEFT JOIN pc_post post ON mgt.PostID = post.PostID
+                                LEFT JOIN pc_profession prof ON post.ProfessionID = prof.ProfessionID
+                                LEFT JOIN pc_company company ON post.CompanyID = company.CompanyID
+                                LEFT JOIN pc_jobhunt jobHunt ON mgt.JobHuntID = jobHunt.JobHuntID
+                                LEFT JOIN pc_jobuser jobUser ON jobHunt.JobUserID = jobUser.JobuserID
+                        WHERE
+                            mgt.ModifyTime IS NOT NULL UNION
+                        SELECT
+                            jobUser.JobUserID,
+                            mgt.CreateTime AS ServiceTime
+                        FROM
+                            pc_recommend_mgt mgt
+                                LEFT JOIN pc_post post ON mgt.PostID = post.PostID
+                                LEFT JOIN pc_profession prof ON post.ProfessionID = prof.ProfessionID
+                                LEFT JOIN pc_company company ON post.CompanyID = company.CompanyID
+                                LEFT JOIN pc_jobhunt jobHunt ON mgt.JobHuntID = jobHunt.JobHuntID
+                                LEFT JOIN pc_jobuser jobUser ON jobHunt.JobUserID = jobUser.JobuserID
+                    ) AS subquery
+            ) AS ranked_service
+        WHERE
+            rn = 1
+        <if test="jobUserIDList != '' and jobUserIDList != null">
+            and jobuserID in (${jobUserIDList})
+        </if>
+    </select>
 </mapper>

+ 16 - 0
vue/src/assets/css/common.css

@@ -61,3 +61,19 @@ button {
 .flex-box {
   display: flex;
 }
+
+.justify-between {
+  justify-content: space-between;
+}
+
+.items-center {
+  align-items: center;
+}
+
+.triangle-up {
+  width: 0;
+  height: 0;
+  border-left: 5px solid transparent;
+  border-right: 5px solid transparent;
+  border-bottom: 10px solid;
+}

+ 60 - 4
vue/src/views/dataMap/jobUserDataMap.vue

@@ -59,14 +59,20 @@
         <!-- 数据列表 -->
         <div class="data-box">
           <div v-if="jobUserList.length > 0" class="list-box">
-            <div class="jobUser-data-box margin-bottom-10 cursor-pointer" v-for="(jobUser,jobUserIndex) in jobUserList"
+            <div class="jobUser-data-box margin-bottom-10 cursor-pointer"
+                 v-for="(jobUser,jobUserIndex) in jobUserList"
                  :key="jobUserIndex"
-                 :class="{'check-jobUser':nowCheckJobUser.jobUserID == jobUser.jobUserID || nowMouseenterJobUser.jobUserID == jobUser.jobUserID}"
+                 :class="[
+                   (nowCheckJobUser.jobUserID == jobUser.jobUserID || nowMouseenterJobUser.jobUserID == jobUser.jobUserID) ? 'check-jobUser' : '',
+                   setColorClass(jobUser)
+                 ]"
                  @click="checkJobUser(jobUser)"
                  @mouseenter="jobUserMouseenter(jobUser)"
                  @mouseleave="jobUserMouseenter({jobUserID:-1})"
             >
-              <p class="font-size-14 font-weight-600 margin-bottom-8">{{ jobUser.name }}({{ jobUser.regionName }})</p>
+              <div class="flex-box justify-between items-center margin-bottom-8">
+                <p class="font-size-14 font-weight-600">{{ jobUser.name }}({{ jobUser.regionName }})</p>
+              </div>
               <p class="label-text">年龄:{{ jobUser.age }}</p>
               <p class="label-text">性别:{{ jobUser.sex == 1 ? '男' : '女' }}</p>
               <!-- 岗位 -->
@@ -534,6 +540,28 @@ const showSalary = (minSalary: any, maxSalary: any) => {
   }
 }
 
+// 按要求显示求职人员颜色状态
+function setColorClass(jobUser: any) {
+  if (jobUser.jobStatusID == 1) {
+    return 'jobUser-data-box-before-green'
+  }
+  // 服务时间
+  const serviceTime = dayjs(jobUser.serviceTime);
+  // 获取当前日期
+  const currentDate = dayjs();
+  // 计算1个月和3个月之前的日期
+  const oneMonthAgo = currentDate.subtract(1, 'month');
+  const threeMonthsAgo = currentDate.subtract(3, 'month');
+  // 判断指定日期是否在1-3个月内
+  if (serviceTime.isAfter(threeMonthsAgo) && serviceTime.isBefore(oneMonthAgo)) {
+    return 'jobUser-data-box-before-yellow';
+  }
+  if (serviceTime.isBefore(threeMonthsAgo)) {
+    return 'jobUser-data-box-before-red';
+  }
+  return false;
+}
+
 // 查询全部
 function searchAll() {
   searchParams.pageIndex = 1
@@ -655,9 +683,10 @@ export default {
         overflow-y: auto;
 
         .jobUser-data-box {
+          position: relative;
           width: 100%;
           background-color: white;
-          border-radius: 10px;
+          border-radius: 10px 0 10px 10px;
           padding: 10px;
           box-sizing: border-box;
           border: 1px solid white;
@@ -680,6 +709,33 @@ export default {
           }
         }
 
+        .jobUser-data-box::before {
+          border-width: 8px;
+          content: '';
+          position: absolute;
+          top: 0;
+          right: 0;
+          border-color: transparent;
+          border-style: solid;
+          border-top-color: #BEBEBE;
+          border-right-color: #BEBEBE;
+        }
+
+        .jobUser-data-box-before-green::before {
+          border-top-color: #00FF00;
+          border-right-color: #00FF00;
+        }
+
+        .jobUser-data-box-before-yellow::before {
+          border-top-color: #FFA500;
+          border-right-color: #FFA500;
+        }
+
+        .jobUser-data-box-before-red::before {
+          border-top-color: #FF0000;
+          border-right-color: #FF0000;
+        }
+
         .check-jobUser {
           border-color: #007EFF;
         }