Browse Source

修改access数据库读取方式, sqlite数据库读取位置,不记录响应数据

lamphua 1 month ago
parent
commit
c9a3995a20

+ 1
- 1
cmc-temperature-back/cmc-monitoring/src/main/java/com/ruoyi/monitoring/mapper/CmcChannelMapper.java View File

20
      */
20
      */
21
     List<CmcChannel> listChannel(CmcChannel cmcChannel);
21
     List<CmcChannel> listChannel(CmcChannel cmcChannel);
22
 
22
 
23
-    Long selectMaxId();
23
+    Integer selectMaxId();
24
 
24
 
25
     int batchInsert(@Param("list") List<CmcChannel> list);
25
     int batchInsert(@Param("list") List<CmcChannel> list);
26
 
26
 

+ 1
- 1
cmc-temperature-back/cmc-monitoring/src/main/java/com/ruoyi/monitoring/mapper/CmcTemperatureMapper.java View File

25
                                          @Param("startTime") String startTime,
25
                                          @Param("startTime") String startTime,
26
                                          @Param("endTime") String endTime);
26
                                          @Param("endTime") String endTime);
27
 
27
 
28
-    Long selectMaxId();
28
+    Integer selectMaxId();
29
 
29
 
30
     int batchInsert(@Param("list") List<CmcTemperature> list);
30
     int batchInsert(@Param("list") List<CmcTemperature> list);
31
 
31
 

+ 0
- 18
cmc-temperature-back/cmc-monitoring/src/main/java/com/ruoyi/monitoring/mapper/access/AccessChannelMapper.java View File

1
-package com.ruoyi.monitoring.mapper.access;
2
-
3
-import com.mybatisflex.annotation.UseDataSource;
4
-import com.mybatisflex.core.BaseMapper;
5
-import com.ruoyi.monitoring.domain.CmcChannel;
6
-import org.apache.ibatis.annotations.Param;
7
-
8
-import java.util.List;
9
-
10
-@UseDataSource("access")
11
-public interface AccessChannelMapper extends BaseMapper<CmcChannel> {
12
-
13
-    List<CmcChannel> listAll();
14
-
15
-    List<CmcChannel> listByIdRange(@Param("minIdExclusive") Long minIdExclusive);
16
-}
17
-
18
-

+ 0
- 16
cmc-temperature-back/cmc-monitoring/src/main/java/com/ruoyi/monitoring/mapper/access/AccessDataMapper.java View File

1
-package com.ruoyi.monitoring.mapper.access;
2
-
3
-import com.mybatisflex.annotation.UseDataSource;
4
-import com.mybatisflex.core.BaseMapper;
5
-import com.ruoyi.monitoring.domain.CmcTemperature;
6
-import org.apache.ibatis.annotations.Param;
7
-
8
-import java.util.List;
9
-
10
-@UseDataSource("access")
11
-public interface AccessDataMapper extends BaseMapper<CmcTemperature> {
12
-
13
-    List<CmcTemperature> listByIdRange(@Param("minIdExclusive") Long minIdExclusive);
14
-}
15
-
16
-

+ 1
- 1
cmc-temperature-back/cmc-monitoring/src/main/java/com/ruoyi/monitoring/service/IAccessSyncService.java View File

2
 
2
 
3
 public interface IAccessSyncService {
3
 public interface IAccessSyncService {
4
 
4
 
5
-    void syncAccessToSqlite();
5
+    void syncAccessToSqlite() throws  Exception;
6
 }
6
 }
7
 
7
 
8
 
8
 

+ 88
- 42
cmc-temperature-back/cmc-monitoring/src/main/java/com/ruoyi/monitoring/service/impl/AccessSyncServiceImpl.java View File

4
 import com.ruoyi.monitoring.domain.CmcTemperature;
4
 import com.ruoyi.monitoring.domain.CmcTemperature;
5
 import com.ruoyi.monitoring.mapper.CmcChannelMapper;
5
 import com.ruoyi.monitoring.mapper.CmcChannelMapper;
6
 import com.ruoyi.monitoring.mapper.CmcTemperatureMapper;
6
 import com.ruoyi.monitoring.mapper.CmcTemperatureMapper;
7
-import com.ruoyi.monitoring.mapper.access.AccessChannelMapper;
8
-import com.ruoyi.monitoring.mapper.access.AccessDataMapper;
9
 import com.ruoyi.monitoring.service.IAccessSyncService;
7
 import com.ruoyi.monitoring.service.IAccessSyncService;
8
+import org.noear.solon.Solon;
10
 import org.noear.solon.annotation.Component;
9
 import org.noear.solon.annotation.Component;
11
 import org.noear.solon.annotation.Inject;
10
 import org.noear.solon.annotation.Inject;
12
 
11
 
12
+import java.sql.*;
13
+import java.util.ArrayList;
13
 import java.util.List;
14
 import java.util.List;
14
 
15
 
15
 @Component
16
 @Component
18
     // 每批插入的记录数
19
     // 每批插入的记录数
19
     private static final int BATCH_SIZE = 5000;
20
     private static final int BATCH_SIZE = 5000;
20
 
21
 
21
-    @Inject
22
-    AccessChannelMapper accessChannelMapper;
23
-
24
-    @Inject
25
-    AccessDataMapper accessDataMapper;
26
-
27
     @Inject
22
     @Inject
28
     CmcChannelMapper sqliteChannelMapper;
23
     CmcChannelMapper sqliteChannelMapper;
29
 
24
 
31
     CmcTemperatureMapper sqliteDataMapper;
26
     CmcTemperatureMapper sqliteDataMapper;
32
 
27
 
33
     @Override
28
     @Override
34
-    public void syncAccessToSqlite() {
29
+    public void syncAccessToSqlite() throws Exception {
35
         System.out.println("开始同步Access数据到SQLite...");
30
         System.out.println("开始同步Access数据到SQLite...");
36
-        
37
-        try {
38
-            // 同步 Channel:增量,按ID递增同步
31
+        Class.forName(Solon.cfg().getProperty("mybatis-flex.datasource.access.driverClassName"));
32
+
33
+        try (Connection conn = DriverManager.getConnection(
34
+                Solon.cfg().getProperty("mybatis-flex.datasource.access.jdbcUrl"), "", "")) {
35
+
36
+            // 直接同步 Channel 表
39
             System.out.println("开始同步Channel表...");
37
             System.out.println("开始同步Channel表...");
40
-            Long channelMaxId = sqliteChannelMapper.selectMaxId();
41
-            if (channelMaxId == null) {
42
-                channelMaxId = 0L;
43
-            }
38
+            Integer channelMaxId = sqliteChannelMapper.selectMaxId();
44
             System.out.println("SQLite Channel表当前最大ID: " + channelMaxId);
39
             System.out.println("SQLite Channel表当前最大ID: " + channelMaxId);
45
-            List<CmcChannel> newChannels = accessChannelMapper.listByIdRange(channelMaxId);
46
-            if (newChannels != null && !newChannels.isEmpty()) {
40
+
41
+            List<CmcChannel> newChannels = new ArrayList<>();
42
+
43
+            String channelQuery = "SELECT ID, Sensor_No, Info, Ver, Sn, Ca, Cb, Units, LastDT " +
44
+                    "FROM Channel " +
45
+                    "WHERE ID > ? " +
46
+                    "ORDER BY ID ASC";
47
+
48
+            try (PreparedStatement pstmt = conn.prepareStatement(channelQuery)) {
49
+                pstmt.setInt(1, channelMaxId);
50
+                try (ResultSet rs = pstmt.executeQuery()) {
51
+                    while (rs.next()) {
52
+                        CmcChannel channel = new CmcChannel();
53
+                        channel.setId(rs.getInt("ID"));
54
+                        channel.setSensorNo(rs.getInt("Sensor_No"));
55
+                        channel.setInfo(rs.getString("Info"));
56
+                        channel.setVer(rs.getInt("Ver"));
57
+                        channel.setSn(rs.getString("Sn"));
58
+                        channel.setCa(rs.getInt("Ca"));
59
+                        channel.setCb(rs.getInt("Cb"));
60
+                        channel.setUnits(rs.getString("Units"));
61
+                        channel.setLastDT(rs.getString("LastDT"));
62
+                        newChannels.add(channel);
63
+                    }
64
+                }
65
+            }
66
+
67
+            if (!newChannels.isEmpty()) {
47
                 System.out.println("从Access读取到" + newChannels.size() + "条新Channel记录(ID > " + channelMaxId + ")");
68
                 System.out.println("从Access读取到" + newChannels.size() + "条新Channel记录(ID > " + channelMaxId + ")");
48
-                // 分批插入
49
                 batchInsertChannels(newChannels);
69
                 batchInsertChannels(newChannels);
50
                 System.out.println("Channel表同步完成,共同步" + newChannels.size() + "条记录");
70
                 System.out.println("Channel表同步完成,共同步" + newChannels.size() + "条记录");
51
             } else {
71
             } else {
52
                 System.out.println("没有新的Channel记录需要同步(ID > " + channelMaxId + ")");
72
                 System.out.println("没有新的Channel记录需要同步(ID > " + channelMaxId + ")");
53
             }
73
             }
54
 
74
 
55
-            // 同步 Data:增量,按ID递增同步
75
+            // 同步 Data
56
             System.out.println("开始同步Data表...");
76
             System.out.println("开始同步Data表...");
57
-            Long dataMaxId = sqliteDataMapper.selectMaxId();
58
-            if (dataMaxId == null) {
59
-                dataMaxId = 0L;
60
-            }
77
+            Integer dataMaxId = sqliteDataMapper.selectMaxId();
61
             System.out.println("SQLite Data表当前最大ID: " + dataMaxId);
78
             System.out.println("SQLite Data表当前最大ID: " + dataMaxId);
62
-            List<CmcTemperature> newData = accessDataMapper.listByIdRange(dataMaxId);
63
-            for (CmcTemperature cmcTemperature : newData) {
64
-                cmcTemperature.setDatetime(cmcTemperature.getDatetime().replace(".000000", ""));
65
-                cmcTemperature.setData(cmcTemperature.getData().replace("00000", ""));
79
+
80
+            List<CmcTemperature> newData = new ArrayList<>();
81
+            String dataQuery = "SELECT ID, Group_No, Sensor_No, DateTime, Data, Volt, CSQ " +
82
+                    "FROM Data " +
83
+                    "WHERE ID > ? " +
84
+                    "ORDER BY ID ASC";
85
+
86
+            try (PreparedStatement pstmt = conn.prepareStatement(dataQuery)) {
87
+                pstmt.setInt(1, dataMaxId);
88
+                try (ResultSet rs = pstmt.executeQuery()) {
89
+                    while (rs.next()) {
90
+                        CmcTemperature data = new CmcTemperature();
91
+                        data.setId(rs.getInt("ID"));
92
+                        data.setGroupNo(rs.getInt("Group_No"));
93
+                        data.setSensorNo(rs.getInt("Sensor_No"));
94
+
95
+                        // 处理日期时间字段
96
+                        String datetime = rs.getString("DateTime");
97
+                        if (datetime != null) {
98
+                            data.setDatetime(datetime.replace(".000000", ""));
99
+                        } else {
100
+                            data.setDatetime("");
101
+                        }
102
+
103
+                        // 处理数据字段
104
+                        String dataValue = rs.getString("Data");
105
+                        if (dataValue != null) {
106
+                            data.setData(dataValue.replace("00000", ""));
107
+                        } else {
108
+                            data.setData("");
109
+                        }
110
+
111
+                        data.setVolt(rs.getString("Volt"));
112
+                        data.setCSQ(rs.getInt("CSQ"));
113
+                        newData.add(data);
114
+                    }
115
+                }
66
             }
116
             }
67
-            if (newData != null && !newData.isEmpty()) {
117
+
118
+            if (!newData.isEmpty()) {
68
                 System.out.println("从Access读取到" + newData.size() + "条新Data记录(ID > " + dataMaxId + ")");
119
                 System.out.println("从Access读取到" + newData.size() + "条新Data记录(ID > " + dataMaxId + ")");
69
-                // 分批插入
70
                 batchInsertData(newData);
120
                 batchInsertData(newData);
71
                 System.out.println("Data表同步完成,共同步" + newData.size() + "条新记录");
121
                 System.out.println("Data表同步完成,共同步" + newData.size() + "条新记录");
72
             } else {
122
             } else {
73
                 System.out.println("没有新的Data记录需要同步(ID > " + dataMaxId + ")");
123
                 System.out.println("没有新的Data记录需要同步(ID > " + dataMaxId + ")");
74
             }
124
             }
75
-            
125
+
76
             System.out.println("Access数据同步到SQLite完成");
126
             System.out.println("Access数据同步到SQLite完成");
77
-        } catch (Exception e) {
78
-            System.out.println("同步Access数据到SQLite失败: " + e.getMessage());
79
-            e.printStackTrace();
80
-            throw e;
127
+        } catch (SQLException e) {
128
+            throw new RuntimeException("Access数据库查询失败", e);
81
         }
129
         }
82
     }
130
     }
83
 
131
 
87
     private void batchInsertChannels(List<CmcChannel> channels) {
135
     private void batchInsertChannels(List<CmcChannel> channels) {
88
         int total = channels.size();
136
         int total = channels.size();
89
         int batchCount = (total + BATCH_SIZE - 1) / BATCH_SIZE;
137
         int batchCount = (total + BATCH_SIZE - 1) / BATCH_SIZE;
90
-        
138
+
91
         for (int i = 0; i < batchCount; i++) {
139
         for (int i = 0; i < batchCount; i++) {
92
             int fromIndex = i * BATCH_SIZE;
140
             int fromIndex = i * BATCH_SIZE;
93
             int toIndex = Math.min((i + 1) * BATCH_SIZE, total);
141
             int toIndex = Math.min((i + 1) * BATCH_SIZE, total);
94
             List<CmcChannel> batch = channels.subList(fromIndex, toIndex);
142
             List<CmcChannel> batch = channels.subList(fromIndex, toIndex);
95
-            
143
+
96
             sqliteChannelMapper.batchInsert(batch);
144
             sqliteChannelMapper.batchInsert(batch);
97
             System.out.println("Channel表已插入第 " + (i + 1) + "/" + batchCount + " 批,共 " + batch.size() + " 条记录");
145
             System.out.println("Channel表已插入第 " + (i + 1) + "/" + batchCount + " 批,共 " + batch.size() + " 条记录");
98
         }
146
         }
104
     private void batchInsertData(List<CmcTemperature> dataList) {
152
     private void batchInsertData(List<CmcTemperature> dataList) {
105
         int total = dataList.size();
153
         int total = dataList.size();
106
         int batchCount = (total + BATCH_SIZE - 1) / BATCH_SIZE;
154
         int batchCount = (total + BATCH_SIZE - 1) / BATCH_SIZE;
107
-        
155
+
108
         for (int i = 0; i < batchCount; i++) {
156
         for (int i = 0; i < batchCount; i++) {
109
             int fromIndex = i * BATCH_SIZE;
157
             int fromIndex = i * BATCH_SIZE;
110
             int toIndex = Math.min((i + 1) * BATCH_SIZE, total);
158
             int toIndex = Math.min((i + 1) * BATCH_SIZE, total);
111
             List<CmcTemperature> batch = dataList.subList(fromIndex, toIndex);
159
             List<CmcTemperature> batch = dataList.subList(fromIndex, toIndex);
112
-            
160
+
113
             sqliteDataMapper.batchInsert(batch);
161
             sqliteDataMapper.batchInsert(batch);
114
             System.out.println("Data表已插入第 " + (i + 1) + "/" + batchCount + " 批,共 " + batch.size() + " 条记录");
162
             System.out.println("Data表已插入第 " + (i + 1) + "/" + batchCount + " 批,共 " + batch.size() + " 条记录");
115
         }
163
         }
116
     }
164
     }
117
-}
118
-
119
-
165
+}

+ 0
- 31
cmc-temperature-back/cmc-monitoring/src/main/resources/mapper/access/AccessChannelMapper.xml View File

1
-<?xml version="1.0" encoding="UTF-8" ?>
2
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
4
-<mapper namespace="com.ruoyi.monitoring.mapper.access.AccessChannelMapper">
5
-
6
-    <resultMap type="com.ruoyi.monitoring.domain.CmcChannel" id="CmcChannelResult">
7
-        <id     property="Id"      column="ID"      />
8
-        <result property="SensorNo"     column="Sensor_No"     />
9
-        <result property="Info"   column="Info"   />
10
-        <result property="Ver"    column="Ver"    />
11
-        <result property="Sn"      column="Sn"      />
12
-        <result property="Ca"    column="Ca"    />
13
-        <result property="Cb"    column="Cb"    />
14
-        <result property="Units"    column="Units"    />
15
-        <result property="LastDT"    column="LastDT"    />
16
-    </resultMap>
17
-
18
-    <select id="listAll" resultMap="CmcChannelResult">
19
-        SELECT c.ID, c.Sensor_No, c.Info, c.Ver, c.Sn, c.Ca, c.Cb, c.Units, c.LastDT
20
-        FROM Channel c
21
-    </select>
22
-
23
-    <select id="listByIdRange" resultMap="CmcChannelResult">
24
-        SELECT c.ID, c.Sensor_No, c.Info, c.Ver, c.Sn, c.Ca, c.Cb, c.Units, c.LastDT
25
-        FROM Channel c
26
-        WHERE c.ID > #{minIdExclusive}
27
-        ORDER BY c.ID ASC
28
-    </select>
29
-
30
-</mapper>
31
-

+ 0
- 24
cmc-temperature-back/cmc-monitoring/src/main/resources/mapper/access/AccessDataMapper.xml View File

1
-<?xml version="1.0" encoding="UTF-8" ?>
2
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
4
-<mapper namespace="com.ruoyi.monitoring.mapper.access.AccessDataMapper">
5
-
6
-    <resultMap type="com.ruoyi.monitoring.domain.CmcTemperature" id="CmcTemperatureResult">
7
-        <id     property="Id"      column="ID"      />
8
-        <result property="GroupNo"    column="Group_No"    />
9
-        <result property="SensorNo"     column="Sensor_No"     />
10
-        <result property="Datetime"   column="DateTime"   />
11
-        <result property="Data"    column="Data"    />
12
-        <result property="Volt"      column="Volt"      />
13
-        <result property="CSQ"    column="CSQ"    />
14
-    </resultMap>
15
-
16
-    <select id="listByIdRange" resultMap="CmcTemperatureResult">
17
-        SELECT d.ID, d.Group_No, d.Sensor_No, d.DateTime, d.Data, d.Volt, d.CSQ
18
-        FROM Data d
19
-        WHERE d.ID &gt; #{minIdExclusive}
20
-        ORDER BY d.ID ASC
21
-    </select>
22
-
23
-</mapper>
24
-

+ 1
- 1
cmc-temperature-back/cmc-monitoring/src/main/resources/mapper/temperature/CmcChannelMapper.xml View File

35
         </where>
35
         </where>
36
     </select>
36
     </select>
37
 
37
 
38
-    <select id="selectMaxId" resultType="long">
38
+    <select id="selectMaxId" resultType="int">
39
         SELECT IFNULL(MAX(ID), 0) FROM Channel
39
         SELECT IFNULL(MAX(ID), 0) FROM Channel
40
     </select>
40
     </select>
41
 
41
 

+ 1
- 1
cmc-temperature-back/cmc-monitoring/src/main/resources/mapper/temperature/CmcTemperatureMapper.xml View File

38
         ORDER BY d.DateTime ASC, d.Sensor_No ASC
38
         ORDER BY d.DateTime ASC, d.Sensor_No ASC
39
     </select>
39
     </select>
40
 
40
 
41
-    <select id="selectMaxId" resultType="long">
41
+    <select id="selectMaxId" resultType="int">
42
         SELECT IFNULL(MAX(ID), 0) FROM Data
42
         SELECT IFNULL(MAX(ID), 0) FROM Data
43
     </select>
43
     </select>
44
 
44
 

+ 11
- 11
cmc-temperature-back/ruoyi-admin/src/main/resources/app-dev.yml View File

165
     sqlite:
165
     sqlite:
166
       type: com.zaxxer.hikari.HikariDataSource
166
       type: com.zaxxer.hikari.HikariDataSource
167
       driverClassName: org.sqlite.JDBC
167
       driverClassName: org.sqlite.JDBC
168
-      jdbcUrl: jdbc:sqlite::resource:static/cmc-temperature.db?date_string_format=yyyy-MM-dd HH:mm:ss
168
+      jdbcUrl: jdbc:sqlite:///home/cmcgis/projects/cmc-temperature/Data/cmc-temperature.db?date_string_format=yyyy-MM-dd HH:mm:ss
169
+#      jdbcUrl: jdbc:sqlite://E:/Java/cmc-temperature/cmc-temperature-back/sql/Data/cmc-temperature.db?date_string_format=yyyy-MM-dd HH:mm:ss
169
       username:
170
       username:
170
       password:
171
       password:
171
     access:
172
     access:
172
-      type: com.zaxxer.hikari.HikariDataSource
173
       driverClassName: net.ucanaccess.jdbc.UcanaccessDriver
173
       driverClassName: net.ucanaccess.jdbc.UcanaccessDriver
174
-#      jdbcUrl: jdbc:ucanaccess:///home/cmcgis/projects/cmc-temperature/Data/SKREC_ID1.accdb;showSchema=false;sysSchema=false;memory=false;keepMirror=true;immediatelyReleaseResources=true;openExclusive=false;net.ucanaccess.metadata=ignore;ignoreCase=true;logLevel=WARNING;newDatabaseVersion=V2007
175
-      jdbcUrl: jdbc:ucanaccess://E:/Java/cmc-temperature/cmc-temperature-back/sql/Data/SKREC_ID1.accdb;memory=false;keepMirror=true;immediatelyReleaseResources=true;ignorecase=true;showschema=false;sysschema=false;openExclusive=false
174
+      jdbcUrl: jdbc:ucanaccess:///home/cmcgis/projects/cmc-temperature/Data/SKREC_ID1.accdb;ignorecase=true
175
+#      jdbcUrl: jdbc:ucanaccess://E:/Java/cmc-temperature/cmc-temperature-back/sql/Data/SKREC_ID1.accdb;ignorecase=true
176
       username:
176
       username:
177
       password:
177
       password:
178
 #      type: com.zaxxer.hikari.HikariDataSource
178
 #      type: com.zaxxer.hikari.HikariDataSource
214
 # Redis配置
214
 # Redis配置
215
 redis:
215
 redis:
216
   cache_source:
216
   cache_source:
217
-#    config: |
218
-#      singleServerConfig:
219
-#        address: redis://cmc-redis:6379
220
-#        password:
221
-#        database: 7
222
-#      codec: !<org.redisson.codec.JsonJacksonCodec> {}
223
     config: |
217
     config: |
224
       singleServerConfig:
218
       singleServerConfig:
225
-        address: redis://localhost:6379
219
+        address: redis://cmc-redis:6379
226
         password:
220
         password:
227
         database: 7
221
         database: 7
228
       codec: !<org.redisson.codec.JsonJacksonCodec> {}
222
       codec: !<org.redisson.codec.JsonJacksonCodec> {}
223
+#    config: |
224
+#      singleServerConfig:
225
+#        address: redis://localhost:6379
226
+#        password:
227
+#        database: 7
228
+#      codec: !<org.redisson.codec.JsonJacksonCodec> {}
229
 
229
 
230
 # 分页插件配置
230
 # 分页插件配置
231
 pagehelper:
231
 pagehelper:

+ 1
- 1
cmc-temperature-back/ruoyi-framework/src/main/java/com/ruoyi/framework/annotation/RyLog.java View File

34
     /**
34
     /**
35
      * 是否保存响应数据
35
      * 是否保存响应数据
36
      */
36
      */
37
-    boolean isSaveResponseData() default true;
37
+    boolean isSaveResponseData() default false;
38
 
38
 
39
 }
39
 }

+ 30
- 0
cmc-temperature-back/ruoyi-schedule/src/main/java/com/ruoyi/schedule/task/AccessSyncTask.java View File

1
+package com.ruoyi.schedule.task;
2
+
3
+import com.ruoyi.monitoring.service.IAccessSyncService;
4
+import org.noear.solon.annotation.Component;
5
+import org.noear.solon.annotation.Inject;
6
+import org.noear.solon.scheduling.annotation.Scheduled;
7
+
8
+import java.util.Date;
9
+
10
+@Component
11
+public class AccessSyncTask {
12
+
13
+    @Inject
14
+    IAccessSyncService accessSyncService;
15
+
16
+    // 每小时执行一次(cron格式:秒 分 时 日 月 周 年)
17
+    @Scheduled(cron = "0 20 0/1 * * ? *", zone = "Asia/Shanghai")
18
+    public void sync() throws Exception {
19
+        System.out.println("========== Access数据同步任务开始执行,当前时间: " + new Date() + "==========");
20
+        try {
21
+            accessSyncService.syncAccessToSqlite();
22
+            System.out.println("========== Access数据同步任务执行成功,当前时间: " + new Date() + "==========");
23
+        } catch (Exception e) {
24
+            System.out.println("========== Access数据同步任务执行失败 ==========");
25
+            throw e;
26
+        }
27
+    }
28
+}
29
+
30
+

Loading…
Cancel
Save