zf
2024-03-25 cd02923a7ce1ffa004b3abbb7af67ab6173dd99d
Merge branch 'master' of https://sinanoaq.cn:8888/r/safePlatform-out into zf
已重命名1个文件
已修改17个文件
已添加2个文件
1049 ■■■■■ 文件已修改
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/EquipmentInfoServiceImpl.java 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentCaseInfoMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataCourceProperties.java 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEquipment.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigGoalManage.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigIncidentManage.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-dev.yaml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-guotai-prod-1.yaml 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-guotai-prod.yaml 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-online-uat.yaml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-test.yaml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application-uat.yaml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application.yaml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/service/impl/EquipmentInfoServiceImpl.java
@@ -261,45 +261,55 @@
        //保存设备保养
        List<EquipmentTakecareDetail> takecareDetailList = infoDto.getTakecareDetailList();
        takecareDetailList.forEach(f->{
            f.setEquipmentId(equipmentInfo.getId());
            f.setInfoTpe(equipmentInfo.getInfoType());
        });
        equipmentTakecareDetailBaseService.saveOrUpdateBatch(takecareDetailList);
        if(StringUtils.hasText(infoDto.getDelTakecareDetails())){
            List<Long> idList = Arrays.stream(infoDto.getDelTakecareDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                    .collect(Collectors.toList());
            List<EquipmentTakecareDetail> delList = new ArrayList<>();
            idList.forEach(f->{
                EquipmentTakecareDetail info = new EquipmentTakecareDetail();
                info.setDelFlag(1);
                info.setId(f);
                delList.add(info);
        if(takecareDetailList != null && !takecareDetailList.isEmpty()){
            takecareDetailList.forEach(f->{
                f.setEquipmentId(equipmentInfo.getId());
                f.setInfoTpe(equipmentInfo.getInfoType());
            });
            equipmentTakecareDetailBaseService.updateBatchById(delList);
            equipmentTakecareDetailBaseService.saveOrUpdateBatch(takecareDetailList);
        }
        if(infoDto.getTakecareDetailList() != null){
            if(StringUtils.hasText(infoDto.getDelTakecareDetails())){
                List<Long> idList = Arrays.stream(infoDto.getDelTakecareDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                        .collect(Collectors.toList());
                if(idList != null && !idList.isEmpty()){
                    List<EquipmentTakecareDetail> delList = new ArrayList<>();
                    idList.forEach(f->{
                        EquipmentTakecareDetail info = new EquipmentTakecareDetail();
                        info.setDelFlag(1);
                        info.setId(f);
                        delList.add(info);
                    });
                    equipmentTakecareDetailBaseService.updateBatchById(delList);
                }
            }
        }
        //保存设备检测
        List<EquipmentTestDetail> testDetailList = infoDto.getTestDetailList();
        testDetailList.forEach(f->{
            f.setEquipmentId(equipmentInfo.getId());
            f.setInfoTpe(equipmentInfo.getInfoType());
        });
        equipmentTestDetailBaseService.saveOrUpdateBatch(testDetailList);
        if(StringUtils.hasText(infoDto.getDelTestDetails())){
            List<Long> idList = Arrays.stream(infoDto.getDelTestDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                    .collect(Collectors.toList());
            List<EquipmentTestDetail> delList = new ArrayList<>();
            idList.forEach(f->{
                EquipmentTestDetail info = new EquipmentTestDetail();
                info.setDelFlag(1);
                info.setId(f);
                delList.add(info);
        if(testDetailList != null && !testDetailList.isEmpty()){
            testDetailList.forEach(f->{
                f.setEquipmentId(equipmentInfo.getId());
                f.setInfoTpe(equipmentInfo.getInfoType());
            });
            equipmentTestDetailBaseService.updateBatchById(delList);
            equipmentTestDetailBaseService.saveOrUpdateBatch(testDetailList);
        }
        if(infoDto.getDelTestDetails() != null && !infoDto.getDelTestDetails().isEmpty()){
            if(StringUtils.hasText(infoDto.getDelTestDetails())){
                List<Long> idList = Arrays.stream(infoDto.getDelTestDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                        .collect(Collectors.toList());
                List<EquipmentTestDetail> delList = new ArrayList<>();
                idList.forEach(f->{
                    EquipmentTestDetail info = new EquipmentTestDetail();
                    info.setDelFlag(1);
                    info.setId(f);
                    delList.add(info);
                });
                equipmentTestDetailBaseService.updateBatchById(delList);
            }
        }
        //设备检查 TODO
@@ -307,64 +317,77 @@
        //保存设备维修
        List<EquipmentRepairDetail> repaireDetailList = infoDto.getRepaireDetailList();
        repaireDetailList.forEach(f->{
            f.setEquipmentId(equipmentInfo.getId());
            f.setInfoTpe(equipmentInfo.getInfoType());
        });
        equipmentRepairDetailBaseService.saveOrUpdateBatch(repaireDetailList);
        if(StringUtils.hasText(infoDto.getDelRepaireDetails())){
            List<Long> idList = Arrays.stream(infoDto.getDelRepaireDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                    .collect(Collectors.toList());
            List<EquipmentRepairDetail> delList = new ArrayList<>();
            idList.forEach(f->{
                EquipmentRepairDetail info = new EquipmentRepairDetail();
                info.setDelFlag(1);
                info.setId(f);
                delList.add(info);
        if(repaireDetailList != null && !repaireDetailList.isEmpty()){
            repaireDetailList.forEach(f->{
                f.setEquipmentId(equipmentInfo.getId());
                f.setInfoTpe(equipmentInfo.getInfoType());
            });
            equipmentRepairDetailBaseService.updateBatchById(delList);
            equipmentRepairDetailBaseService.saveOrUpdateBatch(repaireDetailList);
        }
        if(infoDto.getDelRepaireDetails() != null && !infoDto.getDelRepaireDetails().isEmpty()){
            if(StringUtils.hasText(infoDto.getDelRepaireDetails())){
                List<Long> idList = Arrays.stream(infoDto.getDelRepaireDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                        .collect(Collectors.toList());
                List<EquipmentRepairDetail> delList = new ArrayList<>();
                idList.forEach(f->{
                    EquipmentRepairDetail info = new EquipmentRepairDetail();
                    info.setDelFlag(1);
                    info.setId(f);
                    delList.add(info);
                });
                equipmentRepairDetailBaseService.updateBatchById(delList);
            }
        }
        //保存检查标准
        List<EquipmentCheckStandardDetail> checkStandardeDetailList = infoDto.getCheckStandardeDetailList();
        checkStandardeDetailList.forEach(f->{
            f.setEquipmentId(equipmentInfo.getId());
            f.setInfoTpe(equipmentInfo.getInfoType());
        });
        equipmentCheckStandardDetailBaseService.saveOrUpdateBatch(checkStandardeDetailList);
        if(StringUtils.hasText(infoDto.getDelCheckStandardeDetails())){
            List<Long> idList = Arrays.stream(infoDto.getDelCheckStandardeDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                    .collect(Collectors.toList());
            List<EquipmentCheckStandardDetail> delList = new ArrayList<>();
            idList.forEach(f->{
                EquipmentCheckStandardDetail info = new EquipmentCheckStandardDetail();
                info.setDelFlag(1);
                info.setId(f);
                delList.add(info);
        if(checkStandardeDetailList != null && !checkStandardeDetailList.isEmpty()){
            checkStandardeDetailList.forEach(f->{
                f.setEquipmentId(equipmentInfo.getId());
                f.setInfoTpe(equipmentInfo.getInfoType());
            });
            equipmentCheckStandardDetailBaseService.updateBatchById(delList);
            equipmentCheckStandardDetailBaseService.saveOrUpdateBatch(checkStandardeDetailList);
        }
        if(infoDto.getDelCheckStandardeDetails() != null && !infoDto.getDelCheckStandardeDetails().isEmpty()){
            if(StringUtils.hasText(infoDto.getDelCheckStandardeDetails())){
                List<Long> idList = Arrays.stream(infoDto.getDelCheckStandardeDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                        .collect(Collectors.toList());
                List<EquipmentCheckStandardDetail> delList = new ArrayList<>();
                idList.forEach(f->{
                    EquipmentCheckStandardDetail info = new EquipmentCheckStandardDetail();
                    info.setDelFlag(1);
                    info.setId(f);
                    delList.add(info);
                });
                equipmentCheckStandardDetailBaseService.updateBatchById(delList);
            }
        }
        //保存保养标准
        List<EquipmentTakecareStardardDetail> takecareStardardeDetailList = infoDto.getTakecareStardardeDetailList();
        takecareStardardeDetailList.forEach(f->{
            f.setEquipmentId(equipmentInfo.getId());
            f.setInfoTpe(equipmentInfo.getInfoType());
        });
        equipmentTakecareStardardDetailBaseService.saveOrUpdateBatch(takecareStardardeDetailList);
        if(StringUtils.hasText(infoDto.getDelTakecareStardardeDetails())){
            List<Long> idList = Arrays.stream(infoDto.getDelTakecareStardardeDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                    .collect(Collectors.toList());
            List<EquipmentTakecareStardardDetail> delList = new ArrayList<>();
            idList.forEach(f->{
                EquipmentTakecareStardardDetail info = new EquipmentTakecareStardardDetail();
                info.setDelFlag(1);
                info.setId(f);
                delList.add(info);
        if(takecareStardardeDetailList != null && !takecareStardardeDetailList.isEmpty()){
            takecareStardardeDetailList.forEach(f->{
                f.setEquipmentId(equipmentInfo.getId());
                f.setInfoTpe(equipmentInfo.getInfoType());
            });
            equipmentTakecareStardardDetailBaseService.updateBatchById(delList);
            equipmentTakecareStardardDetailBaseService.saveOrUpdateBatch(takecareStardardeDetailList);
        }
        if(infoDto.getDelTakecareStardardeDetails() != null && !infoDto.getDelTakecareStardardeDetails().isEmpty()){
            if(StringUtils.hasText(infoDto.getDelTakecareStardardeDetails())){
                List<Long> idList = Arrays.stream(infoDto.getDelTakecareStardardeDetails().split(",")).map(s-> Long.parseLong(s.trim()))
                        .collect(Collectors.toList());
                List<EquipmentTakecareStardardDetail> delList = new ArrayList<>();
                idList.forEach(f->{
                    EquipmentTakecareStardardDetail info = new EquipmentTakecareStardardDetail();
                    info.setDelFlag(1);
                    info.setId(f);
                    delList.add(info);
                });
                equipmentTakecareStardardDetailBaseService.updateBatchById(delList);
            }
        }
    }
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentExpressServiceImpl.java
@@ -182,7 +182,7 @@
        }
    }
    private void updateAccidentExpressFile(Long uid, Long accidentExpressId, Date nowDate, List<AccidentExpressFileReqDTO> AccidentExpressFileReqDTOList) {
    private void updateAccidentExpressFile(Long uid, Long accidentExpressId, Date nowDate, List<AccidentExpressFileReqDTO> accidentExpressFileReqDTOList) {
        List<AccidentExpressFileInfoDO> accidentExpressFileInfoDOList = accidentExpressFileInfoService.selectByAccidentExpressId(accidentExpressId);
        List<Long> oldIdsList = accidentExpressFileInfoDOList.stream().map(AccidentExpressFileInfoDO::getId).collect(Collectors.toList());
@@ -192,20 +192,22 @@
        List<AccidentExpressFileInfo> addList = new ArrayList<>();
        //删除的附件集合(id)
        List<Long> deleteList = new ArrayList<>();
        for (AccidentExpressFileReqDTO AccidentExpressFileReqDTO : AccidentExpressFileReqDTOList) {
            //如果不存在id则表示页面新增的附件
            if (AccidentExpressFileReqDTO.getId() == null) {
                AccidentExpressFileInfo AccidentExpressFileInfo = new AccidentExpressFileInfo();
                BeanUtils.copyProperties(AccidentExpressFileReqDTO, AccidentExpressFileInfo);
                AccidentExpressFileInfo.setDelFlag(false);
                AccidentExpressFileInfo.setGmtCreate(nowDate);
                AccidentExpressFileInfo.setCreateUid(uid);
                AccidentExpressFileInfo.setAccidentExpressId(accidentExpressId);
                addList.add(AccidentExpressFileInfo);
            }
            //如果存在id则判断页面是否删除
            else {
                newIdsList.add(AccidentExpressFileReqDTO.getId());
        if(accidentExpressFileReqDTOList != null && !accidentExpressFileInfoDOList.isEmpty()){
            for (AccidentExpressFileReqDTO accidentExpressFileReqDTO : accidentExpressFileReqDTOList) {
                //如果不存在id则表示页面新增的附件
                if (accidentExpressFileReqDTO.getId() == null) {
                    AccidentExpressFileInfo accidentExpressFileInfo = new AccidentExpressFileInfo();
                    BeanUtils.copyProperties(accidentExpressFileReqDTO, accidentExpressFileInfo);
                    accidentExpressFileInfo.setDelFlag(false);
                    accidentExpressFileInfo.setGmtCreate(nowDate);
                    accidentExpressFileInfo.setCreateUid(uid);
                    accidentExpressFileInfo.setAccidentExpressId(accidentExpressId);
                    addList.add(accidentExpressFileInfo);
                }
                //如果存在id则判断页面是否删除
                else {
                    newIdsList.add(accidentExpressFileReqDTO.getId());
                }
            }
        }
        for (Long oldId : oldIdsList) {
incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentCaseInfoMapper.xml
@@ -23,7 +23,7 @@
    <insert id="addAccidentCase" parameterType="com.gkhy.safePlatform.incidentManage.entity.AccidentCaseInfo"
            keyProperty="id" useGeneratedKeys="true">
        insert into accident_Case
        insert into accident_case
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null ">id,</if>
            <if test="delFlag != null ">del_flag,</if>
@@ -67,7 +67,7 @@
    </select>
    <update id="updateAccidentCase" parameterType="com.gkhy.safePlatform.incidentManage.entity.AccidentCaseInfo">
        update accident_Case
        update accident_case
        <trim prefix="SET" suffixOverrides=",">
            <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if>
            <if test="updateUid != null ">update_uid = #{updateUid},</if>
@@ -80,7 +80,7 @@
    </update>
    <update id="deleteAccidentCaseById">
        update accident_Case set del_flag = 1 where id = #{id}
        update accident_case set del_flag = 1 where id = #{id}
    </update>
</mapper>
pom.xml
@@ -231,11 +231,11 @@
            <version>1.9.9.1</version>
            <!--            <scope>runtime</scope>-->
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.2.9</version>
        </dependency>
<!--        <dependency>-->
<!--            <groupId>com.alibaba</groupId>-->
<!--            <artifactId>druid-spring-boot-starter</artifactId>-->
<!--            <version>1.2.9</version>-->
<!--        </dependency>-->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataCourceProperties.java
对比新文件
@@ -0,0 +1,151 @@
package com.gkhy.safePlatform.config.database;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "spring.datasource")
public class DataCourceProperties {
    private Prop emergency;
    private Prop goalmanage;
    private Prop incidentmanage;
    private Prop equipment;
    public Prop getEmergency() {
        return emergency;
    }
    public void setEmergency(Prop emergency) {
        this.emergency = emergency;
    }
    public Prop getGoalmanage() {
        return goalmanage;
    }
    public void setGoalmanage(Prop goalmanage) {
        this.goalmanage = goalmanage;
    }
    public Prop getIncidentmanage() {
        return incidentmanage;
    }
    public void setIncidentmanage(Prop incidentmanage) {
        this.incidentmanage = incidentmanage;
    }
    public Prop getEquipment() {
        return equipment;
    }
    public void setEquipment(Prop equipment) {
        this.equipment = equipment;
    }
    public static class Prop{
        private String url;
        private String username;
        private String password;
        private Integer initialSize;
        private Integer minIdle;
        private Integer maxActive;
        private Integer maxWait;
        private String validationQuery;
        private Integer validationQueryTimeout;
        private Boolean testWhileIdle;
        public String getUrl() {
            return url;
        }
        public void setUrl(String url) {
            this.url = url;
        }
        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;
        }
        public Integer getInitialSize() {
            return initialSize;
        }
        public void setInitialSize(Integer initialSize) {
            this.initialSize = initialSize;
        }
        public Integer getMinIdle() {
            return minIdle;
        }
        public void setMinIdle(Integer minIdle) {
            this.minIdle = minIdle;
        }
        public Integer getMaxActive() {
            return maxActive;
        }
        public void setMaxActive(Integer maxActive) {
            this.maxActive = maxActive;
        }
        public Integer getMaxWait() {
            return maxWait;
        }
        public void setMaxWait(Integer maxWait) {
            this.maxWait = maxWait;
        }
        public String getValidationQuery() {
            return validationQuery;
        }
        public void setValidationQuery(String validationQuery) {
            this.validationQuery = validationQuery;
        }
        public Integer getValidationQueryTimeout() {
            return validationQueryTimeout;
        }
        public void setValidationQueryTimeout(Integer validationQueryTimeout) {
            this.validationQueryTimeout = validationQueryTimeout;
        }
        public Boolean getTestWhileIdle() {
            return testWhileIdle;
        }
        public void setTestWhileIdle(Boolean testWhileIdle) {
            this.testWhileIdle = testWhileIdle;
        }
    }
}
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java
@@ -1,6 +1,5 @@
package com.gkhy.safePlatform.config.database;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
@@ -14,21 +13,6 @@
@Configuration
public class DataSourceConfig {
//    @Bean
//    @ConfigurationProperties("spring.datasource.goalmanage")
//    DataSource dsGoalManage(){
//        return DruidDataSourceBuilder.create().build();
//    }
//
//    @Bean
//    @ConfigurationProperties("spring.datasource.emergency")
//    DataSource dsEmergency(){
//        return DruidDataSourceBuilder.create().build();
//    }
    /**
     * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DruidConfig.java
@@ -1,12 +1,8 @@
package com.gkhy.safePlatform.config.database;
import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallFilter;
import com.atomikos.icatch.jta.UserTransactionImp;
import com.atomikos.icatch.jta.UserTransactionManager;
import com.mysql.cj.jdbc.MysqlXADataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
@@ -32,24 +28,29 @@
@Configuration
public class DruidConfig {
    @Value("${spring.datasource.type}")
    private String datasourceClass;
    @Autowired
    private DataCourceProperties dataCourceProperties;
    @Bean(name = "dsGoalManage")
    @Primary
    @Autowired
    public DataSource dsGoalManage(Environment env) {
        AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        final MysqlXADataSource mysqlXADataSource = new MysqlXADataSource();
        Properties prop = build(env, "spring.datasource.goalmanage.");
//        ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource");
        ds.setXaDataSourceClassName(datasourceClass);
        mysqlXADataSource.setUrl(dataCourceProperties.getGoalmanage().getUrl());
        mysqlXADataSource.setUser(dataCourceProperties.getGoalmanage().getUsername());
        mysqlXADataSource.setPassword(dataCourceProperties.getGoalmanage().getPassword());
        final AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        ds.setXaDataSource(mysqlXADataSource);
        ds.setUniqueResourceName("goalmanage");
        ds.setPoolSize(2);
        ds.setPoolSize(dataCourceProperties.getGoalmanage().getInitialSize());
        ds.setMinPoolSize(dataCourceProperties.getGoalmanage().getMinIdle());
        ds.setMaxPoolSize(dataCourceProperties.getGoalmanage().getMaxActive());
        ds.setXaProperties(prop);
        ds.setMaxIdleTime(3600);
        ds.setMaxLifetime(3000);
        ds.setTestQuery(dataCourceProperties.getGoalmanage().getValidationQuery());
        return ds;
    }
@@ -57,15 +58,21 @@
    @Primary
    @Bean(name = "dsEmergency")
    public AtomikosDataSourceBean dsEmergency(Environment env) {
        AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        final MysqlXADataSource mysqlXADataSource = new MysqlXADataSource();
        Properties prop = build(env, "spring.datasource.emergency.");
//        ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource");
        ds.setXaDataSourceClassName(datasourceClass);
        mysqlXADataSource.setUrl(dataCourceProperties.getEmergency().getUrl());
        mysqlXADataSource.setUser(dataCourceProperties.getEmergency().getUsername());
        mysqlXADataSource.setPassword(dataCourceProperties.getEmergency().getPassword());
        final AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        ds.setXaDataSource(mysqlXADataSource);
        ds.setUniqueResourceName("emergency");
        ds.setPoolSize(2);
        ds.setPoolSize(dataCourceProperties.getEmergency().getInitialSize());
        ds.setMinPoolSize(dataCourceProperties.getEmergency().getMinIdle());
        ds.setMaxPoolSize(dataCourceProperties.getEmergency().getMaxActive());
        ds.setXaProperties(prop);
        ds.setMaxIdleTime(3600);
        ds.setMaxLifetime(3000);
        ds.setTestQuery(dataCourceProperties.getEmergency().getValidationQuery());
        return ds;
    }
@@ -73,15 +80,21 @@
    @Primary
    @Bean(name = "dsIncidentManage")
    public AtomikosDataSourceBean dsIncidentManage(Environment env) {
        AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        final MysqlXADataSource mysqlXADataSource = new MysqlXADataSource();
        Properties prop = build(env, "spring.datasource.incidentmanage.");
        ds.setXaDataSourceClassName(datasourceClass);
//        ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource");
        mysqlXADataSource.setUrl(dataCourceProperties.getIncidentmanage().getUrl());
        mysqlXADataSource.setUser(dataCourceProperties.getIncidentmanage().getUsername());
        mysqlXADataSource.setPassword(dataCourceProperties.getIncidentmanage().getPassword());
        final AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        ds.setXaDataSource(mysqlXADataSource);
        ds.setUniqueResourceName("incidentmanage");
        ds.setPoolSize(2);
        ds.setPoolSize(dataCourceProperties.getIncidentmanage().getInitialSize());
        ds.setMinPoolSize(dataCourceProperties.getIncidentmanage().getMinIdle());
        ds.setMaxPoolSize(dataCourceProperties.getIncidentmanage().getMaxActive());
        ds.setXaProperties(prop);
        ds.setMaxIdleTime(3600);
        ds.setMaxLifetime(3000);
        ds.setTestQuery(dataCourceProperties.getIncidentmanage().getValidationQuery());
        return ds;
    }
@@ -89,15 +102,21 @@
    @Primary
    @Bean(name = "dsEquipment")
    public AtomikosDataSourceBean dsEquipment(Environment env) {
        AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        final MysqlXADataSource mysqlXADataSource = new MysqlXADataSource();
        Properties prop = build(env, "spring.datasource.equipment.");
        ds.setXaDataSourceClassName(datasourceClass);
//        ds.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource");
        mysqlXADataSource.setUrl(dataCourceProperties.getEquipment().getUrl());
        mysqlXADataSource.setUser(dataCourceProperties.getEquipment().getUsername());
        mysqlXADataSource.setPassword(dataCourceProperties.getEquipment().getPassword());
        final AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
        ds.setXaDataSource(mysqlXADataSource);
        ds.setUniqueResourceName("equipment");
        ds.setPoolSize(2);
        ds.setPoolSize(dataCourceProperties.getEquipment().getInitialSize());
        ds.setMinPoolSize(dataCourceProperties.getEquipment().getMinIdle());
        ds.setMaxPoolSize(dataCourceProperties.getEquipment().getMaxActive());
        ds.setXaProperties(prop);
        ds.setMaxIdleTime(3600);
        ds.setMaxLifetime(3000);
        ds.setTestQuery(dataCourceProperties.getEquipment().getValidationQuery());
        return ds;
    }
@@ -143,45 +162,6 @@
//        prop.put("filters", env.getProperty(prefix + "filters"));
        return prop;
    }
//    @Bean
    public ServletRegistrationBean druidServlet() {
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
        //控制台管理用户,加入下面2行 进入druid后台就需要登录
        //servletRegistrationBean.addInitParameter("loginUsername", "admin");
        //servletRegistrationBean.addInitParameter("loginPassword", "admin");
        return servletRegistrationBean;
    }
//    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new WebStatFilter());
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
        filterRegistrationBean.addInitParameter("profileEnable", "true");
        return filterRegistrationBean;
    }
//    @Bean
    public StatFilter statFilter(){
        StatFilter statFilter = new StatFilter();
        statFilter.setLogSlowSql(true); //slowSqlMillis用来配置SQL慢的标准,执行时间超过slowSqlMillis的就是慢。
        statFilter.setMergeSql(true); //SQL合并配置
        statFilter.setSlowSqlMillis(1000);//slowSqlMillis的缺省值为3000,也就是3秒。
        return statFilter;
    }
//    @Bean
    public WallFilter wallFilter(){
        WallFilter wallFilter = new WallFilter();
        //允许执行多条SQL
        WallConfig config = new WallConfig();
        config.setMultiStatementAllow(true);
        wallFilter.setConfig(config);
        return wallFilter;
    }
}
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java
@@ -1,7 +1,5 @@
package com.gkhy.safePlatform.config.database;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.plugin.Interceptor;
@@ -37,14 +35,8 @@
    @Autowired
    private MybatisPlusInterceptor mybatisPlusInterceptor;
    @Bean(name = "dataSourceEmergency")
    @ConfigurationProperties(prefix = "spring.datasource.emergency")
    public DruidDataSource dataSourceDoublePrevent(){
        return DruidDataSourceBuilder.create().build();
    }
    @Bean(name = "sqlSessionFactoryEmergency")
    public SqlSessionFactory sqlSessionFactoryEmergency(@Qualifier("dataSourceEmergency") DruidDataSource dataSource) throws Exception {
    public SqlSessionFactory sqlSessionFactoryEmergency() throws Exception {
        MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
        factoryBean.setDataSource(dsEmergency);
        ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
@@ -56,7 +48,7 @@
    }
    @Bean
    public SqlSessionTemplate sqlSessionTemplateEmergency(@Qualifier("sqlSessionFactoryEmergency") SqlSessionFactory sqlSessionFactory){
        return new SqlSessionTemplate(sqlSessionFactory);
    public SqlSessionTemplate sqlSessionTemplateEmergency() throws Exception {
        return new SqlSessionTemplate(sqlSessionFactoryEmergency());
    }
}
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEquipment.java
@@ -1,7 +1,5 @@
package com.gkhy.safePlatform.config.database;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
@@ -37,14 +35,8 @@
    @Autowired
    private MybatisPlusInterceptor mybatisPlusInterceptor;
    @Bean(name = "datasourceEquipment")
    @ConfigurationProperties(prefix = "spring.datasource.equipment")
    public DruidDataSource druidDataSourceA(){
        return DruidDataSourceBuilder.create().build();
    }
    @Bean(name = "sqlFactoryEquipment")
    public SqlSessionFactory sqlSessionFactory(@Qualifier("datasourceEquipment") DruidDataSource dataSource)
    public SqlSessionFactory sqlSessionFactory()
            throws Exception
    {
        MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigGoalManage.java
@@ -1,7 +1,5 @@
package com.gkhy.safePlatform.config.database;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.plugin.Interceptor;
@@ -35,14 +33,8 @@
    @Autowired
    private MybatisPlusInterceptor mybatisPlusInterceptor;
    @Bean(name = "dataSourceGoalManage")
    @ConfigurationProperties(prefix = "spring.datasource.goalmanage")
    public DruidDataSource dataSourceGoalManage(){
        return DruidDataSourceBuilder.create().build();
    }
    @Bean(name = "sqlFactoryGoalManage")
    public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSourceGoalManage") DruidDataSource dataSource)
    public SqlSessionFactory sqlSessionFactory()
            throws Exception
    {
        MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigIncidentManage.java
@@ -1,7 +1,5 @@
package com.gkhy.safePlatform.config.database;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.plugin.Interceptor;
@@ -35,14 +33,8 @@
    @Autowired
    private MybatisPlusInterceptor mybatisPlusInterceptor;
    @Bean(name = "dataSourceIncidentManage")
    @ConfigurationProperties(prefix = "spring.datasource.incidentmanage")
    public DruidDataSource dataSourceIncidentManage(){
        return DruidDataSourceBuilder.create().build();
    }
    @Bean(name = "sqlFactoryIncidentManage")
    public SqlSessionFactory sqlSessionFactory(@Qualifier("dataSourceIncidentManage") DruidDataSource dataSource)
    public SqlSessionFactory sqlSessionFactory()
            throws Exception
    {
        MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java
@@ -10,6 +10,7 @@
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.commons.utils.RPCUtils;
import com.gkhy.safePlatform.commons.utils.RequestContextHolder;
import com.gkhy.safePlatform.commons.utils.StringUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.config.redis.RedisUtils;
@@ -29,6 +30,7 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -68,97 +70,77 @@
    private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest req,HttpServletResponse resp) {
        // header获取token
        String authToken = req.getHeader(tokenConfig.getHeader());
        String loginUserId = req.getHeader(tokenConfig.getLoginUserHeader());
        if(authToken != null) {
            // header 传入 userId
            if (StringUtils.isBlank(loginUserId)) {
                throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_LACK);
            }
            // 登录成功时,会将权限数据存入redis
            // 这里是验证获取权限信息
            // 1.从redis中获取对应该用户的权限信息
            String accessTokenKey = RedisKeyEnum.authKey(RedisKeyEnum.AUTH_TOKEN, loginUserId);
            String accessTokenKey = RedisKeyEnum.authKey(RedisKeyEnum.AUTH_TOKEN, authToken);
            Object o = redisUtils.get(accessTokenKey);
            // 2.token是否存在
            if (o == null) {
                // 是否存在
                // 是否存在 uid未登录
                throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_TOKEN_INVALID);
            }else{
                Long userId = Long.valueOf(loginUserId);
                ContextCacheUser contextCacheUser = JSONObject.parseObject(o.toString(), ContextCacheUser.class);
                assert userId.equals(contextCacheUser.getUid());
                if ( !authToken.equals(contextCacheUser.getAccessToken())) {
                    throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_TOKEN_INVALID);
                // todo 可以不转换,建议rpc传入string
                String uid = o.toString();
                Long userId = Long.valueOf(uid);
                String accessUserKey = RedisKeyEnum.authKey(RedisKeyEnum.AUTH_USER, userId);
                // 这里不做用户信息的token判断 放入登录
                Long expireSecondsLeft = redisUtils.getExpireTime(accessTokenKey);
                // 60m 内请求则续期 时长为原本的有效时间
                if (expireSecondsLeft != null && 0L < expireSecondsLeft && expireSecondsLeft < 60 * 60) {
                    // 重置token:uid
                    redisUtils.resetKeyExpireTime(accessTokenKey, tokenConfig.getExpiration());
                    // 重置uid:userInfo
                    redisUtils.resetKeyExpireTime(accessUserKey, tokenConfig.getExpiration());
                }
                // 3.redis获取权限
                String authoritiesKey = RedisKeyEnum.authKey(RedisKeyEnum.AUTH_AUTHORITIES, userId);
                Object oo = redisUtils.get(authoritiesKey);
                List<GrantedAuthority> authorities = new ArrayList<>();
                // 4.redis中是否存在
                if (oo != null) {
                    // 5.存在
                    List<ContextCacheAuthority> cacheAuthorities = JSONArray.parseArray(oo.toString(), ContextCacheAuthority.class);
                    for (ContextCacheAuthority cacheAuthority: cacheAuthorities) {
                        authorities.add(new SimpleGrantedAuthority(cacheAuthority.getAuthority()));
                    }
                }else {
                    // 6.不存在=>数据库查询
                    ResultVO<String> rpcResultRole = userAccountService.getUserRoleCodeByUserId(userId);
                    if (rpcResultRole == null) {
                        throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
                    }
                    if (!ResultCodes.OK.getCode().equals(rpcResultRole.getCode())) {
                        throw new BusinessException(rpcResultRole.getCode(), rpcResultRole.getMsg());
                    }
                    if (rpcResultRole.getData() == null) {
                        throw new BusinessException(ResultCodes.RPC_DATA_NULL);
                    }
                    if (!(rpcResultRole.getData() instanceof String)) {
                        throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
                    }
                    // role
                    authorities.add(new SimpleGrantedAuthority("ROLE_" + rpcResultRole.getData().toString()));
                    // permission
                    ResultVO<List<String>> rpcResultPermission = userAccountService.getUserPermissionByUserId(userId);
                    if (rpcResultPermission == null) {
                        throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
                    }
                    if (!ResultCodes.OK.getCode().equals(rpcResultPermission.getCode())) {
                        throw new BusinessException(rpcResultRole.getCode(), rpcResultRole.getMsg());
                    }
                    if (rpcResultPermission.getData() == null) {
                        throw new BusinessException(ResultCodes.RPC_DATA_NULL);
                    }
                    if (!(rpcResultPermission.getData() instanceof List)) {
                        throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
                    }
                    List<String> permissions = RPCUtils.castList(rpcResultPermission.getData(), String.class);
                    for (String permission : permissions) {
                        SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(permission);
                        authorities.add(simpleGrantedAuthority);
                    }
                // 获取用户信息
                Object oo = redisUtils.get(accessUserKey);
                // 初始化
                ContextCacheUser contextCacheUser = null;
                if (oo == null) {
                    // 业务逻辑上是不会空的
                    // 实际操作可能会手动清空
                    ResultVO<ContextCacheUser> rpcResultVo = userAccountService.getCacheUserDetailByUid(userId);
                    // 调用rpc返回的数据 没有token 所以得至少续上这次token
                    contextCacheUser = this.getRpcResult(rpcResultVo);
                    // 因为手动清空等原因,可能会丢失其他token数据,就不去一一搜索这个uid的token了
                    contextCacheUser.setAccessToken(Collections.singletonList(authToken));
                }else{
                    // 正常的实际场景必定会走这里
                    // 推荐用jackson
                    contextCacheUser = JSONObject.parseObject(oo.toString(), ContextCacheUser.class);
                }
                // threadLocal存入用户信息
                RequestContextHolder.contextUserLocal.set(contextCacheUser);
                // security对象中存入登陆者信息
                return new UsernamePasswordAuthenticationToken(contextCacheUser,authToken,authorities);
                return new UsernamePasswordAuthenticationToken(contextCacheUser, authToken, contextCacheUser.getAuthorities());
            }
        }
        return null;
    }
    /**
     * 获取rpc 返回的用户数据
     *
     * @param rpcResultVo rpc返回数据
     * @return 用户准备缓存的数据
     */
    private ContextCacheUser getRpcResult(ResultVO<ContextCacheUser> rpcResultVo) {
        if (!rpcResultVo.getCode().equals(ResultCodes.OK.getCode())) {
            throw new BusinessException(rpcResultVo.getCode(), rpcResultVo.getMsg());
        }
        if (rpcResultVo.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (rpcResultVo.getData() instanceof ContextCacheUser) {
            return (ContextCacheUser) rpcResultVo.getData();
        } else {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
    }
    protected void writeJSON(HttpServletRequest req,
safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
@@ -11,31 +11,55 @@
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.alibaba.druid.pool.xa.DruidXADataSource
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.incidentmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.equipment.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 192.168.0.52
    port: 6379
safePlatfrom-out-web/src/main/resources/config/application-guotai-prod-1.yaml
文件名从 safePlatfrom-out-web/src/main/resources/config/application-guotai-demo.yaml 修改
@@ -11,36 +11,60 @@
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.alibaba.druid.pool.xa.DruidXADataSource
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.emergency.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.goalmanage.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.incidentmanage.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.equipment.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 192.168.30.107
    port: 6375
    password: SEF98uvs98dUAUEF90Udssa
    database: 0           # Redis 数据库号,默认为 0
    port: 6364
    password: akj78avauba789a
    database: 13           # Redis 数据库号,默认为 0
    timeout: 15000        # Redis 连接超时时间,单位:毫秒。
    lettuce:
      pool:
safePlatfrom-out-web/src/main/resources/config/application-guotai-prod.yaml
对比新文件
@@ -0,0 +1,165 @@
server:
  tomcat:
    uri-encoding: UTF-8
    basedir: /
  port: 16012
  servlet:
    context-path: /
# mysql
spring:
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:6361/safeplatform.emergency.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: root
      password: HZjCbHGxiXy7cek4
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:6361/safeplatform.goalmanage.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: root
      password: HZjCbHGxiXy7cek4
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:6361/safeplatform.incidentmanage.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: root
      password: HZjCbHGxiXy7cek4
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:6361/safeplatform.equipment.guotai.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: root
      password: HZjCbHGxiXy7cek4
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 127.0.0.1
    port: 6379
    password: akj78avauba789a
    database: 13           # Redis 数据库号,默认为 0
    timeout: 15000        # Redis 连接超时时间,单位:毫秒。
    lettuce:
      pool:
        max-active: 4
        max-idle: 4
    # 对应 RedisProperties.Jedis 内部类
    jedis:
      pool:
        max-active: 4     # 连接池最大连接数,默认为 8 。使用负数表示没有限制    同一时间最大只能执行8条sql语句,每执行一条语句就会建立一个连接
        max-idle: 4       # 默认连接数最大空闲的连接数,默认为 8 。使用负数表示没有限制。
        min-idle: 0       # 默认连接池最小空闲的连接数,默认为 0 。允许设置 0 和 正数。
        max-wait: -1
  cloud:
    nacos:
      discovery:
        server-addr: http://10.211.134.185:8848
        namespace: 78fe80cc-6159-4381-8e42-1cc6c68eb22e
        username: nacos
        password: nacos
        enabled: true
        register-enabled: true
      config:
        server-addr: http://10.211.134.185:8848
        namespace: 78fe80cc-6159-4381-8e42-1cc6c68eb22e
        username: nacos
        password: nacos
    inetutils:
      ignored-interfaces:
        - VirtualBox Host-Only Network
      preferred-networks:
        - 10.211
  #是否允许跨域 true:允许;false:不允许
  enableCors: false
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
dubbo:
  registry:
    protocol: nacos
    address: nacos://10.211.134.185:8848?namespace=78fe80cc-6159-4381-8e42-1cc6c68eb22e&username=nacos&password=nacos
  application:
    name: gkhy-safeplatform-out
  scan:
    # 扫描rpc接口定义包
    base-packages: com.gkhy.safePlatform
  protocol:
    name: dubbo
    port: 18089
    serialization: kryo
    host: ${spring.cloud.client.ip-address}
  consumer:
    # 服务连接超时时间
    timeout: 3000
    # 取消服务启动检查
    check: false
threadPool:
  corePoolSize: 20
  maxPoolSize: 20
  queueCapacity: 10000
  scheduling:
    #控制线程是否执行 true:执行;false:不执行
    enabled: true
#    enabled: false
rocketmq:
  name-server: 127.0.0.1:9876
  producer:
    group: gkhy-safeplatform-guotai-uat
    sendMessageTimeout: 300000
  consumer:
    group: gkhy-safeplatform-guotai-uat
  topic:
    demoTopic: gkhy-safeplatform-topic-demo-uat
minio:
  endPoint: 106.15.95.149
  port: 9001
  accessKey: U9JW4xOeeUQOSR4f
  secretKey: iaqQV6twR9yDZiFAf2UYr5xZfESanZs3+FU7G5A87BzPIRdObGjK
  secure: false
  bucketName: safeplatform-guotai-uat
  urlPrefix: http://106.15.95.149:9001
  #用户名 gkhy_team_out_dev
  #密码 12345678
token:
  header: Authorization
  secret: safe666
  expiration: 7200
  refreshExpiration: 14400
  tokenHead: Bearer
  loginUserHeader: uid
safePlatfrom-out-web/src/main/resources/config/application-online-uat.yaml
@@ -11,31 +11,55 @@
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.alibaba.druid.pool.xa.DruidXADataSource
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.emergency.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.goalmanage.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.incidentmanage.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.30.107:43306/safeplatform.equipment.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_safeplatform_guotai_out
      password: a7687@i8a1Sdd
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 192.168.30.107
    port: 6376
safePlatfrom-out-web/src/main/resources/config/application-out-dev.yaml
@@ -11,31 +11,55 @@
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.alibaba.druid.pool.xa.DruidXADataSource
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.incidentmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.equipment.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 192.168.0.52
    port: 6378
safePlatfrom-out-web/src/main/resources/config/application-test.yaml
@@ -11,31 +11,55 @@
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.alibaba.druid.pool.xa.DruidXADataSource
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.incidentmanage.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.equipment.dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 192.168.0.52
    port: 6377
safePlatfrom-out-web/src/main/resources/config/application-uat.yaml
@@ -11,31 +11,55 @@
  jta:
    transaction-manager-id: txManager
  datasource:
    type: com.alibaba.druid.pool.xa.DruidXADataSource
    type: com.mysql.cj.jdbc.MysqlXADataSource
    emergency:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.emergency.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    goalmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.goalmanage.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    incidentmanage:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.incidentmanage.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
    equipment:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://192.168.0.52:3306/safeplatform.equipment.uat?allowMultiQueries=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: gkhy_dev_out_team
      password: Adsdf675T6AC7yga
      type: com.alibaba.druid.pool.DruidDataSource
      initialSize: 3
      minIdle: 3
      maxActive: 10
      maxWait: 30000
      validationQuery: select 1
      validationQueryTimeout: 10000
      testWhileIdle: true
  redis:
    host: 192.168.0.52
    port: 6375
safePlatfrom-out-web/src/main/resources/config/application.yaml
@@ -2,9 +2,9 @@
  application:
    name: safeplatform-out
  profiles:
    active: online-uat
    #active: uat
#### dev out-dev  test  uat  online-uat guotai-demo
#    active: guotai-demo  国泰试运行环境
     active: guotai-prod
#    active: online-uat   线上预发环境
#    active: dev  本地开发环境
#    active: out-dev  外包对接环境