Browse Source

平阴项目统计数据校验

dev
zhaoqifeng 4 years ago
parent
commit
75ca49624c
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java
  2. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/DataCheckDTO.java
  3. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ProjectDataServiceImpl.java
  4. 43
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

3
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;
}

6
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;
/**
* 日期
*/

31
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<ScreenProjectDataDao
}
}
List<DataCheckDTO> 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);
}
}
}
}

43
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -395,16 +395,28 @@
</select>
<select id="getCheckResult" resultType="com.epmet.dto.screen.result.DataCheckDTO">
SELECT
CUSTOMER_ID AS customerId,
CUSTOMER_ID,
AGENCY_ID AS agencyId,
CASE
CUSTOMER_ID
WHEN '46c55cb862d6d5e6d05d2ab61a1cc07e' THEN
AGENCY_ID
WHEN '1258587398679126017' THEN
'榆山'
WHEN '44876154d10d7cb7affd92000f84f833' THEN
WHEN '1215437824174608386' THEN
'锦水'
WHEN '6f203e30de1a65aab7e69c058826cd80' THEN
'平阴' ELSE '孔村'
END AS customerName,
WHEN '1234085031077498881' THEN
'孔村'
WHEN 'f8d4a6af53b3fc5991ab1434b6ad39b8' THEN
'东阿镇'
WHEN 'f279343a67653fc20d8333c6b2e4dbee' THEN
'孝直镇'
WHEN 'ea78a8e9252f567517c4a8d60250c714' THEN
'安城镇'
WHEN 'c259c3b1d27f960b9b379fb2886179ba' THEN
'洪范池镇'
WHEN 'd20a7488eedf5bcfd5231c3771bc0e3d' THEN
'玫瑰镇'
ELSE '未知'
END AS agencyName,
PROJECT_TOTAL AS reportCount,
DATE_ID,
(
@ -414,21 +426,22 @@
screen_project_data
WHERE
1 = 1
AND customer_id = a.CUSTOMER_ID
AND CUSTOMER_ID = a.CUSTOMER_ID
AND ALL_PARENT_IDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
AND DEL_FLAG = '0'
AND DATE_FORMAT( PROJECT_CREATE_TIME, '%Y%m%d' ) &lt;= DATE_ID
GROUP BY
CUSTOMER_ID
AGENCY_ID
ORDER BY
CUSTOMER_ID
AGENCY_ID
) AS count
FROM
epmet_data_statistical.fact_agency_project_daily a
WHERE
1 = 1
AND del_flag = '0'
AND customer_id IN ( '2fe0065f70ca0e23ce4c26fca5f1d933', '44876154d10d7cb7affd92000f84f833', '46c55cb862d6d5e6d05d2ab61a1cc07e' )
AND AGENCY_ID IN ( '1234085031077498881', '1215437824174608386', '1258587398679126017' )
AND customer_id IN ( '2fe0065f70ca0e23ce4c26fca5f1d933', '44876154d10d7cb7affd92000f84f833', '46c55cb862d6d5e6d05d2ab61a1cc07e', '6f203e30de1a65aab7e69c058826cd80' )
AND AGENCY_ID IN ( '1234085031077498881', '1215437824174608386', '1258587398679126017', 'c259c3b1d27f960b9b379fb2886179ba', 'd20a7488eedf5bcfd5231c3771bc0e3d', 'ea78a8e9252f567517c4a8d60250c714', 'f279343a67653fc20d8333c6b2e4dbee', 'f8d4a6af53b3fc5991ab1434b6ad39b8' )
<if test='null != dateId and "" != dateId'>
AND DATE_ID = #{dateId}
</if>
@ -436,13 +449,13 @@
AND DATE_ID BETWEEN #{startDate} AND #{endDate}
</if>
GROUP BY
CUSTOMER_ID,
AGENCY_ID,
DATE_ID
HAVING
1 = 1
AND reportCount != count
ORDER BY
CUSTOMER_ID,
DATE_ID DESC
AGENCY_ID,
DATE_ID DESC
</select>
</mapper>

Loading…
Cancel
Save