|
@@ -3,9 +3,7 @@ package com.redxun.knowledge.analysis.service;
|
|
|
|
|
|
import com.redxun.common.tool.StringUtils;
|
|
import com.redxun.common.tool.StringUtils;
|
|
import com.redxun.knowledge.album.mapper.AlbumCategoryMapper;
|
|
import com.redxun.knowledge.album.mapper.AlbumCategoryMapper;
|
|
-import com.redxun.knowledge.analysis.entity.vo.AlbumCategoryVo;
|
|
|
|
-import com.redxun.knowledge.analysis.entity.vo.AlbumCompanyVo;
|
|
|
|
-import com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo;
|
|
|
|
|
|
+import com.redxun.knowledge.analysis.entity.vo.*;
|
|
import com.redxun.knowledge.analysis.mapper.AnalysisAlbumMapper;
|
|
import com.redxun.knowledge.analysis.mapper.AnalysisAlbumMapper;
|
|
import com.redxun.knowledge.analysis.mapper.PvLogMapper;
|
|
import com.redxun.knowledge.analysis.mapper.PvLogMapper;
|
|
import com.redxun.knowledge.common.UserService;
|
|
import com.redxun.knowledge.common.UserService;
|
|
@@ -49,8 +47,26 @@ public class AnalysisAlbumServiceImpl {
|
|
* @param type
|
|
* @param type
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public Map<String, Object> albumAmount(String type) {
|
|
|
|
- return null;
|
|
|
|
|
|
+ public CreateCountTotal albumAmount(String type) {
|
|
|
|
+ CreateCountTotal createCountTotal = new CreateCountTotal();
|
|
|
|
+ List<CreateCountLabel> createCountLabel = new ArrayList<>();
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
|
+ if (("total").equals(type)) {
|
|
|
|
+ createCountLabel = analysisAlbumMapper.albumAmount(null, null);
|
|
|
|
+ } else if ("year".equals(type)) {
|
|
|
|
+ createCountLabel = analysisAlbumMapper.albumAmount(DateUtils.format(DateUtils.getFirstOfYear(year)),
|
|
|
|
+ DateUtils.format(DateUtils.getLastOfYear(year)));
|
|
|
|
+ } else if ("month".equals(type)) {
|
|
|
|
+ int month = calendar.get(Calendar.MONTH);
|
|
|
|
+ String firstOfMonth = DateUtils.getFirstOfMonth(year, month + 1, 15);
|
|
|
|
+ String lastOfMonth = DateUtils.getLastOfMonth(year, month + 1, 15);
|
|
|
|
+ createCountLabel = analysisAlbumMapper.albumAmount(firstOfMonth, lastOfMonth);
|
|
|
|
+ }
|
|
|
|
+ int sum = createCountLabel.stream().mapToInt(e -> Integer.parseInt(e.getValue())).sum();
|
|
|
|
+ createCountTotal.setTotal(sum);
|
|
|
|
+ createCountTotal.setLables(createCountLabel);
|
|
|
|
+ return createCountTotal;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|