lideyin преди 6 години
родител
ревизия
58a259b9bb

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

@@ -44,7 +44,11 @@ public class NoticeController extends ControllerSupport {
     public PageInfo<NoticeDomain> getPagedNoticeList(@PathVariable Integer curPage,
                                                      @PathVariable Integer pageSize, NoticeDomainQuery query) {
         PageInfo<NoticeDomain> resultPageInfo = new PageInfo<>();
+        User accessUser = this.getAccessUser();
         NoticeInfoQuery infoQuery = new NoticeInfoQuery();
+        infoQuery.setTitle(query.getTitle());
+        infoQuery.setRootOrgId(accessUser.getRootOrgId());
+        infoQuery.setUserId(accessUser.getUserId());
         PageInfo<NoticeInfo> pagedNoticeInfo = noticeService.getPagedNoticeList(curPage, pageSize, infoQuery);
         resultPageInfo = getPageInfoFrom(pagedNoticeInfo);
         return resultPageInfo;
@@ -148,6 +152,7 @@ public class NoticeController extends ControllerSupport {
         info.setRuleType(addNoticeDomain.getRuleType());
         info.setUserId(accessUser.getUserId());
         info.setNoticeStatus(addNoticeDomain.getNoticeStatus());
+        info.setTitle(addNoticeDomain.getTitle());
         return info;
     }
     private UpdateNoticeInfo getUpdateNoticeInfoFrom(UpdateNoticeDomain updateNoticeDomain) {

+ 0 - 32
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/NoticeCloudServiceProvider.java

@@ -1,47 +1,15 @@
 package cn.com.qmth.examcloud.core.examwork.api.provider;
 
-import cn.com.qmth.examcloud.api.commons.enums.CURD;
-import cn.com.qmth.examcloud.api.commons.enums.ExamType;
-import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
-import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
-import cn.com.qmth.examcloud.core.examwork.base.enums.ExamProperty;
-import cn.com.qmth.examcloud.core.examwork.dao.*;
-import cn.com.qmth.examcloud.core.examwork.dao.entity.*;
 import cn.com.qmth.examcloud.core.examwork.service.NoticeService;
-import cn.com.qmth.examcloud.core.examwork.service.bean.ExamInfo;
-import cn.com.qmth.examcloud.core.examwork.service.impl.ExamServiceImpl;
-import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
 import cn.com.qmth.examcloud.examwork.api.NoticeCloudService;
-import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
-import cn.com.qmth.examcloud.examwork.api.bean.ExamCourseRelationBean;
-import cn.com.qmth.examcloud.examwork.api.bean.ExamPaperTypeRelation;
-import cn.com.qmth.examcloud.examwork.api.bean.ExamSpecialSettingsBean;
-import cn.com.qmth.examcloud.examwork.api.request.*;
-import cn.com.qmth.examcloud.examwork.api.response.*;
-import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.domain.Sort.Direction;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.persistence.criteria.Predicate;
-import java.util.*;
-
 /**
  * 考试云服务
  *

+ 33 - 32
examcloud-core-examwork-service/pom.xml

@@ -1,42 +1,43 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>cn.com.qmth.examcloud.core.examwork</groupId>
-		<artifactId>examcloud-core-examwork</artifactId>
-		<version>2019-SNAPSHOT</version>
-	</parent>
-	<artifactId>examcloud-core-examwork-service</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>cn.com.qmth.examcloud.core.examwork</groupId>
+        <artifactId>examcloud-core-examwork</artifactId>
+        <version>2019-SNAPSHOT</version>
+    </parent>
+    <artifactId>examcloud-core-examwork-service</artifactId>
 
-	<dependencies>
-		<dependency>
-			<groupId>cn.com.qmth.examcloud.core.examwork</groupId>
-			<artifactId>examcloud-core-examwork-dao</artifactId>
-			<version>${examcloud.version}</version>
-		</dependency>
+    <dependencies>
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.core.examwork</groupId>
+            <artifactId>examcloud-core-examwork-dao</artifactId>
+            <version>${examcloud.version}</version>
+        </dependency>
 
-		<dependency>
-			<groupId>cn.com.qmth.examcloud.rpc</groupId>
-			<artifactId>examcloud-core-basic-api-client</artifactId>
-			<version>${examcloud.version}</version>
-		</dependency>
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.rpc</groupId>
+            <artifactId>examcloud-core-basic-api-client</artifactId>
+            <version>${examcloud.version}</version>
+        </dependency>
 
-		<dependency>
-			<groupId>cn.com.qmth.examcloud.rpc</groupId>
-			<artifactId>examcloud-core-oe-admin-api-client</artifactId>
-			<version>${examcloud.version}</version>
-		</dependency>
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.rpc</groupId>
+            <artifactId>examcloud-core-oe-admin-api-client</artifactId>
+            <version>${examcloud.version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.rpc</groupId>
+            <artifactId>examcloud-core-marking-api-client</artifactId>
+            <version>${examcloud.version}</version>
+        </dependency>
 
-		<dependency>
-			<groupId>cn.com.qmth.examcloud.rpc</groupId>
-			<artifactId>examcloud-task-api-client</artifactId>
-			<version>${examcloud.version}</version>
-		</dependency>
         <dependency>
             <groupId>cn.com.qmth.examcloud.rpc</groupId>
-            <artifactId>examcloud-core-marking-api</artifactId>
-            <version>2019-SNAPSHOT</version>
-            <scope>compile</scope>
+            <artifactId>examcloud-task-api-client</artifactId>
+            <version>${examcloud.version}</version>
         </dependency>
 
     </dependencies>

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

@@ -106,7 +106,7 @@ public class NoticeServiceImpl implements NoticeService {
         Long rootOrgId = infoQuery.getRootOrgId();
         Specification<NoticeEntity> specification = (root, query, cb) -> {
             List<Predicate> predicates = new ArrayList<>();
-            predicates.add(cb.equal(root.get("rootOrgId"), infoQuery.getPublishStatus()));
+            predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
             if (!StringUtils.isNullOrEmpty(infoQuery.getTitle())) {
                 predicates.add(cb.like(root.get("title"), DBUtil.toSqlSearchPattern(infoQuery.getTitle())));
             }
@@ -267,10 +267,10 @@ public class NoticeServiceImpl implements NoticeService {
         //通知过期年限阈值// TODO: 2019/7/10
         int overdueYearThreshold = PropertyHolder.getInt("notice.dispose.overdue.year", 1);
         Date now = new Date();
-        Date lastYear=DateUtils.addYears(now,-overdueYearThreshold);
+        Date lastYear = DateUtils.addYears(now, -overdueYearThreshold);
         List<NoticeEntity> overdueNoticeList = noticeRepo.findByCreationTimeBefore(lastYear);
-        if (overdueNoticeList!=null && !overdueNoticeList.isEmpty()){
-            for (NoticeEntity notice:overdueNoticeList){
+        if (overdueNoticeList != null && !overdueNoticeList.isEmpty()) {
+            for (NoticeEntity notice : overdueNoticeList) {
                 deleteAllRelatedNotice(notice.getId());
             }
         }
@@ -279,10 +279,11 @@ public class NoticeServiceImpl implements NoticeService {
 
     /**
      * 删除所有相关的通知数据
+     *
      * @param noticeId
      */
     @Transactional
-    public void deleteAllRelatedNotice(Long noticeId){
+    public void deleteAllRelatedNotice(Long noticeId) {
         userNoticeRepo.deleteByNoticeId(noticeId);
         noticeReceiverRuleRepo.deleteByNoticeId(noticeId);
         noticePublishScheduleRepo.deleteByNoticeId(noticeId);
@@ -304,15 +305,13 @@ public class NoticeServiceImpl implements NoticeService {
             throw new StatusException("501010", "读取的数据行数不得少于1行");
         }
         GetLimitUserIdResp getLimitUserIdResp = getSpecifiedUserIdList(rootOrgId, rowNumber, startUserId, ruleType, ruleList);
-        //返回的下一个用户id
         Long nextId = getLimitUserIdResp.getNextId();
-        //满足条件集合中的最大用户id
         Long maxUserId = getLimitUserIdResp.getMaxId();
         //满足条件的用户id集合(可能为空)
         List<Long> limitStudentIdList = getLimitUserIdResp.getIdList();
 
         //如果起始id和方法返回的下次查询id相同,说明数据已经取完,否则继续查询
-        if (startUserId == nextId) {
+        if (startUserId.equals(nextId)) {
             finishNoticePublishSchedule(rootOrgId, noticeId, ruleType, publishSchedule, limitStudentIdList);
         } else {
             updateNoticePublishSchedule(publishSchedule, maxUserId);
@@ -393,8 +392,9 @@ public class NoticeServiceImpl implements NoticeService {
         markWorkerReq.setWorkIds(markWorkIdList);
         markWorkerReq.setStarId(startUserId);
         markWorkerReq.setSize(rowNumber);
+        // FIXME: 2019/7/11
         GetMarkersByWorkIdsResp markWorkerResp = markWorkCloudService.getMarkersByWorkIds(markWorkerReq);
-
+//        GetMarkersByWorkIdsResp markWorkerResp = new GetMarkersByWorkIdsResp();
         List<Long> limitUserIdList = markWorkerResp.getMarkers();
         if (markWorkerResp.getMarkers() != null && !markWorkerResp.getMarkers().isEmpty()) {
             resultResp.setMaxId(Collections.max(limitUserIdList));
@@ -566,6 +566,7 @@ public class NoticeServiceImpl implements NoticeService {
         bean.setRootOrgId(rootOrgId);
         bean.setStatus(1);
         req.setMarkWorkBean(bean);
+        // FIXME: 2019/7/11
         GetMarkWorkResp markWorkResp = markWorkCloudService.getMarkWork(req);
         List<MarkWorkBean> markWorkList = markWorkResp.getMarkWorkBeanList();
         for (Long mwId : markWorkIdList) {