不同app用不同的appid支付
This commit is contained in:
@@ -3,6 +3,7 @@ package com.peanut.common.utils;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
@@ -21,11 +22,11 @@ public class DataMigrationUtil extends Thread {
|
||||
|
||||
|
||||
public static void main(String[] args){
|
||||
// catalogue();
|
||||
catalogue();
|
||||
// courseCatalogue();
|
||||
// courseCatalogueChapter();
|
||||
// courseCatalogueChapterVideo();
|
||||
user();//用的都是copy表里的数据
|
||||
// user();//用的都是copy表里的数据
|
||||
|
||||
}
|
||||
|
||||
@@ -337,8 +338,9 @@ public class DataMigrationUtil extends Thread {
|
||||
}
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
yljkconn.close();
|
||||
// 1、创建服务,创建线程池
|
||||
ExecutorService service = Executors.newFixedThreadPool(200);
|
||||
ExecutorService service = Executors.newFixedThreadPool(50);
|
||||
for (int i=1;i<=list.size(); i++){
|
||||
DataMigrationUtil d1 = new DataMigrationUtil(list.get(i),i);
|
||||
service.execute(d1);
|
||||
@@ -355,14 +357,10 @@ public class DataMigrationUtil extends Thread {
|
||||
System.out.println("---已插入数据"+i);
|
||||
}
|
||||
String userId = "";
|
||||
BigDecimal userBalance = new BigDecimal(0);
|
||||
Connection fzdsconn = DriverManager.getConnection(
|
||||
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true",
|
||||
"nuttyreading", "Wu751019!");
|
||||
PreparedStatement telInsertStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO user_copy1 (name,avatar,nickname,tel,vip,peanut_coin,jf,yljk_oid) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement userVipStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO user_vip_copy1 (user_id,type,start_time,end_time,state) VALUES (?, ?, ?, ?, ?)");
|
||||
PreparedStatement oidStatements = fzdsconn.prepareStatement("select * from user_copy1 where del_flag = 0 and yljk_oid = '"+map.get("oid")+"' ");
|
||||
ResultSet oidResultSet = oidStatements.executeQuery();
|
||||
//已绑定过id
|
||||
@@ -373,7 +371,9 @@ public class DataMigrationUtil extends Thread {
|
||||
"vip= "+map.get("payStatus")+" ,peanut_coin = peanut_coin + "+map.get("point")+" , jf = jf + "+map.get("pointByJF")+" where id = "+oidResultSet.getString("id")+"";
|
||||
PreparedStatement oidUpdateStatement = fzdsconn.prepareStatement(sql);
|
||||
userId = oidResultSet.getString("id");
|
||||
userBalance = oidResultSet.getBigDecimal("peanut_coin").add(new BigDecimal(map.get("point").toString()));
|
||||
oidUpdateStatement.execute();
|
||||
oidUpdateStatement.close();
|
||||
}else {
|
||||
//未绑定过id,用电话查询
|
||||
PreparedStatement telStatements = fzdsconn.prepareStatement("select * from user_copy1 where del_flag = 0 and tel = '"+map.get("cellPhone")+"' ");
|
||||
@@ -387,10 +387,15 @@ public class DataMigrationUtil extends Thread {
|
||||
"vip= "+map.get("payStatus")+" ,peanut_coin = peanut_coin + "+map.get("point")+" , jf = jf + "+map.get("pointByJF")+" where tel = '"+map.get("cellPhone")+"'";
|
||||
PreparedStatement telUpdateStatement = fzdsconn.prepareStatement(sql);
|
||||
userId = telResultSet.getString("id");
|
||||
userBalance = oidResultSet.getBigDecimal("peanut_coin").add(new BigDecimal(map.get("point").toString()));
|
||||
telUpdateStatement.execute();
|
||||
telUpdateStatement.close();
|
||||
}
|
||||
}else {
|
||||
//没有关联,直接导入
|
||||
PreparedStatement telInsertStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO user_copy1 (name,avatar,nickname,tel,vip,peanut_coin,jf,yljk_oid) " +
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
telInsertStatement.setString(1,map.get("nameCN")==null?"":map.get("nameCN").toString());
|
||||
telInsertStatement.setString(2,map.get("icons")==null?"":map.get("icons").toString());
|
||||
telInsertStatement.setString(3,map.get("nickName")==null?"":map.get("nickName").toString());
|
||||
@@ -399,10 +404,19 @@ public class DataMigrationUtil extends Thread {
|
||||
telInsertStatement.setString(6,map.get("point")==null?"":map.get("point").toString());
|
||||
telInsertStatement.setString(7,map.get("pointByJF")==null?"":map.get("pointByJF").toString());
|
||||
telInsertStatement.setString(8,map.get("oid")==null?"":map.get("oid").toString());
|
||||
telInsertStatement.execute();
|
||||
telInsertStatement.execute();//获取添加之后自动增长id值
|
||||
ResultSet rs = telInsertStatement.getGeneratedKeys();
|
||||
while(rs.next()) {
|
||||
Object id = rs.getObject(1);
|
||||
userId = id.toString();
|
||||
}
|
||||
telInsertStatement.close();
|
||||
userBalance = new BigDecimal(map.get("point").toString());
|
||||
}
|
||||
}
|
||||
//添加超v
|
||||
PreparedStatement userVipStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO user_vip_copy1 (user_id,type,start_time,end_time,state) VALUES (?, ?, ?, ?, ?)");
|
||||
if (map.get("paydate")!=null&&map.get("payValidDate")!=null){
|
||||
userVipStatement.setString(1,userId);
|
||||
userVipStatement.setString(2,map.get("payStatus").toString());
|
||||
@@ -414,7 +428,24 @@ public class DataMigrationUtil extends Thread {
|
||||
userVipStatement.setString(5,"1");
|
||||
}
|
||||
userVipStatement.execute();
|
||||
userVipStatement.close();
|
||||
}
|
||||
//添加灵兰币记录
|
||||
PreparedStatement transactionDetailStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO transaction_details_copy1 (user_id,order_type,change_amount,remark,user_balance," +
|
||||
"user_name,tel) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||
if (map.get("point")!=null&&!"0".equals(map.get("point").toString())){
|
||||
transactionDetailStatement.setString(1,userId);
|
||||
transactionDetailStatement.setString(2,"系统合并结算");
|
||||
transactionDetailStatement.setString(3,map.get("point").toString());
|
||||
transactionDetailStatement.setString(4,"合并");
|
||||
transactionDetailStatement.setBigDecimal(5,userBalance);
|
||||
transactionDetailStatement.setString(6,map.get("nameCN")==null?"":map.get("nameCN").toString());
|
||||
transactionDetailStatement.setString(7,map.get("cellPhone").toString());
|
||||
transactionDetailStatement.execute();
|
||||
transactionDetailStatement.close();
|
||||
}
|
||||
fzdsconn.close();
|
||||
}catch (Exception ee){
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user