From a1aa8c7187dd16767ddfaab70acd711c05963109 Mon Sep 17 00:00:00 2001 From: "zhouj1203@hotmail.com" Date: Thu, 8 Aug 2024 16:53:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8F=AD=E4=BC=9A=E7=A7=91?= =?UTF-8?q?=E7=9B=AE=E9=80=BB=E8=BE=91=E4=BB=A3=E7=A0=81=EF=BC=8C=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E6=94=B9=E4=B8=BA=E6=AD=A3=E5=BC=8F?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/impl/AdminIndexDutyServiceImpl.java | 6 ++++++ .../cn/teammodel/model/dto/weekDuty/LessonRecordDto.java | 8 +++++--- .../java/cn/teammodel/model/entity/school/School.java | 2 ++ .../java/cn/teammodel/repository/SchoolRepository.java | 2 ++ src/main/resources/application.yml | 4 ++-- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/AdminIndexDutyServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/AdminIndexDutyServiceImpl.java index 715acba..155363e 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/AdminIndexDutyServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/AdminIndexDutyServiceImpl.java @@ -229,6 +229,12 @@ public class AdminIndexDutyServiceImpl implements AdminIndexDutyService { Map mapper = new HashMap<>(); String apiUrl = env.getProperty("ies.server-url"); + if(lessonRecordDto.isClassMeeting()) { + List subjects = schoolRepository.findSubjectById(lessonRecordDto.getSchool(), lessonRecordDto.getPeriodId()); + List subjectIds = subjects.stream().filter(subject -> "班会".equals(subject.getName())) + .map(School.Subject::getId).collect(Collectors.toList()); + lessonRecordDto.setSubjectId(subjectIds); + } try (CloseableHttpClient httpClient = HttpClients.createDefault()) { // 创建HttpPost对象 diff --git a/src/main/java/cn/teammodel/model/dto/weekDuty/LessonRecordDto.java b/src/main/java/cn/teammodel/model/dto/weekDuty/LessonRecordDto.java index 1e4140e..a274df5 100644 --- a/src/main/java/cn/teammodel/model/dto/weekDuty/LessonRecordDto.java +++ b/src/main/java/cn/teammodel/model/dto/weekDuty/LessonRecordDto.java @@ -3,6 +3,7 @@ package cn.teammodel.model.dto.weekDuty; import lombok.Data; import java.util.ArrayList; +import java.util.List; @Data public class LessonRecordDto { @@ -13,9 +14,9 @@ public class LessonRecordDto { private String periodId; private Long stime; private Long etime; - private ArrayList category; - private ArrayList subjectId; - private ArrayList grade; + private List category; + private List subjectId; + private List grade; private boolean doubleGreen = false; private boolean singleGreen = false; private boolean isOk = false; @@ -24,4 +25,5 @@ public class LessonRecordDto { private int pageCount; private String continuationToken; private boolean managePage = true; + private boolean classMeeting; } diff --git a/src/main/java/cn/teammodel/model/entity/school/School.java b/src/main/java/cn/teammodel/model/entity/school/School.java index 507cfe1..d038d6a 100644 --- a/src/main/java/cn/teammodel/model/entity/school/School.java +++ b/src/main/java/cn/teammodel/model/entity/school/School.java @@ -88,6 +88,8 @@ public class School extends BaseItem { } @Data + @AllArgsConstructor + @NoArgsConstructor public static class Subject { private String id; private String name; diff --git a/src/main/java/cn/teammodel/repository/SchoolRepository.java b/src/main/java/cn/teammodel/repository/SchoolRepository.java index 108f044..5a200de 100644 --- a/src/main/java/cn/teammodel/repository/SchoolRepository.java +++ b/src/main/java/cn/teammodel/repository/SchoolRepository.java @@ -21,6 +21,8 @@ public interface SchoolRepository extends CosmosRepository { List findPeriodById(@Param("schoolId") String schoolId, @Param("periodId") String periodId); @Query("select value p.semesters from School as s join p in s.period where s.id = @schoolId and s.code = 'Base' and p.id = @periodId") List findSemestersById(@Param("schoolId") String schoolId, @Param("periodId") String periodId); + @Query("select value p.subjects from School as s join p in s.period where s.id = @schoolId and s.code = 'Base' and p.id = @periodId") + List findSubjectById(@Param("schoolId") String schoolId, @Param("periodId") String periodId); School findSchoolByIdAndCode(String schoolId, String code); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2a3fe23..18cfc64 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -23,9 +23,9 @@ spring: cloud: azure: cosmos: - endpoint: https://cdhabookdep-free.documents.azure.cn:443 + endpoint: https://teammodelos.documents.azure.cn:443 database: TEAMModelOS - key: JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A== + key: clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg== populate-query-metrics: true security: