自动更新房间状态

This commit is contained in:
俞扬
2023-06-25 14:38:27 +08:00
parent 10aceade69
commit ce1415bcfe
3 changed files with 51 additions and 35 deletions

View File

@@ -203,16 +203,16 @@
set room_status = #{roomStatus},update_time = now() set room_status = #{roomStatus},update_time = now()
<where> <where>
<if test="record.roomStatus !=null and record.roomStatus!=''"> <if test="record.roomStatus !=null and record.roomStatus!=''">
and hpip.room_status = #{record.roomStatus} and room_status = #{record.roomStatus}
</if> </if>
<if test="record.startTime !=null and record.startTime!=''"> <if test="record.startTime !=null'">
and hpip.start_time &gt;= #{record.startTime} and start_time &gt;= #{record.startTime}
</if> </if>
<if test="record.endTime !=null and record.endTime!=''"> <if test="record.endTime !=null">
and hpip.end_time &lt;= #{record.endTime} and end_time &lt;= #{record.endTime}
</if> </if>
<if test="record.deleted !=null and record.deleted!=''"> <if test="record.deleted !=null and record.deleted!=''">
and hpip.deleted = #{deleted} and deleted = #{deleted}
</if> </if>
</where> </where>
</update> </update>
@@ -222,16 +222,16 @@
set room_status = #{roomStatus},update_time = now() set room_status = #{roomStatus},update_time = now()
<where> <where>
<if test="record.roomStatus !=null and record.roomStatus!=''"> <if test="record.roomStatus !=null and record.roomStatus!=''">
and hpip.room_status = #{record.roomStatus} and room_status = #{record.roomStatus}
</if> </if>
<if test="record.startTime !=null and record.startTime!=''"> <if test="record.startTime !=null">
and hpip.start_time &gt;= #{record.startTime} and start_time &gt;= #{record.startTime}
</if> </if>
<if test="record.endTime !=null and record.endTime!=''"> <if test="record.endTime !=null">
and hpip.start_time &lt;= #{record.endTime} and start_time &lt;= #{record.endTime}
</if> </if>
<if test="record.deleted !=null and record.deleted!=''"> <if test="record.deleted !=null and record.deleted!=''">
and hpip.deleted = #{deleted} and deleted = #{deleted}
</if> </if>
</where> </where>
</update> </update>
@@ -241,16 +241,16 @@
set room_status = #{roomStatus},update_time = now() set room_status = #{roomStatus},update_time = now()
<where> <where>
<if test="record.roomStatus !=null and record.roomStatus!=''"> <if test="record.roomStatus !=null and record.roomStatus!=''">
and hpip.room_status = #{record.roomStatus} and room_status = #{record.roomStatus}
</if> </if>
<if test="record.startTime !=null and record.startTime!=''"> <if test="record.startTime !=null">
and hpip.end_time &gt;= #{record.startTime} and end_time &gt;= #{record.startTime}
</if> </if>
<if test="record.endTime !=null and record.endTime!=''"> <if test="record.endTime !=null">
and hpip.end_time &lt;= #{record.endTime} and end_time &lt;= #{record.endTime}
</if> </if>
<if test="record.deleted !=null and record.deleted!=''"> <if test="record.deleted !=null and record.deleted!=''">
and hpip.deleted = #{deleted} and deleted = #{deleted}
</if> </if>
</where> </where>
</update> </update>
@@ -353,10 +353,10 @@
<if test="record.roomStatus !=null and record.roomStatus!=''"> <if test="record.roomStatus !=null and record.roomStatus!=''">
and hpip.room_status = #{record.roomStatus} and hpip.room_status = #{record.roomStatus}
</if> </if>
<if test="record.startTime !=null and record.startTime!=''"> <if test="record.startTime !=null">
and hpip.start_time &gt;= #{record.startTime} and hpip.start_time &gt;= #{record.startTime}
</if> </if>
<if test="record.endTime !=null and record.endTime!=''"> <if test="record.endTime !=null">
and hpip.end_time &lt;= #{record.endTime} and hpip.end_time &lt;= #{record.endTime}
</if> </if>
<if test="record.deleted !=null and record.deleted!=''"> <if test="record.deleted !=null and record.deleted!=''">
@@ -415,10 +415,10 @@
<if test="record.partnerId !=null and record.partnerId!=''"> <if test="record.partnerId !=null and record.partnerId!=''">
and partner_id = #{record.partnerId} and partner_id = #{record.partnerId}
</if> </if>
<if test="record.startTime !=null and record.startTime!=''"> <if test="record.startTime !=null">
and start_time = #{record.startTime} and start_time = #{record.startTime}
</if> </if>
<if test="record.endTime !=null and record.endTime!=''"> <if test="record.endTime !=null">
and end_time = #{record.endTime} and end_time = #{record.endTime}
</if> </if>
<if test="record.interviewer !=null and record.interviewer!=''"> <if test="record.interviewer !=null and record.interviewer!=''">

