Browse Source

Merge remote-tracking branch 'remotes/origin/dev_data_stats' into dev

master
jianjun 5 years ago
parent
commit
8a0a3f161c
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  2. 15
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/form/IssueJobFromDTO.java
  3. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  4. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java
  6. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java
  7. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml
  9. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsIssueService.java
  10. 9
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  11. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsIssueTask.java

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -471,4 +471,14 @@ public class DateUtils {
}
return result;
}
public static Date getLastDayOfMonth(Date date) {
Calendar cale = Calendar.getInstance();
cale.setTime(date);
cale.add(Calendar.MONTH, 0);
cale.set(Calendar.DAY_OF_MONTH, 1);
cale.add(Calendar.MONTH, 1);
cale.set(Calendar.DAY_OF_MONTH, 0);
return cale.getTime();
}
}

15
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/form/IssueJobFromDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.issue.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/1 15:25
*/
@Data
public class IssueJobFromDTO implements Serializable {
private String date;
}

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -2,9 +2,11 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.issue.form.IssueJobFromDTO;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
@ -118,6 +120,16 @@ public interface DataStatisticalOpenFeignClient {
@PostMapping("/data/stats/statsissue/issuestats")
Result agencyGridIssueStats();
/**
* 指定日期统计
* @author zhaoqifeng
* @date 2020/7/1 15:29
* @param fromDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/data/stats/statsissue/issuestatsofdate")
Result agencyGridIssueStatsOfDate(@RequestBody IssueJobFromDTO fromDTO);
/**
* @Description 数据统计-项目-机关日月统计
* @Author sun

6
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -3,6 +3,7 @@ package com.epmet.feign.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.issue.form.IssueJobFromDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.stereotype.Component;
@ -118,6 +119,11 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "agencyGridIssueStats");
}
@Override
public Result agencyGridIssueStatsOfDate(IssueJobFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "agencyGridIssueStatsOfDate");
}
/**
* @Description 数据统计-项目-机关日月统计
* @Author sun

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -51,6 +51,6 @@ public interface ProjectConstant {
/**
* 统计数据执行失败日志前缀
*/
String STATS_FAILED_PREFIX = "统计数据执行失败:%s 客户ID:%s,统计日期:%s,异常信息:%s";
String STATS_FAILED_PREFIX = "统计数据执行失败:%s 客户ID:%s,统计日期:%s";
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsIssueController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.issue.form.IssueJobFromDTO;
import com.epmet.service.StatsIssueService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,14 +36,17 @@ public class StatsIssueController {
statsIssueService.agencyGridIssueStats();
return new Result();
}
@Data
private static class StatsDate implements Serializable {
private static final long serialVersionUID = 149723067011918433L;
private String date;
}
@PostMapping("date")
public Result agencyGridIssueStatsOfDate(@RequestBody StatsDate statsDate) {
statsIssueService.agencyGridIssueStatsOfDate(DateUtils.parse(statsDate.getDate(), DateUtils.DATE_PATTERN));
/**
* 指定日期统计
* @author zhaoqifeng
* @date 2020/7/1 15:29
* @param fromDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("issuestatsofdate")
public Result agencyGridIssueStatsOfDate(@RequestBody IssueJobFromDTO fromDTO) {
statsIssueService.agencyGridIssueStatsOfDate(DateUtils.parse(fromDTO.getDate(), DateUtils.DATE_PATTERN));
return new Result();
}
}

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

@ -108,14 +108,15 @@ public class StatsIssueServiceImpl implements StatsIssueService {
* @return void
*/
private void customerStats(String customerId, Date date) {
Date lastDate = DateUtils.getLastDayOfMonth(date);
//机关议题日统计
saveIssueAgencyDaily(customerId, date);
//机关议题月统计
saveIssueAgencyMonthly(customerId, date);
saveIssueAgencyMonthly(customerId, lastDate);
//网格议题日统计
saveIssueGridDaily(customerId, date);
//网格议题月统计
saveIssueGridMonthly(customerId, date);
saveIssueGridMonthly(customerId, lastDate);
}
@Override

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml

@ -86,7 +86,7 @@
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND DATE(CREATED_TIME) = #{date}
AND DATE(CREATED_TIME) <![CDATA[ <= ]]> #{date}
GROUP BY
ORG_ID, GRID_ID, ISSUE_STATUS
</select>

2
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsIssueService.java

@ -15,5 +15,5 @@ public interface StatsIssueService {
* @param
* @return com.epmet.commons.tools.utils.Result
*/
Result agencyGridIssueStats();
Result agencyGridIssueStats(String params);
}

9
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -1,8 +1,10 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.issue.form.IssueJobFromDTO;
import com.epmet.service.StatsIssueService;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,7 +19,12 @@ public class StatsIssueServiceImpl implements StatsIssueService {
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public Result agencyGridIssueStats() {
public Result agencyGridIssueStats(String params) {
if (StringUtils.isNotBlank(params)) {
IssueJobFromDTO dto = new IssueJobFromDTO();
dto.setDate(params);
return dataStatisticalOpenFeignClient.agencyGridIssueStatsOfDate(dto);
}
return dataStatisticalOpenFeignClient.agencyGridIssueStats();
}
}

2
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsIssueTask.java

@ -22,7 +22,7 @@ public class StatsIssueTask implements ITask {
@Override
public void run(String params) {
log.debug("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params);
Result result = statsIssueService.agencyGridIssueStats();
Result result = statsIssueService.agencyGridIssueStats(params);
if (result.success()){
log.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行成功");
}else {

Loading…
Cancel
Save