diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
index 695c187105..5221a30b33 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
@@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
+import com.alibaba.fastjson.JSON;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@@ -120,10 +121,10 @@ public class LoginServiceImpl implements LoginService {
wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode);
}
} catch (WxErrorException e) {
- log.error("->[getMaOpenId]::error[{}]", "解析微信code失败");
+ log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e);
}
if (null == wxMaJscode2SessionResult) {
- log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s]",app,wxCode));
+ log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult)));
throw new RenException("解析微信用户信息失败");
} else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) {
log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode));
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java
index 014722de84..d74e47dab6 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java
@@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums;
**/
public enum MqMethodPathEnum {
SEND_MSG("producerService/producer/sendMsg", "发送消息"),
+ GET_EVENT_LIST("/eventClass/getList", "获取时间类型列表"),
;
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
index 9f8ba52d28..6d91832472 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
@@ -27,7 +27,6 @@ import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
@@ -45,11 +44,10 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -188,7 +186,7 @@ public class HttpClientManager {
// HttpEntity reqEntity = MultipartEntityBuilder.create()
// .addPart("media", fileBody).build();
// httppost.setEntity(reqEntity);
- return execute(httppost);
+ return execute(httppost,false);
} catch (Exception e) {
log.error("send exception", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java
new file mode 100644
index 0000000000..e95e09002a
--- /dev/null
+++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java
@@ -0,0 +1,112 @@
+/**
+ * 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.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 事件表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-07-16
+ */
+@Data
+public class EventDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ private String id;
+
+ /**
+ * 消息网关事件类别ID 从消息网关获取事件类型Id
+ */
+ private String classId;
+
+ /**
+ * 消息网关APP_ID
+ */
+ private String appId;
+
+ /**
+ * 消息网关APP_NAME
+ */
+ private String appName;
+
+ /**
+ * 事件标识 与消息网关事件tag一致
+ */
+ private String eventCode;
+
+ /**
+ * 事件名称
+ */
+ private String eventName;
+
+ /**
+ * 事件说明
+ */
+ private String eventDesc;
+
+ /**
+ * 事件功能分组ID 来自oper_customize.customer_function表
+ */
+ private String functionId;
+
+ /**
+ * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值
+ */
+ private String isCommon;
+
+ /**
+ * 删除标识 0-否,1-是
+ */
+ private String delFlag;
+
+ /**
+ * 乐观锁 查询时添加版本号,新加的事件需要更新版本号
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/epmet-common-service/common-service-server/pom.xml b/epmet-module/epmet-common-service/common-service-server/pom.xml
index 2c694bbd67..69b16c5a01 100644
--- a/epmet-module/epmet-common-service/common-service-server/pom.xml
+++ b/epmet-module/epmet-common-service/common-service-server/pom.xml
@@ -116,6 +116,11 @@
false
+
+ https://epmet-dev.elinkservice.cn/estos/
+ producerService/producer/sendMsg
+ 202007161443499985fa2d397436d10356542134c8f008c48
+ 52d9d9b0e7d0eb5b8b81c205b579e07c
@@ -177,6 +182,11 @@
true
+
+ https://epmet-dev.elinkservice.cn/estos/
+ producerService/producer/sendMsg
+ 202007161443499985fa2d397436d10356542134c8f008c48
+ 52d9d9b0e7d0eb5b8b81c205b579e07c
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java
index a9a8108669..5fb6ca00bd 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java
@@ -17,15 +17,24 @@
package com.epmet.controller;
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.config.MqConfig;
+import com.epmet.commons.tools.enums.MqMethodPathEnum;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.form.EventFormDTO;
+import com.epmet.dto.result.EventDTO;
import com.epmet.service.EventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.util.Map;
+
/**
* 事件表
@@ -39,6 +48,24 @@ public class EventController {
@Autowired
private EventService eventService;
+ @Autowired
+ private MqConfig mqConfig;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = eventService.page(params);
+ return new Result>().ok(page);
+ }
+ @GetMapping("geteventclass")
+ public Result> getEventClass(@RequestParam Map params){
+ params.put("token", mqConfig.getToken());
+ params.put("appId", mqConfig.getAppId());
+ Result result = HttpClientManager.getInstance().sendPostByHttps(mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode()), JSON.toJSONString(params));
+ if (result.success()){
+ return new Result<>().ok(JSON.parseArray(result.getData()));
+ }
+ return new Result<>().error(EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
/**
* desc:添加事件,如果已存在则不作任何改动,直接返回成功
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java
index fc60058fc2..8e2c4cb635 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java
@@ -18,9 +18,13 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.EventFormDTO;
+import com.epmet.dto.result.EventDTO;
import com.epmet.entity.EventEntity;
+import java.util.Map;
+
/**
* 事件表
*
@@ -32,4 +36,6 @@ public interface EventService extends BaseService {
void addEvent(EventFormDTO formDTO);
void updateEvent(EventFormDTO formDTO);
+
+ PageData page(Map params);
}
\ No newline at end of file
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java
index 53f892b9a5..5fe736adb3 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java
@@ -17,15 +17,23 @@
package com.epmet.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.EventDao;
import com.epmet.dto.form.EventFormDTO;
+import com.epmet.dto.result.EventDTO;
import com.epmet.entity.EventEntity;
import com.epmet.service.EventService;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
+import java.util.Map;
+
/**
* 事件表
*
@@ -35,7 +43,14 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
public class EventServiceImpl extends BaseServiceImpl implements EventService {
-
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, EventDTO.class);
+ }
@Override
public void addEvent(EventFormDTO formDTO) {
EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class);
@@ -46,4 +61,12 @@ public class EventServiceImpl extends BaseServiceImpl imp
public void updateEvent(EventFormDTO formDTO) {
//baseDao.update(eventEntity);
}
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
}
\ No newline at end of file
diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml
index 146d5758dd..ec2f2c7a2b 100644
--- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml
@@ -117,4 +117,12 @@ ribbon:
#pageHelper分页插件
pagehelper:
helper-dialect: mysql
- reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
\ No newline at end of file
+ reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
+
+#亿联云消息网关
+elink:
+ mq:
+ appId: @elink.mq.appId@ #项目接入亿联云的应用Id
+ token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
+ host: @elink.mq.host@ #亿联云消息网关服务地址
+ sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径
\ No newline at end of file
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
index 8571a47da1..72477fb20d 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
@@ -118,17 +118,19 @@ pagehelper:
helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
-#亿联云消息网关
-elink:
- mq:
- appId: @elink.mq.appId@ #项目接入亿联云的应用Id
- token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
- host: @elink.mq.host@ #亿联云消息网关服务地址
- sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径
+
openapi:
scan:
server:
url: @openapi.scan.server.url@
method:
imgSyncScan: /imgSyncScan
- textSyncScan: /textSyncScan
\ No newline at end of file
+ textSyncScan: /textSyncScan
+
+#亿联云消息网关
+elink:
+ mq:
+ appId: @elink.mq.appId@ #项目接入亿联云的应用Id
+ token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
+ host: @elink.mq.host@ #亿联云消息网关服务地址
+ sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径
\ No newline at end of file