数据处理模块新增
parent
96123ae891
commit
6e70e3f721
|
@ -29,8 +29,10 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -6,17 +6,20 @@ import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
|||
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
||||
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
||||
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
||||
import com.muyu.cloud.common.many.datasource.init.InitDataSource;
|
||||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||
import com.muyu.cloud.common.saas.domain.Datasource;
|
||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.common.system.domain.Datasource;
|
||||
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteSaaSService;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
|
@ -38,9 +41,14 @@ import java.util.Map;
|
|||
@Component
|
||||
@AutoConfiguration(before = {MybatisPlusAutoConfiguration.class, MybatisAutoConfiguration.class})
|
||||
public class ManyDataSource implements ApplicationRunner{
|
||||
|
||||
@Autowired
|
||||
private InitDataSource initDataSource;
|
||||
|
||||
|
||||
private List<EntInfo> dataSourceInfoList(){
|
||||
RemoteSaaSService remoteSaaSService = SpringUtils.getBean(RemoteSaaSService.class);
|
||||
Result<List<Datasource>> tableDataInfoResult = remoteSaaSService.findDatabaseList();
|
||||
Result<List<Datasource>> tableDataInfoResult = initDataSource.initDatasource();
|
||||
if (tableDataInfoResult==null){
|
||||
throw new SaaSException("saas远调数据源错误");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.cloud.common.many.datasource.init;
|
||||
|
||||
|
||||
import com.muyu.cloud.common.saas.domain.Datasource;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Log4j2
|
||||
public class InitDataSource {
|
||||
|
||||
public static final String USER="root";
|
||||
public static final String PASSWORD="Lw030106";
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public Result<List<Datasource>> initDatasource(){
|
||||
ArrayList<Datasource> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
|
||||
Connection connection= DriverManager.getConnection("jdbc:mysql://47.101.53.251:3306/datasource?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT&useSSL=false",USER,PASSWORD);
|
||||
String sql="select * from `datasource` ";
|
||||
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
|
||||
while (rs.next()){
|
||||
Datasource datasource = new Datasource();
|
||||
datasource.setId(rs.getInt("id"));
|
||||
datasource.setFirmName(rs.getString("firm_name"));
|
||||
datasource.setDatabaseName(rs.getString("database_name"));
|
||||
list.add(datasource);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return Result.success(list);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -86,6 +86,23 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-car</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-fence</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ package com.muyu.data;
|
|||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableMyFeignClients
|
||||
@EnableFeignClients
|
||||
public class DataApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataApplication.class,args);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.data.controller;
|
||||
|
||||
import com.muyu.data.service.DataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("data")
|
||||
public class DataController {
|
||||
|
||||
@Autowired
|
||||
private DataService dataService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.data.domian;
|
||||
|
||||
|
||||
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 jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("event")
|
||||
public class Event {
|
||||
|
||||
@TableId(value ="event_id" )
|
||||
@Excel(name = "事件id")
|
||||
private Integer eventId;
|
||||
|
||||
@Excel(name = "事件名称")
|
||||
private String eventName;
|
||||
|
||||
@Excel(name = "车辆vin")
|
||||
private String carVin;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.muyu.data.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DataMapper {
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.data.remote;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.req.SysCarReq;
|
||||
import com.muyu.domain.resp.SysCarVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "cloud-car")
|
||||
public interface RemoteCarService {
|
||||
|
||||
|
||||
@PostMapping("/car/selectSysCarVoList")
|
||||
public Result<List<SysCarVo>> selectSysCarVoList(
|
||||
@RequestBody SysCarReq sysCarReq);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.data.remote;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupListReq;
|
||||
import com.muyu.fence.domain.resp.GroupFenceListresp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "cloud-fence")
|
||||
public interface RemoteFenceService {
|
||||
|
||||
@PostMapping("/fence/selectGroupList")
|
||||
public Result<List<GroupFenceListresp>> selectGroupList(
|
||||
@RequestBody ElectronicFenceGroupListReq req);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.muyu.data.service;
|
||||
|
||||
public interface DataService {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.data.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DataServiceImpl {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.muyu.data.util;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.data.remote.RemoteCarService;
|
||||
import com.muyu.data.remote.RemoteFenceService;
|
||||
import com.muyu.domain.resp.SysCarVo;
|
||||
import com.muyu.fence.domain.resp.GroupFenceListresp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class InitDataRedis implements ApplicationRunner {
|
||||
|
||||
|
||||
@Resource
|
||||
private RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private RemoteCarService remoteCarService;
|
||||
@Autowired
|
||||
private RemoteFenceService remoteFenceService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
|
||||
//查询数控库中的车辆列表基本信息
|
||||
Result<List<SysCarVo>> sysCarVoListResult = remoteCarService.selectSysCarVoList(null);
|
||||
List<SysCarVo> sysCarVoList = sysCarVoListResult.getData();
|
||||
//将全部信息存入redis中
|
||||
for (SysCarVo sysCarVo : sysCarVoList) {
|
||||
String carVin = sysCarVo.getCarVin();
|
||||
redisTemplate.opsForValue().set("four:car:"+carVin,sysCarVo);
|
||||
}
|
||||
|
||||
//查询车辆围栏组列表信息
|
||||
Result<List<GroupFenceListresp>> groupListResult = remoteFenceService.selectGroupList(null);
|
||||
List<GroupFenceListresp> groupFenceList = groupListResult.getData();
|
||||
//将去全部信息存入redis中
|
||||
for (GroupFenceListresp groupFenceListresp : groupFenceList) {
|
||||
Long id = groupFenceListresp.getId();
|
||||
redisTemplate.opsForValue().set("four:fenceGroup:"+id,groupFenceListresp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.data.util;
|
||||
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
public class Receive {
|
||||
|
||||
public static MqttClient mqttClient= null;
|
||||
private static MemoryPersistence memoryPersistence=null;
|
||||
private static MqttConnectOptions mqttConnectOptions=null;
|
||||
|
||||
private static String ClientName="";
|
||||
|
||||
private static String IP="";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
public static void start(String clientId){
|
||||
//初始化连接设置对象
|
||||
mqttConnectOptions = new MqttConnectOptions();
|
||||
//设置是否情
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.data.util;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
|
||||
public class ReceiveTwo {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String topic = "vehicle";
|
||||
String broker = "tcp://47.101.53.251:1883";
|
||||
String clientId="lxy";
|
||||
|
||||
try {
|
||||
MqttClient mqttClient= new MqttClient(broker,clientId);
|
||||
MqttConnectOptions connectOptions=new MqttConnectOptions();
|
||||
connectOptions.setCleanSession(true);
|
||||
System.out.println("Connecting to broker:" + broker);
|
||||
mqttClient.connect(connectOptions);
|
||||
|
||||
System.out.println("已连接");
|
||||
|
||||
mqttClient.setCallback(new MqttCallback(){
|
||||
|
||||
|
||||
@Override
|
||||
public void connectionLost(Throwable throwable) {
|
||||
System.out.println("Connect lost!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||
System.out.println("Message arrived. topic:"+topic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mqttClient.subscribe(topic);
|
||||
System.out.println("Subscribed to topic " + topic);
|
||||
} catch (MqttException e) {
|
||||
System.out.println("reason "+e.getReasonCode());
|
||||
System.out.println("msg " +e.getMessage());
|
||||
System.out.println("loc " +e.getLocalizedMessage());
|
||||
System.out.println("cause "+e.getCause());
|
||||
System.out.println("excep "+e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -20,6 +20,8 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
public class ElectroicFenceListReq {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class CloudSystemApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudSystemApplication.class, args);
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudSystemApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param firm 用户名
|
||||
* @param
|
||||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
|
@ -105,7 +105,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
String databaseName = firm.getDatabaseName();
|
||||
String userName = firm.getUserName();
|
||||
|
||||
|
||||
String user="root";
|
||||
String password="Lw030106";
|
||||
SysUser sysUser=new SysUser();
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>cloud-saas</artifactId>
|
||||
|
||||
<description>
|
||||
cloud-saas
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<version>4.1.2</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>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 接口模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</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>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -1,19 +0,0 @@
|
|||
package com.muyu.saas;
|
||||
|
||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableMyFeignClients
|
||||
@MapperScan(value = "com.muyu.saas.mapper")
|
||||
public class SaasApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SaasApplication.class,args);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package com.muyu.saas.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.saas.domain.Datasource;
|
||||
import com.muyu.saas.service.SaasService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("saas")
|
||||
public class SaaSController {
|
||||
|
||||
@Autowired
|
||||
private SaasService saasService;
|
||||
|
||||
/**
|
||||
* 数据源查询
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("findDatabaseList")
|
||||
public Result<List<Datasource>> findDatabaseList(){
|
||||
List<Datasource> list=saasService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据源添加
|
||||
* @param datasource
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("addDatasource")
|
||||
public Result addDatasource(@RequestBody Datasource datasource){
|
||||
saasService.save(datasource);
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("updDatasource")
|
||||
public Result updDatasource(@RequestBody Datasource datasource){
|
||||
saasService.updateById(datasource);
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除成功
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("delDatasource/{id}")
|
||||
public Result delDatasource(@PathVariable("id") Integer id){
|
||||
saasService.removeById(id);
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package com.muyu.saas.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "datasource", autoResultMap = true)
|
||||
public class Datasource {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
public String firmName;
|
||||
|
||||
public String databaseName;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.muyu.saas.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.saas.domain.Datasource;
|
||||
|
||||
public interface SaaSMapper extends BaseMapper<Datasource> {
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.muyu.saas.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.saas.domain.Datasource;
|
||||
|
||||
public interface SaasService extends IService<Datasource> {
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package com.muyu.saas.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.saas.domain.Datasource;
|
||||
import com.muyu.saas.mapper.SaaSMapper;
|
||||
import com.muyu.saas.service.SaasService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SaasServiceImpl extends ServiceImpl<SaaSMapper,Datasource> implements SaasService {
|
||||
|
||||
@Autowired
|
||||
private SaaSMapper saaSMapper;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -1,56 +0,0 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9523
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: cloud-saas
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
config:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos.addr}
|
||||
# nacos用户名
|
||||
username: ${nacos.user-name}
|
||||
# nacos密码
|
||||
password: ${nacos.password}
|
||||
# 命名空间
|
||||
namespace: ${nacos.namespace}
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
# 系统共享配置
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# 系统环境Config共享配置
|
||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# xxl-job 配置文件
|
||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# rabbit 配置文件
|
||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-saas"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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>
|
|
@ -1,81 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-saas"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.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>
|
||||
|
||||
<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>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -1,81 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/cloud-saas"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.sky.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>
|
||||
|
||||
<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>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<Pattern>${log.sky.pattern}</Pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.muyu" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="GRPC_LOG"/>
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -1,8 +0,0 @@
|
|||
<?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.saas.mapper.SaaSMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -18,8 +18,7 @@
|
|||
<module>cloud-modules-wechat</module>
|
||||
<module>cloud-modules-breakdown</module>
|
||||
<module>cloud-modules-warn</module>
|
||||
<module>cloud-saas</module>
|
||||
<module>cloud-data</module>
|
||||
<module>cloud-data</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>cloud-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue