diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java index 1ae7002dc4..543b3865b3 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java @@ -12,6 +12,7 @@ public interface DataSourceConstant { String RESI_GROUP = "resiGroup"; String EPMET_USER = "epmetuser"; String EVALUATION_INDEX = "evaluationIndex"; + String EVALUATION_INDEX_READ = "evaluationIndexRead"; String PARTY_MEMBER = "partyMember"; String EPMET_HEART="epmetHeart"; String EPMET_POINT = "epmetPoint"; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/DataCheckDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/DataCheckDTO.java new file mode 100644 index 0000000000..005d23246f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/DataCheckDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.screen.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/3/7 15:56 + */ +@Data +public class DataCheckDTO implements Serializable { + private static final long serialVersionUID = -5836567756526658928L; + /** + * 客户ID + */ + private String customerId; + /** + * 客户名 + */ + private String customerName; + /** + * 日期 + */ + private String dateId; + /** + * 上报项目数 + */ + private String reportCount; + /** + * 项目数 + */ + private String count; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index c729dea005..595977d64c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -365,4 +365,7 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/ic/user/category-analysis-daily") Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO); + + @PostMapping("/data/stats/screenextract/data_check") + Result dataCheck(@RequestBody ExtractOriginFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index a65ced89f8..43e2a3445c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -346,4 +346,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result statUserCategoryDaily(IcUserCategoryAnalysisDailyFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statUserCategoryDaily", formDTO); } + + @Override + public Result dataCheck(ExtractOriginFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "dataCheck", formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index d142521099..de703b486f 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -242,6 +242,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + root + root + @@ -374,6 +380,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + root + root + @@ -506,6 +518,12 @@ epmet elink@833066 + + + + epmet + elink@833066 + @@ -634,6 +652,12 @@ epmet_evaluation_index_user EpmEt-db-UsEr + + + + epmet_cloud_viewer + EpmEtclOUdvIEwEr@w + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java index 756ecc2d8a..466774ecc5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; +import com.epmet.service.evaluationindex.screen.ProjectDataService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; import java.util.concurrent.ExecutorService; /** @@ -26,6 +28,8 @@ public class ScreenExtractDailyController { private ScreenExtractService screenExtractService; @Autowired private ExecutorService executorService; + @Resource + private ProjectDataService projectDataService; /** * @param extractOriginFormDTO @@ -59,4 +63,19 @@ public class ScreenExtractDailyController { return new Result(); } + + /** + * 平阴三个街道上报统计数据正确性校验 + * + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/3/7 15:43 + */ + @PostMapping("data_check") + public Result dataCheck(@RequestBody ExtractOriginFormDTO formDTO) { + projectDataService.dataCheck(formDTO); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index 701348e39a..bf82610651 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -18,7 +18,9 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.result.DataCheckDTO; import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -111,4 +113,13 @@ public interface ScreenProjectDataDao extends BaseDao { @Param("customerId") String customerId, @Param("subCount")Integer subCount, @Param("allAgencies") List allAgencies); + /** + * 获取数据比对结果 + * + * @Param formDTO + * @Return {@link List< DataCheckDTO>} + * @Author zhaoqifeng + * @Date 2022/3/7 16:00 + */ + List getCheckResult(ExtractOriginFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ProjectDataService.java new file mode 100644 index 0000000000..ac348125ab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ProjectDataService.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; + +/** + * 中央区-项目数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-02-23 + */ +public interface ProjectDataService extends BaseService { + + /** + * 平阴三个街道上报统计数据正确性校验 + * + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/3/7 15:44 + */ + void dataCheck(ExtractOriginFormDTO formDTO); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ProjectDataServiceImpl.java new file mode 100644 index 0000000000..6d98d21115 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ProjectDataServiceImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.evaluationindex.screen.impl; + +import com.alibaba.fastjson.JSON; +import com.dingtalk.api.request.OapiRobotSendRequest; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.DingDingRobotConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.result.DataCheckDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; +import com.epmet.service.evaluationindex.screen.ProjectDataService; +import com.epmet.util.DimIdGenerator; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 中央区-项目数据 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-02-23 + */ +@Slf4j +@Service +@DataSource(value = DataSourceConstant.EVALUATION_INDEX_READ) +public class ProjectDataServiceImpl extends BaseServiceImpl implements ProjectDataService { + + /** + * 平阴三个街道上报统计数据正确性校验 + * + * @param formDTO + * @Param formDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/3/7 15:44 + */ + @Override + public void dataCheck(ExtractOriginFormDTO formDTO) { + if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { + formDTO.setDateId(null); + } else { + if (StringUtils.isBlank(formDTO.getDateId())){ + formDTO.setDateId(DimIdGenerator.getDateDimId(DateUtils.addDateDays(new Date(), -1))); + } + } + List list = baseDao.getCheckResult(formDTO); + if (CollectionUtils.isNotEmpty(list)) { + //发送钉钉消息 + //EPMETV3群机器人 + String secret = DingDingRobotConstant.V3_ROBOT_SECRET; + String url = DingDingRobotConstant.V3_ROBOT_URL; + + for (DataCheckDTO dto : list) { + OapiRobotSendRequest request = new OapiRobotSendRequest(); + request.setMsgtype("markdown"); + OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); + markdown.setTitle("平阴三个街道项目日统计数据上报比对结果"); + markdown.setText("客户ID:" + dto.getCustomerId() +"\n\n"+ + "> 客户名称:" + dto.getCustomerName() +"\n\n"+ + "> 日期:" + dto.getDateId() + "\n\n"+ + "> 上报项目数:" + dto.getReportCount() + "\n\n"+ + "> 表中项目数:" + dto.getCount()); + request.setMarkdown(markdown); + log.info("robot需要发送的内容为:"+markdown.getText()); + HttpClientManager.getInstance().sendDingMsg(JSON.toJSONString(request),url,secret); + } + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index 8374e06c4f..b159668ec9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -193,6 +193,11 @@ dynamic: url: @datasource.druid.operCustomize.url@ username: @datasource.druid.operCustomize.username@ password: @datasource.druid.operCustomize.password@ + evaluationIndexRead: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.evaluationIndex1.url@ + username: @datasource.druid.evaluationIndex1.username@ + password: @datasource.druid.evaluationIndex1.password@ thread: # 线程池配置 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 7a192fa70d..fd9d29f527 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -393,4 +393,56 @@ GROUP BY categoryCode + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java index 25a4244301..90716be4c4 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java @@ -19,4 +19,7 @@ public interface ScreenExtractTaskService { * @Date 2020/9/28 10:49 **/ Result screenExtractMonthly(String params); + + + Result dateCheckDaily(String params); } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java index 698a3ec7b3..dea86b3965 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java @@ -47,4 +47,13 @@ public class ScreenExtractTaskServiceImpl implements ScreenExtractTaskService { } return dataStatisticalOpenFeignClient.extractMonthlyAll(extractScreenFormDTO); } + + @Override + public Result dateCheckDaily(String params) { + ExtractOriginFormDTO extractOriginFormDTO = new ExtractOriginFormDTO(); + if (StringUtils.isNotBlank(params)) { + extractOriginFormDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); + } + return dataStatisticalOpenFeignClient.dataCheck(extractOriginFormDTO); + } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataCheckDailyTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataCheckDailyTask.java new file mode 100644 index 0000000000..e94d4c68c7 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataCheckDailyTask.java @@ -0,0 +1,33 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.ScreenExtractTaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + +/** + * @author Administrator + */ +@Component("dataCheckDailyTask") +public class DataCheckDailyTask implements ITask{ + + @Autowired + private ScreenExtractTaskService screenExtractTaskService; + + private Logger logger = LoggerFactory.getLogger(getClass()); + + + @Override + public void run(String params) { + logger.info("DataCheckDailyTask定时任务正在执行,参数为:{}", params); + Result result = screenExtractTaskService.dateCheckDaily(params); + if (result.success()){ + logger.info("DataCheckDailyTask定时任务执行成功"); + }else { + logger.error("DataCheckDailyTask定时任务执行失败:" + result.getMsg()); + } + } +}