package com.goafanti.user.service.impl; import com.goafanti.admin.service.DepartmentService; import com.goafanti.common.dao.AdminMapper; import com.goafanti.common.dao.PublicReleaseCountMapper; import com.goafanti.common.dao.UserFollowMapper; import com.goafanti.common.utils.excel.NewExcelUtil; import com.goafanti.core.mybatis.BaseMybatisDao; import com.goafanti.core.mybatis.page.Pagination; import com.goafanti.core.shiro.token.TokenManager; import com.goafanti.user.bo.InputUserFollowList; import com.goafanti.user.bo.outFollowStatisticsList; import com.goafanti.user.bo.outProvinceFollowStatistic; import com.goafanti.user.bo.outUserFollowList; import com.goafanti.user.service.UserFollowService; import jdk.nashorn.internal.parser.Token; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.terracotta.offheapstore.HashingMap; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class UserFollowServiceImpl extends BaseMybatisDao implements UserFollowService { @Autowired private AdminMapper adminMapper; @Autowired private PublicReleaseCountMapper publicReleaseCountMapper; @Autowired private DepartmentService departmentService; @Override public Pagination userFollowList(InputUserFollowList in) { Mapmap=setParam(in); return (Pagination) findPage("userFollowList","userFollowCount",map,in.getPageNo(), in.getPageSize()); } private Map setParam(InputUserFollowList in) { Mapmap=new HashMap<>(); if (in.getUserName()!=null) map.put("userName", in.getUserName()); if (in.getContactType()!=null) map.put("contactType", in.getContactType()); if (in.getUserType()!=null) map.put("userType", in.getUserType()); if (in.getFollowStartTime()!=null) map.put("followStartTime", in.getFollowStartTime()); if (in.getFollowEndTime()!=null) map.put("followEndTime", in.getFollowEndTime()+" 23:59:59"); if (in.getCreateStartTime()!=null) map.put("createStartTime", in.getCreateStartTime()); if (in.getCreateEndTime()!=null) map.put("createEndTime", in.getCreateEndTime()+" 23:59:59"); if (in.getGuidanceStartTime()!=null) map.put("guidanceStartTime", in.getGuidanceStartTime()); if (in.getGuidanceEndTime()!=null) map.put("guidanceEndTime", in.getGuidanceEndTime()+" 23:59:59"); if (in.getDepId() != null){ map.put("deps", departmentService.getLowerDep(in.getDepId())); } if (in.getShiroType()!=null)map.put("shiroType",in.getShiroType()); else map.put("shiroType",0); if(in.getShiroType()==0){ map.put("aid", TokenManager.getAdminId()); }else if(in.getShiroType()==1){ String aid=TokenManager.getAdminId(); List aids=new ArrayList<>(); aids=adminMapper.selectBySuperId(aid); aids.add(aid); map.put("aids",aids); } if (in.getFollowName() != null )map.put("followName",in.getFollowName()); return map; } @Override public List userFollowListExport(InputUserFollowList in) { Mapmap=setParam(in); Listlist= (List) findList("userFollowList",map,1,999999); return list; } @Override public List followStatisticsList(String depId, String date,Integer province, Integer sort) { if(sort==null)sort=0; if (date==null)return new ArrayList<>(); return publicReleaseCountMapper.followStatisticsList(depId,date,province,sort); } @Override public List provinceFollowStatisticsList(String depId, String date, Integer province,Integer type, Integer sort) { if(sort==null)sort=0; return publicReleaseCountMapper.provinceFollowStatisticsList(depId,date,province,type,sort); } }