lideyin před 5 roky
rodič
revize
98b350ee10

+ 6 - 4
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/NoticeController.java

@@ -24,6 +24,7 @@ import cn.com.qmth.examcloud.examwork.api.response.DisposePublishingUserNoticeRe
 import cn.com.qmth.examcloud.examwork.api.response.GetNoticeRulePublishProgressListResp;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.web.support.Naked;
 import com.mysql.cj.util.StringUtils;
 import io.micrometer.core.instrument.util.DoubleFormat;
 import io.swagger.annotations.Api;
@@ -295,17 +296,18 @@ public class NoticeController extends ControllerSupport {
     }
 
 
-    @GetMapping("dipose")
+    @Naked
+    @GetMapping("disposetest")
     @ApiOperation(value = "获取用户公告列表")
-    public void dipose(){
+    public void disposetest(){
         //获取待处理的通知进度数据
         List<NoticeRulePublishProgressEntity> progressList = noticeService.getToBeDisposedNoticeRulePublishProgressList();
         if (progressList == null || progressList.isEmpty()) {
             return;
         }
-        Long startUserId = 0L;
 
         for (NoticeRulePublishProgressEntity progress : progressList) {
+            Long startUserId = 0L;
             int loopTimes = 0;
             Long lastMaxUserId = getLastMaxUserId(progress.getNoticeReceiverRuleType(), progress);
             if (lastMaxUserId != null) {
@@ -318,7 +320,7 @@ public class NoticeController extends ControllerSupport {
                     noticeService.updateNoticeStatus(progress.getNoticeId(), NoticeStatus.PUBLISHED);
                     break;
                 } else {
-                    startUserId = nextUserId+1;
+                    startUserId = nextUserId;
                     //处理中的状态只需更新一次
                     if (loopTimes == 1) {
                         noticeService.updateNoticeStatus(progress.getNoticeId(), NoticeStatus.PUBLISHING);

+ 6 - 1
examcloud-core-examwork-service/src/main/java/cn/com/qmth/examcloud/core/examwork/service/impl/NoticeServiceImpl.java

@@ -245,7 +245,7 @@ public class NoticeServiceImpl implements NoticeService {
                                             NoticeRulePublishProgressEntity ruleProgress) {
 
         // 发布通知每次处理的用户id数量 // TODO: 2019/7/10 需要将参数放到配置文件
-        int rowNumber = PropertyHolder.getInt("notice.dispose.userId.size", 100);
+        int rowNumber = PropertyHolder.getInt("notice.dispose.userId.size", 20);
         Long rootOrgId = ruleProgress.getRootOrgId();
         Long noticeId = ruleProgress.getNoticeId();
         NoticeReceiverRuleType ruleType = ruleProgress.getNoticeReceiverRuleType();
@@ -259,6 +259,11 @@ public class NoticeServiceImpl implements NoticeService {
         // 满足条件的用户id集合(可能为空)
         List<Long> limitStudentIdList = getLimitUserIdResp.getIdList();
 
+        //如果没有取到数据,则直接返回
+        if (null == limitStudentIdList || limitStudentIdList.size()==0){
+            return getLimitUserIdResp.getNextId();
+        }
+
         //保存用户通知关系表数据,并更新通知的发布进度
         saveUserNoticeAndUpdateRulePublishProgress(rootOrgId, noticeId, ruleType, ruleProgress,
                 limitStudentIdList, getLimitUserIdResp.getMaxId());