14 changed files with 336 additions and 0 deletions
			
			
		| @ -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; | |||
| } | |||
| @ -0,0 +1,42 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * 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. | |||
|  * <p> | |||
|  * 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. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| 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<ScreenProjectDataEntity> { | |||
| 
 | |||
|     /** | |||
|      * 平阴三个街道上报统计数据正确性校验 | |||
|      * | |||
|      * @Param formDTO | |||
|      * @Return | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2022/3/7 15:44 | |||
|      */ | |||
|     void dataCheck(ExtractOriginFormDTO formDTO); | |||
| 
 | |||
| } | |||
| @ -0,0 +1,94 @@ | |||
| /** | |||
|  * Copyright 2018 人人开源 https://www.renren.io
 | |||
|  * <p> | |||
|  * 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. | |||
|  * <p> | |||
|  * 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. | |||
|  * <p> | |||
|  * You should have received a copy of the GNU General Public License | |||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | |||
|  */ | |||
| 
 | |||
| 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<ScreenProjectDataDao, ScreenProjectDataEntity> 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<DataCheckDTO> 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); | |||
|             } | |||
|         } | |||
|     } | |||
| } | |||
| @ -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()); | |||
|         } | |||
|     } | |||
| } | |||
					Loading…
					
					
				
		Reference in new issue