瀏覽代碼

bug修复

dzx 1 年之前
父節點
當前提交
84752c9107

+ 4 - 4
src/main/java/com/xjrsoft/module/job/JianyuekbScheduleTask.java

@@ -19,7 +19,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
-import static cn.hutool.core.convert.NumberWordFormatter.format;
 
 
 /**
 /**
  * @author dzx
  * @author dzx
@@ -97,6 +96,7 @@ public class JianyuekbScheduleTask {
             long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
             long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
             long times = (between / 7) + 1;
             long times = (between / 7) + 1;
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            JsonArray allScheduleInfo = new JsonArray();
             for (int i = 0; i < times; i ++) {
             for (int i = 0; i < times; i ++) {
                 LocalDate statrTime = startDateObj.plusDays(i * 7L);
                 LocalDate statrTime = startDateObj.plusDays(i * 7L);
                 String startDate = statrTime.format(formatter);
                 String startDate = statrTime.format(formatter);
@@ -108,10 +108,10 @@ public class JianyuekbScheduleTask {
                 String endDate = endTime.format(formatter);
                 String endDate = endTime.format(formatter);
                 //获取课表并存到数据库
                 //获取课表并存到数据库
                 JsonArray scheduleInfo = dataUtil.getScheduleInfoByGrade(eduYearSerialNo, startDate, endDate);
                 JsonArray scheduleInfo = dataUtil.getScheduleInfoByGrade(eduYearSerialNo, startDate, endDate);
-                dataUtil.insertCourseTable(scheduleInfo, classroomMap, courseMap, semesterMap, teacherMap, classMap);
-                dataUtil.insertClassTime(scheduleInfo);
+                allScheduleInfo.addAll(scheduleInfo);
             }
             }
-
+            dataUtil.insertCourseTableEntiy(allScheduleInfo, classroomMap, courseMap, semesterMap, teacherMap, classMap);
+            dataUtil.insertClassTime(allScheduleInfo);
             log.info("课表数据获取完成");
             log.info("课表数据获取完成");
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             log.error(e.getMessage(), e);

+ 0 - 2
src/main/java/com/xjrsoft/module/schedule/util/DataUtil.java

@@ -619,7 +619,6 @@ public class DataUtil {
 //        List<String> sqls = new ArrayList<>();
 //        List<String> sqls = new ArrayList<>();
 //        Map<Integer, String> week = ScheduleUtil.getWeek();
 //        Map<Integer, String> week = ScheduleUtil.getWeek();
         Map<Integer, Integer> tmePeriod = ScheduleUtil.getTmePeriod();
         Map<Integer, Integer> tmePeriod = ScheduleUtil.getTmePeriod();
-        int count = 1;
         String tableName = "course_table";
         String tableName = "course_table";
         List<Entity> entityList = new ArrayList();
         List<Entity> entityList = new ArrayList();
         SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
         SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
@@ -664,7 +663,6 @@ public class DataUtil {
             entity.set("schedule_date", asJsonObject.get("scheduleDate").getAsString());
             entity.set("schedule_date", asJsonObject.get("scheduleDate").getAsString());
             entity.set("jianyue_id", asJsonObject.get("id").getAsString());
             entity.set("jianyue_id", asJsonObject.get("id").getAsString());
             entityList.add(entity);
             entityList.add(entity);
-            count ++;
         }
         }
         if(!entityList.isEmpty()){
         if(!entityList.isEmpty()){
             SqlRunnerAdapter.db().dynamicInsertBatch(tableName, entityList);
             SqlRunnerAdapter.db().dynamicInsertBatch(tableName, entityList);

+ 11 - 8
src/main/resources/mapper/student/BaseStudentDevelopmentMapper.xml

@@ -5,15 +5,18 @@
 <mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentDevelopmentMapper">
 <mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentDevelopmentMapper">
     <select id="getInfoById" resultType="com.xjrsoft.module.student.vo.BaseStudentDevelopmentVo">
     <select id="getInfoById" resultType="com.xjrsoft.module.student.vo.BaseStudentDevelopmentVo">
         SELECT t1.id,t1.is_entrepreneurship,t1.entrepreneurial_project,t1.is_flexible_work,t1.work_content,
         SELECT t1.id,t1.is_entrepreneurship,t1.entrepreneurial_project,t1.is_flexible_work,t1.work_content,
-        t1.is_company_coop,t1.work_company,t1.company_industry,t1.company_nature,t2.name AS company_scale_cn,t1.is_matching,
-        t1.money,t1.work_date,t1.work_city,t3.name AS culture_type_cn,t4.name AS ascending_channels_cn,
-        t1.school,t1.admission_major,t1.score,t5.name AS ascending_arrangement_cn,t6.name AS unemployed_type_cn,t1.remark
+               t1.is_company_coop,t1.work_company,t7.name AS company_industry,t8.name AS company_nature,t2.name AS company_scale_cn,t1.is_matching,
+               t1.money,t1.work_date,t1.work_city,t3.name AS culture_type_cn,t4.name AS ascending_channels_cn,
+               t1.school,t1.admission_major,t1.score,t5.name AS ascending_arrangement_cn,t6.name AS unemployed_type_cn,t1.remark,t1.enroll_type
+
         FROM base_student_development t1
         FROM base_student_development t1
-        LEFT JOIN xjr_dictionary_detail t2 ON t1.company_scale = t2.code
-        LEFT JOIN xjr_dictionary_detail t3 ON t1.culture_type = t3.code
-        LEFT JOIN xjr_dictionary_detail t4 ON t1.ascending_channels = t4.code
-        LEFT JOIN xjr_dictionary_detail t5 ON t1.ascending_arrangement = t5.code
-        LEFT JOIN xjr_dictionary_detail t6 ON t1.unemployed_type = t6.code
+                 LEFT JOIN xjr_dictionary_detail t2 ON t1.company_scale = t2.code
+                 LEFT JOIN xjr_dictionary_detail t3 ON t1.culture_type = t3.code
+                 LEFT JOIN xjr_dictionary_detail t4 ON t1.ascending_channels = t4.code
+                 LEFT JOIN xjr_dictionary_detail t5 ON t1.ascending_arrangement = t5.code
+                 LEFT JOIN xjr_dictionary_detail t6 ON t1.unemployed_type = t6.code
+                 LEFT JOIN xjr_dictionary_detail t7 ON t1.company_industry = t7.code
+                 LEFT JOIN xjr_dictionary_detail t8 ON t1.company_nature = t8.code
         WHERE t1.delete_mark = 0
         WHERE t1.delete_mark = 0
         AND t1.id = #{id}
         AND t1.id = #{id}
     </select>
     </select>

+ 8 - 5
src/test/java/com/xjrsoft/module/job/JianyuekbScheduleTaskTest.java

@@ -94,10 +94,11 @@ class JianyuekbScheduleTaskTest {
             LocalDate startDateObj = LocalDate.parse(startDateStr);
             LocalDate startDateObj = LocalDate.parse(startDateStr);
             LocalDate endDateObj = LocalDate.parse(endDateStr);
             LocalDate endDateObj = LocalDate.parse(endDateStr);
             long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
             long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
-            long times = (between / 7) + 1;
+            int times = Integer.parseInt(((between / 7) + 1) + "");
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            for (int i = 0; i < times; i ++) {
-                LocalDate statrTime = startDateObj.plusDays(i * 7L);
+            JsonArray allScheduleInfo = new JsonArray();
+            for (int index = 0; index < times; index ++) {
+                LocalDate statrTime = startDateObj.plusDays(index * 7L);
                 String startDate = statrTime.format(formatter);
                 String startDate = statrTime.format(formatter);
                 LocalDate endTime = statrTime.plusDays(6L);
                 LocalDate endTime = statrTime.plusDays(6L);
                 if(endTime.isAfter(endDateObj)){
                 if(endTime.isAfter(endDateObj)){
@@ -107,9 +108,11 @@ class JianyuekbScheduleTaskTest {
                 String endDate = endTime.format(formatter);
                 String endDate = endTime.format(formatter);
                 //获取课表并存到数据库
                 //获取课表并存到数据库
                 JsonArray scheduleInfo = dataUtil.getScheduleInfoByGrade(eduYearSerialNo, startDate, endDate);
                 JsonArray scheduleInfo = dataUtil.getScheduleInfoByGrade(eduYearSerialNo, startDate, endDate);
-                dataUtil.insertCourseTableEntiy(scheduleInfo, classroomMap, courseMap, semesterMap, teacherMap, classMap);
-                dataUtil.insertClassTime(scheduleInfo);
+                allScheduleInfo.addAll(scheduleInfo);
             }
             }
+
+            dataUtil.insertCourseTableEntiy(allScheduleInfo, classroomMap, courseMap, semesterMap, teacherMap, classMap);
+            dataUtil.insertClassTime(allScheduleInfo);
         } catch (Exception e) {
         } catch (Exception e) {
         }
         }
     }
     }