bihuisong 1 jaar geleden
bovenliggende
commit
d0ba772ccc
23 gewijzigde bestanden met toevoegingen van 1941 en 0 verwijderingen
  1. 126 0
      pom.xml
  2. 32 0
      src/main/java/com/sooka/sponest/songhuahu/SookaSonghuahuApplication.java
  3. 76 0
      src/main/java/com/sooka/sponest/songhuahu/conf/FeignConfig.java
  4. 139 0
      src/main/java/com/sooka/sponest/songhuahu/exchange/controller/ExchangeController.java
  5. 35 0
      src/main/java/com/sooka/sponest/songhuahu/exchange/domian/DataExchangeEntity.java
  6. 44 0
      src/main/java/com/sooka/sponest/songhuahu/exchange/domian/LoginBody.java
  7. 22 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/EnableSookaFeignClients.java
  8. 4 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/RemoveApiBaseService.java
  9. 36 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/auth/RemoteAuthBaseServiceFallbackFactory.java
  10. 19 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/data/RemoteDataBaseServiceFallbackFactory.java
  11. 40 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/event/RemoteEventBaseServiceFallbackFactory.java
  12. 53 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/system/RemoteSystemBaseServiceFallbackFactory.java
  13. 49 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/ModulesServiceNameContants.java
  14. 25 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/auth/RemoteAuthBaseService.java
  15. 16 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/data/RemoteDataBaseService.java
  16. 29 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/event/RemoteEventBaseService.java
  17. 44 0
      src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/system/RemoteSystemService.java
  18. 178 0
      src/main/java/com/sooka/sponest/songhuahu/util/CacheUtils.java
  19. 275 0
      src/main/java/com/sooka/sponest/songhuahu/util/RestUtil.java
  20. 536 0
      src/main/java/com/sooka/sponest/songhuahu/util/StringUtils.java
  21. 142 0
      src/main/java/com/sooka/sponest/songhuahu/util/spring/SpringUtils.java
  22. 2 0
      src/main/resources/banner.txt
  23. 19 0
      src/main/resources/bootstrap.yml

+ 126 - 0
pom.xml

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>ruoyi-modules</artifactId>
+        <groupId>com.ruoyi</groupId>
+        <version>3.4.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.sooka.onest</groupId>
+    <artifactId>sooka-songhuahu</artifactId>
+
+
+    <dependencies>
+        <!-- SpringBoot Actuator -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+        <!-- Swagger UI -->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>${swagger.fox.version}</version>
+        </dependency>
+
+        <!-- RuoYi Common Log -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>sooka-sponest-common-log</artifactId>
+        </dependency>
+
+        <!-- RuoYi Common Swagger -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>sooka-sponest-common-swagger</artifactId>
+        </dependency>
+
+        <!--Shiro核心框架 -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-core</artifactId>
+            <version>1.10.1</version>
+        </dependency>
+
+        <!-- Shiro使用EhCache缓存框架 -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-ehcache</artifactId>
+            <version>1.10.1</version>
+        </dependency>
+
+        <!-- ICC鉴权 -->
+        <dependency>
+            <groupId>com.dahuatech.icc</groupId>
+            <artifactId>java-sdk-oauth</artifactId>
+            <version>1.0.9</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>java-sdk-core</artifactId>
+                    <groupId>com.dahuatech.icc</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>com.dahuatech.icc</groupId>
+            <artifactId>java-sdk-core</artifactId>
+            <version>1.0.9</version>
+        </dependency>
+
+        <!-- mp4文件操作jar -->
+        <!-- https://mvnrepository.com/artifact/com.googlecode.mp4parser/isoparser -->
+        <dependency>
+            <groupId>com.googlecode.mp4parser</groupId>
+            <artifactId>isoparser</artifactId>
+            <version>1.1.22</version>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.websocket</groupId>
+            <artifactId>javax.websocket-api</artifactId>
+            <version>1.1</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!--hutool-->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.2</version>
+        </dependency>
+        <!-- 系统接口 -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>sooka-sponest-api-system</artifactId>
+            <version>${ruoyi.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.5.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 32 - 0
src/main/java/com/sooka/sponest/songhuahu/SookaSonghuahuApplication.java

@@ -0,0 +1,32 @@
+package com.sooka.sponest.songhuahu;
+
+import com.ruoyi.common.security.annotation.EnableCustomConfig;
+import com.ruoyi.common.security.annotation.EnableRyFeignClients;
+import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.util.unit.DataSize;
+
+import javax.servlet.MultipartConfigElement;
+
+@EnableCustomConfig
+@EnableCustomSwagger2
+@EnableRyFeignClients
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
+public class SookaSonghuahuApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(SookaSonghuahuApplication.class, args);
+        System.out.println("(♥◠‿◠)ノ゙  首佳科技 松花湖 数据交换中台 启动成功   ლ(´ڡ`ლ)゙");
+    }
+
+    @Bean
+    public MultipartConfigElement multipartConfigElement() {
+        MultipartConfigFactory factory = new MultipartConfigFactory();
+        factory.setMaxFileSize(DataSize.parse("10240000KB"));
+        factory.setMaxRequestSize(DataSize.parse("10240000KB"));
+        return factory.createMultipartConfig();
+    }
+}

+ 76 - 0
src/main/java/com/sooka/sponest/songhuahu/conf/FeignConfig.java

@@ -0,0 +1,76 @@
+package com.sooka.sponest.songhuahu.conf;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @author echo lovely
+ * @date 2021/2/1 20:45
+ */
+@Configuration
+public class FeignConfig implements RequestInterceptor {
+    /**
+     * 复写feign请求对象
+     *
+     * @param requestTemplate hhh
+     */
+
+    @Override
+    public void apply(RequestTemplate requestTemplate) {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
+                .getRequestAttributes();
+        if (attributes == null) {
+            return;
+        }
+        HttpServletRequest request = attributes.getRequest();
+        Enumeration<String> headerNames = request.getHeaderNames();
+        if (headerNames != null) {
+            while (headerNames.hasMoreElements()) {
+                String name = headerNames.nextElement();
+                String values = request.getHeader(name);
+                //跳过 content-length,避免追加参数导致content-length值与实际长度不一样
+                if (name.equals("content-length")) {
+                    continue;
+                }
+                Enumeration<String> values1 = request.getHeaders(name);
+                while (values1.hasMoreElements()) {
+                    String value = values1.nextElement();
+                    requestTemplate.header(name, value);
+                }
+            }
+        }
+    }
+
+    //获取请求对象
+    private HttpServletRequest getHttpServletRequest() {
+        try {
+            return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    //拿到请求头信息
+    private Map<String, String> getHeaders(HttpServletRequest request) {
+        Map<String, String> map = new LinkedHashMap<>();
+        Enumeration<String> enumeration = request.getHeaderNames();
+        while (enumeration.hasMoreElements()) {
+            String key = enumeration.nextElement();
+            String value = request.getHeader(key);
+            map.put(key, value);
+        }
+        return map;
+    }
+
+}
+

+ 139 - 0
src/main/java/com/sooka/sponest/songhuahu/exchange/controller/ExchangeController.java

@@ -0,0 +1,139 @@
+package com.sooka.sponest.songhuahu.exchange.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.exception.file.FileException;
+import com.ruoyi.common.core.utils.file.FilePrefixUtils;
+import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.system.api.RemoteConfigService;
+import com.ruoyi.system.api.RemoteFileService;
+import com.ruoyi.system.api.domain.SysFile;
+import com.sooka.sponest.songhuahu.exchange.domian.DataExchangeEntity;
+import com.sooka.sponest.songhuahu.exchange.domian.LoginBody;
+import com.sooka.sponest.songhuahu.remoteapi.service.center.auth.RemoteAuthBaseService;
+import com.sooka.sponest.songhuahu.remoteapi.service.center.event.RemoteEventBaseService;
+import com.sooka.sponest.songhuahu.util.RestUtil;
+import com.sooka.sponest.songhuahu.util.spring.SpringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.CollectionUtils;
+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.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Controller
+@RequestMapping("/data/exchange")
+public class ExchangeController {
+
+    @Resource
+    private RemoteAuthBaseService remoteAuthBaseService;
+    @Resource
+    private RemoteEventBaseService remoteEventBaseService;
+    @Resource
+    private RemoteConfigService remoteConfigService;
+
+    //    @Value("${}")
+    private String url;
+
+    /**
+     * 获取秘钥接口
+     */
+    @PostMapping("/getRemoteSecretKey")
+    @ResponseBody
+    public R<?> getRemoteSecretKey() {
+        R<?> result = remoteAuthBaseService.getRemoteSecretKey();
+        log.info("result:{}", result.getData());
+        if (result.getCode() == 200) {
+            return R.ok(result.getData().toString(), "获取成功");
+        } else {
+            return R.fail("获取失败");
+        }
+    }
+
+    /**
+     * 获取token
+     */
+    @PostMapping("/getToken")
+    @ResponseBody
+    public R<?> getToken(@RequestBody LoginBody form) {
+        R<?> result = remoteAuthBaseService.loginRemote(form);
+        log.info("result:{}", result.getData());
+        if (result.getCode() == 200) {
+            Map<String, Object> json = (Map<String, Object>) result.getData();
+            return R.ok(json.get("access_token").toString(), "获取成功");
+        } else {
+            return R.fail("获取失败");
+        }
+    }
+
+    @PostMapping("/straightPushData")
+    @ResponseBody
+    public R<?> straightPushData(@RequestBody DataExchangeEntity dataExchangeEntity) {
+        log.info("dataExchangeEntity:{}", dataExchangeEntity);
+        List<String> pictureList = new ArrayList<>();
+        if (StringUtils.isNotEmpty(SecurityUtils.getToken()) && !CollectionUtils.isEmpty(dataExchangeEntity.getEventPicture())) {
+            log.info("token:{}", StringUtils.isNotEmpty(SecurityUtils.getToken()));
+            for (String picture : dataExchangeEntity.getEventPicture()) {
+                if (!"image".equals(FilePrefixUtils.getUrlSuffix(picture))) {
+                    log.error("事件图片必须为图片格式---{}", dataExchangeEntity);
+                    return R.fail("事件图片必须为图片格式");
+                } else {
+                    MultipartFile multipartFile = FilePrefixUtils.urlToMultipartFile(picture, System.currentTimeMillis() + ".jpg");
+                    log.info("multipartFile:{}", multipartFile);
+                    try {
+                        SysFile sysFile = SpringUtils.getBean(RemoteFileService.class).upload(multipartFile).getData();
+                        log.info("sysFile:{}", sysFile);
+                        pictureList.add(sysFile.getUrl());
+                    } catch (FileException e) {
+                        log.info("上传附件失败");
+                    }
+
+                }
+            }
+            dataExchangeEntity.setPictureUrlList(pictureList);
+            R<?> result = remoteEventBaseService.insert3rdSystemEvent(dataExchangeEntity);
+            log.info("insert3rdSystemEvent:{}", result);
+            if (result.getCode() == 200) {
+                return R.ok(null, "推送成功");
+            } else {
+                return R.fail(result.getMsg());
+            }
+        } else {
+            return R.fail("推送失败");
+        }
+    }
+
+
+    @PostMapping("/receiveEventData")
+    @ResponseBody
+    public R<?> receiveEventData(@RequestBody DataExchangeEntity dataExchangeEntity) {
+        System.out.println(dataExchangeEntity);
+        R<String> appUrl = remoteConfigService.remotegetConfigKey("appUrl");
+        List<String> pictureList = new ArrayList<>();
+        for (String picture : dataExchangeEntity.getEventPicture()) {
+            pictureList.add(appUrl.getData().toString() + picture);
+        }
+        dataExchangeEntity.setEventPicture(pictureList);
+        // TODO: 2024/1/9 0009 待修改
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("", dataExchangeEntity);
+        try {
+            JSONObject result = RestUtil.post(url, jsonObject);
+            log.info("远程调用119:{}", result);
+        } catch (Exception e) {
+            log.info("远程调用119报错");
+        }
+        return R.ok(null, "接收成功");
+    }
+
+}

+ 35 - 0
src/main/java/com/sooka/sponest/songhuahu/exchange/domian/DataExchangeEntity.java

@@ -0,0 +1,35 @@
+package com.sooka.sponest.songhuahu.exchange.domian;
+
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class DataExchangeEntity {
+
+
+    private String eventName;
+
+    private String eventType;
+
+    private String eventDescription;
+
+    private String eventReporter;
+
+    private String eventReportTime;
+
+    private String eventLocation;
+
+    private String eventLongitude;
+
+    private String eventLatitude;
+
+    private List<String> eventPicture;
+
+    /**
+     * 本地上传之后的图片url
+     */
+    private List<String> pictureUrlList;
+
+}

+ 44 - 0
src/main/java/com/sooka/sponest/songhuahu/exchange/domian/LoginBody.java

@@ -0,0 +1,44 @@
+package com.sooka.sponest.songhuahu.exchange.domian;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 用户登录对象
+ *
+ * @author ruoyi
+ */
+@Getter
+@Setter
+public class LoginBody {
+    /**
+     * sessionId
+     */
+    private String sessionId;
+
+    /**
+     * 用户名
+     */
+    private String username;
+
+    /**
+     * 用户密码
+     */
+    private String password;
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

+ 22 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/EnableSookaFeignClients.java

@@ -0,0 +1,22 @@
+package com.sooka.sponest.songhuahu.remoteapi;
+
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@EnableFeignClients
+public @interface EnableSookaFeignClients {
+
+    String[] value() default {};
+
+    String[] basePackages() default {"com.ruoyi", "com.sooka"};
+
+    Class<?>[] basePackageClasses() default {};
+
+    Class<?>[] defaultConfiguration() default {};
+
+    Class<?>[] clients() default {};
+}

+ 4 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/RemoveApiBaseService.java

@@ -0,0 +1,4 @@
+package com.sooka.sponest.songhuahu.remoteapi;
+
+public interface RemoveApiBaseService {
+}

+ 36 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/auth/RemoteAuthBaseServiceFallbackFactory.java

@@ -0,0 +1,36 @@
+package com.sooka.sponest.songhuahu.remoteapi.fallback.center.auth;
+
+
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.songhuahu.exchange.domian.LoginBody;
+import com.sooka.sponest.songhuahu.remoteapi.service.center.auth.RemoteAuthBaseService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class RemoteAuthBaseServiceFallbackFactory implements FallbackFactory<RemoteAuthBaseService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteAuthBaseServiceFallbackFactory.class);
+
+    @Override
+    public RemoteAuthBaseService create(Throwable cause) {
+        log.error("认证中心-服务调用失败:{}", cause.getMessage());
+
+
+        return new RemoteAuthBaseService() {
+
+            @Override
+            public R<?> loginRemote(LoginBody form) {
+                return null;
+            }
+
+            @Override
+            public R<?> getRemoteSecretKey() {
+                return null;
+            }
+
+        };
+    }
+}

+ 19 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/data/RemoteDataBaseServiceFallbackFactory.java

@@ -0,0 +1,19 @@
+package com.sooka.sponest.songhuahu.remoteapi.fallback.center.data;
+
+
+import com.sooka.sponest.songhuahu.remoteapi.service.center.data.RemoteDataBaseService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class RemoteDataBaseServiceFallbackFactory implements FallbackFactory<RemoteDataBaseService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteDataBaseServiceFallbackFactory.class);
+
+    @Override
+    public RemoteDataBaseService create(Throwable cause) {
+        return null;
+    }
+}

