|
@@ -557,6 +557,113 @@ public class KtTest3 {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 三力测试抓取
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void getSanliQuestion() {
|
|
|
+ String model = "cart";
|
|
|
+ String countid = "4000";
|
|
|
+ String columnZh = "三力测试";
|
|
|
+ String subject = "sanli";
|
|
|
+ String time = String.valueOf(System.currentTimeMillis() / 1000);
|
|
|
+
|
|
|
+ String result2 = ktService.getQuestion(model, countid, columnZh, subject, time);
|
|
|
+ JSONObject json2 = JSONObject.parseObject(result2);
|
|
|
+ JSONArray data2 = json2.getJSONArray("data");
|
|
|
+ List<QuestionInfoKtNew> addList = new ArrayList<QuestionInfoKtNew>();
|
|
|
+ List<QuestionInfoKtNew> upList = new ArrayList<QuestionInfoKtNew>();
|
|
|
+
|
|
|
+ for (int j = 0; j < data2.size(); j++) {
|
|
|
+ JSONObject n2 = (JSONObject) data2.get(j);
|
|
|
+ String id2 = n2.getString("id"); //快通ID
|
|
|
+ String idYdt = n2.getString("idYdt"); //一点通ID
|
|
|
+ String number = n2.getString("number"); //一点通ID
|
|
|
+ String type = n2.getString("type"); // 1:判断题 2:选择题 3:多选题
|
|
|
+ String answer = n2.getString("answer"); //答案
|
|
|
+ String answerkeyword = n2.getString("answerkeyword");//答案关键词
|
|
|
+ String explainGif = n2.getString("explainGif"); //技巧讲解图片URL
|
|
|
+ String explainJq = n2.getString("explainJq"); //技巧讲解说明
|
|
|
+ String explainJs = n2.getString("explainJs"); //官方解释
|
|
|
+ String explainMp3 = n2.getString("explainMp3"); //技巧讲解语音URL
|
|
|
+ String image = n2.getString("image"); //题目图片URL
|
|
|
+ String imageYdt = n2.getString("imageYdt"); //题目图片URL2
|
|
|
+ String issue = n2.getString("issue"); //题目
|
|
|
+ String model2 = n2.getString("model"); //车型
|
|
|
+ String columnAll = n2.getString("columnAll"); //车型
|
|
|
+ String opts = n2.getString("opts"); //答案选项
|
|
|
+ String skillkeyword = n2.getString("skillkeyword"); //答题技巧关键词
|
|
|
+
|
|
|
+ String subject2 = n2.getString("subject"); // 科目与分类
|
|
|
+
|
|
|
+ String titlekeyword = n2.getString("titlekeyword"); // 题目关键词
|
|
|
+ String issuemp3 = n2.getString("issuemp3"); //读题语音URL
|
|
|
+ String answermp3 = n2.getString("answermp3"); //答案语音URL
|
|
|
+ String explainjsmp3 = n2.getString("explainjsmp3"); //读题+答案语音URL
|
|
|
+
|
|
|
+ //查询当前是否数据是否存在
|
|
|
+ QuestionInfoKtNew questionInfoKtNewQuery = new QuestionInfoKtNew();
|
|
|
+ questionInfoKtNewQuery.setId(Long.parseLong(id2));
|
|
|
+ int count = questionInfoKtNewService.selectQuestionInfoKtNewCount(questionInfoKtNewQuery);
|
|
|
+ if (count == 0) {
|
|
|
+ QuestionInfoKtNew questionInfoKtNew = new QuestionInfoKtNew();
|
|
|
+ questionInfoKtNew.setId(Long.parseLong(id2));
|
|
|
+ questionInfoKtNew.setIdYdt(idYdt == null ? null : Long.parseLong(idYdt));
|
|
|
+ questionInfoKtNew.setNumber(number == null ? null : Long.parseLong(number));
|
|
|
+ questionInfoKtNew.setQuestionType(type == null ? null : Long.parseLong(type));
|
|
|
+ questionInfoKtNew.setAnswer(answer);
|
|
|
+ questionInfoKtNew.setAnswerkeyword(answerkeyword);
|
|
|
+ questionInfoKtNew.setExplainGif(explainGif);
|
|
|
+ questionInfoKtNew.setExplainJq(explainJq);
|
|
|
+ questionInfoKtNew.setExplainJs(explainJs);
|
|
|
+ questionInfoKtNew.setExplainMp3(explainMp3);
|
|
|
+ questionInfoKtNew.setImage(image);
|
|
|
+ questionInfoKtNew.setImageYdt(imageYdt);
|
|
|
+ questionInfoKtNew.setIssue(issue);
|
|
|
+ questionInfoKtNew.setOpts(opts);
|
|
|
+ questionInfoKtNew.setSkillkeyword(skillkeyword);
|
|
|
+ questionInfoKtNew.setTitlekeyword(titlekeyword);
|
|
|
+ questionInfoKtNew.setIssuemp3(issuemp3);
|
|
|
+ questionInfoKtNew.setAnswermp3(answermp3);
|
|
|
+ questionInfoKtNew.setExplainjsmp3(explainjsmp3);
|
|
|
+
|
|
|
+ questionInfoKtNew.setModel(model2);
|
|
|
+ questionInfoKtNew.setSubject(subject2);
|
|
|
+ questionInfoKtNew.setColumnAll(columnAll);
|
|
|
+
|
|
|
+ addList.add(questionInfoKtNew);
|
|
|
+ } else {
|
|
|
+ QuestionInfoKtNew questionInfoKtNew = new QuestionInfoKtNew();
|
|
|
+ questionInfoKtNew.setId(Long.parseLong(id2));
|
|
|
+ questionInfoKtNew.setIdYdt(idYdt == null ? null : Long.parseLong(idYdt));
|
|
|
+ questionInfoKtNew.setNumber(number == null ? null : Long.parseLong(number));
|
|
|
+ questionInfoKtNew.setQuestionType(type == null ? null : Long.parseLong(type));
|
|
|
+ questionInfoKtNew.setAnswer(answer);
|
|
|
+ questionInfoKtNew.setAnswerkeyword(answerkeyword);
|
|
|
+ questionInfoKtNew.setExplainGif(explainGif);
|
|
|
+ questionInfoKtNew.setExplainJq(explainJq);
|
|
|
+ questionInfoKtNew.setExplainJs(explainJs);
|
|
|
+ questionInfoKtNew.setExplainMp3(explainMp3);
|
|
|
+ questionInfoKtNew.setImage(image);
|
|
|
+ questionInfoKtNew.setImageYdt(imageYdt);
|
|
|
+ questionInfoKtNew.setIssue(issue);
|
|
|
+ questionInfoKtNew.setOpts(opts);
|
|
|
+ questionInfoKtNew.setSkillkeyword(skillkeyword);
|
|
|
+ questionInfoKtNew.setTitlekeyword(titlekeyword);
|
|
|
+ questionInfoKtNew.setIssuemp3(issuemp3);
|
|
|
+ questionInfoKtNew.setAnswermp3(answermp3);
|
|
|
+ questionInfoKtNew.setExplainjsmp3(explainjsmp3);
|
|
|
+
|
|
|
+ questionInfoKtNew.setModel(model2);
|
|
|
+ questionInfoKtNew.setSubject(subject2);
|
|
|
+ questionInfoKtNew.setColumnAll(columnAll);
|
|
|
+ upList.add(questionInfoKtNew);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ questionInfoKtNewService.saveBatch(addList);
|
|
|
+ questionInfoKtNewService.updateBatchById(upList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|