diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/DeptRelationDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/DeptRelationDto.java new file mode 100644 index 0000000..1e57709 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/DeptRelationDto.java @@ -0,0 +1,56 @@ +package com.sincere.common.dto.smartCampus; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 10:53 + */ +public class DeptRelationDto { + + private int hxyDeptId; + private String yxyDeptId ; + private int userType ; + private int state ; + + private int sqlStatus ; // 1增2改3删 + + public int getHxyDeptId() { + return hxyDeptId; + } + + public void setHxyDeptId(int hxyDeptId) { + this.hxyDeptId = hxyDeptId; + } + + public String getYxyDeptId() { + return yxyDeptId; + } + + public void setYxyDeptId(String yxyDeptId) { + this.yxyDeptId = yxyDeptId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getState() { + return state; + } + + public void setState(int state) { + this.state = state; + } + + public int getSqlStatus() { + return sqlStatus; + } + + public void setSqlStatus(int sqlStatus) { + this.sqlStatus = sqlStatus; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/GroupDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/GroupDto.java new file mode 100644 index 0000000..13ea022 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/GroupDto.java @@ -0,0 +1,37 @@ +package com.sincere.common.dto.smartCampus; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/26 0026 15:47 + */ +public class GroupDto { + + private int groupId ; + private String groupName ; + private int pId ; + + public int getGroupId() { + return groupId; + } + + public void setGroupId(int groupId) { + this.groupId = groupId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public int getpId() { + return pId; + } + + public void setpId(int pId) { + this.pId = pId; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncDeptDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncDeptDto.java new file mode 100644 index 0000000..292bd0a --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncDeptDto.java @@ -0,0 +1,73 @@ +package com.sincere.common.dto.smartCampus; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 9:28 + */ +public class SyncDeptDto { + private int id ; + private int deptId ; + private int schoolId ; + private String deptName ; + private int updateType ; + private int gradeId ; + private int userType ; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getDeptId() { + return deptId; + } + + public void setDeptId(int deptId) { + this.deptId = deptId; + } + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public int getUpdateType() { + return updateType; + } + + public void setUpdateType(int updateType) { + this.updateType = updateType; + } + + public int getGradeId() { + return gradeId; + } + + public void setGradeId(int gradeId) { + this.gradeId = gradeId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncSchoolDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncSchoolDto.java new file mode 100644 index 0000000..4366453 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncSchoolDto.java @@ -0,0 +1,46 @@ +package com.sincere.common.dto.smartCampus; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/26 0026 15:39 + */ +public class SyncSchoolDto { + + private int schoolId ; + private String schoolName ; + private String yxtId ; + private int push ; + + public int getSchoolId() { + return schoolId; + } + + public void setSchoolId(int schoolId) { + this.schoolId = schoolId; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public String getYxtId() { + return yxtId; + } + + public void setYxtId(String yxtId) { + this.yxtId = yxtId; + } + + public int getPush() { + return push; + } + + public void setPush(int push) { + this.push = push; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncUserDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncUserDto.java new file mode 100644 index 0000000..b6f1d91 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SyncUserDto.java @@ -0,0 +1,82 @@ +package com.sincere.common.dto.smartCampus; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 9:38 + */ +public class SyncUserDto { + + private int id ; + private String name ; + private String customerId ; + private int userType ; + private int classId ; + private int sex ; + private String mobile ; + private int updateType ; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getClassId() { + return classId; + } + + public void setClassId(int classId) { + this.classId = classId; + } + + public int getSex() { + return sex; + } + + public void setSex(int sex) { + this.sex = sex; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public int getUpdateType() { + return updateType; + } + + public void setUpdateType(int updateType) { + this.updateType = updateType; + } +} diff --git a/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserRelationDto.java b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserRelationDto.java new file mode 100644 index 0000000..f83d6a6 --- /dev/null +++ b/cloud/common/src/main/java/com/sincere/common/dto/smartCampus/UserRelationDto.java @@ -0,0 +1,56 @@ +package com.sincere.common.dto.smartCampus; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 15:45 + */ +public class UserRelationDto { + + private String hxyCustomerId ; + private String yxyUserId ; + private int userType ; + private int state ; + + private int sqlstate ; + + public String getHxyCustomerId() { + return hxyCustomerId; + } + + public void setHxyCustomerId(String hxyCustomerId) { + this.hxyCustomerId = hxyCustomerId; + } + + public String getYxyUserId() { + return yxyUserId; + } + + public void setYxyUserId(String yxyUserId) { + this.yxyUserId = yxyUserId; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public int getState() { + return state; + } + + public void setState(int state) { + this.state = state; + } + + public int getSqlstate() { + return sqlstate; + } + + public void setSqlstate(int sqlstate) { + this.sqlstate = sqlstate; + } +} diff --git a/cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java b/cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java index dfc318c..53775d5 100644 --- a/cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java +++ b/cloud/quartz/src/main/java/com/sincere/quartz/feign/ScFeign.java @@ -45,4 +45,42 @@ public interface ScFeign { @RequestMapping(value = "/sm/rp/selectNotBind",method = RequestMethod.GET) List selectNotBind(@RequestParam("schoolId") int schoolId , @RequestParam("type") int type); + + + //同步通讯录 + @RequestMapping(value = "sm/sync/selectSyncSchool",method = RequestMethod.GET) + List selectSyncSchool(); + + @RequestMapping(value = "sm/sync/selectGroup",method = RequestMethod.GET) + List selectGroup(@RequestParam("schoolId") int schoolId); + + @RequestMapping(value = "sm/sync/selectSubject",method = RequestMethod.GET) + List selectSubject(@RequestParam("schoolId") int schoolId); + + @RequestMapping(value = "sm/sync/selectDept",method = RequestMethod.GET) + List selectDept(@RequestParam("schoolId") int schoolId) ; + + @RequestMapping(value = "sm/sync/selectUser",method = RequestMethod.GET) + List selectUser(@RequestParam("schoolId") int schoolId); + + @RequestMapping(value = "sm/sync/updateSchool",method = RequestMethod.GET) + void updateSchool(@RequestParam("schoolId") int schoolId); + + @RequestMapping(value = "sm/sync/updateDept",method = RequestMethod.GET) + void updateDept(@RequestParam("id") int id); + + @RequestMapping(value = "sm/sync/updateUser",method = RequestMethod.GET) + void updateUser(@RequestParam("id")int id); + + @RequestMapping(value = "sm/sync/updateDeptRelation",method = RequestMethod.POST) + void updateDeptRelation(@RequestBody DeptRelationDto deptRelationDto); + + @RequestMapping(value = "sm/sync/selectYxyIdByHxyId",method = RequestMethod.GET) + String selectYxyIdByHxyId(@RequestParam("hxyId") int hxyId); + + @RequestMapping(value = "sm/sync/updateUserRelation",method = RequestMethod.POST) + void updateUserRelation(@RequestBody UserRelationDto userRelationDto); + + @RequestMapping(value = "sm/sync/selectUserYxyIdByHxyId",method = RequestMethod.GET) + String selectUserYxyIdByHxyId(@RequestParam("hxyCustomerId") String hxyCustomerId); } diff --git a/cloud/quartz/src/main/java/com/sincere/quartz/job/BindPushJob.java b/cloud/quartz/src/main/java/com/sincere/quartz/job/BindPushJob.java index 4648baa..2dd569c 100644 --- a/cloud/quartz/src/main/java/com/sincere/quartz/job/BindPushJob.java +++ b/cloud/quartz/src/main/java/com/sincere/quartz/job/BindPushJob.java @@ -22,7 +22,7 @@ import java.util.*; * @version 1.0 * @date 2019/12/10 0010 8:31 */ -@Service +//@Service public class BindPushJob { private Logger logger = LoggerFactory.getLogger(KQJob.class); diff --git a/cloud/quartz/src/main/java/com/sincere/quartz/job/KQJob.java b/cloud/quartz/src/main/java/com/sincere/quartz/job/KQJob.java index b387281..8bc9118 100644 --- a/cloud/quartz/src/main/java/com/sincere/quartz/job/KQJob.java +++ b/cloud/quartz/src/main/java/com/sincere/quartz/job/KQJob.java @@ -28,7 +28,7 @@ import java.util.*; * @version 1.0 * @date 2019/11/27 0027 17:05 */ -@Service +//@Service public class KQJob { private Logger logger = LoggerFactory.getLogger(KQJob.class); diff --git a/cloud/quartz/src/main/java/com/sincere/quartz/job/SyncJob.java b/cloud/quartz/src/main/java/com/sincere/quartz/job/SyncJob.java new file mode 100644 index 0000000..244e179 --- /dev/null +++ b/cloud/quartz/src/main/java/com/sincere/quartz/job/SyncJob.java @@ -0,0 +1,30 @@ +package com.sincere.quartz.job; + +import com.sincere.quartz.third.yixueyun.YXYReadService; +import com.sincere.quartz.third.yixueyun.YXYWriteService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/24 0024 10:54 + */ +@Service +public class SyncJob { + + @Autowired + YXYWriteService yxyWriteService ; + + @Autowired + YXYReadService yxyReadService ; + + @Scheduled(cron = "0/1 * * * * ? ") + //@Scheduled(cron = "0 0 23 * * ? ") + public void Sync(){ + //翼校通的同步 之后还有钉钉的同步等等 + yxyWriteService.sync(); + //yxyReadService.sync(); + } +} diff --git a/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/SyncController.java b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/SyncController.java new file mode 100644 index 0000000..4b9eb4a --- /dev/null +++ b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/SyncController.java @@ -0,0 +1,90 @@ +package com.sincere.smartSearch.controller; + +import com.sincere.common.dto.smartCampus.*; +import com.sincere.smartSearch.service.SyncService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 9:55 + */ +@RestController +@RequestMapping("sm/sync") +public class SyncController { + + @Autowired + SyncService syncService ; + + @RequestMapping(value = "selectSyncSchool",method = RequestMethod.GET) + List selectSyncSchool(){ + return syncService.selectSyncSchool(); + } + + @RequestMapping(value = "updateSchool",method = RequestMethod.GET) + void updateSchool(@RequestParam("schoolId") int schoolId){ + syncService.updateSchool(schoolId); + } + + + @RequestMapping(value = "selectGroup",method = RequestMethod.GET) + List selectGroup(@RequestParam("schoolId") int schoolId){ + return syncService.selectGroup(schoolId); + } + + @RequestMapping(value = "selectSubject",method = RequestMethod.GET) + List selectSubject(@RequestParam("schoolId") int schoolId){ + return syncService.selectSubject(schoolId); + } + + @RequestMapping(value = "selectDept",method = RequestMethod.GET) + List selectDept(@RequestParam("schoolId") int schoolId){ + return syncService.selectDept(schoolId); + } + + @RequestMapping(value = "updateDept",method = RequestMethod.GET) + void updateDept(@RequestParam("id") int id) { + syncService.updateDept(id); + } + + @RequestMapping(value = "updateUser",method = RequestMethod.GET) + void updateUser(@RequestParam("id")int id){ + syncService.updateUser(id); + } + + @RequestMapping(value = "updateDeptRelation",method = RequestMethod.POST) + void updateDeptRelation(@RequestBody DeptRelationDto deptRelationDto){ //1 新增 2 修改删除 + if(deptRelationDto.getSqlStatus() == 1){ + syncService.insertDeptRelation(deptRelationDto); + }else { + syncService.updateDeptRelation(deptRelationDto); + } + } + + @RequestMapping(value = "selectUser",method = RequestMethod.GET) + List selectUser(@RequestParam("schoolId") int schoolId){ + return syncService.selectUser(schoolId); + } + + @RequestMapping(value = "selectYxyIdByHxyId",method = RequestMethod.GET) + String selectYxyIdByHxyId(@RequestParam("hxyId") int hxyId){ + return syncService.selectYxyIdByHxyId(hxyId); + } + + @RequestMapping(value = "updateUserRelation",method = RequestMethod.POST) + void updateUserRelation(@RequestBody UserRelationDto userRelationDto){ //1 新增 2 修改删除 + if(userRelationDto.getSqlstate() == 1){ + syncService.insertUserRelation(userRelationDto); + }else { + syncService.updateUserRelation(userRelationDto); + } + } + + @RequestMapping(value = "selectUserYxyIdByHxyId",method = RequestMethod.GET) + String selectUserYxyIdByHxyId(@RequestParam("hxyCustomerId") String hxyCustomerId){ + return syncService.selectUserYxyIdByHxyId(hxyCustomerId); + } +} diff --git a/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/SyncMapper.java b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/SyncMapper.java new file mode 100644 index 0000000..c86d328 --- /dev/null +++ b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/SyncMapper.java @@ -0,0 +1,42 @@ +package com.sincere.smartSearch.mapper; + +import com.sincere.common.dto.smartCampus.*; +import com.sincere.smartSearch.model.User; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/26 0026 15:35 + */ +public interface SyncMapper { + + List selectSyncSchool(); + + int updateSchool(int schoolId); + + List selectGroup(int schoolId) ; + + int updateDept(int id); + + int updateUser(int id); + + List selectSubject(int schoolId); + + List selectDept(int schoolId) ; + + List selectUser(int schoolId); + + int insertDeptRelation(DeptRelationDto deptRelationDto); + + int updateDeptRelation(DeptRelationDto deptRelationDto); + + String selectYxyIdByHxyId(int hxyDeptId); + + int insertUserRelation(UserRelationDto userRelationDto); + + int updateUserRelation(UserRelationDto userRelationDto); + + String selectUserYxyIdByHxyId(String hxyCustomerId); +} diff --git a/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/SyncService.java b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/SyncService.java new file mode 100644 index 0000000..9eb8b12 --- /dev/null +++ b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/SyncService.java @@ -0,0 +1,41 @@ +package com.sincere.smartSearch.service; + +import com.sincere.common.dto.smartCampus.*; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 9:51 + */ +public interface SyncService { + + List selectSyncSchool(); + + int updateSchool(int schoolId); + + List selectGroup(int schoolId) ; + + int updateDept(int id); + + int updateUser(int id); + + List selectSubject(int schoolId); + + List selectDept(int schoolId) ; + + List selectUser(int schoolId); + + int insertDeptRelation(DeptRelationDto deptRelationDto); + + int updateDeptRelation(DeptRelationDto deptRelationDto); + + String selectYxyIdByHxyId(int hxyId); + + int insertUserRelation(UserRelationDto userRelationDto); + + int updateUserRelation(UserRelationDto userRelationDto); + + String selectUserYxyIdByHxyId(String hxyCustomerId); +} diff --git a/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/SyncServiceImpl.java b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/SyncServiceImpl.java new file mode 100644 index 0000000..5c77bcc --- /dev/null +++ b/cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/SyncServiceImpl.java @@ -0,0 +1,91 @@ +package com.sincere.smartSearch.service.impl; + +import com.sincere.common.dto.smartCampus.*; +import com.sincere.smartSearch.mapper.SyncMapper; +import com.sincere.smartSearch.service.SyncService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author chen + * @version 1.0 + * @date 2019/12/27 0027 9:51 + */ +@Service +public class SyncServiceImpl implements SyncService { + + @Autowired + SyncMapper syncMapper ; + + @Override + public List selectSyncSchool() { + return syncMapper.selectSyncSchool(); + } + + @Override + public int updateSchool(int schoolId) { + return syncMapper.updateSchool(schoolId); + } + + @Override + public List selectGroup(int schoolId) { + return syncMapper.selectGroup(schoolId); + } + + @Override + public int updateDept(int id) { + return syncMapper.updateDept(id); + } + + @Override + public int updateUser(int id) { + return syncMapper.updateUser(id); + } + + @Override + public List selectSubject(int schoolId) { + return syncMapper.selectSubject(schoolId); + } + + @Override + public List selectDept(int schoolId) { + return syncMapper.selectDept(schoolId); + } + + @Override + public List selectUser(int schoolId) { + return syncMapper.selectUser(schoolId); + } + + @Override + public int insertDeptRelation(DeptRelationDto deptRelationDto) { + return syncMapper.insertDeptRelation(deptRelationDto); + } + + @Override + public int updateDeptRelation(DeptRelationDto deptRelationDto) { + return syncMapper.updateDeptRelation(deptRelationDto); + } + + @Override + public String selectYxyIdByHxyId(int hxyId) { + return syncMapper.selectYxyIdByHxyId(hxyId); + } + + @Override + public int insertUserRelation(UserRelationDto userRelationDto) { + return syncMapper.insertUserRelation(userRelationDto); + } + + @Override + public int updateUserRelation(UserRelationDto userRelationDto) { + return syncMapper.updateUserRelation(userRelationDto); + } + + @Override + public String selectUserYxyIdByHxyId(String hxyCustomerId) { + return syncMapper.selectUserYxyIdByHxyId(hxyCustomerId); + } +} diff --git a/cloud/search_smartCampus/src/main/resources/application.yml b/cloud/search_smartCampus/src/main/resources/application.yml index 1981a18..239a06f 100644 --- a/cloud/search_smartCampus/src/main/resources/application.yml +++ b/cloud/search_smartCampus/src/main/resources/application.yml @@ -4,9 +4,12 @@ spring: application: name: smartCampusSearch datasource: - username: szjxtuser - password: RQminVCJota3H1u8bBYH - url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus +# username: szjxtuser +# password: RQminVCJota3H1u8bBYH +# url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus + username: SZJXTUSER + password: xst200919 + url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver mvc: static-path-pattern: /images/** diff --git a/cloud/search_smartCampus/src/main/resources/mapper/SyncMapper.xml b/cloud/search_smartCampus/src/main/resources/mapper/SyncMapper.xml new file mode 100644 index 0000000..9056ffd --- /dev/null +++ b/cloud/search_smartCampus/src/main/resources/mapper/SyncMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + update HS_SchoolRelated set IsAllPush = 1 where SchoolId_XX = #{schoolId} + + + + + + + + + + + + + + + + + + + + + + + + update HS_TeaGroupUpdate set yxy_is_new = 1 where ID = #{id} + + + + update HS_StudentUpdateCard set yxy_is_new = 1 where ID = #{id} + + + + + + + + + + + + + + + + insert into SZ_DeptRelation (hxyDeptId,yxyDeptId,usertype,updateTime,createTime,state) + values (#{hxyDeptId},#{yxyDeptId},#{userType},GETDATE(),GETDATE(),#{state}) + + + + update SZ_DeptRelation set updateTime = GETDATE() where state = #{state} and hxyDeptId = #{hxyDeptId} + + + + + + + insert into SZ_UserRelation (hxyCustomerId,yxyUserId,userType,updateTime,createTime,state) + values (#{hxyCustomerId},#{yxyUserId},#{userType},GETDATE(),GETDATE(),#{state}) + + + + update SZ_UserRelation set updateTime = GETDATE() where state = #{state} and hxyCustomerId = #{hxyCustomerId} + + + + \ No newline at end of file -- libgit2 0.21.0