View File

@@ -39,25 +39,40 @@ public class JobHandler {
*/ */
@XxlJob("updateInterviewOverTime") @XxlJob("updateInterviewOverTime")
public void updateInterviewOverTime(){ public void updateInterviewOverTime(){
log.info("面试超时定时任务开始"); try {
hyPartnerInterviewPlanService.updateInterviewOverTime(); log.info("面试超时定时任务开始");
log.info("面试超时定时任务结束"); hyPartnerInterviewPlanService.updateInterviewOverTime();
XxlJobHelper.handleSuccess(); log.info("面试超时定时任务结束");
XxlJobHelper.handleSuccess();
}catch (Exception e){
log.error("面试超时定时任务异常",e);
XxlJobHelper.log("面试超时定时任务异常"+e.getMessage());
}
} }
@XxlJob("openInterviewRoom") @XxlJob("openInterviewRoom")
public void openInterviewRoom(){ public void openInterviewRoom(){
log.info("房间状态开启定时任务开始"); try {
hyPartnerInterviewPlanService.openInterviewRoom(); log.info("房间状态开启定时任务开始");
log.info("房间状态开启定时任务结束"); hyPartnerInterviewPlanService.openInterviewRoom();
XxlJobHelper.handleSuccess(); log.info("房间状态开启定时任务结束");
XxlJobHelper.handleSuccess();
}catch (Exception e){
log.error("房间状态开启定时任务异常",e);
XxlJobHelper.log("房间状态开启定时任务异常"+e.getMessage());
}
} }
public void updateAbsentInterview(){ public void updateAbsentInterview(){
log.info("面试缺席定时任务开始"); try {
hyPartnerInterviewPlanService.updateAbsentInterview(); log.info("面试缺席定时任务开始");
log.info("面试缺席定时任务结束"); hyPartnerInterviewPlanService.updateAbsentInterview();
XxlJobHelper.handleSuccess(); log.info("面试缺席定时任务结束");
XxlJobHelper.handleSuccess();
}catch (Exception e){
log.error("面试缺席定时任务异常",e);
XxlJobHelper.log("面试缺席定时任务异常"+e.getMessage());
}
} }

View File

@@ -174,8 +174,9 @@ public class HyPartnerInterviewPlanServiceImpl implements HyPartnerInterviewPlan
public void openInterviewRoom() { public void openInterviewRoom() {
//更新会议开始时间为十分钟之内的房间状态为开启 //更新会议开始时间为十分钟之内的房间状态为开启
Date startTime = new Date(); Date startTime = new Date();
String startTimeStr = DateUtil.formatDateTime(startTime);
HyPartnerInterviewPlanDO hyPartnerInterviewPlanDO = new HyPartnerInterviewPlanDO(); HyPartnerInterviewPlanDO hyPartnerInterviewPlanDO = new HyPartnerInterviewPlanDO();
hyPartnerInterviewPlanDO.setStartTime(startTime); hyPartnerInterviewPlanDO.setStartTime(DateUtil.parseDateTime(startTimeStr));
hyPartnerInterviewPlanDO.setEndTime(DateUtil.offsetMinute(startTime,10)); hyPartnerInterviewPlanDO.setEndTime(DateUtil.offsetMinute(startTime,10));
hyPartnerInterviewPlanDO.setRoomStatus(RoomStatus.WAIT_FOR_OPEN.getCode()); hyPartnerInterviewPlanDO.setRoomStatus(RoomStatus.WAIT_FOR_OPEN.getCode());
hyPartnerInterviewPlanDO.setDeleted(false); hyPartnerInterviewPlanDO.setDeleted(false);