+ 40 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/event/RemoteEventBaseServiceFallbackFactory.java

@@ -0,0 +1,40 @@
+package com.sooka.sponest.songhuahu.remoteapi.fallback.center.event;
+
+
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.songhuahu.exchange.domian.DataExchangeEntity;
+import com.sooka.sponest.songhuahu.remoteapi.service.center.event.RemoteEventBaseService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class RemoteEventBaseServiceFallbackFactory implements FallbackFactory<RemoteEventBaseService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteEventBaseServiceFallbackFactory.class);
+
+    @Override
+    public RemoteEventBaseService create(Throwable cause) {
+        log.error("事件中心-服务调用失败:{}", cause.getMessage());
+
+        return new RemoteEventBaseService() {
+
+            @Override
+            public R<?> insert3rdSystemEvent(DataExchangeEntity dataExchangeEntity) {
+                return null;
+            }
+
+            @Override
+            public R<?> subscribeTo(String list) {
+                return null;
+            }
+
+            @Override
+            public R<?> getDataSubscribeTo() {
+                return null;
+            }
+
+        };
+    }
+}

+ 53 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/fallback/center/system/RemoteSystemBaseServiceFallbackFactory.java

@@ -0,0 +1,53 @@
+package com.sooka.sponest.songhuahu.remoteapi.fallback.center.system;
+
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.system.api.domain.SysUser;
+import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
+import com.sooka.sponest.songhuahu.remoteapi.service.center.system.RemoteSystemService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @program: ruoyi
+ * @description: yy
+ * @author: yy
+ * @create: 2022-06-16 11:05
+ **/
+@Component
+public class RemoteSystemBaseServiceFallbackFactory implements FallbackFactory<RemoteSystemService> {
+
+    private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
+
+    @Override
+    public RemoteSystemService create(Throwable cause) {
+        log.error("维护中心-服务调用失败:{}", cause.getMessage());
+
+        return new RemoteSystemService() {
+
+            @Override
+            public R<List<SysUser>> userFeginlist(SysUser user) {
+                return null;
+            }
+
+            @Override
+            public R<String> selectConfigKey_insectPestsUrl() {
+                return null;
+            }
+
+            @Override
+            public R<String> selectConfigKey_fileUrl() {
+                return null;
+            }
+
+            @Override
+            public R<String> remotegetConfigKey(String configKey) {
+                return null;
+            }
+
+        };
+    }
+}

+ 49 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/ModulesServiceNameContants.java

@@ -0,0 +1,49 @@
+package com.sooka.sponest.songhuahu.remoteapi.service;
+
+import com.ruoyi.common.core.constant.ServiceNameConstants;
+
+public class ModulesServiceNameContants extends ServiceNameConstants {
+
+    //综合治理中心中心
+    public static final String CENTER_COMPREHENSIVE = "sooka-sponest-center-comprehensive";
+
+    //数据中心
+    public static final String CENTER_DATA = "sooka-sponest-center-data";
+
+    //测评中心
+    public static final String CENTER_EVALUATION = "sooka-sponest-center-evaluation";
+
+    //事件中心
+    public static final String CENTER_EVENT = "sooka-sponest-center-event";
+
+    //森林防火中心
+    public static final String CENTER_FIRE = "sooka-sponest-center-fire";
+
+    //监控中心
+    public static final String CENTER_MONITOR = "sooka-sponest-center-monitor";
+
+    //一体化平台
+    public static final String CENTER_ONEST = "sooka-sponest-center-onest";
+
+    //病虫灾害中心
+    public static final String CENTER_PESTS = "sooka-sponest-center-pests";
+
+    //秸秆禁烧中心
+    public static final String CENTER_STRAW = "sooka-sponest-center-straw";
+
+    //任务中心
+    public static final String CENTER_TASK = "sooka-sponest-center-task";
+
+    //运管中心
+    public static final String CENTER_TRANMANAGER = "sooka-sponest-center-tranmanager";
+    //文件中心
+    public static final String CENTER_FILE = "sooka-sponest-file";
+    /**
+     * 系统模块的serviceid
+     */
+    public static final String SYSTEM_SERVICE = "sooka-sponest-system";
+    //认证中心
+    public static final String CENTER_AUTH = "sooka-sponest-auth";
+
+
+}

+ 25 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/auth/RemoteAuthBaseService.java

@@ -0,0 +1,25 @@
+package com.sooka.sponest.songhuahu.remoteapi.service.center.auth;
+
+
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.songhuahu.exchange.domian.LoginBody;
+import com.sooka.sponest.songhuahu.remoteapi.fallback.center.auth.RemoteAuthBaseServiceFallbackFactory;
+import com.sooka.sponest.songhuahu.remoteapi.service.ModulesServiceNameContants;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+
+
+@FeignClient(
+        contextId = "RemoteAuthBaseService",
+        value = ModulesServiceNameContants.CENTER_AUTH,
+        fallbackFactory = RemoteAuthBaseServiceFallbackFactory.class
+)
+public interface RemoteAuthBaseService {
+
+    @PostMapping("/loginRemote")
+    public R<?> loginRemote(LoginBody form);
+
+    @PostMapping("/getRemoteSecretKey")
+    public R<?> getRemoteSecretKey();
+
+}

+ 16 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/data/RemoteDataBaseService.java

@@ -0,0 +1,16 @@
+package com.sooka.sponest.songhuahu.remoteapi.service.center.data;
+
+
+import com.sooka.sponest.songhuahu.remoteapi.fallback.center.data.RemoteDataBaseServiceFallbackFactory;
+import com.sooka.sponest.songhuahu.remoteapi.service.ModulesServiceNameContants;
+import org.springframework.cloud.openfeign.FeignClient;
+
+
+@FeignClient(
+        contextId = "RemoteDataBaseService",
+        value = ModulesServiceNameContants.CENTER_DATA,
+        fallbackFactory = RemoteDataBaseServiceFallbackFactory.class
+)
+public interface RemoteDataBaseService {
+
+}

+ 29 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/event/RemoteEventBaseService.java

@@ -0,0 +1,29 @@
+package com.sooka.sponest.songhuahu.remoteapi.service.center.event;
+
+
+import com.ruoyi.common.core.domain.R;
+import com.sooka.sponest.songhuahu.exchange.domian.DataExchangeEntity;
+import com.sooka.sponest.songhuahu.remoteapi.fallback.center.event.RemoteEventBaseServiceFallbackFactory;
+import com.sooka.sponest.songhuahu.remoteapi.service.ModulesServiceNameContants;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+
+
+@FeignClient(
+        contextId = "RemoteEventBaseService",
+        value = ModulesServiceNameContants.CENTER_EVENT,
+        fallbackFactory = RemoteEventBaseServiceFallbackFactory.class
+)
+public interface RemoteEventBaseService {
+
+    @PostMapping("/fireIncident/insert3rdSystemEvent")
+    public R<?> insert3rdSystemEvent(DataExchangeEntity dataExchangeEntity);
+
+    @PostMapping("/subscribeTo")
+    public R<?> subscribeTo(String list);
+
+
+    @PostMapping("/getDataSubscribeTo")
+    public R<?> getDataSubscribeTo();
+
+}

+ 44 - 0
src/main/java/com/sooka/sponest/songhuahu/remoteapi/service/center/system/RemoteSystemService.java

@@ -0,0 +1,44 @@
+package com.sooka.sponest.songhuahu.remoteapi.service.center.system;
+
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.system.api.domain.SysUser;
+import com.sooka.sponest.songhuahu.remoteapi.fallback.center.system.RemoteSystemBaseServiceFallbackFactory;
+import com.sooka.sponest.songhuahu.remoteapi.service.ModulesServiceNameContants;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+@FeignClient(contextId = "remoteSystemService", fallbackFactory = RemoteSystemBaseServiceFallbackFactory.class, value = ModulesServiceNameContants.SYSTEM_SERVICE)
+public interface RemoteSystemService {
+    /**
+     * 获取系统用户
+     *
+     * @param user
+     * @return com.ruoyi.common.core.domain.R<java.util.List < com.ruoyi.system.api.domain.SysUser>>
+     * @author pengyu
+     * @date 2023/3/8 16:27
+     **/
+    @PostMapping("/user/userFeginlist")
+    public R<List<SysUser>> userFeginlist(@RequestBody SysUser user);
+
+    /**
+     * 获取系统参数配置
+     *
+     * @return com.ruoyi.common.core.domain.R<java.lang.String>
+     * @author pengyu
+     * @date 2023/3/8 16:27
+     **/
+    @GetMapping("/config/selectConfigKey/insectPestsUrl")
+    public R<String> selectConfigKey_insectPestsUrl();
+
+    @GetMapping("/config/selectConfigKey/fileUrl")
+    public R<String> selectConfigKey_fileUrl();
+
+    @PostMapping(value = "/config/remotegetConfigKey")
+    R<String> remotegetConfigKey(@RequestBody String configKey);
+
+
+}

+ 178 - 0
src/main/java/com/sooka/sponest/songhuahu/util/CacheUtils.java

