|
|
@@ -0,0 +1,63 @@
|
|
|
+package com.xjrsoft.module.job;
|
|
|
+
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
+import com.xjrsoft.common.enums.EnabledMark;
|
|
|
+import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
|
+import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
|
|
|
+import com.xjrsoft.module.schedule.service.IWfCourseAdjustService;
|
|
|
+import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 每过10分钟定时处理没有处理成功的调课或者顶课流程
|
|
|
+ * @author dzx
|
|
|
+ * @date 2025/3/3
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class WfCourseAdjustTask {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IWfCourseAdjustService wfCourseAdjustService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseTableService courseTableService;
|
|
|
+
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 */10 * * * ?")
|
|
|
+ public void execute() {
|
|
|
+ List<WfCourseAdjust> list = wfCourseAdjustService.list(
|
|
|
+ new MPJLambdaWrapper<WfCourseAdjust>()
|
|
|
+ .select(WfCourseAdjust::getId)
|
|
|
+ .select(WfCourseAdjust.class, x -> VoToColumnUtil.fieldsToColumns(WfCourseAdjust.class).contains(x.getProperty()))
|
|
|
+ .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getFormKeyValue, WfCourseAdjust::getId)
|
|
|
+ .eq(WorkflowFormRelation::getCurrentState, HistoricProcessInstance.STATE_COMPLETED)
|
|
|
+ .eq(WfCourseAdjust::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .eq(WfCourseAdjust::getEnabledMark, EnabledMark.ENABLED.getCode())
|
|
|
+ );
|
|
|
+
|
|
|
+ for (WfCourseAdjust wfCourseAdjust : list) {
|
|
|
+ String sql = "SELECT * FROM course_table t1" +
|
|
|
+ " INNER JOIN course_table_bak t2 ON t1.id = t2.id" +
|
|
|
+ " WHERE t2.wf_course_adjust_id = " + wfCourseAdjust.getId() +
|
|
|
+ " AND t1.course_id = t2.course_id" +
|
|
|
+ " AND t1.course_name = t2.course_name" +
|
|
|
+ " AND t1.site_id = t2.site_id" +
|
|
|
+ " AND t1.teacher_name = t2.teacher_name";
|
|
|
+ long count = SqlRunnerAdapter.db().selectCount(sql);
|
|
|
+ if(count > 0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ courseTableService.adjustCourse(wfCourseAdjust);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|