连接oracle
parent
ca28cfaf66
commit
f5f001d7bb
12
pom.xml
12
pom.xml
|
@ -271,7 +271,17 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- oracle驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>19.3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.easyproject</groupId>
|
||||
<artifactId>orai18n</artifactId>
|
||||
<version>12.1.0.2.0</version>
|
||||
</dependency>
|
||||
<!--shiro start-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.zcloud.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 说明:第二数据源配置
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = No3DataSourceConfig.PACKAGE, sqlSessionFactoryRef = "no3SqlSessionFactory") //扫描 Mapper 接口并容器管理
|
||||
public class No3DataSourceConfig {
|
||||
|
||||
static final String PACKAGE = "com.zcloud.mapper.dsno3"; //master 目录
|
||||
static final String MAPPER_LOCATION = "classpath:mybatis/dsno3/*/*.xml"; //扫描的 xml 目录
|
||||
static final String CONFIG_LOCATION = "classpath:mybatis/dsno3/mybatis-config.xml"; //自定义的mybatis config 文件位置
|
||||
static final String TYPE_ALIASES_PACKAGE = "ocom.zcloud.entity"; //扫描的 实体类 目录
|
||||
|
||||
@Value("${datasource.no3.url}")
|
||||
private String url;
|
||||
|
||||
@Value("${datasource.no3.username}")
|
||||
private String user;
|
||||
|
||||
@Value("${datasource.no3.password}")
|
||||
private String password;
|
||||
|
||||
@Value("${datasource.no3.driver-class-name}")
|
||||
private String driverClass;
|
||||
|
||||
@Bean(name = "no3DataSource")
|
||||
public DataSource no3DataSource() {
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
dataSource.setDriverClassName(driverClass);
|
||||
dataSource.setUrl(url);
|
||||
dataSource.setUsername(user);
|
||||
dataSource.setPassword(password);
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
@Bean(name = "no3TransactionManager")
|
||||
public DataSourceTransactionManager no3TransactionManager() {
|
||||
return new DataSourceTransactionManager(no3DataSource());
|
||||
}
|
||||
|
||||
@Bean(name = "no3SqlSessionFactory")
|
||||
public SqlSessionFactory no3SqlSessionFactory(@Qualifier("no3DataSource") DataSource no3DataSource)throws Exception {
|
||||
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
||||
sessionFactory.setDataSource(no3DataSource);
|
||||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(No3DataSourceConfig.MAPPER_LOCATION));
|
||||
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(No3DataSourceConfig.CONFIG_LOCATION));
|
||||
sessionFactory.setTypeAliasesPackage(No3DataSourceConfig.TYPE_ALIASES_PACKAGE);
|
||||
return sessionFactory.getObject();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.zcloud.mapper.dsno3.anemometer;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zy
|
||||
* @date 2024/1/16 19:35
|
||||
*/
|
||||
public interface AnemometerMapper {
|
||||
|
||||
|
||||
public List<PageData> listAll(PageData pd);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.zcloud.service.announcement;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 风速仪
|
||||
* @author zy
|
||||
* @date 2024/1/16 19:39
|
||||
*/
|
||||
public interface AnemometerService {
|
||||
|
||||
/**列表(全部)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listAll(PageData pd)throws Exception;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.service.announcement.impl;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.mapper.dsno3.anemometer.AnemometerMapper;
|
||||
import com.zcloud.service.announcement.AnemometerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 风速仪
|
||||
* @author zy
|
||||
* @date 2024/1/16 19:39
|
||||
*/
|
||||
@Service
|
||||
@Transactional //开启事物
|
||||
public class AnemometerServiceImpl implements AnemometerService {
|
||||
|
||||
@Autowired
|
||||
private AnemometerMapper anemometerMapper;
|
||||
@Override
|
||||
public List<PageData> listAll(PageData pd) throws Exception {
|
||||
return anemometerMapper.listAll(pd);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.service.announcement.AnemometerService;
|
||||
import com.zcloud.service.bus.SysDateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 风速仪定时器
|
||||
*/
|
||||
@Component
|
||||
public class AnemometerScheduled {
|
||||
@Autowired
|
||||
private AnemometerService anemometerService;
|
||||
|
||||
|
||||
//@Scheduled(cron ="0 5 0 * * ?")//每天12点05
|
||||
@Scheduled(cron ="0 30 0 * * ?")//每天12点30
|
||||
|
||||
//@Scheduled(cron ="*/20 * * * * ?")//测试
|
||||
public void scheduled(){
|
||||
try {
|
||||
System.out.println("============同步风速仪==========");
|
||||
PageData pd = new PageData();
|
||||
pd.put("SYSDATE_ID", this.get32UUID()); //主键
|
||||
pd.put("DATE", DateUtil.getDay());
|
||||
pd.put("DAY_START", DateUtil.getDay()+" 00:00:00");
|
||||
pd.put("DAY_END", DateUtil.getDay()+" 23:59:59");
|
||||
pd.put("WEEK_START", DateUtil.getWeekStart());
|
||||
pd.put("WEEK_END", DateUtil.getWeekEnd());
|
||||
String year = DateUtil.getYear().toString();
|
||||
String month = DateUtil.getMonth().toString();
|
||||
Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString());
|
||||
String xunStartTime = year + "-" + month + "-";
|
||||
String xunEndTime = year + "-" + month + "-";
|
||||
if(day <= 10) {
|
||||
xunStartTime = xunStartTime+"01 00:00:00";
|
||||
xunEndTime = xunEndTime+"10 23:59:59";
|
||||
} else if(day > 10 && day <= 20) {
|
||||
xunStartTime = xunStartTime+"11 00:00:00";
|
||||
xunEndTime = xunEndTime+"20 23:59:59";
|
||||
} else {
|
||||
xunStartTime = xunStartTime+"21 00:00:00";
|
||||
xunEndTime = DateUtil.getMonthEndDay()+" 23:59:59";
|
||||
}
|
||||
pd.put("XUN_START", xunStartTime);
|
||||
pd.put("XUN_END", xunEndTime);
|
||||
pd.put("MONTH_START", DateUtil.getMonthFirstDay()+" 00:00:00");
|
||||
pd.put("MONTH_END", DateUtil.getMonthEndDay()+" 23:59:59");
|
||||
pd.put("QUARTER_START", DateUtil.quarterStart()+" 00:00:00");
|
||||
pd.put("QUARTER_END", DateUtil.quarterEnd()+" 23:59:59");
|
||||
String HalfYearStartTime = DateUtil.getYear().toString();
|
||||
String HalfYearEndTime = DateUtil.getYear().toString();
|
||||
Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString());
|
||||
|
||||
if(bmonth <= 6) {
|
||||
HalfYearStartTime = HalfYearStartTime+"-01-01 00:00:00";
|
||||
HalfYearEndTime = HalfYearEndTime+"-06-30 23:59:59";
|
||||
} else if(bmonth > 6) {
|
||||
HalfYearStartTime = HalfYearStartTime+"-07-01 00:00:00";
|
||||
HalfYearEndTime = HalfYearEndTime+"-12-31 23:59:59";
|
||||
}
|
||||
pd.put("HALFYEAR_START", HalfYearStartTime);
|
||||
pd.put("HALFYEAR_END", HalfYearEndTime);
|
||||
pd.put("YEAR_START", DateUtil.getCurrYearFirst()+" 00:00:00");
|
||||
pd.put("YEAR_END", DateUtil.getCurrYearLast()+" 23:59:59");
|
||||
// sysdateService.save(pd);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据初始化:bus_sysdate表时使用
|
||||
*/
|
||||
/* public void scheduled(){
|
||||
try {
|
||||
System.out.println("============定时增加日期==========");
|
||||
for(int i=0;i < 730;i++) {
|
||||
PageData pd = new PageData();
|
||||
pd.put("SYSDATE_ID", this.get32UUID()); //主键
|
||||
pd.put("DATE", DateSysUtil.getDay(i));
|
||||
pd.put("DAY_START", DateSysUtil.getDay(i)+" 00:00:00");
|
||||
pd.put("DAY_END", DateSysUtil.getDay(i)+" 23:59:59");
|
||||
pd.put("WEEK_START", DateSysUtil.getWeekStart(i));
|
||||
pd.put("WEEK_END", DateSysUtil.getWeekEnd(i));
|
||||
String year = DateSysUtil.getYear(i).toString();
|
||||
String month = DateSysUtil.getMonth(i).toString();
|
||||
Integer day = Integer.parseInt(DateSysUtil.getOnlyDay(i).toString());
|
||||
String xunStartTime = year + "-" + month + "-";
|
||||
String xunEndTime = year + "-" + month + "-";
|
||||
if(day <= 10) {
|
||||
xunStartTime = xunStartTime+"01 00:00:00";
|
||||
xunEndTime = xunEndTime+"10 23:59:59";
|
||||
} else if(day > 10 && day <= 20) {
|
||||
xunStartTime = xunStartTime+"11 00:00:00";
|
||||
xunEndTime = xunEndTime+"20 23:59:59";
|
||||
} else {
|
||||
xunStartTime = xunStartTime+"21 00:00:00";
|
||||
xunEndTime = DateSysUtil.getMonthEndDay(i)+" 23:59:59";
|
||||
}
|
||||
pd.put("XUN_START", xunStartTime);
|
||||
pd.put("XUN_END", xunEndTime);
|
||||
pd.put("MONTH_START", DateSysUtil.getMonthFirstDay(i)+" 00:00:00");
|
||||
pd.put("MONTH_END", DateSysUtil.getMonthEndDay(i)+" 23:59:59");
|
||||
pd.put("QUARTER_START", DateSysUtil.quarterStart(i)+" 00:00:00");
|
||||
pd.put("QUARTER_END", DateSysUtil.quarterEnd(i)+" 23:59:59");
|
||||
String HalfYearStartTime = DateSysUtil.getYear(i).toString();
|
||||
String HalfYearEndTime = DateSysUtil.getYear(i).toString();
|
||||
Integer bmonth = Integer.parseInt(DateSysUtil.getMonth(i).toString());
|
||||
|
||||
if(bmonth <= 6) {
|
||||
HalfYearStartTime = HalfYearStartTime+"-01-01 00:00:00";
|
||||
HalfYearEndTime = HalfYearEndTime+"-06-30 23:59:59";
|
||||
} else if(bmonth > 6) {
|
||||
HalfYearStartTime = HalfYearStartTime+"-07-01 00:00:00";
|
||||
HalfYearEndTime = HalfYearEndTime+"-12-31 23:59:59";
|
||||
}
|
||||
pd.put("HALFYEAR_START", HalfYearStartTime);
|
||||
pd.put("HALFYEAR_END", HalfYearEndTime);
|
||||
pd.put("YEAR_START", DateSysUtil.getCurrYearFirst(i)+" 00:00:00");
|
||||
pd.put("YEAR_END", DateSysUtil.getCurrYearLast(i)+" 23:59:59");
|
||||
sysdateService.save(pd);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
/**得到32位的uuid
|
||||
* @return
|
||||
*/
|
||||
public String get32UUID(){
|
||||
return UuidUtil.get32UUID();
|
||||
}
|
||||
}
|
|
@ -5,10 +5,15 @@ datasource.no1.password=root
|
|||
|
||||
|
||||
datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
datasource.no2.url=jdbc:mysql://192.168.0.18:33068/qa-cmt-regulatory1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
|
||||
datasource.no2.url=jdbc:mysql://192.168.0.18:3306/qa-cmt-regulatory1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
|
||||
datasource.no2.username=root
|
||||
datasource.no2.password=root
|
||||
|
||||
datasource.no3.driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
datasource.no3.url=jdbc:oracle:thin:@172.16.11.75:1521:orcl
|
||||
datasource.no3.username=jkqask
|
||||
datasource.no3.password=Qask@1115
|
||||
|
||||
#druid???
|
||||
spring.datasource.type: com.alibaba.druid.pool.DruidDataSource
|
||||
#?????
|
||||
|
@ -59,6 +64,18 @@ qa-regulatory-gwj.api.url=http://192.168.0.31:8992/qa-regulatory-gwj/
|
|||
#preventionxgf.api.url=https://qgxgf.qhdsafety.com/qa-prevention-xgf/
|
||||
#qa-regulatory-gwj.api.url=https://qgjg.qhdsafety.com/qa-regulatory-gwj/
|
||||
# \u6587\u4EF6\u4E0A\u4F20\u8DEF\u5F84
|
||||
#smb.host=172.16.11.146
|
||||
#smb.port=22
|
||||
#smb.user=root
|
||||
#smb.password=Zcloud@zcloud88888
|
||||
#smb.basePath=/mnt/web/file/
|
||||
|
||||
#smb.host=39.103.224.166
|
||||
#smb.port=22
|
||||
#smb.user=root
|
||||
#smb.password=Zcloud@zcloud88888
|
||||
#smb.basePath=/mnt/qgfile/file/
|
||||
|
||||
smb.host=39.101.130.96
|
||||
smb.port=22
|
||||
smb.user=root
|
||||
|
@ -66,10 +83,6 @@ smb.password=Zcloud@zcloud88888
|
|||
smb.basePath=/mnt/wwag/file/
|
||||
|
||||
#Mq\u914D\u7F6E
|
||||
rocketmq.consumer.group2=edu-admin-edit
|
||||
rocketmq.consumer.group1=edu-admin-add
|
||||
#rocketmq.name-server=10.0.140.141:9876
|
||||
#rocketmq.name-server=192.168.0.70:9876
|
||||
rocketmq.name-server=192.168.0.18:9876
|
||||
rocketmq.producer.group=libmiddle
|
||||
rocketmq.producer.send-message-timeout=300000
|
||||
|
@ -90,15 +103,21 @@ mq.topic.dockingPicture=dockingPicture
|
|||
mq.group.docking=scheduled_tasks_docking
|
||||
|
||||
# \u4EBA\u5458\u5BF9\u63A5
|
||||
perLoc.url=http://172.16.130.86/gateway-service
|
||||
perLoc.url=http://192.168.0.18/gateway-service
|
||||
perLoc.userName=qaaqadmin
|
||||
perLoc.pwd=Cfd2023@
|
||||
# \u4F01\u4E1A\u56FE\u7247
|
||||
corp.default.pic-path=https://qgqy.qhdsafety.com/
|
||||
corp.default.back-end-path=https://qgqy.qhdsafety.com/file/
|
||||
|
||||
http.file.url=https://qgqy.qhdsafety.com/file/
|
||||
|
||||
|
||||
# \u6E2F\u80A1\u4F01\u4E1A\u7AEF-app\u767B\u5F55\u9ED8\u8BA4 \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740\uFF08\u66F9\u7164\u70AD\u4E0D\u7528\uFF09
|
||||
corp.default.pic-path=https://qgqy.qhdsafety.com/file/
|
||||
# \u6E2F\u80A1\u4F01\u4E1A\u7AEF-app\u767B\u5F55\u9ED8\u8BA4 \u540E\u53F0\u5730\u5740\u5730\u5740\uFF08\u66F9\u7164\u70AD\u4E0D\u7528\uFF09
|
||||
corp.default.back-end-path=https://qgqy.qhdsafety.com/file/
|
||||
# \u672C\u670D\u52A1\u56FE\u7247\u5730\u5740
|
||||
http.file.url=https://wwag.qhdsafety.com/file/
|
||||
# \u672C\u670D\u52A1\u56FE\u7247\u5730\u5740
|
||||
baseimgpath =https://wwag.qhdsafety.com/file/
|
||||
|
||||
cfd.prevention.api.url=http://192.168.0.31:7021/qa-regulatory-cfd
|
||||
|
||||
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zcloud.mapper.dsno3.anemometer.AnemometerMapper">
|
||||
|
||||
|
||||
|
||||
<!-- 查询最新风速仪 -->
|
||||
<select id="listAll" parameterType="pd" resultType="pd">
|
||||
select * from cfd_produce.view_jk_windspeed_time
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD SQL Map Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<typeAliases>
|
||||
<typeAlias type="com.zcloud.entity.PageData" alias="pd"/>
|
||||
<typeAlias type="com.zcloud.entity.Page" alias="page"/>
|
||||
<typeAlias type="com.zcloud.entity.system.User" alias="user"/>
|
||||
<typeAlias type="com.zcloud.entity.system.Menu" alias="menu"/>
|
||||
<typeAlias type="com.zcloud.entity.system.Role" alias="role"/>
|
||||
<typeAlias type="com.zcloud.entity.system.Dictionaries" alias="dictionaries"/>
|
||||
|
||||
<!-- 这里添加实体类 -->
|
||||
|
||||
</typeAliases>
|
||||
|
||||
<plugins>
|
||||
<plugin interceptor="com.zcloud.plugins.PagePlugin">
|
||||
<property name="dialect" value="mysql"/>
|
||||
<property name="pageSqlId" value=".*listPage.*"/>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue