|
@@ -7,6 +7,9 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
import javax.persistence.criteria.Root;
|
|
|
|
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.CommonDao;
|
|
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
|
|
+import com.uas.platform.core.model.Constant;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
@@ -30,15 +33,26 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private NoticeBodyDao noticeBodyDao;
|
|
private NoticeBodyDao noticeBodyDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CommonDao commonDao;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- public Page<Notice> findAllByPageInfo(final PageInfo pageInfo) {
|
|
|
|
|
- return noticeDao.findAll(new Specification<Notice>() {
|
|
|
|
|
|
|
+ public Page<Notice> findAllByPageInfo(final PageInfo pageInfo, final Long useruu) {
|
|
|
|
|
+ Page<Notice> notices = noticeDao.findAll(new Specification<Notice>() {
|
|
|
|
|
|
|
|
public Predicate toPredicate(Root<Notice> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
public Predicate toPredicate(Root<Notice> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
|
query.where(pageInfo.getPredicates(root, query, builder));
|
|
query.where(pageInfo.getPredicates(root, query, builder));
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
}, pageInfo);
|
|
}, pageInfo);
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(notices.getContent())) {
|
|
|
|
|
+ for(Notice notice : notices.getContent()) {
|
|
|
|
|
+ String sql = "select count(1) from notice$readstatus where no_id = " + notice.getId() + " and no_useruu = " + useruu;
|
|
|
|
|
+ Integer count = commonDao.getJdbcTemplate().queryForObject(sql, Integer.class);
|
|
|
|
|
+ notice.setReadStatus(count > 0 ? Constant.YES : null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return notices;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -49,7 +63,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
|
|
+ @Override
|
|
|
public Notice save(NoticeBody noticeBody) {
|
|
public Notice save(NoticeBody noticeBody) {
|
|
|
noticeBody = noticeBodyDao.save(noticeBody);
|
|
noticeBody = noticeBodyDao.save(noticeBody);
|
|
|
return noticeBody.getNotice();
|
|
return noticeBody.getNotice();
|
|
@@ -66,7 +80,9 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
throw new IllegalOperatorException("没有找到您要删除的公告");
|
|
throw new IllegalOperatorException("没有找到您要删除的公告");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void setReadStatus(Long id, Long useruu) {
|
|
|
|
|
+ noticeDao.setReadStatus(id, useruu);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|