|
|
@@ -1,20 +1,104 @@
|
|
|
package com.goafanti.admin.service.impl;
|
|
|
|
|
|
import com.goafanti.admin.service.AdminStatisticsService;
|
|
|
+import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.AdminMapper;
|
|
|
+import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
@Service
|
|
|
public class AdminStatisticsServiceImpl implements AdminStatisticsService {
|
|
|
+ private static final Integer TYPE_PRIVATE=0;
|
|
|
+ private static final Integer TYPE_SIGN=2;
|
|
|
+ private static final Integer TYPE_CHANNEL=3;
|
|
|
+
|
|
|
+
|
|
|
@Autowired
|
|
|
private AdminMapper adminMapper;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public Object info( String startTime, String endTime) {
|
|
|
+ String aid=TokenManager.getAdminId();
|
|
|
endTime=endTime+" 23:59:59";
|
|
|
- return adminMapper.adminStatisticsInfo(TokenManager.getAdminId(),startTime,endTime);
|
|
|
+ return adminMapper.adminStatisticsInfo(aid,startTime,endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object lists() {
|
|
|
+ //获取当月的列表
|
|
|
+ String aid=TokenManager.getAdminId();
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ Days days = new Days();
|
|
|
+ List thisMonth = getThisMonth(days);
|
|
|
+ List<Integer> signList = adminMapper.thisMonthUserByType(thisMonth,days.firstDay,days.endDay, aid,TYPE_SIGN);
|
|
|
+ map.put("dates",thisMonth);
|
|
|
+ map.put("signList",signList);
|
|
|
+ List<Integer> privateList = adminMapper.thisMonthUserByType(thisMonth,days.firstDay,days.endDay, aid,TYPE_PRIVATE);
|
|
|
+ map.put("privateList",privateList);
|
|
|
+ List<Integer> channelList = adminMapper.thisMonthUserByType(thisMonth,days.firstDay,days.endDay, aid,TYPE_CHANNEL);
|
|
|
+ map.put("channelList",channelList);
|
|
|
+ //公出企业数
|
|
|
+ List<Integer> publicReleaseList = adminMapper.thisMonthPublicRelease(thisMonth,days.firstDay, aid);
|
|
|
+ map.put("publicReleaseList",publicReleaseList);
|
|
|
+ //跟进数
|
|
|
+ List<Integer> userFollowList = adminMapper.thisMonthUserFollow(thisMonth, days.firstDay, aid);
|
|
|
+ map.put("userFollowList",userFollowList);
|
|
|
+ //订单数
|
|
|
+ List<Integer> orderList = adminMapper.thisMonthOrderSum(thisMonth, days.firstDay, aid);
|
|
|
+ map.put("orderList",orderList);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List getThisMonth(Days days) {
|
|
|
+ //获取当月的第一天
|
|
|
+ Date date=new Date();
|
|
|
+
|
|
|
+ Calendar ca=Calendar.getInstance();
|
|
|
+ ca.setTime(date);
|
|
|
+ ca.add(Calendar.DAY_OF_MONTH,-30);
|
|
|
+ days.setFirstDay(DateUtils.formatDate(ca.getTime(),AFTConstants.YYYYMMDD));
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
+ for (int i=0;i<31;i++){
|
|
|
+ if (i==0){
|
|
|
+ Calendar newc=Calendar.getInstance();
|
|
|
+ newc.setTime(ca.getTime());
|
|
|
+ list.add(DateUtils.formatDate(newc.getTime(), AFTConstants.YYYYMMDD));
|
|
|
+ }else {
|
|
|
+ ca.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ if (ca.getTimeInMillis()<date.getTime()){
|
|
|
+ Calendar newc=Calendar.getInstance();
|
|
|
+ newc.setTime(ca.getTime());
|
|
|
+ days.setEndDay(DateUtils.formatDate(newc.getTime(), AFTConstants.YYYYMMDD));
|
|
|
+ list.add(days.getEndDay());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+
|
|
|
+ }
|
|
|
+ class Days{
|
|
|
+ private String firstDay;
|
|
|
+ private String endDay;
|
|
|
+
|
|
|
+ public String getFirstDay() {
|
|
|
+ return firstDay;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setFirstDay(String firstDay) {
|
|
|
+ this.firstDay = firstDay;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getEndDay() {
|
|
|
+ return endDay;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEndDay(String endDay) {
|
|
|
+ this.endDay = endDay;
|
|
|
+ }
|
|
|
}
|
|
|
}
|