Commit a54847d8 authored by 赵啸非's avatar 赵啸非

修改刷新用户树

parent a1a48388
......@@ -36,54 +36,10 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private UserService userService;
@Autowired
private IUserFeign userFeign;
@Override
public void excuteTask(ITask task) throws AppException {
userService.refreshUser();
log.info("同步用户");
/* UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());*/
//resourceService.updateUserList();
/* UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
*//* List<UserPdu> firstList = list.getData().getData();
List<UserEntity> secondList = userService.find(new UserQuery());
//交叉对比后,多的新增 少的删除
List<UserEntity> diffList = secondList.parallelStream()
.filter(item -> !firstList.parallelStream().map(e -> e.getId()).collect(Collectors.toList()).contains(item.getId()))
.collect(Collectors.toList());*//*
//log.info("diffList:{}",JSON.toJSONString(diffList));
//更新本地用户信息,并且更新用户站点树
list.getData().getData().forEach(user -> {
//查询用户是否存在,
//UserEntity userEntity = userService.get(user.getId());
UserEntity userEntity =userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(userEntity)) {
//新增
UserEntity entity = new UserEntity();
entity.initAttrValue();
BeanUtils.copyProperties(user, entity, BeanUtil.getNullPropertyNames(user));
userService.save(entity);
Context context = new Context();
context.setUser(entity);
new Thread(new SyncTreeSiteThread(siteService, context)).start();
}
});*/
userService.refreshUser();
}
......
......@@ -217,7 +217,8 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Override
protected void saveAfter(SiteEntity entity, Context context) throws AppException {
super.saveAfter(entity, context);
this.updateAllSiteTree(context);
userService.refreshUser();
// this.updateAllSiteTree(context);
//通知php系统更新
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
HashMap<String, String> paramsMap = new HashMap<>();
......@@ -365,11 +366,11 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
Rest<Void> rest1 = deviceFeign.refreshMessage(devicePdu);
log.info("调用刷新结果:{}", JSON.toJSONString(rest1));
refresh = false;
//刷新站点树
cacheService.del(USER_SITE_TREE);
this.updateAllSiteTree(context);
//刷新用户站点树
// cacheService.del(USER_SITE_TREE);
// this.updateAllSiteTree(context);
userService.refreshUser();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment