|
@@ -17,6 +17,7 @@ import org.apache.http.util.EntityUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -37,6 +38,8 @@ public class SsoSyncService {
|
|
|
private SysDeptService sysDeptService;
|
|
|
@Autowired
|
|
|
private DbdcUserService dbdcUserService;
|
|
|
+ @Autowired
|
|
|
+ private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
public void ssoSync(){
|
|
|
boolean flag = syncDept();
|
|
@@ -76,7 +79,7 @@ public class SsoSyncService {
|
|
|
// newDept.setUpdateTime(new Date(ssoDeptDto.getUPDATE_TIME()));
|
|
|
// newDept.setPdeptids(parenDept.getPdeptids()+","+orgId);
|
|
|
// newDept.setOrgId(orgId);
|
|
|
- sysDeptService.saveAndUpdateDeptInfo(newDept);
|
|
|
+// sysDeptService.saveAndUpdateDeptInfo(newDept);
|
|
|
// }
|
|
|
// }
|
|
|
// if (!ssoDeptDto.getPARENT_ID().equals("515959718506717184")){
|
|
@@ -166,7 +169,12 @@ public class SsoSyncService {
|
|
|
}
|
|
|
|
|
|
public List<SsoUserDto> getSsoUser(){
|
|
|
- String url ="http://200.1.70.44:8088/id-sync/v5/urm/service/V3/res/users?syncSequence=0";
|
|
|
+ String syncSequence = redisTemplate.opsForValue().get("userSequence");
|
|
|
+ if (StringUtils.isEmpty(syncSequence)){
|
|
|
+ syncSequence="0";
|
|
|
+ }
|
|
|
+ String url ="http://200.1.70.44:8088/id-sync/v5/urm/service/V3/res/users?syncSequence="+syncSequence;
|
|
|
+ logger.info("用户请求地址"+url);
|
|
|
Map headers=new HashMap();
|
|
|
headers.put("appKey","508443066584064000");
|
|
|
List<SsoUserDto> ssoUserDtos = new ArrayList<>();
|
|
@@ -175,6 +183,11 @@ public class SsoSyncService {
|
|
|
if (map.get("resultCode").toString().equals("200")){
|
|
|
String data = map.get("data").toString();
|
|
|
ssoUserDtos=JSONObject.parseArray(data,SsoUserDto.class);
|
|
|
+
|
|
|
+ String nextSyncSequence= map.get("nextSyncSequence").toString();
|
|
|
+ if (StringUtils.isNotEmpty(nextSyncSequence)){
|
|
|
+ redisTemplate.opsForValue().set("userSequence",nextSyncSequence);
|
|
|
+ }
|
|
|
}
|
|
|
return ssoUserDtos;
|
|
|
}
|