package com.goafanti.admin.service.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.goafanti.admin.bo.NoticeBo; import com.goafanti.admin.service.NoticeService; import com.goafanti.common.dao.NoticeMapper; import com.goafanti.common.enums.NoticeTypes; import com.goafanti.core.mybatis.BaseMybatisDao; import com.goafanti.core.mybatis.page.Pagination; import com.goafanti.core.shiro.token.TokenManager; @Service public class NoticeServiceImpl extends BaseMybatisDao implements NoticeService { @Autowired private NoticeMapper noticeMapper; @Override public List> updateListUnreadNoticeByAid() { List> list = new ArrayList<>(); List nl = noticeMapper.findUnreadNoticeListByPage(TokenManager.getAdminId()); List dl = new ArrayList(); for (int i = NoticeTypes.getCount(); i >= 0; i--) { Map map = new HashMap(); List cffk = new ArrayList(); for (NoticeBo n : nl) { // 0专利提醒 if (n.getType() == i) { cffk.add(n); } else if (n.getType() == i) { cffk.add(n); } else if (n.getType() == i) { cffk.add(n); } else if (n.getType() == i) { cffk.add(n); } else if (n.getType() == i) { cffk.add(n); } else if (n.getType() == i) { cffk.add(n); } else if (n.getType() == i) { cffk.add(n); } } map.put("name", NoticeTypes.getValueByCode(i)); map.put("id", i); map.put("list", cffk); list.add(map); } if (!nl.isEmpty()) { for (NoticeBo n : nl) { // 添加已读 dl.add(n.getId()); } noticeMapper.batchUpdateUnreaded(dl); } return list; } @SuppressWarnings("unchecked") @Override public Pagination ListReadedNoticeByAid(Integer type, Integer pageNo, Integer pageSize) { Map params = new HashMap<>(); params.put("aid", TokenManager.getAdminId()); params.put("type", type==null?0:type); return (Pagination) findPage("findReadedNoticeListByPage", "findReadedNoticeCount", params, pageNo, pageSize); } @Override public int findUnreadNoticeCount() { return noticeMapper.selectUnreadedCount(TokenManager.getAdminId()); } }