Ver Fonte

面试日历修改

change há 4 anos atrás
pai
commit
7d422a21af

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/bo/RecruitInterviewAddBo.java

@@ -29,10 +29,10 @@ public class RecruitInterviewAddBo {
     private Integer day;
     /** 时间段开始 */
     @ApiModelProperty("时间段开始")
-    private String timingStart;
+    private Long timingStart;
     /** 时间段结束 */
     @ApiModelProperty("时间段结束")
-    private String timingEnd;
+    private Long timingEnd;
     /** 面试需求岗位ID */
     @ApiModelProperty("面试需求岗位ID")
     private Long needsId;

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/bo/RecruitInterviewEditBo.java

@@ -36,11 +36,11 @@ public class RecruitInterviewEditBo {
 
     /** 时间段开始 */
     @ApiModelProperty("时间段开始")
-    private String timingStart;
+    private Long timingStart;
 
     /** 时间段结束 */
     @ApiModelProperty("时间段结束")
-    private String timingEnd;
+    private Long timingEnd;
 
     /** 面试需求岗位ID */
     @ApiModelProperty("面试需求岗位ID")

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/bo/RecruitInterviewQueryBo.java

@@ -47,10 +47,10 @@ public class RecruitInterviewQueryBo extends BaseEntity {
 	private Integer day;
 	/** 时间段开始 */
 	@ApiModelProperty("时间段开始")
-	private String timingStart;
+	private Long timingStart;
 	/** 时间段结束 */
 	@ApiModelProperty("时间段结束")
-	private String timingEnd;
+	private Long timingEnd;
 	/** 面试需求岗位ID */
 	@ApiModelProperty("面试需求岗位ID")
 	private Long needsId;

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/domain/RecruitInterview.java

@@ -38,10 +38,10 @@ private static final long serialVersionUID=1L;
     private Integer day;
 
     /** 时间段开始 */
-    private String timingStart;
+    private Long timingStart;
 
     /** 时间段结束 */
-    private String timingEnd;
+    private Long timingEnd;
 
     /** 面试需求岗位ID */
     private Long needsId;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/mapper/RecruitInterviewMapper.java

@@ -15,5 +15,5 @@ import java.util.List;
  */
 public interface RecruitInterviewMapper extends BaseMapper<RecruitInterview> {
 
-    List<RecruitInterviewVo> selectByDay(@Param("day") Long date,@Param("month") Integer moth,@Param("year") Integer year);
+    List<RecruitInterviewVo> selectByDay(@Param("day") Integer date,@Param("month") Integer moth,@Param("year") Integer year,@Param("timingStart")Long quantumStart,@Param("timingEnd")Long quantumEnd);
 }

+ 63 - 70
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/service/impl/RecruitInterviewServiceImpl.java

@@ -5,14 +5,13 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.course.domain.MajorCategory;
 import com.zhongzheng.modules.recruit.service.IRecruitNeedsService;
 import com.zhongzheng.modules.recruit.service.IRecruitResumeService;
-import com.zhongzheng.modules.recruit.vo.CalendarInterviewVo;
-import com.zhongzheng.modules.recruit.vo.DayInterviewVo;
-import com.zhongzheng.modules.recruit.vo.RecruitResumeVo;
+import com.zhongzheng.modules.recruit.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -24,10 +23,10 @@ import com.zhongzheng.modules.recruit.bo.RecruitInterviewQueryBo;
 import com.zhongzheng.modules.recruit.bo.RecruitInterviewEditBo;
 import com.zhongzheng.modules.recruit.domain.RecruitInterview;
 import com.zhongzheng.modules.recruit.mapper.RecruitInterviewMapper;
-import com.zhongzheng.modules.recruit.vo.RecruitInterviewVo;
 import com.zhongzheng.modules.recruit.service.IRecruitInterviewService;
 
 import java.text.DateFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -56,8 +55,8 @@ public class RecruitInterviewServiceImpl extends ServiceImpl<RecruitInterviewMap
         lqw.eq(bo.getYear() != null, RecruitInterview::getYear, bo.getYear());
         lqw.eq(bo.getMonth() != null, RecruitInterview::getMonth, bo.getMonth());
         lqw.eq(bo.getDay() != null, RecruitInterview::getDay, bo.getDay());
-        lqw.eq(StrUtil.isNotBlank(bo.getTimingStart()), RecruitInterview::getTimingStart, bo.getTimingStart());
-        lqw.eq(StrUtil.isNotBlank(bo.getTimingEnd()), RecruitInterview::getTimingEnd, bo.getTimingEnd());
+        lqw.eq(bo.getTimingStart() !=null, RecruitInterview::getTimingStart, bo.getTimingStart());
+        lqw.eq(bo.getTimingEnd() != null, RecruitInterview::getTimingEnd, bo.getTimingEnd());
         lqw.eq(bo.getNeedsId() != null, RecruitInterview::getNeedsId, bo.getNeedsId());
         lqw.eq(StrUtil.isNotBlank(bo.getResumeJson()), RecruitInterview::getResumeJson, bo.getResumeJson());
         lqw.eq(bo.getStatus() != null, RecruitInterview::getStatus, bo.getStatus());
@@ -148,82 +147,76 @@ public class RecruitInterviewServiceImpl extends ServiceImpl<RecruitInterviewMap
         if (bo.getMonth() == null){
             bo.setMonth(cal.get(Calendar.MONTH)+1);
         }
-        Long firstDayOfMonth = getFirstDayOfMonth(bo.getMonth());
-        Long lastDayOfMonth = getLastDayOfMonth(bo.getMonth());
-        List<DayInterviewVo> dayStudyVosOne = getDays(firstDayOfMonth,lastDayOfMonth);
+        if(bo.getYear() == null){
+            bo.setYear(cal.get(Calendar.YEAR));
+        }
+        if(bo.getDay() == null){
+            throw new IllegalArgumentException("日期为空");
+        }
+
+        List<DayInterviewVo> dayStudyVosOne = null;
+        try {
+            dayStudyVosOne = getDays(bo.getYear(),bo.getMonth(),bo.getDay());
+        } catch (ParseException e) {
+            throw new RuntimeException("服务器正忙,请稍后重试");
+        }
         for (DayInterviewVo dayInterviewVo : dayStudyVosOne) {
-            List<RecruitInterviewVo> recruitInterviewVos=baseMapper.selectByDay(dayInterviewVo.getDate(),bo.getMonth(),bo.getYear());
-            dayInterviewVo.setRecruitInterviewList(recruitInterviewVos);
+            for (QuantumVo quantumVo : dayInterviewVo.getQuantumList()) {
+                List<RecruitInterviewVo> recruitInterviewVos = baseMapper.selectByDay(bo.getDay(),bo.getMonth(), bo.getYear(), quantumVo.getTimingStart(), quantumVo.getTimingEnd());
+                quantumVo.setRecruitInterviewList(recruitInterviewVos);
+            }
         }
-        calendarInterviewVo.setYear(Convert.toLong(cal.get(Calendar.YEAR)));
+        calendarInterviewVo.setYear(Convert.toLong(bo.getYear()));
         calendarInterviewVo.setMonth(Convert.toLong(bo.getMonth()));
         calendarInterviewVo.setDayInterviewVos(dayStudyVosOne);
         return calendarInterviewVo;
     }
 
 
-    private static List<DayInterviewVo> getDays(long time_start, long time_end) {
-        try {
-            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            Date c_start = dateFormat.parse(dateFormat.format(new Date(time_start * 1000).getTime()));
-            Date c_end = dateFormat.parse(dateFormat.format(new Date(time_end * 1000).getTime()));
-            Calendar tempStart = Calendar.getInstance();
-            tempStart.setTime(c_start);
-            Calendar tempEnd = Calendar.getInstance();
-            tempEnd.setTime(c_end);
-            tempEnd.add(Calendar.DATE, +1);
-            List<DayInterviewVo> dayStudyVos = new ArrayList<>();
-            while (tempStart.before(tempEnd)) {
-                String format = dateFormat.format(tempStart.getTime());
-                String strh = format.substring(format.length() -2,format.length());
-                int week = tempStart.get(Calendar.DAY_OF_WEEK)- 1;
-                DayInterviewVo dayStudyVo = new DayInterviewVo();
-                dayStudyVo.setStudyDay(Convert.toLong(week));
-                dayStudyVo.setDate(Convert.toLong(strh));
-                dayStudyVos.add(dayStudyVo);
-                tempStart.add(Calendar.DAY_OF_YEAR, 1);
-            }
-            return dayStudyVos;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
 
-    /**
-     * 获取当前月第一天
-     * @param month
-     * @return
-     */
-    public static Long getFirstDayOfMonth(int month) {
-        Calendar calendar = Calendar.getInstance();
-        // 设置月份
-        calendar.set(Calendar.MONTH, month - 1);
-        // 获取某月最小天数
-        int firstDay = calendar.getActualMinimum(Calendar.DAY_OF_MONTH);
-        // 设置日历中月份的最小天数
-        calendar.set(Calendar.DAY_OF_MONTH, firstDay);
-
-        Date time = calendar.getTime();
-        return time.getTime() / 1000;
-    }
 
-    public static Long getLastDayOfMonth(int month) {
+    private static List<DayInterviewVo> getDays(int year, int month,int day) throws ParseException {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         Calendar calendar = Calendar.getInstance();
-        // 设置月份
-        calendar.set(Calendar.MONTH, month - 1);
-        // 获取某月最大天数
-        int lastDay=0;
-        //2月的平年瑞年天数
-        if(month==2) {
-            lastDay = calendar.getLeastMaximum(Calendar.DAY_OF_MONTH);
-        }else {
-            lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
+        //自定义时间
+        String recipeTime = year+"-"+month+"-"+day;
+        //现在时间
+        //String  recipeTime=simpleDateFormat.format(new Date());
+
+        calendar.setTime(simpleDateFormat.parse(recipeTime));
+        calendar.setFirstDayOfWeek(Calendar.MONDAY);
+        int week = calendar.get(Calendar.DAY_OF_WEEK);
+        if (1 == week) {
+            calendar.add(Calendar.DAY_OF_MONTH, -1);
+        }
+        int getDayFirst =calendar.get(Calendar.DAY_OF_WEEK);
+        calendar.add(Calendar.DATE, calendar.getFirstDayOfWeek() - getDayFirst);
+        //本周星期一
+        String beginDate = simpleDateFormat.format(calendar.getTime());
+        //本周星期日
+        calendar.add(Calendar.DATE, 6);
+        String endDate = simpleDateFormat.format(calendar.getTime());
+        List<DayInterviewVo> dayInterviewVos = new ArrayList<>();
+        for (int i = 0; i < 7; i++) {
+            calendar.setFirstDayOfWeek(Calendar.MONDAY);
+            calendar.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
+            long time = calendar.getTimeInMillis() + 24*60*60*1000*i;
+            String sunday = simpleDateFormat.format(time);
+            String strh = sunday.substring(sunday.length() -2,sunday.length());
+            DayInterviewVo dayInterviewVo = new DayInterviewVo();
+            dayInterviewVo.setDate(Convert.toLong(strh));
+            dayInterviewVo.setStudyDay(Convert.toLong(i+1));
+            dayInterviewVos.add(dayInterviewVo);
+            List<QuantumVo> quantumList = new ArrayList<>();
+            for (int j = 0; j < 24; j++) {
+                QuantumVo quantumVo = new QuantumVo();
+                quantumVo.setTimingStart(Convert.toLong(j));
+                quantumVo.setTimingEnd(Convert.toLong(j+1));
+                quantumList.add(quantumVo);
+            }
+            dayInterviewVo.setQuantumList(quantumList);
         }
-        // 设置日历中月份的最大天数
-        calendar.set(Calendar.DAY_OF_MONTH, lastDay);
-        Date time = calendar.getTime();
-        return time.getTime() / 1000;
+        return dayInterviewVos;
     }
 
 }

+ 7 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/vo/DayInterviewVo.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author change
@@ -23,8 +24,11 @@ public class DayInterviewVo {
     @ApiModelProperty("0周日  1周一 2周二 3周三 4周四 5周五 6周六")
     private Long studyDay;
 
-    /** 面试人信息 */
-    @ApiModelProperty("面试人信息")
-    private List<RecruitInterviewVo> recruitInterviewList;
+
+    /** 当天时间段 */
+    @ApiModelProperty("当天时间段12个时间段")
+    private List<QuantumVo> quantumList;
+
+
 
 }

+ 31 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/vo/QuantumVo.java

@@ -0,0 +1,31 @@
+package com.zhongzheng.modules.recruit.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author change
+ * @date 2021年08月23日 10:12
+ */
+@Data
+@ApiModel("【面试时间段】视图对象")
+public class QuantumVo {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 时间段开始 */
+    @ApiModelProperty("时间段开始")
+    private Long timingStart;
+
+    /** 时间段结束 */
+    @ApiModelProperty("时间段结束")
+    private Long timingEnd;
+
+    /** 面试人信息 */
+    @ApiModelProperty("面试人信息")
+    private List<RecruitInterviewVo> recruitInterviewList;
+
+}

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/recruit/vo/RecruitInterviewVo.java

@@ -39,11 +39,11 @@ public class RecruitInterviewVo {
 	/** 时间段开始 */
 	@Excel(name = "时间段开始")
 	@ApiModelProperty("时间段开始")
-	private String timingStart;
+	private Long timingStart;
 	/** 时间段结束 */
 	@Excel(name = "时间段结束")
 	@ApiModelProperty("时间段结束")
-	private String timingEnd;
+	private Long timingEnd;
 	/** 面试需求岗位ID */
 	@Excel(name = "面试需求岗位ID")
 	@ApiModelProperty("面试需求岗位ID")

+ 6 - 0
zhongzheng-system/src/main/resources/mapper/modules/recruit/RecruitInterviewMapper.xml

@@ -47,5 +47,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="day!=null">
                 and day=#{day}
             </if>
+        <if test="timingStart !=null">
+            and timing_start=#{timingStart}
+        </if>
+        <if test="timingEnd !=null">
+            and timing_End=#{timingEnd}
+        </if>
     </select>
 </mapper>