|
|
@@ -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;
|
|
|
}
|
|
|
|
|
|
}
|