管理端-课程营销标签
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package com.peanut.common.utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
|
||||
public class DataMigrationUtil {
|
||||
|
||||
@@ -13,7 +16,7 @@ public class DataMigrationUtil {
|
||||
// courseCatalogue();
|
||||
// courseCatalogueChapter();
|
||||
// courseCatalogueChapterVideo();
|
||||
|
||||
user();
|
||||
|
||||
}
|
||||
|
||||
@@ -303,8 +306,8 @@ public class DataMigrationUtil {
|
||||
public static void user(){
|
||||
try {
|
||||
Connection fzdsconn = DriverManager.getConnection(
|
||||
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
|
||||
"yljkmaster", "Wu751019!@");
|
||||
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true",
|
||||
"nuttyreading", "Wu751019!");
|
||||
Connection yljkconn = DriverManager.getConnection(
|
||||
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
|
||||
"yljkmaster", "Wu751019!@");
|
||||
@@ -331,19 +334,31 @@ public class DataMigrationUtil {
|
||||
//已绑定过
|
||||
PreparedStatement oidStatements = fzdsconn.prepareStatement("select * from user_copy1 where del_flag = 0 and yljk_oid = '"+list.get(i).get("oid")+"' ");
|
||||
ResultSet oidResultSet = oidStatements.executeQuery();
|
||||
if (oidResultSet.wasNull()){
|
||||
if (oidResultSet.next()){
|
||||
PreparedStatement oidUpdateStatement = fzdsconn.prepareStatement("update user_copy1 set " +
|
||||
"name = if(isnull(name),"+list.get(i).get("nameCN")+") , nickname = if(isnull(nickname),"+list.get(i).get("nickName")+") ," +
|
||||
"tel = if(isnull(tel),"+list.get(i).get("cellPhone")+") ," +
|
||||
"vip= "+list.get(i).get("payStatus")+" ,peanut_coin = peanut_coin + "+list.get(i).get("point")+" , jf = jf + "+list.get(i).get("pointByJF")+" where id = "+oidResultSet.getString("id")+"");
|
||||
oidUpdateStatement.executeUpdate();
|
||||
if (list.get(i).get("payValidDate")!=null){
|
||||
PreparedStatement oidInsertStatement = fzdsconn.prepareStatement(
|
||||
"INSERT ignore INTO user_vip_copy1 (user_id,type,start_time,end_time,state) VALUES (?, ?, ?, ?, ?)");
|
||||
oidInsertStatement.setString(1,oidResultSet.getString("id"));
|
||||
oidInsertStatement.setString(2,list.get(i).get("payStatus").toString());
|
||||
oidInsertStatement.setString(3,list.get(i).get("paydate").toString());
|
||||
oidInsertStatement.setString(4,list.get(i).get("payValidDate").toString());
|
||||
if (DateUtil.compare(DateUtil.parseDate(list.get(i).get("payValidDate").toString()),new Date())>0){
|
||||
oidInsertStatement.setString(5,"0");
|
||||
}else {
|
||||
oidInsertStatement.setString(5,"1");
|
||||
}
|
||||
oidUpdateStatement.execute();
|
||||
}
|
||||
}else {
|
||||
//未绑定过,用电话查询
|
||||
PreparedStatement telStatements = fzdsconn.prepareStatement("select * from user_copy1 where del_flag = 0 and tel = '"+list.get(i).get("cellPhone")+"' ");
|
||||
ResultSet telResultSet = telStatements.executeQuery();
|
||||
if (telResultSet.wasNull()){
|
||||
|
||||
}
|
||||
}else {
|
||||
while(resultSet.next()){
|
||||
PreparedStatement oidStatement = fzdsconn.prepareStatement("update user_copy1 set " +
|
||||
"name = if(isnull(name),"+list.get(i).get("nameCN")+",name) , nickname = if(isnull(nickname),"+list.get(i).get("nickName")+",nickname) ," +
|
||||
"tel = if(isnull(tel),"+list.get(i).get("cellPhone")+",tel) ," +
|
||||
"vip= "+list.get(i).get("payStatus")+" ,peanut_coin = peanut_coin + "+list.get(i).get("point")+" , jf = jf + "+list.get(i).get("pointByJF")+" where id = "+resultSet.getString("id")+"");
|
||||
if (telResultSet.next()){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user