Commit 6d803f2c authored by 赵啸非's avatar 赵啸非

添加删除站点后通知门户服务更新

parent d1424053
......@@ -129,6 +129,7 @@ public class UserEntity extends UserEntityExt implements IUser {
public UserEntity(){
}
/**
* 获取 登录名
* @return loginName
......
......@@ -39,4 +39,6 @@ public class UserEntityExt extends BaseEntityLong {
private List<ModelEntity> modleList;
}
\ No newline at end of file
......@@ -2,12 +2,15 @@ package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.springcloud.config.web.BaseWebMvcConfigurer;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
......@@ -41,6 +44,8 @@ public class DemoStartedService implements IApplicationStartedService {
@Autowired
private UserService userService;
@Autowired
private IUserFeign userFeign;
@Override
public void start() {
......@@ -52,8 +57,107 @@ public class DemoStartedService implements IApplicationStartedService {
contextTemp.setUser(userEntity);
SyncTreeSiteThread syncTreeSiteThread = new SyncTreeSiteThread(siteService, contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
userService.find(new UserQuery()).stream().forEach(user->{
userFeign.list(new UserPdu()).getData().getData().stream().forEach(userPdu->{
Context context = new Context();
IUser user = new IUser() {
@Override
public Long getId() {
return userPdu.getId();
}
@Override
public Long getDeptId() {
return null;
}
@Override
public String getDeptName() {
return null;
}
@Override
public Long getCustomerId() {
return null;
}
@Override
public Long getSiteId() {
return null;
}
@Override
public String getSiteIds() {
return userPdu.getSiteIds();
}
@Override
public Long getCustomerJoinId() {
return null;
}
@Override
public String getCustomerNum() {
return null;
}
@Override
public String getLoginName() {
return userPdu.getLoginName();
}
@Override
public String getRealName() {
return userPdu.getRealName();
}
@Override
public boolean isAdmin() {
return userPdu.getId()==1L;
}
@Override
public boolean isSystemUser() {
return false;
}
@Override
public boolean isManager() {
return false;
}
@Override
public Integer getUserType() {
return null;
}
@Override
public String getToken() {
return null;
}
@Override
public Long getLoginTime() {
return null;
}
@Override
public Long getExpireTime() {
return null;
}
@Override
public void setExpireTime(Long expireTime) {
}
@Override
public String getMenuUrl() {
return null;
}
};
context.setUser(user);
ThreadPool.getInstance().execute(new SyncTreeSiteThread(siteService,context));
});
......
......@@ -96,6 +96,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
//查詢指定的站點ids
log.info("siteQuery==>{}", JSON.toJSONString(siteQuery));
List<SiteEntity> siteList = this.find(siteQuery);
//turn to sitemap
Map<String, SiteEntity> siteMap = siteList.parallelStream().collect(Collectors.toMap(x -> x.getSiteCode(), y -> y, (o, n) -> n));
//遍历过滤站点树
for (SiteEntity siteEntity : siteList) {
......@@ -109,6 +110,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
recursionFn(areaMap, areaEntity);
}
}
log.info("rebuildAreaMap==>{}", JSON.toJSONString(areaMap));
//areaMap 为当前站点相关区域树结构 已经剔除不必要的分支结构
return buildSiteTreeSelect(areaMap, siteMap);
}
......
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