Ver Fonte

Merge branch 'pre'

dzx há 1 ano atrás
pai
commit
10dcd53231

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

@@ -59,10 +59,17 @@ public class JianyuekbScheduleTask {
         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("_")){
-                gradeId = el.get("source_id").toString().split("_")[1];
+                String[] split = el.get("source_id").toString().split("_");
+                gradeId = split[1];
+                orgId = split[0];
             }
-            List<BaseClass> classList = classService.list(new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getGradeId, gradeId));
+            List<BaseClass> classList = classService.list(
+                    new QueryWrapper<BaseClass>().lambda()
+                            .eq(BaseClass::getGradeId, gradeId)
+                            .eq(orgId != null, BaseClass::getOrgId, orgId)
+            );
             List<Long> classIds = classList.stream().map(BaseClass::getId).collect(Collectors.toList());
 
             gradeClassMaps.put(el.get("jianyue_id").toString(), classIds);

+ 43 - 18
src/main/java/com/xjrsoft/module/oa/service/impl/NewsServiceImpl.java

@@ -55,14 +55,19 @@ import com.xjrsoft.module.oa.vo.ProclamationPageVo;
 import com.xjrsoft.module.oa.vo.ProclamationVo;
 import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
 import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.entity.Role;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
+import com.xjrsoft.module.organization.entity.UserRoleRelation;
 import com.xjrsoft.module.organization.mapper.DepartmentMapper;
 import com.xjrsoft.module.organization.mapper.UserDeptRelationMapper;
 import com.xjrsoft.module.organization.mapper.UserMapper;
 import com.xjrsoft.module.organization.service.IWeChatService;
+import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
+import com.xjrsoft.module.student.service.IStudentManagerService;
+import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import com.xjrsoft.module.system.entity.File;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.teacher.mapper.XjrUserMapper;
@@ -91,15 +96,12 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
 
     private final NewsMapper newsMapper;
 
-
     private final NewsAppendixMapper newsAppendixMapper;
     private final NewsRelationMapper newsRelationMapper;
     private final NewsRelationConfigMapper newsRelationConfigMapper;
 
-
     private final UserDeptRelationMapper userDeptRelationMapper;
 
-
     private final BaseStudentSchoolRollMapper baseStudentSchoolRollMapper;
 
     private final IWeChatService weChatService;
@@ -613,21 +615,44 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
 
         //公告需要添加阅读关系,发送范围 1=全校教职工 2=全校师生 3=指定人员
         //1=全校教职工,添加全校教职工到关系表
