From 01d4b80b564c8d00744c16cb5d5c73090f3cad73 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Wed, 24 Jul 2024 09:53:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E6=94=B9=E4=B8=BA6?= =?UTF-8?q?=E4=BD=8D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/DataMigrationUtil.java | 168 ++++++++++-------- .../book/controller/MyUserController.java | 15 +- .../common/controller/UserController.java | 15 +- 3 files changed, 109 insertions(+), 89 deletions(-) diff --git a/src/main/java/com/peanut/common/utils/DataMigrationUtil.java b/src/main/java/com/peanut/common/utils/DataMigrationUtil.java index 1867ecb8..14d93fd7 100644 --- a/src/main/java/com/peanut/common/utils/DataMigrationUtil.java +++ b/src/main/java/com/peanut/common/utils/DataMigrationUtil.java @@ -27,26 +27,27 @@ public class DataMigrationUtil extends Thread { public static void main(String[] args){ -// catalogue(); -// courseCatalogue(); +// course("2024-05-19");//运行时间2024-07-11 +// courseCatalogue("2024-05-19"); +// courseCatalogueChapter("2024-05-19"); +// courseCatalogueChapterVideo("2024-05-19"); // userCourse(); -// courseCatalogueChapter(); -// courseCatalogueChapterVideo(); //用的都是copy表里的数据 // truncate(); } - public static void catalogue(){ + public static void course(String createTime){ try { Connection yljkconn = DriverManager.getConnection( "jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?", "yljkmaster", "Wu751019!@"); // PreparedStatement statement = yljkconn.prepareStatement("select * from t_curriculum_catalogue where valid = 1" + -// " and poid in (select oid from t_curriculum_catalogue where valid = 1 and poid is null) " + -// "and (courseFee like '%,%' or courseFee = '0' or courseFee = '' or poid = '00000000000000000000000000000070' )"); +// " and poid in (select oid from t_curriculum_catalogue where valid = 1 and poid is null)" + +// " and (courseFee like '%,%' or courseFee = '0' or courseFee = '' or poid = '00000000000000000000000000000070')" + +// " and createDate > '"+createTime+"'"); PreparedStatement statement = yljkconn.prepareStatement("select * from t_curriculum_catalogue " + - "where oid = 'ee9d5e16845a43b5933ecc111ee52052' "); + "where oid = '71f55cff46494791b839d0d8c17e1f2b' "); ResultSet resultSet = statement.executeQuery(); List list = new ArrayList(); while(resultSet.next()){ @@ -104,13 +105,16 @@ public class DataMigrationUtil extends Thread { - public static void courseCatalogue(){ + public static void courseCatalogue(String createTime){ try { Connection fzdsconn = DriverManager.getConnection( "jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true", "nuttyreading", "Wu751019!"); // PreparedStatement fzdsstatement = fzdsconn.prepareStatement("select id,uid from course "); - PreparedStatement fzdsstatement = fzdsconn.prepareStatement("select id,uid from course where id = 183 "); +// PreparedStatement fzdsstatement = fzdsconn.prepareStatement( +// "select id,uid from course where uid != '' and create_time > '"+createTime+"'"); + PreparedStatement fzdsstatement = fzdsconn.prepareStatement( + "select id,uid from course where id = 195 "); ResultSet fzdsresultSet = fzdsstatement.executeQuery(); List fzdslist = new ArrayList(); while(fzdsresultSet.next()){ @@ -192,77 +196,19 @@ public class DataMigrationUtil extends Thread { } } - public static void userCourse(){ - try { - Connection yljkconn = DriverManager.getConnection( - "jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?", - "yljkmaster", "Wu751019!@"); - Connection connection = DriverManager.getConnection( - "jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true", - "nuttyreading", "Wu751019!"); -// PreparedStatement statement = yljkconn.prepareStatement("select oid,cellPhone,nameCN,nickName,icons,superVIP,point,pointByJF,payStatus,paydate,payValidDate from t_customer where valid = 1 and cellphone != '' and cellphone is not null "); -// ResultSet resultSet = statement.executeQuery(); -// while(resultSet.next()){ -// PreparedStatement fzdsstatement = connection.prepareStatement("select * from user where yljk_oid = '"+resultSet.getString("oid")+"'"); -// ResultSet fzdsresultSet = fzdsstatement.executeQuery(); -// if (!fzdsresultSet.next()){ -// user(yljkconn,connection,resultSet.getString("oid")); -// } -// } - List list = new ArrayList(); - list.add("137a4c15dad741f1b8bdcf3f1ed29bb2"); - list.add("4f50a94045994dafb16c337f9b590d3d"); - for (int i=0;i '"+createTime+"'"); PreparedStatement fzdsstatement = fzdsconn.prepareStatement( - "select c.id,c.uid,cc.id ccid,cc.title cctitle from course c left join course_catalogue cc on c.id = cc.course_id " + - "where c.id = 183"); + "select c.id,c.uid,cc.id ccid,cc.title cctitle from course c " + + " left join course_catalogue cc on c.id = cc.course_id " + + " where c.id = 195"); ResultSet fzdsresultSet = fzdsstatement.executeQuery(); List fzdslist = new ArrayList(); while(fzdsresultSet.next()){ @@ -326,16 +272,19 @@ public class DataMigrationUtil extends Thread { } } - public static void courseCatalogueChapterVideo(){ + public static void courseCatalogueChapterVideo(String createTime){ try { Connection fzdsconn = DriverManager.getConnection( "jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true", "nuttyreading", "Wu751019!"); // PreparedStatement fzdsstatement = fzdsconn.prepareStatement( -// "select c.uid,ccc.id as cccid,ccc.title from course c left join course_catalogue_chapter ccc on c.id = ccc.course_id"); +// "select c.uid,ccc.id as cccid,ccc.title from course c" + +// " left join course_catalogue_chapter ccc on c.id = ccc.course_id" + +// " where c.create_time > '"+createTime+"'"); PreparedStatement fzdsstatement = fzdsconn.prepareStatement( - "select c.uid,ccc.id as cccid,ccc.title from course c left join course_catalogue_chapter ccc on c.id = ccc.course_id " + - "where c.id = 183"); + "select c.uid,ccc.id as cccid,ccc.title from course c" + + " left join course_catalogue_chapter ccc on c.id = ccc.course_id" + + " where c.id = 195 "); ResultSet fzdsresultSet = fzdsstatement.executeQuery(); List fzdslist = new ArrayList(); while(fzdsresultSet.next()){ @@ -410,6 +359,67 @@ public class DataMigrationUtil extends Thread { } } + public static void userCourse(){ + try { + Connection yljkconn = DriverManager.getConnection( + "jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?", + "yljkmaster", "Wu751019!@"); + Connection connection = DriverManager.getConnection( + "jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true", + "nuttyreading", "Wu751019!"); +// PreparedStatement statement = yljkconn.prepareStatement("select oid,cellPhone,nameCN,nickName,icons,superVIP,point,pointByJF,payStatus,paydate,payValidDate from t_customer where valid = 1 and cellphone != '' and cellphone is not null "); +// ResultSet resultSet = statement.executeQuery(); +// while(resultSet.next()){ +// PreparedStatement fzdsstatement = connection.prepareStatement("select * from user where yljk_oid = '"+resultSet.getString("oid")+"'"); +// ResultSet fzdsresultSet = fzdsstatement.executeQuery(); +// if (!fzdsresultSet.next()){ +// user(yljkconn,connection,resultSet.getString("oid")); +// } +// } + List list = new ArrayList(); + list.add("137a4c15dad741f1b8bdcf3f1ed29bb2"); + list.add("4f50a94045994dafb16c337f9b590d3d"); + for (int i=0;i