Browse Source

议题统计修改

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
38b54b5189
  1. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.IssueConstant; import com.epmet.constant.IssueConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueAgencyDTO;
import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueGridDTO;
import com.epmet.dto.issue.IssueProjectDTO; import com.epmet.dto.issue.IssueProjectDTO;
@ -18,6 +19,7 @@ import com.epmet.service.StatsIssueService;
import com.epmet.service.project.ProjectService; import com.epmet.service.project.ProjectService;
import com.epmet.service.stats.*; import com.epmet.service.stats.*;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,6 +35,7 @@ import java.util.stream.Collectors;
* @dscription * @dscription
* @date 2020/6/17 16:51 * @date 2020/6/17 16:51
*/ */
@Slf4j
@Service @Service
public class StatsIssueServiceImpl implements StatsIssueService { public class StatsIssueServiceImpl implements StatsIssueService {
@Autowired @Autowired
@ -60,11 +63,17 @@ public class StatsIssueServiceImpl implements StatsIssueService {
int pageSize = 100; int pageSize = 100;
List<String> customerIdList = null; List<String> customerIdList = null;
do { do {
//获取当前日期前一天
Date date = DateUtils.getBeforeDay(new Date());
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) { if (!CollectionUtils.isEmpty(customerIdList)) {
for (String customerId : customerIdList) { for (String customerId : customerIdList) {
//遍历统计每一个客户数据 //遍历统计每一个客户数据
customerStats(customerId); try {
customerStats(customerId, date);
} catch(Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", DateUtils.format(date), e.getMessage()));
}
} }
} }
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
@ -77,10 +86,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
* @param customerId * @param customerId
* @return void * @return void
*/ */
@Async private void customerStats(String customerId, Date date) {
public void customerStats(String customerId) {
//获取当前日期前一天
Date date = DateUtils.getBeforeDay(new Date());
//机关议题日统计 //机关议题日统计
saveIssueAgencyDaily(customerId, date); saveIssueAgencyDaily(customerId, date);
//机关议题月统计 //机关议题月统计

Loading…
Cancel
Save