|
@@ -0,0 +1,89 @@
|
|
|
+package com.ruoyi.framework.task.trainingbcc;
|
|
|
+
|
|
|
+import com.ruoyi.common.jpush.JiGuangPushService;
|
|
|
+import com.ruoyi.framework.web.controller.BaseController;
|
|
|
+import com.ruoyi.project.plant.domain.TConfInfo;
|
|
|
+import com.ruoyi.project.plant.domain.TConfRoom;
|
|
|
+import com.ruoyi.project.plant.mapper.TConfInfoMapper;
|
|
|
+import com.ruoyi.project.plant.mapper.TConfRoomMapper;
|
|
|
+import com.ruoyi.project.plant.service.ITConfInfoService;
|
|
|
+import com.ruoyi.project.plant.service.ITConfRoomService;
|
|
|
+import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
+import com.ruoyi.project.system.domain.SysUser;
|
|
|
+import com.ruoyi.project.system.mapper.SysUserMapper;
|
|
|
+import com.ruoyi.project.training.domain.TTrainingbcc;
|
|
|
+import com.ruoyi.project.training.domain.TTrainingbccDevice;
|
|
|
+import com.ruoyi.project.training.service.ITTrainingbccDeviceService;
|
|
|
+import com.ruoyi.project.training.service.ITTrainingbccService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.time.DayOfWeek;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.LocalTime;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 定时任务调度测试
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ */
|
|
|
+@Component("trainingbccTask")
|
|
|
+public class TrainingbccTask extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private ITTrainingbccDeviceService tTrainingbccDeviceService;
|
|
|
+ @Autowired
|
|
|
+ private ITTrainingbccService tTrainingbccService;
|
|
|
+ @Resource
|
|
|
+ private SysUserMapper sysUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private ITStaffmgrService tStaffmgrService;
|
|
|
+ @Resource
|
|
|
+ private JiGuangPushService jiGuangPushService;
|
|
|
+
|
|
|
+ public void trainingbccTask()
|
|
|
+ {
|
|
|
+ TTrainingbcc query = new TTrainingbcc();
|
|
|
+ query.setIsfinish(0l);
|
|
|
+ //未完成的培训
|
|
|
+ List<TTrainingbcc> list = tTrainingbccService.selectTTrainingbccList(query);
|
|
|
+ for (TTrainingbcc t: list
|
|
|
+ ) {
|
|
|
+ TTrainingbccDevice tTrainingbccDevice = new TTrainingbccDevice();
|
|
|
+ tTrainingbccDevice.setRegularId(t.getId());
|
|
|
+ List<TTrainingbccDevice> deviceList = tTrainingbccDeviceService.selectTTrainingbccDeviceList(tTrainingbccDevice);
|
|
|
+ for (TTrainingbccDevice d :deviceList
|
|
|
+ ) {
|
|
|
+ if (d.getExamState() != 1) { //未完成的考试
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ long diff = t.getCourseEnddate().getTime() - now;
|
|
|
+ long nd = 1000 * 24 * 60 * 60;
|
|
|
+ long day = diff / nd;
|
|
|
+ if (t.getTrainingType().equals("10")) { //定期培训
|
|
|
+ if ( day <= 7 && day > -2) {
|
|
|
+ SysUser staff = sysUserMapper.selectUserByStaffId(d.getStaffId());
|
|
|
+ jiGuangPushService.send("装置培训-定期培训", "您有装置培训尚未完成", staff.getUserId().toString());
|
|
|
+ }
|
|
|
+ }else {//非定期培训
|
|
|
+ if ( day <= 3 && day > -2) {
|
|
|
+ SysUser staff = sysUserMapper.selectUserByStaffId(d.getStaffId());
|
|
|
+ jiGuangPushService.send("装置培训", "您有装置培训尚未完成", staff.getUserId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|