|
|
@@ -32,7 +32,6 @@ import com.xjrsoft.module.organization.entity.UserRoleRelation;
|
|
|
import com.xjrsoft.module.organization.service.IDepartmentService;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
|
-import com.xjrsoft.module.schedule.entity.CourseReceiveMsg;
|
|
|
import com.xjrsoft.module.schedule.entity.CourseTableBak;
|
|
|
import com.xjrsoft.module.schedule.entity.JianyueData;
|
|
|
import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
|
|
|
@@ -54,7 +53,6 @@ import com.xjrsoft.module.workflow.service.IWorkflowFormRelationService;
|
|
|
import com.xjrsoft.module.workflow.service.IWorkflowRecordService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import me.zhyd.oauth.log.Log;
|
|
|
-import org.apache.skywalking.apm.toolkit.trace.ActiveSpan;
|
|
|
import org.camunda.bpm.engine.RuntimeService;
|
|
|
import org.camunda.bpm.engine.TaskService;
|
|
|
import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
@@ -67,12 +65,18 @@ import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -159,20 +163,16 @@ public class JianyuekbScheduleTask {
|
|
|
" and table_name = 'base_grade'" +
|
|
|
" and jianyue_id in (" + eduYearSerialNo1.toString().replace("[", "").replace("]", "") + ")";
|
|
|
List<Map<String, Object>> jianyueData = SqlRunnerAdapter.db().selectList(sql);
|
|
|
- Map<String, List<BaseClass>> gradeClassMaps = new HashMap<>();//存入对应年级的所有班级id
|
|
|
+ Map<String, List<Long>> gradeClassMaps = new HashMap<>();//存入对应年级的所有班级id
|
|
|
for (Map<String, Object> el : jianyueData) {
|
|
|
- String gradeId = el.get("source_id").toString();
|
|
|
- String orgId = null;
|
|
|
- if (gradeId.contains("_")) {
|
|
|
- String[] split = el.get("source_id").toString().split("_");
|
|
|
- gradeId = split[1];
|
|
|
- orgId = split[0];
|
|
|
+ String clasSql = "select source_id from jianyue_data where extend_data = '" + el.get("jianyue_id").toString() + "'";
|
|
|
+ List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(clasSql);
|
|
|
+
|
|
|
+ List<Long> classList = new ArrayList<>();
|
|
|
+ for (Map<String, Object> objectMap : list) {
|
|
|
+ classList.add(Long.parseLong(objectMap.get("source_id").toString()));
|
|
|
}
|
|
|
- List<BaseClass> classList = classService.list(
|
|
|
- new QueryWrapper<BaseClass>().lambda()
|
|
|
- .eq(BaseClass::getGradeId, gradeId)
|
|
|
- .eq(BaseClass::getOrgId, orgId)
|
|
|
- );
|
|
|
+
|
|
|
gradeClassMaps.put(el.get("jianyue_id").toString(), classList);
|
|
|
}
|
|
|
LocalDate today = LocalDate.now();
|
|
|
@@ -207,8 +207,7 @@ public class JianyuekbScheduleTask {
|
|
|
}
|
|
|
|
|
|
//删除课表信息;
|
|
|
- List<BaseClass> classList = gradeClassMaps.get(eduYearSerialNo);
|
|
|
- List<Long> classIdList = classList.stream().map(BaseClass::getId).collect(Collectors.toList());
|
|
|
+ List<Long> classIdList = gradeClassMaps.get(eduYearSerialNo);
|
|
|
String classIds = classIdList.toString().replace("[", "").replace("]", "");
|
|
|
String delSql = "delete from course_table where schedule_date between '" + startDateStr + "'" +
|
|
|
" and '" + endDateStr +
|
|
|
@@ -216,7 +215,7 @@ public class JianyuekbScheduleTask {
|
|
|
SqlRunnerAdapter.db().delete(delSql);
|
|
|
|
|
|
startDateStr = receiveMsg.get("start_date").toString();
|
|
|
- List<String> processIds = suspendedCourseAdjust(classList, startDateStr, endDateStr);
|
|
|
+ List<String> processIds = suspendedCourseAdjust(classIdList, startDateStr, endDateStr);
|
|
|
|
|
|
long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
|
|
|
int times = Integer.parseInt(((between / 7) + 1) + "");
|
|
|
@@ -244,7 +243,7 @@ public class JianyuekbScheduleTask {
|
|
|
//恢复挂起的流程
|
|
|
restoreCourseAdjust(processIds);
|
|
|
//处理该日期内已经审批通过的调课和顶课申请
|
|
|
- handleCourseAdjust(classList, startDateStr, endDateStr);
|
|
|
+ handleCourseAdjust(classIdList, startDateStr, endDateStr);
|
|
|
} catch (Exception e) {
|
|
|
Log.error(e.getMessage(), e);
|
|
|
} finally {
|
|
|
@@ -369,9 +368,8 @@ public class JianyuekbScheduleTask {
|
|
|
* 2、筛选出课表变化了的调课和顶课申请,通知发起人
|
|
|
* 3、顶课数据,如果顶课日期那天那个老师没有课,但是新发布的课表又有课了,需要把原来的顶课数据作废
|
|
|
*/
|
|
|
- public void handleCourseAdjust(List<BaseClass> classList, String startDate, String endDate) {
|
|
|
- List<Long> classIds = classList.stream().map(BaseClass::getId).collect(Collectors.toList());
|
|
|
- Map<Long, String> classMap = classList.stream().collect(Collectors.toMap(BaseClass::getId, BaseClass::getName));
|
|
|
+ public void handleCourseAdjust(List<Long> classIds, String startDate, String endDate) {
|
|
|
+ Map<Long, String> classMap = classService.listByIds(classIds).stream().collect(Collectors.toMap(BaseClass::getId, BaseClass::getName));
|
|
|
List<CourseTableBak> bakList = courseTableBakService.list(
|
|
|
new QueryWrapper<CourseTableBak>().lambda()
|
|
|
.in(CourseTableBak::getClassId, classIds)
|
|
|
@@ -657,8 +655,7 @@ public class JianyuekbScheduleTask {
|
|
|
/**
|
|
|
* 挂起未通过的流程
|
|
|
*/
|
|
|
- List<String> suspendedCourseAdjust(List<BaseClass> classList, String startDate, String endDate) {
|
|
|
- List<Long> classIds = classList.stream().map(BaseClass::getId).collect(Collectors.toList());
|
|
|
+ List<String> suspendedCourseAdjust(List<Long> classIds, String startDate, String endDate) {
|
|
|
List<CourseTableBak> bakList = courseTableBakService.list(
|
|
|
new QueryWrapper<CourseTableBak>().lambda()
|
|
|
.in(CourseTableBak::getClassId, classIds)
|