jiazx0107@163.com
2023-10-23 e5c5137e91c04fff001d439d64ed5a253e3fc8da
初期提交四川相关配置
已删除1个文件
已修改9个文件
已添加13个文件
696 ■■■■■ 文件已修改
pom.xml 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/api/utils/AESUtils.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/api/utils/ContextUtil.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/api/utils/ShRSAUtils.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/conf/WebsocketConfig.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/GatewayRunner.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/entity/GatewayConf.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/package-info.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/sc2023/ScConstant.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/sc2023/api/ApiInitService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/sc2023/package-info.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/sc2023/websocket/WebSocketMqtt.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/mqtt/MqttAcceptCallback.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/mqtt/MqttAcceptClient.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/mqtt/MqttCondition.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/mqtt/MqttProperties.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/sys/RolePR.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/sys/UserPR.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-gateway.yml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-pro.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
velocity.log 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -38,6 +38,10 @@
                    <artifactId>javassist</artifactId>
                    <groupId>javassist</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>dom4j</artifactId>
                    <groupId>dom4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
@@ -107,6 +111,33 @@
            <version>${spring.boot.version}</version>
        </dependency>
        <!-- websocket -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-websocket</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <!-- mqtt -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-integration</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-stream</artifactId>
            <version>5.2.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-mqtt</artifactId>
            <version>5.2.0.RELEASE</version>
        </dependency>
        <!-- thymeleaf -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
@@ -126,12 +157,9 @@
            <version>1.4.01</version>
        </dependency>
        <!-- Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring.security}</version>
        </dependency>
        <!-- Security <dependency> <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId> <version>${spring.security}</version>
            </dependency> -->
        <!-- druid -->
@@ -271,28 +299,30 @@
    <build>
        <plugins>
            <!-- è®¾ç½®ç¼–译版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
<!--            <plugin>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <goals>-->
<!--                            <goal>repackage</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
        </plugins>
        <resources>
src/main/java/com/fzzy/api/utils/AESUtils.java
@@ -1,7 +1,6 @@
package com.fzzy.api.utils;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
src/main/java/com/fzzy/api/utils/ContextUtil.java
@@ -101,9 +101,6 @@
//        int i = ContextUtil.getMinuteOfHour(date);
//
//        System.out.println(i);
        String str = null;
        String [] s= str.split("-");
        System.out.println( Integer.valueOf(s[0]));
    }
src/main/java/com/fzzy/api/utils/ShRSAUtils.java
@@ -1,13 +1,11 @@
package com.fzzy.api.utils;
;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
src/main/java/com/fzzy/conf/WebsocketConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.fzzy.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
 * é¡¹ç›®ä½¿ç”¨WEbSocket配置
 */
@Configuration
public class WebsocketConfig {
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
}
src/main/java/com/fzzy/gateway/GatewayRunner.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
package com.fzzy.gateway;
import com.fzzy.api.service.ApiCommonService;
import com.fzzy.api.service.ApiTriggerService;
import com.fzzy.api.service.GbCheckItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
/**
 * é…ç½®éšç³»ç»Ÿå¯åŠ¨é»˜è®¤é…ç½®
 */
@Service
@Slf4j
@Order(value = 2)
public class GatewayRunner implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        log.info("网关接口随系统启动------------");
        //四川网关接口,启动默认获取鉴权信息,长期有效
    }
}
src/main/java/com/fzzy/gateway/entity/GatewayConf.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
package com.fzzy.gateway.entity;
import com.bstek.dorado.annotation.PropertyDef;
import com.fzzy.api.Constant;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
 * ç½‘关配置
 */
@Data
@Entity
@Table(name = "G_CONF")
public class GatewayConf implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 8687625896329163486L;
    @Id
    @PropertyDef(label = "库区代码")
    @Column(name = "kqdm", length = 50)
    private String kqdm;
    @PropertyDef(label = "库区名称")
    @Column(name = "kqmc", length = 100)
    private String kqmc;
    @PropertyDef(label = "用户名")
    @Column(name = "username", length = 50)
    private String userName;
    @PropertyDef(label = "密码")
    @Column(name = "password", length = 50)
    private String password;
    @PropertyDef(label = "省平台加密公钥")
    @Column(name = "publicKey", length = 200)
    private String publicKey;
    @PropertyDef(label = "省平台接口地址")
    @Column(name = "apiUrl", length = 200)
    private String apiUrl;
    @PropertyDef(label = "推送协议")
    @Column(name = "pushProtocol", length = 20)
    private String pushProtocol;
    @PropertyDef(label = "粮库系统库区代码")
    @Column(name = "deptId", length = 50)
    private String deptId;
    @PropertyDef(label = "是否上线")
    @Column(name = "exe_tag", length = 2)
    private String exeTag = Constant.YN_Y;
}
src/main/java/com/fzzy/gateway/package-info.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,4 @@
/**
 * ç½‘关接口
 */
package com.fzzy.gateway;
src/main/java/com/fzzy/gateway/sc2023/ScConstant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.fzzy.gateway.sc2023;
import java.util.HashMap;
import java.util.Map;
/**
 * å¸¸é‡
 */
public class ScConstant {
    public static Map<String,String> contextToken = new HashMap<>();
}
src/main/java/com/fzzy/gateway/sc2023/api/ApiInitService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.fzzy.gateway.sc2023.api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
 * å½“前接口,初始化相关
 */
@Slf4j
@Component
public class ApiInitService {
}
src/main/java/com/fzzy/gateway/sc2023/package-info.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
/**
 * å››å·çœ-2023年接口
 */
package com.fzzy.gateway.sc2023;
src/main/java/com/fzzy/gateway/sc2023/websocket/WebSocketMqtt.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
package com.fzzy.gateway.sc2023.websocket;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 *
 */
@Slf4j
@Component
@ServerEndpoint(value = "/mqtt")
public class WebSocketMqtt {
    private static Map<String, Session> sessionPool = new ConcurrentHashMap<>();
    // ä¸ŽæŸä¸ªå®¢æˆ·ç«¯çš„连接会话,需要通过它来给客户端发送数据
    private Session session;
    private String key;
    @OnOpen
    public void onOpen(Session session,
                       @PathParam("keepalive") String keepalive,
                       @PathParam("clientId") String clientId,
                       @PathParam("protocolId") String protocolId,
                       @PathParam("protocolVersion") String protocolVersion,
                       @PathParam("clean") String clean,
                       @PathParam("reconnectPeriod") String reconnectPeriod,
                       @PathParam("reconnectTimeout") String reconnectTimeout
    ) throws Exception {
        this.session = session;
        key = clientId;
        sessionPool.put(key, session);
        log.info("new webSocket,clientId={}", key);
    }
    @OnClose
    public void onClose() {
        sessionPool.remove(key);
        log.info("WebSocket连接关闭={}", key);
    }
    /**
     * æ”¶åˆ°å‰ç«¯å‘送的信息
     *
     * @param message
     * @param session
     */
    @OnMessage
    public void onMessage(String message, Session session) {
        log.info("来自客户端信息:\n" + message);
    }
    @OnError
    public void onError(Session session, Throwable error) {
        log.error("发生错误");
        sessionPool.remove(key);
        error.printStackTrace();
    }
}
src/main/java/com/fzzy/mqtt/MqttAcceptCallback.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,90 @@
package com.fzzy.mqtt;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @Description : MQTT接受服务的回调类
 */
@Slf4j
@Component
public class MqttAcceptCallback implements MqttCallbackExtended {
    @Autowired
    private MqttAcceptClient mqttAcceptClient;
    @Autowired
    private MqttProperties mqttProperties;
    /**
     * å®¢æˆ·ç«¯æ–­å¼€åŽè§¦å‘
     *
     * @param throwable
     */
    @Override
    public void connectionLost(Throwable throwable) {
        log.info("连接断开,可以重连");
        if (MqttAcceptClient.client == null || !MqttAcceptClient.client.isConnected()) {
            log.info("【emqx重新连接】....................................................");
            mqttAcceptClient.reconnection();
        }
    }
    /**
     * å®¢æˆ·ç«¯æ”¶åˆ°æ¶ˆæ¯è§¦å‘
     *
     * @param topic       ä¸»é¢˜
     * @param mqttMessage æ¶ˆæ¯
     */
    @Override
    public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
        log.info("【接收消息主题】:" + topic);
        log.info("【接收消息Qos】:" + mqttMessage.getQos());
        log.info("【接收消息内容】:" + new String(mqttMessage.getPayload()));
        //        int i = 1/0;
    }
    /**
     * å‘布消息成功
     *
     * @param token token
     */
    @Override
    public void deliveryComplete(IMqttDeliveryToken token) {
        String[] topics = token.getTopics();
        for (String topic : topics) {
            log.info("向主题【" + topic + "】发送消息成功!");
        }
        try {
            MqttMessage message = token.getMessage();
            byte[] payload = message.getPayload();
            String s = new String(payload, "UTF-8");
            log.info("【消息内容】:" + s);
        } catch (Exception e) {
            log.error("MqttAcceptCallback deliveryComplete error,message:{}", e.getMessage());
            e.printStackTrace();
        }
    }
    /**
     * è¿žæŽ¥emq服务器后触发
     *
     * @param b
     * @param s
     */
    @Override
    public void connectComplete(boolean b, String s) {
        log.info("============================= å®¢æˆ·ç«¯ã€" + MqttAcceptClient.client.getClientId() + "】连接成功!=============================");
        // ä»¥/#结尾表示订阅所有以test开头的主题
        // è®¢é˜…所有机构主题
        mqttAcceptClient.subscribe(mqttProperties.getDefaultTopic(), 0);
    }
}
src/main/java/com/fzzy/mqtt/MqttAcceptClient.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,104 @@
package com.fzzy.mqtt;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @Description : MQTT接受服务的客户端
 */
@Slf4j
@Component
public class MqttAcceptClient {
    @Autowired
    private MqttAcceptCallback mqttAcceptCallback;
    @Autowired
    private MqttProperties mqttProperties;
    public static MqttClient client;
    private static MqttClient getClient() {
        return client;
    }
    private static void setClient(MqttClient client) {
        MqttAcceptClient.client = client;
    }
    /**
     * å®¢æˆ·ç«¯è¿žæŽ¥
     */
    public void connect() {
        MqttClient client;
        try {
            client = new MqttClient(mqttProperties.getHost(), mqttProperties.getClientId(),
                    new MemoryPersistence());
            MqttConnectOptions options = new MqttConnectOptions();
            options.setUserName(mqttProperties.getClientUsername());
            options.setPassword(mqttProperties.getClientPassword().toCharArray());
            options.setConnectionTimeout(mqttProperties.getClientTimeout());
            options.setKeepAliveInterval(mqttProperties.getClientAliveTime());
            options.setAutomaticReconnect(mqttProperties.getReconnect());
            options.setCleanSession(mqttProperties.getCleanSession());
            MqttAcceptClient.setClient(client);
            // è®¾ç½®å›žè°ƒ
            client.setCallback(mqttAcceptCallback);
            client.connect(options);
        } catch (Exception e) {
            log.error("MqttAcceptClient connect error,message:{}", e.getMessage());
            e.printStackTrace();
        }
    }
    /**
     * é‡æ–°è¿žæŽ¥
     */
    public void reconnection() {
        try {
            client.connect();
        } catch (MqttException e) {
            log.error("MqttAcceptClient reconnection error,message:{}", e.getMessage());
            e.printStackTrace();
        }
    }
    /**
     * è®¢é˜…某个主题
     *
     * @param topic ä¸»é¢˜
     * @param qos   è¿žæŽ¥æ–¹å¼
     */
    public void subscribe(String topic, int qos) {
        log.info("========================【开始订阅主题:" + topic + "】========================");
        try {
            client.subscribe(topic, qos);
        } catch (MqttException e) {
            log.error("MqttAcceptClient subscribe error,message:{}", e.getMessage());
            e.printStackTrace();
        }
    }
    /**
     * å–消订阅某个主题
     *
     * @param topic
     */
    public void unsubscribe(String topic) {
        log.info("========================【取消订阅主题:" + topic + "】========================");
        try {
            client.unsubscribe(topic);
        } catch (MqttException e) {
            log.error("MqttAcceptClient unsubscribe error,message:{}", e.getMessage());
            e.printStackTrace();
        }
    }
}
src/main/java/com/fzzy/mqtt/MqttCondition.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.fzzy.mqtt;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
/**
 * @Description : è‡ªå®šä¹‰é…ç½®,通过这个配置,来控制启动项目的时候是否启动mqtt
 */
