UserFollowServiceImpl.java 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package com.goafanti.user.service.impl;
  2. import com.goafanti.admin.service.DepartmentService;
  3. import com.goafanti.common.dao.AdminMapper;
  4. import com.goafanti.common.dao.PublicReleaseCountMapper;
  5. import com.goafanti.common.dao.UserFollowMapper;
  6. import com.goafanti.common.utils.excel.NewExcelUtil;
  7. import com.goafanti.core.mybatis.BaseMybatisDao;
  8. import com.goafanti.core.mybatis.page.Pagination;
  9. import com.goafanti.core.shiro.token.TokenManager;
  10. import com.goafanti.user.bo.InputUserFollowList;
  11. import com.goafanti.user.bo.outFollowStatisticsList;
  12. import com.goafanti.user.bo.outProvinceFollowStatistic;
  13. import com.goafanti.user.bo.outUserFollowList;
  14. import com.goafanti.user.service.UserFollowService;
  15. import jdk.nashorn.internal.parser.Token;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.beans.factory.annotation.Value;
  18. import org.springframework.stereotype.Service;
  19. import org.terracotta.offheapstore.HashingMap;
  20. import java.util.ArrayList;
  21. import java.util.HashMap;
  22. import java.util.List;
  23. import java.util.Map;
  24. @Service
  25. public class UserFollowServiceImpl extends BaseMybatisDao<UserFollowMapper> implements UserFollowService {
  26. @Autowired
  27. private AdminMapper adminMapper;
  28. @Autowired
  29. private PublicReleaseCountMapper publicReleaseCountMapper;
  30. @Autowired
  31. private DepartmentService departmentService;
  32. @Override
  33. public Pagination<outUserFollowList> userFollowList(InputUserFollowList in) {
  34. Map<String,Object>map=setParam(in);
  35. return (Pagination<outUserFollowList>) findPage("userFollowList","userFollowCount",map,in.getPageNo(), in.getPageSize());
  36. }
  37. private Map<String,Object> setParam(InputUserFollowList in) {
  38. Map<String,Object>map=new HashMap<>();
  39. if (in.getUserName()!=null) map.put("userName", in.getUserName());
  40. if (in.getContactType()!=null) map.put("contactType", in.getContactType());
  41. if (in.getUserType()!=null) map.put("userType", in.getUserType());
  42. if (in.getFollowStartTime()!=null) map.put("followStartTime", in.getFollowStartTime());
  43. if (in.getFollowEndTime()!=null) map.put("followEndTime", in.getFollowEndTime()+" 23:59:59");
  44. if (in.getCreateStartTime()!=null) map.put("createStartTime", in.getCreateStartTime());
  45. if (in.getCreateEndTime()!=null) map.put("createEndTime", in.getCreateEndTime()+" 23:59:59");
  46. if (in.getGuidanceStartTime()!=null) map.put("guidanceStartTime", in.getGuidanceStartTime());
  47. if (in.getGuidanceEndTime()!=null) map.put("guidanceEndTime", in.getGuidanceEndTime()+" 23:59:59");
  48. if (in.getDepId() != null){
  49. map.put("deps", departmentService.getLowerDep(in.getDepId()));
  50. }
  51. if (in.getShiroType()!=null)map.put("shiroType",in.getShiroType());
  52. else map.put("shiroType",0);
  53. if(in.getShiroType()==0){
  54. map.put("aid", TokenManager.getAdminId());
  55. }else if(in.getShiroType()==1){
  56. String aid=TokenManager.getAdminId();
  57. List<String> aids=new ArrayList<>();
  58. aids=adminMapper.selectBySuperId(aid);
  59. aids.add(aid);
  60. map.put("aids",aids);
  61. }
  62. if (in.getFollowName() != null )map.put("followName",in.getFollowName());
  63. return map;
  64. }
  65. @Override
  66. public List<outUserFollowList> userFollowListExport(InputUserFollowList in) {
  67. Map<String,Object>map=setParam(in);
  68. List<outUserFollowList>list= (List<outUserFollowList>) findList("userFollowList",map,1,999999);
  69. return list;
  70. }
  71. @Override
  72. public List<outFollowStatisticsList> followStatisticsList(String depId, String date,Integer province, Integer sort) {
  73. if(sort==null)sort=0;
  74. if (date==null)return new ArrayList<>();
  75. return publicReleaseCountMapper.followStatisticsList(depId,date,province,sort);
  76. }
  77. @Override
  78. public List<outProvinceFollowStatistic> provinceFollowStatisticsList(String depId, String date, Integer province,Integer type, Integer sort) {
  79. if(sort==null)sort=0;
  80. return publicReleaseCountMapper.provinceFollowStatisticsList(depId,date,province,type,sort);
  81. }
  82. }