Commit d847e88693dbd0cb8d81f1885355f1d39f557e2e

Authored by 陈杰
1 parent 5781141d
Exists in master

翼学云通讯录同步

@@ -21,20 +21,17 @@ @@ -21,20 +21,17 @@
21 <module>common</module> 21 <module>common</module>
22 <!-- <module>geteway</module>--> 22 <!-- <module>geteway</module>-->
23 <module>haikang</module> 23 <module>haikang</module>
24 - <module>dahua</module> 24 +<!-- <module>dahua</module>-->
25 <!-- <module>consumer</module>--> 25 <!-- <module>consumer</module>-->
26 - <module>haikangface</module>  
27 - <!--<module>search_independence</module>--> 26 +<!-- <module>haikangface</module>-->
  27 +<!-- <module>search_independence</module>-->
28 <module>search_smartCampus</module> 28 <module>search_smartCampus</module>
29 <module>search_xiaoan</module> 29 <module>search_xiaoan</module>
30 - <module>mypulsar</module>  
31 - <!--<module>weigeng</module>-->  
32 - <!--<module>independence</module>-->  
33 -<!-- <module>test</module>-->  
34 - <!--<module>weigeng</module>-->  
35 - <!--<module>independence</module>-->  
36 - <!--<module>quartz</module>-->  
37 - <!-- <module>test</module>--> 30 +<!-- <module>mypulsar</module>-->
  31 +<!-- <module>weigeng</module>-->
  32 +<!-- <module>independence</module>-->
  33 + <module>quartz</module>
  34 + <module>zkAttendance</module>
38 </modules> 35 </modules>
39 36
40 <properties> 37 <properties>
@@ -84,5 +81,4 @@ @@ -84,5 +81,4 @@
84 </dependency> 81 </dependency>
85 </dependencies> 82 </dependencies>
86 </dependencyManagement> 83 </dependencyManagement>
87 -  
88 </project> 84 </project>
cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java
@@ -51,9 +51,6 @@ public interface ScFeign { @@ -51,9 +51,6 @@ public interface ScFeign {
51 @RequestMapping(value = "sm/sync/selectSyncSchool",method = RequestMethod.GET) 51 @RequestMapping(value = "sm/sync/selectSyncSchool",method = RequestMethod.GET)
52 List<SyncSchoolDto> selectSyncSchool(); 52 List<SyncSchoolDto> selectSyncSchool();
53 53
54 - @RequestMapping(value = "sm/sync/selectGroup",method = RequestMethod.GET)  
55 - List<GroupDto> selectGroup(@RequestParam("schoolId") int schoolId);  
56 -  
57 @RequestMapping(value = "sm/sync/selectSubject",method = RequestMethod.GET) 54 @RequestMapping(value = "sm/sync/selectSubject",method = RequestMethod.GET)
58 List<String> selectSubject(@RequestParam("schoolId") int schoolId); 55 List<String> selectSubject(@RequestParam("schoolId") int schoolId);
59 56
cloud/quartz/src/main/java/com/sincere/quartz/job/BindPushJob.java
@@ -22,7 +22,7 @@ import java.util.*; @@ -22,7 +22,7 @@ import java.util.*;
22 * @version 1.0 22 * @version 1.0
23 * @date 2019/12/10 0010 8:31 23 * @date 2019/12/10 0010 8:31
24 */ 24 */
25 -//@Service 25 +@Service
26 public class BindPushJob { 26 public class BindPushJob {
27 27
28 private Logger logger = LoggerFactory.getLogger(KQJob.class); 28 private Logger logger = LoggerFactory.getLogger(KQJob.class);
cloud/quartz/src/main/java/com/sincere/quartz/job/KQJob.java
@@ -28,7 +28,7 @@ import java.util.*; @@ -28,7 +28,7 @@ import java.util.*;
28 * @version 1.0 28 * @version 1.0
29 * @date 2019/11/27 0027 17:05 29 * @date 2019/11/27 0027 17:05
30 */ 30 */
31 -//@Service 31 +@Service
32 public class KQJob { 32 public class KQJob {
33 33
34 private Logger logger = LoggerFactory.getLogger(KQJob.class); 34 private Logger logger = LoggerFactory.getLogger(KQJob.class);
cloud/quartz/src/main/java/com/sincere/quartz/job/SyncJob.java
@@ -20,11 +20,11 @@ public class SyncJob { @@ -20,11 +20,11 @@ public class SyncJob {
20 @Autowired 20 @Autowired
21 YXYReadService yxyReadService ; 21 YXYReadService yxyReadService ;
22 22
23 - @Scheduled(cron = "0/1 * * * * ? ") 23 + @Scheduled(cron = "0 1-59 * * * ? ")
24 //@Scheduled(cron = "0 0 23 * * ? ") 24 //@Scheduled(cron = "0 0 23 * * ? ")
25 public void Sync(){ 25 public void Sync(){
26 //翼校通的同步 之后还有钉钉的同步等等 26 //翼校通的同步 之后还有钉钉的同步等等
27 yxyWriteService.sync(); 27 yxyWriteService.sync();
28 - //yxyReadService.sync(); 28 + yxyReadService.sync();
29 } 29 }
30 } 30 }
cloud/quartz/src/main/java/com/sincere/quartz/third/ding/DingUtils.java 0 → 100644
@@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
  1 +//package com.sincere.quartz.third.ding;
  2 +//
  3 +//import com.dingtalk.api.DefaultDingTalkClient;
  4 +//import com.dingtalk.api.DingTalkClient;
  5 +//import com.dingtalk.api.request.OapiDepartmentListRequest;
  6 +//import com.dingtalk.api.request.OapiEduTeacherGetRequest;
  7 +//import com.dingtalk.api.request.OapiServiceGetCorpTokenRequest;
  8 +//import com.dingtalk.api.request.OapiUserSimplelistRequest;
  9 +//import com.dingtalk.api.response.OapiDepartmentListResponse;
  10 +//import com.dingtalk.api.response.OapiServiceGetCorpTokenResponse;
  11 +//import com.dingtalk.api.response.OapiUserSimplelistResponse;
  12 +//import com.taobao.api.ApiException;
  13 +//
  14 +///**
  15 +// * 钉钉 数据同步接口
  16 +// * @author chen
  17 +// * @version 1.0
  18 +// * @date 2019/12/11 0011 9:17
  19 +// */
  20 +//public class DingUtils {
  21 +//
  22 +// public static void main(String[] args){
  23 +// //System.out.println(getToken("ding5b3f718a90027ec4","suitea4oyazedqfxn60fh", "i6mJCpaWOo-N1ibqExCwvwOJF9mW81Yoc0tc2YCGzehfUO2vyI9tocM9kNR4KBIU"));
  24 +// getDept("63424a88ee8f3e118e11ede370746bf5");
  25 +// }
  26 +//
  27 +// private static String getToken(String corpId , String key , String secret){
  28 +// try{
  29 +// DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/service/get_corp_token");
  30 +// OapiServiceGetCorpTokenRequest req = new OapiServiceGetCorpTokenRequest();
  31 +// req.setAuthCorpid(corpId);
  32 +// OapiServiceGetCorpTokenResponse execute = client.execute(req,key,secret, "suiteTicket");
  33 +// return execute.getAccessToken();
  34 +// }catch (ApiException e){
  35 +//
  36 +// }
  37 +// return null ;
  38 +// }
  39 +//
  40 +// private static void getDept(String accessToken){
  41 +// try{
  42 +// DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/department/list");
  43 +// OapiDepartmentListRequest request = new OapiDepartmentListRequest();
  44 +// request.setId("1");
  45 +// request.setHttpMethod("GET");
  46 +// OapiDepartmentListResponse response = client.execute(request, accessToken);
  47 +// System.out.println("1");
  48 +// }catch (ApiException e){
  49 +//
  50 +// }
  51 +//
  52 +// }
  53 +//
  54 +// private static void getUser(String accessToken , Long deptId){
  55 +// try{
  56 +// DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/simplelist");
  57 +// OapiUserSimplelistRequest request = new OapiUserSimplelistRequest();
  58 +// request.setDepartmentId(deptId);
  59 +// request.setHttpMethod("GET");
  60 +// OapiUserSimplelistResponse response = client.execute(request, accessToken);
  61 +// }catch (ApiException e){
  62 +//
  63 +// }
  64 +//
  65 +// }
  66 +//
  67 +//}
cloud/quartz/src/main/java/com/sincere/quartz/third/qiyehao/QYHUtils.java 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +package com.sincere.quartz.third.qiyehao;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sincere.common.util.HttpClientUtils;
  5 +
  6 +/**
  7 + * @author chen
  8 + * @version 1.0
  9 + * @date 2019/12/11 0011 15:28
  10 + */
  11 +public class QYHUtils {
  12 +
  13 + public static void main(String[] args){
  14 + getToken("wx51b3acc9a06f0bb0","pb5P1feSHnWYYLPAfN4QBMk-nPFaF4RGW5Lq1ceyfhk");
  15 + }
  16 +
  17 + public static String getToken(String id , String secret){
  18 + String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+id+"&corpsecret="+secret ;
  19 + JSONObject json = HttpClientUtils.httpGet(url) ;
  20 + return json.get("access_token").toString() ;
  21 + }
  22 +
  23 + public static void getDept(String accessToken){
  24 + String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token="+accessToken;
  25 + JSONObject json = HttpClientUtils.httpGet(url) ;
  26 + }
  27 +
  28 + public static void getUser(String accessToken){
  29 + String url = "https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+accessToken+"&department_id="+1+"&fetch_child=1&status=0";
  30 + JSONObject json = HttpClientUtils.httpGet(url) ;
  31 + }
  32 +}
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYReadService.java
@@ -44,9 +44,9 @@ public class YXYReadService { @@ -44,9 +44,9 @@ public class YXYReadService {
44 list.add(SI); 44 list.add(SI);
45 list.add(getPassword(SI_CODE)); 45 list.add(getPassword(SI_CODE));
46 list.add("05750400"); 46 list.add("05750400");
47 - String wsdl =getAllDept ; 47 + String wsdl =getAllStudent ;
48 String ns = nameSpace; 48 String ns = nameSpace;
49 - String method = getALlDept_method; 49 + String method = getALlStudent_method;
50 JSONArray jsonArray = getMessage(wsdl, ns, method, list); 50 JSONArray jsonArray = getMessage(wsdl, ns, method, list);
51 System.out.println(jsonArray.toJSONString()); 51 System.out.println(jsonArray.toJSONString());
52 } 52 }
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYWriteService.java
@@ -70,7 +70,7 @@ public class YXYWriteService { @@ -70,7 +70,7 @@ public class YXYWriteService {
70 List<SyncUserDto> deleteTeacherList = new ArrayList<>(); 70 List<SyncUserDto> deleteTeacherList = new ArrayList<>();
71 71
72 for(SyncUserDto user : userList){ 72 for(SyncUserDto user : userList){
73 - if(user.getUserType() == 1){ //老师 73 + if(user.getUserType() == 2){ //学生
74 if(user.getUpdateType() == 1){ 74 if(user.getUpdateType() == 1){
75 addStudentList.add(user); 75 addStudentList.add(user);
76 }else if(user.getUpdateType() == 3){ 76 }else if(user.getUpdateType() == 3){
@@ -78,7 +78,7 @@ public class YXYWriteService { @@ -78,7 +78,7 @@ public class YXYWriteService {
78 }else if(user.getUpdateType() == 5){ 78 }else if(user.getUpdateType() == 5){
79 deleteStudentList.add(user); 79 deleteStudentList.add(user);
80 } 80 }
81 - }else if(user.getUserType() == 2){ //学生 81 + }else if(user.getUserType() == 1){ //老师
82 if(user.getUpdateType() == 1){ 82 if(user.getUpdateType() == 1){
83 addTeacherList.add(user); 83 addTeacherList.add(user);
84 }else if(user.getUpdateType() == 3){ 84 }else if(user.getUpdateType() == 3){
@@ -219,7 +219,7 @@ public class YXYWriteService { @@ -219,7 +219,7 @@ public class YXYWriteService {
219 }else { 219 }else {
220 System.out.println(result.getMessage()); 220 System.out.println(result.getMessage());
221 } 221 }
222 - for(SyncDeptDto deptDto : updateDept){ 222 + for(SyncDeptDto deptDto : deleteDept){
223 if(!errorList.contains(deptDto.getDeptName())){ 223 if(!errorList.contains(deptDto.getDeptName())){
224 DeptRelationDto deptRelationDto = new DeptRelationDto(); 224 DeptRelationDto deptRelationDto = new DeptRelationDto();
225 deptRelationDto.setHxyDeptId(deptDto.getDeptId()); 225 deptRelationDto.setHxyDeptId(deptDto.getDeptId());
@@ -391,84 +391,20 @@ public class YXYWriteService { @@ -391,84 +391,20 @@ public class YXYWriteService {
391 } 391 }
392 } 392 }
393 393
394 -  
395 - private JSONArray initAddJson(List<SyncUserDto> list){  
396 - JSONArray array = new JSONArray();  
397 - for(SyncUserDto user : list){  
398 - JSONObject object = new JSONObject();  
399 - object.put("classid",scFeign.selectYxyIdByHxyId(user.getClassId()));  
400 - object.put("stuname",user.getName());  
401 - object.put("mobile",user.getMobile());  
402 - object.put("sex",user.getSex());  
403 - array.add(object);  
404 - }  
405 - return array ;  
406 - }  
407 -  
408 - private JSONArray initTeacherAddJson(SyncSchoolDto school , List<SyncUserDto> list){  
409 - JSONArray array = new JSONArray();  
410 - for(SyncUserDto user : list){  
411 - JSONObject object = new JSONObject();  
412 - object.put("schoolid",school.getYxtId());  
413 - object.put("name",user.getName());  
414 - object.put("mobile",user.getMobile());  
415 - object.put("sex",user.getSex());  
416 - array.add(object);  
417 - }  
418 - return array ;  
419 - }  
420 -  
421 - private JSONArray initTeacherUpdateJson(SyncSchoolDto school , List<SyncUserDto> list){  
422 - JSONArray array = new JSONArray();  
423 - for(SyncUserDto user : list){  
424 - JSONObject object = new JSONObject();  
425 - object.put("schoolid",school.getYxtId());  
426 - object.put("name",user.getName());  
427 - object.put("mobile",user.getMobile());  
428 - object.put("sex",user.getSex());  
429 - array.add(object);  
430 - }  
431 - return array ;  
432 - }  
433 -  
434 - private JSONArray initUserUpdateJson(List<SyncUserDto> list){  
435 - JSONArray array = new JSONArray();  
436 - for(SyncUserDto user : list){  
437 - JSONObject object = new JSONObject();  
438 - object.put("userid",user.getHxyCustomerId());  
439 - object.put("classid",scFeign.selectYxyIdByHxyId(user.getClassId()));  
440 - object.put("stuname",user.getName());  
441 - object.put("mobile",user.getMobile());  
442 - object.put("sex",user.getSex());  
443 - array.add(object);  
444 - }  
445 - return array ;  
446 - }  
447 -  
448 - private JSONArray initUserDeleteJson(List<SyncUserDto> list){  
449 - JSONArray array = new JSONArray();  
450 - for(SyncUserDto user : list){  
451 - JSONObject object = new JSONObject();  
452 - object.put("id",user.getHxyCustomerId());  
453 - array.add(object);  
454 - }  
455 - return array ;  
456 - }  
457 -  
458 private void syncStudentHxy(SyncSchoolDto school , List<SyncUserDto> addStudentList , List<SyncUserDto> updateStudentList ,List<SyncUserDto> deleteStudentList ){ 394 private void syncStudentHxy(SyncSchoolDto school , List<SyncUserDto> addStudentList , List<SyncUserDto> updateStudentList ,List<SyncUserDto> deleteStudentList ){
459 if(addStudentList.size() > 0){ 395 if(addStudentList.size() > 0){
460 JSONArray array = initAddJson(addStudentList); 396 JSONArray array = initAddJson(addStudentList);
461 YXYResult result = getResult(prefix_url+suffix_student_add,array.toJSONString()); 397 YXYResult result = getResult(prefix_url+suffix_student_add,array.toJSONString());
462 if(result.getCode() == 0 || result.getCode() == -3){ 398 if(result.getCode() == 0 || result.getCode() == -3){
463 for(YXYResultDetail detail : result.getData()){ 399 for(YXYResultDetail detail : result.getData()){
464 - if(StringUtils.isNotBlank(detail.getId())){ 400 + if(StringUtils.isNotBlank(detail.getUserid())){
465 //成功 401 //成功
466 UserRelationDto userRelationDto = new UserRelationDto(); 402 UserRelationDto userRelationDto = new UserRelationDto();
467 - SyncUserDto syncUserDto = getUser(addStudentList,detail.getName()) ; 403 + SyncUserDto syncUserDto = getUser(addStudentList,detail.getStuname()) ;
468 userRelationDto.setHxyCustomerId(syncUserDto.getCustomerId()); 404 userRelationDto.setHxyCustomerId(syncUserDto.getCustomerId());
469 userRelationDto.setYxyUserId(detail.getUserid()); 405 userRelationDto.setYxyUserId(detail.getUserid());
470 userRelationDto.setSqlstate(1); 406 userRelationDto.setSqlstate(1);
471 - userRelationDto.setUserType(1); 407 + userRelationDto.setUserType(2);
472 userRelationDto.setState(1); 408 userRelationDto.setState(1);
473 scFeign.updateUserRelation(userRelationDto); 409 scFeign.updateUserRelation(userRelationDto);
474 scFeign.updateUser(syncUserDto.getId()); 410 scFeign.updateUser(syncUserDto.getId());
@@ -493,14 +429,14 @@ public class YXYWriteService { @@ -493,14 +429,14 @@ public class YXYWriteService {
493 System.out.println(result.getMessage()); 429 System.out.println(result.getMessage());
494 } 430 }
495 for(SyncUserDto user : updateStudentList){ 431 for(SyncUserDto user : updateStudentList){
496 - if(!errorList.contains(user.getHxyCustomerId())){ 432 + if(!errorList.contains(user.getYxyUserId())){
497 UserRelationDto userRelationDto = new UserRelationDto(); 433 UserRelationDto userRelationDto = new UserRelationDto();
498 - userRelationDto.setYxyUserId(user.getCustomerId()); 434 + userRelationDto.setHxyCustomerId(user.getCustomerId());
499 userRelationDto.setSqlstate(2); 435 userRelationDto.setSqlstate(2);
500 - userRelationDto.setUserType(1); 436 + userRelationDto.setUserType(2);
501 userRelationDto.setState(1); 437 userRelationDto.setState(1);
502 scFeign.updateUserRelation(userRelationDto); 438 scFeign.updateUserRelation(userRelationDto);
503 - scFeign.updateDept(user.getId()); 439 + scFeign.updateUser(user.getId());
504 } 440 }
505 } 441 }
506 } 442 }
@@ -518,15 +454,15 @@ public class YXYWriteService { @@ -518,15 +454,15 @@ public class YXYWriteService {
518 }else { 454 }else {
519 System.out.println(result.getMessage()); 455 System.out.println(result.getMessage());
520 } 456 }
521 - for(SyncUserDto user : updateStudentList){  
522 - if(!errorList.contains(user.getHxyCustomerId())){ 457 + for(SyncUserDto user : deleteStudentList){
  458 + if(!errorList.contains(user.getYxyUserId())){
523 UserRelationDto userRelationDto = new UserRelationDto(); 459 UserRelationDto userRelationDto = new UserRelationDto();
524 - userRelationDto.setYxyUserId(user.getCustomerId()); 460 + userRelationDto.setHxyCustomerId(user.getCustomerId());
525 userRelationDto.setSqlstate(2); 461 userRelationDto.setSqlstate(2);
526 - userRelationDto.setUserType(1); 462 + userRelationDto.setUserType(2);
527 userRelationDto.setState(0); 463 userRelationDto.setState(0);
528 scFeign.updateUserRelation(userRelationDto); 464 scFeign.updateUserRelation(userRelationDto);
529 - scFeign.updateDept(user.getId()); 465 + scFeign.updateUser(user.getId());
530 } 466 }
531 } 467 }
532 } 468 }
@@ -538,14 +474,14 @@ public class YXYWriteService { @@ -538,14 +474,14 @@ public class YXYWriteService {
538 YXYResult result = getResult(prefix_url+suffix_teacher_add,array.toJSONString()); 474 YXYResult result = getResult(prefix_url+suffix_teacher_add,array.toJSONString());
539 if(result.getCode() == 0 || result.getCode() == -3){ 475 if(result.getCode() == 0 || result.getCode() == -3){
540 for(YXYResultDetail detail : result.getData()){ 476 for(YXYResultDetail detail : result.getData()){
541 - if(StringUtils.isNotBlank(detail.getId())){ 477 + if(StringUtils.isNotBlank(detail.getUserid())){
542 //成功 478 //成功
543 UserRelationDto userRelationDto = new UserRelationDto(); 479 UserRelationDto userRelationDto = new UserRelationDto();
544 SyncUserDto syncUserDto = getUser(addTeacherList,detail.getName()) ; 480 SyncUserDto syncUserDto = getUser(addTeacherList,detail.getName()) ;
545 userRelationDto.setHxyCustomerId(syncUserDto.getCustomerId()); 481 userRelationDto.setHxyCustomerId(syncUserDto.getCustomerId());
546 userRelationDto.setYxyUserId(detail.getUserid()); 482 userRelationDto.setYxyUserId(detail.getUserid());
547 userRelationDto.setSqlstate(1); 483 userRelationDto.setSqlstate(1);
548 - userRelationDto.setUserType(2); 484 + userRelationDto.setUserType(1);
549 userRelationDto.setState(1); 485 userRelationDto.setState(1);
550 scFeign.updateUserRelation(userRelationDto); 486 scFeign.updateUserRelation(userRelationDto);
551 scFeign.updateUser(syncUserDto.getId()); 487 scFeign.updateUser(syncUserDto.getId());
@@ -570,14 +506,14 @@ public class YXYWriteService { @@ -570,14 +506,14 @@ public class YXYWriteService {
570 System.out.println(result.getMessage()); 506 System.out.println(result.getMessage());
571 } 507 }
572 for(SyncUserDto user : updateTeacherList){ 508 for(SyncUserDto user : updateTeacherList){
573 - if(!errorList.contains(user.getHxyCustomerId())){ 509 + if(!errorList.contains(user.getYxyUserId())){
574 UserRelationDto userRelationDto = new UserRelationDto(); 510 UserRelationDto userRelationDto = new UserRelationDto();
575 - userRelationDto.setYxyUserId(user.getCustomerId()); 511 + userRelationDto.setHxyCustomerId(user.getCustomerId());
576 userRelationDto.setSqlstate(2); 512 userRelationDto.setSqlstate(2);
577 - userRelationDto.setUserType(2); 513 + userRelationDto.setUserType(1);
578 userRelationDto.setState(1); 514 userRelationDto.setState(1);
579 scFeign.updateUserRelation(userRelationDto); 515 scFeign.updateUserRelation(userRelationDto);
580 - scFeign.updateDept(user.getId()); 516 + scFeign.updateUser(user.getId());
581 } 517 }
582 } 518 }
583 } 519 }
@@ -596,14 +532,14 @@ public class YXYWriteService { @@ -596,14 +532,14 @@ public class YXYWriteService {
596 System.out.println(result.getMessage()); 532 System.out.println(result.getMessage());
597 } 533 }
598 for(SyncUserDto user : deleteTeacherList){ 534 for(SyncUserDto user : deleteTeacherList){
599 - if(!errorList.contains(user.getHxyCustomerId())){ 535 + if(!errorList.contains(user.getYxyUserId())){
600 UserRelationDto userRelationDto = new UserRelationDto(); 536 UserRelationDto userRelationDto = new UserRelationDto();
601 - userRelationDto.setYxyUserId(user.getCustomerId()); 537 + userRelationDto.setHxyCustomerId(user.getCustomerId());
602 userRelationDto.setSqlstate(2); 538 userRelationDto.setSqlstate(2);
603 - userRelationDto.setUserType(2); 539 + userRelationDto.setUserType(1);
604 userRelationDto.setState(0); 540 userRelationDto.setState(0);
605 scFeign.updateUserRelation(userRelationDto); 541 scFeign.updateUserRelation(userRelationDto);
606 - scFeign.updateDept(user.getId()); 542 + scFeign.updateUser(user.getId());
607 } 543 }
608 } 544 }
609 } 545 }
@@ -657,6 +593,70 @@ public class YXYWriteService { @@ -657,6 +593,70 @@ public class YXYWriteService {
657 return array ; 593 return array ;
658 } 594 }
659 595
  596 + private JSONArray initAddJson(List<SyncUserDto> list){
  597 + JSONArray array = new JSONArray();
  598 + for(SyncUserDto user : list){
  599 + JSONObject object = new JSONObject();
  600 + object.put("classid",scFeign.selectYxyIdByHxyId(user.getClassId()));
  601 + object.put("stuname",user.getName());
  602 + object.put("mobile",user.getMobile());
  603 + object.put("sex",user.getSex());
  604 + array.add(object);
  605 + }
  606 + return array ;
  607 + }
  608 +
  609 + private JSONArray initTeacherAddJson(SyncSchoolDto school , List<SyncUserDto> list){
  610 + JSONArray array = new JSONArray();
  611 + for(SyncUserDto user : list){
  612 + JSONObject object = new JSONObject();
  613 + object.put("schoolid",school.getYxtId());
  614 + object.put("name",user.getName());
  615 + object.put("mobile",user.getMobile());
  616 + object.put("sex",user.getSex());
  617 + array.add(object);
  618 + }
  619 + return array ;
  620 + }
  621 +
  622 + private JSONArray initTeacherUpdateJson(SyncSchoolDto school , List<SyncUserDto> list){
  623 + JSONArray array = new JSONArray();
  624 + for(SyncUserDto user : list){
  625 + JSONObject object = new JSONObject();
  626 + object.put("userid",user.getYxyUserId());
  627 + object.put("name",user.getName());
  628 + object.put("mobile",user.getMobile());
  629 + object.put("sex",user.getSex());
  630 + array.add(object);
  631 + }
  632 + return array ;
  633 + }
  634 +
  635 + private JSONArray initUserUpdateJson(List<SyncUserDto> list){
  636 + JSONArray array = new JSONArray();
  637 + for(SyncUserDto user : list){
  638 + JSONObject object = new JSONObject();
  639 + object.put("userid",user.getYxyUserId());
  640 + object.put("classid",scFeign.selectYxyIdByHxyId(user.getClassId()));
  641 + object.put("stuname",user.getName());
  642 + object.put("mobile",user.getMobile());
  643 + object.put("sex",user.getSex());
  644 + array.add(object);
  645 + }
  646 + return array ;
  647 + }
  648 +
  649 + private JSONArray initUserDeleteJson(List<SyncUserDto> list){
  650 + JSONArray array = new JSONArray();
  651 + for(SyncUserDto user : list){
  652 + JSONObject object = new JSONObject();
  653 + object.put("userid",user.getYxyUserId());
  654 + array.add(object);
  655 + }
  656 + return array ;
  657 + }
  658 +
  659 +
660 //返回父部门,或者年级 660 //返回父部门,或者年级
661 private SyncDeptDto getDept(List<SyncDeptDto> deptList , int pId){ 661 private SyncDeptDto getDept(List<SyncDeptDto> deptList , int pId){
662 for(SyncDeptDto dept : deptList){ 662 for(SyncDeptDto dept : deptList){