|
@@ -0,0 +1,65 @@
|
|
|
|
|
+package com.xjrsoft.module.job;
|
|
|
|
|
+
|
|
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
+import com.xjrsoft.XjrSoftApplication;
|
|
|
|
|
+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 org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @author dzx
|
|
|
|
|
+ * @date 2025/3/17
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
|
|
+@SpringBootTest(classes = XjrSoftApplication.class)
|
|
|
|
|
+class WfCourseAdjustTaskTest {
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IWfCourseAdjustService wfCourseAdjustService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ICourseTableService courseTableService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ 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";
|
|
|
|
|
+ if(SqlRunnerAdapter.db().selectList(sql).isEmpty()){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ courseTableService.adjustCourse(wfCourseAdjust);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|