diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java index 08c5708cf6..eb09819172 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java @@ -12,4 +12,7 @@ public interface DingDingRobotConstant { */ String V3_ROBOT_URL="https://oapi.dingtalk.com/robot/send?access_token=75e9ab857536f3018baa09009646876edbd263d07521a1a22eedfc3852623614"; String V3_ROBOT_SECRET="SECdc8d3fb6780faa919f38fd43783f76d111255036c3b5bdcbc086dff023ee84d5"; + + String SELF_ROBOT_URL="https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; + String SELF_ROBOT_SECRET=null; } 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 index 005d23246f..a19dfbc1a2 100644 --- 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 @@ -16,10 +16,14 @@ public class DataCheckDTO implements Serializable { * 客户ID */ private String customerId; + /** + * 客户ID + */ + private String agencyId; /** * 客户名 */ - private String customerName; + private String agencyName; /** * 日期 */ 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 index 6d98d21115..1b1a5d5755 100644 --- 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 @@ -18,12 +18,14 @@ package com.epmet.service.evaluationindex.screen.impl; import com.alibaba.fastjson.JSON; +import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.request.OapiRobotSendRequest; +import com.dingtalk.api.response.OapiRobotSendResponse; 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; @@ -31,6 +33,7 @@ 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 com.taobao.api.ApiException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -69,25 +72,31 @@ public class ProjectDataServiceImpl extends BaseServiceImpl list = baseDao.getCheckResult(formDTO); + //群机器人 + String url = DingDingRobotConstant.SELF_ROBOT_URL; + DingTalkClient client = new DefaultDingTalkClient(url); 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"+ + markdown.setTitle("数据异常"); + markdown.setText("数据异常:" + "\n\n" + + "> 所属客户ID:" + dto.getCustomerId() + "\n\n" + + "> 组织ID:" + dto.getAgencyId() + "\n\n" + + "> 组织名称:" + dto.getAgencyName() + "\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); + try { + OapiRobotSendResponse execute = client.execute(request); + log.info("=====通知结果===>" + JSON.toJSONString(execute)); + } catch (ApiException e) { + log.error("sendDingMarkDownMsg exception", e); + } } } } 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 fd9d29f527..95c907ce97 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 @@ -395,16 +395,28 @@