xushili 1 rok pred
commit
3cde152ef3
76 zmenil súbory, kde vykonal 3319 pridanie a 0 odobranie
  1. 39 0
      .gitignore
  2. 44 0
      build.gradle
  3. 17 0
      clientside/build.gradle
  4. 13 0
      clientside/src/main/java/com/gyee/clientside/ClientsideApp.java
  5. 30 0
      clientside/src/main/java/com/gyee/clientside/config/FilePathConfig.java
  6. 51 0
      clientside/src/main/java/com/gyee/clientside/config/MasterDSConfig.java
  7. 38 0
      clientside/src/main/java/com/gyee/clientside/config/MybatisPlusConfig.java
  8. 51 0
      clientside/src/main/java/com/gyee/clientside/config/MydbinfoDSConfig.java
  9. 51 0
      clientside/src/main/java/com/gyee/clientside/config/VacantDSConfig.java
  10. 68 0
      clientside/src/main/java/com/gyee/clientside/controller/MyUsersController.java
  11. 44 0
      clientside/src/main/java/com/gyee/clientside/controller/PermissionsController.java
  12. 37 0
      clientside/src/main/java/com/gyee/clientside/controller/RolePermissionsController.java
  13. 44 0
      clientside/src/main/java/com/gyee/clientside/controller/RolesController.java
  14. 142 0
      clientside/src/main/java/com/gyee/clientside/controller/TaosController.java
  15. 37 0
      clientside/src/main/java/com/gyee/clientside/controller/UserRolesController.java
  16. 59 0
      clientside/src/main/java/com/gyee/clientside/entity/MyUsers.java
  17. 45 0
      clientside/src/main/java/com/gyee/clientside/entity/Permissions.java
  18. 20 0
      clientside/src/main/java/com/gyee/clientside/entity/Point.java
  19. 59 0
      clientside/src/main/java/com/gyee/clientside/entity/RolePermissions.java
  20. 45 0
      clientside/src/main/java/com/gyee/clientside/entity/Roles.java
  21. 113 0
      clientside/src/main/java/com/gyee/clientside/entity/TaosEntity.java
  22. 59 0
      clientside/src/main/java/com/gyee/clientside/entity/UserRoles.java
  23. 44 0
      clientside/src/main/java/com/gyee/clientside/mapper/master/PointMapper.java
  24. 31 0
      clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/MyUsersMapper.java
  25. 16 0
      clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/PermissionsMapper.java
  26. 16 0
      clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/RolePermissionsMapper.java
  27. 16 0
      clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/RolesMapper.java
  28. 16 0
      clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/UserRolesMapper.java
  29. 30 0
      clientside/src/main/java/com/gyee/clientside/mapper/vacant/PointDBMapper.java
  30. 85 0
      clientside/src/main/java/com/gyee/clientside/result/Result.java
  31. 85 0
      clientside/src/main/java/com/gyee/clientside/result/ResultCode.java
  32. 93 0
      clientside/src/main/java/com/gyee/clientside/service/FileService.java
  33. 17 0
      clientside/src/main/java/com/gyee/clientside/service/IMyUsersService.java
  34. 16 0
      clientside/src/main/java/com/gyee/clientside/service/IPermissionsService.java
  35. 16 0
      clientside/src/main/java/com/gyee/clientside/service/IPointService.java
  36. 16 0
      clientside/src/main/java/com/gyee/clientside/service/IRolePermissionsService.java
  37. 16 0
      clientside/src/main/java/com/gyee/clientside/service/IRolesService.java
  38. 16 0
      clientside/src/main/java/com/gyee/clientside/service/IUserRolesService.java
  39. 179 0
      clientside/src/main/java/com/gyee/clientside/service/TaosService.java
  40. 28 0
      clientside/src/main/java/com/gyee/clientside/service/impl/MyUsersServiceImpl.java
  41. 20 0
      clientside/src/main/java/com/gyee/clientside/service/impl/PermissionsServiceImpl.java
  42. 20 0
      clientside/src/main/java/com/gyee/clientside/service/impl/PointServiceImpl.java
  43. 20 0
      clientside/src/main/java/com/gyee/clientside/service/impl/RolePermissionsServiceImpl.java
  44. 20 0
      clientside/src/main/java/com/gyee/clientside/service/impl/RolesServiceImpl.java
  45. 20 0
      clientside/src/main/java/com/gyee/clientside/service/impl/UserRolesServiceImpl.java
  46. 166 0
      clientside/src/main/java/com/gyee/clientside/util/FileUtils.java
  47. 69 0
      clientside/src/main/resources/application.yml
  48. 10 0
      feign/build.gradle
  49. 13 0
      feign/src/main/java/com/gyee/feign/FeignApp.java
  50. 16 0
      feign/src/main/java/com/gyee/feign/api/GetKeysApi.java
  51. 14 0
      feign/src/main/java/com/gyee/feign/api/Redis2TaosApi.java
  52. 11 0
      feign/src/main/resources/application.yml
  53. 1 0
      gateway/build.gradle
  54. 11 0
      gateway/src/main/java/com/gyee/gateway/GatewayApp.java
  55. 0 0
      gateway/src/main/resources/application.yml
  56. BIN
      gradle/wrapper/gradle-wrapper.jar
  57. 5 0
      gradle/wrapper/gradle-wrapper.properties
  58. 185 0
      gradlew
  59. 89 0
      gradlew.bat
  60. 8 0
      redisread/build.gradle
  61. 11 0
      redisread/src/main/java/com/gyee/redisread/RedisreadApp.java
  62. 47 0
      redisread/src/main/java/com/gyee/redisread/config/RedisConfig.java
  63. 73 0
      redisread/src/main/java/com/gyee/redisread/config/ThreadPoolTaskConfig.java
  64. 55 0
      redisread/src/main/java/com/gyee/redisread/controller/RedisController.java
  65. 113 0
      redisread/src/main/java/com/gyee/redisread/entity/TaosEntity.java
  66. 109 0
      redisread/src/main/java/com/gyee/redisread/service/ReadRedisService.java
  67. 49 0
      redisread/src/main/java/com/gyee/redisread/service/RedisService.java
  68. 129 0
      redisread/src/main/java/com/gyee/redisread/task/TaskRedisRead.java
  69. 8 0
      redisread/src/main/java/com/gyee/redisread/util/ChangedSave.java
  70. 44 0
      redisread/src/main/resources/application.yml
  71. 7 0
      settings.gradle
  72. 9 0
      taoswrite/build.gradle
  73. 13 0
      taoswrite/src/main/java/com/gyee/taoswrite/TaoswriteApp.java
  74. 49 0
      taoswrite/src/main/java/com/gyee/taoswrite/controller/TaosWriteController.java
  75. 12 0
      taoswrite/src/main/java/com/gyee/taoswrite/mapper/PointMapper.java
  76. 51 0
      taoswrite/src/main/resources/application.yml

+ 39 - 0
.gitignore

@@ -0,0 +1,39 @@
+HELP.md
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+/*.log
+/*.gz

+ 44 - 0
build.gradle

@@ -0,0 +1,44 @@
+plugins {
+    id 'java'
+    id 'org.springframework.boot' version '2.7.9'
+    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
+    id 'java-library'
+}
+
+version '1.0'
+
+allprojects {
+
+    repositories {
+        mavenLocal()
+        maven {
+            url 'https://maven.aliyun.com/repository/public/'
+        }
+        maven {
+            url 'https://maven.aliyun.com/repository/gradle-plugin/'
+        }
+        mavenCentral()
+    }
+
+    group = 'com.gyee'
+}
+
+subprojects {
+    apply plugin: 'org.springframework.boot'
+    apply plugin: 'io.spring.dependency-management'
+    apply plugin: 'java'
+    apply plugin: 'java-library'
+
+    dependencies {
+        implementation 'org.springframework.boot:spring-boot-starter'
+
+        compileOnly 'org.projectlombok:lombok'
+        annotationProcessor 'org.projectlombok:lombok'
+
+        testImplementation 'org.springframework.boot:spring-boot-starter-test'
+    }
+
+    test {
+        useJUnitPlatform()
+    }
+}

+ 17 - 0
clientside/build.gradle

@@ -0,0 +1,17 @@
+version '1.0'
+
+dependencies {
+    implementation project(':feign')
+    compileOnly 'org.projectlombok:lombok'
+    annotationProcessor 'org.projectlombok:lombok'
+
+    implementation 'xerces:xercesImpl:2.12.2'
+    implementation 'org.apache.poi:poi-ooxml:5.2.3'
+    implementation 'cn.hutool:hutool-poi:5.8.12'
+    implementation 'cn.hutool:hutool-core:5.8.13'
+    implementation 'com.taosdata.jdbc:taos-jdbcdriver:3.1.0'
+    implementation 'com.alibaba:druid:1.2.16'
+    implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.3.1'
+
+    implementation 'cn.hutool:hutool-jwt:5.8.16'
+}

+ 13 - 0
clientside/src/main/java/com/gyee/clientside/ClientsideApp.java

@@ -0,0 +1,13 @@
+package com.gyee.clientside;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@EnableFeignClients
+@SpringBootApplication(scanBasePackages = "com.gyee")
+public class ClientsideApp {
+    public static void main(String[] args) {
+        SpringApplication.run(ClientsideApp.class, args);
+    }
+}

+ 30 - 0
clientside/src/main/java/com/gyee/clientside/config/FilePathConfig.java

@@ -0,0 +1,30 @@
+package com.gyee.clientside.config;
+
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+@Component
+public class FilePathConfig {
+    private static String filePath;
+    private static String taosTemplatePath;
+
+    public static String getFilePath() {
+        if (filePath == null) {
+            ApplicationHome home = new ApplicationHome(FilePathConfig.class);
+            filePath = home.getSource().getParentFile().getAbsolutePath();
+        }
+        return filePath;
+    }
+
+    public static String getTaosInfoTablePath() {
+        if (taosTemplatePath == null) {
+            getFilePath();
+            taosTemplatePath = filePath + File.separator + "Taos更新表.xlsx";
+            File file = new File(taosTemplatePath);
+            if (!file.exists()) file.mkdirs();
+        }
+        return taosTemplatePath;
+    }
+}

+ 51 - 0
clientside/src/main/java/com/gyee/clientside/config/MasterDSConfig.java

@@ -0,0 +1,51 @@
+package com.gyee.clientside.config;
+
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import org.apache.ibatis.logging.stdout.StdOutImpl;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages = "com.gyee.clientside.mapper.master", sqlSessionFactoryRef = "masterSqlSessionFactory")
+public class MasterDSConfig {
+
+    @Bean(name = "master")
+    @Primary
+    @ConfigurationProperties("spring.datasource.druid.master")
+    public DataSource masterDataSource() {
+        return DataSourceBuilder.create().build();
+    }
+
+    @Bean(name = "masterSqlSessionFactory")
+    @Primary
+    public SqlSessionFactory masterSqlSessionFactory(@Qualifier("master") DataSource dataSource) throws Exception {
+        MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
+        sessionFactoryBean.setDataSource(dataSource);
+        MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
+        mybatisConfiguration.setLogImpl(StdOutImpl.class);
+        sessionFactoryBean.setConfiguration(mybatisConfiguration);
+        sessionFactoryBean.setMapperLocations(
+                new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/master/*.xml"));
+
+        return sessionFactoryBean.getObject();
+    }
+
+    @Bean("masterSqlSessionTemplate")
+    @Primary
+    public SqlSessionTemplate masterSqlSessionTemplate(
+            @Qualifier("masterSqlSessionFactory") SqlSessionFactory sessionFactory) {
+        return new SqlSessionTemplate(sessionFactory);
+    }
+
+}

+ 38 - 0
clientside/src/main/java/com/gyee/clientside/config/MybatisPlusConfig.java

@@ -0,0 +1,38 @@
+package com.gyee.clientside.config;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class MybatisPlusConfig {
+
+
+    /**
+     * mybatis 3.4.1 pagination config start
+     ***/
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
+        return interceptor;
+    }
+
+    //    @Bean
+    //    public ConfigurationCustomizer configurationCustomizer() {
+    //        return configuration -> configuration.setUseDeprecatedExecutor(false);
+    //    }
+
+/*    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+//        return new PaginationInterceptor();
+        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
+        //TODO: mybatis-plus do not support TDengine, use postgresql Dialect
+        paginationInterceptor.setDialectType("postgresql");
+
+        return paginationInterceptor;
+    }*/
+
+}

+ 51 - 0
clientside/src/main/java/com/gyee/clientside/config/MydbinfoDSConfig.java

@@ -0,0 +1,51 @@
+package com.gyee.clientside.config;
+
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import org.apache.ibatis.logging.stdout.StdOutImpl;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages = "com.gyee.clientside.mapper.mydbinfo", sqlSessionFactoryRef = "mydbinfoSqlSessionFactory")
+public class MydbinfoDSConfig {
+
+    @Bean(name = "mydbinfo")
+    @Primary
+    @ConfigurationProperties("spring.datasource.druid.mydbinfo")
+    public DataSource mydbinfoDataSource() {
+        return DataSourceBuilder.create().build();
+    }
+
+    @Bean(name = "mydbinfoSqlSessionFactory")
+    @Primary
+    public SqlSessionFactory mydbinfoSqlSessionFactory(@Qualifier("mydbinfo") DataSource dataSource) throws Exception {
+        MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
+        sessionFactoryBean.setDataSource(dataSource);
+        MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
+        mybatisConfiguration.setLogImpl(StdOutImpl.class);
+        sessionFactoryBean.setConfiguration(mybatisConfiguration);
+        sessionFactoryBean.setMapperLocations(
+                new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/mydbinfo/*.xml"));
+
+        return sessionFactoryBean.getObject();
+    }
+
+    @Bean("mydbinfoSqlSessionTemplate")
+    @Primary
+    public SqlSessionTemplate mydbinfoSqlSessionTemplate(
+            @Qualifier("mydbinfoSqlSessionFactory") SqlSessionFactory sessionFactory) {
+        return new SqlSessionTemplate(sessionFactory);
+    }
+
+}

+ 51 - 0
clientside/src/main/java/com/gyee/clientside/config/VacantDSConfig.java

@@ -0,0 +1,51 @@
+package com.gyee.clientside.config;
+
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import org.apache.ibatis.logging.stdout.StdOutImpl;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages = "com.gyee.clientside.mapper.vacant", sqlSessionFactoryRef = "vacantSqlSessionFactory")
+public class VacantDSConfig {
+
+    @Bean(name = "vacant")
+    @Primary
+    @ConfigurationProperties("spring.datasource.druid.vacant")
+    public DataSource masterDataSource() {
+        return DataSourceBuilder.create().build();
+    }
+
+    @Bean(name = "vacantSqlSessionFactory")
+    @Primary
+    public SqlSessionFactory vacantSqlSessionFactory(@Qualifier("vacant") DataSource dataSource) throws Exception {
+        MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
+        sessionFactoryBean.setDataSource(dataSource);
+        MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
+        mybatisConfiguration.setLogImpl(StdOutImpl.class);
+        sessionFactoryBean.setConfiguration(mybatisConfiguration);
+        sessionFactoryBean.setMapperLocations(
+                new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/vacant/*.xml"));
+
+        return sessionFactoryBean.getObject();
+    }
+
+    @Bean("vacantSqlSessionTemplate")
+    @Primary
+    public SqlSessionTemplate vacantSqlSessionTemplate(
+            @Qualifier("vacantSqlSessionFactory") SqlSessionFactory sessionFactory) {
+        return new SqlSessionTemplate(sessionFactory);
+    }
+
+}

+ 68 - 0
clientside/src/main/java/com/gyee/clientside/controller/MyUsersController.java

@@ -0,0 +1,68 @@
+package com.gyee.clientside.controller;
+
+import cn.hutool.jwt.JWT;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.clientside.entity.MyUsers;
+import com.gyee.clientside.result.Result;
+import com.gyee.clientside.result.ResultCode;
+import com.gyee.clientside.service.IMyUsersService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.nio.charset.StandardCharsets;
+import java.sql.Timestamp;
+import java.util.Map;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@RestController
+@RequestMapping("/myUsers")
+public class MyUsersController {
+
+    @Resource
+    private IMyUsersService userService;
+
+    @PostMapping("/login")
+    private JSONObject login(@RequestBody Map<String, String> user) {
+        String username = user.get("username");
+        QueryWrapper<MyUsers> wrapper = new QueryWrapper<>();
+        wrapper.eq("username", username);
+        MyUsers loginDTO = userService.getOne(wrapper);
+        if (loginDTO == null) return Result.error(ResultCode.USER_ACCOUNT_ERROR);
+        if (JWT.of(loginDTO.getToken()).verify())
+            return Result.successData(loginDTO);
+        return Result.error(ResultCode.USER_ACCOUNT_ERROR);
+    }
+
+    @PostMapping("/set")
+    private void set(@RequestBody Map<String, String> user) {
+        MyUsers ld = new MyUsers();
+        ld.setId(new Timestamp(System.currentTimeMillis()));
+        ld.setUsername(user.get("username"));
+        String token = JWT.create().setPayload("username", ld.getUsername())
+                .setKey(user.get("password").getBytes(StandardCharsets.UTF_8))
+                .sign();
+        ld.setToken(token);
+        userService.save(ld);
+    }
+
+    @GetMapping("/get")
+    private JSONObject get(String username) {
+        QueryWrapper<MyUsers> wrapper = new QueryWrapper<>();
+        wrapper.eq("username", username);
+        MyUsers one = userService.getOne(wrapper);
+        return Result.successData(one);
+    }
+
+    @GetMapping("/create")
+    private void create() {
+        userService.create();
+    }
+}

+ 44 - 0
clientside/src/main/java/com/gyee/clientside/controller/PermissionsController.java

@@ -0,0 +1,44 @@
+package com.gyee.clientside.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.clientside.entity.Permissions;
+import com.gyee.clientside.result.Result;
+import com.gyee.clientside.service.IPermissionsService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.sql.Timestamp;
+import java.util.Map;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@RestController
+@RequestMapping("/permissions")
+public class PermissionsController {
+
+    @Resource
+    private IPermissionsService permissionsService;
+
+    @PostMapping("/set")
+    private void set(@RequestBody Map<String, String> user) {
+        Permissions ld = new Permissions();
+        ld.setId(new Timestamp(System.currentTimeMillis()));
+        ld.setPermisname(user.get("permisname"));
+        permissionsService.save(ld);
+    }
+
+    @GetMapping("/get")
+    private JSONObject get(String permisname) {
+        QueryWrapper<Permissions> wrapper = new QueryWrapper<>();
+        wrapper.eq("permisname", permisname);
+        Permissions one = permissionsService.getOne(wrapper);
+        return Result.successData(one);
+    }
+}

+ 37 - 0
clientside/src/main/java/com/gyee/clientside/controller/RolePermissionsController.java

@@ -0,0 +1,37 @@
+package com.gyee.clientside.controller;
+
+import com.gyee.clientside.entity.RolePermissions;
+import com.gyee.clientside.service.IRolePermissionsService;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.sql.Timestamp;
+import java.util.Map;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@RestController
+@RequestMapping("/rolePermissions")
+public class RolePermissionsController {
+
+    @Resource
+    private IRolePermissionsService rolePermissionsService;
+
+    @PostMapping("/set")
+    private void set(@RequestBody Map<String, Timestamp> user) {
+        RolePermissions ur = new RolePermissions();
+        ur.setId(new Timestamp(System.currentTimeMillis()));
+        ur.setRoleid(user.get("roleid"));
+        ur.setPermisid(user.get("permisid"));
+        rolePermissionsService.save(ur);
+    }
+}

+ 44 - 0
clientside/src/main/java/com/gyee/clientside/controller/RolesController.java

@@ -0,0 +1,44 @@
+package com.gyee.clientside.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.clientside.entity.Roles;
+import com.gyee.clientside.result.Result;
+import com.gyee.clientside.service.IRolesService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.sql.Timestamp;
+import java.util.Map;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@RestController
+@RequestMapping("/roles")
+public class RolesController {
+
+    @Resource
+    private IRolesService rolesService;
+
+    @PostMapping("/set")
+    private void set(@RequestBody Map<String, String> user) {
+        Roles ld = new Roles();
+        ld.setId(new Timestamp(System.currentTimeMillis()));
+        ld.setRolename(user.get("rolename"));
+        rolesService.save(ld);
+    }
+
+    @GetMapping("/get")
+    private JSONObject get(String rolename) {
+        QueryWrapper<Roles> wrapper = new QueryWrapper<>();
+        wrapper.eq("rolename", rolename);
+        Roles one = rolesService.getOne(wrapper);
+        return Result.successData(one);
+    }
+}

+ 142 - 0
clientside/src/main/java/com/gyee/clientside/controller/TaosController.java

@@ -0,0 +1,142 @@
+package com.gyee.clientside.controller;
+
+import cn.hutool.poi.excel.ExcelReader;
+import cn.hutool.poi.excel.ExcelUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.clientside.config.FilePathConfig;
+import com.gyee.clientside.entity.Point;
+import com.gyee.clientside.entity.TaosEntity;
+import com.gyee.clientside.result.Result;
+import com.gyee.clientside.result.ResultCode;
+import com.gyee.clientside.service.FileService;
+import com.gyee.clientside.service.TaosService;
+import com.gyee.clientside.util.FileUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.util.StringUtil;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Slf4j
+@RestController()
+@RequestMapping("/taos")
+public class TaosController {
+
+    @Resource
+    private TaosService taosService;
+    @Resource
+    private FileService fileService;
+
+    //TODO 升级用mybatis-plus
+
+    @GetMapping("/create/database")
+    private JSONObject stableCreat() {
+        try {
+            taosService.createDataBase();
+            return Result.seccess("数据库创建成功!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error(ResultCode.ERROR_DATA);
+        }
+    }
+
+    @GetMapping("/create/supertable")
+    private JSONObject stableCreat(@RequestParam(value = "aiSTablename", required = false) String aiSTablename,
+                                   @RequestParam(value = "diSTablename", required = false) String diSTablename) {
+        try {
+            boolean b = taosService.createStables(aiSTablename, diSTablename);
+            if (b) return Result.seccess("超级表创建成功!");
+            return Result.error(ResultCode.ERROR_DATA);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error(ResultCode.ERROR_DATA);
+        }
+    }
+
+    @GetMapping("/create/table")
+    private JSONObject tableCreat() {
+        try {
+            int tables = taosService.createTables();
+            if (tables > 0) Result.seccess("点表创建成功!个数:" + tables);
+            return Result.error();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error();
+        }
+    }
+
+    @GetMapping("/template")
+    private void getTemplate(HttpServletResponse response) {
+        FileUtils.download(FilePathConfig.getFilePath() + File.separator + "Taos更新模板.xlsx", response);
+    }
+
+    @PostMapping("/uploadexcel")
+    private JSONObject uploadExcel(@RequestBody MultipartFile excelFile) {
+        List<TaosEntity> entities = new ArrayList<>();
+        //IOUtils.setByteArrayMaxOverride(500000000);
+
+        try {
+            FileUtils.write2File(excelFile.getInputStream());
+            entities = fileService.getTaosEntitys();
+            //ExcelReader reader = ExcelUtil.getReader(FilePathConfig.getTaosInfoTablePath());
+            //entities = reader.read(1, 2, TaosEntity.class);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.info("excel读取失败!");
+            return Result.error(4000, "excel读取失败!");
+        }
+
+        entities = entities.stream().map(te -> {
+            te.setPoint(te.getPoint().replaceFirst("\\.", "_"));
+            return te;
+        }).collect(Collectors.toList());
+        //redisService.creatTables(entities);
+
+        try {
+            taosService.createTablesByExcel(entities);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error(4000, "建表或者修改Tag失败!");
+        }
+        return Result.success();
+    }
+
+    @GetMapping("/tables")
+    private JSONObject getTables(@RequestParam("stablename") String stablename,
+                                 @RequestParam(value = "station", required = false) String station,
+                                 @RequestParam(value = "point", required = false) String point,
+                                 @RequestParam(value = "description", required = false) String description,
+                                 @RequestParam(value = "uniformcode", required = false) String uniformcode,
+                                 @RequestParam(value = "pageNum", required = false) Integer pageNum,
+                                 @RequestParam(value = "pageSize", required = false) Integer pageSize) {
+        if (pageNum == null || pageSize == null) {
+            pageNum = 1;
+            pageSize = 100;
+        }
+        Page<Point> page = new Page<>(pageNum, pageSize);
+
+        QueryWrapper wrapper = new QueryWrapper<>();
+        wrapper.eq(StringUtil.isNotBlank(station), "station", station)
+                .like(StringUtil.isNotBlank(point), "tbname", point)
+                .like(StringUtil.isNotBlank(description), "description", description)
+                .eq(StringUtil.isNotBlank(uniformcode), "uniformcode", uniformcode);
+
+        List<Point> points = null;
+        try {
+            points = taosService.selectPage(page, stablename, wrapper);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error(ResultCode.ERROR_DATA);
+        }
+
+        return Result.successData(points);
+    }
+}

+ 37 - 0
clientside/src/main/java/com/gyee/clientside/controller/UserRolesController.java

@@ -0,0 +1,37 @@
+package com.gyee.clientside.controller;
+
+import com.gyee.clientside.entity.UserRoles;
+import com.gyee.clientside.service.IUserRolesService;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.sql.Timestamp;
+import java.util.Map;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@RestController
+@RequestMapping("/userRoles")
+public class UserRolesController {
+
+    @Resource
+    private IUserRolesService userRolesService;
+
+    @PostMapping("/set")
+    private void set(@RequestBody Map<String, Timestamp> user) {
+        UserRoles ur = new UserRoles();
+        ur.setId(new Timestamp(System.currentTimeMillis()));
+        ur.setUserid(user.get("userid"));
+        ur.setRoleid(user.get("roleid"));
+        userRolesService.save(ur);
+    }
+}

+ 59 - 0
clientside/src/main/java/com/gyee/clientside/entity/MyUsers.java

@@ -0,0 +1,59 @@
+package com.gyee.clientside.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@TableName("my_users")
+public class MyUsers implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Timestamp id;
+
+    private String username;
+
+    private String token;
+
+    public Timestamp getId() {
+        return id;
+    }
+
+    public void setId(Timestamp id) {
+        this.id = id;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    @Override
+    public String toString() {
+        return "MyUsers{" +
+                "id = " + id +
+                ", username = " + username +
+                ", token = " + token +
+                "}";
+    }
+}

+ 45 - 0
clientside/src/main/java/com/gyee/clientside/entity/Permissions.java

@@ -0,0 +1,45 @@
+package com.gyee.clientside.entity;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public class Permissions implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Timestamp id;
+
+    private String permisname;
+
+    public Timestamp getId() {
+        return id;
+    }
+
+    public void setId(Timestamp id) {
+        this.id = id;
+    }
+
+    public String getPermisname() {
+        return permisname;
+    }
+
+    public void setPermisname(String permisname) {
+        this.permisname = permisname;
+    }
+
+    @Override
+    public String toString() {
+        return "Permissions{" +
+                "id = " + id +
+                ", permisname = " + permisname +
+                "}";
+    }
+}

+ 20 - 0
clientside/src/main/java/com/gyee/clientside/entity/Point.java

@@ -0,0 +1,20 @@
+package com.gyee.clientside.entity;
+
+import lombok.Data;
+
+import java.sql.Timestamp;
+
+@Data
+public class Point {
+    private String point;
+    private Timestamp ts;
+    private Object val;
+
+    private String description;
+    private String station;
+    private String category;
+    private String facility;
+    private String uniformcode;
+    private Float rate;
+    private String remark;
+}

+ 59 - 0
clientside/src/main/java/com/gyee/clientside/entity/RolePermissions.java

@@ -0,0 +1,59 @@
+package com.gyee.clientside.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@TableName("role_permissions")
+public class RolePermissions implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Timestamp id;
+
+    private Timestamp roleid;
+
+    private Timestamp permisid;
+
+    public Timestamp getId() {
+        return id;
+    }
+
+    public void setId(Timestamp id) {
+        this.id = id;
+    }
+
+    public Timestamp getRoleid() {
+        return roleid;
+    }
+
+    public void setRoleid(Timestamp roleid) {
+        this.roleid = roleid;
+    }
+
+    public Timestamp getPermisid() {
+        return permisid;
+    }
+
+    public void setPermisid(Timestamp permisid) {
+        this.permisid = permisid;
+    }
+
+    @Override
+    public String toString() {
+        return "RolePermissions{" +
+                "id = " + id +
+                ", roleid = " + roleid +
+                ", permisid = " + permisid +
+                "}";
+    }
+}

+ 45 - 0
clientside/src/main/java/com/gyee/clientside/entity/Roles.java

@@ -0,0 +1,45 @@
+package com.gyee.clientside.entity;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public class Roles implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Timestamp id;
+
+    private String rolename;
+
+    public Timestamp getId() {
+        return id;
+    }
+
+    public void setId(Timestamp id) {
+        this.id = id;
+    }
+
+    public String getRolename() {
+        return rolename;
+    }
+
+    public void setRolename(String rolename) {
+        this.rolename = rolename;
+    }
+
+    @Override
+    public String toString() {
+        return "Roles{" +
+                "id = " + id +
+                ", rolename = " + rolename +
+                "}";
+    }
+}

+ 113 - 0
clientside/src/main/java/com/gyee/clientside/entity/TaosEntity.java

@@ -0,0 +1,113 @@
+package com.gyee.clientside.entity;
+
+public class TaosEntity {
+    private String point;
+    private String description;
+    private String station;
+    private String category;
+    private String facility;
+    private String uniformcode;
+    private Float rate;
+    private String remark;
+    private String datatype;
+
+    public String getPoint() {
+        return point;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getStation() {
+        return station;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public String getFacility() {
+        return facility;
+    }
+
+    public String getUniformcode() {
+        return uniformcode;
+    }
+
+    public Float getRate() {
+        return rate;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public String getDatatype() {
+        return datatype;
+    }
+
+    public void setPoint(String point) {
+        this.point = point;
+    }
+
+    public void setDescription(Object description) {
+        if (description == null) {
+            this.description = "";
+        } else {
+            this.description = description.toString();
+        }
+    }
+
+    public void setStation(Object station) {
+        if (station == null) {
+            this.station = "";
+        } else {
+            this.station = station.toString();
+        }
+    }
+
+    public void setCategory(Object category) {
+        if (category == null) {
+            this.category = "";
+        } else {
+            this.category = category.toString();
+        }
+    }
+
+    public void setFacility(Object facility) {
+        if (facility == null) {
+            this.facility = "";
+        } else {
+            this.facility = facility.toString();
+        }
+    }
+
+    public void setUniformcode(Object uniformcode) {
+        if (uniformcode == null) {
+            this.uniformcode = "";
+        } else {
+            this.uniformcode = uniformcode.toString();
+        }
+    }
+
+    public void setRate(Object rate) {
+        if (rate == null || rate.equals("")) {
+            this.rate = 1f;
+        } else {
+            this.rate = Float.valueOf(rate.toString());
+        }
+    }
+
+    public void setRemark(Object remark) {
+        if (remark == null) {
+            this.remark = "";
+        } else {
+            this.remark = remark.toString();
+        }
+    }
+
+    public void setDatatype(String datatype) {
+        this.datatype = datatype;
+    }
+}

+ 59 - 0
clientside/src/main/java/com/gyee/clientside/entity/UserRoles.java

@@ -0,0 +1,59 @@
+package com.gyee.clientside.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@TableName("user_roles")
+public class UserRoles implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Timestamp id;
+
+    private Timestamp userid;
+
+    private Timestamp roleid;
+
+    public Timestamp getId() {
+        return id;
+    }
+
+    public void setId(Timestamp id) {
+        this.id = id;
+    }
+
+    public Timestamp getUserid() {
+        return userid;
+    }
+
+    public void setUserid(Timestamp userid) {
+        this.userid = userid;
+    }
+
+    public Timestamp getRoleid() {
+        return roleid;
+    }
+
+    public void setRoleid(Timestamp roleid) {
+        this.roleid = roleid;
+    }
+
+    @Override
+    public String toString() {
+        return "UserRoles{" +
+                "id = " + id +
+                ", userid = " + userid +
+                ", roleid = " + roleid +
+                "}";
+    }
+}

+ 44 - 0
clientside/src/main/java/com/gyee/clientside/mapper/master/PointMapper.java

@@ -0,0 +1,44 @@
+package com.gyee.clientside.mapper.master;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gyee.clientside.entity.Point;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+public interface PointMapper extends BaseMapper<Point> {
+
+    @Select("SELECT DISTINCT station FROM #{stbname}")
+    List<String> selectStation(String stbname);
+
+    @Select("SELECT table_name FROM INFORMATION_SCHEMA.INS_TABLES where stable_name=#{stablename} limit #{startindex},#{endindex}")
+    List<String> selectTableName(@Param("stablename") String stablename, @Param("startindex") int startindex, @Param("endindex") int endindex);
+
+    @Select("SELECT tbname as point,description,ts,val,station,category,facility,uniformcode,rate,remark FROM ${stablename} ${ew.customSqlSegment}")
+    List<Point> selectTableNamesPage(IPage<Point> page, @Param("stablename") String stablename, @Param("ew") Wrapper wrapper);
+
+    @Update("DROP TABLE ${tablename}")
+    void deleteTable(String tablename);
+
+    @Select("SELECT * FROM ${tablename} ${ew.customSqlSegment}")
+    List<Point> selectTableValPage(IPage<Point> page, @Param("tablename") String tablename, @Param("ew") Wrapper wrapper);
+
+    @Update("CREATE STABLE IF NOT EXISTS #{stableName}(ts timestamp,val ${valueType}) TAGS (description nchar(100),station binary(20),category binary(20),facility binary(20),uniformcode binary(20),rate float,remark binary(30))")
+    int createSuperTable(@Param("stableName") String stableName, @Param("valueType") String valueType);
+
+    @Update("CREATE TABLE IF NOT EXISTS #{tableName} USING ${stableName} TAGS (${description},${station},${category},${facility},${uniformcode},${rate},${remark})")
+    int createTable(@Param("tableName") String tableName, @Param("stableName") String stableName, @Param("description") String description, @Param("station") String station, @Param("category") String category, @Param("facility") String facility, @Param("uniformcode") String uniformcode, @Param("rate") float rate, @Param("remark") String remark);
+
+    @Update("${sql}")
+    void runSql(String sql);
+
+    @Update("ALTER TABLE ${tableName} SET TAG ${tagName}='${tagValue}'")
+    void alterTag(@Param("tableName") String tableName, @Param("tagName") String tagName, @Param("tagValue") String tagValue);
+
+    @Update("ALTER TABLE ${tableName} SET TAG ${tagName}=${tagValue}")
+    void alterTagNum(@Param("tableName") String tableName, @Param("tagName") String tagName, @Param("tagValue") Float tagValue);
+}

+ 31 - 0
clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/MyUsersMapper.java

@@ -0,0 +1,31 @@
+package com.gyee.clientside.mapper.mydbinfo;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.clientside.entity.MyUsers;
+import org.apache.ibatis.annotations.Update;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface MyUsersMapper extends BaseMapper<MyUsers> {
+
+    @Update("CREATE TABLE IF NOT EXISTS mydbinfo.my_users (id timestamp,username nchar(30),token binary(256))")
+    void createUsersTable();
+
+    @Update("CREATE TABLE IF NOT EXISTS mydbinfo.roles (id timestamp,rolename nchar(30))")
+    void createRolesTable();
+
+    @Update("CREATE TABLE IF NOT EXISTS mydbinfo.user_roles (id timestamp,userid timestamp,roleid timestamp)")
+    void createUserRolesTable();
+
+    @Update("CREATE TABLE IF NOT EXISTS mydbinfo.permissions (id timestamp,permisname nchar(30))")
+    void createPermissionsTable();
+
+    @Update("CREATE TABLE IF NOT EXISTS mydbinfo.role_permissions (id timestamp,roleid timestamp,permisid timestamp)")
+    void createRolePermissionsTable();
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/PermissionsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.mapper.mydbinfo;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.clientside.entity.Permissions;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface PermissionsMapper extends BaseMapper<Permissions> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/RolePermissionsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.mapper.mydbinfo;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.clientside.entity.RolePermissions;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface RolePermissionsMapper extends BaseMapper<RolePermissions> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/RolesMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.mapper.mydbinfo;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.clientside.entity.Roles;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface RolesMapper extends BaseMapper<Roles> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/mapper/mydbinfo/UserRolesMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.mapper.mydbinfo;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.clientside.entity.UserRoles;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface UserRolesMapper extends BaseMapper<UserRoles> {
+
+}

+ 30 - 0
clientside/src/main/java/com/gyee/clientside/mapper/vacant/PointDBMapper.java

@@ -0,0 +1,30 @@
+package com.gyee.clientside.mapper.vacant;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.clientside.entity.Point;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Update;
+
+import java.sql.Timestamp;
+
+public interface PointDBMapper extends BaseMapper<Point> {
+
+    @Update("CREATE DATABASE IF NOT EXISTS ${dbname} ${ew.customSqlSegment}")
+    int createDataBase(String dbname, @Param("ew") Wrapper wrapper);
+
+    @Update("CREATE TABLE IF NOT EXISTS #{tbName} USING #{stbName} TAGS(#{description},#{station},#{category},#{equipment},#{uniformcode},#{rate},#{remark})")
+    int createTable(@Param("tbName") String tbName, @Param("stbName") String stbName, @Param("description") String description, @Param("station") String station, @Param("category") String category, @Param("equipment") String equipment, @Param("uniformcode") String uniformcode, @Param("rate") float rate, @Param("remark") String remark);
+
+    @Update("DROP TABLE IF EXISTS #{tbname}")
+    void dropTable(String tbname);
+
+    @Insert("INSERT INTO #{tbname}(ts, val) values(#{ts}, #{val})")
+    int insertOne(@Param("tbname") String tbname, @Param("ts") Timestamp ts, @Param("val") Double val);
+
+    @Update("ALTER TABLE #{point} SET TAG description=#{description},station=#{station},category=#{category},equipment=#{equipment},uniformcode=#{uniformcode},rate=#{rate},remark=#{remark}")
+        //int alterTags(@Param("tbName") String tbName, @Param("description") String description, @Param("station") String station, @Param("category") String category, @Param("equipment") String equipment, @Param("uniformcode") String uniformcode, @Param("rate") float rate, @Param("remark") String remark);
+    int alterTags(Point entity);
+
+}

+ 85 - 0
clientside/src/main/java/com/gyee/clientside/result/Result.java

@@ -0,0 +1,85 @@
+package com.gyee.clientside.result;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class Result implements Serializable {
+
+    private Integer code;
+    private String message;
+    private Object data;
+
+    public static JSONObject error() {
+        JSONObject json = new JSONObject();
+        json.put("code", ResultCode.ERROR.getCode());
+        json.put("msg", ResultCode.ERROR.getMessage());
+        return json;
+    }
+
+    public static JSONObject error(ResultCode resultCode) {
+        JSONObject json = new JSONObject();
+        json.put("code", resultCode.getCode());
+        json.put("msg", resultCode.getMessage());
+        return json;
+    }
+
+    public static JSONObject error(ResultCode resultCode, String message) {
+        JSONObject json = new JSONObject();
+        json.put("code", resultCode.getCode());
+        json.put("msg", resultCode.getMessage() + "," + message);
+        return json;
+    }
+
+    public static JSONObject error(int code, String message) {
+        JSONObject json = new JSONObject();
+        json.put("code", code);
+        json.put("msg", message);
+        return json;
+    }
+
+    public static JSONObject success() {
+        JSONObject json = new JSONObject();
+        json.put("code", ResultCode.SUCCESS.getCode());
+        json.put("msg", ResultCode.SUCCESS.getMessage());
+        return json;
+    }
+
+    public static JSONObject seccess(int code, String message) {
+        JSONObject json = new JSONObject();
+        json.put("code", code);
+        json.put("msg", message);
+        return json;
+    }
+
+    public static JSONObject seccess(String message) {
+        JSONObject json = new JSONObject();
+        json.put("code", 200);
+        json.put("msg", message);
+        return json;
+    }
+
+    public static JSONObject success(ResultCode resultCode) {
+        JSONObject json = new JSONObject();
+        json.put("code", resultCode.getCode());
+        json.put("msg", resultCode.getMessage());
+        return json;
+    }
+
+    public static JSONObject successData(ResultCode code, Object data) {
+        JSONObject json = new JSONObject();
+        json.put("code", code.getCode());
+        json.put("msg", code.getMessage());
+        json.put("data", data == null ? new JSONObject() : data);
+        return json;
+    }
+
+    public static JSONObject successData(Object data) {
+        JSONObject json = new JSONObject();
+        json.put("code", 200);
+        json.put("data", data == null ? new JSONObject() : data);
+        return json;
+    }
+}

+ 85 - 0
clientside/src/main/java/com/gyee/clientside/result/ResultCode.java

@@ -0,0 +1,85 @@
+package com.gyee.clientside.result;
+
+/*
+ * #1001~1999 区间表示参数错误
+ * #2001~2999 区间表示用户错误
+ * #3001~3999 区间表示权限异常
+ */
+
+public enum ResultCode {
+    /* 成功 */
+    SUCCESS(200, "成功"),
+
+    /* 默认失败 */
+    ERROR(4000, "失败"),
+    ERROR_FILE_NO(4001, "文件未找到"),
+    ERROR_FILE_TYPE(4002, "文件类型不正确"),
+    ERROR_FILE_DATA(4003, "数据为空"),
+    ERROR_DATA_TYPE(4004, "数据格式不正确"),
+    ERROR_CONNECT(4005, "数据库连接异常"),
+    ERROR_DATA(4006, "数据库操作失败"),
+    ERROR_DATA_REPEAT(4007, "数据已存在"),
+    ERROR_MODEL(4008, "同场站不同机型至少启用一个模型"),
+    ERROR_SQL(4009, "sql语法不正确"),
+    ERROR_UNSUPPORTED_SQL(4010, "不支持的sql语句"),
+
+
+    /* 参数错误:1000~1999 */
+    PARAM_NOT_VALID(1001, "参数无效"),
+    PARAM_IS_BLANK(1002, "参数为空"),
+    PARAM_TYPE_ERROR(1003, "参数类型错误"),
+    PARAM_NOT_COMPLETE(1004, "参数缺失"),
+    ERROR_DATA_DIR(1005, "目录创建失败"),
+    ERROR_DATA_FILE(1006, "文件上传失败"),
+
+    /* 用户错误 */
+    USER_NOT_LOGIN(2001, "用户未登录"),
+    USER_ACCOUNT_ERROR(2002, "账号或密码错误"),
+    USER_FAIL_LOGIN(2003, "登录失败"),
+    USER_OUT_LOGIN(2004, "登出成功"),
+    USER_ERROR_TOKEN(2005, "登录已过期,请重新登录"),
+
+    /* 业务错误 */
+    NO_PERMISSION(3001, "没有权限"),
+    ERROR_ENABLE(3002, "模型为启用状态,不允许删除"),
+    ERROR_TASK(3003, "有正在进行的任务,请稍后在试");
+
+    private Integer code;
+    private String message;
+
+    ResultCode(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    /**
+     * 根据code获取message
+     *
+     * @param code
+     * @return
+     */
+    public static String getMessageByCode(Integer code) {
+        for (ResultCode ele : values()) {
+            if (ele.getCode().equals(code)) {
+                return ele.getMessage();
+            }
+        }
+        return null;
+    }
+}

+ 93 - 0
clientside/src/main/java/com/gyee/clientside/service/FileService.java

@@ -0,0 +1,93 @@
+package com.gyee.clientside.service;
+
+import cn.hutool.poi.excel.ExcelUtil;
+import cn.hutool.poi.excel.sax.handler.RowHandler;
+import com.gyee.clientside.config.FilePathConfig;
+import com.gyee.clientside.entity.TaosEntity;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@Service
+public class FileService {
+
+/*    @Autowired
+    private TaosConfig taosConfig;
+
+    private List<StringBuilder> sbList = new ArrayList<>();
+    private String s0 = null;
+    private int i = 0;
+    private String substring = null;
+
+    private StringBuilder sb = new StringBuilder();
+    private String type = null;*/
+
+    private TaosEntity taosEntity;
+    private List<TaosEntity> taosEntitys = new ArrayList<>();
+
+    public List<TaosEntity> getTaosEntitys() throws Exception {
+        if (taosEntitys.size() == 0) {
+            ExcelUtil.readBySax(FilePathConfig.getTaosInfoTablePath(), 0, createRowHandler());
+            log.info("Excel加载完毕!");
+            //XSSFWorkbook workbook = new XSSFWorkbook(excelPath);
+            //List<TaosEntity> entities = FileUtils.excel2Entity(workbook);
+            //taosEntitys.addAll(entities);
+            //ExcelReader reader = ExcelUtil.getReader(FilePathConfig.getTaosInfoTablePath());
+            //taosEntitys = reader.read(1, 2, TaosEntity.class);
+        }
+        return taosEntitys;
+    }
+
+    private RowHandler createRowHandler() {
+        return new RowHandler() {
+            @Override
+            public void handle(int sheetIndex, long rowIndex, List<Object> rowlist) {
+                taosEntity = new TaosEntity();
+                if (rowIndex < 2) {
+                    log.info("Excel读取完毕!");
+                    //sbList.add(sb);
+                    //sb.append("create table");
+                    return;
+                }
+                try {
+                    taosEntity.setPoint(rowlist.get(0).toString());
+                    taosEntity.setDescription(rowlist.get(1));
+                    taosEntity.setStation(rowlist.get(2));
+                    taosEntity.setCategory(rowlist.get(3));
+                    taosEntity.setFacility(rowlist.get(4));
+                    taosEntity.setUniformcode(rowlist.get(5));
+                    taosEntity.setRate(rowlist.get(6));
+                    taosEntity.setRemark(rowlist.get(7));
+                    taosEntity.setDatatype(rowlist.get(8).toString());
+                    taosEntitys.add(taosEntity);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    System.out.println(taosEntitys);
+                }
+
+                /*if (rowIndex % 2999 == 0) {
+                    sb = new StringBuilder();
+                    sbList.add(sb);
+                    sb.append("create table");
+                }
+                if ("double".equals(rowlist.get(7))) {
+                    type = taosConfig.getAIStableName();
+                } else {
+                    type = taosConfig.getDIStableName();
+                }
+                s0 = rowlist.get(0).toString();
+                i = s0.indexOf(".");
+                substring = s0.substring(i + 1);
+                sb.append(" if not exists ").append(taosConfig.getDbName()).append(".").append(substring).append(" using ")
+                        .append(taosConfig.getDbName()).append(".").append(type).append(" tags('").append(rowlist.get(1)).append("','")
+                        .append(rowlist.get(2)).append("','").append(rowlist.get(3)).append("','").append(rowlist.get(4)).append("','")
+                        .append(rowlist.get(5)).append("','").append(rowlist.get(6)).append("','").append(s0.substring(0, i < 0 ? 0 : i))
+                        .append("')");
+                point.add(substring);*/
+            }
+        };
+    }
+}

+ 17 - 0
clientside/src/main/java/com/gyee/clientside/service/IMyUsersService.java

@@ -0,0 +1,17 @@
+package com.gyee.clientside.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.clientside.entity.MyUsers;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface IMyUsersService extends IService<MyUsers> {
+
+    void create();
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/service/IPermissionsService.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.clientside.entity.Permissions;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface IPermissionsService extends IService<Permissions> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/service/IPointService.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.clientside.entity.Point;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface IPointService extends IService<Point> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/service/IRolePermissionsService.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.clientside.entity.RolePermissions;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface IRolePermissionsService extends IService<RolePermissions> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/service/IRolesService.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.clientside.entity.Roles;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface IRolesService extends IService<Roles> {
+
+}

+ 16 - 0
clientside/src/main/java/com/gyee/clientside/service/IUserRolesService.java

@@ -0,0 +1,16 @@
+package com.gyee.clientside.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.clientside.entity.UserRoles;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+public interface IUserRolesService extends IService<UserRoles> {
+
+}

+ 179 - 0
clientside/src/main/java/com/gyee/clientside/service/TaosService.java

@@ -0,0 +1,179 @@
+package com.gyee.clientside.service;
+
+import cn.hutool.core.collection.ListUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.clientside.entity.Point;
+import com.gyee.clientside.entity.TaosEntity;
+import com.gyee.clientside.mapper.master.PointMapper;
+import com.gyee.clientside.mapper.vacant.PointDBMapper;
+import com.gyee.feign.api.GetKeysApi;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.util.StringUtil;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+public class TaosService {
+
+    @Resource
+    private PointDBMapper pointDBMapper;
+    @Resource
+    private PointMapper pointMapper;
+    @Resource
+    private GetKeysApi getKeysApi;
+
+    @Value("${taoscz.db_name:zgxny}")
+    private String dbname;
+    @Value("${taoscz.ai_stable_name:pointai}")
+    private String aistablename;
+    @Value("${taoscz.di_stable_name:pointdi}")
+    private String distablename;
+
+    public void createDataBase() {
+        log.info("创建taos库!");
+        pointDBMapper.createDataBase("mydbinfo", Wrappers.emptyWrapper());
+        QueryWrapper wrapper = new QueryWrapper<>();
+        wrapper.last("cachemodel 'last_row' wal_retention_period 1800");
+        pointDBMapper.createDataBase(dbname, wrapper);
+    }
+
+
+    public boolean createStables(String aiSTablename, String diSTablename) {
+
+        if (StringUtil.isBlank(aiSTablename) || StringUtil.isBlank(diSTablename)) {
+            aiSTablename = aistablename;
+            diSTablename = distablename;
+        }
+
+        log.info("创建taos超级表!");
+        pointMapper.createSuperTable(aiSTablename, "double");
+        pointMapper.createSuperTable(diSTablename, "bool");
+        return true;
+    }
+
+    public int createTables() {
+        log.info("创建taos表!");
+        List<String> aiKeys = getKeysApi.getAIKeys();
+        List<String> diKeys = getKeysApi.getDIKeys();
+
+        //按数量分组,di点
+        List<List<String>> diStrll = ListUtil.split(diKeys, 2900);
+        //按数量分组,ai点
+        List<List<String>> aiStrll = ListUtil.split(aiKeys, 2900);
+
+        int k = 0;
+        for (List<String> s : diStrll) {
+            pointMapper.runSql(getDiSql(s, distablename));
+            k += s.size();
+            log.info(String.valueOf(k));
+        }
+        for (List<String> s : aiStrll) {
+            pointMapper.runSql(getAiSql(s, aistablename));
+            k += s.size();
+            log.info(String.valueOf(k));
+        }
+        log.info("taos表创建完成!");
+        return k;
+    }
+
+    public int createTablesByExcel(List<TaosEntity> entities) {
+        log.info("创建taos表!");
+        List<StringBuilder> excelTaos = taosEntity2CreateStr(entities);
+        for (StringBuilder excelTao : excelTaos) {
+            try {
+                //pointMapper.runSql(excelTao.toString());
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.info(excelTao.toString());
+            }
+            log.info(String.valueOf(entities.size()));
+        }
+        log.info("taos表创建完成!");
+
+        log.info("更新taos的Tag!");
+        int i = 0;
+        for (TaosEntity entity : entities) {
+            pointMapper.alterTag(entity.getPoint(),"description",entity.getDescription());
+            pointMapper.alterTag(entity.getPoint(),"station",entity.getStation());
+            pointMapper.alterTag(entity.getPoint(),"category",entity.getCategory());
+            pointMapper.alterTag(entity.getPoint(),"facility",entity.getFacility());
+            pointMapper.alterTag(entity.getPoint(),"uniformcode",entity.getUniformcode());
+            pointMapper.alterTagNum(entity.getPoint(),"rate",entity.getRate());
+            pointMapper.alterTag(entity.getPoint(),"remark",entity.getRemark());
+            i++;
+            log.info(String.valueOf(i));
+        }
+        log.info("taos的Tag更新完成!");
+        return i;
+    }
+
+    private List<StringBuilder> taosEntity2CreateStr(List<TaosEntity> entities) {
+        List<StringBuilder> sbList = new ArrayList<>();
+        StringBuilder sb = new StringBuilder();
+        Map<String, List<TaosEntity>> collect = entities.stream().collect(Collectors.groupingBy(TaosEntity::getDatatype));
+        List<TaosEntity> teDouble = collect.get("double");
+        if (teDouble == null) teDouble = new ArrayList<>();
+        List<TaosEntity> teBool = collect.get("bool");
+        if (teBool == null) teBool = new ArrayList<>();
+
+        TaosEntity te;
+        for (int i = 0; i < teDouble.size(); i++) {
+            te = teDouble.get(i);
+            if (i % 2999 == 0) {
+                sb = new StringBuilder();
+                sbList.add(sb);
+                sb.append("CREATE TABLE");
+            }
+            sb.append(" IF NOT EXISTS ").append(te.getPoint()).append(" USING ").append(aistablename).append(" TAGS('")
+                    .append(te.getDescription()).append("','").append(te.getStation()).append("','")
+                    .append(te.getCategory()).append("','").append(te.getFacility()).append("','")
+                    .append(te.getUniformcode()).append("',").append(te.getRate()).append(",'")
+                    .append(te.getRemark()).append("')");
+        }
+        for (int i = 0; i < teBool.size(); i++) {
+            te = teBool.get(i);
+            if (i % 2999 == 0) {
+                sb = new StringBuilder();
+                sbList.add(sb);
+                sb.append("CREATE TABLE");
+            }
+            sb.append(" IF NOT EXISTS ").append(te.getPoint()).append(" USING ").append(distablename).append(" TAGS('")
+                    .append(te.getDescription()).append("','").append(te.getStation()).append("','")
+                    .append(te.getCategory()).append("','").append(te.getFacility()).append("','")
+                    .append(te.getUniformcode()).append("',").append(te.getRate()).append(",'")
+                    .append(te.getRemark()).append("')");
+        }
+        return sbList;
+    }
+
+    private String getAiSql(List<String> ls, String astn) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("CREATE TABLE");
+        for (String s : ls) {
+            sb.append(" IF NOT EXISTS ").append(s).append(" USING ").append(astn).append(" TAGS('','','','','',1,'')");
+        }
+        return sb.toString();
+    }
+
+    private String getDiSql(List<String> ls, String dastn) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("CREATE TABLE");
+        for (String s : ls) {
+            sb.append(" IF NOT EXISTS ").append(s).append(" USING ").append(dastn).append(" TAGS('','','','','',1,'')");
+        }
+        return sb.toString();
+    }
+
+    public List<Point> selectPage(Page<Point> page, String stablename, QueryWrapper wrapper) {
+        return pointMapper.selectTableNamesPage(page, stablename, wrapper);
+    }
+}

+ 28 - 0
clientside/src/main/java/com/gyee/clientside/service/impl/MyUsersServiceImpl.java

@@ -0,0 +1,28 @@
+package com.gyee.clientside.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.clientside.entity.MyUsers;
+import com.gyee.clientside.mapper.mydbinfo.MyUsersMapper;
+import com.gyee.clientside.service.IMyUsersService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@Service
+public class MyUsersServiceImpl extends ServiceImpl<MyUsersMapper, MyUsers> implements IMyUsersService {
+
+    @Override
+    public void create() {
+        baseMapper.createUsersTable();
+        baseMapper.createRolesTable();
+        baseMapper.createUserRolesTable();
+        baseMapper.createPermissionsTable();
+        baseMapper.createRolePermissionsTable();
+    }
+}

+ 20 - 0
clientside/src/main/java/com/gyee/clientside/service/impl/PermissionsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.clientside.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.clientside.entity.Permissions;
+import com.gyee.clientside.mapper.mydbinfo.PermissionsMapper;
+import com.gyee.clientside.service.IPermissionsService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@Service
+public class PermissionsServiceImpl extends ServiceImpl<PermissionsMapper, Permissions> implements IPermissionsService {
+
+}

+ 20 - 0
clientside/src/main/java/com/gyee/clientside/service/impl/PointServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.clientside.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.clientside.entity.Point;
+import com.gyee.clientside.mapper.master.PointMapper;
+import com.gyee.clientside.service.IPointService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@Service
+public class PointServiceImpl extends ServiceImpl<PointMapper, Point> implements IPointService {
+
+}

+ 20 - 0
clientside/src/main/java/com/gyee/clientside/service/impl/RolePermissionsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.clientside.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.clientside.entity.RolePermissions;
+import com.gyee.clientside.mapper.mydbinfo.RolePermissionsMapper;
+import com.gyee.clientside.service.IRolePermissionsService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@Service
+public class RolePermissionsServiceImpl extends ServiceImpl<RolePermissionsMapper, RolePermissions> implements IRolePermissionsService {
+
+}

+ 20 - 0
clientside/src/main/java/com/gyee/clientside/service/impl/RolesServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.clientside.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.clientside.entity.Roles;
+import com.gyee.clientside.mapper.mydbinfo.RolesMapper;
+import com.gyee.clientside.service.IRolesService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@Service
+public class RolesServiceImpl extends ServiceImpl<RolesMapper, Roles> implements IRolesService {
+
+}

+ 20 - 0
clientside/src/main/java/com/gyee/clientside/service/impl/UserRolesServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.clientside.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.clientside.entity.UserRoles;
+import com.gyee.clientside.mapper.mydbinfo.UserRolesMapper;
+import com.gyee.clientside.service.IUserRolesService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-03-29
+ */
+@Service
+public class UserRolesServiceImpl extends ServiceImpl<UserRolesMapper, UserRoles> implements IUserRolesService {
+
+}

+ 166 - 0
clientside/src/main/java/com/gyee/clientside/util/FileUtils.java

@@ -0,0 +1,166 @@
+package com.gyee.clientside.util;
+
+import com.gyee.clientside.config.FilePathConfig;
+import com.gyee.clientside.entity.TaosEntity;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.streaming.SXSSFSheet;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+@Slf4j
+public class FileUtils {
+    /**
+     * 下载文件
+     */
+    public static void download(String fileName, HttpServletResponse response) {
+        FileInputStream fis = null;
+        BufferedInputStream bis = null;
+        try {
+            // 获取文件
+            File file = new File(fileName);
+            // 清空缓冲区,状态码和响应头(headers)
+            response.reset();
+            // 设置ContentType,响应内容为二进制数据流,编码为utf-8,此处设定的编码是文件内容的编码
+            response.setContentType("application/vnd.ms-excel;charset=utf-8");
+            fileName = response.encodeURL(new String(file.getName().getBytes(), "iso8859-1"));
+            // 以(Content-Disposition: attachment; filename="filename.jpg")格式设定默认文件名,设定utf编码,此处的编码是文件名的编码,使能正确显示中文文件名
+            response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
+
+            // 实现文件下载
+            byte[] buffer = new byte[1024];
+            fis = new FileInputStream(file);
+            bis = new BufferedInputStream(fis);
+            // 获取字节流
+            OutputStream os = response.getOutputStream();
+            int i = bis.read(buffer);
+            while (i != -1) {
+                os.write(buffer, 0, i);
+                i = bis.read(buffer);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (bis != null) {
+                try {
+                    bis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    public static void write2File(InputStream stream) throws IOException {
+        File file = new File(FilePathConfig.getTaosInfoTablePath());
+        file.delete();
+        long copy = IOUtils.copy(stream, file);
+        log.info("保存excel成功!" + copy);
+    }
+
+    /**
+     * @describe 压缩多个文件
+     */
+    public static String zipFiles(List<File> srcFiles, File zipFile) {
+        // 判断压缩后的文件存在不,不存在则创建
+        //if (!zipFile.exists()) {
+        try {
+            zipFile.createNewFile();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        // 创建 FileOutputStream 对象
+        FileOutputStream fileOutputStream = null;
+        // 创建 ZipOutputStream
+        ZipOutputStream zipOutputStream = null;
+        // 创建 FileInputStream 对象
+        FileInputStream fileInputStream = null;
+
+        try {
+            // 实例化 FileOutputStream 对象
+            fileOutputStream = new FileOutputStream(zipFile);
+            // 实例化 ZipOutputStream 对象
+            zipOutputStream = new ZipOutputStream(fileOutputStream);
+            // 创建 ZipEntry 对象
+            ZipEntry zipEntry = null;
+            // 遍历源文件数组
+            for (int i = 0; i < srcFiles.size(); i++) {
+                // 将源文件数组中的当前文件读入 FileInputStream 流中
+                fileInputStream = new FileInputStream(srcFiles.get(i));
+                // 实例化 ZipEntry 对象,源文件数组中的当前文件
+                zipEntry = new ZipEntry(srcFiles.get(i).getName());
+                zipOutputStream.putNextEntry(zipEntry);
+                // 该变量记录每次真正读的字节个数
+                int len;
+                // 定义每次读取的字节数组
+                byte[] buffer = new byte[1024];
+                while ((len = fileInputStream.read(buffer)) > 0) {
+                    zipOutputStream.write(buffer, 0, len);
+                }
+            }
+            zipOutputStream.closeEntry();
+            zipOutputStream.close();
+            fileInputStream.close();
+            fileOutputStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        //}
+        return zipFile.getAbsolutePath();
+    }
+
+    public static List<TaosEntity> excel2Entity(XSSFWorkbook xssfWorkbook) {
+        log.info("读取excel!");
+        List<TaosEntity> entities = new ArrayList<>();
+        SXSSFWorkbook workbook = new SXSSFWorkbook(xssfWorkbook, 9999);
+        SXSSFSheet sheet = workbook.getSheetAt(0);
+        //获得当前sheet的结束行
+        int lastRowNum = sheet.getLastRowNum();
+        String scv1, scv2, scv3, scv4, scv5, scv6, scv8, scv9;
+        float scv7;
+        TaosEntity te;
+        //循环从第2行开始
+        for (int rowNum = 2; rowNum <= lastRowNum; rowNum++) {
+            //获得当前行
+            Row row = sheet.getRow(rowNum);
+            scv1 = row.getCell(0).getStringCellValue();
+            scv2 = row.getCell(1).getStringCellValue();
+            scv3 = row.getCell(2).getStringCellValue();
+            scv4 = row.getCell(3).getStringCellValue();
+            scv5 = row.getCell(4).getStringCellValue();
+            scv6 = row.getCell(5).getStringCellValue();
+            scv7 = (float) row.getCell(6).getNumericCellValue();
+            scv8 = row.getCell(7).getStringCellValue();
+            scv9 = row.getCell(8).getStringCellValue();
+            te = new TaosEntity();
+            te.setPoint(scv1);
+            te.setDescription(scv2 != null ? scv2 : "");
+            te.setStation(scv3);
+            te.setCategory(scv4 != null ? scv4 : "");
+            te.setFacility(scv5 != null ? scv5 : "");
+            te.setUniformcode(scv6);
+            te.setRate(scv7);
+            te.setRemark(scv8 == null ? "" : scv8);
+            te.setDatatype(scv9);
+            entities.add(te);
+        }
+        log.info("excel读取完毕!");
+        return entities;
+    }
+}

+ 69 - 0
clientside/src/main/resources/application.yml

@@ -0,0 +1,69 @@
+server:
+  port: 5087
+
+spring:
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 100MB
+  application:
+    name: redis2taos
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      initial-size: 12
+      min-idle: 9
+      max-active: 39
+
+      master:
+        jdbc-url: jdbc:TAOS://${taoscz.server_ip}:6030/${taoscz.db_name}?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+        username: root
+        password: taosdata
+        driver-class-name: com.taosdata.jdbc.TSDBDriver
+      mydbinfo:
+        jdbc-url: jdbc:TAOS://${taoscz.server_ip}:6030/mydbinfo?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+        username: root
+        password: taosdata
+        driver-class-name: com.taosdata.jdbc.TSDBDriver
+      vacant:
+        jdbc-url: jdbc:TAOS://${taoscz.server_ip}:6030?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+        username: root
+        password: taosdata
+        driver-class-name: com.taosdata.jdbc.TSDBDriver
+
+#适配器链接taos数据库配置信息
+taoscz:
+  #server_ip: 192.168.126.128
+  server_ip: 192.168.10.13
+  server_port: 6030
+  #数据库名
+  db_name: nxxny
+  user_name: root
+  password: taosdata
+  pool_size: 10
+  max_pool_size: 100
+  #driver_type: com.taosdata.jdbc.rs.RestfulDriver
+  driver_type: com.taosdata.jdbc.TSDBDriver
+  #taos中ai测点的超级表名
+  ai_stable_name: pointai
+  #taos中di测点的超级表名
+  di_stable_name: pointdi
+
+mybatis-plus:
+  configuration:
+    # 是否将sql打印到控制面板(该配置会将sql语句和查询的结果都打印到控制台)
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+redis:
+  url: localhost:5085
+
+logging:
+  level:
+    web: info
+    sql: debug
+  file:
+    name: server.log
+    path: ./log
+  logback:
+    rollingpolicy:
+      file-name-pattern: server.%d{yyyy-MM-dd}.%i.gz

+ 10 - 0
feign/build.gradle

@@ -0,0 +1,10 @@
+version '1.0'
+
+dependencies {
+    /*implementation ('org.springframework.boot:spring-boot-starter-web') {
+        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
+    }*/
+    api 'org.springframework.boot:spring-boot-starter-web'
+    api 'org.springframework.cloud:spring-cloud-starter-openfeign:3.1.4'
+    implementation 'io.github.openfeign:feign-httpclient:11.9.1'
+}

+ 13 - 0
feign/src/main/java/com/gyee/feign/FeignApp.java

@@ -0,0 +1,13 @@
+package com.gyee.feign;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@EnableFeignClients
+@SpringBootApplication
+public class FeignApp {
+    public static void main(String[] args) {
+        SpringApplication.run(FeignApp.class, args);
+    }
+}

+ 16 - 0
feign/src/main/java/com/gyee/feign/api/GetKeysApi.java

@@ -0,0 +1,16 @@
+package com.gyee.feign.api;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import java.util.List;
+
+@FeignClient(name = "redisread", url = "${redis.url}")
+public interface GetKeysApi {
+
+    @GetMapping("/redis/aikeys")
+    List<String> getAIKeys();
+
+    @GetMapping("/redis/dikeys")
+    List<String> getDIKeys();
+}

+ 14 - 0
feign/src/main/java/com/gyee/feign/api/Redis2TaosApi.java

@@ -0,0 +1,14 @@
+package com.gyee.feign.api;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.net.URI;
+
+@FeignClient("taoswrite")
+public interface Redis2TaosApi {
+
+    @PostMapping("/write")
+    String putSql(URI baseUri, @RequestBody String sql);
+}

+ 11 - 0
feign/src/main/resources/application.yml

@@ -0,0 +1,11 @@
+feign:
+  client:
+    config:
+      default: #全局
+        #logger有四种类型:NONE,BASIC,HEADERS, FULL
+        loggerLevel: BASIC
+  httpclient:
+    enabled: true
+    connection-timeout: 18000
+    max-connections: 256
+    max-connections-per-route: 50

+ 1 - 0
gateway/build.gradle

@@ -0,0 +1 @@
+version '1.0'

+ 11 - 0
gateway/src/main/java/com/gyee/gateway/GatewayApp.java

@@ -0,0 +1,11 @@
+package com.gyee.gateway;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class GatewayApp {
+    public static void main(String[] args) {
+        SpringApplication.run(GatewayApp.class, args);
+    }
+}

+ 0 - 0
gateway/src/main/resources/application.yml


BIN
gradle/wrapper/gradle-wrapper.jar


+ 5 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 185 - 0
gradlew

@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MSYS* | MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=`expr $i + 1`
+    done
+    case $i in
+        0) set -- ;;
+        1) set -- "$args0" ;;
+        2) set -- "$args0" "$args1" ;;
+        3) set -- "$args0" "$args1" "$args2" ;;
+        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"

+ 89 - 0
gradlew.bat

@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 8 - 0
redisread/build.gradle

@@ -0,0 +1,8 @@
+version '1.0'
+
+dependencies {
+    implementation project(':feign')
+
+    implementation 'redis.clients:jedis:4.3.1'
+    implementation 'cn.hutool:hutool-core:5.8.13'
+}

+ 11 - 0
redisread/src/main/java/com/gyee/redisread/RedisreadApp.java

@@ -0,0 +1,11 @@
+package com.gyee.redisread;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = "com.gyee")
+public class RedisreadApp {
+    public static void main(String[] args) {
+        SpringApplication.run(RedisreadApp.class, args);
+    }
+}

+ 47 - 0
redisread/src/main/java/com/gyee/redisread/config/RedisConfig.java

@@ -0,0 +1,47 @@
+package com.gyee.redisread.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+import redis.clients.jedis.JedisPoolConfig;
+
+@Component
+public class RedisConfig {
+    @Value("${redis.host:127.0.0.1}")
+    private String host;
+    @Value("${redis.port:6379}")
+    private Integer port;
+    @Value("${redis.password:}")
+    private String password;
+
+    @Value("${taoswrite.urls}")
+    private String taosUrls;
+
+    private JedisPool jedisPool;
+
+    public Jedis getJedis() {
+        if (jedisPool == null) {
+            JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
+            // 最大连接
+            jedisPoolConfig.setMaxTotal(32);
+            // 最大空闲连接
+            jedisPoolConfig.setMaxIdle(64);
+            // 最小空闲连接
+            jedisPoolConfig.setMinIdle(0);
+            if ("".equals(password)) {
+                jedisPool = new JedisPool(jedisPoolConfig, host, port, 5000);
+            } else {
+                jedisPool = new JedisPool(jedisPoolConfig, host, port, 5000, password);
+            }
+        }
+        return jedisPool.getResource();
+    }
+
+    public String getTaosUrls() {
+        if (taosUrls == null) {
+            taosUrls = "";
+        }
+        return taosUrls;
+    }
+}

+ 73 - 0
redisread/src/main/java/com/gyee/redisread/config/ThreadPoolTaskConfig.java

@@ -0,0 +1,73 @@
+package com.gyee.redisread.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+public class ThreadPoolTaskConfig {
+
+    /**
+     *   默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
+     *	当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
+     *  当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
+     */
+
+    /**
+     * 核心线程数(默认线程数)
+     */
+    private static final int corePoolSize = 128;
+    /**
+     * 最大线程数
+     */
+    private static final int maxPoolSize = 256;
+    /**
+     * 允许线程空闲时间(单位:默认为秒)
+     */
+    private static final int keepAliveTime = 60;
+    /**
+     * 缓冲队列大小
+     */
+    private static final int queueCapacity = 128;
+    /**
+     * 允许等待最长时间
+     */
+    private static final int awaitTime = 60;
+    /**
+     * 线程池名前缀
+     */
+    private static final String threadNamePrefix = "GYEE-Thread-";
+
+    private ThreadPoolTaskExecutor executor;
+
+    public ThreadPoolTaskExecutor getInstance() {
+        if (executor == null)
+            executor = taskExecutor();
+
+        return executor;
+    }
+
+    @Bean
+    public ThreadPoolTaskExecutor taskExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveTime);
+        executor.setThreadNamePrefix(threadNamePrefix);
+        // 该方法用来设置 线程池关闭 的时候 等待 所有任务都完成后,再继续 销毁 其他的 Bean,
+        // 这样这些 异步任务 的 销毁 就会先于 数据库连接池对象 的销毁。
+        executor.setWaitForTasksToCompleteOnShutdown(true);
+        executor.setAwaitTerminationSeconds(awaitTime);
+
+        // 线程池对拒绝任务的处理策略
+        // CallerRunsPolicy:由调用线程(提交任务的线程)处理该任务
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
+        // 初始化
+        executor.initialize();
+        return executor;
+    }
+
+}

+ 55 - 0
redisread/src/main/java/com/gyee/redisread/controller/RedisController.java

@@ -0,0 +1,55 @@
+package com.gyee.redisread.controller;
+
+import com.gyee.redisread.service.ReadRedisService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/redis")
+public class RedisController {
+
+    @Resource
+    private ReadRedisService readRedisService;
+
+
+    @GetMapping("/read/start")
+    private boolean taos2RedisStart() throws Exception {
+        return readRedisService.start();
+    }
+
+    @GetMapping("/read/stop")
+    private boolean taos2RedisStop() {
+        return readRedisService.stop();
+    }
+
+    @GetMapping("/read/status")
+    private boolean taos2RedisStatus() {
+        return readRedisService.isActive();
+    }
+
+    @GetMapping("/aikeys")
+    private List<String> getAIKeys() {
+        return readRedisService.getAikeys();
+    }
+
+    @GetMapping("/dikeys")
+    private List<String> getDIKeys() {
+        return readRedisService.getDikeys();
+    }
+
+    @GetMapping("/size/aipoint")
+    private int getAiPoint() {
+        return readRedisService.getAikeys().size();
+    }
+
+    @GetMapping("/size/dipoint")
+    private int getDiPoint() {
+        return readRedisService.getDikeys().size();
+    }
+}

+ 113 - 0
redisread/src/main/java/com/gyee/redisread/entity/TaosEntity.java

@@ -0,0 +1,113 @@
+package com.gyee.redisread.entity;
+
+public class TaosEntity {
+    private String point;
+    private String description;
+    private String station;
+    private String category;
+    private String facility;
+    private String uniformcode;
+    private Float rate;
+    private String remark;
+    private String datatype;
+
+    public String getPoint() {
+        return point;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getStation() {
+        return station;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public String getFacility() {
+        return facility;
+    }
+
+    public String getUniformcode() {
+        return uniformcode;
+    }
+
+    public Float getRate() {
+        return rate;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public String getDatatype() {
+        return datatype;
+    }
+
+    public void setPoint(String point) {
+        this.point = point;
+    }
+
+    public void setDescription(Object description) {
+        if (description == null) {
+            this.description = "";
+        } else {
+            this.description = description.toString();
+        }
+    }
+
+    public void setStation(Object station) {
+        if (station == null) {
+            this.station = "";
+        } else {
+            this.station = station.toString();
+        }
+    }
+
+    public void setCategory(Object category) {
+        if (category == null) {
+            this.category = "";
+        } else {
+            this.category = category.toString();
+        }
+    }
+
+    public void setFacility(Object facility) {
+        if (facility == null) {
+            this.facility = "";
+        } else {
+            this.facility = facility.toString();
+        }
+    }
+
+    public void setUniformcode(Object uniformcode) {
+        if (uniformcode == null) {
+            this.uniformcode = "";
+        } else {
+            this.uniformcode = uniformcode.toString();
+        }
+    }
+
+    public void setRate(Object rate) {
+        if (rate == null || rate.equals("")) {
+            this.rate = 1f;
+        } else {
+            this.rate = Float.valueOf(rate.toString());
+        }
+    }
+
+    public void setRemark(Object remark) {
+        if (remark == null) {
+            this.remark = "";
+        } else {
+            this.remark = remark.toString();
+        }
+    }
+
+    public void setDatatype(String datatype) {
+        this.datatype = datatype;
+    }
+}

+ 109 - 0
redisread/src/main/java/com/gyee/redisread/service/ReadRedisService.java

@@ -0,0 +1,109 @@
+package com.gyee.redisread.service;
+
+import cn.hutool.core.collection.ListUtil;
+import com.gyee.feign.api.Redis2TaosApi;
+import com.gyee.redisread.config.RedisConfig;
+import com.gyee.redisread.task.TaskRedisRead;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.boot.DefaultApplicationArguments;
+import org.springframework.core.annotation.Order;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+@Slf4j
+@Order(1)
+@Service
+public class ReadRedisService implements ApplicationRunner {
+
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private ThreadPoolTaskExecutor taskExecutor;
+    @Resource
+    private RedisConfig redisConfig;
+    @Resource
+    private Redis2TaosApi redis2TaosApi;
+
+    List<String> dikeys = new ArrayList<>();
+    List<String> aikeys = new ArrayList<>();
+
+    @Value("${active:false}")
+    private boolean active;
+
+    @Override
+    public void run(ApplicationArguments args) {
+
+        getKeys();
+
+        List<List<String>> boolStrll = ListUtil.split(dikeys, 9216);
+        List<List<String>> douStrll = ListUtil.split(aikeys, 9216);
+
+        while (active) {
+            try {
+                for (List<String> strings : boolStrll) {
+                    taskExecutor.execute(new TaskRedisRead(strings, redisConfig, "bool", redis2TaosApi));
+                }
+                for (List<String> strings : douStrll) {
+                    taskExecutor.execute(new TaskRedisRead(strings, redisConfig, "double", redis2TaosApi));
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            log.info("\n#");
+        }
+    }
+
+    public void getKeys() {
+        //long l1 = System.currentTimeMillis();
+        Set<String> keys = redisService.getKeys();
+        if (keys.size() == 0) return;
+        //long l2 = System.currentTimeMillis();
+        log.info("读取rediskeys成功!!!有" + keys.size() + "个点。");
+        //按类型分点
+        dikeys = new ArrayList<>();
+        aikeys = new ArrayList<>();
+        keys.forEach(k -> {
+            if (k.contains("DI") || k.contains("di")) {
+                dikeys.add(k);
+            } else {
+                aikeys.add(k);
+            }
+        });
+    }
+
+    public boolean stop() {
+        this.active = false;
+        return true;
+    }
+
+    public boolean start() {
+        this.active = true;
+        run(new DefaultApplicationArguments());
+        return true;
+    }
+
+    public boolean isActive() {
+        return active;
+    }
+
+    public List<String> getDikeys() {
+        return dikeys;
+    }
+
+    public List<String> getAikeys() {
+        return aikeys;
+    }
+}

+ 49 - 0
redisread/src/main/java/com/gyee/redisread/service/RedisService.java

@@ -0,0 +1,49 @@
+package com.gyee.redisread.service;
+
+import com.gyee.redisread.config.RedisConfig;
+import com.gyee.redisread.entity.TaosEntity;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import redis.clients.jedis.Jedis;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+public class RedisService {
+
+    @Resource
+    private RedisConfig redisConfig;
+
+    private static final ThreadLocal<SimpleDateFormat> sdf = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+
+    public void creatTables(List<TaosEntity> entities) {
+        List<String> collect = entities.stream().map(TaosEntity::getPoint).collect(Collectors.toList());
+        Map<String, String> map;
+        Date date = new Date();
+        log.info("开始redis建表!");
+        try (Jedis jedis = redisConfig.getJedis()) {
+            for (String excelRedi : collect) {
+                if (!jedis.exists(excelRedi)) {
+                    map = new LinkedHashMap<>();
+                    map.put("pointid", excelRedi);
+                    map.put("value", "0");
+                    map.put("timestamp", String.valueOf(date.getTime() / 1000));
+                    map.put("datetime", sdf.get().format(date));
+                    map.put("status", "0");
+                    jedis.hmset(excelRedi, map);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        log.info("redis建表完成!");
+    }
+
+    public Set<String> getKeys() {
+        return redisConfig.getJedis().keys("*");
+    }
+}

+ 129 - 0
redisread/src/main/java/com/gyee/redisread/task/TaskRedisRead.java

@@ -0,0 +1,129 @@
+package com.gyee.redisread.task;
+
+import com.gyee.feign.api.Redis2TaosApi;
+import com.gyee.redisread.config.RedisConfig;
+import com.gyee.redisread.util.ChangedSave;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.Pipeline;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Objects;
+
+public class TaskRedisRead implements Runnable {
+    private final List<String> keys;
+    private RedisConfig redisConfig;
+    private String dataType;
+    private Redis2TaosApi redis2TaosApi;
+
+    public static final Logger log = LoggerFactory.getLogger(TaskRedisRead.class);
+
+    public TaskRedisRead(List<String> keys, RedisConfig redisConfig, String dataType, Redis2TaosApi redis2TaosApi) {
+        this.keys = keys;
+        this.redisConfig = redisConfig;
+        this.dataType = dataType;
+        this.redis2TaosApi = redis2TaosApi;
+    }
+
+    @Override
+    public void run() {
+
+        List<Object> objects;
+
+        String pointid = null;
+
+        try (Jedis jedis = redisConfig.getJedis(); Pipeline pipelined = jedis.pipelined();) {
+
+            for (String key : keys) {
+                //pipelined.hscan(key, "0");
+                pipelined.hmget(key, "pointid", "value", "timestamp");
+            }
+            //redis批量获取接收为Object
+            objects = pipelined.syncAndReturnAll();
+
+            StringBuilder sb = new StringBuilder();
+            sb.append("INSERT INTO ");
+
+            String value;
+            String datetime;
+            double val;
+            long ts;
+            boolean bl;
+            List<String> response;
+            String sb2str;
+
+            if ("bool".equals(dataType)) {
+                for (int i = 0; i < objects.size(); i++) {
+                    response = (List<String>) objects.get(i);
+
+                    value = response.get(1);
+                    if (value == null || "".equals(value) || value.contains("-nan")) continue;
+                    datetime = response.get(2);
+                    if (StringUtils.isEmpty(datetime)) continue;
+                    pointid = response.get(0);
+                    if (StringUtils.isEmpty(pointid)) continue;
+
+                    if (ChangedSave.map.containsKey(pointid)) {
+                        if (!Objects.equals(ChangedSave.map.get(pointid), datetime)) {
+                            ChangedSave.map.put(pointid, datetime);
+                            ts = Long.valueOf(datetime) * 1000;
+                            bl = Double.valueOf(value) == 1;
+                            //j++;
+                            sb.append(pointid).append(" VALUES (").append(ts).append(",").append(bl).append(") ");
+                        }
+                    } else {
+                        ChangedSave.map.put(pointid, datetime);
+                    }
+
+                    /*ts = Long.valueOf(datetime) * 1000;
+                    bl = Double.valueOf(value) == 1;
+                    sb.append(pointid).append(" VALUES (").append(ts).append(",").append(bl).append(") ");*/
+                }
+                sb2str = sb.toString();
+                if ("INSERT INTO ;".equals(sb2str)) return;
+                for (String taosUrl : redisConfig.getTaosUrls().split(",")) {
+                    redis2TaosApi.putSql(URI.create(taosUrl), sb2str);
+                }
+            } else {
+                for (int i = 0; i < objects.size(); i++) {
+                    response = (List<String>) objects.get(i);
+
+                    value = response.get(1);
+                    if (value == null || "".equals(value) || value.contains("-nan")) continue;
+                    datetime = response.get(2);
+                    if (StringUtils.isEmpty(datetime)) continue;
+                    pointid = response.get(0);
+                    if (StringUtils.isEmpty(pointid)) continue;
+
+                    if (ChangedSave.map.containsKey(pointid)) {
+                        if (!Objects.equals(ChangedSave.map.get(pointid), datetime)) {
+                            ChangedSave.map.put(pointid, datetime);
+                            ts = Long.valueOf(datetime) * 1000;
+                            val = Double.valueOf(value);
+
+                            //j++;
+                            sb.append(pointid).append(" VALUES (").append(ts).append(",").append(val).append(") ");
+                        }
+                    } else {
+                        ChangedSave.map.put(pointid, datetime);
+                    }
+                    /*ts = Long.valueOf(datetime) * 1000;
+                    val = Double.valueOf(value);
+                    sb.append(pointid).append(" VALUES (").append(ts).append(",").append(val).append(") ");*/
+                }
+                sb2str = sb.toString();
+                if ("INSERT INTO ;".equals(sb2str)) return;
+                for (String taosUrl : redisConfig.getTaosUrls().split(",")) {
+                    redis2TaosApi.putSql(URI.create(taosUrl), sb2str);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(pointid + "------写请求超时或读取redis出错!");
+        }
+        System.out.print("*");
+    }
+}

+ 8 - 0
redisread/src/main/java/com/gyee/redisread/util/ChangedSave.java

@@ -0,0 +1,8 @@
+package com.gyee.redisread.util;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ChangedSave {
+    public static Map<String, String> map = new ConcurrentHashMap<>();
+}

+ 44 - 0
redisread/src/main/resources/application.yml

@@ -0,0 +1,44 @@
+server:
+  port: 5085
+
+spring:
+  application:
+    name: redisread
+
+redis:
+  host: 192.168.126.128
+  port: 6379
+  password: zghww693
+
+#redis:
+#  host: 18.6.30.75
+#  port: 6379
+#  password: 123456
+
+active: false
+
+#适配器链接taos数据库配置信息
+taoswrite:
+  urls: http://localhost:5086
+
+logging:
+  level:
+    web: info
+  file:
+    name: server.log
+    path: ./log
+  logback:
+    rollingpolicy:
+      file-name-pattern: server.%d{yyyy-MM-dd}.%i.gz
+
+feign:
+  client:
+    config:
+      default: #全局
+        #logger有四种类型:NONE,BASIC,HEADERS, FULL
+        loggerLevel: FULL
+  httpclient:
+    enabled: true
+    connection-timeout: 18000
+    max-connections: 512
+    max-connections-per-route: 256

+ 7 - 0
settings.gradle

@@ -0,0 +1,7 @@
+rootProject.name = 'taos'
+include 'feign'
+//include 'gateway'
+include 'redisread'
+include 'taoswrite'
+include 'clientside'
+

+ 9 - 0
taoswrite/build.gradle

@@ -0,0 +1,9 @@
+version '1.0'
+
+dependencies {
+    implementation 'org.springframework.boot:spring-boot-starter-web'
+
+    implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
+    implementation 'com.taosdata.jdbc:taos-jdbcdriver:3.1.0'
+    implementation 'com.alibaba:druid:1.2.16'
+}

+ 13 - 0
taoswrite/src/main/java/com/gyee/taoswrite/TaoswriteApp.java

@@ -0,0 +1,13 @@
+package com.gyee.taoswrite;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@Mapper
+@SpringBootApplication
+public class TaoswriteApp {
+    public static void main(String[] args) {
+        SpringApplication.run(TaoswriteApp.class, args);
+    }
+}

+ 49 - 0
taoswrite/src/main/java/com/gyee/taoswrite/controller/TaosWriteController.java

@@ -0,0 +1,49 @@
+package com.gyee.taoswrite.controller;
+
+import com.gyee.taoswrite.mapper.PointMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@RestController
+public class TaosWriteController {
+
+    @Resource
+    private PointMapper pointMapper;
+
+    @Value("${taoscz.ai_stable_name:pointai}")
+    private String aidbname;
+    @Value("${taoscz.di_stable_name:pointdi}")
+    private String didbname;
+
+    @PostMapping("/write")
+    private void taos2RedisStart(@RequestBody String sql) {
+
+        try {
+            pointMapper.insert(sql);
+            System.out.print("*");
+        } catch (Exception e) {
+            e.printStackTrace();
+
+            String ss;
+            if (sql.contains("DI") || sql.contains("di")) {
+                ss = sql.replace("VALUES", "USING " + didbname + " TAGS('','','','','',1,'') VALUES");
+            } else {
+                ss = sql.replace("VALUES", "USING " + aidbname + " TAGS('','','','','',1,'') VALUES");
+            }
+
+            try {
+                pointMapper.insert(ss);
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                log.error(ss);
+            }
+        }
+
+    }
+}

+ 12 - 0
taoswrite/src/main/java/com/gyee/taoswrite/mapper/PointMapper.java

@@ -0,0 +1,12 @@
+package com.gyee.taoswrite.mapper;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PointMapper {
+
+    @Insert("${sql}")
+    void insert(String sql);
+
+}

+ 51 - 0
taoswrite/src/main/resources/application.yml

@@ -0,0 +1,51 @@
+server:
+  port: 5086
+  tomcat:
+    threads:
+      max: 256
+      min-spare: 50
+
+spring:
+  application:
+    name: taoswrite
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: com.taosdata.jdbc.TSDBDriver
+    url: jdbc:TAOS://${taoscz.server_ip}:6030/${taoscz.db_name}?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+    username: root
+    password: taosdata
+    druid:
+      # SQL查询,用来验证从连接池取出的连接,在将连接返回给调用者之前.
+      validation-query: select 1
+      initial-size: 12
+      min-idle: 9
+      max-active: 39
+
+#适配器链接taos数据库配置信息
+taoscz:
+  #server_ip: 192.168.126.128
+  server_ip: 192.168.10.13
+  server_port: 6030
+  #数据库名
+  db_name: nxxny
+  user_name: root
+  password: taosdata
+  pool_size: 10
+  max_pool_size: 100
+  #driver_type: com.taosdata.jdbc.rs.RestfulDriver
+  driver_type: com.taosdata.jdbc.TSDBDriver
+  #taos中ai测点的超级表名
+  ai_stable_name: pointai
+  #taos中di测点的超级表名
+  di_stable_name: pointdi
+
+logging:
+  level:
+    web: info
+    sql: debug
+  file:
+    name: server.log
+    path: ./log
+  logback:
+    rollingpolicy:
+      file-name-pattern: server.%d{yyyy-MM-dd}.%i.gz