@@ -0,0 +1,178 @@
+package com.sooka.sponest.songhuahu.util;
+
+import com.sooka.sponest.songhuahu.util.spring.SpringUtils;
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.CacheManager;
+import org.apache.shiro.cache.ehcache.EhCacheManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Cache工具类
+ *
+ * @author ruoyi
+ */
+public class CacheUtils {
+    private static final String SYS_CACHE = "sys-cache";
+    private static Logger logger = LoggerFactory.getLogger(CacheUtils.class);
+    private static CacheManager cacheManager = SpringUtils.getBean(CacheManager.class);
+
+    /**
+     * 获取SYS_CACHE缓存
+     *
+     * @param key
+     * @return
+     */
+    public static Object get(String key) {
+        return get(SYS_CACHE, key);
+    }
+
+    /**
+     * 获取SYS_CACHE缓存
+     *
+     * @param key
+     * @param defaultValue
+     * @return
+     */
+    public static Object get(String key, Object defaultValue) {
+        Object value = get(key);
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * 写入SYS_CACHE缓存
+     *
+     * @param key
+     * @return
+     */
+    public static void put(String key, Object value) {
+        put(SYS_CACHE, key, value);
+    }
+
+    /**
+     * 从SYS_CACHE缓存中移除
+     *
+     * @param key
+     * @return
+     */
+    public static void remove(String key) {
+        remove(SYS_CACHE, key);
+    }
+
+    /**
+     * 获取缓存
+     *
+     * @param cacheName
+     * @param key
+     * @return
+     */
+    public static Object get(String cacheName, String key) {
+        return getCache(cacheName).get(getKey(key));
+    }
+
+    /**
+     * 获取缓存
+     *
+     * @param cacheName
+     * @param key
+     * @param defaultValue
+     * @return
+     */
+    public static Object get(String cacheName, String key, Object defaultValue) {
+        Object value = get(cacheName, getKey(key));
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * 写入缓存
+     *
+     * @param cacheName
+     * @param key
+     * @param value
+     */
+    public static void put(String cacheName, String key, Object value) {
+        getCache(cacheName).put(getKey(key), value);
+    }
+
+    /**
+     * 从缓存中移除
+     *
+     * @param cacheName
+     * @param key
+     */
+    public static void remove(String cacheName, String key) {
+        getCache(cacheName).remove(getKey(key));
+    }
+
+    /**
+     * 从缓存中移除所有
+     *
+     * @param cacheName
+     */
+    public static void removeAll(String cacheName) {
+        Cache<String, Object> cache = getCache(cacheName);
+        Set<String> keys = cache.keys();
+        for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
+            cache.remove(it.next());
+        }
+        logger.info("清理缓存: {} => {}", cacheName, keys);
+    }
+
+    /**
+     * 从缓存中移除指定key
+     *
+     * @param keys
+     */
+    public static void removeByKeys(Set<String> keys) {
+        removeByKeys(SYS_CACHE, keys);
+    }
+
+    /**
+     * 从缓存中移除指定key
+     *
+     * @param cacheName
+     * @param keys
+     */
+    public static void removeByKeys(String cacheName, Set<String> keys) {
+        for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
+            remove(it.next());
+        }
+        logger.info("清理缓存: {} => {}", cacheName, keys);
+    }
+
+    /**
+     * 获取缓存键名
+     *
+     * @param key
+     * @return
+     */
+    private static String getKey(String key) {
+        return key;
+    }
+
+    /**
+     * 获得一个Cache,没有则显示日志。
+     *
+     * @param cacheName
+     * @return
+     */
+    public static Cache<String, Object> getCache(String cacheName) {
+        Cache<String, Object> cache = cacheManager.getCache(cacheName);
+        if (cache == null) {
+            throw new RuntimeException("当前系统中没有定义“" + cacheName + "”这个缓存。");
+        }
+        return cache;
+    }
+
+    /**
+     * 获取所有缓存
+     *
+     * @return 缓存组
+     */
+    public static String[] getCacheNames() {
+        return ((EhCacheManager) cacheManager).getCacheManager().getCacheNames();
+    }
+}

+ 275 - 0
src/main/java/com/sooka/sponest/songhuahu/util/RestUtil.java

