diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java index 4cde837bc9..bb663ac327 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java @@ -2,7 +2,6 @@ package com.epmet.commons.tools.utils; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.dto.form.DingTalkTextMsg; -import com.epmet.commons.tools.exception.EpmetErrorCode; import com.google.common.collect.Lists; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; @@ -13,13 +12,9 @@ import org.springframework.stereotype.Component; import javax.annotation.PreDestroy; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.URL; -import java.net.URLConnection; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.concurrent.ArrayBlockingQueue; /** @@ -104,7 +99,7 @@ public class DingdingMsgSender { } private Thread getThread() { - Thread sendMsgThread = new Thread("MsgSender-Thread") { + return new Thread("MsgSender-Thread") { @Override public void run() { while (running) { @@ -112,7 +107,6 @@ public class DingdingMsgSender { } } }; - return sendMsgThread; } @@ -139,77 +133,19 @@ public class DingdingMsgSender { try { String stringToSign = timestamp + "\n" + param.getSecret(); Mac mac = Mac.getInstance("HmacSHA256"); - mac.init(new SecretKeySpec(param.getSecret().getBytes("UTF-8"), "HmacSHA256")); - byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8")); + mac.init(new SecretKeySpec(param.getSecret().getBytes(StandardCharsets.UTF_8), "HmacSHA256")); + byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8)); String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8"); String url = param.getWebHook(); url = url.concat("×tamp=" + timestamp + "&sign=" + sign); String jsonStrParam = param.getMsgContent(); - result = this.sendPostByJSON(url, jsonStrParam); + result = HttpClientManager.getInstance().sendPostByJSON(url, jsonStrParam); } catch (Exception e) { logger.warn("sendPostByJSON error", e); } return result; } - /** - * 发送POST 请求 - * - * @param url 发送请求的 URL - * @param param 请求参数,JSON格式 - * @return - */ - public Result sendPostByJSON(String url, String param) throws IOException { - if (StringUtils.isEmpty(url) || StringUtils.isEmpty(param)) { - throw new IllegalArgumentException("参数不能为空"); - } - PrintWriter out = null; - BufferedReader in = null; - String result = ""; - try { - URL realUrl = new URL(url); - // 打开和URL之间的连接 - URLConnection conn = realUrl.openConnection(); - // 设置通用的请求属性 - conn.setRequestProperty("accept", "*/*"); - conn.setRequestProperty("Content-Type", "application/json"); - conn.setRequestProperty("connection", "Keep-Alive"); - conn.setRequestProperty("user-agent", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); - // 发送POST请求必须设置如下两行 - conn.setDoOutput(true); - conn.setDoInput(true); - // 获取URLConnection对象对应的输出流 - out = new PrintWriter(conn.getOutputStream()); - // 发送请求参数 - out.print(param); - // flush输出流的缓冲 - out.flush(); - // 定义BufferedReader输入流来读取URL的响应 - in = new BufferedReader( - new InputStreamReader(conn.getInputStream())); - String line; - while ((line = in.readLine()) != null) { - result += line; - } - } catch (Exception e) { - logger.warn("sendPostByJSON error", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); - } finally { - try { - if (out != null) { - out.close(); - } - if (in != null) { - in.close(); - } - } catch (IOException ex) { - } - - } - return new Result().ok(result); - } - public static void main(String[] args) { for (int i = 0; i < 50; i++) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml index 2a466396bd..a33bda9bed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml @@ -91,6 +91,7 @@ UNION ALL SELECT c.CUSTOMER_ID, + c.CUSTOMER_ID AS categoryOriginCustomerId, left(c.CATEGORY_CODE, 4) AS CATEGORY_CODE, '1' AS `LEVEL`, p.AGENCY_ID AS orgId, diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml index f9fc875f7e..5883c4ccec 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml @@ -5,8 +5,8 @@ + - @@ -36,20 +36,29 @@ and ro.ORG_ID = #{orgId} AND ro.ORG_READ = 'un_read' - ORDER BY re.CREATED_TIME AND ro.ORG_READ = 'read' AND re.`STATUS` = 'processing' - ORDER BY re.LATEST_OPERATED_TIME DESC AND ro.ORG_READ = 'read' AND re.`STATUS` = 'closed_case' - ORDER BY re.CLOSE_CASE_TIME DESC )t - LEFT JOIN resi_event_attachment rea ON (rea.RESI_EVENT_ID = t.eventId AND rea.DEL_FLAG = '0' AND rea.ATTACHMENT_TYPE = 'image' AND (rea.SORT = 3 OR rea.SORT = 1 OR rea.SORT = 2)) + LEFT JOIN resi_event_attachment rea + ON (rea.RESI_EVENT_ID = t.eventId) + where rea.DEL_FLAG = '0' + AND rea.ATTACHMENT_TYPE = 'image' + + ORDER BY t.eventTime,rea.sort asc + + + ORDER BY t.eventTime DESC,rea.sort asc + + + ORDER BY t.eventTime DESC,rea.sort asc +