|
@@ -62,6 +62,8 @@ public class YouZy {
|
|
|
public void getUniversityList() {
|
|
|
//64 9 学校 10221, 香港树仁大学
|
|
|
//91 11 学校 11831, 邯郸幼儿师范高等专科学校
|
|
|
+ //12页2
|
|
|
+ //开始第17页
|
|
|
int count = 0, total = 5000, pageIndex = 1, pageSize=20;
|
|
|
|
|
|
do {
|
|
@@ -92,7 +94,14 @@ public class YouZy {
|
|
|
/**
|
|
|
* 招生简单
|
|
|
*/
|
|
|
- enrollDetail(universityCode);
|
|
|
+// enrollDetail(universityCode);
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 院系设置
|
|
|
+ */
|
|
|
+ getDepartment(universityCode);
|
|
|
+
|
|
|
|
|
|
ThreadUtil.safeSleep(1 * 1000);
|
|
|
log.error("{} 学校 {}, {}, 耗时{}",i+1,universityCode,rowUniversity.getString("cnName"), DateUtil.formatBetween(System.currentTimeMillis() - start));
|
|
@@ -235,6 +244,152 @@ public class YouZy {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //特色专业
|
|
|
+ private void getProfession(String collegeCode){
|
|
|
+ String requestPath = "/youzy.dms.basiclib.api.college.profession.bycollege.get";
|
|
|
+ Map paramMap =new HashMap<>();
|
|
|
+ paramMap.put("collegeCode",collegeCode);
|
|
|
+ String res = getRes(requestPath,paramMap,"");
|
|
|
+ if (StringUtils.isEmpty(res)) {
|
|
|
+ log.error("res is empty");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ JSONObject resultJsonobject = JSONObject.parseObject(res);
|
|
|
+ if (resultJsonobject.getBoolean("isSuccess")) {
|
|
|
+ JSONObject result = resultJsonobject.getJSONObject("result");
|
|
|
+ JSONArray insert = new JSONArray();
|
|
|
+ JSONArray countries = result.getJSONArray("countries");
|
|
|
+ JSONArray provinces = result.getJSONArray("provinces");
|
|
|
+ Date now =new Date();
|
|
|
+
|
|
|
+ countries.forEach(cc->{
|
|
|
+ JSONObject row= (JSONObject) cc;
|
|
|
+ row.put("collegeCode",collegeCode);
|
|
|
+ row.put("id",UUID.randomUUID());
|
|
|
+ row.put("update_time",now);
|
|
|
+ insert.add(row);
|
|
|
+ });
|
|
|
+ provinces.forEach(cc->{
|
|
|
+ JSONObject row= (JSONObject) cc;
|
|
|
+ row.put("collegeCode",collegeCode);
|
|
|
+ row.put("id",UUID.randomUUID());
|
|
|
+ row.put("update_time",now);
|
|
|
+ insert.add(row);
|
|
|
+ });
|
|
|
+ //插入表数据
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //重点学科、双一流学科
|
|
|
+ private void getSubjectgroup(String collegeCode){
|
|
|
+ String requestPath = "youzy.dms.basiclib.api.college.subjectgroup.query";
|
|
|
+ Map paramMap =new HashMap<>();
|
|
|
+ paramMap.put("collegeCode",collegeCode);
|
|
|
+ String res = getRes(requestPath,paramMap,"");
|
|
|
+ if (StringUtils.isEmpty(res)) {
|
|
|
+ log.error("res is empty");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ JSONObject resultJsonobject = JSONObject.parseObject(res);
|
|
|
+ if (resultJsonobject.getBoolean("isSuccess")) {
|
|
|
+ JSONObject result = resultJsonobject.getJSONObject("result");
|
|
|
+ JSONArray insert = new JSONArray();
|
|
|
+ //重点学科
|
|
|
+ JSONArray keySubjects = result.getJSONArray("keySubjects");
|
|
|
+ //双一流学科
|
|
|
+ JSONArray sylSubjectsGroup = result.getJSONArray("sylSubjectsGroup");
|
|
|
+ Date now =new Date();
|
|
|
+
|
|
|
+ keySubjects.forEach(cc->{
|
|
|
+ JSONObject row= (JSONObject) cc;
|
|
|
+ row.put("collegeCode",collegeCode);
|
|
|
+ row.put("id",UUID.randomUUID());
|
|
|
+ row.put("dataType","重点学科");
|
|
|
+ row.put("update_time",now);
|
|
|
+ insert.add(row);
|
|
|
+ });
|
|
|
+ sylSubjectsGroup.forEach(cc->{
|
|
|
+ JSONObject row= (JSONObject) cc;
|
|
|
+ row.put("collegeCode",collegeCode);
|
|
|
+ row.put("id",UUID.randomUUID());
|
|
|
+ row.put("dataType","双一流学科");
|
|
|
+ row.put("update_time",now);
|
|
|
+ insert.add(row);
|
|
|
+ });
|
|
|
+ //插入表数据
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //院系设置
|
|
|
+ private void getDepartment(String collegeCode){
|
|
|
+ String requestPath = "/youzy.dms.basiclib.api.college.department.bycollege.get";
|
|
|
+ Map paramMap =new HashMap<>();
|
|
|
+ paramMap.put("collegeCode",collegeCode);
|
|
|
+ String res = getRes(requestPath,paramMap,"");
|
|
|
+ if (StringUtils.isEmpty(res)) {
|
|
|
+ log.error("res is empty");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ JSONObject resultJsonobject = JSONObject.parseObject(res);
|
|
|
+ if (resultJsonobject.getBoolean("isSuccess")) {
|
|
|
+ JSONArray result = resultJsonobject.getJSONArray("result");
|
|
|
+ Date now =new Date();
|
|
|
+
|
|
|
+ for (Object cc : result) {
|
|
|
+ //院系
|
|
|
+ JSONObject row = (JSONObject) cc;
|
|
|
+ row.put("update_time", now);
|
|
|
+ //院系专业
|
|
|
+ JSONArray departmentMajors = row.getJSONArray("departmentMajors");
|
|
|
+ if(departmentMajors.size()==0){
|
|
|
+ row.put("departmentId",collegeCode+row.getString("name"));
|
|
|
+ }
|
|
|
+ for (Object dd : departmentMajors) {
|
|
|
+ //院系专业
|
|
|
+ JSONObject major = (JSONObject) dd;
|
|
|
+
|
|
|
+ if(!row.containsKey("departmentId")){
|
|
|
+ String departmentId = major.getString("departmentId");
|
|
|
+ if(StringUtils.isNotEmpty(departmentId)){
|
|
|
+ row.put("departmentId",departmentId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ major.put("update_time", now);
|
|
|
+ major.put("collegeCode", collegeCode);
|
|
|
+
|
|
|
+ //存储院系专业
|
|
|
+ Entity majorTable = Entity.create("sy_university_department_major");
|
|
|
+ majorTable.putAll(major);
|
|
|
+ try {
|
|
|
+ DbUtil.use().insertOrUpdate(majorTable, "id");
|
|
|
+ } catch (SQLException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //存储院系
|
|
|
+ row.remove("departmentMajors");
|
|
|
+ Entity departmentTable = Entity.create("sy_university_department");
|
|
|
+ departmentTable.putAll(row);
|
|
|
+ try {
|
|
|
+ DbUtil.use().insertOrUpdate(departmentTable, "departmentId");
|
|
|
+ } catch (SQLException e) {
|
|
|
+ log.error(JSONObject.toJSONString(resultJsonobject));
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|