@@ -0,0 +1,275 @@
+package com.sooka.sponest.songhuahu.util;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.*;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.web.client.RestTemplate;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 调用 Restful 接口 Util
+ *
+ * @author bihs
+ */
+@Slf4j
+public class RestUtil {
+
+
+    /**
+     * RestAPI 调用器
+     */
+    private final static RestTemplate RT;
+
+    static {
+        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+        requestFactory.setConnectTimeout(300000);
+        requestFactory.setReadTimeout(300000);
+        RT = new RestTemplate(requestFactory);
+        // 解决乱码问题
+        RT.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
+    }
+
+    public static RestTemplate getRestTemplate() {
+        return RT;
+    }
+
+    /**
+     * 发送 get 请求
+     */
+    public static JSONObject get(String url) {
+        return getNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 get 请求
+     */
+    public static JSONObject get(String url, JSONObject variables) {
+        return getNative(url, variables, null).getBody();
+    }
+
+    /**
+     * 发送 get 请求
+     */
+    public static JSONObject get(String url, JSONObject variables, JSONObject params) {
+        return getNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 get 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> getNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.GET, variables, params);
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url) {
+        return postNative(url, null, new JSONObject()).getBody();
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url, JSONObject params) {
+        return postNative(url, null, params).getBody();
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url, JSONArray params) {
+        return postNative(url, null, params).getBody();
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url, JSONObject variables, JSONObject params) {
+        return postNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 Post 请求
+     */
+    public static JSONObject post(String url, JSONObject variables, JSONArray params) {
+        return postNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 POST 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> postNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.POST, variables, params);
+    }
+
+    /**
+     * 发送 POST 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> postNative(String url, JSONObject variables, JSONArray params) {
+        return request(url, HttpMethod.POST, variables, params);
+    }
+
+    /**
+     * 发送 put 请求
+     */
+    public static JSONObject put(String url) {
+        return putNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 put 请求
+     */
+    public static JSONObject put(String url, JSONObject params) {
+        return putNative(url, null, params).getBody();
+    }
+
+    /**
+     * 发送 put 请求
+     */
+    public static JSONObject put(String url, JSONObject variables, JSONObject params) {
+        return putNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 put 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> putNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.PUT, variables, params);
+    }
+
+    /**
+     * 发送 delete 请求
+     */
+    public static JSONObject delete(String url) {
+        return deleteNative(url, null, null).getBody();
+    }
+
+    /**
+     * 发送 delete 请求
+     */
+    public static JSONObject delete(String url, JSONObject variables, JSONObject params) {
+        return deleteNative(url, variables, params).getBody();
+    }
+
+    /**
+     * 发送 delete 请求,返回原生 ResponseEntity 对象
+     */
+    public static ResponseEntity<JSONObject> deleteNative(String url, JSONObject variables, JSONObject params) {
+        return request(url, HttpMethod.DELETE, null, variables, params, JSONObject.class);
+    }
+
+    /**
+     * 发送请求
+     */
+    public static ResponseEntity<JSONObject> request(String url, HttpMethod method, JSONObject variables, JSONObject params) {
+        return request(url, method, getHeaderApplicationJson(), variables, params, JSONObject.class);
+    }
+
+    /**
+     * 发送请求
+     */
+    public static ResponseEntity<JSONObject> request(String url, HttpMethod method, JSONObject variables, JSONArray params) {
+        return request(url, method, getHeaderApplicationJson(variables), variables, params, JSONObject.class);
+    }
+
+    /**
+     * 发送请求
+     *
+     * @param url          请求地址
+     * @param method       请求方式
+     * @param headers      请求头  可空
+     * @param variables    请求url参数 可空
+     * @param params       请求body参数 可空
+     * @param responseType 返回类型
+     * @return ResponseEntity<responseType>
+     */
+    public static <T> ResponseEntity<T> request(String url, HttpMethod method, HttpHeaders headers, JSONObject variables, Object params, Class<T> responseType) {
+        log.info(" RestUtil  --- request ---  url = " + url);
+        if (StringUtils.isEmpty(url)) {
+            throw new RuntimeException("url 不能为空");
+        }
+        if (method == null) {
+            throw new RuntimeException("method 不能为空");
+        }
+        if (headers == null) {
+            headers = new HttpHeaders();
+        }
+        // 请求体
+        String body = "";
+        if (params != null) {
+            if (params instanceof JSONObject) {
+                body = ((JSONObject) params).toJSONString();
+
+            } else if (params instanceof JSONArray) {
+                body = ((JSONArray) params).toJSONString();
+            } else {
+                body = params.toString();
+            }
+        }
+        // 拼接 url 参数
+        if (variables != null) {
+            url += ("?" + asUrlVariables(variables));
+        }
+        // 发送请求
+        HttpEntity<String> request = new HttpEntity<>(body, headers);
+        return RT.exchange(url, method, request, responseType);
+    }
+
+    /**
+     * 获取JSON请求头
+     */
+    public static HttpHeaders getHeaderApplicationJson() {
+        return getHeader(MediaType.APPLICATION_JSON_UTF8_VALUE);
+    }
+
+    /**
+     * 获取JSON请求头
+     */
+    public static HttpHeaders getHeaderApplicationJson(JSONObject jsonObject) {
+        HttpHeaders headers = getHeader(MediaType.APPLICATION_JSON_UTF8_VALUE);
+        if (null != jsonObject && null != jsonObject.getString(HttpHeaders.COOKIE)) {
+            headers.add(HttpHeaders.COOKIE, jsonObject.getString(HttpHeaders.COOKIE));
+        }
+        return headers;
+    }
+
+    /**
+     * 获取请求头
+     */
+    public static HttpHeaders getHeader(String mediaType) {
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.parseMediaType(mediaType));
+        headers.add("Accept", mediaType);
+        return headers;
+    }
+
+    /**
+     * 将 JSONObject 转为 a=1&b=2&c=3...&n=n 的形式
+     */
+    public static String asUrlVariables(JSONObject variables) {
+        Map<String, Object> source = variables.getInnerMap();
+        Iterator<String> it = source.keySet().iterator();
+        StringBuilder urlVariables = new StringBuilder();
+        while (it.hasNext()) {
+            String key = it.next();
+            String value = "";
+            Object object = source.get(key);
+            if (object != null) {
+                if (!StringUtils.isEmpty(object.toString())) {
+                    value = object.toString();
+                }
+            }
+            urlVariables.append("&").append(key).append("=").append(value);
+        }
+        // 去掉第一个&
+        return urlVariables.substring(1);
+    }
+
+}

+ 536 - 0
src/main/java/com/sooka/sponest/songhuahu/util/StringUtils.java

