0a4919adb0ebac51f3e387c34f50efba79e1e217.svn-base
2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.cms.service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.service.BaseService;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.modules.cms.dao.ArticleDao;
import com.thinkgem.jeesite.modules.cms.entity.Category;
import com.thinkgem.jeesite.modules.cms.entity.Site;
import com.thinkgem.jeesite.modules.sys.entity.Office;
/**
* 统计Service
* @author ThinkGem
* @version 2013-05-21
*/
@Service
@Transactional(readOnly = true)
public class StatsService extends BaseService {
@Autowired
private ArticleDao articleDao;
public List<Category> article(Map<String, Object> paramMap) {
Category category = new Category();
Site site = new Site();
site.setId(Site.getCurrentSiteId());
category.setSite(site);
Date beginDate = DateUtils.parseDate(paramMap.get("beginDate"));
if (beginDate == null){
beginDate = DateUtils.setDays(new Date(), 1);
paramMap.put("beginDate", DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
}
category.setBeginDate(beginDate);
Date endDate = DateUtils.parseDate(paramMap.get("endDate"));
if (endDate == null){
endDate = DateUtils.addDays(DateUtils.addMonths(beginDate, 1), -1);
paramMap.put("endDate", DateUtils.formatDate(endDate, "yyyy-MM-dd"));
}
category.setEndDate(endDate);
String categoryId = (String)paramMap.get("categoryId");
if (categoryId != null && !("".equals(categoryId))){
category.setId(categoryId);
category.setParentIds(categoryId);
}
String officeId = (String)(paramMap.get("officeId"));
Office office = new Office();
if (officeId != null && !("".equals(officeId))){
office.setId(officeId);
category.setOffice(office);
}else{
category.setOffice(office);
}
List<Category> list = articleDao.findStats(category);
return list;
}
}