初始代码
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yunzhupaas-visualdev-portal</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-visualdev-portal-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-portal-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-system-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-permission-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-base-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yunzhupaas.portal.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.portal.entity.PortalDataEntity;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2023-04-19
|
||||
*/
|
||||
public interface PortalDataMapper extends SuperMapper<PortalDataEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.portal.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* base_portal
|
||||
* 版本: V3.0.0
|
||||
* 版权: 深圳市乐程软件有限公司
|
||||
* 作者: 管理员/admin
|
||||
* 日期: 2020-10-21 14:23:30
|
||||
*/
|
||||
public interface PortalMapper extends SuperMapper<PortalEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.yunzhupaas.portal.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.portal.entity.PortalDataEntity;
|
||||
import com.yunzhupaas.portal.model.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门户数据接口
|
||||
*
|
||||
* 后期门户模板数据,将会以platform再做区分,
|
||||
* 故将formData抽离成单独的表
|
||||
* @author
|
||||
* @since 2023-04-19
|
||||
*/
|
||||
public interface PortalDataService extends SuperService<PortalDataEntity> {
|
||||
|
||||
String getCustomDataForm(PortalCustomPrimary primary) throws Exception;
|
||||
|
||||
String getModelDataForm(PortalModPrimary primary) throws Exception;
|
||||
|
||||
/**
|
||||
* 发布
|
||||
*/
|
||||
void release(String platform, String portalId, List<String> systemIdList,String releasePlatform,PortalReleaseForm form) throws Exception;
|
||||
|
||||
void releaseModule(ReleaseModel releaseModel,String portalId) throws Exception;
|
||||
|
||||
Boolean isReleaseFlag(PortalReleasePrimary primary);
|
||||
|
||||
Boolean deleteAll(String portalId);
|
||||
|
||||
/**
|
||||
* 创建或更新门户自定义信息
|
||||
*/
|
||||
void createOrUpdate(PortalCustomPrimary primary, String formData) throws Exception;
|
||||
|
||||
/**
|
||||
* 创建或更新门户模板信息
|
||||
*/
|
||||
void createOrUpdate(PortalModPrimary primary, String formData) throws Exception;
|
||||
|
||||
/**
|
||||
* 创建或更新门户发布信息
|
||||
*/
|
||||
void createOrUpdate(PortalReleasePrimary primary, String formData) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取门户显示信息
|
||||
*
|
||||
* @param portalId 门户ID
|
||||
* @param platform 平台:app/pc
|
||||
*/
|
||||
PortalInfoAuthVO getDataFormView(String portalId, String platform) throws Exception;
|
||||
|
||||
/**
|
||||
* 设置默认门户
|
||||
*/
|
||||
void setCurrentDefault(String platform, String portalId);
|
||||
|
||||
String getCurrentDefault(String platform) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取当前带权限的portalIds
|
||||
*/
|
||||
List<String> getCurrentAuthPortalIds(PortalViewPrimary primary);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.yunzhupaas.portal.service;
|
||||
|
||||
import com.yunzhupaas.base.model.VisualFunctionModel;
|
||||
import com.yunzhupaas.base.model.base.SystemListVO;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
import com.yunzhupaas.portal.model.PortalPagination;
|
||||
import com.yunzhupaas.portal.model.PortalSelectModel;
|
||||
import com.yunzhupaas.portal.model.PortalSelectVO;
|
||||
import com.yunzhupaas.portal.model.PortalViewPrimary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* base_portal
|
||||
* 版本: V3.0.0
|
||||
* 版权: 深圳市乐程软件有限公司
|
||||
* 作者: 管理员/admin
|
||||
* 日期: 2020-10-21 14:23:30
|
||||
*/
|
||||
|
||||
public interface PortalService extends SuperService<PortalEntity> {
|
||||
|
||||
PortalEntity getInfo(String id);
|
||||
|
||||
/**
|
||||
* 是否重名
|
||||
*/
|
||||
Boolean isExistByFullName(String fullName, String id);
|
||||
|
||||
/**
|
||||
* 是否重码
|
||||
*/
|
||||
Boolean isExistByEnCode(String encode, String id);
|
||||
|
||||
void create(PortalEntity entity);
|
||||
|
||||
Boolean update(String id, PortalEntity entity);
|
||||
|
||||
void delete(PortalEntity entity) throws Exception;
|
||||
|
||||
List<PortalEntity> getList(PortalPagination pagination);
|
||||
|
||||
String getModListFirstId(PortalViewPrimary primary);
|
||||
|
||||
List<PortalSelectModel> getModList(PortalViewPrimary primary);
|
||||
|
||||
List<PortalSelectModel> getModSelectList();
|
||||
|
||||
/**
|
||||
* 获取门户模型集合
|
||||
*
|
||||
* @param pagination 分页信息
|
||||
* @return 模型集合
|
||||
*/
|
||||
List<VisualFunctionModel> getModelList(PortalPagination pagination);
|
||||
|
||||
|
||||
/**
|
||||
* 获取门户管理下拉
|
||||
*
|
||||
* @param pagination 分页信息
|
||||
* @param systemId 系统ID
|
||||
* @return 分页结婚
|
||||
*/
|
||||
List<PortalSelectVO> getManageSelectorPage(PortalPagination pagination, String systemId);
|
||||
|
||||
/**
|
||||
* 获取可选系统列表
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<SystemListVO> systemFilterList(String id,String category);
|
||||
|
||||
/**
|
||||
* 获取发布信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
VisualFunctionModel getReleaseInfo(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,398 @@
|
||||
package com.yunzhupaas.portal.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.MyBatisPrimaryBase;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.PortalManageEntity;
|
||||
import com.yunzhupaas.base.entity.SystemEntity;
|
||||
import com.yunzhupaas.base.model.online.VisualMenuModel;
|
||||
import com.yunzhupaas.base.model.portalManage.PortalManagePrimary;
|
||||
import com.yunzhupaas.base.model.portalManage.PortalManageVO;
|
||||
import com.yunzhupaas.base.service.ModuleService;
|
||||
import com.yunzhupaas.base.service.PortalManageService;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.base.service.SystemService;
|
||||
import com.yunzhupaas.base.util.visualUtil.PubulishUtil;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.permission.entity.AuthorizeEntity;
|
||||
import com.yunzhupaas.permission.entity.PermissionGroupEntity;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.service.AuthorizeService;
|
||||
import com.yunzhupaas.permission.service.PermissionGroupService;
|
||||
import com.yunzhupaas.permission.service.RoleService;
|
||||
import com.yunzhupaas.permission.service.UserService;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalDataEntity;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
import com.yunzhupaas.portal.mapper.PortalDataMapper;
|
||||
import com.yunzhupaas.portal.model.*;
|
||||
import com.yunzhupaas.portal.service.PortalDataService;
|
||||
import com.yunzhupaas.portal.service.PortalService;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.JsonUtilEx;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2023-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PortalDataServiceImpl extends SuperServiceImpl<PortalDataMapper, PortalDataEntity> implements PortalDataService {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private PortalService portalService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private AuthorizeService authorizeService;
|
||||
@Autowired
|
||||
private PortalManageService portalManageApi;
|
||||
@Autowired
|
||||
private PermissionGroupService permissionGroupApi;
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
@Autowired
|
||||
private PubulishUtil pubulishUtil;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
|
||||
@Override
|
||||
public String getCustomDataForm(PortalCustomPrimary primary) throws Exception {
|
||||
PortalDataEntity one = getOne(primary.getQuery());
|
||||
if(one != null){
|
||||
return one.getFormData();
|
||||
}else {
|
||||
save(primary.getEntity());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelDataForm(PortalModPrimary primary) throws Exception {
|
||||
PortalDataEntity one = getOne(primary.getQuery());
|
||||
if(one != null){
|
||||
return one.getFormData();
|
||||
}else {
|
||||
save(primary.getEntity());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release(String platform, String portalId, List<String> systemIdList,String releasePlatform,PortalReleaseForm form) throws Exception {
|
||||
if(CollectionUtils.isNotEmpty(systemIdList)){
|
||||
// 系统管理对应添加绑定
|
||||
portalManageApi.createBatch(systemIdList.stream().map(systemId->
|
||||
new PortalManagePrimary(releasePlatform, portalId, systemId)).collect(Collectors.toList()));
|
||||
}else {
|
||||
List<PortalManageVO> voList = portalManageApi.getList(new PortalManagePrimary(platform, portalId, null));
|
||||
List<String> list = systemService.getList().stream().map(SystemEntity::getId).collect(Collectors.toList());
|
||||
boolean hasSys = false;//剩下的门户对象-应用都被删除。
|
||||
for (PortalManageVO item : voList) {
|
||||
if(list.contains(item.getSystemId())){
|
||||
hasSys = true;
|
||||
}
|
||||
}
|
||||
if (voList.size() == 0 || !hasSys) {
|
||||
throw new WorkFlowException(MsgCode.VS413.get());
|
||||
}
|
||||
systemIdList = voList.stream().map(PortalManageVO::getSystemId).collect(Collectors.toList());
|
||||
}
|
||||
String formData = "";
|
||||
try {
|
||||
formData = getModelDataForm(new PortalModPrimary(portalId));
|
||||
createOrUpdate(new PortalReleasePrimary(portalId, platform), formData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 查询所有相关的自定义数据
|
||||
for (String systemId : systemIdList) {
|
||||
List<PortalDataEntity> list = list(new PortalCustomPrimary(platform, portalId, systemId, null).getQuery());
|
||||
final String finalFormData = formData;
|
||||
if(list.size() > 0){
|
||||
// 把所有数据进行重置formData
|
||||
list.forEach(entity -> entity.setFormData(finalFormData));
|
||||
updateBatchById(list);
|
||||
}
|
||||
}
|
||||
PortalEntity info = portalService.getInfo(portalId);
|
||||
if(info!=null){
|
||||
info.setState(1);
|
||||
info.setEnabledMark(1);
|
||||
info.setPlatformRelease(form.getPlatformRelease());
|
||||
portalService.update(portalId,info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseModule(ReleaseModel releaseModel,String portalId) throws Exception {
|
||||
PortalEntity info = portalService.getInfo(portalId);
|
||||
if(info!=null) {
|
||||
VisualMenuModel visual = new VisualMenuModel();
|
||||
visual.setApp(releaseModel.getApp());
|
||||
visual.setPc(releaseModel.getPc());
|
||||
visual.setPcModuleParentId(releaseModel.getPcModuleParentId());
|
||||
visual.setAppModuleParentId(releaseModel.getAppModuleParentId());
|
||||
// visual.setAppModuleParentId(releaseModel.getAppModuleParentId());
|
||||
// if (StringUtil.isNotEmpty(releaseModel.getPcModuleParentId()) && StringUtil.isEmpty(releaseModel.getPcSystemId())) {
|
||||
// visual.setPcModuleParentId("-1");
|
||||
// } else {
|
||||
// visual.setPcModuleParentId(releaseModel.getPcModuleParentId());
|
||||
// }
|
||||
if (releaseModel.getPc() == 1) {
|
||||
createOrUpdate(new PortalReleasePrimary(portalId, PortalConst.WEB), getModelDataForm(new PortalModPrimary(portalId)));
|
||||
}
|
||||
if (releaseModel.getApp() == 1) {
|
||||
createOrUpdate(new PortalReleasePrimary(portalId, PortalConst.APP), getModelDataForm(new PortalModPrimary(portalId)));
|
||||
}
|
||||
// visual.setPcSystemId(Optional.ofNullable(releaseModel.getPcSystemId()).orElse(releaseModel.getPcModuleParentId()));
|
||||
// visual.setAppSystemId(Optional.ofNullable(releaseModel.getAppSystemId()).orElse(releaseModel.getAppModuleParentId()));
|
||||
visual.setType(8);
|
||||
visual.setFullName(info.getFullName());
|
||||
visual.setEncode(info.getEnCode());
|
||||
visual.setId(info.getId());
|
||||
pubulishUtil.publishMenu(visual);
|
||||
info.setState(1);
|
||||
info.setEnabledMark(1);
|
||||
portalService.update(portalId,info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isReleaseFlag(PortalReleasePrimary primary) {
|
||||
return count(primary.getQuery()) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteAll(String portalId) {
|
||||
QueryWrapper<PortalDataEntity> query = new QueryWrapper<>();
|
||||
query.lambda().eq(PortalDataEntity::getPortalId, portalId);
|
||||
return remove(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建或更新
|
||||
*
|
||||
* 门户ID ->(平台、系统ID、用户ID)-> 排版信息
|
||||
* 基础:门户ID绑定排版信息(一对多)、 条件:平台、系统ID、用户ID
|
||||
*/
|
||||
@Override
|
||||
public void createOrUpdate(PortalCustomPrimary primary, String formData) throws Exception {
|
||||
creUpCom(primary, formData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createOrUpdate(PortalModPrimary primary, String formData) throws Exception {
|
||||
creUpCom(primary, formData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createOrUpdate(PortalReleasePrimary primary, String formData) throws Exception {
|
||||
creUpCom(primary, formData);
|
||||
}
|
||||
|
||||
private void creUpCom(MyBatisPrimaryBase<PortalDataEntity> primary, String formData) throws Exception {
|
||||
// 自定义数据变量条件:0、门户 1、用户 2、系统 3、平台
|
||||
List<PortalDataEntity> list = list(primary.getQuery());
|
||||
if(list.size() < 1){
|
||||
PortalDataEntity creEntity = primary.getEntity();
|
||||
creEntity.setFormData(formData);
|
||||
save(creEntity);
|
||||
}else if(list.size() == 1){
|
||||
PortalDataEntity upEntity = list.get(0);
|
||||
upEntity.setFormData(formData);
|
||||
updateById(upEntity);
|
||||
}else {
|
||||
throw new Exception(MsgCode.VS414.get());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id返回门户信息
|
||||
*/
|
||||
@Override
|
||||
public PortalInfoAuthVO getDataFormView(String portalId, String platform) throws Exception{
|
||||
PortalEntity entity = portalService.getInfo(portalId);
|
||||
if (entity == null) throw new Exception(MsgCode.VS415.get());
|
||||
// if (entity.getEnabledMark() == 0) throw new Exception("门户被禁止");
|
||||
PortalInfoAuthVO infoVo = JsonUtil.getJsonToBean(JsonUtilEx.getObjectToStringDateFormat
|
||||
(entity, "yyyy-MM-dd HH:mm:ss"), PortalInfoAuthVO.class);
|
||||
// 查询自定义设计的门户信息
|
||||
infoVo.setFormData(getDataForm(platform, portalId));
|
||||
return infoVo;
|
||||
}
|
||||
|
||||
private String getDataForm(String platform, String portalId) throws Exception {
|
||||
List<PortalDataEntity> dataList = list(new PortalCustomPrimary(platform, portalId).getQuery());
|
||||
if(CollectionUtil.isEmpty(dataList)) {
|
||||
dataList = list(new PortalReleasePrimary(portalId, platform).getQuery());
|
||||
}
|
||||
// 当没有自定义的排版信息时,使用已发布模板排版信息
|
||||
if(CollectionUtil.isNotEmpty(dataList)){
|
||||
PortalDataEntity entity = dataList.get(0);
|
||||
if (dataList.size() != 1) {
|
||||
List<String> ids = dataList.stream().map(PortalDataEntity::getId).collect(Collectors.toList());
|
||||
removeBatchByIds(ids.stream().filter(id -> !id.equals(entity.getId())).collect(Collectors.toList()));
|
||||
}
|
||||
return entity.getFormData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置门户默认主页
|
||||
*
|
||||
* 用户ID -> (平台、系统ID) -> 门户ID
|
||||
* 基础:用户ID绑定门户ID(多对多)、条件:平台、系统ID
|
||||
* Map格式:Map <platform:systemId, portalId>
|
||||
* @param portalId 门户ID
|
||||
* @param platform 平台
|
||||
*/
|
||||
@Override
|
||||
public void setCurrentDefault(String platform, String portalId) {
|
||||
UserEntity userEntity = userService.getInfo(UserProvider.getUser().getUserId());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
try{
|
||||
map = JSONObject.parseObject(userEntity.getPortalId()).getInnerMap();
|
||||
}catch (Exception ignore){}
|
||||
if ("App".equals(platform)) {
|
||||
map.put(platform + ":" + userEntity.getAppSystemId(), portalId);
|
||||
} else {
|
||||
map.put(platform + ":" + userEntity.getSystemId(), portalId);
|
||||
}
|
||||
UserEntity update = new UserEntity();
|
||||
update.setId(userEntity.getId());
|
||||
update.setPortalId(JSONObject.toJSONString(map));
|
||||
userService.updateById(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentDefault(String platform) throws Exception {
|
||||
UserEntity userEntity = userService.getInfo(UserProvider.getUser().getUserId());
|
||||
String systemId = PortalConst.WEB.equals(platform) ? UserProvider.getUser().getSystemId() : UserProvider.getUser().getAppSystemId();
|
||||
String portalId = "";
|
||||
try{
|
||||
Map<String, Object> map = JSONObject.parseObject(userEntity.getPortalId()).getInnerMap();
|
||||
portalId = map.get(platform + ":" + systemId).toString();
|
||||
}catch (Exception ignore){}
|
||||
PortalEntity mainPortal = portalService.getById(portalId);
|
||||
// 校验门户有效性
|
||||
if(mainPortal != null && mainPortal.getEnabledMark().equals(1)){
|
||||
// 管理员直接设置默认主页
|
||||
List<String> authPortalIds;
|
||||
if(UserProvider.getUser().getIsAdministrator()){
|
||||
List<PortalManageVO> currentVoList = portalManageApi.getListByEnable(new PortalManagePrimary(platform, null, systemId));
|
||||
authPortalIds = currentVoList.stream().map(PortalManageVO::getPortalId).collect(Collectors.toList());
|
||||
}else {
|
||||
// 获取当前用户的所有权限的门户ID集合
|
||||
authPortalIds = getCurrentAuthPortalIds(new PortalViewPrimary(platform, null));
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(authPortalIds) && authPortalIds.contains(portalId)) {
|
||||
return portalId;
|
||||
}
|
||||
}
|
||||
// 重新设置默认门户
|
||||
String updatePortalId = portalService.getModListFirstId(new PortalViewPrimary(platform, null));
|
||||
setCurrentDefault(platform, updatePortalId);
|
||||
return updatePortalId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当下所有带权限PortalId集合
|
||||
*/
|
||||
public List<String> getCurrentAuthPortalIds(PortalViewPrimary primary){
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
String systemId = primary.getSystemId();
|
||||
|
||||
// 获取用户底下所有权限portalManage
|
||||
Supplier<List<String>> authPortalManageIds = ()->{
|
||||
List<String> roleIds = permissionGroupApi.getPermissionGroupByUserId(userInfo.getUserId(), userInfo.getOrganizeId(), false, null).stream().map(PermissionGroupEntity::getId).collect(Collectors.toList());
|
||||
List<String> portalManageIds = new ArrayList<>();
|
||||
for (String roleId : roleIds) {
|
||||
/* authorize存储 portalManage->item、role->object,本质:门户管理条目与角色关系
|
||||
根据用户Id查询出对应所有的门户管理条目(distinct()进行去重) */
|
||||
List<AuthorizeEntity> authorizePortalManage = authorizeService.getListByObjectId(roleId, PortalConst.AUTHORIZE_PORTAL_MANAGE);
|
||||
portalManageIds.addAll(authorizePortalManage.stream()
|
||||
.map(AuthorizeEntity::getItemId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
return portalManageIds;
|
||||
};
|
||||
|
||||
List<String> portalManageIds = authPortalManageIds.get();
|
||||
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
// 获取具有权限的所有门户
|
||||
if(portalManageIds.size() > 0) {
|
||||
QueryWrapper<PortalManageEntity> query = new QueryWrapper<>();
|
||||
query.lambda().eq(PortalManageEntity::getEnabledMark, 1)
|
||||
.eq(PortalManageEntity::getPlatform, primary.getPlatForm())
|
||||
.in(PortalManageEntity::getId, portalManageIds);
|
||||
List<PortalManageEntity> portalManageList = portalManageApi.list(query);
|
||||
Map<String, List<PortalManageEntity>> collect = portalManageList.stream().collect(Collectors.groupingBy(PortalManageEntity::getSystemId));
|
||||
// key:systemId 、 value:portalIdList
|
||||
collect.forEach((key, description) -> map.put(key, description.stream().map(PortalManageEntity::getPortalId).collect(Collectors.toList())));
|
||||
return map.get(systemId);
|
||||
}else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/* ============== 目前使用懒加载更新主页,故注释 =============== */
|
||||
// /**
|
||||
// * 校验:当前用户的默认门户首页是否还具备权限
|
||||
// * (当权限被删除,默认首页丢失)
|
||||
// */
|
||||
// private void checkDefaultPortal(List<String> originRoleIds, List<String> updateRoleIds, String portalManageId){
|
||||
// // 若是新增角色不会对默认门户产生影响
|
||||
// List<String> delRoleIds = originRoleIds.stream().filter(o -> !updateRoleIds.contains(o))
|
||||
// .collect(Collectors.toList());
|
||||
// if(CollectionUtil.isNotEmpty(delRoleIds)){
|
||||
// // 授权取消所涉及到用户集合
|
||||
// List<UserEntity> userList = userService.getListByRoleIds(delRoleIds);
|
||||
// for (UserEntity userEntity : userList) {
|
||||
// String userId = userEntity.getId();
|
||||
// // 获取各系统下带权限的门户ID(这里跨服务会产生数据不同步的问题)
|
||||
// Map<String, List<String>> authorizeSysPortalIdsMap = getAuthorizePortalIds(userId);
|
||||
// // 获取原始各系统下默认门户ID
|
||||
// Map<String, String> sysDefaultPortalIdMap = portalManageService.getDefault(userEntity.getId());
|
||||
// for (Map.Entry<String, String> defaultMap : sysDefaultPortalIdMap.entrySet()) {
|
||||
// String systemId = defaultMap.getKey();
|
||||
// // 默认门户ID
|
||||
// String defaultPortalId = defaultMap.getValue();
|
||||
// // 带权限门户ID
|
||||
// List<String> authorizePortalIds = authorizeSysPortalIdsMap.get(systemId);
|
||||
// if(CollectionUtil.isNotEmpty(authorizePortalIds)){
|
||||
// if(!authorizePortalIds.contains(defaultPortalId)){
|
||||
// // 丢失默认门户,顺位首个
|
||||
// portalManageService.setDefault(userId, systemId, authorizePortalIds.get(0));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,398 @@
|
||||
package com.yunzhupaas.portal.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.entity.ModuleEntity;
|
||||
import com.yunzhupaas.base.entity.PortalManageEntity;
|
||||
import com.yunzhupaas.base.entity.SystemEntity;
|
||||
import com.yunzhupaas.base.model.VisualFunctionModel;
|
||||
import com.yunzhupaas.base.model.base.SystemListVO;
|
||||
import com.yunzhupaas.base.model.base.SystemPageVO;
|
||||
import com.yunzhupaas.base.model.module.ModuleNameVO;
|
||||
import com.yunzhupaas.base.model.portalManage.PortalManagePage;
|
||||
import com.yunzhupaas.base.model.portalManage.PortalManagePageDO;
|
||||
import com.yunzhupaas.base.model.portalManage.PortalManagePrimary;
|
||||
import com.yunzhupaas.base.model.portalManage.PortalManageVO;
|
||||
import com.yunzhupaas.base.service.*;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.service.UserService;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
import com.yunzhupaas.portal.mapper.PortalMapper;
|
||||
import com.yunzhupaas.portal.model.*;
|
||||
import com.yunzhupaas.portal.service.PortalDataService;
|
||||
import com.yunzhupaas.portal.service.PortalService;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.util.enums.DictionaryDataEnum;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Service
|
||||
public class PortalServiceImpl extends SuperServiceImpl<PortalMapper, PortalEntity> implements PortalService {
|
||||
|
||||
@Autowired
|
||||
private PortalService portalService;
|
||||
@Autowired
|
||||
private PortalManageService portalManageService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private DictionaryDataService dictionaryDataService;
|
||||
@Autowired
|
||||
private DictionaryTypeService dictionaryTypeService;
|
||||
@Autowired
|
||||
private PortalDataService portalDataService;
|
||||
@Autowired
|
||||
private SystemService systemApi;
|
||||
@Autowired
|
||||
private ModuleService moduleApi;
|
||||
|
||||
@Override
|
||||
public List<PortalEntity> getList(PortalPagination portalPagination) {
|
||||
return getList(portalPagination, new QueryWrapper<>());
|
||||
}
|
||||
|
||||
public List<PortalEntity> getList(PortalPagination portalPagination, QueryWrapper<PortalEntity> queryWrapper) {
|
||||
// 定义变量判断是否需要使用修改时间倒序
|
||||
boolean flag = false;
|
||||
// 模糊查询
|
||||
if (!StringUtil.isEmpty(portalPagination.getKeyword())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().and(q-> q.like(PortalEntity::getFullName, portalPagination.getKeyword()).or()
|
||||
.like(PortalEntity::getEnCode, portalPagination.getKeyword()));
|
||||
}
|
||||
// 分类(数据字典)
|
||||
if (StringUtil.isNotEmpty(portalPagination.getCategory())) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(PortalEntity::getCategory, portalPagination.getCategory());
|
||||
}
|
||||
// 类型(0-页面设计,1-自定义路径)
|
||||
if (portalPagination.getType() != null) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(PortalEntity::getType, portalPagination.getType());
|
||||
}
|
||||
// 锁定
|
||||
if (portalPagination.getEnabledLock() != null) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(PortalEntity::getEnabledLock, portalPagination.getEnabledLock());
|
||||
}
|
||||
// 发布状态
|
||||
if (portalPagination.getIsRelease() != null) {
|
||||
flag = true;
|
||||
queryWrapper.lambda().eq(PortalEntity::getState, portalPagination.getIsRelease());
|
||||
}
|
||||
// 排序
|
||||
queryWrapper.lambda().orderByAsc(PortalEntity::getSortCode).orderByDesc(PortalEntity::getCreatorTime);
|
||||
if (flag) {
|
||||
queryWrapper.lambda().orderByDesc(PortalEntity::getLastModifyTime);
|
||||
}
|
||||
// 分页
|
||||
Page<PortalEntity> page = new Page<>(portalPagination.getCurrentPage(), portalPagination.getPageSize());
|
||||
IPage<PortalEntity> userPage = this.page(page, queryWrapper);
|
||||
return portalPagination.setData(userPage.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortalEntity getInfo(String id) {
|
||||
QueryWrapper<PortalEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(PortalEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean isExistByFullName(String fullName, String id) {
|
||||
QueryWrapper<PortalEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(PortalEntity::getFullName, fullName);
|
||||
return isExistCommon(queryWrapper, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isExistByEnCode(String enCode, String id) {
|
||||
QueryWrapper<PortalEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(PortalEntity::getEnCode, enCode);
|
||||
return isExistCommon(queryWrapper, id);
|
||||
}
|
||||
|
||||
private Boolean isExistCommon(QueryWrapper<PortalEntity> queryWrapper, String id){
|
||||
if (!StringUtil.isEmpty(id)) queryWrapper.lambda().ne(PortalEntity::getId, id);
|
||||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(PortalEntity entity) {
|
||||
if (StringUtil.isEmpty(entity.getId())) {
|
||||
entity.setId(RandomUtil.uuId());
|
||||
}
|
||||
entity.setState(0);
|
||||
entity.setEnabledMark(0);
|
||||
this.setIgnoreLogicDelete().saveOrUpdate(entity);
|
||||
this.clearIgnoreLogicDelete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(String id, PortalEntity entity) {
|
||||
entity.setId(id);
|
||||
entity.setLastModifyTime(DateUtil.getNowDate());
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(PortalEntity entity) throws Exception{
|
||||
// 0、门户管理判断(已绑定系统不允许删除)
|
||||
List<PortalManageVO> portalManageList = portalManageService.getList(new PortalManagePrimary(null, entity.getId(), null));
|
||||
if (portalManageList.size() > 0) {
|
||||
List<String> sysNameList = portalManageList.stream().map(manage -> {
|
||||
try{
|
||||
return systemApi.getInfo(manage.getSystemId()).getFullName();
|
||||
}catch (Exception ignore){ return ""; }
|
||||
}).collect(Collectors.toList());
|
||||
String sysName = sysNameList.get(0);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("此记录被\"【"+sysName+"】应用门户\"关联引用,不允许被删除");
|
||||
throw new Exception(buffer.toString());
|
||||
}
|
||||
// 1、删除门户设置数据(数据删除可提示用户确认)
|
||||
portalDataService.deleteAll(entity.getId());
|
||||
portalService.removeById(entity.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortalSelectVO> getManageSelectorPage(PortalPagination pagination, String systemId) {
|
||||
// 根据系统ID、平台获取
|
||||
List<PortalManageVO> manageVOList = portalManageService.getList(new PortalManagePrimary(pagination.getPlatform(), null, systemId));
|
||||
Set<String> usedPortalIds = manageVOList.stream().map(PortalManageVO::getPortalId).collect(Collectors.toSet());
|
||||
QueryWrapper<PortalEntity> query = new QueryWrapper<>();
|
||||
// 已绑定的门户,不再出现在下拉列表
|
||||
if(usedPortalIds.size() > 0) query.lambda().notIn(PortalEntity::getId, usedPortalIds);
|
||||
query.lambda().eq(PortalEntity::getEnabledMark, 1);
|
||||
List<PortalEntity> portalList = getList(pagination, query);
|
||||
List<PortalSelectVO> voList = new ArrayList<>();
|
||||
portalList.forEach(entity->{
|
||||
PortalSelectVO vo = new PortalSelectVO();
|
||||
vo.setId(entity.getId());
|
||||
vo.setFullName(entity.getFullName());
|
||||
vo.setEnCode(entity.getEnCode());
|
||||
DictionaryDataEntity dicEntity = dictionaryDataService.getInfo(entity.getCategory());
|
||||
if(dicEntity!=null) {
|
||||
vo.setCategory(dicEntity.getFullName());
|
||||
vo.setCategoryName(dicEntity.getFullName());
|
||||
vo.setCategoryId(dicEntity.getId());
|
||||
}
|
||||
voList.add(vo);
|
||||
});
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModListFirstId(PortalViewPrimary primary){
|
||||
try{
|
||||
List<PortalSelectModel> modList = getModList(primary);
|
||||
PortalSelectModel first = modList.stream().filter(mod -> mod.getParentId().equals("0")).findFirst().get();
|
||||
PortalSelectModel firstPortal = modList.stream().filter(mod -> mod.getParentId().equals(first.getId())).findFirst().get();
|
||||
return firstPortal.getId();
|
||||
}catch (Exception e){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortalSelectModel> getModList(PortalViewPrimary primary) {
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
List<String> portalIds;
|
||||
if(userInfo.getIsAdministrator()){
|
||||
portalIds = portalManageService.getListByEnable(new PortalManagePrimary(primary.getPlatForm(), null, primary.getSystemId()))
|
||||
.stream().map(PortalManageVO::getPortalId).collect(Collectors.toList());
|
||||
}else {
|
||||
portalIds = portalDataService.getCurrentAuthPortalIds(primary);
|
||||
}
|
||||
PortalManagePage page =new PortalManagePage();
|
||||
page.setEnabledMark(1);
|
||||
page.setPlatform(primary.getPlatForm());
|
||||
page.setSystemId(primary.getSystemId());
|
||||
page.setState(0);
|
||||
List<PortalManagePageDO> selectList = portalManageService.getSelectList(page);
|
||||
List<PortalEntity> resultList = new ArrayList<>();
|
||||
for (PortalManagePageDO portalManagePageDO : selectList) {
|
||||
if(portalIds.contains(portalManagePageDO.getPortalId())){
|
||||
PortalEntity entity = new PortalEntity();
|
||||
entity.setId(portalManagePageDO.getPortalId());
|
||||
entity.setFullName(portalManagePageDO.getPortalName());
|
||||
entity.setCategory(portalManagePageDO.getCategoryId());
|
||||
resultList.add(entity);
|
||||
}
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(portalIds)){
|
||||
return getModelList(resultList.stream().distinct().collect(Collectors.toList()));
|
||||
}else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortalSelectModel> getModSelectList() {
|
||||
QueryWrapper<PortalEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(PortalEntity::getEnabledMark,1);
|
||||
List<PortalEntity> list = this.list(queryWrapper);
|
||||
return getModelList(list);
|
||||
}
|
||||
|
||||
private List<PortalSelectModel> getModelList(List<PortalEntity> portalList){
|
||||
List<PortalSelectModel> modelList = JsonUtil.getJsonToList(portalList, PortalSelectModel.class);
|
||||
// 外层菜单排序取数据字典
|
||||
List<DictionaryDataEntity> dictionaryList = dictionaryDataService.getListByTypeDataCode(DictionaryDataEnum.VISUALDEV_PORTAL.getDictionaryTypeId());
|
||||
for (DictionaryDataEntity dictionary : dictionaryList) {
|
||||
List<PortalSelectModel> models = modelList.stream().filter(model->model.getParentId().equals(dictionary.getId())).collect(Collectors.toList());
|
||||
if(models.size() > 0){
|
||||
PortalSelectModel model = new PortalSelectModel();
|
||||
model.setId(dictionary.getId());
|
||||
model.setFullName(dictionary.getFullName());
|
||||
model.setParentId("0");
|
||||
if (!modelList.contains(model)) {
|
||||
modelList.add(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
return modelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VisualFunctionModel> getModelList(PortalPagination pagination) {
|
||||
List<PortalEntity> data = portalService.getList(pagination);
|
||||
List<String> userId = data.stream().map(t -> t.getCreatorUserId()).collect(Collectors.toList());
|
||||
List<String> lastUserId = data.stream().map(t -> t.getLastModifyUserId()).collect(Collectors.toList());
|
||||
List<UserEntity> userEntities = userService.getUserName(userId);
|
||||
List<UserEntity> lastUserIdEntities = userService.getUserName(lastUserId);
|
||||
List<DictionaryDataEntity> dictionList = dictionaryDataService.getListByTypeDataCode(DictionaryDataEnum.VISUALDEV_PORTAL.getDictionaryTypeId());
|
||||
List<VisualFunctionModel> modelAll = new LinkedList<>();
|
||||
// 发布判断
|
||||
|
||||
for (PortalEntity entity : data) {
|
||||
VisualFunctionModel model = JsonUtil.getJsonToBean(entity, VisualFunctionModel.class);
|
||||
|
||||
DictionaryDataEntity dataEntity = dictionList.stream().filter(t -> t.getId().equals(entity.getCategory())).findFirst().orElse(null);
|
||||
if (dataEntity != null) {
|
||||
model.setCategory(dataEntity.getFullName());
|
||||
UserEntity creatorUser = userEntities.stream().filter(t -> t.getId().equals(model.getCreatorUserId())).findFirst().orElse(null);
|
||||
if (creatorUser != null) {
|
||||
model.setCreatorUser(creatorUser.getRealName() + "/" + creatorUser.getAccount());
|
||||
} else {
|
||||
model.setCreatorUser("");
|
||||
}
|
||||
UserEntity lastmodifyuser = lastUserIdEntities.stream().filter(t -> t.getId().equals(model.getLastModifyUserId())).findFirst().orElse(null);
|
||||
if (lastmodifyuser != null) {
|
||||
model.setLastModifyUser(lastmodifyuser.getRealName() + "/" + lastmodifyuser.getAccount());
|
||||
} else {
|
||||
model.setLastModifyUser("");
|
||||
}
|
||||
if (Objects.isNull(model.getSortCode())) {
|
||||
model.setSortCode(0L);
|
||||
}
|
||||
model.setIsRelease(entity.getState());
|
||||
modelAll.add(model);
|
||||
}
|
||||
}
|
||||
return modelAll.stream().sorted(Comparator.comparing(VisualFunctionModel::getSortCode)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发布信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public VisualFunctionModel getReleaseInfo(String id) {
|
||||
VisualFunctionModel model =new VisualFunctionModel();
|
||||
model.setPcIsRelease(0);
|
||||
model.setAppIsRelease(0);
|
||||
model.setPcPortalIsRelease(0);
|
||||
model.setAppPortalIsRelease(0);
|
||||
List<SystemEntity> sysList = systemApi.getList();
|
||||
List<PortalManageEntity> isReleaseList = portalManageService.list();
|
||||
ModuleNameVO moduleNameVO = moduleApi.getModuleNameList(id);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(isReleaseList)){
|
||||
List<PortalManageEntity> webPortalList = isReleaseList.stream().filter(vo -> vo.getPortalId().equalsIgnoreCase(id)
|
||||
&& PortalConst.WEB.equalsIgnoreCase(vo.getPlatform())).collect(Collectors.toList());
|
||||
StringJoiner webStr = new StringJoiner(";");
|
||||
for (PortalManageEntity item : webPortalList) {
|
||||
SystemEntity systemEntity = sysList.stream().filter(t -> t.getId().equals(item.getSystemId())).findFirst().orElse(null);
|
||||
if(systemEntity!=null){
|
||||
webStr.add(systemEntity.getFullName());
|
||||
}
|
||||
}
|
||||
if(StringUtil.isNotEmpty(webStr.toString())){
|
||||
model.setPcPortalIsRelease(1);
|
||||
model.setPcPortalReleaseName(webStr.toString());
|
||||
}
|
||||
List<PortalManageEntity> appPortalList = isReleaseList.stream().filter(vo -> vo.getPortalId().equalsIgnoreCase(id)
|
||||
&& PortalConst.APP.equalsIgnoreCase(vo.getPlatform())).collect(Collectors.toList());
|
||||
StringJoiner appStr = new StringJoiner(";");
|
||||
for (PortalManageEntity item : appPortalList) {
|
||||
SystemEntity systemEntity = sysList.stream().filter(t -> t.getId().equals(item.getSystemId())).findFirst().orElse(null);
|
||||
if(systemEntity!=null){
|
||||
appStr.add(systemEntity.getFullName());
|
||||
}
|
||||
}
|
||||
if(StringUtil.isNotEmpty(appStr.toString())){
|
||||
model.setAppPortalIsRelease(1);
|
||||
model.setAppPortalReleaseName(appStr.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if(moduleNameVO!=null){
|
||||
if(StringUtil.isNotEmpty(moduleNameVO.getPcNames())){
|
||||
model.setPcIsRelease(1);
|
||||
model.setPcReleaseName(moduleNameVO.getPcNames());
|
||||
}
|
||||
if(StringUtil.isNotEmpty(moduleNameVO.getAppNames())){
|
||||
model.setAppIsRelease(1);
|
||||
model.setAppReleaseName(moduleNameVO.getAppNames());
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemListVO> systemFilterList(String id,String category) {
|
||||
List<SystemEntity> list = systemApi.getList(null, true, true, true, true, new ArrayList<>());
|
||||
List<SystemListVO> jsonToList = JsonUtil.getJsonToList(list, SystemListVO.class);
|
||||
List<PortalManageEntity> isReleaseList = portalManageService.list();
|
||||
List<PortalManageEntity> webPortalList;
|
||||
if(PortalConst.APP.equalsIgnoreCase(category)){
|
||||
webPortalList = isReleaseList.stream().filter(vo -> vo.getPortalId().equalsIgnoreCase(id)
|
||||
&& PortalConst.APP.equalsIgnoreCase(vo.getPlatform())).collect(Collectors.toList());
|
||||
}else {
|
||||
webPortalList = isReleaseList.stream().filter(vo -> vo.getPortalId().equalsIgnoreCase(id)
|
||||
&& PortalConst.WEB.equalsIgnoreCase(vo.getPlatform())).collect(Collectors.toList());
|
||||
}
|
||||
List<String> collect = webPortalList.stream().map(PortalManageEntity::getSystemId).collect(Collectors.toList());
|
||||
for (SystemListVO item : jsonToList) {
|
||||
if(collect.contains(item.getId())){
|
||||
item.setDisabled(true);
|
||||
}
|
||||
}
|
||||
return jsonToList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user