public class MqttCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata annotatedTypeMetadata) {
        //1、能获取到ioc使用的beanfactory
        ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        //2、获取类加载器
        ClassLoader classLoader = context.getClassLoader();
        //3、获取当前环境信息
        Environment environment = context.getEnvironment();
        String isOpen = environment.getProperty("mqtt.isOpen");
        return Boolean.valueOf(isOpen);
    }
}
src/main/java/com/fzzy/mqtt/MqttProperties.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
package com.fzzy.mqtt;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
 * MQTT é…ç½®ä¿¡æ¯
 */
@Component
@ConfigurationProperties("mqtt")
@Data
public class MqttProperties {
    /**
     * è¿žæŽ¥åœ°å€
     */
    private String host;
    /**
     * ç”¨æˆ·å
     */
    private String clientUsername;
    /**
     * å¯†ç 
     */
    private String clientPassword;
    /**
     * å®¢æˆ·ç«¯Id,同一台服务器下,不允许出现重复的客户端id
     */
    private String clientId;
    /**
     * è¶…æ—¶æ—¶é—´
     */
    private int clientTimeout;
    /**
     * è®¾ç½®ä¼šè¯å¿ƒè·³æ—¶é—´ å•位为秒 æœåŠ¡å™¨ä¼šæ¯éš”1.5*20秒的时间向客户端
     * å‘送个消息判断客户端是否在线,但这个方法并没有重连的机制
     */
    private int clientAliveTime;
    private int clientMaxConnectTime;
    private String clientTopics;
    /**
     * è¿žæŽ¥æ–¹å¼
     */
    private Integer clientQos;
    /**
     * é»˜è®¤è¿žæŽ¥ä¸»é¢˜ï¼Œä»¥/#结尾表示订阅所有以test开头的主题
     */
    private String  defaultTopic;
    /**
     * è®¾ç½®æ˜¯å¦æ¸…空session,这里如果设置为false表示服务器会保留客户端的连
     * æŽ¥è®°å½•,这里设置为true表示每次连接到服务器都以新的身份连接
     */
    private Boolean cleanSession;
    /**
     * æ˜¯å¦æ–­çº¿é‡è¿ž
     */
    private Boolean reconnect;
    /**
     * å¯åŠ¨çš„æ—¶å€™æ˜¯å¦å…³é—­mqtt
     */
    private Boolean isOpen;
}
src/main/java/com/fzzy/sys/RolePR.java
@@ -15,11 +15,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * æƒé™ç»´æŠ¤
src/main/java/com/fzzy/sys/UserPR.java
@@ -5,19 +5,13 @@
import com.bstek.dorado.annotation.Expose;
import com.bstek.dorado.data.entity.EntityState;
import com.bstek.dorado.data.entity.EntityUtils;
import com.fzzy.api.Constant;
import com.fzzy.sys.entity.SysUser;
import com.fzzy.sys.repository.UserRepository;
import org.apache.commons.lang.math.RandomUtils;
import org.bouncycastle.crypto.generators.BCrypt;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -31,7 +25,6 @@
    @Autowired
    private UserRepository userRepository;
    private BCryptPasswordEncoder bCryptPasswordEncoder;
    /**
     * sys.userPR#findAll
@@ -65,10 +58,10 @@
            //密码加密
            int salt = RandomUtils.nextInt(27);
            salt += 4;
            bCryptPasswordEncoder = new BCryptPasswordEncoder(salt);
            String password = bCryptPasswordEncoder.encode(entity.getPassword());
//            bCryptPasswordEncoder = new BCryptPasswordEncoder(salt);
//            String password = bCryptPasswordEncoder.encode(entity.getPassword());
//            boolean b= bCryptPasswordEncoder.matches(entity.getPassword(),password);
            entity.setPassword(password);
            entity.setPassword(entity.getPassword());
            entity.setSalt(String.valueOf(salt));
        }
        // æ‰‹åЍ将doradoEntity对象转换为标准Bean对象
@@ -101,9 +94,9 @@
        //密码加密
        int salt = RandomUtils.nextInt(27);
        salt += 4;
        bCryptPasswordEncoder = new BCryptPasswordEncoder(salt);
        String password = bCryptPasswordEncoder.encode(Constant.DEFAULT_USER_PASSWORD);
        entity.setPassword(password);
//        bCryptPasswordEncoder = new BCryptPasswordEncoder(salt);
//        String password = bCryptPasswordEncoder.encode(Constant.DEFAULT_USER_PASSWORD);
        entity.setPassword(entity.getPassword());
        entity.setSalt(String.valueOf(salt));
        SysUser data = new SysUser();
src/main/resources/application-dev.yml
@@ -5,6 +5,7 @@
  datasource:
    #主数据源
    primary:
      url: jdbc:mysql://127.0.0.1:3306/igds_api?useUnicode=true&useSSL=false&characterEncoding=utf-8
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5016?useUnicode=true&useSSL=false&characterEncoding=utf-8     #大湾区
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5303?useUnicode=true&useSSL=false&characterEncoding=utf-8     #上海嘉定
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5311?useUnicode=true&useSSL=false&characterEncoding=utf-8     #广澳
@@ -24,13 +25,14 @@
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5320?useUnicode=true&useSSL=false&characterEncoding=utf-8     #广东台山
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5321?useUnicode=true&useSSL=false&characterEncoding=utf-8     #广东韶关
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5322?useUnicode=true&useSSL=false&characterEncoding=utf-8     #广东徐闻
      url: jdbc:mysql://127.0.0.1:3306/igds_api_5326?useUnicode=true&useSSL=false&characterEncoding=utf-8     #惠州惠新
      #      url: jdbc:mysql://127.0.0.1:3306/igds_api_5326?useUnicode=true&useSSL=false&characterEncoding=utf-8     #惠州惠新
#      url: jdbc:mysql://127.0.0.1:3306/igds_api_5327?useUnicode=true&useSSL=false&characterEncoding=utf-8     #武汉黄陂军粮
      username: root
      password: Abc123..
      driver-class-name: com.mysql.jdbc.Driver
    #次数据源
    secondary:
      url: jdbc:mysql://127.0.0.1:3306/igds_v40?useUnicode=true&useSSL=false&characterEncoding=utf-8
#      url: jdbc:mysql://127.0.0.1:3306/igds_3.5_5016?useUnicode=true&useSSL=false&characterEncoding=utf-8  #大湾区
#      url: jdbc:mysql://127.0.0.1:3306/igds_3.5_5303?useUnicode=true&useSSL=false&characterEncoding=utf-8  #上海嘉定
#      url: jdbc:mysql://127.0.0.1:3306/igds_3.5_5311?useUnicode=true&useSSL=false&characterEncoding=utf-8  #广澳
@@ -38,7 +40,7 @@
#      url: jdbc:mysql://127.0.0.1:3306/igds_3.5_5320?useUnicode=true&useSSL=false&characterEncoding=utf-8
#      url: jdbc:mysql://127.0.0.1:3306/igds_3.5_5321?useUnicode=true&useSSL=false&characterEncoding=utf-8
#      url: jdbc:mysql://127.0.0.1:3306/igds_4.0_5322?useUnicode=true&useSSL=false&characterEncoding=utf-8  #广东徐闻
      url: jdbc:mysql://127.0.0.1:3306/igds_4.0_5326?useUnicode=true&useSSL=false&characterEncoding=utf-8  #惠州惠新
      #      url: jdbc:mysql://127.0.0.1:3306/igds_4.0_5326?useUnicode=true&useSSL=false&characterEncoding=utf-8  #惠州惠新
#      url: jdbc:mysql://127.0.0.1:3306/igds_4.0_5327?useUnicode=true&useSSL=false&characterEncoding=utf-8  #武汉黄陂军粮
      username: root
      password: Abc123..
@@ -65,7 +67,7 @@
    database: 5
    host: 127.0.0.1
    port: 6379
    password: Abc123..
    password: Redispwd..
    # è¿žæŽ¥æ± æœ€å¤§è¿žæŽ¥æ•°ï¼ˆä½¿ç”¨è´Ÿå€¼è¡¨ç¤ºæ²¡æœ‰é™åˆ¶ï¼‰
    pool:
      max-active: 200
@@ -73,3 +75,15 @@
      max-idle: 10
      min-idle: 0
      timeout: 6000
mqtt:
  host: tcp://10.13.4.84:11883
  client-id:
  client-username:
  client-password:
  client-timeout: 10
  client-alive-time: 20
  client-max-connect-times: 5
  client-topics:
  client-qos: 0
  isOpen: false
src/main/resources/application-gateway.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
##########################  ç½‘关模式接口   ##########################
server:
  port: 8083
  jetty:
    max-http-post-size: 209715200
  tomcat:
    max-http-post-size: 209715200
spring:
  datasource:
    #主数据源
    primary:
      url: jdbc:mysql://127.0.0.1:3306/igds_api?useUnicode=true&characterEncoding=utf-8
      username: root
      password: Abc123..
      driver-class-name: com.mysql.jdbc.Driver
    #次数据源
    secondary:
      url: jdbc:mysql://127.0.0.1:3306/igds_master?useUnicode=true&characterEncoding=utf-8
      username: root
      password: Abc123..
      driver-class-name: com.mysql.jdbc.Driver
  jpa:
    #主jpa配置
    primary:
      show-sql: true
      properties:
        hibernate:
          hbm2ddl:
            auto: update
          dialect: org.hibernate.dialect.MySQL5InnoDBDialect
    #次jpa配置
    secondary:
      show-sql: true
      properties:
        hibernate:
          hbm2ddl:
            auto: none
          dialect: org.hibernate.dialect.MySQL5InnoDBDialect
  # Redis相关配置
  redis:
    database: 1
    host: 127.0.0.1
    port: 6379
    password: Redispwd..
    # è¿žæŽ¥æ± æœ€å¤§è¿žæŽ¥æ•°ï¼ˆä½¿ç”¨è´Ÿå€¼è¡¨ç¤ºæ²¡æœ‰é™åˆ¶ï¼‰
    pool:
      max-active: 200
      max-wait: -1
      max-idle: 10
      min-idle: 0
      timeout: 6000
igds:
  default:
    companyId: 5326
  file-path: D:/IGDS-API/FILE/
  img-path: D:/IGDS/FILE/
src/main/resources/application-pro.yml
@@ -41,7 +41,7 @@
    database: 1
    host: 127.0.0.1
    port: 6379
    password: Abc123..
    password: Redispwd..
    # è¿žæŽ¥æ± æœ€å¤§è¿žæŽ¥æ•°ï¼ˆä½¿ç”¨è´Ÿå€¼è¡¨ç¤ºæ²¡æœ‰é™åˆ¶ï¼‰
    pool:
      max-active: 200
src/main/resources/application.yml
@@ -1,7 +1,7 @@
##########################  Server   ##########################
spring:
  profiles:
    active: pro
    active: dev
  application:
    name: igds-api
  main:
velocity.log
ÎļþÒÑɾ³ý