Browse Source

1.6 红包数据同步

huangqizheng/feature-20260106155423-红包修改
huangqizhen 5 days ago
parent
commit
5d3a983f28
  1. 15
      src/main/java/com/example/demo/Mysql/MysqlServiceImpl.java
  2. 6
      src/main/java/com/example/demo/Util/GoldTistV2.java

15
src/main/java/com/example/demo/Mysql/MysqlServiceImpl.java

@ -81,7 +81,7 @@ public class MysqlServiceImpl implements MysqlService {
// 👇 恢复动态时间查询原注释掉的硬编码时间已移除
String querySql = """
SELECT
id, gtype, jwcode, free, core_jb, buy_jb, cz_time, cz_user, cz_bz, operation_platform, goods_name
id, gtype, jwcode, free, core_jb, buy_jb, cz_time, cz_user, cz_bz, operation_platform, goods_name,uid
FROM
hwhcGold.dbo.user_gold_records
WHERE cz_time >= ?
@ -94,8 +94,8 @@ public class MysqlServiceImpl implements MysqlService {
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,
audit_status, create_time, flag, update_time, audit_time, is_refund, uid)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
audit_status, create_time, flag, update_time, audit_time, is_refund, uid,link_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""";
while (hasMoreData) {
@ -189,7 +189,7 @@ public class MysqlServiceImpl implements MysqlService {
// 👇 恢复动态时间查询原注释掉的硬编码时间已移除
String querySql = """
SELECT
id, gtype, jwcode, free, core_jb, buy_jb, cz_time, cz_user, cz_bz, operation_platform, goods_name
id, gtype, jwcode, free, core_jb, buy_jb, cz_time, cz_user, cz_bz, operation_platform, goods_name, uid
FROM
hwhcGold.dbo.user_gold_records
WHERE cz_time >= ?
@ -202,8 +202,8 @@ public class MysqlServiceImpl implements MysqlService {
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,
audit_status, create_time, flag, update_time, audit_time, is_refund, uid)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
audit_status, create_time, flag, update_time, audit_time, is_refund, uid,link_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""";
while (hasMoreData) {
@ -284,6 +284,7 @@ public class MysqlServiceImpl implements MysqlService {
Timestamp cz_time;
String cz_user, cz_bz, operation_platform, goods_name, uid;
String orderNumber; // 预生成避免重复计算
String linkId;
}
private RecordData extractRecordData(ResultSet rs) throws SQLException {
@ -299,6 +300,7 @@ public class MysqlServiceImpl implements MysqlService {
data.operation_platform = rs.getString("operation_platform");
data.goods_name = rs.getString("goods_name");
data.uid = rs.getString("id");
data.linkId = rs.getString("link_id");
// 预生成订单号避免在循环中重复生成
String timestampPart = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
@ -420,6 +422,7 @@ public class MysqlServiceImpl implements MysqlService {
stmt.setTimestamp(18, now);
stmt.setTimestamp(19, data.cz_time);
stmt.setString(21, data.uid);
stmt.setString(22, data.linkId);
}
private void updateUserBalance(Connection conn, RecordData data) throws Exception {

6
src/main/java/com/example/demo/Util/GoldTistV2.java

@ -193,10 +193,10 @@ public class GoldTistV2 {
* @返回数据: String 返回状态1加成功2减成功其他失败 -5 金币不足 -6 类型错误 -7签名错误
* @版本编号: V1.0
*/
public static String addCoinNew(String jwcode, int lx, double jbs,
public static String addCoinNew(String jwcode, int lx, double jbs, String sjzfc,
String remark,double yjjb,String czr,String goodsname){
//查错误使用
String sjzfc = RandomUid(10);
// String sjzfc = RandomUid(10);
String resp = "";
try {
DESGB desjbkc = new DESGB("Jbxt.205");
@ -218,7 +218,7 @@ public class GoldTistV2 {
public static void main(String[] args) throws Exception {
//调用demo
addCoinNew("94226013",65,-2,"测试",-1,"黄其振","文章11");
addCoinNew("94226013",65,-2,"123","测试",-1,"黄其振","文章11");
}

Loading…
Cancel
Save