|
@@ -19,7 +19,9 @@ import cn.com.qmth.examcloud.core.examwork.service.bean.UserNoticeInfoQuery;
|
|
|
import com.mysql.cj.util.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -32,6 +34,7 @@ import java.util.stream.Collectors;
|
|
|
* @Date 2019/7/2 17:41
|
|
|
* @Version 1.0
|
|
|
*/
|
|
|
+@Service("noticeService")
|
|
|
public class NoticeServiceImpl implements NoticeService {
|
|
|
@Autowired
|
|
|
private NoticeRepo noticeRepo;
|
|
@@ -43,8 +46,8 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
public List<UserNoticeInfo> getNoticeList(UserNoticeInfoQuery query) {
|
|
|
List<UserNoticeInfo> resultList = new ArrayList<>();
|
|
|
List<UserNoticeEntity> userNoticeList;
|
|
|
- if (query.getRead()!=null){
|
|
|
- userNoticeList = userNoticeRepo.findByRootOrgIdAndUserTypeAndUserIdAndRead(query.getRootOrgId(),query.getUserType(), query.getUserId(),query.getRead());
|
|
|
+ if (query.getHasRead()!=null){
|
|
|
+ userNoticeList = userNoticeRepo.findByRootOrgIdAndUserTypeAndUserIdAndHasRead(query.getRootOrgId(),query.getUserType(), query.getUserId(),query.getHasRead());
|
|
|
}else {
|
|
|
userNoticeList = userNoticeRepo.findByRootOrgIdAndUserTypeAndUserId(query.getRootOrgId(),query.getUserType(), query.getUserId());
|
|
|
}
|
|
@@ -62,7 +65,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
info.setContent(noticeEntity.getContent());
|
|
|
info.setPublisher(noticeEntity.getPublisher());
|
|
|
info.setPublishTime(noticeEntity.getPublishTime());
|
|
|
- info.setRead(un.getRead());
|
|
|
+ info.setHasRead(un.getHasRead());
|
|
|
resultList.add(info);
|
|
|
}
|
|
|
}
|
|
@@ -89,8 +92,13 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
}
|
|
|
//获取相应发布状态的通知id集合
|
|
|
List<Long> noticeIdList = byPublishStatusNoticeScheduleList.stream().map(NoticePublishScheduleEntity::getNoticeId).collect(Collectors.toList());
|
|
|
- // predicates.add(cb.in());
|
|
|
+ CriteriaBuilder.In<Object> inCriteriaBuilder = cb.in(root.get("id"));
|
|
|
+ for (Long nid:noticeIdList){
|
|
|
+ inCriteriaBuilder.value(nid);
|
|
|
+ }
|
|
|
+ predicates.add(inCriteriaBuilder);
|
|
|
}
|
|
|
+
|
|
|
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
};
|
|
|
//TODO
|