From e0495d5afd8ba8165cf35fef78e8569e8dca78f5 Mon Sep 17 00:00:00 2001 From: liuchuang Date: Tue, 31 Dec 2019 13:06:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9webservice=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- esua-epdc/epdc-module/epdc-webservice/pom.xml | 86 +++++++++++++++---- .../esua/epdc/WebserviceApplication.java | 2 + .../esua/epdc/config/ModuleConfigImpl.java | 26 ++++++ .../src/main/resources/application.yml | 39 ++++++++- .../mapper/GridPlatformHandleLogDao.xml | 33 +------ .../main/resources/mapper/InterfaceLogDao.xml | 16 ---- .../resources/mapper/ItemGridPlatformDao.xml | 16 +--- .../resources/mapper/ItemHandleProcessDao.xml | 16 ---- .../src/main/resources/registry.conf | 21 +++++ 9 files changed, 156 insertions(+), 99 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java create mode 100644 esua-epdc/epdc-module/epdc-webservice/src/main/resources/registry.conf diff --git a/esua-epdc/epdc-module/epdc-webservice/pom.xml b/esua-epdc/epdc-module/epdc-webservice/pom.xml index 041caa4eb..6db682ca9 100644 --- a/esua-epdc/epdc-module/epdc-webservice/pom.xml +++ b/esua-epdc/epdc-module/epdc-webservice/pom.xml @@ -1,5 +1,6 @@ - 4.0.0 @@ -17,17 +18,32 @@ + + com.esua.epdc + epdc-commons-tools + 1.0.0 + + + com.esua.epdc + epdc-commons-mybatis + 1.0.0 + org.springframework.boot spring-boot-starter-web - org.springframework.cloud - spring-cloud-starter-openfeign + org.springframework + spring-context-support + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery - org.springframework.cloud - spring-cloud-starter-netflix-hystrix + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} @@ -49,18 +65,6 @@ xstream ${xstream.version} - - com.esua.epdc - epdc-commons-tools - ${project.version} - compile - - - com.esua.epdc - epdc-commons-mybatis - ${project.version} - compile - @@ -85,6 +89,30 @@ + + ${project.basedir}/src/main/java + + + + true + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + @@ -97,11 +125,19 @@ 9075 dev + 2 + 47.104.224.45 + 6379 + elink@888 + epdc elink833066 + + false + 47.104.224.45:8848 @@ -110,11 +146,19 @@ 9075 test + 2 + 47.104.224.45 + 6379 + elink@888 + epdc elink833066 + + false + 47.104.224.45:8848 @@ -123,11 +167,19 @@ 9075 prod + 0 + 10.5.34.164 + 6379 + Elink@833066 + epdc Elink@833066 + + false + 10.5.34.164:8848 diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/WebserviceApplication.java b/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/WebserviceApplication.java index c150db4a4..f2eff5de6 100644 --- a/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/WebserviceApplication.java +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/WebserviceApplication.java @@ -10,6 +10,7 @@ package com.elink.esua.epdc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * webservice服务 @@ -18,6 +19,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @since 1.0.0 */ @SpringBootApplication +@EnableDiscoveryClient public class WebserviceApplication { public static void main(String[] args) { diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java b/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java new file mode 100644 index 000000000..06d0f66b4 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.config; + +import com.elink.esua.epdc.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息-新闻公告模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "webservice"; + } +} diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/application.yml b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/application.yml index 32b033478..e57062c70 100644 --- a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/application.yml +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/application.yml @@ -3,8 +3,9 @@ server: servlet: context-path: /webservice - spring: + main: + allow-bean-definition-overriding: true application: name: epdc-webservice #环境 dev|test|prod @@ -12,10 +13,24 @@ spring: active: @spring.profiles.active@ messages: encoding: UTF-8 - basename: i18n/messages_common + basename: i18n/messages,i18n/messages_common jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + timeout: 30s + port: @spring.redis.port@ + password: @spring.redis.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + register-enabled: @nacos.register-enabled@ + alibaba: + seata: + tx-service-group: epdc-webservice-fescar-service-group datasource: druid: driver-class-name: com.mysql.jdbc.Driver @@ -23,6 +38,24 @@ spring: username: @spring.datasource.druid.username@ password: @spring.datasource.druid.password@ +feign: + hystrix: + enabled: true + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + management: endpoints: web: @@ -33,7 +66,7 @@ management: show-details: ALWAYS mybatis-plus: - mapper-locations: classpath:/mapper/*.xml + mapper-locations: classpath:/mapper/**/*.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.elink.esua.epdc.entity global-config: diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/GridPlatformHandleLogDao.xml b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/GridPlatformHandleLogDao.xml index b63a046f3..7a009f45b 100644 --- a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/GridPlatformHandleLogDao.xml +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/GridPlatformHandleLogDao.xml @@ -3,39 +3,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + INSERT INTO esua_epdc_events.epdc_grid_platform_handle_log ( ID, ITEM_GRID_PLATFORM_ID, diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/InterfaceLogDao.xml b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/InterfaceLogDao.xml index eaf729e3e..8c7cb8403 100644 --- a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/InterfaceLogDao.xml +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/InterfaceLogDao.xml @@ -3,21 +3,5 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemGridPlatformDao.xml b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemGridPlatformDao.xml index 7d3396ae7..75a4da3f8 100644 --- a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemGridPlatformDao.xml +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemGridPlatformDao.xml @@ -3,22 +3,8 @@ - - - - - - - - - - - - - - - select * from epdc_item_grid_platform e where e.DEL_FLAG='0' and e.TASKID=#{taskNum} diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemHandleProcessDao.xml b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemHandleProcessDao.xml index 8c57740fc..c8902ab17 100644 --- a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemHandleProcessDao.xml +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemHandleProcessDao.xml @@ -3,22 +3,6 @@ - - - - - - - - - - - - - - - - INSERT INTO epdc_item_handle_process ( ID, ITEM_ID, STATE, HANDLE_ADVICE, OUT_HANDLE_ADVICE, HANDLER_DEPT, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DEL_FLAG ) VALUES (#{id}, #{itemId}, #{state}, #{handleAdvice}, #{outHandleAdvice}, #{handlerDept}, 0, '网格化平台', #{createdTime}, '网格化平台', #{updatedTime}, '0') diff --git a/esua-epdc/epdc-module/epdc-webservice/src/main/resources/registry.conf b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/registry.conf new file mode 100644 index 000000000..fb64abd71 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-webservice/src/main/resources/registry.conf @@ -0,0 +1,21 @@ +registry { + # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa + type = "nacos" + + nacos { + serverAddr = "@nacos.server-addr@" + namespace = "public" + cluster = "default" + } +} + +config { + # file、nacos 、apollo、zk、consul、etcd3 + type = "nacos" + + nacos { + serverAddr = "@nacos.server-addr@" + namespace = "public" + cluster = "default" + } +}