|
|
@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.IssueConstant; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.dto.issue.IssueAgencyDTO; |
|
|
|
import com.epmet.dto.issue.IssueGridDTO; |
|
|
|
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.stats.*; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -33,6 +35,7 @@ import java.util.stream.Collectors; |
|
|
|
* @dscription |
|
|
|
* @date 2020/6/17 16:51 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
@Autowired |
|
|
@ -60,11 +63,17 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
int pageSize = 100; |
|
|
|
List<String> customerIdList = null; |
|
|
|
do { |
|
|
|
//获取当前日期前一天
|
|
|
|
Date date = DateUtils.getBeforeDay(new Date()); |
|
|
|
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); |
|
|
|
if (!CollectionUtils.isEmpty(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); |
|
|
@ -77,10 +86,7 @@ public class StatsIssueServiceImpl implements StatsIssueService { |
|
|
|
* @param customerId |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
@Async |
|
|
|
public void customerStats(String customerId) { |
|
|
|
//获取当前日期前一天
|
|
|
|
Date date = DateUtils.getBeforeDay(new Date()); |
|
|
|
private void customerStats(String customerId, Date date) { |
|
|
|
//机关议题日统计
|
|
|
|
saveIssueAgencyDaily(customerId, date); |
|
|
|
//机关议题月统计
|
|
|
|