| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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<NoticeMapper> implements NoticeService {
- @Autowired
- private NoticeMapper noticeMapper;
- @Override
- public List<Map<String, Object>> updateListUnreadNoticeByAid() {
- List<Map<String, Object>> list = new ArrayList<>();
- List<NoticeBo> nl = noticeMapper.findUnreadNoticeListByPage(TokenManager.getAdminId());
- List<String> dl = new ArrayList<String>();
- for (int i = NoticeTypes.getCount(); i >= 0; i--) {
- Map<String, Object> map = new HashMap<String, Object>();
- List<NoticeBo> cffk = new ArrayList<NoticeBo>();
- 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<NoticeBo> ListReadedNoticeByAid(Integer type, Integer pageNo, Integer pageSize) {
- Map<String, Object> params = new HashMap<>();
- params.put("aid", TokenManager.getAdminId());
- params.put("type", type==null?0:type);
- return (Pagination<NoticeBo>) findPage("findReadedNoticeListByPage", "findReadedNoticeCount", params, pageNo,
- pageSize);
- }
- @Override
- public int findUnreadNoticeCount() {
- return noticeMapper.selectUnreadedCount(TokenManager.getAdminId());
- }
- }
|