|
@ -77,24 +77,27 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
|
|
|
|
|
|
// 查询 SQL Server 数据的 SQL 语句 |
|
|
// 查询 SQL Server 数据的 SQL 语句 |
|
|
String querySql = """ |
|
|
String querySql = """ |
|
|
SELECT gtype, jwcode, free, core_jb, buy_jb, cz_time, cz_user, cz_bz, operation_platform, goods_name |
|
|
|
|
|
FROM hwhcGold.dbo.user_gold_records |
|
|
|
|
|
WHERE flag = 1 AND cz_time > '2025-08-24 17:57:50' |
|
|
|
|
|
ORDER BY cz_time ASC |
|
|
|
|
|
OFFSET ? ROWS FETCH NEXT ? ROWS ONLY |
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
id, gtype, jwcode, free, core_jb, buy_jb, cz_time, cz_user, cz_bz, operation_platform, goods_name\s |
|
|
|
|
|
FROM |
|
|
|
|
|
hwhcGold.dbo.user_gold_records |
|
|
|
|
|
WHERE cz_time>? |
|
|
|
|
|
ORDER BY |
|
|
|
|
|
cz_time ASC |
|
|
|
|
|
OFFSET ? ROWS FETCH NEXT ? ROWS ONLY; |
|
|
"""; |
|
|
"""; |
|
|
|
|
|
|
|
|
// 插入 MySQL 数据的 SQL 语句 |
|
|
// 插入 MySQL 数据的 SQL 语句 |
|
|
String insertSql = "INSERT INTO user_gold_record_sun (order_code, jwcode, sum_gold, permanent_gold, free_june, free_december, " + |
|
|
|
|
|
|
|
|
String insertSql = "INSERT IGNORE INTO user_gold_record (order_code, jwcode, sum_gold, permanent_gold, free_june, free_december, " + |
|
|
"task_gold, pay_platform, goods_name, refund_type, refund_model, remark, type, admin_id, " + |
|
|
"task_gold, pay_platform, goods_name, refund_type, refund_model, remark, type, admin_id, " + |
|
|
"audit_status, create_time, flag, update_time, audit_time, is_refund) " + |
|
|
|
|
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
|
|
|
|
|
|
|
|
"audit_status, create_time, flag, update_time, audit_time, is_refund,uid) " + |
|
|
|
|
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)"; |
|
|
|
|
|
|
|
|
while (hasMoreData) { |
|
|
while (hasMoreData) { |
|
|
try (PreparedStatement sqlServerStmt = sqlServerConn.prepareStatement(querySql)) { |
|
|
try (PreparedStatement sqlServerStmt = sqlServerConn.prepareStatement(querySql)) { |
|
|
// sqlServerStmt.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now().minusHours(1))); // 获取最近一小时的数据 |
|
|
|
|
|
sqlServerStmt.setInt(1, offset); // 设置 OFFSET |
|
|
|
|
|
sqlServerStmt.setInt(2, pageSize); // 设置 FETCH NEXT |
|
|
|
|
|
|
|
|
sqlServerStmt.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now().minusHours(1))); // 获取最近一小时的数据 |
|
|
|
|
|
sqlServerStmt.setInt(2, offset); // 设置 OFFSET |
|
|
|
|
|
sqlServerStmt.setInt(3, pageSize); // 设置 FETCH NEXT |
|
|
|
|
|
|
|
|
ResultSet resultSet = sqlServerStmt.executeQuery(); |
|
|
ResultSet resultSet = sqlServerStmt.executeQuery(); |
|
|
|
|
|
|
|
@ -118,6 +121,7 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
String remark = resultSet.getString("cz_bz"); |
|
|
String remark = resultSet.getString("cz_bz"); |
|
|
String operation_platform = resultSet.getString("operation_platform"); |
|
|
String operation_platform = resultSet.getString("operation_platform"); |
|
|
String goods_name = resultSet.getString("goods_name"); |
|
|
String goods_name = resultSet.getString("goods_name"); |
|
|
|
|
|
String uid = resultSet.getString("id"); |
|
|
String timestampPart = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
|
|
String timestampPart = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
|
|
String orderNumber = UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
String orderNumber = UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
|
|
|
|
|
@ -173,15 +177,15 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
mysqlStmt.setInt(5, free); |
|
|
mysqlStmt.setInt(5, free); |
|
|
} |
|
|
} |
|
|
mysqlStmt.setInt(7, core_jb); |
|
|
mysqlStmt.setInt(7, core_jb); |
|
|
if (operation_platform.equals("1")) { |
|
|
|
|
|
|
|
|
if ("1".equals(operation_platform)) { |
|
|
mysqlStmt.setString(8, "ERP"); |
|
|
mysqlStmt.setString(8, "ERP"); |
|
|
} else if (operation_platform.equals("2")) { |
|
|
|
|
|
|
|
|
} else if ("2".equals(operation_platform)) { |
|
|
mysqlStmt.setString(8, "HomilyLink"); |
|
|
mysqlStmt.setString(8, "HomilyLink"); |
|
|
} else if (operation_platform.equals("3")) { |
|
|
|
|
|
|
|
|
} else if ("3".equals(operation_platform)) { |
|
|
mysqlStmt.setString(8, "HomilyChart"); |
|
|
mysqlStmt.setString(8, "HomilyChart"); |
|
|
} else if (operation_platform.equals("4")) { |
|
|
|
|
|
|
|
|
} else if ("4".equals(operation_platform)) { |
|
|
continue; |
|
|
continue; |
|
|
} else if (operation_platform.equals("0")) { |
|
|
|
|
|
|
|
|
} else if ("0".equals(operation_platform)) { |
|
|
mysqlStmt.setString(8, "初始化金币"); |
|
|
mysqlStmt.setString(8, "初始化金币"); |
|
|
} else { |
|
|
} else { |
|
|
mysqlStmt.setString(8, "其他"); |
|
|
mysqlStmt.setString(8, "其他"); |
|
@ -190,13 +194,14 @@ public class MysqlServiceImpl implements MysqlService { |
|
|
mysqlStmt.setString(12, remark); |
|
|
mysqlStmt.setString(12, remark); |
|
|
mysqlStmt.setInt(15, 3); |
|
|
mysqlStmt.setInt(15, 3); |
|
|
mysqlStmt.setTimestamp(16, created_at); |
|
|
mysqlStmt.setTimestamp(16, created_at); |
|
|
if (remark.contains("测试") && remark.contains("员工")) { |
|
|
|
|
|
|
|
|
if (remark != null && remark.contains("测试") && remark.contains("员工")) { |
|
|
mysqlStmt.setInt(17, 0); |
|
|
mysqlStmt.setInt(17, 0); |
|
|
} else { |
|
|
} else { |
|
|
mysqlStmt.setInt(17, 1); |
|
|
mysqlStmt.setInt(17, 1); |
|
|
} |
|
|
} |
|
|
mysqlStmt.setTimestamp(18, created_at); |
|
|
mysqlStmt.setTimestamp(18, created_at); |
|
|
mysqlStmt.setTimestamp(19, created_at); |
|
|
mysqlStmt.setTimestamp(19, created_at); |
|
|
|
|
|
mysqlStmt.setString(21, uid); |
|
|
|
|
|
|
|
|
mysqlStmt.addBatch(); |
|
|
mysqlStmt.addBatch(); |
|
|
|
|
|
|
|
|