commit
1a39a51aaa
@ -0,0 +1,38 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
@ -0,0 +1,147 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.ykMap</groupId>
|
||||||
|
<artifactId>ykMap</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<spring-boot.version>2.7.6</spring-boot.version>
|
||||||
|
<druid.version>1.2.23</druid.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringBoot 拦截器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--postgresql-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>42.6.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里数据库连接池 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>${druid.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>8.2.0</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||||
|
<version>4.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.25</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>2.0.41</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>public</id>
|
||||||
|
<name>aliyun nexus</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!--打包成jar包时的名字-->
|
||||||
|
<finalName>ykMap</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.ykMap.YkMapApplication</mainClass>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>repackage</id>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ykMap;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wu
|
||||||
|
* @since 2024/2/26 10:24
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.ykMap.mapper")
|
||||||
|
@EnableAsync
|
||||||
|
@EnableScheduling
|
||||||
|
public class YkMapApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(YkMapApplication.class, args);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.ykMap.base.aspectj;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.ykMap.base.annotation.DataSource;
|
||||||
|
import com.ykMap.base.datasource.DynamicDataSourceContextHolder;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.core.annotation.AnnotationUtils;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Order(1)
|
||||||
|
@Component
|
||||||
|
public class DataSourceAspect {
|
||||||
|
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
@Pointcut("@annotation(com.ykMap.base.annotation.DataSource)" + "|| @within(com.ykMap.base.annotation.DataSource)")
|
||||||
|
public void dsPointCut() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Around("dsPointCut()")
|
||||||
|
public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||||
|
DataSource dataSource = getDataSource(point);
|
||||||
|
|
||||||
|
if (BeanUtil.isNotEmpty(dataSource)) {
|
||||||
|
DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return point.proceed();
|
||||||
|
} finally {
|
||||||
|
// 销毁数据源 在执行方法之后
|
||||||
|
DynamicDataSourceContextHolder.clearDataSourceType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需要切换的数据源
|
||||||
|
*/
|
||||||
|
public DataSource getDataSource(ProceedingJoinPoint point) {
|
||||||
|
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||||
|
DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class);
|
||||||
|
if (Objects.nonNull(dataSource)) {
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.ykMap.base.config;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||||
|
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 程序注解配置
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
// 表示通过aop框架暴露该代理对象,AopContext能够访问
|
||||||
|
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||||
|
// 指定要扫描的Mapper类的包的路径
|
||||||
|
@MapperScan("com.ykMap.**.mapper")
|
||||||
|
public class ApplicationConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 时区配置
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
|
||||||
|
{
|
||||||
|
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
package com.ykMap.base.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||||
|
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||||
|
import com.alibaba.druid.util.Utils;
|
||||||
|
import com.ykMap.base.config.properties.DruidProperties;
|
||||||
|
import com.ykMap.base.datasource.DynamicDataSource;
|
||||||
|
import com.ykMap.base.enums.DataSourceType;
|
||||||
|
import com.ykMap.utils.spring.SpringUtils;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
import javax.servlet.Filter;
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid 配置多数据源
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class DruidConfig {
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties("spring.datasource.druid.master")
|
||||||
|
public DataSource masterDataSource(DruidProperties druidProperties) {
|
||||||
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
|
return druidProperties.dataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties("spring.datasource.druid.slave")
|
||||||
|
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
||||||
|
public DataSource slaveDataSource(DruidProperties druidProperties) {
|
||||||
|
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
||||||
|
return druidProperties.dataSource(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "dynamicDataSource")
|
||||||
|
@Primary
|
||||||
|
public DynamicDataSource dataSource(DataSource masterDataSource) {
|
||||||
|
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||||
|
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||||
|
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
||||||
|
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置数据源
|
||||||
|
*
|
||||||
|
* @param targetDataSources 备选数据源集合
|
||||||
|
* @param sourceName 数据源名称
|
||||||
|
* @param beanName bean名称
|
||||||
|
*/
|
||||||
|
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName) {
|
||||||
|
try {
|
||||||
|
DataSource dataSource = SpringUtils.getBean(beanName);
|
||||||
|
targetDataSources.put(sourceName, dataSource);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去除监控页面底部的广告
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
|
||||||
|
public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) {
|
||||||
|
// 获取web监控页面的参数
|
||||||
|
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||||
|
// 提取common.js的配置路径
|
||||||
|
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
||||||
|
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||||
|
final String filePath = "support/http/resources/js/common.js";
|
||||||
|
// 创建filter进行过滤
|
||||||
|
Filter filter = new Filter() {
|
||||||
|
@Override
|
||||||
|
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
|
throws IOException, ServletException {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
// 重置缓冲区,响应头不会被重置
|
||||||
|
response.resetBuffer();
|
||||||
|
// 获取common.js
|
||||||
|
String text = Utils.readFromResource(filePath);
|
||||||
|
// 正则替换banner, 除去底部的广告信息
|
||||||
|
text = text.replaceAll("<a.*?banner\"></a><br/>", "");
|
||||||
|
text = text.replaceAll("powered.*?shrek.wang</a>", "");
|
||||||
|
response.getWriter().write(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||||
|
registrationBean.setFilter(filter);
|
||||||
|
registrationBean.addUrlPatterns(commonJsPattern);
|
||||||
|
return registrationBean;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.ykMap.base.controller;
|
||||||
|
|
||||||
|
import com.ykMap.base.domain.AjaxResult;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web层通用数据处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class BaseController {
|
||||||
|
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功
|
||||||
|
*/
|
||||||
|
public AjaxResult success() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*/
|
||||||
|
public AjaxResult error() {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*/
|
||||||
|
public AjaxResult success(String message) {
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*/
|
||||||
|
public AjaxResult success(Object data) {
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*/
|
||||||
|
public AjaxResult error(String message) {
|
||||||
|
return AjaxResult.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回警告消息
|
||||||
|
*/
|
||||||
|
public AjaxResult warn(String message) {
|
||||||
|
return AjaxResult.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param rows 影响行数
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(int rows) {
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param result 结果
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(boolean result) {
|
||||||
|
return result ? success() : error();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.ykMap.base.datasource;
|
||||||
|
|
||||||
|
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态数据源
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||||
|
public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources) {
|
||||||
|
super.setDefaultTargetDataSource(defaultTargetDataSource);
|
||||||
|
super.setTargetDataSources(targetDataSources);
|
||||||
|
super.afterPropertiesSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object determineCurrentLookupKey() {
|
||||||
|
return DynamicDataSourceContextHolder.getDataSourceType();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.ykMap.base.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public enum DataSourceType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 主库
|
||||||
|
*/
|
||||||
|
MASTER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从库
|
||||||
|
*/
|
||||||
|
SLAVE
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
package com.ykMap.controller;
|
||||||
|
|
||||||
|
import com.ykMap.base.annotation.DataSource;
|
||||||
|
import com.ykMap.base.controller.BaseController;
|
||||||
|
import com.ykMap.base.domain.AjaxResult;
|
||||||
|
import com.ykMap.base.enums.DataSourceType;
|
||||||
|
import com.ykMap.entity.response.EquipResponse;
|
||||||
|
import com.ykMap.entity.response.GetCarIdInfoResponse;
|
||||||
|
import com.ykMap.entity.response.ItemsResponse;
|
||||||
|
import com.ykMap.entity.response.LineTemplateResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityCountResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityResponse;
|
||||||
|
import com.ykMap.entity.response.SelectLineInfoResponse;
|
||||||
|
import com.ykMap.entity.response.UserInfoResponse;
|
||||||
|
import com.ykMap.service.LineService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏线路接口
|
||||||
|
*
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 10:40
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ykmap/line")
|
||||||
|
@Api(tags = "大屏线路接口")
|
||||||
|
public class LineController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LineService lineService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "根据车辆id查询线路,装备,人员,标的物", response = GetCarIdInfoResponse.class)
|
||||||
|
@GetMapping("/getCarIdInfo/{id}")
|
||||||
|
public AjaxResult getCarIdInfo(@PathVariable String id) {
|
||||||
|
return success(lineService.getCarIdInfo(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "任务明细弹窗线路信息", response = SelectLineInfoResponse.class)
|
||||||
|
@GetMapping("/selectLineInfo/{id}")
|
||||||
|
public AjaxResult selectLineInfo(@PathVariable String id) {
|
||||||
|
return success(lineService.selectLineInfo(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "任务明细弹窗装备信息", response = EquipResponse.class)
|
||||||
|
@GetMapping("/equip/{id}")
|
||||||
|
public AjaxResult equip(@PathVariable String id) {
|
||||||
|
return success(lineService.equip(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "任务明细弹窗人员信息", response = UserInfoResponse.class)
|
||||||
|
@GetMapping("/userInfo/{id}")
|
||||||
|
public AjaxResult userInfo(@PathVariable String id) {
|
||||||
|
return success(lineService.userInfo(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "任务明细弹窗标的物信息", response = ItemsResponse.class)
|
||||||
|
@GetMapping("/items/{id}")
|
||||||
|
public AjaxResult items(@PathVariable String id) {
|
||||||
|
return success(lineService.items(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "线路模板具体信息", response = LineTemplateResponse.class)
|
||||||
|
@GetMapping("/lineTemplate")
|
||||||
|
@DataSource(value = DataSourceType.SLAVE)
|
||||||
|
public AjaxResult lineTemplate(String area) {
|
||||||
|
return success(lineService.lineTemplate(area));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "业务已覆盖省份清单", response = SearchCityResponse.class)
|
||||||
|
@GetMapping("/searchCity")
|
||||||
|
@DataSource(value = DataSourceType.SLAVE)
|
||||||
|
public AjaxResult searchCity() {
|
||||||
|
return success(lineService.searchCity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "业务已覆盖省份个数", response = SearchCityCountResponse.class)
|
||||||
|
@GetMapping("/searchCityCount")
|
||||||
|
@DataSource(value = DataSourceType.SLAVE)
|
||||||
|
public AjaxResult searchCityCount() {
|
||||||
|
return success(lineService.searchCityCount());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务装备返回体
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 11:06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("任务装备返回体")
|
||||||
|
public class EquipResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装备名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("装备名称")
|
||||||
|
private String thingType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装备类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("装备类型")
|
||||||
|
private String type;
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车辆id查询线路,装备,人员,标的物
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/15 9:29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GetCarIdInfoResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("线路类型")
|
||||||
|
private String lineType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装备信息
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("装备信息")
|
||||||
|
private List<EquipResponse> zbList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("人员信息")
|
||||||
|
private List<UserInfoResponse> userList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标的物
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("标的物")
|
||||||
|
private ItemsResponse bdwInfo;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标的物信息返回体
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 11:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("标的物信息返回体")
|
||||||
|
public class ItemsResponse {
|
||||||
|
|
||||||
|
@ApiModelProperty("数量")
|
||||||
|
private Integer count;
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路模板具体信息返回体
|
||||||
|
*
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 15:09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("线路模板具体信息返回体")
|
||||||
|
public class LineTemplateResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("区域")
|
||||||
|
private String area;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路总数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("线路总数")
|
||||||
|
private Integer LineTotalNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业网点总数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("营业网点总数")
|
||||||
|
private Integer outletsTotalNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上门收款点总数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("上门收款点总数")
|
||||||
|
private Integer paymentPointNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ATM机总数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("ATM机总数")
|
||||||
|
private Integer atmTotalNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime dataTime;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份清单数量
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 17:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("业务已覆盖省份清单数量")
|
||||||
|
public class SearchCityCountResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("个数")
|
||||||
|
private Integer count;
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份清单
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 16:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("业务已覆盖省份清单")
|
||||||
|
public class SearchCityResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省份
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("省份")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime dataTime;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路信息返回体
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 10:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("线路信息返回体")
|
||||||
|
public class SelectLineInfoResponse {
|
||||||
|
/**
|
||||||
|
* 任务名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("任务名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("任务类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.ykMap.entity.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息返回体
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 11:10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("人员信息返回体")
|
||||||
|
public class UserInfoResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员信息
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("人员信息")
|
||||||
|
private String ename;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("职位名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
private Integer orderNum;
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ykMap.mapper;
|
||||||
|
|
||||||
|
import com.ykMap.entity.response.EquipResponse;
|
||||||
|
import com.ykMap.entity.response.ItemsResponse;
|
||||||
|
import com.ykMap.entity.response.LineTemplateResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityCountResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityResponse;
|
||||||
|
import com.ykMap.entity.response.SelectLineInfoResponse;
|
||||||
|
import com.ykMap.entity.response.UserInfoResponse;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏线路数据层
|
||||||
|
*
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/13 9:49
|
||||||
|
*/
|
||||||
|
public interface LineMapper{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗线路信息
|
||||||
|
*/
|
||||||
|
SelectLineInfoResponse selectLineInfo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗装备信息
|
||||||
|
*/
|
||||||
|
List<EquipResponse> equip(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗人员信息
|
||||||
|
*/
|
||||||
|
List<UserInfoResponse> userInfo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗标的物信息
|
||||||
|
*/
|
||||||
|
ItemsResponse items(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路模板具体信息
|
||||||
|
*/
|
||||||
|
List<LineTemplateResponse> lineTemplate(@Param("area") String area,@Param("a1") LocalDate a1, @Param("a2")LocalDate a2);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份清单
|
||||||
|
*/
|
||||||
|
List<SearchCityResponse> searchCity(@Param("a1") LocalDate a1, @Param("a2")LocalDate a2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份个数
|
||||||
|
*/
|
||||||
|
SearchCityCountResponse searchCityCount(@Param("a1") LocalDate a1, @Param("a2")LocalDate a2);
|
||||||
|
|
||||||
|
String getByCarId(String id);
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.ykMap.service;
|
||||||
|
|
||||||
|
import com.ykMap.entity.response.EquipResponse;
|
||||||
|
import com.ykMap.entity.response.GetCarIdInfoResponse;
|
||||||
|
import com.ykMap.entity.response.ItemsResponse;
|
||||||
|
import com.ykMap.entity.response.LineTemplateResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityCountResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityResponse;
|
||||||
|
import com.ykMap.entity.response.SelectLineInfoResponse;
|
||||||
|
import com.ykMap.entity.response.UserInfoResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏线路业务层
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 10:43
|
||||||
|
*/
|
||||||
|
public interface LineService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗线路信息
|
||||||
|
*/
|
||||||
|
SelectLineInfoResponse selectLineInfo(String id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗装备信息
|
||||||
|
*/
|
||||||
|
List<EquipResponse> equip(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗人员信息
|
||||||
|
*/
|
||||||
|
List<UserInfoResponse> userInfo(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗标的物信息
|
||||||
|
*/
|
||||||
|
ItemsResponse items(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路模板具体信息
|
||||||
|
*/
|
||||||
|
List<LineTemplateResponse> lineTemplate(String area);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份清单
|
||||||
|
*/
|
||||||
|
List<SearchCityResponse> searchCity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份个数
|
||||||
|
*/
|
||||||
|
SearchCityCountResponse searchCityCount();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车辆id查询线路,装备,人员,标的
|
||||||
|
*/
|
||||||
|
GetCarIdInfoResponse getCarIdInfo(String id);
|
||||||
|
}
|
@ -0,0 +1,132 @@
|
|||||||
|
package com.ykMap.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.ykMap.entity.response.EquipResponse;
|
||||||
|
import com.ykMap.entity.response.GetCarIdInfoResponse;
|
||||||
|
import com.ykMap.entity.response.ItemsResponse;
|
||||||
|
import com.ykMap.entity.response.LineTemplateResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityCountResponse;
|
||||||
|
import com.ykMap.entity.response.SearchCityResponse;
|
||||||
|
import com.ykMap.entity.response.SelectLineInfoResponse;
|
||||||
|
import com.ykMap.entity.response.UserInfoResponse;
|
||||||
|
import com.ykMap.mapper.LineMapper;
|
||||||
|
import com.ykMap.service.LineService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏线路业务处理层
|
||||||
|
*
|
||||||
|
* @author du
|
||||||
|
* @since 2024/8/14 10:44
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LineServiceImpl implements LineService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LineMapper lineMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗线路信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SelectLineInfoResponse selectLineInfo(String id) {
|
||||||
|
return lineMapper.selectLineInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗装备信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EquipResponse> equip(String id) {
|
||||||
|
return lineMapper.equip(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗人员信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<UserInfoResponse> userInfo(String id) {
|
||||||
|
return lineMapper.userInfo(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务明细弹窗标的物信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemsResponse items(String id) {
|
||||||
|
return lineMapper.items(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路模板具体信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<LineTemplateResponse> lineTemplate(String area) {
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
if (now.getDayOfMonth() < 26) {
|
||||||
|
LocalDate a1 = now.minusMonths(2).withDayOfMonth(26);
|
||||||
|
LocalDate a2 = now.minusMonths(1).withDayOfMonth(25);
|
||||||
|
return lineMapper.lineTemplate(area, a1, a2);
|
||||||
|
} else {
|
||||||
|
LocalDate a1 = now.minusMonths(1).withDayOfMonth(26);
|
||||||
|
LocalDate a2 = now.withDayOfMonth(25);
|
||||||
|
return lineMapper.lineTemplate(area, a1, a2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份清单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SearchCityResponse> searchCity() {
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
if (now.getDayOfMonth() < 26) {
|
||||||
|
LocalDate a1 = now.minusMonths(2).withDayOfMonth(26);
|
||||||
|
LocalDate a2 = now.minusMonths(1).withDayOfMonth(25);
|
||||||
|
return lineMapper.searchCity(a1, a2);
|
||||||
|
} else {
|
||||||
|
LocalDate a1 = now.minusMonths(1).withDayOfMonth(26);
|
||||||
|
LocalDate a2 = now.withDayOfMonth(25);
|
||||||
|
return lineMapper.searchCity(a1, a2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务已覆盖省份个数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SearchCityCountResponse searchCityCount() {
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
if (now.getDayOfMonth() < 26) {
|
||||||
|
LocalDate a1 = now.minusMonths(2).withDayOfMonth(26);
|
||||||
|
LocalDate a2 = now.minusMonths(1).withDayOfMonth(25);
|
||||||
|
return lineMapper.searchCityCount(a1, a2);
|
||||||
|
} else {
|
||||||
|
LocalDate a1 = now.minusMonths(1).withDayOfMonth(26);
|
||||||
|
LocalDate a2 = now.withDayOfMonth(25);
|
||||||
|
return lineMapper.searchCityCount(a1, a2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据车辆id查询线路,装备,人员,标的
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public GetCarIdInfoResponse getCarIdInfo(String id) {
|
||||||
|
//获取该车辆的任务id
|
||||||
|
String bcs = lineMapper.getByCarId(id);
|
||||||
|
GetCarIdInfoResponse res = new GetCarIdInfoResponse();
|
||||||
|
res.setZbList(lineMapper.equip(bcs));
|
||||||
|
res.setUserList(lineMapper.userInfo(bcs));
|
||||||
|
res.setBdwInfo(lineMapper.items(bcs));
|
||||||
|
SelectLineInfoResponse se = lineMapper.selectLineInfo(bcs);
|
||||||
|
if (BeanUtil.isNotEmpty(se)) {
|
||||||
|
res.setLineType(se.getType());
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
# 数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
druid:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://39.101.188.84:3307/yk_map?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: Admin123@
|
||||||
|
# 从库数据源
|
||||||
|
slave:
|
||||||
|
# 从数据源开关/默认关闭
|
||||||
|
driverClassName: org.postgresql.Driver
|
||||||
|
enabled: true
|
||||||
|
url: jdbc:postgresql://39.101.188.84:5432/yk_map
|
||||||
|
username: postgres
|
||||||
|
password: adminadmin
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1
|
||||||
|
# 初始连接数
|
||||||
|
initialSize: 5
|
||||||
|
# 最小连接池数量
|
||||||
|
minIdle: 10
|
||||||
|
# 最大连接池数量
|
||||||
|
maxActive: 20
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
maxWait: 60000
|
||||||
|
# 配置连接超时时间
|
||||||
|
connectTimeout: 30000
|
||||||
|
# 配置网络超时时间
|
||||||
|
socketTimeout: 60000
|
||||||
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
|
maxEvictableIdleTimeMillis: 900000
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
webStatFilter:
|
||||||
|
enabled: true
|
||||||
|
statViewServlet:
|
||||||
|
enabled: true
|
||||||
|
# 设置白名单,不填则允许所有访问
|
||||||
|
allow:
|
||||||
|
url-pattern: /druid/*
|
||||||
|
# 控制台管理用户名和密码
|
||||||
|
login-username: ruoyi
|
||||||
|
login-password: 123456
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
# 慢SQL记录
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
@ -0,0 +1,64 @@
|
|||||||
|
# 数据源配置
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
druid:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://192.168.0.177:3306/finance_security?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: readuser
|
||||||
|
password: Ctsy@1234
|
||||||
|
# 从库数据源
|
||||||
|
slave:
|
||||||
|
# 从数据源开关/默认关闭
|
||||||
|
driverClassName: org.postgresql.Driver
|
||||||
|
enabled: true
|
||||||
|
url: jdbc:postgresql://192.168.0.84:5432/ctsy_data
|
||||||
|
username: szctsy
|
||||||
|
password: 1hblsqt@!Wingconn#
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1
|
||||||
|
# 初始连接数
|
||||||
|
initialSize: 5
|
||||||
|
# 最小连接池数量
|
||||||
|
minIdle: 10
|
||||||
|
# 最大连接池数量
|
||||||
|
maxActive: 20
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
maxWait: 60000
|
||||||
|
# 配置连接超时时间
|
||||||
|
connectTimeout: 30000
|
||||||
|
# 配置网络超时时间
|
||||||
|
socketTimeout: 60000
|
||||||
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||||
|
maxEvictableIdleTimeMillis: 900000
|
||||||
|
# 配置检测连接是否有效
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
webStatFilter:
|
||||||
|
enabled: true
|
||||||
|
statViewServlet:
|
||||||
|
enabled: true
|
||||||
|
# 设置白名单,不填则允许所有访问
|
||||||
|
allow:
|
||||||
|
url-pattern: /druid/*
|
||||||
|
# 控制台管理用户名和密码
|
||||||
|
login-username: ruoyi
|
||||||
|
login-password: 123456
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
# 慢SQL记录
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-allow: true
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ykMap.mapper.YxlglMapper">
|
||||||
|
<select id="page" resultType="com.ykMap.entity.Yxlgl">
|
||||||
|
select *
|
||||||
|
from zyk_yygl_xlgl.exl_operation_line_data
|
||||||
|
<where>
|
||||||
|
<if test="req.lineType != null and req.lineType != '' ">
|
||||||
|
and line_type like concat('%',#{req.lineType},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ykMap.mapper.YywtzMapper">
|
||||||
|
<select id="page" resultType="com.ykMap.entity.Yywtz">
|
||||||
|
select *
|
||||||
|
from zyk_yygl_ywtz.exl_operation_expansion_data
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ykMap.mapper.YywzlMapper">
|
||||||
|
<select id="page" resultType="com.ykMap.entity.Yywzl">
|
||||||
|
select *
|
||||||
|
from zyk_yygl_xlgl.exl_operation_overview_data_route
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="/home/logs/ykMap"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 用户访问日志输出 -->
|
||||||
|
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/sys-user.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 按天回滚 daily -->
|
||||||
|
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.ruoyi" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统用户操作日志-->
|
||||||
|
<logger name="sys-user" level="info">
|
||||||
|
<appender-ref ref="sys-user"/>
|
||||||
|
</logger>
|
||||||
|
</configuration>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE configuration
|
||||||
|
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
<!-- 全局参数 -->
|
||||||
|
<settings>
|
||||||
|
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||||
|
<setting name="cacheEnabled" value="true" />
|
||||||
|
<!-- 允许JDBC 支持自动生成主键 -->
|
||||||
|
<setting name="useGeneratedKeys" value="true" />
|
||||||
|
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||||
|
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||||
|
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||||
|
<setting name="logImpl" value="SLF4J" />
|
||||||
|
<!-- 使用驼峰命名法转换字段 -->
|
||||||
|
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||||
|
</settings>
|
||||||
|
|
||||||
|
</configuration>
|
Loading…
Reference in new issue