Merge remote-tracking branch 'origin/master'
commit
555021f880
|
@ -5,7 +5,7 @@ package com.muyu.common.core.exception;
|
|||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public final class ServiceException extends RuntimeException {
|
||||
public class ServiceException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
<?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>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-modules-many-datasource</artifactId>
|
||||
|
||||
<description>动态数据源</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.cloud.many.datasource;
|
||||
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(exclude =
|
||||
{DynamicDataSourceAutoConfiguration.class, DataSourceAutoConfiguration.class}
|
||||
)
|
||||
public class CloudManySourceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudManySourceApplication.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.muyu.cloud.many.datasource.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.muyu.cloud.many.datasource.config.domain.model.DataSourceInfo;
|
||||
import com.muyu.cloud.many.datasource.config.domain.model.EnterPriseInfo;
|
||||
import com.muyu.cloud.many.datasource.config.factory.DruidDataSourceFactory;
|
||||
import com.muyu.cloud.many.datasource.config.role.DynamicDataSource;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 多数据源 ManyDataSource
|
||||
*
|
||||
* Date 2024/6/3 20:01
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
@AllArgsConstructor
|
||||
public class ManyDataSource {
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
new Thread(()->{
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException ignored) {}
|
||||
DruidDataSourceFactory druidDataSourceFactory= SpringUtils.getBean(DruidDataSourceFactory.class);
|
||||
DynamicDataSource dynamicDataSource= SpringUtils.getBean(DynamicDataSource.class);
|
||||
EnterPriseInfo enterPriseInfo = EnterPriseInfo.builder()
|
||||
.entCode("jiang_0530")
|
||||
.ip("101.34.248.9")
|
||||
.port(3308)
|
||||
.build();
|
||||
|
||||
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild(enterPriseInfo.getEntCode(), enterPriseInfo.getIp(), enterPriseInfo.getPort());
|
||||
DruidDataSource druidDataSource = druidDataSourceFactory.create(dataSourceInfo);
|
||||
dynamicDataSource.put(dataSourceInfo.getKey(), druidDataSource);
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
private List<EnterPriseInfo> dataSourceInfoList(){
|
||||
List<EnterPriseInfo> list = new ArrayList<>();
|
||||
list.add(
|
||||
EnterPriseInfo.builder()
|
||||
.entCode("jiang_0606")
|
||||
.ip("101.34.248.9")
|
||||
.port(3309)
|
||||
.build()
|
||||
);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
||||
|
||||
//企业列表 企业CODE 端口 ip
|
||||
Map<Object, Object> dataSourceMap = new HashMap<>();
|
||||
dataSourceInfoList()
|
||||
.stream()
|
||||
.map(enterPriseInfo -> DataSourceInfo.hostAndPortBuild(enterPriseInfo.getEntCode(), enterPriseInfo.getIp(),enterPriseInfo.getPort()))
|
||||
.forEach(dataSourceInfo -> {
|
||||
dataSourceMap.put(dataSourceInfo.getKey(), druidDataSourceFactory.create(dataSourceInfo));
|
||||
});
|
||||
//设置动态数据源
|
||||
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||
// dynamicDataSource.setDefaultTargetDataSource(masterDataSource());
|
||||
dynamicDataSource.setTargetDataSources(dataSourceMap);
|
||||
//将数据源信息备份在defineTargetDataSources中
|
||||
dynamicDataSource.setDefineTargetDataSources(dataSourceMap);
|
||||
return dynamicDataSource;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.cloud.many.datasource.config.contents;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 数据源常量
|
||||
* @Date 2023-8-1 上午 11:02
|
||||
*/
|
||||
public class DatasourceContent {
|
||||
|
||||
public final static String DATASOURCE_URL = "jdbc:mysql://{}:{}/etltest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||
|
||||
public final static String USER_NAME = "root";
|
||||
|
||||
public final static String PASSWORD = "Jp991103";
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.many.datasource.config.contents;
|
||||
|
||||
/**
|
||||
* SaaS常量 SaaSConstant
|
||||
*
|
||||
* Date 2024/6/4 18:34
|
||||
*/
|
||||
public class SaaSConstant {
|
||||
|
||||
public final static String SAAS_KEY="enterprise-code";
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.cloud.many.datasource.config.domain.model;
|
||||
|
||||
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import static com.muyu.cloud.many.datasource.config.contents.DatasourceContent.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 数据源实体类
|
||||
* @Date 2023-8-1 上午 11:15
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataSourceInfo {
|
||||
|
||||
/**
|
||||
* 键
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
|
||||
public static DataSourceInfo hostAndPortBuild(String key,String host, Integer port){
|
||||
return DataSourceInfo.builder()
|
||||
.key(key)
|
||||
.url(StringUtils.format(DATASOURCE_URL, host, port,port))
|
||||
.password(PASSWORD)
|
||||
.userName(USER_NAME)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.cloud.many.datasource.config.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 企业信息 EnterPriseInfo
|
||||
*
|
||||
* Date 2024/6/4 08:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EnterPriseInfo {
|
||||
|
||||
private String entCode;
|
||||
|
||||
private String ip;
|
||||
|
||||
private Integer port;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.cloud.many.datasource.config.exception;
|
||||
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
|
||||
/**
|
||||
* SaaS异常类 SaaSException
|
||||
*
|
||||
* Date 2024/6/4 18:45
|
||||
*/
|
||||
public class SaaSException extends ServiceException {
|
||||
|
||||
public SaaSException(String message, Integer code) {
|
||||
super(message, code);
|
||||
}
|
||||
|
||||
public SaaSException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
public SaaSException() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.cloud.many.datasource.config.factory;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.muyu.cloud.many.datasource.config.domain.model.DataSourceInfo;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Druid工厂 DruidDataSourceFactory
|
||||
*
|
||||
* Date 2024/6/3 20:12
|
||||
*/
|
||||
@Log4j2
|
||||
@Component
|
||||
public class DruidDataSourceFactory {
|
||||
/**
|
||||
* @Description: 根据传递的数据源信息测试数据库连接
|
||||
* @Author Dongzl
|
||||
*/
|
||||
public DruidDataSource create(DataSourceInfo dataSourceInfo) {
|
||||
DruidDataSource druidDataSource = new DruidDataSource();
|
||||
druidDataSource.setUrl(dataSourceInfo.getUrl());
|
||||
druidDataSource.setUsername(dataSourceInfo.getUserName());
|
||||
druidDataSource.setPassword(dataSourceInfo.getPassword());
|
||||
druidDataSource.setBreakAfterAcquireFailure(true);
|
||||
druidDataSource.setConnectionErrorRetryAttempts(0);
|
||||
try {
|
||||
druidDataSource.getConnection(2000);
|
||||
log.info("{} -> 数据源连接成功", dataSourceInfo.getKey());
|
||||
return druidDataSource;
|
||||
} catch (SQLException throwables) {
|
||||
log.error("数据源 {} 连接失败,用户名:{},密码 {}",dataSourceInfo.getUrl(),dataSourceInfo.getUserName(),dataSourceInfo.getPassword());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.cloud.many.datasource.config.holder;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* 数据源切换处理
|
||||
*
|
||||
* @author Dongzl
|
||||
*/
|
||||
@Slf4j
|
||||
public class DynamicDataSourceHolder {
|
||||
/**
|
||||
* 保存动态数据源名称
|
||||
*/
|
||||
private static final ThreadLocal<String> DYNAMIC_DATASOURCE_KEY = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 设置/切换数据源,决定当前线程使用哪个数据源
|
||||
*/
|
||||
public static void setDynamicDataSourceKey(String key){
|
||||
log.info("数据源切换为:{}",key);
|
||||
DYNAMIC_DATASOURCE_KEY.set(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取动态数据源名称,默认使用mater数据源
|
||||
*/
|
||||
public static String getDynamicDataSourceKey(){
|
||||
String key = DYNAMIC_DATASOURCE_KEY.get();
|
||||
Assert.notNull(key, "请携带数据标识");
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除当前数据源
|
||||
*/
|
||||
public static void removeDynamicDataSourceKey(){
|
||||
log.info("移除数据源:{}",DYNAMIC_DATASOURCE_KEY.get());
|
||||
DYNAMIC_DATASOURCE_KEY.remove();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.cloud.many.datasource.config.interceptor;
|
||||
|
||||
import com.muyu.cloud.many.datasource.config.contents.SaaSConstant;
|
||||
import com.muyu.cloud.many.datasource.config.exception.SaaSException;
|
||||
import com.muyu.cloud.many.datasource.config.holder.DynamicDataSourceHolder;
|
||||
import com.muyu.cloud.many.datasource.config.role.DynamicDataSource;
|
||||
import com.muyu.common.core.utils.ServletUtils;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* SaaS拦截器 SaaSInterceptor
|
||||
*
|
||||
* Date 2024/6/4 14:39
|
||||
*/
|
||||
public class SaaSInterceptor implements AsyncHandlerInterceptor {
|
||||
|
||||
/**
|
||||
* 之前
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
if (!(handler instanceof HandlerMethod)){
|
||||
return true;
|
||||
}
|
||||
|
||||
String SaasKey = ServletUtils.getHeader(request, SaaSConstant.SAAS_KEY);
|
||||
|
||||
if (SaasKey==null){
|
||||
throw new SaaSException("SaaS非法访问");
|
||||
} else {
|
||||
DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class);
|
||||
if (!dynamicDataSource.hashKye(SaasKey)){
|
||||
throw new SaaSException("SaaS非法访问");
|
||||
}
|
||||
}
|
||||
DynamicDataSourceHolder.setDynamicDataSourceKey(SaasKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 之后
|
||||
*/
|
||||
@Override
|
||||
public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
DynamicDataSourceHolder.removeDynamicDataSourceKey();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.cloud.many.datasource.config.interceptor;
|
||||
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 拦截器配置
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public class WebMvcSaaSConfig implements WebMvcConfigurer {
|
||||
/**
|
||||
* 不需要拦截地址
|
||||
*/
|
||||
public static final String[] excludeUrls = {"/login", "/logout", "/refresh"};
|
||||
|
||||
@Override
|
||||
public void addInterceptors (InterceptorRegistry registry) {
|
||||
registry.addInterceptor(getHeaderInterceptor())
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns(excludeUrls)
|
||||
.order(-10);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义请求头拦截器
|
||||
*/
|
||||
public SaaSInterceptor getHeaderInterceptor () {
|
||||
return new SaaSInterceptor();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.muyu.cloud.many.datasource.config.role;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.muyu.cloud.many.datasource.config.holder.DynamicDataSourceHolder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 动态数据源
|
||||
* 调用AddDefineDataSource组件的addDefineDynamicDataSource()方法,获取原来targetdatasources的map,并将新的数据源信息添加到map中,并替换targetdatasources中的map
|
||||
* 切换数据源时可以使用@DataSource(value = "数据源名称"),或者DynamicDataSourceContextHolder.setContextKey("数据源名称")
|
||||
* @author Dongzl
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||
//备份所有数据源信息,备份的是个 指针!!!
|
||||
private Map<Object, Object> defineTargetDataSources;
|
||||
|
||||
/**
|
||||
* 判定键是否出站了
|
||||
* @param key 键
|
||||
* @return 存在结束 true 存在 false 不存在
|
||||
*/
|
||||
public boolean hashKye(String key){
|
||||
return defineTargetDataSources.containsKey(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加数据库
|
||||
* @param key 键
|
||||
* @param value 数据值
|
||||
*/
|
||||
public void put(String key, DruidDataSource value){
|
||||
defineTargetDataSources.put(key,value);
|
||||
this.afterPropertiesSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* 决定当前线程使用哪个数据源
|
||||
*/
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return DynamicDataSourceHolder.getDynamicDataSourceKey();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.cloud.many.datasource.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.muyu.cloud.many.datasource.domain.Vehicle;
|
||||
import com.muyu.cloud.many.datasource.mapper.VehicleMapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆控制层 VehicleController
|
||||
*
|
||||
* Date 2024/6/4 14:08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class VehicleController {
|
||||
@Autowired
|
||||
private VehicleMapper vehicleMapper;
|
||||
|
||||
@GetMapping("/list/all")
|
||||
public Result<List<Vehicle>> findAll () {
|
||||
return Result.success(vehicleMapper.selectList(new QueryWrapper<>()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.muyu.cloud.many.datasource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 vehicle
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "user")
|
||||
public class Vehicle extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String name;
|
||||
private Integer age;
|
||||
|
||||
// /** 车辆id */
|
||||
// @TableId(value = "id",type = IdType.AUTO)
|
||||
// private Long id;
|
||||
//
|
||||
// /** 车辆vin */
|
||||
// private String vin;
|
||||
//
|
||||
// /** 品牌 */
|
||||
// private String brand;
|
||||
//
|
||||
// /** 型号 */
|
||||
// private String model;
|
||||
//
|
||||
// /** 生产日期 */
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
// private Date productionDate;
|
||||
//
|
||||
// /** 车身类型 */
|
||||
// private String bodyType;
|
||||
//
|
||||
// /** 车身颜色 */
|
||||
// private String color;
|
||||
//
|
||||
// /** 发动机排量 */
|
||||
// private BigDecimal engineCapacity;
|
||||
//
|
||||
// /** 燃油类型 */
|
||||
// private String fuelType;
|
||||
//
|
||||
// /** 变速器类型 */
|
||||
// private String transmission;
|
||||
//
|
||||
// /** 驱动方式 */
|
||||
// private String driveType;
|
||||
//
|
||||
// /** 行驶里程 */
|
||||
// @Excel(name = "行驶里程")
|
||||
// @ApiModelProperty(name = "行驶里程", value = "行驶里程")
|
||||
// private BigDecimal mileage;
|
||||
//
|
||||
// /** 注册日期 */
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
// private Date registrationDate;
|
||||
//
|
||||
// /** 车牌号码 */
|
||||
// private String licenseNumber;
|
||||
//
|
||||
// /** 持有者 */
|
||||
// private String holder;
|
||||
//
|
||||
// /** 车辆类型 */
|
||||
// private String vehicleType;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.cloud.many.datasource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.many.datasource.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* 车辆mapper VehicleMapper
|
||||
*
|
||||
* Date 2024/6/4 14:07
|
||||
*/
|
||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.cloud.many.datasource.config.interceptor.WebMvcSaaSConfig
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9208
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: cloud-many-datasource
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.248.9:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.248.9:8848
|
||||
namespace: b9d88e07-8713-4ccd-8e98-d7c19f40fe74
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.cloud.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-many-datasource"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/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}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/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>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" 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>
|
||||
</configuration>
|
|
@ -0,0 +1,20 @@
|
|||
<?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>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-customer-business</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-customer-business-client</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,32 @@
|
|||
<?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>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-customer-business</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-customer-business-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.customer.business.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Atlas {
|
||||
|
||||
private String Q;
|
||||
|
||||
private String R;
|
||||
|
||||
private String lat;
|
||||
|
||||
private String lng;
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.muyu.customer.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 电子围栏对象 fence
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("fence")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Fence", description = "电子围栏")
|
||||
public class Fence extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "id", value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 电子围栏名称 */
|
||||
@Excel(name = "电子围栏名称")
|
||||
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||
private String name;
|
||||
|
||||
/** 围栏类型 */
|
||||
@Excel(name = "围栏类型")
|
||||
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||
private String fenceType;
|
||||
|
||||
/** 经纬度信息 */
|
||||
@Excel(name = "经纬度信息")
|
||||
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||
private String longitudeAndLatitude;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static Fence queryBuild( FenceQueryReq fenceQueryReq){
|
||||
return Fence.builder()
|
||||
.name(fenceQueryReq.getName())
|
||||
.fenceType(fenceQueryReq.getFenceType())
|
||||
.longitudeAndLatitude(fenceQueryReq.getLongitudeAndLatitude())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static Fence saveBuild(FenceSaveReq fenceSaveReq){
|
||||
return Fence.builder()
|
||||
.name(fenceSaveReq.getName())
|
||||
.fenceType(fenceSaveReq.getFenceType())
|
||||
.longitudeAndLatitude(fenceSaveReq.getLongitudeAndLatitude())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static Fence editBuild(Long id, FenceEditReq fenceEditReq){
|
||||
return Fence.builder()
|
||||
.id(id)
|
||||
.name(fenceEditReq.getName())
|
||||
.fenceType(fenceEditReq.getFenceType())
|
||||
.longitudeAndLatitude(fenceEditReq.getLongitudeAndLatitude())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.customer.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.StandardException;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("group")
|
||||
public class Group extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 围栏组id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
@Excel(name = "围栏组名称")
|
||||
private String groupName;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
package com.muyu.customer.business.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
||||
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
||||
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 vehicle
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("vehicle")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Vehicle", description = "车辆录入")
|
||||
public class Vehicle extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车辆id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "车辆id", value = "车辆id")
|
||||
private Long id;
|
||||
|
||||
/** 车辆vin */
|
||||
@Excel(name = "车辆vin")
|
||||
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||
private String vin;
|
||||
|
||||
/** 品牌 */
|
||||
@Excel(name = "品牌")
|
||||
@ApiModelProperty(name = "品牌", value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/** 型号 */
|
||||
@Excel(name = "型号")
|
||||
@ApiModelProperty(name = "型号", value = "型号")
|
||||
private String model;
|
||||
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "生产日期", value = "生产日期")
|
||||
private Date productionDate;
|
||||
|
||||
/** 车身类型 */
|
||||
@Excel(name = "车身类型")
|
||||
@ApiModelProperty(name = "车身类型", value = "车身类型")
|
||||
private String bodyType;
|
||||
|
||||
/** 车身颜色 */
|
||||
@Excel(name = "车身颜色")
|
||||
@ApiModelProperty(name = "车身颜色", value = "车身颜色")
|
||||
private String color;
|
||||
|
||||
/** 发动机排量 */
|
||||
@Excel(name = "发动机排量")
|
||||
@ApiModelProperty(name = "发动机排量", value = "发动机排量")
|
||||
private BigDecimal engineCapacity;
|
||||
|
||||
/** 燃油类型 */
|
||||
@Excel(name = "燃油类型")
|
||||
@ApiModelProperty(name = "燃油类型", value = "燃油类型")
|
||||
private String fuelType;
|
||||
|
||||
/** 变速器类型 */
|
||||
@Excel(name = "变速器类型")
|
||||
@ApiModelProperty(name = "变速器类型", value = "变速器类型")
|
||||
private String transmission;
|
||||
|
||||
/** 驱动方式 */
|
||||
@Excel(name = "驱动方式")
|
||||
@ApiModelProperty(name = "驱动方式", value = "驱动方式")
|
||||
private String driveType;
|
||||
|
||||
/** 行驶里程 */
|
||||
@Excel(name = "行驶里程")
|
||||
@ApiModelProperty(name = "行驶里程", value = "行驶里程")
|
||||
private BigDecimal mileage;
|
||||
|
||||
/** 注册日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "注册日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "注册日期", value = "注册日期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 车牌号码 */
|
||||
@Excel(name = "车牌号码")
|
||||
@ApiModelProperty(name = "车牌号码", value = "车牌号码")
|
||||
private String licenseNumber;
|
||||
|
||||
/** 持有者 */
|
||||
@Excel(name = "持有者")
|
||||
@ApiModelProperty(name = "持有者", value = "持有者")
|
||||
private String holder;
|
||||
|
||||
/** 车辆类型 */
|
||||
@Excel(name = "车辆类型")
|
||||
@ApiModelProperty(name = "车辆类型", value = "车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static Vehicle queryBuild( VehicleQueryReq vehicleQueryReq){
|
||||
return Vehicle.builder()
|
||||
.vin(vehicleQueryReq.getVin())
|
||||
.brand(vehicleQueryReq.getBrand())
|
||||
.model(vehicleQueryReq.getModel())
|
||||
.productionDate(vehicleQueryReq.getProductionDate())
|
||||
.bodyType(vehicleQueryReq.getBodyType())
|
||||
.color(vehicleQueryReq.getColor())
|
||||
.engineCapacity(vehicleQueryReq.getEngineCapacity())
|
||||
.fuelType(vehicleQueryReq.getFuelType())
|
||||
.transmission(vehicleQueryReq.getTransmission())
|
||||
.driveType(vehicleQueryReq.getDriveType())
|
||||
.mileage(vehicleQueryReq.getMileage())
|
||||
.registrationDate(vehicleQueryReq.getRegistrationDate())
|
||||
.licenseNumber(vehicleQueryReq.getLicenseNumber())
|
||||
.holder(vehicleQueryReq.getHolder())
|
||||
.vehicleType(vehicleQueryReq.getVehicleType())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static Vehicle saveBuild(VehicleSaveReq vehicleSaveReq){
|
||||
return Vehicle.builder()
|
||||
.vin(vehicleSaveReq.getVin())
|
||||
.brand(vehicleSaveReq.getBrand())
|
||||
.model(vehicleSaveReq.getModel())
|
||||
.productionDate(vehicleSaveReq.getProductionDate())
|
||||
.bodyType(vehicleSaveReq.getBodyType())
|
||||
.color(vehicleSaveReq.getColor())
|
||||
.engineCapacity(vehicleSaveReq.getEngineCapacity())
|
||||
.fuelType(vehicleSaveReq.getFuelType())
|
||||
.transmission(vehicleSaveReq.getTransmission())
|
||||
.driveType(vehicleSaveReq.getDriveType())
|
||||
.mileage(vehicleSaveReq.getMileage())
|
||||
.registrationDate(vehicleSaveReq.getRegistrationDate())
|
||||
.licenseNumber(vehicleSaveReq.getLicenseNumber())
|
||||
.holder(vehicleSaveReq.getHolder())
|
||||
.vehicleType(vehicleSaveReq.getVehicleType())
|
||||
.createTime(new Date())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.remark(vehicleSaveReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static Vehicle editBuild(Long id, VehicleEditReq vehicleEditReq){
|
||||
return Vehicle.builder()
|
||||
.id(id)
|
||||
.vin(vehicleEditReq.getVin())
|
||||
.brand(vehicleEditReq.getBrand())
|
||||
.model(vehicleEditReq.getModel())
|
||||
.productionDate(vehicleEditReq.getProductionDate())
|
||||
.bodyType(vehicleEditReq.getBodyType())
|
||||
.color(vehicleEditReq.getColor())
|
||||
.engineCapacity(vehicleEditReq.getEngineCapacity())
|
||||
.fuelType(vehicleEditReq.getFuelType())
|
||||
.transmission(vehicleEditReq.getTransmission())
|
||||
.driveType(vehicleEditReq.getDriveType())
|
||||
.mileage(vehicleEditReq.getMileage())
|
||||
.registrationDate(vehicleEditReq.getRegistrationDate())
|
||||
.licenseNumber(vehicleEditReq.getLicenseNumber())
|
||||
.holder(vehicleEditReq.getHolder())
|
||||
.vehicleType(vehicleEditReq.getVehicleType())
|
||||
.updateTime(new Date())
|
||||
.updateBy(SecurityUtils.getUsername())
|
||||
.remark(vehicleEditReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.customer.business.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 电子围栏对象 fence
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "FenceEditReq", description = "电子围栏")
|
||||
public class FenceEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 电子围栏名称 */
|
||||
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||
private String name;
|
||||
|
||||
/** 围栏类型 */
|
||||
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||
private String fenceType;
|
||||
|
||||
/** 经纬度信息 */
|
||||
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||
private String longitudeAndLatitude;
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.customer.business.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 电子围栏对象 fence
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "FenceQueryReq", description = "电子围栏")
|
||||
public class FenceQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 电子围栏名称 */
|
||||
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||
private String name;
|
||||
|
||||
/** 围栏类型 */
|
||||
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||
private String fenceType;
|
||||
|
||||
/** 经纬度信息 */
|
||||
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||
private String longitudeAndLatitude;
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.muyu.customer.business.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 电子围栏对象 fence
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "FenceSaveReq", description = "电子围栏")
|
||||
public class FenceSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
|
||||
@ApiModelProperty(name = "id", value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 电子围栏名称 */
|
||||
|
||||
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||
private String name;
|
||||
|
||||
/** 围栏类型 */
|
||||
|
||||
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||
private String fenceType;
|
||||
|
||||
/** 经纬度信息 */
|
||||
|
||||
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||
private String longitudeAndLatitude;
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.muyu.customer.business.domain.req;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 vehicle
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "VehicleEditReq", description = "车辆录入")
|
||||
public class VehicleEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车辆vin */
|
||||
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||
private String vin;
|
||||
|
||||
/** 品牌 */
|
||||
@ApiModelProperty(name = "品牌", value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/** 型号 */
|
||||
@ApiModelProperty(name = "型号", value = "型号")
|
||||
private String model;
|
||||
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "生产日期", value = "生产日期")
|
||||
private Date productionDate;
|
||||
|
||||
/** 车身类型 */
|
||||
@ApiModelProperty(name = "车身类型", value = "车身类型")
|
||||
private String bodyType;
|
||||
|
||||
/** 车身颜色 */
|
||||
@ApiModelProperty(name = "车身颜色", value = "车身颜色")
|
||||
private String color;
|
||||
|
||||
/** 发动机排量 */
|
||||
@ApiModelProperty(name = "发动机排量", value = "发动机排量")
|
||||
private BigDecimal engineCapacity;
|
||||
|
||||
/** 燃油类型 */
|
||||
@ApiModelProperty(name = "燃油类型", value = "燃油类型")
|
||||
private String fuelType;
|
||||
|
||||
/** 变速器类型 */
|
||||
@ApiModelProperty(name = "变速器类型", value = "变速器类型")
|
||||
private String transmission;
|
||||
|
||||
/** 驱动方式 */
|
||||
@ApiModelProperty(name = "驱动方式", value = "驱动方式")
|
||||
private String driveType;
|
||||
|
||||
/** 行驶里程 */
|
||||
@ApiModelProperty(name = "行驶里程", value = "行驶里程")
|
||||
private BigDecimal mileage;
|
||||
|
||||
/** 注册日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "注册日期", value = "注册日期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 车牌号码 */
|
||||
@ApiModelProperty(name = "车牌号码", value = "车牌号码")
|
||||
private String licenseNumber;
|
||||
|
||||
/** 持有者 */
|
||||
@ApiModelProperty(name = "持有者", value = "持有者")
|
||||
private String holder;
|
||||
|
||||
/** 车辆类型 */
|
||||
@ApiModelProperty(name = "车辆类型", value = "车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.muyu.customer.business.domain.req;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 vehicle
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "VehicleQueryReq", description = "车辆录入")
|
||||
public class VehicleQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车辆vin */
|
||||
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||
private String vin;
|
||||
|
||||
/** 品牌 */
|
||||
@ApiModelProperty(name = "品牌", value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/** 型号 */
|
||||
@ApiModelProperty(name = "型号", value = "型号")
|
||||
private String model;
|
||||
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "生产日期", value = "生产日期")
|
||||
private Date productionDate;
|
||||
|
||||
/** 车身类型 */
|
||||
@ApiModelProperty(name = "车身类型", value = "车身类型")
|
||||
private String bodyType;
|
||||
|
||||
/** 车身颜色 */
|
||||
@ApiModelProperty(name = "车身颜色", value = "车身颜色")
|
||||
private String color;
|
||||
|
||||
/** 发动机排量 */
|
||||
@ApiModelProperty(name = "发动机排量", value = "发动机排量")
|
||||
private BigDecimal engineCapacity;
|
||||
|
||||
/** 燃油类型 */
|
||||
@ApiModelProperty(name = "燃油类型", value = "燃油类型")
|
||||
private String fuelType;
|
||||
|
||||
/** 变速器类型 */
|
||||
@ApiModelProperty(name = "变速器类型", value = "变速器类型")
|
||||
private String transmission;
|
||||
|
||||
/** 驱动方式 */
|
||||
@ApiModelProperty(name = "驱动方式", value = "驱动方式")
|
||||
private String driveType;
|
||||
|
||||
/** 行驶里程 */
|
||||
@ApiModelProperty(name = "行驶里程", value = "行驶里程")
|
||||
private BigDecimal mileage;
|
||||
|
||||
/** 注册日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "注册日期", value = "注册日期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 车牌号码 */
|
||||
@ApiModelProperty(name = "车牌号码", value = "车牌号码")
|
||||
private String licenseNumber;
|
||||
|
||||
/** 持有者 */
|
||||
@ApiModelProperty(name = "持有者", value = "持有者")
|
||||
private String holder;
|
||||
|
||||
/** 车辆类型 */
|
||||
@ApiModelProperty(name = "车辆类型", value = "车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.customer.business.domain.req;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 vehicle
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "VehicleSaveReq", description = "车辆录入")
|
||||
public class VehicleSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车辆id */
|
||||
|
||||
@ApiModelProperty(name = "车辆id", value = "车辆id")
|
||||
private Long id;
|
||||
|
||||
/** 车辆vin */
|
||||
|
||||
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||
private String vin;
|
||||
|
||||
/** 品牌 */
|
||||
|
||||
@ApiModelProperty(name = "品牌", value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/** 型号 */
|
||||
|
||||
@ApiModelProperty(name = "型号", value = "型号")
|
||||
private String model;
|
||||
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "生产日期", value = "生产日期")
|
||||
private Date productionDate;
|
||||
|
||||
/** 车身类型 */
|
||||
|
||||
@ApiModelProperty(name = "车身类型", value = "车身类型")
|
||||
private String bodyType;
|
||||
|
||||
/** 车身颜色 */
|
||||
|
||||
@ApiModelProperty(name = "车身颜色", value = "车身颜色")
|
||||
private String color;
|
||||
|
||||
/** 发动机排量 */
|
||||
|
||||
@ApiModelProperty(name = "发动机排量", value = "发动机排量")
|
||||
private BigDecimal engineCapacity;
|
||||
|
||||
/** 燃油类型 */
|
||||
|
||||
@ApiModelProperty(name = "燃油类型", value = "燃油类型")
|
||||
private String fuelType;
|
||||
|
||||
/** 变速器类型 */
|
||||
|
||||
@ApiModelProperty(name = "变速器类型", value = "变速器类型")
|
||||
private String transmission;
|
||||
|
||||
/** 驱动方式 */
|
||||
|
||||
@ApiModelProperty(name = "驱动方式", value = "驱动方式")
|
||||
private String driveType;
|
||||
|
||||
/** 行驶里程 */
|
||||
|
||||
@ApiModelProperty(name = "行驶里程", value = "行驶里程")
|
||||
private BigDecimal mileage;
|
||||
|
||||
/** 注册日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "注册日期", value = "注册日期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 车牌号码 */
|
||||
|
||||
@ApiModelProperty(name = "车牌号码", value = "车牌号码")
|
||||
private String licenseNumber;
|
||||
|
||||
/** 持有者 */
|
||||
|
||||
@ApiModelProperty(name = "持有者", value = "持有者")
|
||||
private String holder;
|
||||
|
||||
/** 车辆类型 */
|
||||
|
||||
@ApiModelProperty(name = "车辆类型", value = "车辆类型")
|
||||
private String vehicleType;
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?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>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-customer-business</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-customer-business-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,116 @@
|
|||
<?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>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-customer-business</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-customer-business-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-customer-business-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.customer.business;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 车联网客户业务系统启动类 MuYuCustomerBusinessApplication
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* Date 2024/5/27 16:51
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuCustomerBusinessApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuCustomerBusinessApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.customer.business.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.customer.business.domain.Fence;
|
||||
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||
import com.muyu.customer.business.service.FenceService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 电子围栏Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Api(tags = "电子围栏")
|
||||
@RestController
|
||||
@RequestMapping("/fence")
|
||||
public class FenceController extends BaseController {
|
||||
@Autowired
|
||||
private FenceService fenceService;
|
||||
|
||||
/**
|
||||
* 查询电子围栏列表
|
||||
*/
|
||||
@ApiOperation("获取电子围栏列表")
|
||||
@RequiresPermissions("customerBusiness:fence:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Fence>> list(FenceQueryReq fenceQueryReq) {
|
||||
startPage();
|
||||
List<Fence> list = fenceService.list(Fence.queryBuild(fenceQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出电子围栏列表
|
||||
*/
|
||||
@ApiOperation("导出电子围栏列表")
|
||||
@RequiresPermissions("customerBusiness:fence:export")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Fence fence) {
|
||||
List<Fence> list = fenceService.list(fence);
|
||||
ExcelUtil<Fence> util = new ExcelUtil<Fence>(Fence.class);
|
||||
util.exportExcel(response, list, "电子围栏数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子围栏详细信息
|
||||
*/
|
||||
@ApiOperation("获取电子围栏详细信息")
|
||||
@RequiresPermissions("customerBusiness:fence:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<Fence> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(fenceService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子围栏
|
||||
*/
|
||||
@RequiresPermissions("customerBusiness:fence:add")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增电子围栏")
|
||||
public Result<String> add(@RequestBody FenceSaveReq fenceSaveReq) {
|
||||
return toAjax(fenceService.save(Fence.saveBuild(fenceSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子围栏
|
||||
*/
|
||||
@RequiresPermissions("customerBusiness:fence:edit")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改电子围栏")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody FenceEditReq fenceEditReq) {
|
||||
return toAjax(fenceService.updateById(Fence.editBuild(id,fenceEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子围栏
|
||||
*/
|
||||
@RequiresPermissions("customerBusiness:fence:remove")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除电子围栏")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(fenceService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.muyu.customer.business.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.customer.business.domain.Group;
|
||||
import com.muyu.customer.business.service.GroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/group")
|
||||
public class GroupController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
/**
|
||||
* 查询围栏组列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Group>> list(Group group)
|
||||
{
|
||||
startPage();
|
||||
List<Group> list = groupService.selectGroupList(group);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出围栏组列表
|
||||
*/
|
||||
@Log(title = "围栏组", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Group group)
|
||||
{
|
||||
List<Group> list = groupService.selectGroupList(group);
|
||||
ExcelUtil<Group> util = new ExcelUtil<Group>(Group.class);
|
||||
util.exportExcel(response, list, "围栏组数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取围栏组详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(groupService.selectGroupById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增围栏组
|
||||
*/
|
||||
@Log(title = "围栏组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Group group)
|
||||
{
|
||||
return toAjax(groupService.insertGroup(group));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏组
|
||||
*/
|
||||
@Log(title = "围栏组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Group group)
|
||||
{
|
||||
return toAjax(groupService.updateGroup(group));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除围栏组
|
||||
*/
|
||||
@Log(title = "围栏组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(groupService.deleteGroupByIds(ids));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.customer.business.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.customer.business.domain.Vehicle;
|
||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
||||
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
||||
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
||||
import com.muyu.customer.business.service.VehicleService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 车辆录入Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Api(tags = "车辆录入")
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class VehicleController extends BaseController {
|
||||
@Autowired
|
||||
private VehicleService vehicleService;
|
||||
|
||||
/**
|
||||
* 查询车辆录入列表
|
||||
*/
|
||||
@ApiOperation("获取车辆录入列表")
|
||||
@RequiresPermissions("customerBusiness:vehicle:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Vehicle>> list(VehicleQueryReq vehicleQueryReq) {
|
||||
startPage();
|
||||
List<Vehicle> list = vehicleService.list(Vehicle.queryBuild(vehicleQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆录入列表
|
||||
*/
|
||||
@ApiOperation("导出车辆录入列表")
|
||||
@RequiresPermissions("customerBusiness:vehicle:export")
|
||||
@Log(title = "车辆录入", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Vehicle vehicle) {
|
||||
List<Vehicle> list = vehicleService.list(vehicle);
|
||||
ExcelUtil<Vehicle> util = new ExcelUtil<Vehicle>(Vehicle.class);
|
||||
util.exportExcel(response, list, "车辆录入数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆录入详细信息
|
||||
*/
|
||||
@ApiOperation("获取车辆录入详细信息")
|
||||
@RequiresPermissions("customerBusiness:vehicle:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<Vehicle> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(vehicleService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车辆录入
|
||||
*/
|
||||
@RequiresPermissions("customerBusiness:vehicle:add")
|
||||
@Log(title = "车辆录入", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增车辆录入")
|
||||
public Result<String> add(@RequestBody VehicleSaveReq vehicleSaveReq) {
|
||||
return toAjax(vehicleService.save(Vehicle.saveBuild(vehicleSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆录入
|
||||
*/
|
||||
@RequiresPermissions("customerBusiness:vehicle:edit")
|
||||
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改车辆录入")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody VehicleEditReq vehicleEditReq) {
|
||||
return toAjax(vehicleService.updateById(Vehicle.editBuild(id,vehicleEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆录入
|
||||
*/
|
||||
@RequiresPermissions("customerBusiness:vehicle:remove")
|
||||
@Log(title = "车辆录入", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除车辆录入")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(vehicleService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.customer.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.customer.business.domain.Fence;
|
||||
|
||||
/**
|
||||
* 电子围栏Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
public interface FenceMapper extends BaseMapper<Fence> {
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.customer.business.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.customer.business.domain.Group;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GroupMapper extends BaseMapper<Group> {
|
||||
|
||||
/**
|
||||
* 查询围栏组
|
||||
*
|
||||
* @param id 围栏组主键
|
||||
* @return 围栏组
|
||||
*/
|
||||
public Group selectGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 查询围栏组列表
|
||||
*
|
||||
* @param group 围栏组
|
||||
* @return 围栏组集合
|
||||
*/
|
||||
public List<Group> selectGroupList(Group group);
|
||||
|
||||
/**
|
||||
* 新增围栏组
|
||||
*
|
||||
* @param group 围栏组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGroup(Group group);
|
||||
|
||||
/**
|
||||
* 修改围栏组
|
||||
*
|
||||
* @param group 围栏组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGroup(Group group);
|
||||
|
||||
/**
|
||||
* 删除围栏组
|
||||
*
|
||||
* @param id 围栏组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除围栏组
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupByIds(Long[] ids);
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.customer.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.customer.business.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* 车辆录入Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.customer.business.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.customer.business.domain.Fence;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 电子围栏Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
public interface FenceService extends IService<Fence> {
|
||||
/**
|
||||
* 查询电子围栏列表
|
||||
*
|
||||
* @param fence 电子围栏
|
||||
* @return 电子围栏集合
|
||||
*/
|
||||
public List<Fence> list(Fence fence);
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.muyu.customer.business.service;
|
||||
|
||||
import com.muyu.customer.business.domain.Group;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GroupService {
|
||||
|
||||
/**
|
||||
* 查询围栏组
|
||||
*
|
||||
* @param id 围栏组主键
|
||||
* @return 围栏组
|
||||
*/
|
||||
public Group selectGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 查询围栏组列表
|
||||
*
|
||||
* @param group 围栏组
|
||||
* @return 围栏组集合
|
||||
*/
|
||||
public List<Group> selectGroupList(Group group);
|
||||
|
||||
/**
|
||||
* 新增围栏组
|
||||
*
|
||||
* @param group 围栏组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGroup(Group group);
|
||||
|
||||
/**
|
||||
* 修改围栏组
|
||||
*
|
||||
* @param group 围栏组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGroup(Group group);
|
||||
|
||||
/**
|
||||
* 批量删除围栏组
|
||||
*
|
||||
* @param ids 需要删除的围栏组主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除围栏组信息
|
||||
*
|
||||
* @param id 围栏组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupById(Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.customer.business.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.customer.business.domain.Vehicle;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 车辆录入Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
public interface VehicleService extends IService<Vehicle> {
|
||||
/**
|
||||
* 查询车辆录入列表
|
||||
*
|
||||
* @param vehicle 车辆录入
|
||||
* @return 车辆录入集合
|
||||
*/
|
||||
public List<Vehicle> list(Vehicle vehicle);
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.customer.business.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.customer.business.mapper.FenceMapper;
|
||||
import com.muyu.customer.business.domain.Fence;
|
||||
import com.muyu.customer.business.service.FenceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 电子围栏Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-31
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
|
||||
|
||||
/**
|
||||
* 查询电子围栏列表
|
||||
*
|
||||
* @param fence 电子围栏
|
||||
* @return 电子围栏
|
||||
*/
|
||||
@Override
|
||||
public List<Fence> list(Fence fence) {
|
||||
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(fence.getName())){
|
||||
queryWrapper.like(Fence::getName, fence.getName());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(fence.getFenceType())){
|
||||
queryWrapper.eq(Fence::getFenceType, fence.getFenceType());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(fence.getLongitudeAndLatitude())){
|
||||
queryWrapper.eq(Fence::getLongitudeAndLatitude, fence.getLongitudeAndLatitude());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.muyu.customer.business.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.customer.business.domain.Group;
|
||||
import com.muyu.customer.business.mapper.GroupMapper;
|
||||
import com.muyu.customer.business.service.GroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class GroupServiceImpl extends ServiceImpl<GroupMapper,Group> implements GroupService {
|
||||
|
||||
@Autowired
|
||||
private GroupMapper groupMapper;
|
||||
@Override
|
||||
public Group selectGroupById(Long id) {
|
||||
return groupMapper.selectGroupById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> selectGroupList(Group group) {
|
||||
return groupMapper.selectGroupList(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertGroup(Group group) {
|
||||
return groupMapper.insertGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateGroup(Group group) {
|
||||
return groupMapper.updateGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteGroupByIds(Long[] ids) {
|
||||
return groupMapper.deleteGroupByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteGroupById(Long id) {
|
||||
return groupMapper.deleteGroupById(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.muyu.customer.business.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.customer.business.mapper.VehicleMapper;
|
||||
import com.muyu.customer.business.domain.Vehicle;
|
||||
import com.muyu.customer.business.service.VehicleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 车辆录入Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
|
||||
|
||||
/**
|
||||
* 查询车辆录入列表
|
||||
*
|
||||
* @param vehicle 车辆录入
|
||||
* @return 车辆录入
|
||||
*/
|
||||
@Override
|
||||
public List<Vehicle> list(Vehicle vehicle) {
|
||||
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getVin())){
|
||||
queryWrapper.eq(Vehicle::getVin, vehicle.getVin());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getBrand())){
|
||||
queryWrapper.eq(Vehicle::getBrand, vehicle.getBrand());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getModel())){
|
||||
queryWrapper.eq(Vehicle::getModel, vehicle.getModel());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getProductionDate())){
|
||||
queryWrapper.eq(Vehicle::getProductionDate, vehicle.getProductionDate());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getBodyType())){
|
||||
queryWrapper.eq(Vehicle::getBodyType, vehicle.getBodyType());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getColor())){
|
||||
queryWrapper.eq(Vehicle::getColor, vehicle.getColor());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getEngineCapacity())){
|
||||
queryWrapper.eq(Vehicle::getEngineCapacity, vehicle.getEngineCapacity());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getFuelType())){
|
||||
queryWrapper.eq(Vehicle::getFuelType, vehicle.getFuelType());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getTransmission())){
|
||||
queryWrapper.eq(Vehicle::getTransmission, vehicle.getTransmission());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getDriveType())){
|
||||
queryWrapper.eq(Vehicle::getDriveType, vehicle.getDriveType());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getMileage())){
|
||||
queryWrapper.eq(Vehicle::getMileage, vehicle.getMileage());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getRegistrationDate())){
|
||||
queryWrapper.eq(Vehicle::getRegistrationDate, vehicle.getRegistrationDate());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getLicenseNumber())){
|
||||
queryWrapper.eq(Vehicle::getLicenseNumber, vehicle.getLicenseNumber());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getHolder())){
|
||||
queryWrapper.eq(Vehicle::getHolder, vehicle.getHolder());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(vehicle.getVehicleType())){
|
||||
queryWrapper.eq(Vehicle::getVehicleType, vehicle.getVehicleType());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,29 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9206
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-customer-business
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.248.9:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.248.9:8848
|
||||
namespace: b9d88e07-8713-4ccd-8e98-d7c19f40fe74
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.net.working.mapper: DEBUG
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/muyu-customer-business"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/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}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/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>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" 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>
|
||||
</configuration>
|
|
@ -0,0 +1,22 @@
|
|||
<?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.muyu.customer.business.mapper.FenceMapper">
|
||||
|
||||
<resultMap type="com.muyu.customer.business.domain.Fence" id="FenceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="fenceType" column="fence_type" />
|
||||
<result property="longitudeAndLatitude" column="longitude_and_latitude" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFenceVo">
|
||||
select id, name, fence_type, longitude_and_latitude, create_by, create_time, update_by, update_time, remark from fence
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,77 @@
|
|||
<?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.muyu.customer.business.mapper.GroupMapper">
|
||||
|
||||
<resultMap type="com.muyu.customer.business.domain.Group" id="GroupResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="groupName" column="group_name" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGroupVo">
|
||||
select id, group_name, remark, create_by, create_time, update_by, update_time from `group`
|
||||
</sql>
|
||||
|
||||
<select id="selectGroupList" parameterType="com.muyu.customer.business.domain.Group" resultMap="GroupResult">
|
||||
<include refid="selectGroupVo"/>
|
||||
<where>
|
||||
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectGroupById" parameterType="Long" resultMap="GroupResult">
|
||||
<include refid="selectGroupVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertGroup" parameterType="com.muyu.customer.business.domain.Group" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into `group`
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="groupName != null">group_name,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="groupName != null">#{groupName},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateGroup" parameterType="com.muyu.customer.business.domain.Group">
|
||||
update `group`
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="groupName != null">group_name = #{groupName},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteGroupById" parameterType="Long">
|
||||
delete from `group` where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGroupByIds" parameterType="String">
|
||||
delete from `group` where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,34 @@
|
|||
<?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.muyu.customer.business.mapper.VehicleMapper">
|
||||
|
||||
<resultMap type="com.muyu.customer.business.domain.Vehicle" id="VehicleResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="vin" column="vin" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="model" column="model" />
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="bodyType" column="body_type" />
|
||||
<result property="color" column="color" />
|
||||
<result property="engineCapacity" column="engine_capacity" />
|
||||
<result property="fuelType" column="fuel_type" />
|
||||
<result property="transmission" column="transmission" />
|
||||
<result property="driveType" column="drive_type" />
|
||||
<result property="mileage" column="mileage" />
|
||||
<result property="registrationDate" column="registration_date" />
|
||||
<result property="licenseNumber" column="license_number" />
|
||||
<result property="holder" column="holder" />
|
||||
<result property="vehicleType" column="vehicle_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVehicleVo">
|
||||
select id, vin, brand, model, production_date, body_type, color, engine_capacity, fuel_type, transmission, drive_type, mileage, registration_date, license_number, holder, vehicle_type, create_by, create_time, update_by, update_time, remark from vehicle
|
||||
</sql>
|
||||
</mapper>
|
|
@ -0,0 +1,27 @@
|
|||
<?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>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-customer-business</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>muyu-customer-business-client</module>
|
||||
<module>muyu-customer-business-remote</module>
|
||||
<module>muyu-customer-business-common</module>
|
||||
<module>muyu-customer-business-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9203
|
||||
port: 9205
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
package com.muyu.net.working.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.net.working.domain.req.EnterpriseQueryReq;
|
||||
import com.muyu.net.working.domain.req.EnterpriseSaveReq;
|
||||
import com.muyu.net.working.domain.req.EnterpriseEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 企业信息对象 enterprise
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("enterprise")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Enterprise", description = "企业信息")
|
||||
public class Enterprise extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private String id;
|
||||
|
||||
/** 企业名称 */
|
||||
@Excel(name = "企业名称")
|
||||
@ApiModelProperty(name = "企业名称", value = "企业名称")
|
||||
private String ebterpriseName;
|
||||
|
||||
/** 法定代表人 */
|
||||
@Excel(name = "法定代表人")
|
||||
@ApiModelProperty(name = "法定代表人", value = "法定代表人")
|
||||
private String legalPerson;
|
||||
|
||||
/** 经营执照凭证号码 */
|
||||
@Excel(name = "经营执照凭证号码")
|
||||
@ApiModelProperty(name = "经营执照凭证号码", value = "经营执照凭证号码")
|
||||
private String businessLincenseNumber;
|
||||
|
||||
/** 企业成立时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "企业成立时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "企业成立时间", value = "企业成立时间")
|
||||
private Date estabinessDate;
|
||||
|
||||
/** 经营范围 */
|
||||
@Excel(name = "经营范围")
|
||||
@ApiModelProperty(name = "经营范围", value = "经营范围")
|
||||
private String businessScope;
|
||||
|
||||
/** 注册地址 */
|
||||
@Excel(name = "注册地址")
|
||||
@ApiModelProperty(name = "注册地址", value = "注册地址")
|
||||
private String address;
|
||||
|
||||
/** 企业联系方式 */
|
||||
@Excel(name = "企业联系方式")
|
||||
@ApiModelProperty(name = "企业联系方式", value = "企业联系方式")
|
||||
private String contactPhone;
|
||||
|
||||
/** 公司邮箱 */
|
||||
@Excel(name = "公司邮箱")
|
||||
@ApiModelProperty(name = "公司邮箱", value = "公司邮箱")
|
||||
private String email;
|
||||
|
||||
/** 企业当前状态 */
|
||||
@Excel(name = "企业当前状态")
|
||||
@ApiModelProperty(name = "企业当前状态", value = "企业当前状态")
|
||||
private String status;
|
||||
|
||||
/** 企业入驻平台时期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "企业入驻平台时期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "企业入驻平台时期", value = "企业入驻平台时期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 企业认证id */
|
||||
@Excel(name = "企业认证id")
|
||||
@ApiModelProperty(name = "企业认证id", value = "企业认证id")
|
||||
private Long certificationId;
|
||||
|
||||
/** 认证时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "认证时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "认证时间", value = "认证时间")
|
||||
private Date authenticationDate;
|
||||
|
||||
/** 服务级别 */
|
||||
@Excel(name = "服务级别")
|
||||
@ApiModelProperty(name = "服务级别", value = "服务级别")
|
||||
private Long serviceLevel;
|
||||
|
||||
/** 开通服务id */
|
||||
@Excel(name = "开通服务id")
|
||||
@ApiModelProperty(name = "开通服务id", value = "开通服务id")
|
||||
private Long openServerId;
|
||||
|
||||
/** 增值服务id */
|
||||
@Excel(name = "增值服务id")
|
||||
@ApiModelProperty(name = "增值服务id", value = "增值服务id")
|
||||
private Long addServerId;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static Enterprise queryBuild( EnterpriseQueryReq enterpriseQueryReq){
|
||||
return Enterprise.builder()
|
||||
.ebterpriseName(enterpriseQueryReq.getEbterpriseName())
|
||||
.legalPerson(enterpriseQueryReq.getLegalPerson())
|
||||
.businessLincenseNumber(enterpriseQueryReq.getBusinessLincenseNumber())
|
||||
.estabinessDate(enterpriseQueryReq.getEstabinessDate())
|
||||
.businessScope(enterpriseQueryReq.getBusinessScope())
|
||||
.address(enterpriseQueryReq.getAddress())
|
||||
.contactPhone(enterpriseQueryReq.getContactPhone())
|
||||
.email(enterpriseQueryReq.getEmail())
|
||||
.status(enterpriseQueryReq.getStatus())
|
||||
.registrationDate(enterpriseQueryReq.getRegistrationDate())
|
||||
.certificationId(enterpriseQueryReq.getCertificationId())
|
||||
.authenticationDate(enterpriseQueryReq.getAuthenticationDate())
|
||||
.serviceLevel(enterpriseQueryReq.getServiceLevel())
|
||||
.openServerId(enterpriseQueryReq.getOpenServerId())
|
||||
.addServerId(enterpriseQueryReq.getAddServerId())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static Enterprise saveBuild(EnterpriseSaveReq enterpriseSaveReq){
|
||||
return Enterprise.builder()
|
||||
.ebterpriseName(enterpriseSaveReq.getEbterpriseName())
|
||||
.legalPerson(enterpriseSaveReq.getLegalPerson())
|
||||
.businessLincenseNumber(enterpriseSaveReq.getBusinessLincenseNumber())
|
||||
.estabinessDate(enterpriseSaveReq.getEstabinessDate())
|
||||
.businessScope(enterpriseSaveReq.getBusinessScope())
|
||||
.address(enterpriseSaveReq.getAddress())
|
||||
.contactPhone(enterpriseSaveReq.getContactPhone())
|
||||
.email(enterpriseSaveReq.getEmail())
|
||||
.status(enterpriseSaveReq.getStatus())
|
||||
.registrationDate(enterpriseSaveReq.getRegistrationDate())
|
||||
.certificationId(enterpriseSaveReq.getCertificationId())
|
||||
.authenticationDate(enterpriseSaveReq.getAuthenticationDate())
|
||||
.serviceLevel(enterpriseSaveReq.getServiceLevel())
|
||||
.openServerId(enterpriseSaveReq.getOpenServerId())
|
||||
.addServerId(enterpriseSaveReq.getAddServerId())
|
||||
.createBy(enterpriseSaveReq.getCreateBy())
|
||||
.createTime(new Date())
|
||||
.remark(enterpriseSaveReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static Enterprise editBuild(String id, EnterpriseEditReq enterpriseEditReq){
|
||||
return Enterprise.builder()
|
||||
.id(id)
|
||||
.ebterpriseName(enterpriseEditReq.getEbterpriseName())
|
||||
.legalPerson(enterpriseEditReq.getLegalPerson())
|
||||
.businessLincenseNumber(enterpriseEditReq.getBusinessLincenseNumber())
|
||||
.estabinessDate(enterpriseEditReq.getEstabinessDate())
|
||||
.businessScope(enterpriseEditReq.getBusinessScope())
|
||||
.address(enterpriseEditReq.getAddress())
|
||||
.contactPhone(enterpriseEditReq.getContactPhone())
|
||||
.email(enterpriseEditReq.getEmail())
|
||||
.status(enterpriseEditReq.getStatus())
|
||||
.registrationDate(enterpriseEditReq.getRegistrationDate())
|
||||
.certificationId(enterpriseEditReq.getCertificationId())
|
||||
.authenticationDate(enterpriseEditReq.getAuthenticationDate())
|
||||
.serviceLevel(enterpriseEditReq.getServiceLevel())
|
||||
.openServerId(enterpriseEditReq.getOpenServerId())
|
||||
.addServerId(enterpriseEditReq.getAddServerId())
|
||||
.updateBy(enterpriseEditReq.getUpdateBy())
|
||||
.updateTime(new Date())
|
||||
.remark(enterpriseEditReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.muyu.net.working.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 企业信息对象 enterprise
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "EnterpriseEditReq", description = "企业信息")
|
||||
public class EnterpriseEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 企业名称 */
|
||||
@ApiModelProperty(name = "企业名称", value = "企业名称")
|
||||
private String ebterpriseName;
|
||||
|
||||
/** 法定代表人 */
|
||||
@ApiModelProperty(name = "法定代表人", value = "法定代表人")
|
||||
private String legalPerson;
|
||||
|
||||
/** 经营执照凭证号码 */
|
||||
@ApiModelProperty(name = "经营执照凭证号码", value = "经营执照凭证号码")
|
||||
private String businessLincenseNumber;
|
||||
|
||||
/** 企业成立时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "企业成立时间", value = "企业成立时间")
|
||||
private Date estabinessDate;
|
||||
|
||||
/** 经营范围 */
|
||||
@ApiModelProperty(name = "经营范围", value = "经营范围")
|
||||
private String businessScope;
|
||||
|
||||
/** 注册地址 */
|
||||
@ApiModelProperty(name = "注册地址", value = "注册地址")
|
||||
private String address;
|
||||
|
||||
/** 企业联系方式 */
|
||||
@ApiModelProperty(name = "企业联系方式", value = "企业联系方式")
|
||||
private String contactPhone;
|
||||
|
||||
/** 公司邮箱 */
|
||||
@ApiModelProperty(name = "公司邮箱", value = "公司邮箱")
|
||||
private String email;
|
||||
|
||||
/** 企业当前状态 */
|
||||
@ApiModelProperty(name = "企业当前状态", value = "企业当前状态")
|
||||
private String status;
|
||||
|
||||
/** 企业入驻平台时期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "企业入驻平台时期", value = "企业入驻平台时期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 企业认证id */
|
||||
@ApiModelProperty(name = "企业认证id", value = "企业认证id")
|
||||
private Long certificationId;
|
||||
|
||||
/** 认证时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "认证时间", value = "认证时间")
|
||||
private Date authenticationDate;
|
||||
|
||||
/** 服务级别 */
|
||||
@ApiModelProperty(name = "服务级别", value = "服务级别")
|
||||
private Long serviceLevel;
|
||||
|
||||
/** 开通服务id */
|
||||
@ApiModelProperty(name = "开通服务id", value = "开通服务id")
|
||||
private Long openServerId;
|
||||
|
||||
/** 增值服务id */
|
||||
@ApiModelProperty(name = "增值服务id", value = "增值服务id")
|
||||
private Long addServerId;
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.muyu.net.working.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 企业信息对象 enterprise
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "EnterpriseQueryReq", description = "企业信息")
|
||||
public class EnterpriseQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 企业名称 */
|
||||
@ApiModelProperty(name = "企业名称", value = "企业名称")
|
||||
private String ebterpriseName;
|
||||
|
||||
/** 法定代表人 */
|
||||
@ApiModelProperty(name = "法定代表人", value = "法定代表人")
|
||||
private String legalPerson;
|
||||
|
||||
/** 经营执照凭证号码 */
|
||||
@ApiModelProperty(name = "经营执照凭证号码", value = "经营执照凭证号码")
|
||||
private String businessLincenseNumber;
|
||||
|
||||
/** 企业成立时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "企业成立时间", value = "企业成立时间")
|
||||
private Date estabinessDate;
|
||||
|
||||
/** 经营范围 */
|
||||
@ApiModelProperty(name = "经营范围", value = "经营范围")
|
||||
private String businessScope;
|
||||
|
||||
/** 注册地址 */
|
||||
@ApiModelProperty(name = "注册地址", value = "注册地址")
|
||||
private String address;
|
||||
|
||||
/** 企业联系方式 */
|
||||
@ApiModelProperty(name = "企业联系方式", value = "企业联系方式")
|
||||
private String contactPhone;
|
||||
|
||||
/** 公司邮箱 */
|
||||
@ApiModelProperty(name = "公司邮箱", value = "公司邮箱")
|
||||
private String email;
|
||||
|
||||
/** 企业当前状态 */
|
||||
@ApiModelProperty(name = "企业当前状态", value = "企业当前状态")
|
||||
private String status;
|
||||
|
||||
/** 企业入驻平台时期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "企业入驻平台时期", value = "企业入驻平台时期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 企业认证id */
|
||||
@ApiModelProperty(name = "企业认证id", value = "企业认证id")
|
||||
private Long certificationId;
|
||||
|
||||
/** 认证时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "认证时间", value = "认证时间")
|
||||
private Date authenticationDate;
|
||||
|
||||
/** 服务级别 */
|
||||
@ApiModelProperty(name = "服务级别", value = "服务级别")
|
||||
private Long serviceLevel;
|
||||
|
||||
/** 开通服务id */
|
||||
@ApiModelProperty(name = "开通服务id", value = "开通服务id")
|
||||
private Long openServerId;
|
||||
|
||||
/** 增值服务id */
|
||||
@ApiModelProperty(name = "增值服务id", value = "增值服务id")
|
||||
private Long addServerId;
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.net.working.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 企业信息对象 enterprise
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "EnterpriseSaveReq", description = "企业信息")
|
||||
public class EnterpriseSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private String id;
|
||||
|
||||
/** 企业名称 */
|
||||
|
||||
@ApiModelProperty(name = "企业名称", value = "企业名称")
|
||||
private String ebterpriseName;
|
||||
|
||||
/** 法定代表人 */
|
||||
|
||||
@ApiModelProperty(name = "法定代表人", value = "法定代表人")
|
||||
private String legalPerson;
|
||||
|
||||
/** 经营执照凭证号码 */
|
||||
|
||||
@ApiModelProperty(name = "经营执照凭证号码", value = "经营执照凭证号码")
|
||||
private String businessLincenseNumber;
|
||||
|
||||
/** 企业成立时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "企业成立时间", value = "企业成立时间")
|
||||
private Date estabinessDate;
|
||||
|
||||
/** 经营范围 */
|
||||
|
||||
@ApiModelProperty(name = "经营范围", value = "经营范围")
|
||||
private String businessScope;
|
||||
|
||||
/** 注册地址 */
|
||||
|
||||
@ApiModelProperty(name = "注册地址", value = "注册地址")
|
||||
private String address;
|
||||
|
||||
/** 企业联系方式 */
|
||||
|
||||
@ApiModelProperty(name = "企业联系方式", value = "企业联系方式")
|
||||
private String contactPhone;
|
||||
|
||||
/** 公司邮箱 */
|
||||
|
||||
@ApiModelProperty(name = "公司邮箱", value = "公司邮箱")
|
||||
private String email;
|
||||
|
||||
/** 企业当前状态 */
|
||||
|
||||
@ApiModelProperty(name = "企业当前状态", value = "企业当前状态")
|
||||
private String status;
|
||||
|
||||
/** 企业入驻平台时期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "企业入驻平台时期", value = "企业入驻平台时期")
|
||||
private Date registrationDate;
|
||||
|
||||
/** 企业认证id */
|
||||
|
||||
@ApiModelProperty(name = "企业认证id", value = "企业认证id")
|
||||
private Long certificationId;
|
||||
|
||||
/** 认证时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "认证时间", value = "认证时间")
|
||||
private Date authenticationDate;
|
||||
|
||||
/** 服务级别 */
|
||||
|
||||
@ApiModelProperty(name = "服务级别", value = "服务级别")
|
||||
private Long serviceLevel;
|
||||
|
||||
/** 开通服务id */
|
||||
|
||||
@ApiModelProperty(name = "开通服务id", value = "开通服务id")
|
||||
private Long openServerId;
|
||||
|
||||
/** 增值服务id */
|
||||
|
||||
@ApiModelProperty(name = "增值服务id", value = "增值服务id")
|
||||
private Long addServerId;
|
||||
|
||||
}
|
|
@ -20,6 +20,11 @@
|
|||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-net-working-common</artifactId>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.net.working;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 车联网运营平台启动类 MuYuNetWorkingApplication
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* Date 2024/5/26 21:45
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuNetWorkingApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuNetWorkingApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
package com.muyu.net.working.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.remote.RemoteSysDeptService;
|
||||
import com.muyu.system.remote.RemoteSysUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import com.muyu.net.working.domain.req.EnterpriseQueryReq;
|
||||
import com.muyu.net.working.domain.req.EnterpriseSaveReq;
|
||||
import com.muyu.net.working.domain.req.EnterpriseEditReq;
|
||||
import com.muyu.net.working.service.EnterpriseService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 企业信息Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Api(tags = "车辆运营平台")
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/car")
|
||||
public class EnterpriseController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private EnterpriseService enterpriseService;
|
||||
|
||||
@Autowired
|
||||
private RemoteSysDeptService remoteSysDeptService;
|
||||
|
||||
@Autowired
|
||||
private RemoteSysUserService remoteSysUserService;
|
||||
|
||||
/**
|
||||
* 查询车辆运营平台列表
|
||||
*/
|
||||
@ApiOperation("获取车辆运营平台列表")
|
||||
@RequiresPermissions("netWorking:car:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Enterprise>> list(EnterpriseQueryReq enterpriseQueryReq) {
|
||||
startPage();
|
||||
List<Enterprise> list = enterpriseService.list(Enterprise.queryBuild(enterpriseQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆运营平台列表
|
||||
*/
|
||||
@ApiOperation("导出车辆运营平台列表")
|
||||
@RequiresPermissions("netWorking:car:export")
|
||||
@Log(title = "车辆运营平台", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Enterprise enterprise) {
|
||||
List<Enterprise> list = enterpriseService.list(enterprise);
|
||||
ExcelUtil<Enterprise> util = new ExcelUtil<Enterprise>(Enterprise.class);
|
||||
util.exportExcel(response, list, "车辆运营平台数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆运营平台详细信息
|
||||
*/
|
||||
@ApiOperation("获取车辆运营平台详细信息")
|
||||
@RequiresPermissions("netWorking:car:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class)
|
||||
public Result<Enterprise> getInfo(@PathVariable("id") String id) {
|
||||
return Result.success(enterpriseService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车辆运营平台
|
||||
*/
|
||||
@RequiresPermissions("netWorking:car:add")
|
||||
@Log(title = "车辆运营平台", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增车辆运营平台")
|
||||
public Result<String> add(@RequestBody EnterpriseSaveReq enterpriseSaveReq) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
Result<SysDept> DeptList = remoteSysDeptService.selectDeptByName(enterpriseSaveReq.getEbterpriseName());
|
||||
SysDept sysDept = DeptList.getData();
|
||||
if(sysDept!=null){
|
||||
return Result.error("部门名称重复");
|
||||
}
|
||||
addDept(enterpriseSaveReq, sysUser);
|
||||
addUser(enterpriseSaveReq,sysUser);
|
||||
|
||||
return toAjax(enterpriseService.save(Enterprise.saveBuild(enterpriseSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加部门表信息
|
||||
* @param enterpriseSaveReq
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
public void addDept(EnterpriseSaveReq enterpriseSaveReq,SysUser sysUser){
|
||||
|
||||
SysDept DeptBuild = SysDept.builder()
|
||||
.deptName(enterpriseSaveReq.getEbterpriseName())
|
||||
.parentId(100L)
|
||||
.ancestors("0,100")
|
||||
.orderNum(2)
|
||||
.status("0")
|
||||
.createBy(sysUser.getUserName())
|
||||
.createTime(new Date())
|
||||
.leader(sysUser.getNickName())
|
||||
.phone(sysUser.getPhonenumber())
|
||||
.email(sysUser.getEmail())
|
||||
.delFlag("0")
|
||||
.build();
|
||||
remoteSysDeptService.add(DeptBuild);
|
||||
}
|
||||
|
||||
public void addUser(EnterpriseSaveReq enterpriseSaveReq,SysUser sysUser){
|
||||
Result<SysDept> sysDeptResult = remoteSysDeptService.selectDeptByName(enterpriseSaveReq.getEbterpriseName());
|
||||
SysDept sysDept = sysDeptResult.getData();
|
||||
SysUser UserBuild = SysUser.builder()
|
||||
.userName(enterpriseSaveReq.getEbterpriseName())
|
||||
.nickName(enterpriseSaveReq.getEbterpriseName())
|
||||
.password("123456")
|
||||
.deptId(sysDept.getDeptId())
|
||||
.email(enterpriseSaveReq.getEmail())
|
||||
.phonenumber(enterpriseSaveReq.getContactPhone())
|
||||
.status("0")
|
||||
.delFlag("0")
|
||||
.roleId(3L)
|
||||
.roleIds(new Long[]{3L})
|
||||
.createBy(sysUser.getUserName())
|
||||
.createTime(new Date())
|
||||
.remark(enterpriseSaveReq.getRemark())
|
||||
.build();
|
||||
remoteSysUserService.add(UserBuild);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆运营平台
|
||||
*/
|
||||
@RequiresPermissions("netWorking:car:edit")
|
||||
@Log(title = "车辆运营平台", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改车辆运营平台")
|
||||
public Result<String> edit(@PathVariable String id, @RequestBody EnterpriseEditReq enterpriseEditReq) {
|
||||
return toAjax(enterpriseService.updateById(Enterprise.editBuild(id,enterpriseEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆运营平台
|
||||
*/
|
||||
@RequiresPermissions("netWorking:car:remove")
|
||||
@Log(title = "车辆运营平台", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除车辆运营平台")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<String> ids) {
|
||||
|
||||
return toAjax(enterpriseService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.net.working.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
|
||||
/**
|
||||
* 企业信息Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
public interface EnterpriseMapper extends BaseMapper<Enterprise> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.net.working.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 企业信息Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
public interface EnterpriseService extends IService<Enterprise> {
|
||||
/**
|
||||
* 查询企业信息列表
|
||||
*
|
||||
* @param enterprise 企业信息
|
||||
* @return 企业信息集合
|
||||
*/
|
||||
public List<Enterprise> list(Enterprise enterprise);
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.muyu.net.working.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.net.working.mapper.EnterpriseMapper;
|
||||
import com.muyu.net.working.domain.Enterprise;
|
||||
import com.muyu.net.working.service.EnterpriseService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 企业信息Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterprise> implements EnterpriseService {
|
||||
|
||||
/**
|
||||
* 查询企业信息列表
|
||||
*
|
||||
* @param enterprise 企业信息
|
||||
* @return 企业信息
|
||||
*/
|
||||
@Override
|
||||
public List<Enterprise> list(Enterprise enterprise) {
|
||||
LambdaQueryWrapper<Enterprise> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getEbterpriseName())){
|
||||
queryWrapper.like(Enterprise::getEbterpriseName, enterprise.getEbterpriseName());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getLegalPerson())){
|
||||
queryWrapper.eq(Enterprise::getLegalPerson, enterprise.getLegalPerson());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getBusinessLincenseNumber())){
|
||||
queryWrapper.eq(Enterprise::getBusinessLincenseNumber, enterprise.getBusinessLincenseNumber());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getEstabinessDate())){
|
||||
queryWrapper.eq(Enterprise::getEstabinessDate, enterprise.getEstabinessDate());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getBusinessScope())){
|
||||
queryWrapper.eq(Enterprise::getBusinessScope, enterprise.getBusinessScope());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getAddress())){
|
||||
queryWrapper.eq(Enterprise::getAddress, enterprise.getAddress());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getContactPhone())){
|
||||
queryWrapper.eq(Enterprise::getContactPhone, enterprise.getContactPhone());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getEmail())){
|
||||
queryWrapper.eq(Enterprise::getEmail, enterprise.getEmail());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getStatus())){
|
||||
queryWrapper.eq(Enterprise::getStatus, enterprise.getStatus());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getRegistrationDate())){
|
||||
queryWrapper.eq(Enterprise::getRegistrationDate, enterprise.getRegistrationDate());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getCertificationId())){
|
||||
queryWrapper.eq(Enterprise::getCertificationId, enterprise.getCertificationId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getAuthenticationDate())){
|
||||
queryWrapper.eq(Enterprise::getAuthenticationDate, enterprise.getAuthenticationDate());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getServiceLevel())){
|
||||
queryWrapper.eq(Enterprise::getServiceLevel, enterprise.getServiceLevel());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getOpenServerId())){
|
||||
queryWrapper.eq(Enterprise::getOpenServerId, enterprise.getOpenServerId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(enterprise.getAddServerId())){
|
||||
queryWrapper.eq(Enterprise::getAddServerId, enterprise.getAddServerId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?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.muyu.net.working.mapper.EnterpriseMapper">
|
||||
|
||||
<resultMap type="com.muyu.net.working.domain.Enterprise" id="EnterpriseResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ebterpriseName" column="ebterprise_name" />
|
||||
<result property="legalPerson" column="legal_person" />
|
||||
<result property="businessLincenseNumber" column="business_lincense_number" />
|
||||
<result property="estabinessDate" column="estabiness_date" />
|
||||
<result property="businessScope" column="business_scope" />
|
||||
<result property="address" column="address" />
|
||||
<result property="contactPhone" column="contact_phone" />
|
||||
<result property="email" column="email" />
|
||||
<result property="status" column="status" />
|
||||
<result property="registrationDate" column="registration_date" />
|
||||
<result property="certificationId" column="certification_id" />
|
||||
<result property="authenticationDate" column="authentication_date" />
|
||||
<result property="serviceLevel" column="service_level" />
|
||||
<result property="openServerId" column="open_server_id" />
|
||||
<result property="addServerId" column="add_server_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEnterpriseVo">
|
||||
select id, ebterprise_name, legal_person, business_lincense_number, estabiness_date, business_scope, address, contact_phone, email, status, registration_date, certification_id, authentication_date, service_level, open_server_id, add_server_id, create_by, create_time, update_by, update_time, remark from enterprise
|
||||
</sql>
|
||||
</mapper>
|
|
@ -9,8 +9,10 @@
|
|||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-net-working</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<description>
|
||||
muyu-net-working车联网运营平台模块
|
||||
</description>
|
||||
<modules>
|
||||
<module>muyu-net-working-common</module>
|
||||
<module>muyu-net-working-server</module>
|
||||
|
@ -18,6 +20,8 @@
|
|||
<module>muyu-net-working-remote</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-net-working</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
|
|
@ -39,6 +39,12 @@ public class SysDeptController extends BaseController {
|
|||
return success(depts);
|
||||
}
|
||||
|
||||
@GetMapping("/selectDeptByName")
|
||||
public Result<SysDept> selectDeptByName (@RequestParam("name") String name) {
|
||||
SysDept sysDept = deptService.selectDeptByName(name);
|
||||
return Result.success(sysDept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
|
@ -50,6 +56,7 @@ public class SysDeptController extends BaseController {
|
|||
return success(depts);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*/
|
||||
|
|
|
@ -128,4 +128,7 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
|
||||
SysDept selectDeptByName(@Param("name") String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.system.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.remote.factory.RemoteSysDeptFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(
|
||||
contextId = "remoteSysDeptService",
|
||||
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallbackFactory = RemoteSysDeptFactory.class,
|
||||
path = "/dept"
|
||||
)
|
||||
public interface RemoteSysDeptService {
|
||||
|
||||
@GetMapping("/selectDeptByName")
|
||||
public Result<SysDept> selectDeptByName (@RequestParam("name") String name);
|
||||
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysDept dept);
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.system.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.remote.factory.RemoteSysUserFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(
|
||||
contextId = "remoteSysUserService",
|
||||
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallbackFactory = RemoteSysUserFactory.class,
|
||||
path = "/user"
|
||||
)
|
||||
public interface RemoteSysUserService {
|
||||
/**
|
||||
* 新增用户服务
|
||||
* @param user
|
||||
* @return Result
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysUser user);
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.remote.RemoteSysDeptService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* 远程调用部门熔断器 RemoteSysDeptFactory
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* Date 2024/6/7 09:00
|
||||
*/
|
||||
@Log4j2
|
||||
public class RemoteSysDeptFactory implements FallbackFactory<RemoteSysDeptService> {
|
||||
@Override
|
||||
public RemoteSysDeptService create(Throwable cause) {
|
||||
|
||||
return new RemoteSysDeptService() {
|
||||
/**
|
||||
* 查找部门列表
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<SysDept> selectDeptByName(String name) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加部门管理
|
||||
* @param dept
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result add(SysDept dept) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.remote.RemoteSysUserService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* 远程调用用户熔断器 RemoteSysUserFactory
|
||||
*
|
||||
* @author DeKangLiu
|
||||
* Date 2024/6/7 08:54
|
||||
*/
|
||||
public class RemoteSysUserFactory implements FallbackFactory<RemoteSysUserService> {
|
||||
|
||||
@Override
|
||||
public RemoteSysUserService create(Throwable cause) {
|
||||
return new RemoteSysUserService() {
|
||||
|
||||
/**
|
||||
* 新增用户服务
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result add(SysUser user) {
|
||||
return Result.error(cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -135,4 +135,7 @@ public interface SysDeptService extends IService<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
|
||||
SysDept selectDeptByName(String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -280,6 +280,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
return deptMapper.deleteDeptById(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysDept selectDeptByName(String name) {
|
||||
return deptMapper.selectDeptByName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
com.muyu.system.remote.factory.RemoteSysDeptFactory
|
||||
com.muyu.system.remote.factory.RemoteSysUserFactory
|
|
@ -180,4 +180,9 @@
|
|||
where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
<select id="selectDeptByName" resultType="com.muyu.common.system.domain.SysDept">
|
||||
select * from sys_dept where dept_name=#{name}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
<module>muyu-job</module>
|
||||
<module>muyu-file</module>
|
||||
<module>muyu-net-working</module>
|
||||
<module>muyu-customer-business</module>
|
||||
<module>cloud-modules-many-datasource</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue