初始代码
This commit is contained in:
21
yunzhupaas-visualdev/yunzhupaas-visualdev-portal/pom.xml
Normal file
21
yunzhupaas-visualdev/yunzhupaas-visualdev-portal/pom.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-visualdev-portal</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>yunzhupaas-visualdev-portal-entity</module>
|
||||
<module>yunzhupaas-visualdev-portal-biz</module>
|
||||
<module>yunzhupaas-visualdev-portal-controller</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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-controller</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-portal-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-provider</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-extend-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.yunzhupaas.portal.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.flowable.model.operator.OperatorVo;
|
||||
import com.yunzhupaas.flowable.model.task.TaskPagination;
|
||||
import com.yunzhupaas.message.model.NoticeModel;
|
||||
import com.yunzhupaas.message.model.message.NoticeVO;
|
||||
import com.yunzhupaas.message.service.MessageService;
|
||||
import com.yunzhupaas.portal.model.*;
|
||||
import com.yunzhupaas.service.EmailReceiveService;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.workflow.service.TaskApi;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主页控制器
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "主页控制器", description = "Home")
|
||||
@RestController
|
||||
@RequestMapping("api/visualdev/Dashboard")
|
||||
public class DashboardController {
|
||||
@Autowired
|
||||
private TaskApi taskApi;
|
||||
@Autowired
|
||||
private EmailReceiveService emailReceiveService;
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取我的待办
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取我的待办")
|
||||
@PostMapping("/FlowTodoCount")
|
||||
public ActionResult getFlowTodoCount(@RequestBody FlowTodo flowTodo) {
|
||||
FlowTodoCountVO vo = new FlowTodoCountVO();
|
||||
TaskPagination pagination = new TaskPagination();
|
||||
pagination.setDelegateType(true);
|
||||
pagination.setPageSize(1L);
|
||||
pagination.setCurrentPage(1L);
|
||||
pagination.setFlowCategory(String.join(",",flowTodo.getFlowToSignType()));
|
||||
pagination.setCategory("0");
|
||||
taskApi.getWaitList(pagination);
|
||||
vo.setFlowToSign(pagination.getTotal());
|
||||
|
||||
pagination.setFlowCategory(String.join(",",flowTodo.getFlowTodoType()));
|
||||
pagination.setCategory("1");
|
||||
taskApi.getWaitList(pagination);
|
||||
vo.setFlowTodo(pagination.getTotal());
|
||||
|
||||
pagination.setFlowCategory(String.join(",",flowTodo.getFlowDoingType()));
|
||||
pagination.setCategory("2");
|
||||
taskApi.getWaitList(pagination);
|
||||
vo.setFlowDoing(pagination.getTotal());
|
||||
|
||||
pagination.setTotal(0);
|
||||
pagination.setFlowCategory(String.join(",",flowTodo.getFlowDoneType()));
|
||||
taskApi.getTrialList(pagination);
|
||||
vo.setFlowDone(pagination.getTotal());
|
||||
|
||||
pagination.setFlowCategory(String.join(",",flowTodo.getFlowCirculateType()));
|
||||
taskApi.getCirculateList(pagination);
|
||||
vo.setFlowCirculate(pagination.getTotal());
|
||||
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通知公告
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取通知公告")
|
||||
@PostMapping("/Notice")
|
||||
public ActionResult getNotice(@RequestBody NoticeModel noticeModel) {
|
||||
List<NoticeVO> list = JsonUtil.getJsonToList(messageService.getNoticeList(noticeModel.getTypeList()), NoticeVO.class);
|
||||
ListVO<NoticeVO> voList = new ListVO();
|
||||
voList.setList(list);
|
||||
return ActionResult.success(voList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未读邮件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取未读邮件")
|
||||
@GetMapping("/Email")
|
||||
public ActionResult getEmail() {
|
||||
List<EmailVO> list = JsonUtil.getJsonToList(emailReceiveService.getDashboardReceiveList(), EmailVO.class);
|
||||
ListVO<EmailVO> voList = new ListVO<>();
|
||||
voList.setList(list);
|
||||
return ActionResult.success(voList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待办事项
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取待办事项")
|
||||
@GetMapping("/FlowTodo")
|
||||
public ActionResult getFlowTodo(@RequestParam("type") Integer type) {
|
||||
TaskPagination pagination = new TaskPagination();
|
||||
pagination.setDelegateType(true);
|
||||
pagination.setPageSize(10L);
|
||||
pagination.setCurrentPage(1L);
|
||||
String category;
|
||||
switch (type) {
|
||||
case 1:
|
||||
category = "0";
|
||||
break;
|
||||
case 2:
|
||||
category = "1";
|
||||
break;
|
||||
default:
|
||||
category = "2";
|
||||
}
|
||||
pagination.setCategory(category);
|
||||
List<OperatorVo> waitList = taskApi.getWaitList(pagination);
|
||||
List<FlowTodoVO> list = new ArrayList<>();
|
||||
for (OperatorVo operatorVo : waitList) {
|
||||
FlowTodoVO vo = JsonUtil.getJsonToBean(operatorVo, FlowTodoVO.class);
|
||||
vo.setTaskNodeId(operatorVo.getNodeCode());
|
||||
vo.setTaskOperatorId(operatorVo.getId());
|
||||
vo.setType(2);
|
||||
list.add(vo);
|
||||
}
|
||||
ListVO voList = new ListVO<>();
|
||||
voList.setList(list);
|
||||
return ActionResult.success(voList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的待办事项
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "获取我的待办事项")
|
||||
@GetMapping("/MyFlowTodo")
|
||||
public ActionResult getMyFlowTodo() {
|
||||
TaskPagination pagination = new TaskPagination();
|
||||
pagination.setCategory("2");
|
||||
List<MyFlowTodoVO> list = JsonUtil.getJsonToList(taskApi.getWaitList(pagination), MyFlowTodoVO.class);
|
||||
ListVO<MyFlowTodoVO> voList = new ListVO<>();
|
||||
voList.setList(list);
|
||||
return ActionResult.success(voList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
package com.yunzhupaas.portal.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.controller.SuperController;
|
||||
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.service.ModuleService;
|
||||
import com.yunzhupaas.base.service.PortalManageService;
|
||||
import com.yunzhupaas.base.service.SystemService;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.base.vo.ListVO;
|
||||
import com.yunzhupaas.base.vo.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.emnus.ExportModelTypeEnum;
|
||||
import com.yunzhupaas.emnus.ModuleTypeEnum;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
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.treeutil.SumTree;
|
||||
import com.yunzhupaas.util.treeutil.newtreeutil.TreeDotUtils;
|
||||
import com.yunzhupaas.util.treeutil.newtreeutil.TreeDotUtils2;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 可视化门户
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "可视化门户" , description = "Portal" )
|
||||
@RequestMapping("/api/visualdev/Portal" )
|
||||
public class PortalController extends SuperController<PortalService, PortalEntity> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PortalService portalService;
|
||||
@Autowired
|
||||
private FileExport fileExport;
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
@Autowired
|
||||
private PortalDataService portalDataService;
|
||||
|
||||
@Operation(summary = "门户列表" )
|
||||
@GetMapping
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
public ActionResult list(PortalPagination portalPagination) {
|
||||
List<VisualFunctionModel> modelAll = portalService.getModelList(portalPagination);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(portalPagination, PaginationVO.class);
|
||||
return ActionResult.page(modelAll, paginationVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "门户树形列表" )
|
||||
@Parameters({
|
||||
@Parameter(name = "type" , description = "类型:0-门户设计,1-配置路径" ),
|
||||
})
|
||||
@GetMapping("/Selector" )
|
||||
public ActionResult<ListVO<PortalSelectVO>> listSelect(String platform,String type) {
|
||||
List<PortalSelectModel> modelList = new ArrayList<>();
|
||||
if(StringUtil.isNotEmpty(type)){
|
||||
modelList.addAll(portalService.getModList(new PortalViewPrimary(platform, null)));
|
||||
}else {
|
||||
modelList.addAll(portalService.getModSelectList());
|
||||
}
|
||||
List<SumTree<PortalSelectModel>> sumTrees = TreeDotUtils2.convertListToTreeDot(modelList);
|
||||
List<PortalSelectVO> jsonToList = JsonUtil.getJsonToList(sumTrees, PortalSelectVO.class);
|
||||
return ActionResult.success(new ListVO<>(jsonToList));
|
||||
}
|
||||
|
||||
@Operation(summary = "门户详情" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@GetMapping("/{id}" )
|
||||
public ActionResult<PortalInfoVO> info(@PathVariable("id" ) String id, String platform) throws Exception {
|
||||
StpUtil.checkPermissionOr("onlineDev.visualPortal" , id);
|
||||
PortalEntity entity = portalService.getInfo(id);
|
||||
if (entity == null) {
|
||||
return ActionResult.fail(MsgCode.FA001.get());
|
||||
}
|
||||
PortalInfoVO vo = JsonUtil.getJsonToBean(JsonUtilEx.getObjectToStringDateFormat(entity, "yyyy-MM-dd HH:mm:ss" ), PortalInfoVO.class);
|
||||
vo.setFormData(portalDataService.getModelDataForm(new PortalModPrimary(id)));
|
||||
//获取发布信息
|
||||
VisualFunctionModel releaseInfo = portalService.getReleaseInfo(entity.getId());
|
||||
vo.setPcPortalIsRelease(releaseInfo.getPcPortalIsRelease());
|
||||
vo.setPcPortalReleaseName(releaseInfo.getPcPortalReleaseName());
|
||||
vo.setAppPortalIsRelease(releaseInfo.getAppPortalIsRelease());
|
||||
vo.setAppPortalReleaseName(releaseInfo.getAppPortalReleaseName());
|
||||
vo.setPcIsRelease(releaseInfo.getPcIsRelease());
|
||||
vo.setPcReleaseName(releaseInfo.getPcReleaseName());
|
||||
vo.setAppIsRelease(releaseInfo.getAppIsRelease());
|
||||
vo.setAppReleaseName(releaseInfo.getAppReleaseName());
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除门户" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@DeleteMapping("/{id}" )
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
@DSTransactional
|
||||
public ActionResult<String> delete(@PathVariable("id" ) String id) {
|
||||
PortalEntity entity = portalService.getInfo(id);
|
||||
if (entity != null) {
|
||||
try {
|
||||
portalService.delete(entity);
|
||||
} catch (Exception e) {
|
||||
return ActionResult.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "创建门户" )
|
||||
@PostMapping()
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
@DSTransactional
|
||||
public ActionResult<String> create(@RequestBody @Valid PortalCrForm portalCrForm) throws Exception {
|
||||
PortalEntity entity = JsonUtil.getJsonToBean(portalCrForm, PortalEntity.class);
|
||||
entity.setId(RandomUtil.uuId());
|
||||
//判断名称是否重复
|
||||
if (portalService.isExistByFullName(entity.getFullName(), entity.getId())) {
|
||||
return ActionResult.fail(MsgCode.EXIST001.get());
|
||||
}
|
||||
//判断编码是否重复
|
||||
if (portalService.isExistByEnCode(entity.getEnCode(), entity.getId())) {
|
||||
return ActionResult.fail(MsgCode.EXIST002.get());
|
||||
}
|
||||
// 修改模板排版数据
|
||||
if(Objects.equals(entity.getType(),1)){
|
||||
entity.setEnabledLock(null);
|
||||
}
|
||||
// 修改模板排版数据
|
||||
portalService.create(entity);
|
||||
portalDataService.createOrUpdate(new PortalModPrimary(entity.getId()), portalCrForm.getFormData());
|
||||
return ActionResult.success(MsgCode.SU001.get(), entity.getId());
|
||||
}
|
||||
|
||||
@Operation(summary = "复制功能" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@PostMapping("/{id}/Actions/Copy" )
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
public ActionResult copyInfo(@PathVariable("id" ) String id) throws Exception {
|
||||
PortalEntity entity = portalService.getInfo(id);
|
||||
entity.setEnabledMark(0);
|
||||
String copyNum = UUID.randomUUID().toString().substring(0, 5);
|
||||
entity.setFullName(entity.getFullName() + ".副本" + copyNum);
|
||||
entity.setLastModifyTime(null);
|
||||
entity.setLastModifyUserId(null);
|
||||
entity.setId(RandomUtil.uuId());
|
||||
entity.setEnCode(entity.getEnCode() + copyNum);
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setCreatorUserId(UserProvider.getUser().getUserId());
|
||||
PortalEntity entity1 = JsonUtil.getJsonToBean(entity, PortalEntity.class);
|
||||
if (entity1.getEnCode().length() > 50 || entity1.getFullName().length() > 50) {
|
||||
return ActionResult.fail(MsgCode.PRI006.get());
|
||||
}
|
||||
portalService.create(entity1);
|
||||
portalDataService.createOrUpdate(new PortalModPrimary(entity1.getId()),
|
||||
portalDataService.getModelDataForm(new PortalModPrimary(id)));
|
||||
return ActionResult.success(MsgCode.SU007.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "修改门户" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@PutMapping("/{id}" )
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
@DSTransactional
|
||||
public ActionResult<String> update(@PathVariable("id" ) String id, @RequestBody @Valid PortalUpForm portalUpForm) throws Exception {
|
||||
PortalEntity originEntity = portalService.getInfo(portalUpForm.getId());
|
||||
if(originEntity == null){
|
||||
ActionResult.fail(MsgCode.FA002.get());
|
||||
}
|
||||
//判断名称是否重复
|
||||
if (!originEntity.getFullName().equals(portalUpForm.getFullName()) && StringUtil.isNotEmpty(portalUpForm.getFullName())) {
|
||||
if (portalService.isExistByFullName(portalUpForm.getFullName(), portalUpForm.getId())) {
|
||||
return ActionResult.fail(MsgCode.EXIST001.get());
|
||||
}
|
||||
}
|
||||
//判断编码是否重复
|
||||
if (!originEntity.getEnCode().equals(portalUpForm.getEnCode()) && StringUtil.isNotEmpty(portalUpForm.getEnCode())) {
|
||||
if (portalService.isExistByEnCode(portalUpForm.getEnCode(), portalUpForm.getId())) {
|
||||
return ActionResult.fail(MsgCode.EXIST002.get());
|
||||
}
|
||||
}
|
||||
// 修改排版数据
|
||||
if(Objects.equals(portalUpForm.getType(),1)){
|
||||
portalUpForm.setEnabledLock(null);
|
||||
}
|
||||
//修改状态
|
||||
if(Objects.equals(originEntity.getState(),1)){
|
||||
originEntity.setState(2);
|
||||
portalUpForm.setState(2);
|
||||
}
|
||||
// 修改排版数据
|
||||
portalDataService.createOrUpdate(new PortalModPrimary(portalUpForm.getId()), portalUpForm.getFormData());
|
||||
if (StringUtil.isNotEmpty(portalUpForm.getFullName()) && StringUtil.isNotEmpty(portalUpForm.getEnCode())) {
|
||||
portalService.update(id, JsonUtil.getJsonToBean(portalUpForm, PortalEntity.class));
|
||||
}else {
|
||||
portalService.update(id, originEntity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "门户导出" )
|
||||
@Parameters({
|
||||
@Parameter(name = "modelId" , description = "模板id" ),
|
||||
})
|
||||
@PostMapping("/{modelId}/Actions/Export" )
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
public ActionResult exportFunction(@PathVariable("modelId" ) String modelId) throws Exception {
|
||||
PortalEntity entity = portalService.getInfo(modelId);
|
||||
if (entity != null) {
|
||||
PortalExportDataVo vo = new PortalExportDataVo();
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
vo.setId(entity.getId());
|
||||
vo.setModelType(ExportModelTypeEnum.Portal.getMessage());
|
||||
vo.setFormData(portalDataService.getModelDataForm(new PortalModPrimary(entity.getId())));
|
||||
DownloadVO downloadVO = fileExport.exportFile(vo, configValueUtil.getTemporaryFilePath(), entity.getFullName(), ModuleTypeEnum.VISUAL_PORTAL.getTableName());
|
||||
return ActionResult.success(downloadVO);
|
||||
} else {
|
||||
return ActionResult.success(MsgCode.FA001.get());
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Operation(summary = "门户导入" )
|
||||
@Parameters({
|
||||
@Parameter(name = "file" , description = "导入文件" ),
|
||||
})
|
||||
@PostMapping(value = "/Actions/Import" , consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@SaCheckPermission("onlineDev.visualPortal" )
|
||||
public ActionResult importFunction(@RequestPart("file" ) MultipartFile multipartFile,@RequestParam("type") Integer type) throws Exception {
|
||||
//判断是否为.json结尾
|
||||
if (FileUtil.existsSuffix(multipartFile, ModuleTypeEnum.VISUAL_PORTAL.getTableName())) {
|
||||
return ActionResult.fail(MsgCode.IMP002.get());
|
||||
}
|
||||
//获取文件内容
|
||||
String fileContent = FileUtil.getFileContent(multipartFile);
|
||||
PortalExportDataVo vo = JsonUtil.getJsonToBean(fileContent, PortalExportDataVo.class);
|
||||
if (vo.getModelType() == null || !vo.getModelType().equals(ExportModelTypeEnum.Portal.getMessage())) {
|
||||
return ActionResult.fail(MsgCode.VS410.get());
|
||||
}
|
||||
|
||||
PortalEntity entity = JsonUtil.getJsonToBean(fileContent, PortalEntity.class);
|
||||
StringJoiner errList = new StringJoiner("、");
|
||||
String copyNum = UUID.randomUUID().toString().substring(0, 5);
|
||||
if (portalService.getInfo(entity.getId()) != null) {
|
||||
if (Objects.equals(type, 0)) {
|
||||
errList.add("ID");
|
||||
}else{
|
||||
entity.setId(null);
|
||||
}
|
||||
}
|
||||
//判断编码是否重复
|
||||
if (portalService.isExistByEnCode(entity.getEnCode(), null)) {
|
||||
if (Objects.equals(type, 0)) {
|
||||
errList.add(MsgCode.IMP009.get());
|
||||
} else {
|
||||
entity.setEnCode(entity.getEnCode() + copyNum);
|
||||
}
|
||||
}
|
||||
//判断名称是否重复
|
||||
if (portalService.isExistByFullName(entity.getFullName(), null)) {
|
||||
if (Objects.equals(type, 0)) {
|
||||
errList.add(MsgCode.IMP008.get());
|
||||
} else {
|
||||
entity.setFullName(entity.getFullName() + ".副本" + copyNum);
|
||||
}
|
||||
}
|
||||
|
||||
if (Objects.equals(type, 0) && errList.length() > 0) {
|
||||
return ActionResult.fail(errList + MsgCode.IMP007.get());
|
||||
}
|
||||
|
||||
portalService.setIgnoreLogicDelete().removeById(entity.getId());
|
||||
portalService.clearIgnoreLogicDelete();
|
||||
entity.setEnabledMark(0);
|
||||
entity.setSortCode(0l);
|
||||
entity.setCreatorTime(new Date());
|
||||
entity.setCreatorUserId(UserProvider.getUser().getUserId());
|
||||
entity.setLastModifyTime(null);
|
||||
entity.setLastModifyUserId(null);
|
||||
portalService.create(entity);
|
||||
portalDataService.createOrUpdate(new PortalModPrimary(entity.getId()), vo.getFormData());
|
||||
return ActionResult.success(MsgCode.IMP001.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "门户管理下拉列表" )
|
||||
@GetMapping("/manage/Selector/{systemId}" )
|
||||
public ActionResult<PageListVO<PortalSelectVO>> getManageSelectorList(@PathVariable String systemId, PortalPagination portalPagination) {
|
||||
portalPagination.setType(null); // 门户设计、配置路径。全选
|
||||
List<PortalSelectVO> voList = portalService.getManageSelectorPage(portalPagination, systemId);
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(portalPagination, PaginationVO.class);
|
||||
return ActionResult.page(voList, paginationVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "门户获取系统下拉" )
|
||||
@GetMapping("/systemFilter/{id}" )
|
||||
public ActionResult<ListVO<SystemListVO>> systemFilterList(@PathVariable("id") String id,String category) {
|
||||
List<SystemListVO> systemListVOS = portalService.systemFilterList(id, category);
|
||||
return ActionResult.success(new ListVO<>(systemListVOS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.yunzhupaas.portal.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.controller.SuperController;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
import com.yunzhupaas.portal.model.*;
|
||||
import com.yunzhupaas.portal.service.PortalDataService;
|
||||
import com.yunzhupaas.portal.service.PortalService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 可视化门户
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "门户展示界面" , description = "Portal" )
|
||||
@RequestMapping("/api/visualdev/Portal" )
|
||||
public class PortalDataController extends SuperController<PortalService, PortalEntity> {
|
||||
@Autowired
|
||||
private PortalDataService portalDataService;
|
||||
|
||||
@Operation(summary = "设置默认门户" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@PutMapping("/{id}/Actions/SetDefault" )
|
||||
@Transactional
|
||||
public ActionResult<String> SetDefault(@PathVariable("id") String id, String platform) {
|
||||
portalDataService.setCurrentDefault(platform, id);
|
||||
return ActionResult.success(MsgCode.SU016.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "门户自定义保存" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@PutMapping("/Custom/Save/{id}")
|
||||
public ActionResult<String> customSave(@PathVariable("id" ) String id, @RequestBody PortalDataForm portalDataForm) throws Exception {
|
||||
StpUtil.checkPermissionOr("onlineDev.visualPortal" , id);
|
||||
portalDataForm.setPortalId(id);
|
||||
portalDataService.createOrUpdate(
|
||||
new PortalCustomPrimary(portalDataForm.getPlatform(), portalDataForm.getPortalId()),
|
||||
portalDataForm.getFormData());
|
||||
return ActionResult.success(MsgCode.SU002.getMsg());
|
||||
}
|
||||
|
||||
@Operation(summary = "门户发布(同步)" )
|
||||
@Parameters({
|
||||
@Parameter(name = "portalId" , description = "门户主键" ),
|
||||
})
|
||||
@PutMapping("/Actions/release/{portalId}" )
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ActionResult<PortalReleaseVO> release(@PathVariable("portalId") String portalId, @RequestBody @Valid PortalReleaseForm form) throws Exception {
|
||||
if (form.getPcPortal() == 1)
|
||||
portalDataService.release(PortalConst.WEB, portalId, form.getPcPortalSystemId(), PortalConst.WEB, form);
|
||||
if (form.getAppPortal() == 1)
|
||||
portalDataService.release(PortalConst.APP, portalId, form.getAppPortalSystemId(), PortalConst.APP, form);
|
||||
|
||||
ReleaseModel releaseSystemModel = new ReleaseModel();
|
||||
releaseSystemModel.setPc(form.getPc());
|
||||
releaseSystemModel.setPcSystemId(form.getPcSystemId());
|
||||
releaseSystemModel.setPcModuleParentId(form.getPcModuleParentId());
|
||||
releaseSystemModel.setApp(form.getApp());
|
||||
releaseSystemModel.setAppSystemId(form.getAppSystemId());
|
||||
releaseSystemModel.setAppModuleParentId(form.getAppModuleParentId());
|
||||
releaseSystemModel.setPcModuleParentId(form.getPcModuleParentId());
|
||||
releaseSystemModel.setAppModuleParentId(form.getAppModuleParentId());
|
||||
portalDataService.releaseModule(releaseSystemModel,portalId);
|
||||
|
||||
return ActionResult.success(MsgCode.SU011.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "个人门户详情" )
|
||||
@Parameters({
|
||||
@Parameter(name = "id" , description = "主键" ),
|
||||
})
|
||||
@GetMapping("/{id}/auth" )
|
||||
public ActionResult<PortalInfoAuthVO> infoAuth(@PathVariable("id" ) String id, String platform, String systemId) {
|
||||
platform = platform.equalsIgnoreCase("pc") || platform.equalsIgnoreCase(PortalConst.WEB) ? PortalConst.WEB : PortalConst.APP;
|
||||
try{
|
||||
return ActionResult.success(portalDataService.getDataFormView(id, platform));
|
||||
}catch (Exception e){
|
||||
return ActionResult.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-common-all</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.portal.constant;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.6
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-02-23
|
||||
*/
|
||||
public class PortalConst {
|
||||
|
||||
/* ========== platform ======== */
|
||||
|
||||
/**
|
||||
* 网页端
|
||||
*/
|
||||
public final static String PC = "pc";
|
||||
public final static String WEB = "Web";
|
||||
|
||||
/**
|
||||
* 手机端
|
||||
*/
|
||||
public final static String APP = "App";
|
||||
|
||||
/**
|
||||
* 模板
|
||||
*/
|
||||
public final static String MODEL = "model";
|
||||
public final static String CUSTOM = "custom";
|
||||
public final static String RELEASE = "release";
|
||||
|
||||
public final static String AUTHORIZE_PORTAL_MANAGE = "portalManage";
|
||||
|
||||
public final static String AUTHORIZE_PORTAL_ROLE = "role";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.yunzhupaas.portal.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.base.entity.SuperEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2023-04-19
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_portal_data")
|
||||
@Schema(description = "PortalData对象")
|
||||
public class PortalDataEntity extends SuperEntity<String> implements Serializable {
|
||||
|
||||
@Schema(description = "门户ID")
|
||||
@TableField("F_PORTAL_ID")
|
||||
private String portalId;
|
||||
|
||||
@Schema(description = "PC:网页端 APP:手机端")
|
||||
@TableField("F_PLATFORM")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "表单配置JSON")
|
||||
@TableField("F_FORM_DATA")
|
||||
private String formData;
|
||||
|
||||
@Schema(description = "系统ID")
|
||||
@TableField("F_SYSTEM_ID")
|
||||
private String systemId;
|
||||
|
||||
@Schema(description = "类型(mod:模型、custom:自定义)")
|
||||
@TableField("F_TYPE")
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yunzhupaas.portal.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 门户
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/3/16
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_portal")
|
||||
public class PortalEntity extends SuperExtendEntity.SuperExtendDEEntity<String> {
|
||||
|
||||
@Schema(description = "名称")
|
||||
@TableField("F_FULL_NAME")
|
||||
private String fullName;
|
||||
|
||||
@Schema(description = "编码")
|
||||
@TableField("F_EN_CODE")
|
||||
private String enCode;
|
||||
|
||||
@Schema(description = "分类(数据字典维护)")
|
||||
@TableField("F_CATEGORY")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "类型(0-页面设计,1-自定义路径)")
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "静态页面路径")
|
||||
@TableField("F_CUSTOM_URL")
|
||||
private String customUrl;
|
||||
|
||||
@Schema(description = "类型(0-页面,1-外链)")
|
||||
@TableField("F_LINK_TYPE")
|
||||
private Integer linkType;
|
||||
|
||||
@TableField("F_STATE")
|
||||
private Integer state;
|
||||
|
||||
@Schema(description = "移动锁定(0-未锁定,1-锁定)")
|
||||
@TableField("F_ENABLED_LOCK")
|
||||
private Integer enabledLock;
|
||||
|
||||
/**
|
||||
* 发布时勾选平台类型
|
||||
*/
|
||||
@TableField("F_PLATFORM_RELEASE" )
|
||||
private String platformRelease;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EmailVO {
|
||||
private String id;
|
||||
@JSONField(name="subject")
|
||||
private String fullName;
|
||||
private Long creatorTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FlowTodo {
|
||||
private List<String> flowToSignType = new ArrayList<>();
|
||||
private List<String> flowTodoType = new ArrayList<>();
|
||||
private List<String> flowDoingType = new ArrayList<>();
|
||||
private List<String> flowDoneType = new ArrayList<>();
|
||||
private List<String> flowCirculateType = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FlowTodoCountVO {
|
||||
private Long flowToSign = 0L;
|
||||
private Long flowTodo = 0L;
|
||||
private Long flowDoing = 0L;
|
||||
private Long flowDone = 0L;
|
||||
private Long flowCirculate = 0L;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/3/16 8:49
|
||||
*/
|
||||
@Data
|
||||
public class FlowTodoVO {
|
||||
public String id;
|
||||
|
||||
public String fullName;
|
||||
|
||||
public String enCode;
|
||||
|
||||
public String flowId;
|
||||
|
||||
public Integer formType;
|
||||
|
||||
public Integer status;
|
||||
|
||||
public String processId;
|
||||
|
||||
public String taskNodeId;
|
||||
|
||||
public String taskOperatorId;
|
||||
|
||||
public Long creatorTime;
|
||||
|
||||
public Integer type;
|
||||
|
||||
public String taskId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MyFlowTodoVO {
|
||||
private String id;
|
||||
private Integer enabledMark;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private String content;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024-10-21 14:23:30
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="门户创建表单")
|
||||
public class PortalCrForm {
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String fullName;
|
||||
@Schema(description = "编码")
|
||||
private String enCode;
|
||||
@Schema(description = "是否启用")
|
||||
private Integer enabledMark;
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
@Schema(description = "表单数据json")
|
||||
private String formData;
|
||||
@Schema(description = "分类")
|
||||
private String category;
|
||||
@Schema(description = "排序")
|
||||
private Long sortCode;
|
||||
@Schema(description = "类型:0-门户设计,1-配置路径")
|
||||
private Integer type;
|
||||
@Schema(description = "配置路径")
|
||||
private String customUrl;
|
||||
@Schema(description = "链接路径")
|
||||
private String appCustomUrl;
|
||||
@Schema(description = "链接类型")
|
||||
private Integer linkType;
|
||||
@Schema(description = "锁定开关0-未锁定,1-锁定")
|
||||
private Integer enabledLock;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.MyBatisPrimaryBase;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalDataEntity;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import com.yunzhupaas.util.context.SpringContext;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.8
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-04-21
|
||||
*/
|
||||
@Data
|
||||
public class PortalCustomPrimary extends MyBatisPrimaryBase<PortalDataEntity> {
|
||||
|
||||
/** 平台 */
|
||||
private String platform = PortalConst.WEB;
|
||||
/** 门户ID */
|
||||
private String portalId;
|
||||
/** 系统ID */
|
||||
private String systemId;
|
||||
/** 用户ID */
|
||||
private String creatorId;
|
||||
/** 类型(mod:模型、custom:自定义) */
|
||||
private String type = PortalConst.CUSTOM;
|
||||
|
||||
public PortalCustomPrimary(String platform, String portalId, String systemId, String userId) {
|
||||
if(platform != null) this.platform = platform;
|
||||
this.portalId = portalId;
|
||||
this.systemId = systemId;
|
||||
this.creatorId = userId;
|
||||
}
|
||||
|
||||
public PortalCustomPrimary(String platform, String portalId){
|
||||
if(platform != null) this.platform = platform;
|
||||
this.portalId = portalId;
|
||||
UserInfo userInfo = SpringContext.getBean(UserProvider.class).get();
|
||||
this.systemId = Objects.equals(platform, PortalConst.WEB) ? userInfo.getSystemId() : userInfo.getAppSystemId();
|
||||
this.creatorId = userInfo.getUserId();
|
||||
}
|
||||
|
||||
public QueryWrapper<PortalDataEntity> getQuery(){
|
||||
queryWrapper.lambda().eq(PortalDataEntity::getType, type);
|
||||
if(this.platform != null) queryWrapper.lambda().eq(PortalDataEntity::getPlatform, platform);
|
||||
if(this.portalId != null) queryWrapper.lambda().eq(PortalDataEntity::getPortalId, portalId);
|
||||
if(this.systemId != null) queryWrapper.lambda().eq(PortalDataEntity::getSystemId, systemId);
|
||||
// if(this.creatorId != null) queryWrapper.lambda().eq(PortalDataEntity::getCreatorUserId, creatorId);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.8
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Data
|
||||
public class PortalDataForm {
|
||||
|
||||
@Schema(description = "门户id")
|
||||
private String portalId;
|
||||
|
||||
@Schema(description = "PC:网页端 APP:手机端 ")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "PC:网页端 APP:手机端 ")
|
||||
private String formData;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.6
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-03-24
|
||||
*/
|
||||
@Data
|
||||
public class PortalDefaultDTO {
|
||||
|
||||
@Schema(description = "默认门户ID")
|
||||
private String defaultPortalId;
|
||||
|
||||
@Schema(description = "系统ID")
|
||||
private String systemId;
|
||||
|
||||
public PortalDefaultDTO(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 门户导入导出
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/7/15
|
||||
*/
|
||||
@Data
|
||||
public class PortalExportDataVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String description;
|
||||
|
||||
private Long sortCode;
|
||||
|
||||
private Integer enabledMark;
|
||||
|
||||
private Date creatorTime;
|
||||
|
||||
private String creatorUser;
|
||||
|
||||
private Date lastModifyTime;
|
||||
|
||||
private String lastModifyUser;
|
||||
|
||||
private Integer deleteMark;
|
||||
|
||||
private Date deleteTime;
|
||||
|
||||
private String deleteUserId;
|
||||
|
||||
private String fullName;
|
||||
|
||||
private String enCode;
|
||||
|
||||
private String category;
|
||||
|
||||
private String formData;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String customUrl;
|
||||
|
||||
private Integer linkType;
|
||||
|
||||
private String modelType;
|
||||
|
||||
private Integer enabledLock;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="门户信息")
|
||||
public class PortalInfoAuthVO {
|
||||
@Schema(description = "表单josn")
|
||||
private String formData;
|
||||
@Schema(description = "门户类型0-用户配置1-自定义外链")
|
||||
private Integer type;
|
||||
@Schema(description = "链接路径")
|
||||
private String customUrl;
|
||||
@Schema(description = "链接路径")
|
||||
private String appCustomUrl;
|
||||
@Schema(description = "链接类型")
|
||||
private Integer linkType;
|
||||
@Schema(description = "锁定开关0-未锁定1锁定")
|
||||
private Integer enabledLock;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @author 管理员/admin
|
||||
* @date 2024-10-21 14:23:30
|
||||
*/
|
||||
@Data
|
||||
public class PortalInfoVO extends PortalCrForm {
|
||||
|
||||
private String id;
|
||||
|
||||
@Schema(description = "pc发布标识")
|
||||
Integer pcIsRelease;
|
||||
@Schema(description = "app发布标识")
|
||||
Integer appIsRelease;
|
||||
|
||||
@Schema(description = "pc是否发布门户" )
|
||||
private Integer pcPortalIsRelease;
|
||||
@Schema(description = "app是否发布门户" )
|
||||
private Integer appPortalIsRelease;
|
||||
|
||||
|
||||
@Schema(description = "pc已发布菜单名称" )
|
||||
private String pcReleaseName;
|
||||
@Schema(description = "app已发布菜单名称" )
|
||||
private String appReleaseName;
|
||||
|
||||
@Schema(description = "pc已发布门户名称" )
|
||||
private String pcPortalReleaseName;
|
||||
@Schema(description = "app已发布门户名称" )
|
||||
private String appPortalReleaseName;
|
||||
|
||||
@Schema(description = "发布时勾选平台类型" )
|
||||
private String platformRelease;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 可视化列表模型
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.8
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/11/20
|
||||
*/
|
||||
@Data
|
||||
public class PortalListModel {
|
||||
private String category;
|
||||
private Long creatorTime;
|
||||
private String creatorUser;
|
||||
private String enCode;
|
||||
private Integer enabledMark;
|
||||
private String fullName;
|
||||
private String id;
|
||||
private Integer type;
|
||||
private Long lastModifyTime;
|
||||
private String lastModifyUser;
|
||||
private Long sortCode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @author 管理员/admin
|
||||
* @date 2024-10-21 14:23:30
|
||||
*/
|
||||
@Data
|
||||
public class PortalListVO{
|
||||
private String id;
|
||||
private Long num;
|
||||
private String fullName;
|
||||
private String enCode;
|
||||
private Integer enabledMark;
|
||||
private Long creatorTime;
|
||||
private String creatorUser;
|
||||
private Long lastModifyTime;
|
||||
private String lastModifyUser;
|
||||
private Long sortCode;
|
||||
private List<PortalListVO> children;
|
||||
private Integer enabledLock;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.MyBatisPrimaryBase;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalDataEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.8
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-04-21
|
||||
*/
|
||||
@Data
|
||||
public class PortalModPrimary extends MyBatisPrimaryBase<PortalDataEntity> {
|
||||
|
||||
/**
|
||||
* 门户ID
|
||||
*/
|
||||
private String portalId;
|
||||
|
||||
/**
|
||||
* 类型(model:模型、custom:自定义)
|
||||
*/
|
||||
private String type = PortalConst.MODEL;
|
||||
|
||||
public PortalModPrimary(String portalId){
|
||||
this.portalId = portalId;
|
||||
}
|
||||
|
||||
public QueryWrapper<PortalDataEntity> getQuery(){
|
||||
queryWrapper.lambda().eq(PortalDataEntity::getType, type);
|
||||
if(this.portalId != null) queryWrapper.lambda().eq(PortalDataEntity::getPortalId, portalId);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.base.Pagination;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024-10-21 14:23:30
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="查询条件")
|
||||
public class PortalPagination extends Pagination {
|
||||
|
||||
@Schema(description = "分类(字典)")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "类型(0-门户设计,1-配置路径)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "锁定(0-禁用,1-启用)")
|
||||
private Integer enabledLock;
|
||||
|
||||
@Schema(description = "平台")
|
||||
private String platform = "web";
|
||||
|
||||
@Schema(description = "状态:0-未发布,1-已发布,2-已修改")
|
||||
private Integer isRelease;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发布(同步)表单
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.6
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-02-23
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="门户创建表单")
|
||||
public class PortalReleaseForm extends ReleaseModel {
|
||||
|
||||
@Schema(description = "pc标识")
|
||||
private Integer pcPortal;
|
||||
@Schema(description = "pc应用集合")
|
||||
private List<String> pcPortalSystemId;
|
||||
@Schema(description = "app标识")
|
||||
private Integer appPortal;
|
||||
@Schema(description = "app应用集合")
|
||||
private List<String> appPortalSystemId;
|
||||
|
||||
@Schema(description = "发布选中平台" )
|
||||
private String platformRelease;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.MyBatisPrimaryBase;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalDataEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.8
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-04-21
|
||||
*/
|
||||
@Data
|
||||
public class PortalReleasePrimary extends MyBatisPrimaryBase<PortalDataEntity> {
|
||||
|
||||
/**
|
||||
* 门户ID
|
||||
*/
|
||||
private String portalId;
|
||||
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 类型(model:模型、custom:自定义、release:发布)
|
||||
*/
|
||||
private String type = PortalConst.RELEASE;
|
||||
|
||||
public PortalReleasePrimary(String portalId, String platform){
|
||||
this.portalId = portalId;
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public QueryWrapper<PortalDataEntity> getQuery(){
|
||||
queryWrapper.lambda().eq(PortalDataEntity::getType, type);
|
||||
if(this.portalId != null) queryWrapper.lambda().eq(PortalDataEntity::getPortalId, portalId);
|
||||
if(this.platform != null) queryWrapper.lambda().eq(PortalDataEntity::getPlatform, platform);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.8
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-04-23
|
||||
*/
|
||||
@Data
|
||||
public class PortalReleaseVO {
|
||||
|
||||
@Schema(description = "pc发布标识")
|
||||
Integer pcIsRelease;
|
||||
@Schema(description = "app发布标识")
|
||||
Integer appIsRelease;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunzhupaas.util.treeutil.SumTree;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
public class PortalSelectModel extends SumTree {
|
||||
private String fullName;
|
||||
private Long sortCode;
|
||||
@JSONField(name="category")
|
||||
private String parentId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
public class PortalSelectVO {
|
||||
private String id;
|
||||
private List<PortalSelectVO> children;
|
||||
private Boolean hasChildren;
|
||||
private String parentId;
|
||||
private Long sortCode;
|
||||
|
||||
@Schema(description = "门户名")
|
||||
private String fullName;
|
||||
@Schema(description = "编码")
|
||||
private String enCode;
|
||||
@Schema(description = "字典类型")
|
||||
private String category;
|
||||
@Schema(description = "分类ID")
|
||||
private String categoryId;
|
||||
@Schema(description = "分类名")
|
||||
private String categoryName;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.yunzhupaas.util.treeutil.SumTree;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
*/
|
||||
@Data
|
||||
public class PortalTreeModel extends SumTree {
|
||||
private String fullName;
|
||||
private Long num;
|
||||
private String enCode;
|
||||
private Long creatorTime;
|
||||
private Integer enabledMark;
|
||||
private String creatorUser;
|
||||
private Long lastModifyTime;
|
||||
private String lastModifyUser;
|
||||
private Long sortCode;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024-10-21 14:23:30
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="门户修改表单")
|
||||
public class PortalUpForm extends PortalCrForm {
|
||||
|
||||
@Schema(description = "门户id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "PC:网页端 APP:手机端 ")
|
||||
String platform;
|
||||
|
||||
@Schema(description = "PC:网页端 APP:手机端 ")
|
||||
Integer state;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import com.yunzhupaas.base.MyBatisPrimaryBase;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.portal.constant.PortalConst;
|
||||
import com.yunzhupaas.portal.entity.PortalEntity;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类功能
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v3.4.8
|
||||
* @copyrignt 深圳市乐程软件有限公司
|
||||
* @date 2023-04-21
|
||||
*/
|
||||
@Data
|
||||
public class PortalViewPrimary extends MyBatisPrimaryBase<PortalEntity> {
|
||||
|
||||
private String creatorId;
|
||||
|
||||
private String portalId;
|
||||
|
||||
private String platForm = PortalConst.WEB;
|
||||
|
||||
private String systemId;
|
||||
|
||||
public PortalViewPrimary(String platForm, String portalId){
|
||||
if(platForm != null) this.platForm = platForm;
|
||||
this.portalId = portalId;
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
this.systemId = PortalConst.WEB.equals(platForm) ? userInfo.getSystemId() : userInfo.getAppSystemId();
|
||||
this.creatorId = userInfo.getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunzhupaas.portal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ReleaseModel {
|
||||
@Schema(description = "pc标识")
|
||||
private Integer pc;
|
||||
@Schema(description = "pc应用集合")
|
||||
private String pcSystemId;
|
||||
@Schema(description = "app标识")
|
||||
private Integer app;
|
||||
@Schema(description = "pc应用集合")
|
||||
private String appSystemId;
|
||||
|
||||
|
||||
@Schema(description = "app上级菜单")
|
||||
private List<String> appModuleParentId;
|
||||
@Schema(description = "pc上级菜单")
|
||||
private List<String> pcModuleParentId;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user