Browse Source
# Conflicts: # epmet-module/gov-issue/gov-issue-server/pom.xml # epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueController.java # epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java # epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java # epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java # epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java # epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml # epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/controller/IssueController.java # epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/feign/GovIssueFeignClient.java # epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/feign/fallback/GovIssueFeignClientFallBack.java # epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.javadev_shibei_match
197 changed files with 3075 additions and 1232 deletions
@ -0,0 +1,13 @@ |
|||||
|
|
||||
|
## 开发环境使用 |
||||
|
##### 本机调用开发环境 |
||||
|
``` |
||||
|
开发环境已经搭建好了 |
||||
|
在最新的代码中: |
||||
|
默认情况下,所有服务的pom.xml中应该启用dev环境,其他环境的active应该被注释掉(dev-local不再有用,可以删除) |
||||
|
根据dev环境中的配置,微服务会注册到nacos,并且调用其他微服务的时候会从nacos中取目标微服务的ip来发送请求 |
||||
|
因此,本地电脑不再需要启动所有服务,只需要启动要开发的服务即可;默认情况下,本机的微服务在调用目标微服务的时候,都是调用的服务器,不再请求本地。 |
||||
|
例如:有A、B2个服务,并且A调用B,如果我们只需要开发A服务,那本地只启动A服务即可,A调用B的时候,会调用服务器的B服务。 |
||||
|
如果需要开发AB2个服务,那么将A中的FeignClient的url属性指向localhost。 |
||||
|
PS:目前正在测试通过负载均衡器和本地环境变量实现动态修改目标服务IP,成功之后就不需要再修改FeignClient的url,配置一下环境变量即可,到时候具体说 |
||||
|
``` |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-admin-server: |
||||
|
container_name: epmet-admin-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-admin-server:0.3.6 |
||||
|
ports: |
||||
|
- "8082:8082" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-auth-server: |
||||
|
container_name: epmet-auth-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.7 |
||||
|
ports: |
||||
|
- "8081:8081" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>epmet-commons</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>epmet-commons-service-call</artifactId> |
||||
|
<version>0.3.1</version> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- 替换Feign原生httpclient --> |
||||
|
<dependency> |
||||
|
<groupId>io.github.openfeign</groupId> |
||||
|
<artifactId>feign-httpclient</artifactId> |
||||
|
<version>10.3.0</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
</project> |
||||
@ -0,0 +1,94 @@ |
|||||
|
package com.epmet.loadbalancer; |
||||
|
|
||||
|
import com.netflix.client.config.IClientConfig; |
||||
|
import com.netflix.loadbalancer.ILoadBalancer; |
||||
|
import com.netflix.loadbalancer.Server; |
||||
|
import com.netflix.loadbalancer.ZoneAvoidanceRule; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.core.env.Environment; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Epmet负载均衡算法规则类。当前支持读取环境变量,将请求重定向到指定的HOST:PORT |
||||
|
* |
||||
|
* @RibbonClient(name = "MS-PROXY", configuration = EpmetRequestLoadBalancerRule.class) |
||||
|
* |
||||
|
* @Bean |
||||
|
* @LoadBalanced |
||||
|
* public RestTemplate getRestTemplate() { |
||||
|
* return new RestTemplate(); |
||||
|
* } |
||||
|
* |
||||
|
* @Bean |
||||
|
* public IRule getMyLoadBalancerRule(Environment env) { |
||||
|
* EpmetRequestLoadBalancerRule rule = new EpmetRequestLoadBalancerRule(); |
||||
|
* rule.setEnv(env); |
||||
|
* return rule; |
||||
|
* } |
||||
|
* |
||||
|
*/ |
||||
|
public class EpmetRequestLoadBalancerRule extends ZoneAvoidanceRule { |
||||
|
|
||||
|
private static Logger logger = LoggerFactory.getLogger(EpmetRequestLoadBalancerRule.class); |
||||
|
|
||||
|
private Environment env; |
||||
|
|
||||
|
public EpmetRequestLoadBalancerRule() { |
||||
|
} |
||||
|
|
||||
|
public void setEnv(Environment env) { |
||||
|
this.env = env; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void initWithNiwsConfig(IClientConfig iClientConfig) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 此处会取环境变量中"测试服务器"的值, |
||||
|
* @param key |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Server choose(Object key) { |
||||
|
ILoadBalancer loadBalancer = getLoadBalancer(); |
||||
|
List<Server> servers = loadBalancer.getReachableServers(); |
||||
|
if (CollectionUtils.isEmpty(servers)) { |
||||
|
logger.error("自定义负载均衡器:ReachableServers列表为空"); |
||||
|
return super.choose(key); |
||||
|
} |
||||
|
Server server = servers.get(0); |
||||
|
String appName = server.getMetaInfo().getAppName(); |
||||
|
String serviceName = appName.split("@@")[1]; |
||||
|
String hostEnvKey = getHostEnvKey(serviceName); |
||||
|
String portEnvKey = getPortEnvKey(serviceName); |
||||
|
String epmetGovOrgHost = env.getProperty(hostEnvKey); |
||||
|
String epmetGovOrgPort = env.getProperty(portEnvKey); |
||||
|
if (StringUtils.isAnyBlank(epmetGovOrgHost, epmetGovOrgPort)) { |
||||
|
// 没有配置,走父类均衡器
|
||||
|
return super.choose(key); |
||||
|
} |
||||
|
|
||||
|
server.setHost(epmetGovOrgHost); |
||||
|
server.setPort(Integer.valueOf(epmetGovOrgPort)); |
||||
|
return server; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取host环境变量Key |
||||
|
* @param serviceName |
||||
|
* @return |
||||
|
*/ |
||||
|
public String getHostEnvKey(String serviceName) { |
||||
|
return serviceName.replace("-", "_").concat("_HOST").toUpperCase(); |
||||
|
} |
||||
|
|
||||
|
public String getPortEnvKey(String serviceName) { |
||||
|
return serviceName.replace("-", "_").concat("_PORT").toUpperCase(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,150 @@ |
|||||
|
package com.epmet.commons.tools.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.exception.ErrorCode; |
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.exception.ValidateException; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.dao.DuplicateKeyException; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
/** |
||||
|
* 日志切面 |
||||
|
* @Author wxz |
||||
|
* @Description |
||||
|
**/ |
||||
|
public abstract class BaseRequestLogAspect { |
||||
|
|
||||
|
private static final Logger log = LoggerFactory.getLogger(BaseRequestLogAspect.class); |
||||
|
|
||||
|
/** |
||||
|
* 由子类实现该方法。并且调用proceed(ProceedingJoinPoint point, HttpServletRequest request)方法 |
||||
|
* @param point |
||||
|
* @return |
||||
|
* @throws Throwable |
||||
|
*/ |
||||
|
public abstract Object proceed(ProceedingJoinPoint point) throws Throwable; |
||||
|
|
||||
|
/** |
||||
|
* 处理日志,异常 |
||||
|
* @param point |
||||
|
* @param request |
||||
|
* @return |
||||
|
* @throws Throwable |
||||
|
*/ |
||||
|
protected Object proceed(ProceedingJoinPoint point, HttpServletRequest request) throws Throwable { |
||||
|
String requestURI = request.getRequestURI(); |
||||
|
|
||||
|
long id = Thread.currentThread().getId(); |
||||
|
Result result; |
||||
|
Exception exception = null; |
||||
|
try { |
||||
|
Object[] args = point.getArgs(); |
||||
|
log.info(">>>>>>>>请求信息>>>>>>>>:线程ID:{},url:{},请求参数:{}", id, requestURI, objectsToString(args)); |
||||
|
result = (Result)point.proceed(); |
||||
|
log.info("<<<<<<<<正常响应<<<<<<<<:线程ID:{},响应数据:{}", id, result.toString()); |
||||
|
} catch (RenException e) { |
||||
|
exception = e; |
||||
|
result = handleRenException(e); |
||||
|
} catch (ValidateException e) { |
||||
|
exception = e; |
||||
|
result = handleValidateException(e); |
||||
|
} catch (DuplicateKeyException e) { |
||||
|
exception = e; |
||||
|
result = handlerDuplicateKeyException(e); |
||||
|
} catch (RuntimeException re) { |
||||
|
exception = re; |
||||
|
result = handlerRuntimeException(re); |
||||
|
} catch (Exception e) { |
||||
|
exception = e; |
||||
|
result = handlerException(e); |
||||
|
} finally { |
||||
|
if (exception != null) { |
||||
|
log.info("<<<<<<<<异常响应<<<<<<<<:线程ID:{},异常信息:{}", id, ExceptionUtils.getErrorStackTrace(exception)); |
||||
|
} |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理Exception |
||||
|
* @param e |
||||
|
* @return |
||||
|
*/ |
||||
|
private Result handlerException(Exception e) { |
||||
|
Result result=new Result().error(); |
||||
|
result.setData(e.getMessage()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理Key重复异常 |
||||
|
* @return |
||||
|
*/ |
||||
|
private Result handlerDuplicateKeyException(DuplicateKeyException ex) { |
||||
|
return new Result().error(ErrorCode.DB_RECORD_EXISTS); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理运行时异常 |
||||
|
* @return |
||||
|
*/ |
||||
|
private Result handlerRuntimeException(RuntimeException ex) { |
||||
|
Result result=new Result().error(); |
||||
|
result.setData(ex.getMessage()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理校验异常 |
||||
|
* @param ex |
||||
|
* @return |
||||
|
*/ |
||||
|
private Result handleValidateException(ValidateException ex) { |
||||
|
Result result=new Result(); |
||||
|
result.setCode(ex.getCode()); |
||||
|
result.setMsg(ex.getMsg()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理RenException |
||||
|
* @param e |
||||
|
* @return |
||||
|
*/ |
||||
|
private Result handleRenException(RenException e) { |
||||
|
if (e.getCode() > 8000) { |
||||
|
Result result=new Result().error(e.getCode()); |
||||
|
result.setData(e.getMsg()); |
||||
|
return result; |
||||
|
} |
||||
|
Result result=new Result().error(); |
||||
|
result.setData(e.getMsg()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将请求对象转换为String |
||||
|
* @param args |
||||
|
* @return |
||||
|
*/ |
||||
|
private String objectsToString(Object[] args) { |
||||
|
if (args == null) { |
||||
|
return null; |
||||
|
} else { |
||||
|
StringBuilder builder = new StringBuilder("["); |
||||
|
for (Object object : args) { |
||||
|
if (object != null) { |
||||
|
builder.append(object.toString()); |
||||
|
builder.append(","); |
||||
|
} |
||||
|
} |
||||
|
builder.append("]"); |
||||
|
return builder.toString(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-gateway-server: |
||||
|
container_name: epmet-gateway-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-gateway:0.3.7 |
||||
|
ports: |
||||
|
- "8080:8080" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-activiti-server: |
||||
|
container_name: epmet-activiti-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-test/epmet-activiti-server:0.3.0 |
||||
|
ports: |
||||
|
- "8086:8086" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
container_name: common-service-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-test/common-service-server:0.3.1 |
||||
|
common-service-server: |
||||
|
ports: |
||||
|
- "8103:8103" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-job-server: |
||||
|
container_name: epmet-job-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-test/epmet-job-server:0.3.1 |
||||
|
ports: |
||||
|
- "8084:8084" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-message-server: |
||||
|
container_name: epmet-message-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-message-server:0.3.5 |
||||
|
ports: |
||||
|
- "8085:8085" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
epmet-oss-server: |
||||
|
container_name: epmet-oss-server-test |
||||
|
# 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-release/epmet-oss-server:0.3.7 |
||||
|
ports: |
||||
|
- "8083:8083" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
gov-access-server: |
||||
|
container_name: gov-access-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-access-server:0.3.10 |
||||
|
ports: |
||||
|
- "8099:8099" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
gov-grid-server: |
||||
|
container_name: gov-grid-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-grid-server:0.3.16 |
||||
|
ports: |
||||
|
- "8097:8097" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 300M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 议题人员选择(查询当前组织的上两级组织、当前组织和所有下级组织)--接口入参 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProcessorListFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 4859779755214502427L; |
||||
|
|
||||
|
@NotBlank(message = "议题Id不能为空") |
||||
|
private String issueId; |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/5/13 16:14 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ShiftProjectListFromDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -1132054225167531812L; |
||||
|
/** |
||||
|
* 网格Id |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
/** |
||||
|
* 当前页 |
||||
|
*/ |
||||
|
private Integer pageNo; |
||||
|
/** |
||||
|
* 每页记录数 |
||||
|
*/ |
||||
|
private Integer pageSize; |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/5/13 16:16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ShiftProjectListResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -8616067919204282328L; |
||||
|
/** |
||||
|
* 议题Id |
||||
|
*/ |
||||
|
private String issueId; |
||||
|
/** |
||||
|
* 议题标题 |
||||
|
*/ |
||||
|
private String issueTitle; |
||||
|
/** |
||||
|
* 转成项目时间 |
||||
|
*/ |
||||
|
private Long shiftedTime; |
||||
|
/** |
||||
|
* 项目状态 |
||||
|
*/ |
||||
|
private String projectStatus; |
||||
|
/** |
||||
|
* 结案说明 |
||||
|
*/ |
||||
|
private String publicReply; |
||||
|
/** |
||||
|
* 当前处理部门 |
||||
|
*/ |
||||
|
private List<String> departmentNameList; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
gov-issue-server: |
||||
|
container_name: gov-issue-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-issue-server:0.3.1 |
||||
|
ports: |
||||
|
- "8101:8101" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.ShiftProjectsFromDTO; |
||||
|
import com.epmet.dto.result.ShiftProjectResultDTO; |
||||
|
import com.epmet.feign.fallback.GovProjectFeignClientFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/5/14 13:26 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.GOV_PROJECT_SERVER, fallback = GovProjectFeignClientFallBack.class) |
||||
|
public interface GovProjectFeignClient { |
||||
|
/** |
||||
|
* 根据议题查询项目 |
||||
|
* @author zhaoqifeng |
||||
|
* @date 2020/5/13 16:55 |
||||
|
* @param fromDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.ProjectDTO>> |
||||
|
*/ |
||||
|
@PostMapping("/gov/project/project/shiftprojectlist") |
||||
|
Result<List<ShiftProjectResultDTO>> getProjectByIssue(@RequestBody ShiftProjectsFromDTO fromDTO); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
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.ShiftProjectsFromDTO; |
||||
|
import com.epmet.dto.result.ShiftProjectResultDTO; |
||||
|
import com.epmet.feign.GovProjectFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2020/5/14 13:26 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class GovProjectFeignClientFallBack implements GovProjectFeignClient { |
||||
|
@Override |
||||
|
public Result<List<ShiftProjectResultDTO>> getProjectByIssue(ShiftProjectsFromDTO fromDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "getProjectByIssue", fromDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
gov-mine-server: |
||||
|
container_name: gov-mine-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-mine-server:0.3.11 |
||||
|
ports: |
||||
|
- "8098:8098" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 250M |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.epmet.aspect; |
||||
|
|
||||
|
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@Order(0) |
||||
|
public class RequestLogAspect extends BaseRequestLogAspect { |
||||
|
|
||||
|
@Override |
||||
|
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
||||
|
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
||||
|
return super.proceed(point, getRequest()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取Request对象 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
private HttpServletRequest getRequest() { |
||||
|
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
||||
|
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
||||
|
return sra.getRequest(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.config; |
||||
|
|
||||
|
import com.epmet.loadbalancer.EpmetRequestLoadBalancerRule; |
||||
|
import com.netflix.loadbalancer.IRule; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.core.env.Environment; |
||||
|
|
||||
|
@Configuration |
||||
|
public class LoadBalancerConfig { |
||||
|
|
||||
|
//@Bean
|
||||
|
//@LoadBalanced
|
||||
|
//public RestTemplate getRestTemplate() {
|
||||
|
// return new RestTemplate();
|
||||
|
//}
|
||||
|
|
||||
|
/** |
||||
|
* 自定义负载均衡算法bean |
||||
|
* @return |
||||
|
*/ |
||||
|
//@Bean
|
||||
|
//public IRule getMyLoadBalancerRule(Environment env) {
|
||||
|
// EpmetRequestLoadBalancerRule rule = new EpmetRequestLoadBalancerRule();
|
||||
|
// rule.setEnv(env);
|
||||
|
// return rule;
|
||||
|
//}
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 组织信息 |
||||
|
* |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AgencyResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 机关组织Id |
||||
|
*/ |
||||
|
private String agencyId = ""; |
||||
|
/** |
||||
|
* 机关组织名称 |
||||
|
*/ |
||||
|
private String agencyName = ""; |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 下级组织信息(迭代对象) |
||||
|
* |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AgencySubResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 机关组织Id |
||||
|
*/ |
||||
|
private String agencyId = ""; |
||||
|
/** |
||||
|
* 机关组织名称 |
||||
|
*/ |
||||
|
private String agencyName = ""; |
||||
|
/** |
||||
|
* 下级组织信息 |
||||
|
*/ |
||||
|
private List<AgencySubResultDTO> subAgencyList; |
||||
|
/** |
||||
|
* 当前组织的所有上级组织Id |
||||
|
*/ |
||||
|
private String pids = ""; |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 项目人员选择(查询当前组织的上两级组织和所有下级组织)--接口返参 |
||||
|
* |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProcessorListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 当前组织的上两级组织信息 |
||||
|
*/ |
||||
|
private List<AgencyResultDTO> parentAgencyList; |
||||
|
/** |
||||
|
* 当前组织信息 |
||||
|
*/ |
||||
|
private AgencyResultDTO agencyList; |
||||
|
/** |
||||
|
* 下级组织信息(迭代) |
||||
|
*/ |
||||
|
private List<AgencySubResultDTO> subAgencyList; |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
version: "3.7" |
||||
|
services: |
||||
|
gov-org-server: |
||||
|
container_name: gov-org-server-test |
||||
|
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-org-server:0.3.33 |
||||
|
ports: |
||||
|
- "8092:8092" |
||||
|
network_mode: host # 使用现有网络 |
||||
|
volumes: |
||||
|
- "/opt/epmet-cloud-logs/test:/logs" |
||||
|
environment: |
||||
|
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
||||
|
deploy: |
||||
|
resources: |
||||
|
limits: |
||||
|
cpus: '0.1' |
||||
|
memory: 300M |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue