Browse Source

统一抽取添加定时任务

dev_shibei_match
jianjun 5 years ago
parent
commit
37b4b4c6bb
  1. 30
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/FactExtractOpenFeignClient.java
  2. 184
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/FactExtractOpenFeignClientFallBack.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginController.java
  4. 23
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/FactOriginExtractTaskService.java
  5. 30
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/FactOriginExtractTaskServiceImpl.java
  6. 48
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/FactOriginExtractTask.java

30
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/FactExtractOpenFeignClient.java

@ -0,0 +1,30 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractFormDTO;
import com.epmet.feign.impl.FactExtractOpenFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* desc: 数据抽取 对外feign client
*
* @return:
* @date: 2020/6/22 17:39
* @author: jianjun liu
*/
@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = FactExtractOpenFeignClientFallBack.class)
public interface FactExtractOpenFeignClient {
/**
* desc: 抽取业务数据到统计库 小组 话题 议题 项目
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@PostMapping(value = "data/stats/factorigin/extractall")
Result extractall(@RequestBody(required = false) ExtractFormDTO formDTO);
}

184
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/FactExtractOpenFeignClientFallBack.java

@ -0,0 +1,184 @@
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.StatsFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.issue.form.IssueJobFromDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.stereotype.Component;
/**
* desc:
*
* @return:
* @date: 2020/6/22 9:38
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
@Component
public class FactExtractOpenFeignClientFallBack implements DataStatisticalOpenFeignClient {
/**
* desc: 统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result articleSummaryDailyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "articleSummaryDailyStatsjob", formDTO);
}
/**
* desc: 定时任务 统计文章总数及在线文章总数 包含 机关 部门 网格
*
* @return:
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result tagUsedDailyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagUsedDailyStatsjob", formDTO);
}
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result tagUsedMonthlyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagUsedMonthlyStatsjob", formDTO);
}
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result tagUsedQuarterlyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagUsedQuarterlyStatsjob", formDTO);
}
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result tagViewedDailyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagViewedDailyStatsjob", formDTO);
}
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result tagViewedMonthlyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagViewedMonthlyStatsjob", formDTO);
}
/**
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @param formDTO
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result tagViewedQuarterlyStatsjob(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "tagViewedQuarterlyStatsjob", formDTO);
}
@Override
public Result groupGridDaily(GroupStatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupGridDaily", formDTO);
}
@Override
public Result groupAgencyDaily(GroupStatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAgencyDaily", formDTO);
}
@Override
public Result groupAgencyMonthly(GroupStatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAgencyMonthly", formDTO);
}
@Override
public Result agencyGridIssueStats() {
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
*/
@Override
public Result agencyProjectStats(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "agencyProjectStats", formDTO);
}
/**
* @Description 数据统计-项目-网格日月统计
* @Author sun
*/
@Override
public Result gridProjectStats(StatsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "gridProjectStats", formDTO);
}
@Override
public Result initAllDims() {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "initAllDims");
}
/**
* @param
* @return
* @Description 执行用户统计
* @author wangc
* @date 2020.06.29 09:26
**/
@Override
public Result execUserStatistical(String date) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execUserStatistical", date);
}
/**
* @param
* @return
* @Description 执行话题统计
* @author wangc
* @date 2020.06.29 09:27
**/
@Override
public Result execTopicStatistical(String date) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "execTopicStatistical", date);
}
@Override
public Result getPartyInfo(CustomerIdAndDateIdFormDTO customerIdAndDateIdFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getPartyInfo", customerIdAndDateIdFormDTO);
}
@Override
public Result processPenddingCalculate() {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "processPenddingCalculate");
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginController.java

@ -37,9 +37,9 @@ public class FactOriginController {
private GroupExtractService groupExtractService;
/**
* desc:
* desc:抽取业务数据到统计库
*
* @param extractFormDTO
* @param extractFormDTO 默认统计前一天
* @return
*/
@PostMapping("extractall")

23
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/FactOriginExtractTaskService.java

@ -0,0 +1,23 @@
package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractFormDTO;
/**
* desc: 业务数据抽取到统计库服务类
*
* @return:
* @date: 2020/6/22 10:24
* @author: jianjun liu
*/
public interface FactOriginExtractTaskService {
/**
* desc: 抽取 小组 话题 议题 项目数据到统计库
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
Result factOriginExtractJob(ExtractFormDTO formDTO);
}

30
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/FactOriginExtractTaskServiceImpl.java

@ -0,0 +1,30 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractFormDTO;
import com.epmet.feign.FactExtractOpenFeignClient;
import com.epmet.service.FactOriginExtractTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* desc数据统计 任务服务类
*/
@Service
public class FactOriginExtractTaskServiceImpl implements FactOriginExtractTaskService {
@Autowired
private FactExtractOpenFeignClient factExtractOpenFeignClient;
/**
* desc: 抽取 小组 话题 议题 项目数据到统计库
*
* @param formDTO
* @date: 2020/6/22 9:09
* @author: jianjun liu
*/
@Override
public Result factOriginExtractJob(ExtractFormDTO formDTO) {
return factExtractOpenFeignClient.extractall(formDTO);
}
}

48
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/FactOriginExtractTask.java

@ -0,0 +1,48 @@
package com.epmet.task;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.extract.form.ExtractFormDTO;
import com.epmet.service.FactOriginExtractTaskService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc:数据抽取定时任务 定时任务
*/
@Component("factOriginExtractTask")
public class FactOriginExtractTask implements ITask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private FactOriginExtractTaskService factOriginExtractTaskService;
@Override
public void run(String params) {
logger.info("FactOriginExtractTask定时任务正在执行,参数为:{}", params);
ExtractFormDTO formDTO = new ExtractFormDTO();
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, ExtractFormDTO.class);
}
Result result = factOriginExtractTaskService.factOriginExtractJob(formDTO);
if (result.success()) {
logger.info("FactOriginExtractTask定时任务执行成功");
} else {
logger.error("FactOriginExtractTask定时任务执行失败:" + result.getMsg());
}
}
public static void main(String[] args) {
StatsFormDTO formDTO = new StatsFormDTO();
String params = "{'date':'\"2020-06-20','customerId':'123'}";
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, StatsFormDTO.class);
}
System.out.println(JSON.toJSONString(formDTO));
}
}
Loading…
Cancel
Save