同步用户开课
This commit is contained in:
@@ -2,6 +2,7 @@ package com.peanut.modules.job.task;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import org.apache.commons.lang.time.DateUtils;
|
import org.apache.commons.lang.time.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -10,6 +11,9 @@ import java.util.Date;
|
|||||||
@Component("userCourseBuyTask")
|
@Component("userCourseBuyTask")
|
||||||
public class UserCourseBuyTask implements ITask{
|
public class UserCourseBuyTask implements ITask{
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String active;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String params) {
|
public void run(String params) {
|
||||||
try {
|
try {
|
||||||
@@ -17,16 +21,18 @@ public class UserCourseBuyTask implements ITask{
|
|||||||
Connection yljkconn = DriverManager.getConnection(
|
Connection yljkconn = DriverManager.getConnection(
|
||||||
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
|
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
|
||||||
"yljkmaster", "Wu751019!@");
|
"yljkmaster", "Wu751019!@");
|
||||||
Connection fzdsconn = DriverManager.getConnection(
|
String url = "jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true";
|
||||||
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true",
|
if ("prod".equals(active)){
|
||||||
"nuttyreading", "Wu751019!");
|
url = "jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true";
|
||||||
|
}
|
||||||
|
Connection fzdsconn = DriverManager.getConnection(url , "nuttyreading", "Wu751019!");
|
||||||
PreparedStatement addClassStatement = fzdsconn.prepareStatement(
|
PreparedStatement addClassStatement = fzdsconn.prepareStatement(
|
||||||
"INSERT ignore INTO user_course_buy (user_id,course_id,catalogue_id,create_time,days,start_time,end_time) " +
|
"INSERT ignore INTO user_course_buy (user_id,course_id,catalogue_id,create_time,days,start_time,end_time) " +
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?)");
|
"VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||||
//查询前一天新开的课
|
//查询前一天新开的课
|
||||||
PreparedStatement classStatement = yljkconn.prepareStatement("select tc.superVIP,tc.cellPhone,tctc.* from t_customer_taihu_class tctc " +
|
PreparedStatement classStatement = yljkconn.prepareStatement("select tc.superVIP,tc.cellPhone,tctc.* from t_customer_taihu_class tctc " +
|
||||||
"left join t_customer tc on tc.oid = tctc.customerOid " +
|
"left join t_customer tc on tc.oid = tctc.customerOid " +
|
||||||
"where tctc.valid = 1 and tctc.status = '10' and DATE(tctc.createDate) = DATE('"+DateUtils.addDays(new Date(),-1)+"') and tc.superVIP = '0' ");
|
"where tctc.valid = 1 and tctc.status = '10' and DATE(tctc.createDate) > DATE('"+DateUtil.format(DateUtils.addDays(new Date(),-1),"yyyy-MM-dd")+"') and tc.superVIP = '0' ");
|
||||||
ResultSet classResultSet = classStatement.executeQuery();
|
ResultSet classResultSet = classStatement.executeQuery();
|
||||||
System.out.println("userCourseBuy数据统计完成-----");
|
System.out.println("userCourseBuy数据统计完成-----");
|
||||||
while (classResultSet.next()) {
|
while (classResultSet.next()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user