From 6e6d9ce9189f2fccbe3b04171363be349dcf8ef8 Mon Sep 17 00:00:00 2001 From: luochuan Date: Wed, 13 Mar 2024 16:25:24 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E8=A1=A5=E5=81=BF=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alis/excel/service/ClassInventory.java | 12 +- .../excel/service/ExcelExportService.java | 4 +- .../org/alis/excel/service/TokenService.java | 67 ----------- src/main/resources/user.txt | 112 +----------------- 4 files changed, 9 insertions(+), 186 deletions(-) delete mode 100644 src/main/java/org/alis/excel/service/TokenService.java diff --git a/src/main/java/org/alis/excel/service/ClassInventory.java b/src/main/java/org/alis/excel/service/ClassInventory.java index c7f2f9c..b261574 100644 --- a/src/main/java/org/alis/excel/service/ClassInventory.java +++ b/src/main/java/org/alis/excel/service/ClassInventory.java @@ -21,7 +21,7 @@ import java.util.stream.Collectors; * @author lc * @date 2024/2/21 15:12 **/ -@Service +//@Service public class ClassInventory implements CommandLineRunner { private static final String group = "prod"; @@ -30,22 +30,22 @@ public class ClassInventory implements CommandLineRunner { "and date_format(ci.create_time, '%Y-%m-%d') =date_format(st.create_time, '%Y-%m-%d')\n" + "left JOIN (select user_id from class.class_student where class_id in (select id from class.class_info where status = 3)) as cl\n" + "on cl.user_id = st.user_id\n" + - "where ci.id is null and st.create_time >'2024-01-01 00:00:00' and st.user_id not in (83335,83340,230940,83327,230747,216119,83342,83388,83385,213412,212723,210824,210690,215397,230231,230941,216365,212762,212854,230843,213368,216112,206927,230604,215389,212297,92713,84675,230376,83337,216362,215374,215391,230657,213737,231093,215265,205049,208510,83338,230289,215235,230484,231009,213413,213111,216114,210825,231298,231297,216358,216805,216699,210707,215319,215246,208905,212151,216455,83334,215868,216348,231013,212626,215762,205622,216363,213792,215767,231122,216696,212263,83424,230230,204840,204997,216804,216563,231199,216808,215349,216208,230511,215491,83401,216206,231200,230778,260080,83383,83384,230232,230777,77652,83322,216357,213369,207459,204894,215812,83343,212727,83344,206611,260171,260170,260169,260168,260167,210261,230762,212329,83333,216339,83341,215440,206283,204727,230776,230104,216347,230126,230600,215425,212625,204765,216806,215345,208096,230845,230103,216342,83389,83369,216364,231015,216698,83351,212325,83425,215303,211168,231014,83368,231008,231007,83347,83387,215465,231333,230193,83348,83339,204665,215296,216359,83370,83402,215321,215267,83350,230453,215350,215226,216690,83353) and st.user_id in "; + "where ci.id is null and st.create_time >'2024-03-01 00:00:00' and st.user_id not in (83335,83340,230940,83327,230747,216119,83342,83388,83385,213412,212723,210824,210690,215397,230231,230941,216365,212762,212854,230843,213368,216112,206927,230604,215389,212297,92713,84675,230376,83337,216362,215374,215391,230657,213737,231093,215265,205049,208510,83338,230289,215235,230484,231009,213413,213111,216114,210825,231298,231297,216358,216805,216699,210707,215319,215246,208905,212151,216455,83334,215868,216348,83324,159468,231013,212626,215762,205622,216363,213792,215767,231122,216696,212263,83424,230230,204840,204997,216804,216563,231199,216808,215349,216208,230511,215491,83401,216206,231200,230778,260080,83383,83384,230232,230777,77652,83322,216357,213369,207459,204894,215812,83343,212727,83344,206611,260171,260170,260169,260168,260167,210261,230762,212329,83333,216339,83341,215440,206283,204727,230776,230104,216347,230126,230600,215425,212625,204765,216806,215345,208096,230845,230103,216342,83389,83369,216364,231015,216698,83351,212325,83425,215303,211168,231014,83368,231008,231007,83347,83387,215465,231333,230193,83348,83339,204665,215296,216359,83370,83402,215321,215267,83350,230453,215350,215226,216690,83353,78213,206432,260222,260223,260224,260225,260226,260240,210989,230779,260241,260242,260243,260244,260245,260275,260276) and st.user_id in "; private static final String selectSql = "select st.user_id,st.id,st.week_id,st.create_time from study.student_record st left JOIN class.class_inventory ci \n" + "on st.user_id = ci.user_id and st.week_id=ci.week_id \n" + "and date_format(ci.create_time, '%Y-%m-%d') =date_format(st.create_time, '%Y-%m-%d')\n" + "left JOIN (select user_id from class.class_student where class_id in (select id from class.class_info where status = 3)) as cl\n" + "on cl.user_id = st.user_id\n" + - "where ci.id is null and st.create_time >'2024-01-01 00:00:00' and st.user_id not in (83335,83340,230940,83327,230747,216119,83342,83388,83385,213412,212723,210824,210690,215397,230231,230941,216365,212762,212854,230843,213368,216112,206927,230604,215389,212297,92713,84675,230376,83337,216362,215374,215391,230657,213737,231093,215265,205049,208510,83338,230289,215235,230484,231009,213413,213111,216114,210825,231298,231297,216358,216805,216699,210707,215319,215246,208905,212151,216455,83334,215868,216348,231013,212626,215762,205622,216363,213792,215767,231122,216696,212263,83424,230230,204840,204997,216804,216563,231199,216808,215349,216208,230511,215491,83401,216206,231200,230778,260080,83383,83384,230232,230777,77652,83322,216357,213369,207459,204894,215812,83343,212727,83344,206611,260171,260170,260169,260168,260167,210261,230762,212329,83333,216339,83341,215440,206283,204727,230776,230104,216347,230126,230600,215425,212625,204765,216806,215345,208096,230845,230103,216342,83389,83369,216364,231015,216698,83351,212325,83425,215303,211168,231014,83368,231008,231007,83347,83387,215465,231333,230193,83348,83339,204665,215296,216359,83370,83402,215321,215267,83350,230453,215350,215226,216690,83353)"; + "where ci.id is null and st.create_time >'2024-03-01 00:00:00' and st.user_id not in (83335,83340,230940,83327,230747,216119,83342,83388,83385,213412,212723,210824,210690,215397,230231,230941,216365,212762,212854,230843,213368,216112,206927,230604,215389,212297,92713,84675,230376,83337,216362,215374,215391,230657,213737,231093,215265,205049,208510,83338,230289,215235,230484,231009,213413,213111,216114,210825,231298,231297,216358,216805,216699,210707,215319,215246,208905,212151,216455,83334,215868,83324,216348,159468,231013,212626,215762,205622,216363,213792,215767,231122,216696,212263,83424,230230,204840,204997,216804,216563,231199,216808,215349,216208,230511,215491,83401,216206,231200,230778,260080,83383,83384,230232,230777,77652,83322,216357,213369,207459,204894,215812,83343,212727,83344,206611,260171,260170,260169,260168,260167,210261,230762,212329,83333,216339,83341,215440,206283,204727,230776,230104,216347,230126,230600,215425,212625,204765,216806,215345,208096,230845,230103,216342,83389,83369,216364,231015,216698,83351,212325,83425,215303,211168,231014,83368,231008,231007,83347,83387,215465,231333,230193,83348,83339,204665,215296,216359,83370,83402,215321,215267,83350,230453,215350,215226,216690,83353,78213,206432,260222,260223,260224,260225,260226,260240,210989,230779,260241,260242,260243,260244,260245,260275,260276)"; @Override public void run(String... args) throws Exception { try (InputStream resource = this.getClass().getClassLoader().getResourceAsStream("user.txt"); BufferedReader reader = new BufferedReader(new InputStreamReader(resource))) { -// String userLists = reader.lines().collect(Collectors.joining(",", "(", ")")); -// String sql = querySql + userLists; - String sql = selectSql; + String userLists = reader.lines().collect(Collectors.joining(",", "(", ")")); + String sql = querySql + userLists; +// String sql = selectSql; List result = Db.use(group).query(sql); int i = 0; List userList = new ArrayList<>(); diff --git a/src/main/java/org/alis/excel/service/ExcelExportService.java b/src/main/java/org/alis/excel/service/ExcelExportService.java index ee37bee..21d1cdd 100644 --- a/src/main/java/org/alis/excel/service/ExcelExportService.java +++ b/src/main/java/org/alis/excel/service/ExcelExportService.java @@ -35,7 +35,7 @@ import java.util.stream.Collectors; * @date 2023/3/11 11:35 */ @Slf4j -//@Service +@Service public class ExcelExportService implements ApplicationRunner { private static final String group = "prod"; @@ -76,7 +76,7 @@ public class ExcelExportService implements ApplicationRunner { private String getCookie() { - return "source=12; _ga=GA1.1.818400960.1708656488; _ga_66T44ZVWSB=GS1.1.1708668168.2.0.1708668168.0.0.0; user_id=10751; timestamp=1708842838472; token=eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJVU0VSX0NFTlRFUiIsInN1YiI6IntcImlkXCI6MTA3NTEsXCJuYW1lXCI6XCLnvZflt51cIixcImVtYWlsXCI6XCJjaHVhbi5sdW9AZGF5dWFuMTk5Ny5jb21cIixcInBob25lXCI6XCIxODEqKioqNzIzOVwiLFwic3RhdHVzXCI6MSxcInR5cGVcIjoyLFwibG9naW5EYXRlXCI6XCIyMDI0LTAyLTE3IDEwOjE1OjQyXCIsXCJleHBpcmVEYXRlXCI6XCIyMDI0LTAzLTE4IDEwOjE1OjQyXCIsXCJkdXJhdGlvblwiOjI1OTIwMDB9IiwiYXVkIjoiTElMWV9wcm9kIiwiaWF0IjoxNzA4MTM2MTQyLCJleHAiOjE3MTA3MjgxNDJ9.QzpYTcJT1gQEvaGt26jxljfgaWusxH_ecL6gcUMSwDtEr-K4HxaytOB9iIwyJCRlGNL8WnC-21MVbfd13p5qYQ"; + return "source=12; user_id=10751; timestamp=1709974674106; token=eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJVU0VSX0NFTlRFUiIsInN1YiI6IntcImlkXCI6MTA3NTEsXCJuYW1lXCI6XCLnvZflt51cIixcImVtYWlsXCI6XCJjaHVhbi5sdW9AZGF5dWFuMTk5Ny5jb21cIixcInBob25lXCI6XCIxODEqKioqNzIzOVwiLFwic3RhdHVzXCI6MSxcInR5cGVcIjoyLFwibG9naW5EYXRlXCI6XCIyMDI0LTAyLTE3IDEwOjE1OjQyXCIsXCJleHBpcmVEYXRlXCI6XCIyMDI0LTAzLTE4IDEwOjE1OjQyXCIsXCJkdXJhdGlvblwiOjI1OTIwMDB9IiwiYXVkIjoiTElMWV9wcm9kIiwiaWF0IjoxNzA4MTM2MTQyLCJleHAiOjE3MTA3MjgxNDJ9.QzpYTcJT1gQEvaGt26jxljfgaWusxH_ecL6gcUMSwDtEr-K4HxaytOB9iIwyJCRlGNL8WnC-21MVbfd13p5qYQ"; } diff --git a/src/main/java/org/alis/excel/service/TokenService.java b/src/main/java/org/alis/excel/service/TokenService.java deleted file mode 100644 index b88a16e..0000000 --- a/src/main/java/org/alis/excel/service/TokenService.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.alis.excel.service; - -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import cn.hutool.http.HttpRequest; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.stereotype.Service; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author lc - * @date 2023/5/14 10:19 - */ -//@Service -public class TokenService implements ApplicationRunner { - - - @Override - public void run(ApplicationArguments args) throws Exception { - try (InputStream resource = this.getClass().getClassLoader().getResourceAsStream("last.txt"); - BufferedReader reader = new BufferedReader(new InputStreamReader(resource))) { - long termId= 30011L; - DateTime startTime = DateUtil.parseDateTime("2023-09-01 00:00:00"); - DateTime endTime = DateUtil.parseDateTime("2023-12-03 23:59:59"); - reader.lines().forEach(r-> execution(r,termId,startTime,endTime)); - }catch (Exception e){ - e.printStackTrace(); - } - } - - private void execution(String className, Long termId, Date startTime, Date endTime) { - Map bodyMap = new HashMap<>(); - bodyMap.put("className", className); - bodyMap.put("termId", termId); - bodyMap.put("startTime", startTime.getTime()); - bodyMap.put("endTime", endTime.getTime()); - String body = HttpRequest.post("https://tom2.dayuan1997.com/api/classcore/comment/add") - .body(JSONUtil.toJsonStr(bodyMap)) - .cookie(getCookie()) - .execute().body(); - JSONObject jsonObject = JSONUtil.parseObj(body); - if (jsonObject.getInt("status").equals(0) && Boolean.TRUE.equals(jsonObject.getBool("data"))) { - System.out.println("战队执行完成:className" + className); - } else { - throw new UnsupportedOperationException("执行:" + className + "失败"); - } - - } - - - private String getCookie() { - return "source=12; user_id=10751; timestamp=1702261043685; token=eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJVU0VSX0NFTlRFUiIsInN1YiI6IntcImlkXCI6MTA3NTEsXCJuYW1lXCI6XCLnvZflt51cIixcImVtYWlsXCI6XCJjaHVhbi5sdW9AZGF5dWFuMTk5Ny5jb21cIixcInBob25lXCI6XCIxODEqKioqNzIzOVwiLFwic3RhdHVzXCI6MSxcInR5cGVcIjoyLFwibG9naW5EYXRlXCI6XCIyMDIzLTEyLTA5IDEwOjA3OjI2XCIsXCJleHBpcmVEYXRlXCI6XCIyMDI0LTAxLTA4IDEwOjA3OjI2XCIsXCJkdXJhdGlvblwiOjI1OTIwMDB9IiwiYXVkIjoiTElMWV9wcm9kIiwiaWF0IjoxNzAyMDg3NjQ2LCJleHAiOjE3MDQ2Nzk2NDZ9.8u8_hb3aPHXFrk1sRIvEQjcB6KFlvJhxGa0LkwR9Zdxz97HOdqRWtJissipxYHxn0IoAgQ5ZQhzzV75ZeFw4BA"; - } - - -} diff --git a/src/main/resources/user.txt b/src/main/resources/user.txt index 238ba3a..95876e3 100644 --- a/src/main/resources/user.txt +++ b/src/main/resources/user.txt @@ -1,111 +1 @@ -76057 -76060 -76071 -76072 -76075 -76079 -76081 -76082 -76086 -76087 -76114 -76115 -76117 -76119 -76123 -76129 -76130 -76131 -76133 -76134 -76138 -76143 -76161 -76163 -76165 -76167 -76173 -76186 -76187 -76197 -76209 -76210 -76223 -76224 -76250 -76254 -76255 -76256 -76259 -76260 -76262 -76264 -76266 -76269 -76270 -76351 -76369 -76371 -76372 -76373 -76374 -76375 -76376 -76377 -76378 -76379 -76380 -76381 -76386 -76387 -76392 -76393 -76394 -76395 -76396 -76397 -76399 -76421 -76422 -76423 -76424 -76425 -76430 -76434 -76436 -76463 -76466 -76470 -76471 -76473 -76475 -76476 -76480 -76482 -76487 -76489 -76492 -76493 -76494 -76495 -76496 -76497 -76500 -76502 -76503 -76507 -76510 -76511 -76523 -76746 -76749 -76752 -76753 -76757 -76770 -76931 -76934 -67886 -72336 -77377 -78063 \ No newline at end of file +86858 \ No newline at end of file