@@ -0,0 +1,536 @@
+package com.sooka.sponest.songhuahu.util;
+
+import com.ruoyi.common.core.constant.Constants;
+import com.ruoyi.common.core.text.StrFormatter;
+import org.springframework.util.AntPathMatcher;
+
+import java.util.*;
+
+/**
+ * 字符串工具类
+ *
+ * @author ruoyi
+ */
+public class StringUtils extends org.apache.commons.lang3.StringUtils {
+    /**
+     * 空字符串
+     */
+    private static final String NULLSTR = "";
+
+    /**
+     * 下划线
+     */
+    private static final char SEPARATOR = '_';
+
+    /**
+     * 获取参数不为空值
+     *
+     * @param value defaultValue 要判断的value
+     * @return value 返回值
+     */
+    public static <T> T nvl(T value, T defaultValue) {
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * * 判断一个Collection是否为空, 包含List,Set,Queue
+     *
+     * @param coll 要判断的Collection
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Collection<?> coll) {
+        return isNull(coll) || coll.isEmpty();
+    }
+
+    /**
+     * * 判断一个Collection是否非空,包含List,Set,Queue
+     *
+     * @param coll 要判断的Collection
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Collection<?> coll) {
+        return !isEmpty(coll);
+    }
+
+    /**
+     * * 判断一个对象数组是否为空
+     *
+     * @param objects 要判断的对象数组
+     *                * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Object[] objects) {
+        return isNull(objects) || (objects.length == 0);
+    }
+
+    /**
+     * * 判断一个对象数组是否非空
+     *
+     * @param objects 要判断的对象数组
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Object[] objects) {
+        return !isEmpty(objects);
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     *
+     * @param map 要判断的Map
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Map<?, ?> map) {
+        return isNull(map) || map.isEmpty();
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     *
+     * @param map 要判断的Map
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Map<?, ?> map) {
+        return !isEmpty(map);
+    }
+
+    /**
+     * * 判断一个字符串是否为空串
+     *
+     * @param str String
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(String str) {
+        return isNull(str) || NULLSTR.equals(str.trim());
+    }
+
+    /**
+     * * 判断一个字符串是否为非空串
+     *
+     * @param str String
+     * @return true:非空串 false:空串
+     */
+    public static boolean isNotEmpty(String str) {
+        return !isEmpty(str);
+    }
+
+    /**
+     * * 判断一个对象是否为空
+     *
+     * @param object Object
+     * @return true:为空 false:非空
+     */
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+    /**
+     * * 判断一个对象是否非空
+     *
+     * @param object Object
+     * @return true:非空 false:空
+     */
+    public static boolean isNotNull(Object object) {
+        return !isNull(object);
+    }
+
+    /**
+     * * 判断一个对象是否是数组类型(Java基本型别的数组)
+     *
+     * @param object 对象
+     * @return true:是数组 false:不是数组
+     */
+    public static boolean isArray(Object object) {
+        return isNotNull(object) && object.getClass().isArray();
+    }
+
+    /**
+     * 去空格
+     */
+    public static String trim(String str) {
+        return (str == null ? "" : str.trim());
+    }
+
+    /**
+     * 截取字符串
+     *
+     * @param str   字符串
+     * @param start 开始
+     * @return 结果
+     */
+    public static String substring(final String str, int start) {
+        if (str == null) {
+            return NULLSTR;
+        }
+
+        if (start < 0) {
+            start = str.length() + start;
+        }
+
+        if (start < 0) {
+            start = 0;
+        }
+        if (start > str.length()) {
+            return NULLSTR;
+        }
+
+        return str.substring(start);
+    }
+
+    /**
+     * 截取字符串
+     *
+     * @param str   字符串
+     * @param start 开始
+     * @param end   结束
+     * @return 结果
+     */
+    public static String substring(final String str, int start, int end) {
+        if (str == null) {
+            return NULLSTR;
+        }
+
+        if (end < 0) {
+            end = str.length() + end;
+        }
+        if (start < 0) {
+            start = str.length() + start;
+        }
+
+        if (end > str.length()) {
+            end = str.length();
+        }
+
+        if (start > end) {
+            return NULLSTR;
+        }
+
+        if (start < 0) {
+            start = 0;
+        }
+        if (end < 0) {
+            end = 0;
+        }
+
+        return str.substring(start, end);
+    }
+
+    /**
+     * 格式化文本, {} 表示占位符<br>
+     * 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
+     * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
+     * 例:<br>
+     * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
+     * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
+     * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
+     *
+     * @param template 文本模板,被替换的部分用 {} 表示
+     * @param params   参数值
+     * @return 格式化后的文本
+     */
+    public static String format(String template, Object... params) {
+        if (isEmpty(params) || isEmpty(template)) {
+            return template;
+        }
+        return StrFormatter.format(template, params);
+    }
+
+    /**
+     * 是否为http(s)://开头
+     *
+     * @param link 链接
+     * @return 结果
+     */
+    public static boolean ishttp(String link) {
+        return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
+    }
+
+    /**
+     * 字符串转set
+     *
+     * @param str 字符串
+     * @param sep 分隔符
+     * @return set集合
+     */
+    public static final Set<String> str2Set(String str, String sep) {
+        return new HashSet<String>(str2List(str, sep, true, false));
+    }
+
+    /**
+     * 字符串转list
+     *
+     * @param str         字符串
+     * @param sep         分隔符
+     * @param filterBlank 过滤纯空白
+     * @param trim        去掉首尾空白
+     * @return list集合
+     */
+    public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) {
+        List<String> list = new ArrayList<String>();
+        if (StringUtils.isEmpty(str)) {
+            return list;
+        }
+
+        // 过滤空白字符串
+        if (filterBlank && StringUtils.isBlank(str)) {
+            return list;
+        }
+        String[] split = str.split(sep);
+        for (String string : split) {
+            if (filterBlank && StringUtils.isBlank(string)) {
+                continue;
+            }
+            if (trim) {
+                string = string.trim();
+            }
+            list.add(string);
+        }
+
+        return list;
+    }
+
+    /**
+     * 判断给定的collection列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value
+     *
+     * @param collection 给定的集合
+     * @param array      给定的数组
+     * @return boolean 结果
+     */
+    public static boolean containsAny(Collection<String> collection, String... array) {
+        if (isEmpty(collection) || isEmpty(array)) {
+            return false;
+        } else {
+            for (String str : array) {
+                if (collection.contains(str)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
+     *
+     * @param cs                  指定字符串
+     * @param searchCharSequences 需要检查的字符串数组
+     * @return 是否包含任意一个字符串
+     */
+    public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) {
+        if (isEmpty(cs) || isEmpty(searchCharSequences)) {
+            return false;
+        }
+        for (CharSequence testStr : searchCharSequences) {
+            if (containsIgnoreCase(cs, testStr)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 驼峰转下划线命名
+     */
+    public static String toUnderScoreCase(String str) {
+        if (str == null) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        // 前置字符是否大写
+        boolean preCharIsUpperCase = true;
+        // 当前字符是否大写
+        boolean curreCharIsUpperCase = true;
+        // 下一字符是否大写
+        boolean nexteCharIsUpperCase = true;
+        for (int i = 0; i < str.length(); i++) {
+            char c = str.charAt(i);
+            if (i > 0) {
+                preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
+            } else {
+                preCharIsUpperCase = false;
+            }
+
+            curreCharIsUpperCase = Character.isUpperCase(c);
+
+            if (i < (str.length() - 1)) {
+                nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
+            }
+
+            if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
+                sb.append(SEPARATOR);
+            } else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
+                sb.append(SEPARATOR);
+            }
+            sb.append(Character.toLowerCase(c));
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 是否包含字符串
+     *
+     * @param str  验证字符串
+     * @param strs 字符串组
+     * @return 包含返回true
+     */
+    public static boolean inStringIgnoreCase(String str, String... strs) {
+        if (str != null && strs != null) {
+            for (String s : strs) {
+                if (str.equalsIgnoreCase(trim(s))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 删除最后一个字符串
+     *
+     * @param str  输入字符串
+     * @param spit 以什么类型结尾的
+     * @return 截取后的字符串
+     */
+    public static String lastStringDel(String str, String spit) {
+        if (!StringUtils.isEmpty(str) && str.endsWith(spit)) {
+            return str.subSequence(0, str.length() - 1).toString();
+        }
+        return str;
+    }
+
+    /**
+     * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
+     *
+     * @param name 转换前的下划线大写方式命名的字符串
+     * @return 转换后的驼峰式命名的字符串
+     */
+    public static String convertToCamelCase(String name) {
+        StringBuilder result = new StringBuilder();
+        // 快速检查
+        if (name == null || name.isEmpty()) {
+            // 没必要转换
+            return "";
+        } else if (!name.contains("_")) {
+            // 不含下划线,仅将首字母大写
+            return name.substring(0, 1).toUpperCase() + name.substring(1);
+        }
+        // 用下划线将原始字符串分割
+        String[] camels = name.split("_");
+        for (String camel : camels) {
+            // 跳过原始字符串中开头、结尾的下换线或双重下划线
+            if (camel.isEmpty()) {
+                continue;
+            }
+            // 首字母大写
+            result.append(camel.substring(0, 1).toUpperCase());
+            result.append(camel.substring(1).toLowerCase());
+        }
+        return result.toString();
+    }
+
+    /**
+     * 驼峰式命名法
+     * 例如:user_name->userName
+     */
+    public static String toCamelCase(String s) {
+        if (s == null) {
+            return null;
+        }
+        if (s.indexOf(SEPARATOR) == -1) {
+            return s;
+        }
+        s = s.toLowerCase();
+        StringBuilder sb = new StringBuilder(s.length());
+        boolean upperCase = false;
+        for (int i = 0; i < s.length(); i++) {
+            char c = s.charAt(i);
+
+            if (c == SEPARATOR) {
+                upperCase = true;
+            } else if (upperCase) {
+                sb.append(Character.toUpperCase(c));
+                upperCase = false;
+            } else {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
+     *
+     * @param str  指定字符串
+     * @param strs 需要检查的字符串数组
+     * @return 是否匹配
+     */
+    public static boolean matches(String str, List<String> strs) {
+        if (isEmpty(str) || isEmpty(strs)) {
+            return false;
+        }
+        for (String pattern : strs) {
+            if (isMatch(pattern, str)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 判断url是否与规则配置:
+     * ? 表示单个字符;
+     * * 表示一层路径内的任意字符串,不可跨层级;
+     * ** 表示任意层路径;
+     *
+     * @param pattern 匹配规则
+     * @param url     需要匹配的url
+     * @return
+     */
+    public static boolean isMatch(String pattern, String url) {
+        AntPathMatcher matcher = new AntPathMatcher();
+        return matcher.match(pattern, url);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> T cast(Object obj) {
+        return (T) obj;
+    }
+
+    /**
+     * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。
+     *
+     * @param num  数字对象
+     * @param size 字符串指定长度
+     * @return 返回数字的字符串格式,该字符串为指定长度。
+     */
+    public static final String padl(final Number num, final int size) {
+        return padl(num.toString(), size, '0');
+    }
+
+    /**
+     * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。
+     *
+     * @param s    原始字符串
+     * @param size 字符串指定长度
+     * @param c    用于补齐的字符
+     * @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
+     */
+    public static final String padl(final String s, final int size, final char c) {
+        final StringBuilder sb = new StringBuilder(size);
+        if (s != null) {
+            final int len = s.length();
+            if (s.length() <= size) {
+                for (int i = size - len; i > 0; i--) {
+                    sb.append(c);
+                }
+                sb.append(s);
+            } else {
+                return s.substring(len - size, len);
+            }
+        } else {
+            for (int i = size; i > 0; i--) {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+}

+ 142 - 0
src/main/java/com/sooka/sponest/songhuahu/util/spring/SpringUtils.java

@@ -0,0 +1,142 @@
+package com.sooka.sponest.songhuahu.util.spring;
+
+import com.sooka.sponest.songhuahu.util.StringUtils;
+import org.springframework.aop.framework.AopContext;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+/**
+ * spring工具类 方便在非spring管理环境中获取bean
+ *
+ * @author ruoyi
+ */
+@Component
+public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware {
+    /**
+     * Spring应用上下文环境
+     */
+    private static ConfigurableListableBeanFactory beanFactory;
+
+    private static ApplicationContext applicationContext;
+
+    /**
+     * 获取对象
+     *
+     * @param name
+     * @return Object 一个以所给名字注册的bean的实例
+     * @throws BeansException
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getBean(String name) throws BeansException {
+        return (T) beanFactory.getBean(name);
+    }
+
+    /**
+     * 获取类型为requiredType的对象
+     *
+     * @param clz
+     * @return
+     * @throws BeansException
+     */
+    public static <T> T getBean(Class<T> clz) throws BeansException {
+        T result = (T) beanFactory.getBean(clz);
+        return result;
+    }
+
+    /**
+     * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
+     *
+     * @param name
+     * @return boolean
+     */
+    public static boolean containsBean(String name) {
+        return beanFactory.containsBean(name);
+    }
+
+    /**
+     * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
+     *
+     * @param name
+     * @return boolean
+     * @throws NoSuchBeanDefinitionException
+     */
+    public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
+        return beanFactory.isSingleton(name);
+    }
+
+    /**
+     * @param name
+     * @return Class 注册对象的类型
+     * @throws NoSuchBeanDefinitionException
+     */
+    public static Class<?> getType(String name) throws NoSuchBeanDefinitionException {
+        return beanFactory.getType(name);
+    }
+
+    /**
+     * 如果给定的bean名字在bean定义中有别名,则返回这些别名
+     *
+     * @param name
+     * @return
+     * @throws NoSuchBeanDefinitionException
+     */
+    public static String[] getAliases(String name) throws NoSuchBeanDefinitionException {
+        return beanFactory.getAliases(name);
+    }
+
+    /**
+     * 获取aop代理对象
+     *
+     * @param invoker
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getAopProxy(T invoker) {
+        return (T) AopContext.currentProxy();
+    }
+
+    /**
+     * 获取当前的环境配置,无配置返回null
+     *
+     * @return 当前的环境配置
+     */
+    public static String[] getActiveProfiles() {
+        return applicationContext.getEnvironment().getActiveProfiles();
+    }
+
+    /**
+     * 获取当前的环境配置,当有多个环境配置时,只获取第一个
+     *
+     * @return 当前的环境配置
+     */
+    public static String getActiveProfile() {
+        final String[] activeProfiles = getActiveProfiles();
+        return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null;
+    }
+
+    /**
+     * 获取配置文件中的值
+     *
+     * @param key 配置文件的key
+     * @return 当前的配置文件的值
+     */
+    public static String getRequiredProperty(String key) {
+        return applicationContext.getEnvironment().getRequiredProperty(key);
+    }
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        SpringUtils.beanFactory = beanFactory;
+    }
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        SpringUtils.applicationContext = applicationContext;
+    }
+
+}

+ 2 - 0
src/main/resources/banner.txt

@@ -0,0 +1,2 @@
+Spring Boot Version: ${spring-boot.version}
+Spring Application Name: ${spring.application.name}

+ 19 - 0
src/main/resources/bootstrap.yml

@@ -0,0 +1,19 @@
+# Tomcat
+server:
+  #测试
+  #  port: 16009
+  # 生产
+  port: 16001
+#  port: 41000
+# Spring
+spring:
+  application:
+    # 应用名称
+    name: sooka-sponest-dataexchange
+  profiles:
+    # 环境配置
+    active: dev
+  redis:
+    host: 127.0.0.1
+    port: 16379
+    password: sooka123456