Commit 1a68a9beee6c768e19a06d6e7bdc4f4caf847c5b
Exists in
master
Merge remote-tracking branch 'origin/master'
Showing
1 changed file
with
38 additions
and
26 deletions
Show diff stats
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYReadService.java
@@ -5,12 +5,13 @@ import com.alibaba.fastjson.JSONObject; | @@ -5,12 +5,13 @@ import com.alibaba.fastjson.JSONObject; | ||
5 | import com.sincere.common.util.DateUtils; | 5 | import com.sincere.common.util.DateUtils; |
6 | import com.sincere.common.util.HttpClientUtils; | 6 | import com.sincere.common.util.HttpClientUtils; |
7 | import com.sincere.common.util.Xml2JsonUtils; | 7 | import com.sincere.common.util.Xml2JsonUtils; |
8 | -import com.sincere.quartz.feign.ScFeign; | ||
9 | import com.sincere.quartz.model.YxyAgency; | 8 | import com.sincere.quartz.model.YxyAgency; |
10 | import com.sincere.quartz.model.YxyStudent; | 9 | import com.sincere.quartz.model.YxyStudent; |
11 | import com.sincere.quartz.model.YxyTeacher; | 10 | import com.sincere.quartz.model.YxyTeacher; |
12 | import com.sincere.quartz.service.YxyService; | 11 | import com.sincere.quartz.service.YxyService; |
13 | import org.apache.commons.lang3.StringUtils; | 12 | import org.apache.commons.lang3.StringUtils; |
13 | +import org.slf4j.Logger; | ||
14 | +import org.slf4j.LoggerFactory; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
16 | 17 | ||
@@ -42,6 +43,8 @@ public class YXYReadService { | @@ -42,6 +43,8 @@ public class YXYReadService { | ||
42 | @Autowired | 43 | @Autowired |
43 | YxyService yxyService ; | 44 | YxyService yxyService ; |
44 | 45 | ||
46 | + private Logger logger = LoggerFactory.getLogger(YXYReadService.class); | ||
47 | + | ||
45 | public void sync(){ | 48 | public void sync(){ |
46 | List<String> areaCodeList = new ArrayList<>(); | 49 | List<String> areaCodeList = new ArrayList<>(); |
47 | areaCodeList.add("0571") ; | 50 | areaCodeList.add("0571") ; |
@@ -59,34 +62,41 @@ public class YXYReadService { | @@ -59,34 +62,41 @@ public class YXYReadService { | ||
59 | yxyService.updateStudent(); | 62 | yxyService.updateStudent(); |
60 | yxyService.updateTeacher(); | 63 | yxyService.updateTeacher(); |
61 | for(String areaCode : areaCodeList){ | 64 | for(String areaCode : areaCodeList){ |
62 | - // 先获取学校,部门,年级 班级 | ||
63 | - // 再根据学校 获取老师 学生 | ||
64 | - List list = new ArrayList(); | ||
65 | - list.add(SI); | ||
66 | - list.add(getPassword(SI_CODE)); | ||
67 | - list.add(areaCode); | ||
68 | - String wsdl =getAllDept ; | ||
69 | - String ns = nameSpace; | ||
70 | - String method = getALlDept_method; | ||
71 | - JSONArray jsonArray = getMessage(wsdl, ns, method, list); | ||
72 | - if(jsonArray != null){ | ||
73 | - List<String> schoolList = new ArrayList<>(); | ||
74 | - for(int i = 0 ; i < jsonArray.size() ; i++){ | ||
75 | - JSONObject object = (JSONObject) jsonArray.get(i) ; | ||
76 | - YxyAgency agency = new YxyAgency() ; | ||
77 | - agency.setDeptId(object.get("deptID").toString()); | ||
78 | - agency.setDeptName(object.get("deptName").toString()); | ||
79 | - agency.setSuperDeptId(object.get("superDeptID").toString()); | ||
80 | - if(areaCode.equals(object.get("superDeptID").toString())){ | ||
81 | - schoolList.add(object.get("deptID").toString()) ; | 65 | + try{ |
66 | + // 先获取学校,部门,年级 班级 | ||
67 | + // 再根据学校 获取老师 学生 | ||
68 | + List list = new ArrayList(); | ||
69 | + list.add(SI); | ||
70 | + list.add(getPassword(SI_CODE)); | ||
71 | + list.add(areaCode); | ||
72 | + String wsdl =getAllDept ; | ||
73 | + String ns = nameSpace; | ||
74 | + String method = getALlDept_method; | ||
75 | + JSONArray jsonArray = getMessage(wsdl, ns, method, list); | ||
76 | + if(jsonArray != null){ | ||
77 | + List<String> schoolList = new ArrayList<>(); | ||
78 | + for(int i = 0 ; i < jsonArray.size() ; i++){ | ||
79 | + logger.info("市编码:" + areaCode); | ||
80 | + JSONObject object = (JSONObject) jsonArray.get(i) ; | ||
81 | + YxyAgency agency = new YxyAgency() ; | ||
82 | + agency.setDeptId(object.get("deptID").toString()); | ||
83 | + agency.setDeptName(object.get("deptName").toString()); | ||
84 | + agency.setSuperDeptId(object.get("superDeptID").toString()); | ||
85 | + if(areaCode.equals(object.get("superDeptID").toString())){ | ||
86 | + logger.info("学校:" + object.get("deptName").toString()); | ||
87 | + schoolList.add(object.get("deptID").toString()) ; | ||
88 | + } | ||
89 | + yxyService.insertAgency(agency); | ||
90 | + } | ||
91 | + for(String schoolId : schoolList){ | ||
92 | + syncTeacher(schoolId) ; | ||
93 | + syncStudent(schoolId) ; | ||
82 | } | 94 | } |
83 | - yxyService.insertAgency(agency); | ||
84 | - } | ||
85 | - for(String schoolId : schoolList){ | ||
86 | - syncTeacher(schoolId) ; | ||
87 | - syncStudent(schoolId) ; | ||
88 | } | 95 | } |
96 | + }catch (Exception e){ | ||
97 | + e.printStackTrace(); | ||
89 | } | 98 | } |
99 | + | ||
90 | } | 100 | } |
91 | } | 101 | } |
92 | 102 | ||
@@ -100,6 +110,7 @@ public class YXYReadService { | @@ -100,6 +110,7 @@ public class YXYReadService { | ||
100 | String ns = nameSpace; | 110 | String ns = nameSpace; |
101 | String method = getALlStudent_method; | 111 | String method = getALlStudent_method; |
102 | JSONArray jsonArray = getMessage(wsdl, ns, method, list); | 112 | JSONArray jsonArray = getMessage(wsdl, ns, method, list); |
113 | + logger.info("学校ID为:"+schoolId + "共有学生" + jsonArray.size() +"人"); | ||
103 | if(jsonArray != null){ | 114 | if(jsonArray != null){ |
104 | for(int i = 0 ; i < jsonArray.size() ; i++){ | 115 | for(int i = 0 ; i < jsonArray.size() ; i++){ |
105 | JSONObject object = (JSONObject) jsonArray.get(i) ; | 116 | JSONObject object = (JSONObject) jsonArray.get(i) ; |
@@ -122,6 +133,7 @@ public class YXYReadService { | @@ -122,6 +133,7 @@ public class YXYReadService { | ||
122 | String ns = nameSpace; | 133 | String ns = nameSpace; |
123 | String method = getAllTeacher_method; | 134 | String method = getAllTeacher_method; |
124 | JSONArray jsonArray = getMessage(wsdl, ns, method, list); | 135 | JSONArray jsonArray = getMessage(wsdl, ns, method, list); |
136 | + logger.info("学校ID为:"+schoolId + "共有老师" + jsonArray.size() +"人"); | ||
125 | if(jsonArray != null){ | 137 | if(jsonArray != null){ |
126 | for(int i = 0 ; i < jsonArray.size() ; i++){ | 138 | for(int i = 0 ; i < jsonArray.size() ; i++){ |
127 | JSONObject object = (JSONObject) jsonArray.get(i) ; | 139 | JSONObject object = (JSONObject) jsonArray.get(i) ; |