-//        if(addNewsDto.getTypeId() == 2 && addNewsDto.getSendRange() == 1){
-//            MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
-//            queryUser
-//                    .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
-//                    .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
-//                    .eq(Role::getId, 2);
-//            List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
-//            for (XjrUser user: userList) {
-//                newsRelation.setUserId(user.getId());
-//                newsRelationMapper.insert(newsRelation);
-//            }
-
-//        }
-
-        if (addNewsDto.getTypeId() == 2 && addNewsDto.getSendRange() == 1) {
+        if(addNewsDto.getTypeId() == 2 && addNewsDto.getSendRange() == 1){
+            MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
+            queryUser
+                    .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
+                    .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
+                    .eq(Role::getId, 2);
+            List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
+            for (XjrUser user: userList) {
+                NewsRelation newsRelation = new NewsRelation();
+                newsRelation.setUserId(user.getId());
+                newsRelation.setNewsId(news.getId());
+                newsRelation.setCreateDate(LocalDateTime.now());
+                newsRelationMapper.insert(newsRelation);
+            }
+            List<BaseStudentInfoPageVo> studyingList = baseStudentSchoolRollMapper.getStudyingList(new BaseStudentInfoPageDto());
+            for (BaseStudentInfoPageVo user: studyingList) {
+                NewsRelation newsRelation = new NewsRelation();
+                newsRelation.setUserId(user.getId());
+                newsRelation.setNewsId(news.getId());
+                newsRelation.setCreateDate(LocalDateTime.now());
+                newsRelationMapper.insert(newsRelation);
+            }
+        } else if(addNewsDto.getTypeId() == 2 && addNewsDto.getSendRange() == 2){
+            MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
+            queryUser
+                    .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
+                    .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
+                    .eq(Role::getId, 2);
+            List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
+            for (XjrUser user: userList) {
+                NewsRelation newsRelation = new NewsRelation();
+                newsRelation.setUserId(user.getId());
+                newsRelation.setNewsId(news.getId());
+                newsRelation.setCreateDate(LocalDateTime.now());
+                newsRelationMapper.insert(newsRelation);
+            }
+
+        } else if (addNewsDto.getTypeId() == 2 && addNewsDto.getSendRange() == 3) {
             for (AddNewsRelationDto relationDto : addNewsDto.getRelationList()) {
 
                 NewsRelationConfig newsRelationConfig = BeanUtil.toBean(relationDto, NewsRelationConfig.class);

+ 31 - 0
src/main/java/com/xjrsoft/module/schedule/controller/ScheduleController.java

@@ -12,6 +12,8 @@ import com.google.gson.JsonParser;
 import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.module.base.entity.BaseSemester;
+import com.xjrsoft.module.base.service.IBaseSemesterService;
 import com.xjrsoft.module.courseTable.entity.CourseTable;
 import com.xjrsoft.module.courseTable.service.ICourseTableService;
 import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
@@ -43,7 +45,9 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.validation.Valid;
 import java.io.ByteArrayOutputStream;
 import java.time.DayOfWeek;
+import java.time.Duration;
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.Date;
 import java.util.List;
@@ -67,6 +71,7 @@ public class ScheduleController {
     private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
     private final IBaseTeacherService baseTeacherService;
     private final ITeacherbaseManagerService teacherService;
+    private final IBaseSemesterService semesterService;
 
     @GetMapping(value = "/receive-msg")
     @ApiOperation(value="接收消息")
@@ -130,6 +135,32 @@ public class ScheduleController {
         return RT.ok(list);
     }
 
+    @GetMapping(value = "/current-week")
+    @ApiOperation(value="获取当前周次")
+    @SaCheckPermission("room:detail")
+    public RT<Integer> currentWeek(CourseTableDto dto){
+        List<BaseSemester> semesterList = semesterService.list(new QueryWrapper<BaseSemester>().lambda().orderByDesc(BaseSemester::getStartDate));
+        BaseSemester baseSemester = semesterList.get(0);
+        LocalDateTime now = LocalDateTime.now();
+        //计算本周是第几周
+        LocalDateTime startDateTime = LocalDateTime.ofInstant(baseSemester.getStartDate().toInstant(), ZoneId.systemDefault());
+        LocalDateTime endDateTime = LocalDateTime.ofInstant(baseSemester.getEndDate().toInstant(), ZoneId.systemDefault());
+        Duration between = Duration.between(startDateTime, endDateTime);
+        long days = between.toDays();
+        int weeks = (int) Math.ceil((double) days / 7);
+        if (dto.getWeek() == null) {
+            for (int i = 0; i < weeks; i++) {
+                LocalDateTime startDate = startDateTime.plusDays(i * 6).withHour(0).withMinute(0).withSecond(0).withNano(0);
+                LocalDateTime endDate = startDateTime.plusDays((i + 1) * 6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
+                if (now.isAfter(startDate) && now.isBefore(endDate)) {
+                    return RT.ok(i + 1);
+                }
+            }
+        }
+
+        return RT.error("未能查询到当前周次");
+    }
+
 
     @GetMapping(value = "/adjust-list")
     @ApiOperation(value = "可以调课的课程")

+ 3 - 1
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -366,7 +366,9 @@ public class BaseNewStudentController {
             }else if(el.getIsAdjust() == 0){
                 vo.setReportStatus("否");
             }
-            vo.setReportTime(el.getReportTime().format(formatter));
+            if(el.getReportTime() != null){
+                vo.setReportTime(el.getReportTime().format(formatter));
+            }
             exportVos.add(vo);
         }
         ByteArrayOutputStream bot = new ByteArrayOutputStream();

+ 2 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentSchoolRollMapper.java

@@ -53,5 +53,7 @@ public interface BaseStudentSchoolRollMapper extends MPJBaseMapper<BaseStudentSc
 
     Long getClassIdByUserId(@Param("userId") Long userId);
 
+    List<BaseStudentInfoPageVo> getStudyingList(BaseStudentInfoPageDto dto);
+
 }
 

+ 47 - 0
src/main/resources/mapper/student/BaseStudentSchoolRollMapper.xml

@@ -204,4 +204,51 @@
         INNER JOIN base_student_school_roll t2 ON t1.id = t2.class_id
         WHERE t2.user_id = #{userId}
     </select>
+    <select id="getStudyingList" parameterType="com.xjrsoft.module.student.dto.BaseStudentInfoPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentInfoPageVo">
+        SELECT
+        t2.id,
+        t2.name AS student_name,
+        t1.student_id,
+        t2.mobile AS phone,
+        t5.mobile AS teacher_phone,
+        t5.name AS teacher_name,
+        t4.name AS class_name,
+        (SELECT mobile
+        FROM base_student_family_member
+        WHERE delete_mark = 0
+        AND user_id = t2.id
+        AND is_guardian = 1) AS guardian_phone,
+        t7.name AS gender_cn,
+        t8.name AS stduyStatus,
+        t2.gender,
+        t10.name AS genderCn,
+        t2.birth_date,
+        t6.name AS nation,
+        t3.archives_status AS archivesStatusCode,
+        t3.stduy_status AS stduyStatusCode,
+        t3.roll_modality AS rollModalityCode,
+        t12.name AS archives_status,
+        t8.name AS stduy_status,
+        t13.name AS roll_modality,
+        t11.name AS student_form,
+        CONCAT(t16.name, ' ', t15.room_name, ' ', t14.bed_number) AS bed_info
+        FROM base_student t1
+        INNER JOIN xjr_user t2 ON t1.user_id = t2.id
+        INNER JOIN base_student_school_roll t3 ON t1.user_id = t3.user_id
+        LEFT JOIN base_class t4 ON t3.class_id = t4.id
+        LEFT JOIN xjr_user t5 ON t4.teacher_id = t5.id
+        LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.nation
+        LEFT JOIN xjr_dictionary_detail t7 ON t7.code = t2.gender
+        LEFT JOIN xjr_dictionary_detail t8 ON t8.code = t3.stduy_status
+        LEFT JOIN xjr_dictionary_detail t11 ON t11.code = t3.student_type
+        LEFT JOIN xjr_dictionary_detail t12 ON t12.code = t3.archives_status
+        LEFT JOIN xjr_dictionary_detail t13 ON t13.code = t3.roll_modality
+        LEFT JOIN xjr_dictionary_detail t10 ON t2.gender = t10.code
+        LEFT JOIN room_bed t14 ON t14.student_user_id = t2.id
+        LEFT JOIN room t15 ON t14.room_id = t15.id
+        LEFT JOIN base_office_build t16 ON t15.office_build_id = t16.id
+        WHERE t2.delete_mark = 0
+        AND t1.delete_mark = 0
+        AND t3.archives_status = 'FB2901'
+    </select>
 </mapper>