|
@@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.miaxis.ZzjsApplication;
|
|
|
import com.miaxis.feign.service.IYdtService;
|
|
|
-import com.miaxis.question.domain.QuestionInfoTwo;
|
|
|
-import com.miaxis.question.service.IQuestionInfoTwoService;
|
|
|
+import com.miaxis.question.domain.QuestionInfoGet;
|
|
|
+import com.miaxis.question.service.IQuestionInfoGetService;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -21,7 +21,7 @@ public class YdtTest {
|
|
|
private IYdtService ydtService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IQuestionInfoTwoService questionInfoTwoService;
|
|
|
+ private IQuestionInfoGetService questionInfoGetService;
|
|
|
|
|
|
/**
|
|
|
* 获取一点通题库
|
|
@@ -29,7 +29,7 @@ public class YdtTest {
|
|
|
@Test
|
|
|
public void getInfo(){
|
|
|
Long kemu = 1l;
|
|
|
- String cartype = "3";
|
|
|
+ String cartype = "3"; //0:小车(313) 1:货车(325) 2:客车(328) 3:摩托车(40)
|
|
|
|
|
|
String result = ydtService.getInfo(kemu,cartype);
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
@@ -42,43 +42,45 @@ public class YdtTest {
|
|
|
String name = json1.getString("name");
|
|
|
String rightAnswer = json1.getString("rightAnswer");
|
|
|
String image = json1.getString("image");
|
|
|
+ if("".equals(image)){
|
|
|
+ image = null;
|
|
|
+ }
|
|
|
String explain = json1.getString("explain");
|
|
|
String type = json1.getString("type");
|
|
|
|
|
|
|
|
|
JSONArray option = json1.getJSONArray("option");
|
|
|
- QuestionInfoTwo questionInfoTwo = new QuestionInfoTwo();
|
|
|
+ QuestionInfoGet questionInfoGet = new QuestionInfoGet();
|
|
|
for (int j = 0; j <option.size() ; j++) {
|
|
|
JSONObject json2 = (JSONObject)option.get(j);
|
|
|
String oid = json2.getString("id");
|
|
|
String oname = json2.getString("name");
|
|
|
if("A".equals(oid)) {
|
|
|
- questionInfoTwo.setAn1(oname);
|
|
|
+ questionInfoGet.setAn1(oname);
|
|
|
} else if ("B".equals(oid)) {
|
|
|
- questionInfoTwo.setAn2(oname);
|
|
|
+ questionInfoGet.setAn2(oname);
|
|
|
} else if ("C".equals(oid)) {
|
|
|
- questionInfoTwo.setAn3(oname);
|
|
|
+ questionInfoGet.setAn3(oname);
|
|
|
} else if ("D".equals(oid)) {
|
|
|
- questionInfoTwo.setAn4(oname);
|
|
|
+ questionInfoGet.setAn4(oname);
|
|
|
} else if ("E".equals(oid)) {
|
|
|
- questionInfoTwo.setAn5(oname);
|
|
|
+ questionInfoGet.setAn5(oname);
|
|
|
} else if ("F".equals(oid)) {
|
|
|
- questionInfoTwo.setAn6(oname);
|
|
|
+ questionInfoGet.setAn6(oname);
|
|
|
} else if ("G".equals(oid)) {
|
|
|
- questionInfoTwo.setAn7(oname);
|
|
|
+ questionInfoGet.setAn7(oname);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- questionInfoTwo.setNum(Long.parseLong(id));
|
|
|
- questionInfoTwo.setName(name);
|
|
|
- questionInfoTwo.setImage(image);
|
|
|
- questionInfoTwo.setRightAnswer(Long.parseLong(rightAnswer));
|
|
|
- questionInfoTwo.setExplainJs(explain);
|
|
|
- questionInfoTwo.setKemu(kemu);
|
|
|
- questionInfoTwo.setCartype(cartype);
|
|
|
- questionInfoTwo.setType(Long.parseLong(type));
|
|
|
- System.out.println(questionInfoTwo);
|
|
|
- questionInfoTwoService.save(questionInfoTwo);
|
|
|
+ questionInfoGet.setNum(Long.parseLong(id));
|
|
|
+ questionInfoGet.setName(name);
|
|
|
+ questionInfoGet.setImage(image);
|
|
|
+ questionInfoGet.setRightAnswer(Long.parseLong(rightAnswer));
|
|
|
+ questionInfoGet.setExplainJs(explain);
|
|
|
+ questionInfoGet.setKemu(kemu);
|
|
|
+ questionInfoGet.setCartype(cartype);
|
|
|
+ questionInfoGet.setType(Long.parseLong(type));
|
|
|
+ questionInfoGetService.save(questionInfoGet);
|
|
|
|
|
|
}
|
|
|
|