Browse Source

1、新闻bug修复
2、课表接口调整

dzx 6 months ago
parent
commit
793156f11f

+ 4 - 0
src/main/java/com/xjrsoft/module/courseTable/service/impl/CourseTableServiceImpl.java

@@ -224,6 +224,8 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
                     if (now.isAfter(startDate) && now.isBefore(endDate)) {
                         tableVo.setWeek("第" + (i + 1) + "周");
                     }
+                    tableVo.setStartDate(startDate.toLocalDate());
+                    tableVo.setEndDate(endDate.toLocalDate());
                 }
             } else {
                 LocalDateTime startDate = startDateTime.plusDays((dto.getWeek() - 1) * 6).withHour(0).withMinute(0).withSecond(0).withNano(0);
@@ -231,6 +233,8 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
                 dto.setStartDate(startDate);
                 dto.setEndDate(endDate);
                 tableVo.setWeek("第" + dto.getWeek() + "周");
+                tableVo.setStartDate(startDate.toLocalDate());
+                tableVo.setEndDate(endDate.toLocalDate());
             }
 
         }

+ 24 - 46
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -350,13 +350,14 @@ public class NewsController {
 
             //新闻
             if(typeId == 1){
-                Long notReadCount = newsService.count(Wrappers.<News>query().lambda()
-                        .eq(News::getTypeId, typeId)
-                        .eq(News::getStatus, 2)
-                        .gt(News::getSendEndDate, LocalDateTime.now())
-                        .eq(News::getWfStatus, 1)
-                        .notInSql(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong()));
-
+                Long notReadCount = newsService.count(
+                        MPJWrappers.<News>lambdaJoin()
+                                .leftJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
+                                .eq(News::getStatus, 2)
+                                .gt(News::getSendEndDate, LocalDateTime.now())
+                                .eq(News::getTypeId, typeId)
+                                .eq(NewsRelation::getReadMark, 0)
+                );
                 newsCountTypeVo.setTypeId(typeId);
                 newsCountTypeVo.setTotal(notReadCount);
 
@@ -373,32 +374,25 @@ public class NewsController {
             //公告
             if(typeId == 2){
                 //公告发给全体的
-                Long notReadCountProclamationToAll = newsService.count(Wrappers.<News>query().lambda()
-                        .eq(News::getTypeId, 2)
-                        .eq(News::getStatus, 2)
-                        .eq(News::getSendRange, 1)
-                        .notInSql(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong())
-                        .and(wp -> wp.gt(News::getSendEndDate, LocalDateTime.now())
-                                .or()
-                                .isNull(News::getSendEndDate)));
+                Long notReadCountProclamation = newsService.count(
+                        MPJWrappers.<News>lambdaJoin()
+                                .leftJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
+                                .eq(News::getStatus, 2)
+                                .gt(News::getSendEndDate, LocalDateTime.now())
+                                .eq(News::getTypeId, typeId)
+                                .eq(NewsRelation::getReadMark, 0)
+                );
 
                 News newsAll = newsService.getOne(Wrappers.<News>query().lambda()
                         .eq(News::getTypeId, 2)
                         .eq(News::getStatus, 2)
                         .eq(News::getSendRange, 1)
-                        //.notInSql(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong())
                         .and(wp -> wp.gt(News::getSendEndDate, LocalDateTime.now())
                                 .or()
                                 .isNull(News::getSendEndDate))
                         .orderByDesc(News::getReleaseTime)
                         .last("limit 1"));
 
-                //公告发给非全体的
-                Long notReadCountProclamation = newsRelationService.count(Wrappers.<NewsRelation>query().lambda()
-                        .eq(NewsRelation::getReadMark, 0)
-                        .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
-                        .inSql(NewsRelation::getNewsId, "select id from xjr_oa_news where delete_mark = 0 and type_id = 2 and (send_range = 2 or send_range = 3) AND (send_end_date > '" + LocalDateTime.now() + "' OR send_end_date IS NULL)"));
-
                 MPJLambdaWrapper<News> queryNews = new MPJLambdaWrapper<>();
                 queryNews
                         .leftJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
@@ -432,7 +426,7 @@ public class NewsController {
                 }
 
                 newsCountTypeVo.setTypeId(typeId);
-                newsCountTypeVo.setTotal(notReadCountProclamationToAll + notReadCountProclamation);
+                newsCountTypeVo.setTotal(notReadCountProclamation);
             }
 
             if (news != null) {
@@ -465,28 +459,12 @@ public class NewsController {
     @GetMapping("/unread-count")
     @ApiOperation(value = "获取登录人未读消息数量")
     public RT<Long> unreadCount() {
-        Long notReadCountNews = newsService.count(Wrappers.<News>query().lambda()
-                .eq(News::getTypeId, 1)
-                .eq(News::getStatus, 2)
-                .gt(News::getSendEndDate, LocalDateTime.now())
-                .eq(News::getWfStatus, 1)
-                .notInSql(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong()));
-
-        //公告发给全体的
-        Long notReadCountProclamationToAll = newsService.count(Wrappers.<News>query().lambda()
-                .eq(News::getTypeId, 2)
-                .eq(News::getStatus, 2)
-                .eq(News::getSendRange, 1)
-                .notInSql(News::getId, "select distinct news_id from xjr_oa_news_relation where read_mark = 1 and user_id = " + StpUtil.getLoginIdAsLong())
-                .and(wp -> wp.gt(News::getSendEndDate, LocalDateTime.now())
-                        .or()
-                        .isNull(News::getSendEndDate)));
-
-        //公告发给非全体的
-        Long notReadCountProclamation = newsRelationService.count(Wrappers.<NewsRelation>query().lambda()
-                .eq(NewsRelation::getReadMark, 0)
-                .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
-                .inSql(NewsRelation::getNewsId, "select id from xjr_oa_news where delete_mark = 0 and type_id = 2 and status = 2 and (send_range = 2 or send_range = 3) AND (send_end_date > '" + LocalDateTime.now() + "' OR send_end_date IS NULL)"));
+        Long notReadCountNews = newsService.count(
+            MPJWrappers.<News>lambdaJoin()
+            .leftJoin(NewsRelation.class, NewsRelation::getNewsId, News::getId)
+            .eq(News::getStatus, 2)
+            .eq(NewsRelation::getReadMark, 0)
+        );
 
         //公告发给非全体的
         long systemUpdateMessageCount = systemUpdateMessageService.count(
@@ -498,7 +476,7 @@ public class NewsController {
                         .eq(SystemUpdateMessageNotice::getStatus, 0)
         );
 
-        Long notReadCount = notReadCountNews + notReadCountProclamationToAll + notReadCountProclamation + systemUpdateMessageCount;
+        Long notReadCount = notReadCountNews + systemUpdateMessageCount;
         return RT.ok(notReadCount);
     }
 

+ 8 - 0
src/main/java/com/xjrsoft/module/schedule/vo/CourseTableVo.java

@@ -4,6 +4,8 @@ import com.xjrsoft.module.courseTable.entity.ClassTime;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -33,4 +35,10 @@ public class CourseTableVo {
 
     @ApiModelProperty("第几周")
     private String week;
+
+    @ApiModelProperty("第几周")
+    private LocalDate startDate;
+
+    @ApiModelProperty("第几周")
+    private LocalDate endDate;
 }

+ 1 - 1
src/main/resources/application.yml

@@ -5,7 +5,7 @@ server:
 spring:
   # 环 io境 dev|pre|prod
   profiles:
-    active: dev
+    active: pre
   # jackson时间格式化
   jackson:
     time-zone: GMT+8