diff --git a/epmet-auth/deploy/docker-compose-prod.yml b/epmet-auth/deploy/docker-compose-prod.yml index a73bb97f30..8c5773f2d5 100644 --- a/epmet-auth/deploy/docker-compose-prod.yml +++ b/epmet-auth/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.66 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.68 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-commons/epmet-commons-extapp-auth/pom.xml b/epmet-commons/epmet-commons-extapp-auth/pom.xml new file mode 100644 index 0000000000..de7060d57f --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + + com.epmet + epmet-commons + 2.0.0 + + + epmet-commons-extapp-auth + jar + + + 6.0.17.Final + 3.7 + 1.3.3 + 2.6 + 4.6.1 + 4.1.0 + 2.9.9 + 1.2.60 + 2.8.6 + 1.11.3 + 1.18.4 + + + + + org.springframework.boot + spring-boot-starter-web + provided + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + com.epmet + common-service-client + 2.0.0 + + + + + ${project.artifactId} + + + diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/ExternalAppRequestAuth.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/ExternalAppRequestAuth.java new file mode 100644 index 0000000000..c71ca89816 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/ExternalAppRequestAuth.java @@ -0,0 +1,32 @@ +/** + * Copyright 2018 人人开源 http://www.renren.io + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.epmet.commons.extappauth.annotation; + +import java.lang.annotation.*; + +/** + * 需要认证的外部请求 + * @Author wxz + * @Description + * @Date 2020/4/23 16:17 + **/ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ExternalAppRequestAuth { + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java new file mode 100644 index 0000000000..db9dc79da3 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java @@ -0,0 +1,99 @@ +package com.epmet.commons.extappauth.aspect; + + +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ExternalAppAuthFormDTO; +import com.epmet.dto.result.ExternalAppAuthResultDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Parameter; + +/** + * 外部应用请求认证切面 + */ +@Aspect +@Component +@Order(100) +public class ExternalAppRequestAuthAspect { + + private static Logger logger = LoggerFactory.getLogger(ExternalAppRequestAuthAspect.class); + + public static final String ACCESS_TOKEN_HEADER_KEY = "access_token"; + public static final String APP_ID_HEADER_KEY = "appId"; + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + /** + * 拦截加了ExternalRequestAuth注解的方法 + * + * @param point + * @throws Throwable + */ + @Before("@annotation(com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth)") + public void auth(JoinPoint point) throws Throwable { + HttpServletRequest request = getRequest(); + String token = request.getHeader(ACCESS_TOKEN_HEADER_KEY); + String appId = request.getHeader(APP_ID_HEADER_KEY); + + if (StringUtils.isAnyBlank(token, appId)) { + throw new RenException("请求头中的token和appId不能为空"); + } + + logger.info("外部应用请求认证拦截Aspect执行,appId:{}, token:{}", appId, token); + + ExternalAppAuthFormDTO form = new ExternalAppAuthFormDTO(); + form.setAppId(appId); + form.setToken(token); + Result result = commonServiceOpenFeignClient.externalAppAuth(form); + if (result == null) { + throw new RenException("调用external鉴权服务,返回null"); + } + if (!result.success()) { + throw new RenException(result.getInternalMsg()); + } + ExternalAppAuthResultDTO authResult = result.getData(); + if (!authResult.getSuccess()) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), + result.getData().getMessage()); + } + + + // header参数赋值 + MethodSignature signature = (MethodSignature) point.getSignature(); + Parameter[] parameters = signature.getMethod().getParameters(); + if (parameters != null && parameters.length != 0) { + for (int i = 0; i < parameters.length; i++) { + if (parameters[i].getType() == ExternalAppRequestParam.class) { + ExternalAppRequestParam requestParam = (ExternalAppRequestParam) point.getArgs()[i]; + requestParam.setAppId(appId); + requestParam.setCustomerId(authResult.getCustomerId()); + } + } + } + } + + public HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) requestAttributes; + return sra.getRequest(); + } + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/bean/ExternalAppRequestParam.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/bean/ExternalAppRequestParam.java new file mode 100644 index 0000000000..97ebf3c2c6 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/bean/ExternalAppRequestParam.java @@ -0,0 +1,12 @@ +package com.epmet.commons.extappauth.bean; + +import lombok.Data; + +/** + * 外部应用请求信息 + */ +@Data +public class ExternalAppRequestParam { + private String customerId; + private String appId; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ExternalRequestAuth.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ExternalRequestAuth.java new file mode 100644 index 0000000000..0cf03c25b7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ExternalRequestAuth.java @@ -0,0 +1,32 @@ +/** + * Copyright 2018 人人开源 http://www.renren.io + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.epmet.commons.tools.annotation; + +import java.lang.annotation.*; + +/** + * 需要认证的外部请求 + * @Author wxz + * @Description + * @Date 2020/4/23 16:17 + **/ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ExternalRequestAuth { + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ExternalRequestAuthAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ExternalRequestAuthAspect.java new file mode 100644 index 0000000000..fa9156f8f3 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ExternalRequestAuthAspect.java @@ -0,0 +1,35 @@ +package com.epmet.commons.tools.aspect; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 外部请求认证切面 + */ +@Aspect +@Component +public class ExternalRequestAuthAspect { + + /** + * 拦截加了ExternalRequestAuth注解的方法 + * @param point + * @throws Throwable + */ + @Before("@annotation(com.epmet.commons.tools.annotation.ExternalRequestAuth)") + public void before(JoinPoint point) throws Throwable { + System.out.println("切面执行了"); + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) requestAttributes; + HttpServletRequest request = sra.getRequest(); + String token = request.getHeader("token"); + System.out.println("token:" + token); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 50512fd6d6..cbb869e1d2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -101,6 +101,7 @@ public enum EpmetErrorCode { OPER_ADD_CUSTOMER_MANAGER_ERROR(8706, "新增客户管理员失败"), OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"), OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"), + OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用鉴权失败"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index bf7c8f1a83..a5be29eb58 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -288,4 +288,13 @@ public class RedisKeys { public static String getVolunteerSmsCodeKey(String phone) { return String.format(rootPrefix+"smscode:regvolunteer:%s",phone); } + + /** + * 外部应用的secret key + * @param appId + * @return + */ + public static String getExternalAppSecretKey(String appId) { + return String.format(rootPrefix+"externalapp:secret:%s",appId); + } } diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml index 3f25f5b1b5..d4b8e270b4 100644 --- a/epmet-commons/pom.xml +++ b/epmet-commons/pom.xml @@ -22,6 +22,7 @@ epmet-commons-tools-wx-ma epmet-commons-tools-wx-mp epmet-commons-service-call + epmet-commons-extapp-auth diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index 894f42b3d7..de78c36557 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.30 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.31 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/deploy/docker-compose-prod.yml b/epmet-gateway/deploy/docker-compose-prod.yml index 44d4d7b7b6..6b8419721d 100644 --- a/epmet-gateway/deploy/docker-compose-prod.yml +++ b/epmet-gateway/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.26 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.30 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index b21830e44e..3b7d156962 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.30 + 0.3.31 com.epmet epmet-cloud diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 7f96938c28..a859f98664 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -62,6 +62,11 @@ 0.3.1 + + com.epmet + epmet-commons-extapp-auth + 2.0.0 + diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java new file mode 100644 index 0000000000..a16df89c2a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java @@ -0,0 +1,19 @@ +package com.epmet.controller.test; + +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; +import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; +import com.epmet.commons.tools.utils.Result; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("test") +public class TestController { + + @ExternalAppRequestAuth + @RequestMapping("/test") + public Result test(ExternalAppRequestParam externalAppRequestParam, String ext) { + return new Result().ok("调用成功,客户信息:"+externalAppRequestParam); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppAuthFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppAuthFormDTO.java new file mode 100644 index 0000000000..2d6470db80 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppAuthFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class ExternalAppAuthFormDTO { + + /** + * 应用ID + */ + private String appId; + + /** + * token字符串 + */ + private String token; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppAuthResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppAuthResultDTO.java new file mode 100644 index 0000000000..ff7e76dd1e --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppAuthResultDTO.java @@ -0,0 +1,10 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class ExternalAppAuthResultDTO { + private Boolean success; + private String message; + private String customerId; +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index be5117fbf1..896dfde000 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -2,7 +2,9 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ExternalAppAuthFormDTO; import com.epmet.dto.form.WorkDayFormDTO; +import com.epmet.dto.result.ExternalAppAuthResultDTO; import com.epmet.dto.result.WorkDayResultDTO; import com.epmet.feign.fallback.EpmetCommonServiceOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -17,7 +19,8 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 10:28 */ -@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) +//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO @@ -28,4 +31,12 @@ public interface EpmetCommonServiceOpenFeignClient { **/ @PostMapping("commonservice/workday/detentiondays") Result> detentionDays(@RequestBody List formDTO); + + /** + * 外部应用认证接口 + * @param formDTO + * @return + */ + @PostMapping("/commonservice/externalapp/auth") + Result externalAppAuth(@RequestBody ExternalAppAuthFormDTO formDTO); } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java index 2a83a94bfc..555e502062 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java @@ -3,7 +3,9 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ExternalAppAuthFormDTO; import com.epmet.dto.form.WorkDayFormDTO; +import com.epmet.dto.result.ExternalAppAuthResultDTO; import com.epmet.dto.result.WorkDayResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import org.springframework.stereotype.Component; @@ -22,4 +24,9 @@ public class EpmetCommonServiceOpenFeignClientFallback implements EpmetCommonSer public Result> detentionDays(List formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "detentionDays", formDTO); } + + @Override + public Result externalAppAuth(ExternalAppAuthFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "externalAppAuth", formDTO); + } } diff --git a/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml index 548d86d6f9..5f9878a727 100644 --- a/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: common-service-server: container_name: common-service-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/common-service-server:0.3.5 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/common-service-server:0.3.9 ports: - "8103:8103" network_mode: host # 使用现有网络 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 2b13593563..f88889f6b4 100644 --- a/epmet-module/epmet-common-service/common-service-server/pom.xml +++ b/epmet-module/epmet-common-service/common-service-server/pom.xml @@ -58,6 +58,12 @@ feign-httpclient 10.3.0 + + + io.jsonwebtoken + jjwt + 0.7.0 + diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java new file mode 100644 index 0000000000..98fa8e9fc9 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java @@ -0,0 +1,39 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ExternalAppAuthFormDTO; +import com.epmet.dto.result.ExternalAppAuthResultDTO; +import com.epmet.service.ExternalAppAuthService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/externalapp") +public class ExternalAppController { + + private static Logger logger = LoggerFactory.getLogger(ExternalAppController.class); + + @Autowired + private ExternalAppAuthService externalAppAuthService; + + @PostMapping("/auth") + public Result auth(@RequestBody ExternalAppAuthFormDTO formDTO) { + String appId = formDTO.getAppId(); + String token = formDTO.getToken(); + if (StringUtils.isAnyBlank(token, appId)) { + throw new RenException("请求头中的token和appId不能为空"); + } + + logger.info("外部应用请求认证拦截Aspect。appId:{}, token:{}", appId, token); + ExternalAppAuthResultDTO auth = externalAppAuthService.auth(appId, token); + return new Result().ok(auth); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java new file mode 100644 index 0000000000..f07f428cfd --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ExternalAppEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 外部应用列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +@Mapper +public interface ExternalAppDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java new file mode 100644 index 0000000000..f56aa08cb0 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java @@ -0,0 +1,43 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ExternalAppSecretEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 外部应用秘钥列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +@Mapper +public interface ExternalAppSecretDao extends BaseDao { + + /** + * 查询app对应的秘钥 + * @param appId + * @return + */ + ExternalAppSecretEntity getSecretsByAppId(@Param("appId") String appId); + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppEntity.java new file mode 100644 index 0000000000..e4a4056108 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppEntity.java @@ -0,0 +1,51 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 外部应用列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("external_app") +public class ExternalAppEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * APP名字 + */ + private String appName; + + /** + * 客户ID + */ + private String customerId; + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppSecretEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppSecretEntity.java new file mode 100644 index 0000000000..0977e12264 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppSecretEntity.java @@ -0,0 +1,51 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 外部应用秘钥列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("external_app_secret") +public class ExternalAppSecretEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * APP ID + */ + private String appId; + + /** + * 秘钥 + */ + private String secret; + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java new file mode 100644 index 0000000000..aff79d5f72 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java @@ -0,0 +1,9 @@ +package com.epmet.service; + +import com.epmet.dto.result.ExternalAppAuthResultDTO; + +public interface ExternalAppAuthService { + + ExternalAppAuthResultDTO auth(String appId, String token); + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java new file mode 100644 index 0000000000..7f6be4bd5a --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java @@ -0,0 +1,28 @@ +/** + * 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.service; + + +/** + * 外部应用秘钥列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +public interface ExternalAppSecretService { +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java new file mode 100644 index 0000000000..5799ea0abb --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java @@ -0,0 +1,27 @@ +/** + * 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.service; + +/** + * 外部应用列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +public interface ExternalAppService { +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java new file mode 100644 index 0000000000..52b82011c9 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java @@ -0,0 +1,83 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dao.ExternalAppSecretDao; +import com.epmet.dto.result.ExternalAppAuthResultDTO; +import com.epmet.entity.ExternalAppSecretEntity; +import com.epmet.service.ExternalAppAuthService; +import com.epmet.utils.externalapp.ExtAppJwtTokenUtils; +import io.jsonwebtoken.Claims; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ExternalAppAuthServiceImpl implements ExternalAppAuthService { + + private static Logger logger = LoggerFactory.getLogger(ExternalAppAuthServiceImpl.class); + + @Autowired + private RedisUtils redisUtils; + + @Autowired + private ExtAppJwtTokenUtils jwtTokenUtils; + + @Autowired + private ExternalAppSecretDao externalAppSecretDao; + + @Override + public ExternalAppAuthResultDTO auth(String appId, String token) { + String secret; + if (StringUtils.isBlank(secret = getTokenByAppId(appId))) { + return fillAuthResult(false, String.format("根据AppId:%s没有找到对应的秘钥", appId), null); + } + + Claims claim; + try { + claim = jwtTokenUtils.getClaimByToken(token, secret); + } catch (Exception e) { + String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); + logger.error("解析token失败:{}", errorStackTrace); + return fillAuthResult(false, "解析token失败", null); + } + + String appIdIn = (String)claim.get("appId"); + String customerId = (String)claim.get("customerId"); + + if (!appId.equals(appIdIn)) { + logger.error("AppId不对应,token外部的:{}, token内部解析出来的:{}", appId, appIdIn); + return fillAuthResult(false, "Header中的AppId不匹配", null); + } + return fillAuthResult(true, "解析成功", customerId); + } + + /** + * 通过APP ID查询对应的秘钥 + * @param appId + * @return + */ + public String getTokenByAppId(String appId) { + String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); + if (StringUtils.isBlank(secret)) { + ExternalAppSecretEntity secretEntity = externalAppSecretDao.getSecretsByAppId(appId); + if (secretEntity == null) { + return null; + } + secret = secretEntity.getSecret(); + redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); + } + return secret; + } + + public ExternalAppAuthResultDTO fillAuthResult(Boolean result, String message, String customerId) { + ExternalAppAuthResultDTO authResult = new ExternalAppAuthResultDTO(); + authResult.setSuccess(result); + authResult.setMessage(message); + authResult.setCustomerId(customerId); + return authResult; + } +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java new file mode 100644 index 0000000000..567baf3fb2 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java @@ -0,0 +1,31 @@ +/** + * 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.service.impl; + +import com.epmet.service.ExternalAppSecretService; +import org.springframework.stereotype.Service; +/** + * 外部应用秘钥列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +@Service +public class ExternalAppSecretServiceImpl implements ExternalAppSecretService { + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java new file mode 100644 index 0000000000..1621e74e2d --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java @@ -0,0 +1,33 @@ +/** + * 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.service.impl; + +import com.epmet.service.ExternalAppService; +import org.springframework.stereotype.Service; + +/** + * 外部应用列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +@Service +public class ExternalAppServiceImpl implements ExternalAppService { + + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java new file mode 100644 index 0000000000..8ef9a4cde4 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

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

+ * 版权所有,侵权必究! + */ + +package com.epmet.utils.externalapp; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Jwt工具类 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class ExtAppJwtTokenUtils { + + private static final Logger logger = LoggerFactory.getLogger(ExtAppJwtTokenUtils.class); + + public Claims getClaimByToken(String token, String secret) { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } + + public Claims tryGetClaimByToken(String token, String secret) { + try { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } catch (Exception e) { + logger.debug("validate is token error, token = " + token, e); + return null; + } + } + + public String createToken(Map map, String secret) { + return Jwts.builder() + .setHeaderParam("typ", "JWT") + .setClaims(map) + .setIssuedAt(new Date()) +// .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate()) + .signWith(SignatureAlgorithm.HS512, secret) + .compact(); + } + +// /** +// * token是否过期 +// * +// * @return true:过期 +// */ +// public boolean isTokenExpired(Date expiration) { +// return expiration.before(new Date()); +// } + + public static void main(String[] args) { + genToken(); +// getClaim(); + } + + public static void genToken() { + HashMap claim = new HashMap<>(); + claim.put("appId", "1"); +// claim.put("customerId", "c1"); + + String abc = new ExtAppJwtTokenUtils().createToken(claim, "4a762660254c57996343f8ee42fbc0a6"); + System.out.println(abc); + } + + public static void getClaim() { + String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJhcHBJZCI6IjEiLCJjdXN0b21lcklkIjoiYzEiLCJpYXQiOjE1OTc3NDI2NTB9.09Vop0Nobg3LENAJoAZaCUKtgAjADAK48BS11ky3YdAp6h-cXYtGeqUxbgvE_4F6239rc7UE2fjxtEvMuWEJuA"; + + Claims claimByToken = new ExtAppJwtTokenUtils().getClaimByToken(token, "4a762660254c57996343f8ee42fbc0a6"); + System.out.println(claimByToken); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml new file mode 100644 index 0000000000..8662bc5f97 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml new file mode 100644 index 0000000000..e207a36013 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml index 6b4899de0d..4816a4cd30 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-job-server:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-job-server:0.3.25 ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml index b270804c81..360d07d79e 100644 --- a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-message-server: container_name: epmet-message-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-message-server:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-message-server:0.3.28 ports: - "8085:8085" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml index 0042119b7d..dbb2282e8e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-prod.yml @@ -3,7 +3,7 @@ services: epmet-oss-server: container_name: epmet-oss-server-prod # image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-test/epmet-oss-server:0.3.2 - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-oss-server:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-oss-server:0.3.25 ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml index 0edc524aed..8fff39478d 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-point-server: container_name: epmet-point-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-point-server:0.0.1 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-point-server:0.0.40 ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml index 75dee17ae1..d10eea3729 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.75 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-third-server:0.0.131 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml index 4f95fcde7b..7a5133aacd 100644 --- a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-access-server: container_name: gov-access-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-access-server:0.3.37 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-access-server:0.3.38 ports: - "8099:8099" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java index 438f105eab..b8ab2dbda6 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java @@ -1,5 +1,8 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.ExternalRequestAuth; +import com.epmet.service.TestService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -9,9 +12,14 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("test") public class TestController { + @Autowired + private TestService testService; + + @ExternalRequestAuth @GetMapping("test") public void test() { - System.out.println(666); + System.out.println("TestController -> test()"); + testService.test(); } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/TestService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/TestService.java new file mode 100644 index 0000000000..587690221c --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/TestService.java @@ -0,0 +1,7 @@ +package com.epmet.service; + +public interface TestService { + + void test(); + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/TestServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/TestServiceImpl.java new file mode 100644 index 0000000000..99ba370525 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/TestServiceImpl.java @@ -0,0 +1,16 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.annotation.ExternalRequestAuth; +import com.epmet.service.TestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TestServiceImpl implements TestService { + + @ExternalRequestAuth + @Override + public void test() { + System.out.println("TestService -> test()"); + } +} diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml index b4890333e8..006b14bdff 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-org-server:0.3.81 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-org-server:0.3.83 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml index 50ef5a1ac9..0c08e7e115 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.39 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-project-server:0.3.40 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml index 53fded4c6b..1821a379dc 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.60 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/gov-voice-server:0.3.68 ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml index a03b8a39cf..9a7eb3e9b9 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.58 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.66 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml index 5c2f1ccb37..df76d59dbc 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-customize-server: container_name: oper-customize-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-customize-server:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-customize-server:0.3.26 ports: - "8089:8089" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml index 1a09240300..a4aecd5dbf 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-group-server:0.3.62 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-group-server:0.3.66 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml index 72a6a10442..f88d341ad0 100644 --- a/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml +++ b/epmet-module/resi-group/resi-group-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-group-server: container_name: resi-group-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-group-server:0.3.64 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-group-server:0.3.66 ports: - "8095:8095" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml index 14f7d5d7da..cfac504f95 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-guide-server:0.3.17 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/resi-guide-server:0.3.20 ports: - "8091:8091" network_mode: host # 使用现有网络 diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 8555b3ea46..15c0789d48 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.117 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.118 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml index 30a65e8b8a..a9847b773c 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.102 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-user-server:0.3.118 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-test.yml b/epmet-user/epmet-user-server/deploy/docker-compose-test.yml index 51d4f40331..0dfe4fac89 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-test.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-server:0.3.116 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-server:0.3.118 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index c92fe0c949..0d7cdfa705 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.117 + 0.3.118 com.epmet epmet-user diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml index 5ec9e5a268..803fa40621 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml @@ -34,8 +34,6 @@ ur.DEL_FLAG = 0 AND ur.USER_ID = #{userId} - AND - ur.CUSTOMER_ID = #{customerId} AND( ur.GRID_ID = #{gridId} OR ur.GRID_ID = 'all' )