初始代码
This commit is contained in:
21
yunzhupaas-visualdev/yunzhupaas-visualdev-onlinedev/pom.xml
Normal file
21
yunzhupaas-visualdev/yunzhupaas-visualdev-onlinedev/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-onlinedev</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>yunzhupaas-visualdev-onlinedev-entity</module>
|
||||
<module>yunzhupaas-visualdev-onlinedev-biz</module>
|
||||
<module>yunzhupaas-visualdev-onlinedev-controller</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -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-onlinedev</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-visualdev-onlinedev-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-onlinedev-entity</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-base-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-system-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualLogEntity;
|
||||
|
||||
/**
|
||||
* 数据日志mapper
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/27 18:22:40
|
||||
*/
|
||||
public interface VisualLogMapper extends SuperMapper<VisualLogEntity> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.mapper;
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualPersonalEntity;
|
||||
|
||||
/**
|
||||
* 列表个性视图:mapper
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 16:51:19
|
||||
*/
|
||||
public interface VisualPersonalMapper extends SuperMapper<VisualPersonalEntity> {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yunzhupaas.onlinedev.mapper;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.mapper.SuperMapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualdevModelDataEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
public interface VisualdevModelDataMapper extends SuperMapper<VisualdevModelDataEntity> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yunzhupaas.onlinedev.service;
|
||||
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineInfoModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* 功能设计表单数据
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/10/26
|
||||
*/
|
||||
public interface VisualDevInfoService {
|
||||
|
||||
/**
|
||||
* 编辑页数据回显
|
||||
* @param id 主键id
|
||||
* @param visualdevEntity 可视化实体
|
||||
* @return
|
||||
*/
|
||||
VisualdevModelDataInfoVO getEditDataInfo(String id, VisualdevEntity visualdevEntity, OnlineInfoModel model);
|
||||
|
||||
/**
|
||||
* 详情页数据
|
||||
* @param id
|
||||
* @param visualdevEntity
|
||||
* @return
|
||||
*/
|
||||
VisualdevModelDataInfoVO getDetailsDataInfo(String id, VisualdevEntity visualdevEntity);
|
||||
|
||||
/**
|
||||
* 详情页数据(过滤字段)
|
||||
* @param id
|
||||
* @param visualdevEntity
|
||||
* @return
|
||||
*/
|
||||
VisualdevModelDataInfoVO getDetailsDataInfo(String id, VisualdevEntity visualdevEntity, OnlineInfoModel model);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.yunzhupaas.onlinedev.service;
|
||||
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.model.VisualDevJsonModel;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.VisualColumnSearchVO;
|
||||
import com.yunzhupaas.onlinedev.model.PaginationModel;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 列表临时接口
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/7/28
|
||||
*/
|
||||
@Service
|
||||
public interface VisualDevListService {
|
||||
|
||||
|
||||
/**
|
||||
* 无表数据
|
||||
*
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getWithoutTableData(String modelId);
|
||||
|
||||
/**
|
||||
* 有表查询
|
||||
*
|
||||
* @param visualDevJsonModel
|
||||
* @param paginationModel
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getListWithTable(VisualDevJsonModel visualDevJsonModel, PaginationModel paginationModel, UserInfo userInfo, List<String> columnPropList);
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*
|
||||
* @param visualDevJsonModel
|
||||
* @param paginationModel
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getDataList(VisualDevJsonModel visualDevJsonModel, PaginationModel paginationModel) throws WorkFlowException;
|
||||
|
||||
/**
|
||||
* 外链列表数据
|
||||
*
|
||||
* @param visualDevJsonModel
|
||||
* @param paginationModel
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getDataListLink(VisualDevJsonModel visualDevJsonModel, PaginationModel paginationModel) throws WorkFlowException;
|
||||
|
||||
|
||||
/**
|
||||
* 无表数据处理
|
||||
*
|
||||
* @param list
|
||||
* @param searchVOList
|
||||
* @param paginationModel
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getList(List<Map<String, Object>> list, List<VisualColumnSearchVO> searchVOList, PaginationModel paginationModel);
|
||||
|
||||
/**
|
||||
* 关联表单列表数据
|
||||
*
|
||||
* @param visualDevJsonModel
|
||||
* @param paginationModel
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getRelationFormList(VisualDevJsonModel visualDevJsonModel, PaginationModel paginationModel);
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
List<Map<String,Object>> getListWithTableList(VisualDevJsonModel visualDevJsonModel, PaginationModel paginationModel, UserInfo userInfo);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yunzhupaas.onlinedev.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualLogEntity;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogForm;
|
||||
import com.yunzhupaas.base.model.VisualLogModel;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据日志service
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/27 18:24:10
|
||||
*/
|
||||
public interface VisualLogService extends SuperService<VisualLogEntity> {
|
||||
|
||||
void createEventLog(VisualLogForm form);
|
||||
|
||||
List<VisualLogEntity> getLogList(VisualLogPage pagination);
|
||||
|
||||
void addLog(VisualLogForm form, List<VisualLogModel> listLog);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.yunzhupaas.onlinedev.service;
|
||||
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualPersonalEntity;
|
||||
import com.yunzhupaas.onlinedev.model.DataInfoVO;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersonalInfo;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersonalVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 列表个性视图 服务
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 16:50:00
|
||||
*/
|
||||
public interface VisualPersonalService extends SuperService<VisualPersonalEntity> {
|
||||
|
||||
/**
|
||||
* 查询个性视图列表
|
||||
*
|
||||
* @param menuId
|
||||
* @return
|
||||
*/
|
||||
List<VisualPersonalEntity> getList(String menuId);
|
||||
|
||||
/**
|
||||
* 查询个性视图列表
|
||||
*
|
||||
* @param menuId
|
||||
* @return
|
||||
*/
|
||||
List<VisualPersonalVo> getListVo(String menuId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询个性视图详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
VisualPersonalInfo getInfo(String id);
|
||||
|
||||
/**
|
||||
* 重名检测 同菜单下不能同名
|
||||
*
|
||||
* @param fullName
|
||||
* @param id
|
||||
* @param menuId
|
||||
* @return
|
||||
*/
|
||||
boolean isExistByFullName(String fullName, String id, String menuId);
|
||||
|
||||
/**
|
||||
* 页面初始化获取个性化配置
|
||||
*
|
||||
* @param menuId
|
||||
* @return
|
||||
*/
|
||||
void setDataInfoVO(String menuId, DataInfoVO dataInfoVO);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.yunzhupaas.onlinedev.service;
|
||||
|
||||
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.model.FormDataField;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
import com.yunzhupaas.base.model.VisualDevJsonModel;
|
||||
import com.yunzhupaas.base.model.flow.DataModel;
|
||||
import com.yunzhupaas.base.model.flow.FlowFormDataModel;
|
||||
import com.yunzhupaas.base.service.SuperService;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualdevModelDataEntity;
|
||||
import com.yunzhupaas.onlinedev.model.PaginationModel;
|
||||
import com.yunzhupaas.onlinedev.model.PaginationModelExport;
|
||||
import com.yunzhupaas.onlinedev.model.VisualParamModel;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 0代码功能数据表
|
||||
* 版本: V3.0.0
|
||||
* 版权: 深圳市乐程软件有限公司
|
||||
* 作者: 管理员/admin
|
||||
* 日期: 2020-07-24 11:59
|
||||
*/
|
||||
public interface VisualdevModelDataService extends SuperService<VisualdevModelDataEntity> {
|
||||
|
||||
/**
|
||||
* 获取表单主表属性下拉框
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FormDataField> fieldList(String id, Integer filterType);
|
||||
|
||||
/**
|
||||
* 弹窗数据分页
|
||||
*
|
||||
* @param visualdevEntity
|
||||
* @param paginationModel
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getPageList(VisualdevEntity visualdevEntity, PaginationModel paginationModel);
|
||||
|
||||
List<VisualdevModelDataEntity> getList(String modelId);
|
||||
|
||||
VisualdevModelDataEntity getInfo(String id);
|
||||
|
||||
VisualdevModelDataInfoVO infoDataChange(String id, VisualdevEntity visualdevEntity) throws IOException, ParseException, DataException, SQLException;
|
||||
|
||||
void delete(VisualdevModelDataEntity entity);
|
||||
|
||||
boolean tableDelete(String id, VisualDevJsonModel visualDevJsonModel) throws Exception;
|
||||
|
||||
ActionResult tableDeleteMore(List<String> id, VisualDevJsonModel visualDevJsonModel) throws Exception;
|
||||
|
||||
List<Map<String, Object>> exportData(String[] keys, PaginationModelExport paginationModelExport, VisualDevJsonModel visualDevJsonModel) throws IOException, ParseException, SQLException, DataException;
|
||||
|
||||
DataModel visualCreate(VisualParamModel visualParamModel) throws Exception;
|
||||
|
||||
DataModel visualUpdate(VisualParamModel visualParamModel) throws Exception;
|
||||
|
||||
void visualDelete(VisualdevEntity visualdevEntity, List<Map<String, Object>> data) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据表名和规则删除功能表单数据
|
||||
*/
|
||||
void deleteByTableName(FlowFormDataModel model) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
package com.yunzhupaas.onlinedev.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.mapper.FlowFormDataMapper;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
import com.yunzhupaas.base.model.VisualConst;
|
||||
import com.yunzhupaas.base.model.form.ModuleFormModel;
|
||||
import com.yunzhupaas.base.service.DbLinkService;
|
||||
import com.yunzhupaas.base.util.FlowFormDataUtil;
|
||||
import com.yunzhupaas.base.util.FormPublicUtils;
|
||||
import com.yunzhupaas.database.model.entity.DbLinkEntity;
|
||||
import com.yunzhupaas.database.util.ConnUtil;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import com.yunzhupaas.model.visualJson.*;
|
||||
import com.yunzhupaas.model.visualJson.analysis.*;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineInfoModel;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevInfoService;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlinePublicUtils;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlineSwapDataUtils;
|
||||
import com.yunzhupaas.permissions.PermissionInterfaceImpl;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import lombok.Cleanup;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.map.CaseInsensitiveMap;
|
||||
import org.mybatis.dynamic.sql.BasicColumn;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.SqlColumn;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectModel;
|
||||
import org.mybatis.dynamic.sql.select.join.EqualTo;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/10/26
|
||||
*/
|
||||
@Service
|
||||
public class VisualDevInfoServiceImpl implements VisualDevInfoService {
|
||||
|
||||
@Autowired
|
||||
private DbLinkService dblinkService;
|
||||
@Autowired
|
||||
private FlowFormDataMapper flowFormDataMapper;
|
||||
@Autowired
|
||||
private OnlineSwapDataUtils onlineSwapDataUtils;
|
||||
@Autowired
|
||||
private FlowFormDataUtil flowDataUtil;
|
||||
|
||||
@Override
|
||||
public VisualdevModelDataInfoVO getEditDataInfo(String id, VisualdevEntity visualdevEntity, OnlineInfoModel model) {
|
||||
VisualdevModelDataInfoVO vo = new VisualdevModelDataInfoVO();
|
||||
Map<String, Object> editDataInfo = flowDataUtil.getEditDataInfo(visualdevEntity, id, model);
|
||||
if (editDataInfo != null && editDataInfo.size() > 0) {
|
||||
vo.setId(editDataInfo.get(FlowFormConstant.ID));
|
||||
vo.setData(JsonUtilEx.getObjectToString(editDataInfo));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevModelDataInfoVO getDetailsDataInfo(String id, VisualdevEntity visualdevEntity) {
|
||||
return this.getDetailsDataInfo(id, visualdevEntity,
|
||||
OnlineInfoModel.builder().needRlationFiled(true).needSwap(true).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevModelDataInfoVO getDetailsDataInfo(String id, VisualdevEntity visualdevEntity,
|
||||
OnlineInfoModel infoModel) {
|
||||
VisualdevModelDataInfoVO vo = new VisualdevModelDataInfoVO();
|
||||
Map<String, Object> allDataMap = new HashMap<>();
|
||||
Map<String, Object> allDataResMap = new HashMap<>();
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
Boolean logicalDelete = formData.getLogicalDelete();
|
||||
// 权限参数
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(visualdevEntity.getColumnData(),
|
||||
ColumnDataModel.class);
|
||||
Boolean needP = false;
|
||||
List<String> formPerList = new ArrayList<>();
|
||||
if (columnDataModel != null && StringUtil.isNotEmpty(infoModel.getMenuId())) {
|
||||
needP = columnDataModel.getUseFormPermission();
|
||||
Map<String, Object> pMap = PermissionInterfaceImpl.getFormMap();
|
||||
if (pMap.get(infoModel.getMenuId()) != null) {
|
||||
formPerList = JsonUtil.getJsonToList(pMap.get(infoModel.getMenuId()), ModuleFormModel.class).stream()
|
||||
.map(ModuleFormModel::getEnCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
List<FieLdsModel> list = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
List<TableModel> tableModelList = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
List<FormAllModel> formAllModel = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(infoModel.getFormAllModel())) {
|
||||
formAllModel = infoModel.getFormAllModel();
|
||||
} else {
|
||||
RecursionForm recursionForm = new RecursionForm(list, tableModelList);
|
||||
FormCloumnUtil.recursionForm(recursionForm, formAllModel);
|
||||
}
|
||||
// form的属性
|
||||
List<FormAllModel> mast = formAllModel.stream()
|
||||
.filter(t -> FormEnum.mast.getMessage().equals(t.getYunzhupaasKey())).collect(Collectors.toList());
|
||||
List<FormAllModel> table = formAllModel.stream()
|
||||
.filter(t -> FormEnum.table.getMessage().equals(t.getYunzhupaasKey())).collect(Collectors.toList());
|
||||
List<FormAllModel> mastTable = formAllModel.stream()
|
||||
.filter(t -> FormEnum.mastTable.getMessage().equals(t.getYunzhupaasKey())).collect(Collectors.toList());
|
||||
|
||||
List<String> relationFiled = new ArrayList() {
|
||||
{
|
||||
add(YunzhupaasKeyConsts.RELATIONFORM);
|
||||
add(YunzhupaasKeyConsts.RELATIONFORM_ATTR);
|
||||
}
|
||||
};
|
||||
|
||||
TableModel mainTable = tableModelList.stream().filter(t -> t.getTypeId().equals("1")).findFirst().orElse(null);
|
||||
|
||||
DbLinkEntity linkEntity = "0".equals(visualdevEntity.getDbLinkId()) ? null
|
||||
: dblinkService.getInfo(visualdevEntity.getDbLinkId());
|
||||
try {
|
||||
DynamicDataSourceUtil.switchToDataSource(linkEntity);
|
||||
@Cleanup
|
||||
Connection conn = ConnUtil.getConnOrDefault(linkEntity);
|
||||
String databaseProductName = conn.getMetaData().getDatabaseProductName();
|
||||
String dbType = conn.getMetaData().getDatabaseProductName().trim();
|
||||
boolean toUpperCase = databaseProductName.equalsIgnoreCase("oracle")
|
||||
|| databaseProductName.equalsIgnoreCase("DM DBMS");
|
||||
// 获取主键
|
||||
TableFields tableFields = mainTable.getFields().stream().filter(t -> Objects.equals(t.getPrimaryKey(), 1)
|
||||
&& !t.getField().toLowerCase().contains(TableFeildsEnum.TENANTID.getField())).findFirst()
|
||||
.orElse(null);
|
||||
String pKeyName = Objects.nonNull(tableFields) ? tableFields.getField()
|
||||
: toUpperCase ? TableFeildsEnum.FID.getField().toUpperCase() : TableFeildsEnum.FID.getField();
|
||||
SqlTable mainSqlTable = SqlTable.of(mainTable.getTable());
|
||||
// 查询主表数据
|
||||
Map<String, Object> mainAllMap = searchMainData(id, infoModel, mainTable, tableModelList);
|
||||
if (mainAllMap.size() == 0) {
|
||||
return vo;
|
||||
}
|
||||
// 是否去除关联表单及关联表单字段
|
||||
if (!infoModel.isNeedRlationFiled()) {
|
||||
mast = mast.stream()
|
||||
.filter(t -> !relationFiled
|
||||
.contains(t.getFormColumnModel().getFieLdsModel().getConfig().getYunzhupaasKey()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 主表
|
||||
List<String> mainTableFields = mast.stream()
|
||||
.filter(m -> StringUtil.isNotEmpty(m.getFormColumnModel().getFieLdsModel().getVModel()))
|
||||
.map(s -> s.getFormColumnModel().getFieLdsModel().getVModel()).collect(Collectors.toList());
|
||||
// 开启权限移除字段
|
||||
if (needP) {
|
||||
if (CollectionUtils.isEmpty(formPerList)) {
|
||||
mainTableFields = Collections.EMPTY_LIST;
|
||||
} else {
|
||||
List<String> newList = new ArrayList<>();
|
||||
for (String item : mainTableFields) {
|
||||
if (formPerList.contains(item)) {
|
||||
newList.add(item);
|
||||
}
|
||||
}
|
||||
mainTableFields = newList;
|
||||
}
|
||||
}
|
||||
List<BasicColumn> mainTableBasicColumn = mainTableFields.stream()
|
||||
.map(m -> SqlTable.of(mainTable.getTable()).column(m)).collect(Collectors.toList());
|
||||
// 无字段时查询主键
|
||||
mainTableBasicColumn.add(SqlTable.of(mainTable.getTable()).column(pKeyName));
|
||||
|
||||
SelectStatementProvider mainRender = SqlBuilder.select(mainTableBasicColumn).from(mainSqlTable)
|
||||
.where(mainSqlTable.column(pKeyName),
|
||||
SqlBuilder.isEqualTo(mainAllMap.get(pKeyName)))
|
||||
.build().render(RenderingStrategies.MYBATIS3);
|
||||
List<Map<String, Object>> mapList = flowFormDataMapper.selectManyMappedRows(mainRender);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(mapList) && mapList.size() > 0) {
|
||||
allDataMap.putAll(mapList.get(0));
|
||||
}
|
||||
|
||||
// 列表子表
|
||||
Map<String, List<FormMastTableModel>> groupByTableNames = mastTable.stream()
|
||||
.map(mt -> mt.getFormMastTableModel()).collect(Collectors.groupingBy(ma -> ma.getTable()));
|
||||
Iterator<Map.Entry<String, List<FormMastTableModel>>> entryIterator = groupByTableNames.entrySet()
|
||||
.iterator();
|
||||
while (entryIterator.hasNext()) {
|
||||
Map.Entry<String, List<FormMastTableModel>> next = entryIterator.next();
|
||||
String childTableName = next.getKey();
|
||||
List<FormMastTableModel> childMastTableList = next.getValue();
|
||||
// 是否去除关联表单及关联表单字段
|
||||
if (!infoModel.isNeedRlationFiled()) {
|
||||
childMastTableList = childMastTableList.stream()
|
||||
.filter(t -> !relationFiled
|
||||
.contains(t.getMastTable().getFieLdsModel().getConfig().getYunzhupaasKey()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 开启权限移除字段
|
||||
if (needP) {
|
||||
if (CollectionUtils.isEmpty(formPerList)) {
|
||||
childMastTableList = Collections.EMPTY_LIST;
|
||||
} else {
|
||||
List<FormMastTableModel> newList = new ArrayList<>();
|
||||
for (FormMastTableModel item : childMastTableList) {
|
||||
if (formPerList.contains(item.getVModel())) {
|
||||
newList.add(item);
|
||||
}
|
||||
}
|
||||
childMastTableList = newList;
|
||||
}
|
||||
}
|
||||
TableModel childTableModel = tableModelList.stream().filter(t -> t.getTable().equals(childTableName))
|
||||
.findFirst().orElse(null);
|
||||
SqlTable mastSqlTable = SqlTable.of(childTableName);
|
||||
List<BasicColumn> mastTableBasicColumn = childMastTableList.stream()
|
||||
.filter(m -> StringUtil.isNotEmpty(m.getField()))
|
||||
.map(m -> mastSqlTable.column(m.getField())).collect(Collectors.toList());
|
||||
// 添加副表关联字段,不然数据会空没有字段名称
|
||||
mastTableBasicColumn.add(mastSqlTable.column(childTableModel.getTableField()));
|
||||
|
||||
// 主表主键
|
||||
String mainField = childTableModel.getRelationField();
|
||||
Object mainValue = new CaseInsensitiveMap(mainAllMap).get(mainField);
|
||||
// 子表外键
|
||||
String childFoIdFiled = childTableModel.getTableField();
|
||||
// 外键字段是否varchar转换
|
||||
TableFields fogIdField = childTableModel.getFields().stream()
|
||||
.filter(t -> t.getField().equals(childFoIdFiled)).findFirst().orElse(null);
|
||||
boolean fogIdTypeString = Objects.nonNull(fogIdField)
|
||||
? fogIdField.getDataType().toLowerCase().contains("varchar")
|
||||
: false;
|
||||
if (fogIdTypeString) {
|
||||
mainValue = mainValue.toString();
|
||||
}
|
||||
|
||||
SelectStatementProvider mastRender = SqlBuilder.select(mastTableBasicColumn).from(mastSqlTable)
|
||||
.where(mastSqlTable.column(childFoIdFiled),
|
||||
SqlBuilder.isEqualTo(mainValue))
|
||||
.build().render(RenderingStrategies.MYBATIS3);
|
||||
List<Map<String, Object>> childMapList = flowFormDataMapper.selectManyMappedRows(mastRender);
|
||||
if (CollectionUtils.isNotEmpty(childMapList)) {
|
||||
Map<String, Object> soloDataMap = childMapList.get(0);
|
||||
Map<String, Object> renameKeyMap = new HashMap<>();
|
||||
for (Map.Entry entry : soloDataMap.entrySet()) {
|
||||
FormMastTableModel model = childMastTableList.stream()
|
||||
.filter(child -> child.getField().equalsIgnoreCase(String.valueOf(entry.getKey())))
|
||||
.findFirst().orElse(null);
|
||||
if (model != null) {
|
||||
renameKeyMap.put(model.getVModel(), entry.getValue());
|
||||
}
|
||||
}
|
||||
List<Map<String, Object>> mapList1 = new ArrayList<>();
|
||||
mapList1.add(renameKeyMap);
|
||||
allDataMap.putAll(mapList1.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
// 设计子表
|
||||
Boolean finalNeedP = needP;
|
||||
List<String> finalFormPerList = formPerList;
|
||||
table.stream().map(t -> t.getChildList()).forEach(
|
||||
t1 -> {
|
||||
String childTableName = t1.getTableName();
|
||||
TableModel tableModel = tableModelList.stream()
|
||||
.filter(tm -> tm.getTable().equals(childTableName)).findFirst().orElse(null);
|
||||
SqlTable childSqlTable = SqlTable.of(childTableName);
|
||||
List<FormColumnModel> chilFieldList = t1.getChildList().stream()
|
||||
.filter(t2 -> StringUtil.isNotEmpty(t2.getFieLdsModel().getVModel()))
|
||||
.collect(Collectors.toList());
|
||||
String tableModelName = t1.getTableModel();
|
||||
// 开启权限移除字段
|
||||
if (finalNeedP) {
|
||||
if (CollectionUtils.isEmpty(finalFormPerList)) {
|
||||
chilFieldList = Collections.EMPTY_LIST;
|
||||
} else {
|
||||
List<FormColumnModel> newList = new ArrayList<>();
|
||||
for (FormColumnModel item : chilFieldList) {
|
||||
if (finalFormPerList
|
||||
.contains(tableModelName + "-" + item.getFieLdsModel().getVModel())) {
|
||||
newList.add(item);
|
||||
}
|
||||
}
|
||||
chilFieldList = newList;
|
||||
}
|
||||
}
|
||||
List<BasicColumn> childFields = chilFieldList.stream()
|
||||
.map(t2 -> childSqlTable.column(t2.getFieLdsModel().getVModel()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
childFields.add(childSqlTable.column(tableModel.getTableField()));
|
||||
String childKeyName = flowDataUtil.getKey(tableModel, dbType);
|
||||
childFields.add(childSqlTable.column(childKeyName));
|
||||
// 主表主键
|
||||
String mainField = tableModel.getRelationField();
|
||||
Object mainValue = new CaseInsensitiveMap(mainAllMap).get(mainField);
|
||||
// 子表外键
|
||||
String childFoIdFiled = tableModel.getTableField();
|
||||
// 外键字段是否varchar转换
|
||||
TableFields fogIdField = tableModel.getFields().stream()
|
||||
.filter(t -> t.getField().equals(childFoIdFiled)).findFirst().orElse(null);
|
||||
boolean fogIdTypeString = Objects.nonNull(fogIdField)
|
||||
? fogIdField.getDataType().toLowerCase().contains("varchar")
|
||||
: false;
|
||||
if (fogIdTypeString) {
|
||||
mainValue = mainValue.toString();
|
||||
}
|
||||
|
||||
// todo
|
||||
QueryExpressionDSL<SelectModel>.QueryExpressionWhereBuilder childWhere = SqlBuilder
|
||||
.select(childFields).from(childSqlTable).where();
|
||||
childWhere.and(childSqlTable.column(tableModel.getTableField()),
|
||||
SqlBuilder.isEqualTo(mainValue));
|
||||
// 逻辑删除不展示
|
||||
if (logicalDelete) {
|
||||
childWhere.and(childSqlTable.column(TableFeildsEnum.DELETEMARK.getField()),
|
||||
SqlBuilder.isNull());
|
||||
}
|
||||
SelectStatementProvider childRender = childWhere.build().render(RenderingStrategies.MYBATIS3);
|
||||
List<Map<String, Object>> childMapList = flowFormDataMapper.selectManyMappedRows(childRender);
|
||||
if (ObjectUtil.isNotEmpty(childMapList)) {
|
||||
Map<String, Object> childMap = new HashMap<>(1);
|
||||
childMap.put(t1.getTableModel(), childMapList);
|
||||
allDataMap.putAll(childMap);
|
||||
}
|
||||
});
|
||||
// 数据转换
|
||||
List<FieLdsModel> fields = new ArrayList<>();
|
||||
OnlinePublicUtils.recursionFields(fields, list);
|
||||
|
||||
// 添加id属性
|
||||
List<Map<String, Object>> dataList = FormPublicUtils.addIdToList(new ArrayList() {
|
||||
{
|
||||
add(allDataMap);
|
||||
}
|
||||
}, pKeyName);
|
||||
// 详情没有区分行内编辑
|
||||
if (infoModel.isNeedSwap()) {
|
||||
allDataResMap = (Map<String, Object>) onlineSwapDataUtils
|
||||
.getSwapInfo(dataList, fields, visualdevEntity.getId(), false, null).get(0);
|
||||
} else {
|
||||
allDataResMap = allDataMap;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
DynamicDataSourceUtil.clearSwitchDataSource();
|
||||
}
|
||||
vo.setId(allDataResMap.get(FlowFormConstant.ID));
|
||||
vo.setData(JsonUtilEx.getObjectToString(allDataResMap));
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定字段查询主表数据
|
||||
*
|
||||
* @param id
|
||||
* @param model
|
||||
* @param mainTable
|
||||
* @param tableModelList
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> searchMainData(String id, OnlineInfoModel model, TableModel mainTable,
|
||||
List<TableModel> tableModelList) {
|
||||
SqlTable mainSqlTable = SqlTable.of(mainTable.getTable());
|
||||
TableFields mainKeyModel = mainTable.getFields().stream().filter(t -> Objects.equals(t.getPrimaryKey(), 1)
|
||||
&& !t.getField().toLowerCase().contains(TableFeildsEnum.TENANTID.getField())).findFirst().orElse(null);
|
||||
String propsValue = model.getPropsValue();
|
||||
SqlColumn column = null;
|
||||
TableFields storedFieldModel = null;
|
||||
if (StringUtil.isNotEmpty(propsValue)) {
|
||||
if (propsValue.contains("_yunzhupaas_")) {
|
||||
String[] split = propsValue.split("_yunzhupaas_");
|
||||
String thisTable = split[0].substring(5);
|
||||
String thisField = split[1];
|
||||
TableModel thisTableModel = tableModelList.stream()
|
||||
.filter(t -> t.getTable().equalsIgnoreCase(thisTable)).findFirst().orElse(null);
|
||||
storedFieldModel = thisTableModel.getFields().stream()
|
||||
.filter(t -> t.getField().equalsIgnoreCase(thisField)).findFirst().orElse(null);
|
||||
SqlTable sqlTable = SqlTable.of(split[0].substring(5));
|
||||
column = sqlTable.column(storedFieldModel.getField());
|
||||
} else {
|
||||
|
||||
storedFieldModel = mainTable.getFields().stream().filter(t -> t.getField().equalsIgnoreCase(propsValue))
|
||||
.findFirst().orElse(null);
|
||||
column = mainSqlTable.column(storedFieldModel.getField());
|
||||
}
|
||||
} else {
|
||||
storedFieldModel = mainKeyModel;
|
||||
column = mainSqlTable.column(storedFieldModel.getField());
|
||||
}
|
||||
// 查询的字段-字段类型转换
|
||||
Object idObj = id;
|
||||
if (VisualConst.DB_INT_ALL.contains(storedFieldModel.getDataType().toLowerCase())) {
|
||||
idObj = Long.parseLong(id);
|
||||
}
|
||||
|
||||
QueryExpressionDSL<SelectModel> from = SqlBuilder.select(mainSqlTable.allColumns()).from(mainSqlTable);
|
||||
for (TableModel item : tableModelList) {
|
||||
if (!Objects.equals("1", item.getTypeId())) {
|
||||
SqlTable sqlTable = SqlTable.of(item.getTable());
|
||||
String tableField = item.getTableField();
|
||||
String relationField = item.getRelationField();
|
||||
from.leftJoin(sqlTable).on(sqlTable.column(tableField),
|
||||
new EqualTo(mainSqlTable.column(relationField)));
|
||||
}
|
||||
}
|
||||
QueryExpressionDSL<SelectModel>.QueryExpressionWhereBuilder where = from.where(column,
|
||||
SqlBuilder.isEqualTo(idObj));
|
||||
SelectStatementProvider render = where.build().render(RenderingStrategies.MYBATIS3);
|
||||
List<Map<String, Object>> maps = flowFormDataMapper.selectManyMappedRows(render);
|
||||
if (CollectionUtils.isNotEmpty(maps)) {
|
||||
return maps.get(0);
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,311 @@
|
||||
package com.yunzhupaas.onlinedev.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.entity.VisualdevReleaseEntity;
|
||||
import com.yunzhupaas.base.model.VisualLogModel;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.base.service.VisualdevReleaseService;
|
||||
import com.yunzhupaas.constant.YunzhupaasConst;
|
||||
import com.yunzhupaas.event.ProjectEventListener;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.FormDataModel;
|
||||
import com.yunzhupaas.model.visualJson.TableFields;
|
||||
import com.yunzhupaas.model.visualJson.TableModel;
|
||||
import com.yunzhupaas.model.visualJson.config.ConfigModel;
|
||||
import com.yunzhupaas.module.ProjectEventBuilder;
|
||||
import com.yunzhupaas.module.ProjectEventInstance;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualLogEntity;
|
||||
import com.yunzhupaas.onlinedev.mapper.VisualLogMapper;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.OnlineDataTypeEnum;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogForm;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogPage;
|
||||
import com.yunzhupaas.onlinedev.service.VisualLogService;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlinePublicUtils;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlineSwapDataUtils;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.PublishEventUtil;
|
||||
import com.yunzhupaas.util.TableFeildsEnum;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据日志实现
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/27 18:24:42
|
||||
*/
|
||||
@Service
|
||||
public class VisualLogServiceImpl extends SuperServiceImpl<VisualLogMapper, VisualLogEntity>
|
||||
implements VisualLogService {
|
||||
@Autowired
|
||||
private VisualdevReleaseService visualdevReleaseService;
|
||||
@Autowired
|
||||
private OnlineSwapDataUtils onlineSwapDataUtils;
|
||||
|
||||
/**
|
||||
* 创建日志事件
|
||||
*
|
||||
* @param form 数据id
|
||||
*/
|
||||
@Override
|
||||
public void createEventLog(VisualLogForm form) {
|
||||
PublishEventUtil.publishLocalEvent(new ProjectEventBuilder(YunzhupaasConst.VSLOG_EVENT_KEY, form));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VisualLogEntity> getLogList(VisualLogPage pagination) {
|
||||
QueryWrapper<VisualLogEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(VisualLogEntity::getModelId, pagination.getModelId());
|
||||
queryWrapper.lambda().eq(VisualLogEntity::getDataId, pagination.getDataId());
|
||||
// 排序
|
||||
queryWrapper.lambda().orderByDesc(VisualLogEntity::getCreatorTime);
|
||||
Page<VisualLogEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||
IPage<VisualLogEntity> iPage = this.page(page, queryWrapper);
|
||||
return pagination.setData(iPage.getRecords(), iPage.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听日志插入
|
||||
*
|
||||
* @param redisEvent
|
||||
*/
|
||||
@ProjectEventListener(channelRegex = YunzhupaasConst.VSLOG_EVENT_KEY + ".*")
|
||||
public void createLogByEvent(ProjectEventInstance redisEvent) {
|
||||
VisualLogForm form = (VisualLogForm) redisEvent.getSource();
|
||||
VisualLogEntity visualLogEntity = new VisualLogEntity();
|
||||
visualLogEntity.setType(form.getType());
|
||||
visualLogEntity.setModelId(form.getModelId());
|
||||
visualLogEntity.setDataId(form.getDataId());
|
||||
|
||||
// 修改数据
|
||||
if (Objects.equals(form.getType(), 1)) {
|
||||
List<VisualLogModel> listLog = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(form.getListLog())) {
|
||||
listLog = form.getListLog();
|
||||
} else {
|
||||
addLog(form, listLog);
|
||||
}
|
||||
visualLogEntity.setDataLog(JsonUtil.getObjectToString(listLog));
|
||||
if (CollectionUtils.isNotEmpty(listLog)) {
|
||||
this.save(visualLogEntity);
|
||||
}
|
||||
} else {
|
||||
// 新增数据
|
||||
this.save(visualLogEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public void addLog(VisualLogForm formSource, List<VisualLogModel> listLog) {
|
||||
VisualLogForm form = BeanUtil.copyProperties(formSource, VisualLogForm.class);
|
||||
VisualdevReleaseEntity visualdevEntity = visualdevReleaseService.getById(form.getModelId());
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
List<FieLdsModel> fieLdsModels = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
|
||||
List<FieLdsModel> fields = new ArrayList<>();
|
||||
OnlinePublicUtils.recursionFields(fields, fieLdsModels);
|
||||
|
||||
List<Map<String, Object>> swapInfoOld = onlineSwapDataUtils.getSwapInfo(new ArrayList<Map<String, Object>>() {
|
||||
{
|
||||
add(form.getOldData());
|
||||
}
|
||||
}, fields, visualdevEntity.getId(), false, null);
|
||||
Map<String, Object> oldData = swapInfoOld.get(0);
|
||||
List<Map<String, Object>> swapInfoNew = onlineSwapDataUtils.getSwapInfo(new ArrayList<Map<String, Object>>() {
|
||||
{
|
||||
add(form.getNewData());
|
||||
}
|
||||
}, fields, visualdevEntity.getId(), false, null);
|
||||
Map<String, Object> newData = swapInfoNew.get(0);
|
||||
|
||||
for (FieLdsModel item : fields) {
|
||||
ConfigModel config = item.getConfig();
|
||||
String yunzhupaasKey = config.getYunzhupaasKey();
|
||||
String label = config.getLabel();
|
||||
String dataType = config.getDataType();
|
||||
// 移除系统字段
|
||||
if (isSkipFields(item))
|
||||
continue;
|
||||
if (YunzhupaasKeyConsts.CHILD_TABLE.equals(yunzhupaasKey)) {
|
||||
TableModel tableModel = tableModels.stream().filter(t -> t.getTable().equals(config.getTableName()))
|
||||
.findFirst().orElse(null);
|
||||
TableFields mainField = tableModel.getFields().stream()
|
||||
.filter(t -> Objects.equals(t.getPrimaryKey(), 1)
|
||||
&& !t.getField().equalsIgnoreCase(TableFeildsEnum.TENANTID.getField()))
|
||||
.findFirst().orElse(null);
|
||||
String mainKey = mainField.getField();
|
||||
|
||||
List<FieLdsModel> children = item.getConfig().getChildren();
|
||||
String vModel = item.getVModel();
|
||||
// 子表数据
|
||||
List<Map<String, Object>> childData = new ArrayList<>();
|
||||
// 子表表头
|
||||
List<Map<String, Object>> childField = new ArrayList<>();
|
||||
for (FieLdsModel childItem : children) {
|
||||
String yunzhupaasKeyChild = childItem.getConfig().getYunzhupaasKey();
|
||||
if (isSkipFields(childItem))
|
||||
continue;
|
||||
Map<String, Object> childItemMap = new HashMap<>();
|
||||
childItemMap.put("prop", childItem.getVModel());
|
||||
childItemMap.put("label", childItem.getConfig().getLabel());
|
||||
childItemMap.put("yunzhupaasKey", yunzhupaasKeyChild);
|
||||
boolean nameModified = false;
|
||||
if (YunzhupaasKeyConsts.getNameModified().contains(yunzhupaasKeyChild)) {
|
||||
if (YunzhupaasKeyConsts.getNameModifiedNotDynamic().contains(yunzhupaasKeyChild)
|
||||
|| OnlineDataTypeEnum.DYNAMIC.getType().equals(childItem.getConfig().getDataType())) {
|
||||
nameModified = true;
|
||||
}
|
||||
}
|
||||
childItemMap.put("nameModified", nameModified);
|
||||
childField.add(childItemMap);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> childOld = oldData.get(vModel) == null ? new ArrayList<>()
|
||||
: (List) oldData.get(vModel);
|
||||
List<Map<String, Object>> childNew = newData.get(vModel) == null ? new ArrayList<>()
|
||||
: (List) newData.get(vModel);
|
||||
List<Object> newIds = childNew.stream().map(t -> t.get(mainKey)).collect(Collectors.toList());
|
||||
List<Map<String, Object>> deleteMap = childOld.stream().filter(t -> !newIds.contains(t.get(mainKey)))
|
||||
.collect(Collectors.toList());
|
||||
for (Map<String, Object> chilMap : deleteMap) {
|
||||
Map<String, Object> childDataMap = new HashMap<>();
|
||||
for (FieLdsModel childItem : children) {
|
||||
String childYunzhupaasKey = childItem.getConfig().getYunzhupaasKey();
|
||||
// 移除系统字段
|
||||
if (isSkipFields(childItem))
|
||||
continue;
|
||||
String childVmodel = childItem.getVModel();
|
||||
String childVmodel_old = "yunzhupaas_old_" + childItem.getVModel();
|
||||
String oldValue = getValueByType(chilMap, childVmodel, childYunzhupaasKey);
|
||||
childDataMap.put(childVmodel, null);
|
||||
childDataMap.put(childVmodel_old, oldValue);
|
||||
childDataMap.put("yunzhupaas_type", 2);
|
||||
}
|
||||
childData.add(childDataMap);
|
||||
}
|
||||
for (Map<String, Object> chilMap : childNew) {
|
||||
Object mainId = chilMap.get(mainKey);
|
||||
Map<String, Object> oldMap = childOld.stream().filter(t -> t.get(mainKey).equals(mainId))
|
||||
.findFirst().orElse(null);
|
||||
Integer yunzhupaas_type = 1;
|
||||
if (oldMap == null) {
|
||||
yunzhupaas_type = 0;
|
||||
}
|
||||
Map<String, Object> childDataMap = new HashMap<>();
|
||||
boolean hasChanged = false;
|
||||
for (FieLdsModel childItem : children) {
|
||||
String childYunzhupaasKey = childItem.getConfig().getYunzhupaasKey();
|
||||
// 移除系统字段
|
||||
if (isSkipFields(childItem))
|
||||
continue;
|
||||
String childVmodel = childItem.getVModel();
|
||||
String childVmodel_old = "yunzhupaas_old_" + childItem.getVModel();
|
||||
String newValue = getValueByType(chilMap, childVmodel, childYunzhupaasKey);
|
||||
String oldValue = getValueByType(oldMap, childVmodel, childYunzhupaasKey);
|
||||
if (!Objects.equals(newValue, oldValue)) {
|
||||
hasChanged = true;
|
||||
}
|
||||
childDataMap.put(childVmodel, newValue);
|
||||
childDataMap.put(childVmodel_old, oldValue);
|
||||
childDataMap.put("yunzhupaas_type", yunzhupaas_type);
|
||||
}
|
||||
if (hasChanged) {
|
||||
childData.add(childDataMap);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(childData)) {
|
||||
VisualLogModel vlogModel = new VisualLogModel();
|
||||
vlogModel.setField(vModel);
|
||||
vlogModel.setFieldName(label);
|
||||
vlogModel.setYunzhupaasKey(yunzhupaasKey);
|
||||
vlogModel.setChidData(childData);
|
||||
vlogModel.setChidField(childField);
|
||||
vlogModel.setType(1);
|
||||
listLog.add(vlogModel);
|
||||
}
|
||||
} else {
|
||||
String vModel = item.getVModel();
|
||||
if (!Objects.equals(oldData.get(vModel), newData.get(vModel))) {
|
||||
Integer actionType = 1;// 0-新增,1-修改
|
||||
if (oldData.get(vModel) == null || oldData.get(vModel).toString().trim().isEmpty()) {
|
||||
actionType = 0;
|
||||
}
|
||||
boolean nameModified = false;
|
||||
if (YunzhupaasKeyConsts.getNameModified().contains(yunzhupaasKey)) {
|
||||
if (YunzhupaasKeyConsts.getNameModifiedNotDynamic().contains(yunzhupaasKey)
|
||||
|| OnlineDataTypeEnum.DYNAMIC.getType().equals(dataType)) {
|
||||
nameModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
String newValue = getValueByType(newData, vModel, yunzhupaasKey);
|
||||
String oldValue = getValueByType(oldData, vModel, yunzhupaasKey);
|
||||
VisualLogModel vlogModel = new VisualLogModel();
|
||||
vlogModel.setField(vModel);
|
||||
vlogModel.setFieldName(label);
|
||||
vlogModel.setYunzhupaasKey(yunzhupaasKey);
|
||||
vlogModel.setNewData(newValue);
|
||||
vlogModel.setOldData(oldValue);
|
||||
vlogModel.setType(actionType);
|
||||
vlogModel.setNameModified(nameModified);
|
||||
listLog.add(vlogModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳过字段不处理
|
||||
*
|
||||
* @param childItem
|
||||
* @return
|
||||
*/
|
||||
private boolean isSkipFields(FieLdsModel childItem) {
|
||||
// 字段不处理直接跳过 :(YunzhupaasKeyConsts.CALCULATE 计算公式仅展示也跳过)
|
||||
List<String> skipFields = new ArrayList<>();
|
||||
skipFields.addAll(YunzhupaasKeyConsts.getSystemKey());
|
||||
skipFields.add(YunzhupaasKeyConsts.POPUPSELECT_ATTR);
|
||||
skipFields.add(YunzhupaasKeyConsts.RELATIONFORM_ATTR);
|
||||
String yunzhupaasKey = childItem.getConfig().getYunzhupaasKey();
|
||||
return skipFields.contains(yunzhupaasKey)
|
||||
|| (YunzhupaasKeyConsts.CALCULATE.equals(yunzhupaasKey) && Objects.equals(childItem.getIsStorage(), 0));
|
||||
}
|
||||
|
||||
private String getValueByType(Map<String, Object> map, String vModel, String yunzhupaasKey) {
|
||||
if (map != null) {
|
||||
Object o = map.get(vModel);
|
||||
String value = o == null ? "" : o.toString();
|
||||
switch (yunzhupaasKey) {
|
||||
case YunzhupaasKeyConsts.UPLOADFZ:
|
||||
List<Map<String, String>> listM = (List) o;
|
||||
if (listM != null) {
|
||||
StringJoiner sj = new StringJoiner(",");
|
||||
listM.stream().forEach(t -> sj.add(t.get("name").toString()));
|
||||
value = sj.toString();
|
||||
}
|
||||
break;
|
||||
case YunzhupaasKeyConsts.LOCATION:
|
||||
Map<String, Object> lcationMap = JsonUtil.stringToMap(value);
|
||||
if (MapUtils.isNotEmpty(lcationMap)) {
|
||||
value = lcationMap.get("fullAddress") != null ? lcationMap.get("fullAddress").toString() : "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.yunzhupaas.onlinedev.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualPersonalEntity;
|
||||
import com.yunzhupaas.onlinedev.mapper.VisualPersonalMapper;
|
||||
import com.yunzhupaas.onlinedev.model.DataInfoVO;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersConst;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersonalInfo;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersonalVo;
|
||||
import com.yunzhupaas.onlinedev.service.VisualPersonalService;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 个性化列表视图服务实现
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/27 18:24:42
|
||||
*/
|
||||
@Service
|
||||
public class VisualPersonalServiceImpl extends SuperServiceImpl<VisualPersonalMapper, VisualPersonalEntity> implements VisualPersonalService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<VisualPersonalEntity> getList(String menuId) {
|
||||
QueryWrapper<VisualPersonalEntity> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.lambda().select(
|
||||
// VisualPersonalEntity::getId,
|
||||
// VisualPersonalEntity::getMenuId,
|
||||
// VisualPersonalEntity::getType,
|
||||
// VisualPersonalEntity::getStatus,
|
||||
// VisualPersonalEntity::getFullName
|
||||
// );
|
||||
queryWrapper.lambda().eq(VisualPersonalEntity::getMenuId, menuId);
|
||||
queryWrapper.lambda().eq(VisualPersonalEntity::getCreatorUserId, UserProvider.getUser().getUserId());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VisualPersonalVo> getListVo(String menuId) {
|
||||
List<VisualPersonalVo> listVo = new ArrayList<>();
|
||||
//个人视图
|
||||
List<VisualPersonalEntity> list = this.getList(menuId);
|
||||
VisualPersonalEntity defaultEntity = list.stream().filter(t -> Objects.equals(1, t.getStatus())).findFirst().orElse(null);
|
||||
//添加系统视图
|
||||
Integer status = ObjectUtil.isEmpty(defaultEntity) ? 1 : 0;
|
||||
VisualPersonalVo vo = new VisualPersonalVo();
|
||||
vo.setId(VisualPersConst.SYSTEM_ID);
|
||||
vo.setFullName(VisualPersConst.SYSTEM_NAME);
|
||||
vo.setStatus(status);
|
||||
vo.setType(0);
|
||||
listVo.add(vo);
|
||||
for (VisualPersonalEntity item : list) {
|
||||
VisualPersonalVo personalVo = JsonUtil.getJsonToBean(item, VisualPersonalVo.class);
|
||||
listVo.add(personalVo);
|
||||
}
|
||||
return listVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualPersonalInfo getInfo(String id) {
|
||||
VisualPersonalInfo info = null;
|
||||
if (ObjectUtil.isNotEmpty(id) && !VisualPersConst.SYSTEM_ID.equals(id)) {
|
||||
VisualPersonalEntity entity = this.getById(id);
|
||||
if (entity != null) {
|
||||
info = JsonUtil.getJsonToBean(entity, VisualPersonalInfo.class);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExistByFullName(String fullName, String id, String menuId) {
|
||||
if (VisualPersConst.SYSTEM_NAME.equals(fullName)) return true;
|
||||
QueryWrapper<VisualPersonalEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(VisualPersonalEntity::getFullName, fullName);
|
||||
if (!StringUtils.isEmpty(id)) {
|
||||
queryWrapper.lambda().ne(VisualPersonalEntity::getId, id);
|
||||
}
|
||||
queryWrapper.lambda().eq(VisualPersonalEntity::getMenuId, menuId);
|
||||
return this.count(queryWrapper) > 0 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDataInfoVO(String menuId, DataInfoVO dataInfoVO) {
|
||||
List<VisualPersonalVo> listVo = StringUtil.isNotEmpty(menuId) ? this.getListVo(menuId) : new ArrayList<>();
|
||||
dataInfoVO.setPersonalList(listVo);
|
||||
VisualPersonalVo personalVo = listVo.stream().filter(t -> Objects.equals(1, t.getStatus())).findFirst().orElse(null);
|
||||
String id = ObjectUtil.isEmpty(personalVo) ? null : personalVo.getId();
|
||||
VisualPersonalInfo info = this.getInfo(id);
|
||||
dataInfoVO.setDefaultView(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,687 @@
|
||||
package com.yunzhupaas.onlinedev.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.ModuleEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevReleaseEntity;
|
||||
import com.yunzhupaas.base.mapper.FlowFormDataMapper;
|
||||
import com.yunzhupaas.base.model.*;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
import com.yunzhupaas.base.model.flow.DataModel;
|
||||
import com.yunzhupaas.base.model.flow.FlowFormDataModel;
|
||||
import com.yunzhupaas.base.model.form.ModuleFormModel;
|
||||
import com.yunzhupaas.base.model.module.PropertyJsonModel;
|
||||
import com.yunzhupaas.base.service.DbLinkService;
|
||||
import com.yunzhupaas.base.service.ModuleService;
|
||||
import com.yunzhupaas.base.service.SuperServiceImpl;
|
||||
import com.yunzhupaas.base.service.VisualdevReleaseService;
|
||||
import com.yunzhupaas.base.util.FlowFormDataUtil;
|
||||
import com.yunzhupaas.base.util.FormCheckUtils;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.database.model.entity.DbLinkEntity;
|
||||
import com.yunzhupaas.database.model.superQuery.SuperJsonModel;
|
||||
import com.yunzhupaas.database.model.superQuery.SuperQueryJsonModel;
|
||||
import com.yunzhupaas.database.util.ConnUtil;
|
||||
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.flowable.entity.TaskEntity;
|
||||
import com.yunzhupaas.model.OnlineDevData;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.FormCloumnUtil;
|
||||
import com.yunzhupaas.model.visualJson.FormDataModel;
|
||||
import com.yunzhupaas.model.visualJson.TableModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormAllModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.RecursionForm;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualdevModelDataEntity;
|
||||
import com.yunzhupaas.onlinedev.mapper.VisualdevModelDataMapper;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.VisualColumnSearchVO;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineInfoModel;
|
||||
import com.yunzhupaas.onlinedev.model.PaginationModel;
|
||||
import com.yunzhupaas.onlinedev.model.PaginationModelExport;
|
||||
import com.yunzhupaas.onlinedev.model.VisualParamModel;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogForm;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevInfoService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevListService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualLogService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualdevModelDataService;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlineDevInfoUtils;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlineProductSqlUtils;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlinePublicUtils;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlineSwapDataUtils;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.model.authorize.OnlineDynamicSqlModel;
|
||||
import com.yunzhupaas.permission.service.UserService;
|
||||
import com.yunzhupaas.permissions.PermissionInterfaceImpl;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.util.context.RequestContext;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import com.yunzhupaas.workflow.service.TaskApi;
|
||||
import com.yunzhupaas.workflow.service.TemplateApi;
|
||||
import lombok.Cleanup;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteDSL;
|
||||
import org.mybatis.dynamic.sql.delete.DeleteModel;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.SelectModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Service
|
||||
public class VisualdevModelDataServiceImpl extends SuperServiceImpl<VisualdevModelDataMapper, VisualdevModelDataEntity>
|
||||
implements VisualdevModelDataService {
|
||||
|
||||
@Autowired
|
||||
private UserService userApi;
|
||||
@Autowired
|
||||
private DbLinkService dblinkService;
|
||||
@Autowired
|
||||
private VisualdevReleaseService visualdevReleaseService;
|
||||
@Autowired
|
||||
private VisualDevListService visualDevListService;
|
||||
@Autowired
|
||||
private OnlineSwapDataUtils onlineSwapDataUtils;
|
||||
@Autowired
|
||||
private OnlineDevInfoUtils onlineDevInfoUtils;
|
||||
@Autowired
|
||||
private FlowFormDataUtil flowFormDataUtil;
|
||||
@Autowired
|
||||
private FormCheckUtils formCheckUtils;
|
||||
@Autowired
|
||||
private TemplateApi templateApi;
|
||||
@Autowired
|
||||
private TaskApi taskApi;
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
@Autowired
|
||||
private VisualLogService visualLogService;
|
||||
@Autowired
|
||||
private VisualDevInfoService visualDevInfoService;
|
||||
@Autowired
|
||||
private FlowFormDataMapper flowFormDataMapper;
|
||||
|
||||
@Override
|
||||
public List<VisualdevModelDataEntity> getList(String modelId) {
|
||||
QueryWrapper<VisualdevModelDataEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(VisualdevModelDataEntity::getVisualDevId, modelId);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单字段
|
||||
*
|
||||
* @param id
|
||||
* @param filterType 过滤类型,0或者不传为默认过滤子表和关联表单,1-弹窗配置需要过滤掉的类型
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FormDataField> fieldList(String id, Integer filterType) {
|
||||
VisualdevReleaseEntity entity = visualdevReleaseService.getById(id);
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(entity.getFormData(), FormDataModel.class);
|
||||
|
||||
List<FieLdsModel> fieLdsModelList = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
List<FieLdsModel> mainFieldModelList = new ArrayList<>();
|
||||
|
||||
OnlinePublicUtils.recursionFields(mainFieldModelList, fieLdsModelList);
|
||||
// 过滤掉无法传递的组件
|
||||
List<String> notInList = new ArrayList<>();
|
||||
notInList.add(YunzhupaasKeyConsts.RELATIONFORM);
|
||||
notInList.add(YunzhupaasKeyConsts.CHILD_TABLE);
|
||||
if (Objects.equals(filterType, 1)) {
|
||||
notInList.add("link");
|
||||
notInList.add("button");
|
||||
notInList.add("YUNZHUPAASText");
|
||||
notInList.add("alert");
|
||||
notInList.add(YunzhupaasKeyConsts.POPUPSELECT);
|
||||
notInList.add(YunzhupaasKeyConsts.QR_CODE);
|
||||
notInList.add(YunzhupaasKeyConsts.BARCODE);
|
||||
notInList.add(YunzhupaasKeyConsts.CREATEUSER);
|
||||
notInList.add(YunzhupaasKeyConsts.CREATETIME);
|
||||
notInList.add(YunzhupaasKeyConsts.UPLOADIMG);
|
||||
notInList.add(YunzhupaasKeyConsts.UPLOADFZ);
|
||||
notInList.add(YunzhupaasKeyConsts.MODIFYUSER);
|
||||
notInList.add(YunzhupaasKeyConsts.MODIFYTIME);
|
||||
|
||||
notInList.add(YunzhupaasKeyConsts.CURRORGANIZE);
|
||||
notInList.add(YunzhupaasKeyConsts.CURRPOSITION);
|
||||
notInList.add(YunzhupaasKeyConsts.IFRAME);
|
||||
notInList.add(YunzhupaasKeyConsts.RELATIONFORM_ATTR);
|
||||
notInList.add(YunzhupaasKeyConsts.POPUPSELECT_ATTR);
|
||||
}
|
||||
|
||||
List<FormDataField> formDataFieldList = mainFieldModelList.stream()
|
||||
.filter(fieLdsModel -> !"".equals(fieLdsModel.getVModel())
|
||||
&& StringUtil.isNotEmpty(fieLdsModel.getVModel())
|
||||
&& !notInList.contains(fieLdsModel.getConfig().getYunzhupaasKey()))
|
||||
.map(fieLdsModel -> {
|
||||
FormDataField formDataField = new FormDataField();
|
||||
formDataField.setLabel(fieLdsModel.getConfig().getLabel());
|
||||
formDataField.setVModel(fieLdsModel.getVModel());
|
||||
return formDataField;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return formDataFieldList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getPageList(VisualdevEntity entity, PaginationModel paginationModel) {
|
||||
// String json = null;
|
||||
// if (StringUtil.isNotEmpty(paginationModel.getKeyword())) {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put(paginationModel.getRelationField(), paginationModel.getKeyword());
|
||||
// json = JsonUtil.getObjectToString(map);
|
||||
// }
|
||||
// paginationModel.setQueryJson(json);
|
||||
VisualDevJsonModel visualJsonModel = OnlinePublicUtils.getVisualJsonModel(entity);
|
||||
|
||||
// 判断请求客户端来源
|
||||
if (!RequestContext.isOrignPc()) {
|
||||
visualJsonModel.setColumnData(visualJsonModel.getAppColumnData());
|
||||
}
|
||||
List<Map<String, Object>> dataList = visualDevListService.getRelationFormList(visualJsonModel, paginationModel);
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> exportData(String[] keys, PaginationModelExport paginationModelExport,
|
||||
VisualDevJsonModel visualDevJsonModel) {
|
||||
PaginationModel paginationModel = new PaginationModel();
|
||||
BeanUtil.copyProperties(paginationModelExport, paginationModel);
|
||||
List<String> keyList = Arrays.asList(keys);
|
||||
List<Map<String, Object>> noSwapDataList;
|
||||
ColumnDataModel columnDataModel = visualDevJsonModel.getColumnData();
|
||||
List<VisualColumnSearchVO> searchVOList = new ArrayList<>();
|
||||
List<TableModel> visualTables = visualDevJsonModel.getVisualTables();
|
||||
TableModel mainTable = visualTables.stream().filter(vi -> vi.getTypeId().equals("1")).findFirst().orElse(null);
|
||||
// 解析控件
|
||||
FormDataModel formDataModel = visualDevJsonModel.getFormData();
|
||||
List<FieLdsModel> fieLdsModels = JsonUtil.getJsonToList(formDataModel.getFields(), FieLdsModel.class);
|
||||
RecursionForm recursionForm = new RecursionForm(fieLdsModels, visualTables);
|
||||
List<FormAllModel> formAllModel = new ArrayList<>();
|
||||
FormCloumnUtil.recursionForm(recursionForm, formAllModel);
|
||||
// 封装查询条件
|
||||
if (StringUtil.isNotEmpty(paginationModel.getQueryJson())) {
|
||||
Map<String, Object> keyJsonMap = JsonUtil.stringToMap(paginationModel.getQueryJson());
|
||||
searchVOList = JsonUtil.getJsonToList(columnDataModel.getSearchList(), VisualColumnSearchVO.class);
|
||||
searchVOList = searchVOList.stream().map(searchVO -> {
|
||||
searchVO.setValue(keyJsonMap.get(searchVO.getId()));
|
||||
return searchVO;
|
||||
}).filter(vo -> vo.getValue() != null && StringUtil.isNotEmpty(String.valueOf(vo.getValue())))
|
||||
.collect(Collectors.toList());
|
||||
// 左侧树查询
|
||||
boolean b = false;
|
||||
if (columnDataModel.getTreeRelation() != null) {
|
||||
b = keyJsonMap.keySet().stream()
|
||||
.anyMatch(t -> t.equalsIgnoreCase(String.valueOf(columnDataModel.getTreeRelation())));
|
||||
}
|
||||
if (b && keyJsonMap.size() > searchVOList.size()) {
|
||||
String relation = String.valueOf(columnDataModel.getTreeRelation());
|
||||
VisualColumnSearchVO vo = new VisualColumnSearchVO();
|
||||
vo.setSearchType("1");
|
||||
vo.setVModel(relation);
|
||||
vo.setValue(keyJsonMap.get(relation));
|
||||
searchVOList.add(vo);
|
||||
}
|
||||
}
|
||||
// 菜单id
|
||||
String menuId = paginationModel.getMenuId();
|
||||
// 菜单判断是否启用流程-添加流程状态
|
||||
ModuleEntity info = moduleService.getInfo(menuId);
|
||||
if (info != null) {
|
||||
// 流程菜单
|
||||
boolean enableFlow = Objects.equals(info.getType(), 9);
|
||||
visualDevJsonModel.setEnableFlow(enableFlow);
|
||||
if (enableFlow) {
|
||||
PropertyJsonModel model = JsonUtil.getJsonToBean(info.getPropertyJson(), PropertyJsonModel.class);
|
||||
List<String> flowVersionIds = templateApi.getFlowIdsByTemplateId(model.getModuleId());
|
||||
visualDevJsonModel.setFlowId(model.getModuleId());
|
||||
visualDevJsonModel.setFlowVersionIds(flowVersionIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (visualDevJsonModel.getVisualTables().size() > 0) {
|
||||
// 当前用户信息
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
// 封装搜索数据
|
||||
OnlineProductSqlUtils.queryList(formAllModel, visualDevJsonModel, paginationModel);
|
||||
noSwapDataList = visualDevListService.getListWithTable(visualDevJsonModel, paginationModel, userInfo,
|
||||
keyList);
|
||||
} else {
|
||||
noSwapDataList = visualDevListService.getWithoutTableData(visualDevJsonModel.getId());
|
||||
noSwapDataList = visualDevListService.getList(noSwapDataList, searchVOList, paginationModel);
|
||||
}
|
||||
|
||||
// 数据转换
|
||||
List<FieLdsModel> fields = new ArrayList<>();
|
||||
OnlinePublicUtils.recursionFields(fields, fieLdsModels);
|
||||
noSwapDataList = onlineSwapDataUtils.getSwapList(noSwapDataList, fields, visualDevJsonModel.getId(), false);
|
||||
|
||||
return noSwapDataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevModelDataEntity getInfo(String id) {
|
||||
QueryWrapper<VisualdevModelDataEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(VisualdevModelDataEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevModelDataInfoVO infoDataChange(String id, VisualdevEntity visualdevEntity)
|
||||
throws IOException, ParseException, DataException, SQLException {
|
||||
FormDataModel formDataModel = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
List<FieLdsModel> modelList = JsonUtil.getJsonToList(formDataModel.getFields(), FieLdsModel.class);
|
||||
|
||||
VisualdevModelDataEntity visualdevModelDataEntity = this.getInfo(id);
|
||||
|
||||
List<FieLdsModel> childFieldModelList = new ArrayList<>();
|
||||
List<FieLdsModel> mainFieldModelList = new ArrayList<>();
|
||||
// 二维码 条形码
|
||||
List<FormModel> models = new ArrayList<>();
|
||||
OnlinePublicUtils.recurseFiled(modelList, mainFieldModelList, childFieldModelList, models);
|
||||
|
||||
if (visualdevModelDataEntity != null) {
|
||||
Map<String, Object> DataMap = JsonUtil.stringToMap(visualdevModelDataEntity.getData());
|
||||
Map<String, Object> childTableMap = DataMap.entrySet().stream()
|
||||
.filter(m -> m.getKey().contains("tableField"))
|
||||
.collect(Collectors.toMap((e) -> (String) e.getKey(),
|
||||
(e) -> ObjectUtil.isNotEmpty(e.getValue()) ? e.getValue() : ""));
|
||||
Map<String, Object> mainTableMap = DataMap.entrySet().stream()
|
||||
.filter(m -> !m.getKey().contains("tableField"))
|
||||
.collect(Collectors.toMap((e) -> (String) e.getKey(),
|
||||
(e) -> ObjectUtil.isNotEmpty(e.getValue()) ? e.getValue() : ""));
|
||||
mainTableMap = onlineDevInfoUtils.swapChildTableDataInfo(mainFieldModelList, mainTableMap, models);
|
||||
|
||||
for (Map.Entry<String, Object> entry : childTableMap.entrySet()) {
|
||||
List<Map<String, Object>> listMap = JsonUtil.getJsonToListMap(String.valueOf(entry.getValue()));
|
||||
FieLdsModel fieLdsModel = childFieldModelList.stream()
|
||||
.filter(child -> child.getVModel().equalsIgnoreCase(entry.getKey())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotEmpty(fieLdsModel)) {
|
||||
List<Map<String, Object>> tableValueList = new ArrayList<>();
|
||||
if (Objects.nonNull(listMap)) {
|
||||
for (Map<String, Object> map : listMap) {
|
||||
Map<String, Object> childFieldMap = onlineDevInfoUtils
|
||||
.swapChildTableDataInfo(fieLdsModel.getConfig().getChildren(), map, models);
|
||||
tableValueList.add(childFieldMap);
|
||||
}
|
||||
}
|
||||
Map<String, Object> childFieldsMap = new HashMap<>();
|
||||
childFieldsMap.put(entry.getKey(), tableValueList);
|
||||
mainTableMap.putAll(childFieldsMap);
|
||||
}
|
||||
}
|
||||
String objectToString = JsonUtilEx.getObjectToString(mainTableMap);
|
||||
VisualdevModelDataInfoVO vo = new VisualdevModelDataInfoVO();
|
||||
vo.setData(objectToString);
|
||||
vo.setId(id);
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataModel visualCreate(VisualParamModel visualParamModel) throws Exception {
|
||||
VisualdevEntity visualdevEntity = visualParamModel.getVisualdevEntity();
|
||||
Map<String, Object> map = visualParamModel.getData();
|
||||
boolean isLink = visualParamModel.getIsLink();
|
||||
boolean isUpload = visualParamModel.getIsUpload();
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(visualdevEntity.getColumnData(),
|
||||
ColumnDataModel.class);
|
||||
Boolean needP = false;
|
||||
List<String> formPerList = new ArrayList<>();
|
||||
if (columnDataModel != null && StringUtil.isNotEmpty(visualParamModel.getMenuId())) {
|
||||
needP = columnDataModel.getUseFormPermission();
|
||||
Map<String, Object> pMap = PermissionInterfaceImpl.getFormMap();
|
||||
if (pMap.get(visualParamModel.getMenuId()) != null) {
|
||||
formPerList = JsonUtil.getJsonToList(pMap.get(visualParamModel.getMenuId()), ModuleFormModel.class)
|
||||
.stream()
|
||||
.map(ModuleFormModel::getEnCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
List<FieLdsModel> list = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
DbLinkEntity linkEntity = StringUtil.isNotEmpty(visualdevEntity.getDbLinkId())
|
||||
? dblinkService.getInfo(visualdevEntity.getDbLinkId())
|
||||
: null;
|
||||
|
||||
// 递归遍历模板
|
||||
RecursionForm recursionForm = new RecursionForm(list, tableModels);
|
||||
List<FormAllModel> formAllModel = new ArrayList<>();
|
||||
FormCloumnUtil.recursionForm(recursionForm, formAllModel);
|
||||
// 是否开启并发锁
|
||||
Boolean concurrency = false;
|
||||
Integer primaryKeyPolicy = formData.getPrimaryKeyPolicy();
|
||||
if (formData.getConcurrencyLock()) {
|
||||
// 初始化version值
|
||||
map.put(TableFeildsEnum.VERSION.getField(), 0);
|
||||
concurrency = true;
|
||||
}
|
||||
OnlineSwapDataUtils.swapDatetime(list, map);
|
||||
// 单行唯一校验
|
||||
if (!isUpload) {
|
||||
CheckFormModel checkFormModel = CheckFormModel.builder().formFieldList(list).dataMap(map)
|
||||
.linkEntity(linkEntity).tableModelList(tableModels)
|
||||
.visualdevEntity(visualdevEntity).id(null).isLink(isLink).build();
|
||||
String b = formCheckUtils.checkForm(checkFormModel);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
throw new WorkFlowException(b);
|
||||
}
|
||||
}
|
||||
String mainId = RandomUtil.uuId();
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
UserEntity info = userApi.getInfo(userInfo.getUserId());
|
||||
DataModel dataModel = DataModel.builder().visualId(visualdevEntity.getId())
|
||||
.dataNewMap(map).fieLdsModelList(list).tableModelList(tableModels).formAllModel(formAllModel)
|
||||
.mainId(mainId).link(linkEntity).userEntity(info).concurrencyLock(concurrency)
|
||||
.primaryKeyPolicy(primaryKeyPolicy).linkOpen(isLink)
|
||||
.needPermission(needP).formPerList(formPerList)
|
||||
.build();
|
||||
flowFormDataUtil.create(dataModel);
|
||||
|
||||
// 数据日志
|
||||
if (formData.isDataLog() && !isUpload && !isLink) {
|
||||
visualLogService.createEventLog(VisualLogForm.builder().modelId(visualdevEntity.getId())
|
||||
.dataId(dataModel.getMainId()).newData(map).type(0).build());
|
||||
}
|
||||
return dataModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataModel visualUpdate(VisualParamModel visualParamModel) throws Exception {
|
||||
VisualdevEntity visualdevEntity = visualParamModel.getVisualdevEntity();
|
||||
Map<String, Object> map = visualParamModel.getData();
|
||||
String id = visualParamModel.getId();
|
||||
boolean isUpload = visualParamModel.getIsUpload();
|
||||
boolean onlyUpdate = visualParamModel.getOnlyUpdate();
|
||||
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(visualdevEntity.getColumnData(),
|
||||
ColumnDataModel.class);
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
Boolean needP = false;
|
||||
List<String> formPerList = new ArrayList<>();
|
||||
if (columnDataModel != null && StringUtil.isNotEmpty(visualParamModel.getMenuId())) {
|
||||
needP = columnDataModel.getUseFormPermission();
|
||||
Map<String, Object> pMap = PermissionInterfaceImpl.getFormMap();
|
||||
if (pMap.get(visualParamModel.getMenuId()) != null) {
|
||||
formPerList = JsonUtil.getJsonToList(pMap.get(visualParamModel.getMenuId()), ModuleFormModel.class)
|
||||
.stream()
|
||||
.map(ModuleFormModel::getEnCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
List<FieLdsModel> list = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
boolean inlineEdit = columnDataModel.getType() != null && columnDataModel.getType() == 4;
|
||||
if (inlineEdit && RequestContext.isOrignPc()) {
|
||||
list = JsonUtil.getJsonToList(columnDataModel.getColumnList(), FieLdsModel.class);
|
||||
list = list.stream().filter(f -> !f.getId().toLowerCase().contains(YunzhupaasKeyConsts.CHILD_TABLE_PREFIX))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
TableModel mainT = tableModels.stream().filter(t -> t.getTypeId().equals("1")).findFirst().orElse(null);
|
||||
DbLinkEntity linkEntity = StringUtil.isNotEmpty(visualdevEntity.getDbLinkId())
|
||||
? dblinkService.getInfo(visualdevEntity.getDbLinkId())
|
||||
: null;
|
||||
|
||||
// 递归遍历模板
|
||||
RecursionForm recursionForm = new RecursionForm(list, tableModels);
|
||||
List<FormAllModel> formAllModel = new ArrayList<>();
|
||||
FormCloumnUtil.recursionForm(recursionForm, formAllModel);
|
||||
// 是否开启并发锁
|
||||
Boolean isConcurrencyLock = false;
|
||||
Integer primaryKeyPolicy = formData.getPrimaryKeyPolicy();
|
||||
if (formData.getConcurrencyLock()) {
|
||||
if (map.get(TableFeildsEnum.VERSION.getField()) == null) {
|
||||
map.put(TableFeildsEnum.VERSION.getField(), 0);
|
||||
} else {
|
||||
boolean version = true;
|
||||
try {
|
||||
Object realId = id;
|
||||
if (Objects.equals(primaryKeyPolicy, 2)) {
|
||||
realId = Long.parseLong(id);
|
||||
}
|
||||
version = flowFormDataUtil.getVersion(mainT.getTable(), linkEntity, map, realId);
|
||||
} catch (Exception e) {
|
||||
throw new WorkFlowException(e.getMessage(), e);
|
||||
}
|
||||
if (!version) {
|
||||
throw new WorkFlowException(MsgCode.VS405.get());
|
||||
} else {
|
||||
Integer vs = Integer.valueOf(String.valueOf(map.get(TableFeildsEnum.VERSION.getField())));
|
||||
map.put(TableFeildsEnum.VERSION.getField(), vs + 1);
|
||||
}
|
||||
}
|
||||
isConcurrencyLock = true;
|
||||
}
|
||||
OnlineSwapDataUtils.swapDatetime(list, map);
|
||||
// 单行唯一校验
|
||||
if (!isUpload) {
|
||||
CheckFormModel checkFormModel = CheckFormModel.builder().formFieldList(list).dataMap(map)
|
||||
.linkEntity(linkEntity).tableModelList(tableModels)
|
||||
.visualdevEntity(visualdevEntity).id(id).build();
|
||||
String b = formCheckUtils.checkForm(checkFormModel);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
throw new WorkFlowException(b);
|
||||
}
|
||||
}
|
||||
|
||||
// 数据日志
|
||||
VisualdevModelDataInfoVO resOld = visualDevInfoService.getDetailsDataInfo(id, visualdevEntity,
|
||||
OnlineInfoModel.builder().needRlationFiled(true).needSwap(false).formAllModel(formAllModel).build());
|
||||
Map<String, Object> oldData = JsonUtil.stringToMap(resOld.getData());
|
||||
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
UserEntity info = userApi.getInfo(userInfo.getUserId());
|
||||
DataModel dataModel = DataModel.builder().visualId(visualdevEntity.getId())
|
||||
.dataNewMap(map).fieLdsModelList(list).tableModelList(tableModels).formAllModel(formAllModel)
|
||||
.mainId(id).link(linkEntity).userEntity(info).concurrencyLock(isConcurrencyLock)
|
||||
.primaryKeyPolicy(primaryKeyPolicy).onlyUpdate(onlyUpdate).logicalDelete(formData.getLogicalDelete())
|
||||
.needPermission(needP).formPerList(formPerList)
|
||||
.build();
|
||||
flowFormDataUtil.update(dataModel);
|
||||
VisualdevModelDataInfoVO res = visualDevInfoService.getDetailsDataInfo(id, visualdevEntity,
|
||||
OnlineInfoModel.builder().needRlationFiled(true).needSwap(false).formAllModel(formAllModel).build());
|
||||
Map<String, Object> newData = JsonUtil.stringToMap(res.getData());
|
||||
VisualLogForm form = VisualLogForm.builder().modelId(visualdevEntity.getId()).dataId(id).oldData(oldData)
|
||||
.newData(newData).type(1).build();
|
||||
// 处理变更字段信息-任务流程用
|
||||
List<VisualLogModel> listLog = new ArrayList<>();
|
||||
visualLogService.addLog(form, listLog);
|
||||
dataModel.setListLog(listLog);
|
||||
// 数据日志
|
||||
if (formData.isDataLog() && !isUpload) {
|
||||
form.setListLog(listLog);
|
||||
visualLogService.createEventLog(form);
|
||||
}
|
||||
return dataModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualDelete(VisualdevEntity visualdevEntity, List<Map<String, Object>> data) throws Exception {
|
||||
VisualDevJsonModel visualJsonModel = OnlinePublicUtils.getVisualJsonModel(visualdevEntity);
|
||||
// 判断请求客户端来源
|
||||
if (!RequestContext.isOrignPc()) {
|
||||
visualJsonModel.setColumnData(visualJsonModel.getAppColumnData());
|
||||
}
|
||||
List<String> idsList = new ArrayList<>();
|
||||
StringJoiner errMess = new StringJoiner(",");
|
||||
// todo 流程关联
|
||||
for (Map<String, Object> map : data) {
|
||||
String id = String.valueOf(map.get(FlowFormConstant.ID));
|
||||
TaskEntity taskEntity = taskApi.getInfoSubmit(String.valueOf(map.get(FlowFormConstant.FLOWTASKID)),
|
||||
TaskEntity::getId,
|
||||
TaskEntity::getParentId, TaskEntity::getFullName, TaskEntity::getStatus);
|
||||
if (taskEntity != null) {
|
||||
try {
|
||||
taskApi.delete(taskEntity);
|
||||
idsList.add(id);
|
||||
} catch (Exception e) {
|
||||
errMess.add(e.getMessage());
|
||||
}
|
||||
} else {
|
||||
idsList.add(id);
|
||||
}
|
||||
}
|
||||
if (idsList.size() == 0) {
|
||||
throw new WorkFlowException(errMess.toString());
|
||||
}
|
||||
if (!StringUtil.isEmpty(visualdevEntity.getVisualTables())
|
||||
&& !OnlineDevData.TABLE_CONST.equals(visualdevEntity.getVisualTables())) {
|
||||
for (String id : idsList) {
|
||||
try {
|
||||
tableDelete(id, visualJsonModel);
|
||||
} catch (Exception e) {
|
||||
throw new WorkFlowException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void delete(VisualdevModelDataEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tableDelete(String id, VisualDevJsonModel visualDevJsonModel) throws Exception {
|
||||
DbLinkEntity linkEntity = dblinkService.getInfo(visualDevJsonModel.getDbLinkId());
|
||||
VisualDevJsonModel model = BeanUtil.copyProperties(visualDevJsonModel, VisualDevJsonModel.class);
|
||||
return flowFormDataUtil.deleteTable(id, model, linkEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult tableDeleteMore(List<String> ids, VisualDevJsonModel visualDevJsonModel) throws Exception {
|
||||
List<String> dataInfoVOList = new ArrayList<>();
|
||||
for (String id : ids) {
|
||||
boolean isDel = tableDelete(id, visualDevJsonModel);
|
||||
if (isDel) {
|
||||
dataInfoVOList.add(id);
|
||||
}
|
||||
}
|
||||
visualDevJsonModel.setDataIdList(dataInfoVOList);
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void deleteByTableName(FlowFormDataModel model) throws Exception {
|
||||
String tableName = model.getTableName();
|
||||
List<Map<String, Object>> ruleList = model.getRuleList();
|
||||
String realTableName = tableName;
|
||||
VisualdevReleaseEntity entity = visualdevReleaseService.getById(model.getFormId());
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(entity.getVisualTables(), TableModel.class);
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(entity.getFormData(), FormDataModel.class);
|
||||
Boolean logicalDelete = formData.getLogicalDelete();
|
||||
DbLinkEntity linkEntity = StringUtil.isNotEmpty(entity.getDbLinkId())
|
||||
? dblinkService.getInfo(entity.getDbLinkId())
|
||||
: null;
|
||||
List<FieLdsModel> fieLdsModels = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
List<FieLdsModel> fields = new ArrayList<>();
|
||||
OnlinePublicUtils.recursionFields(fields, fieLdsModels);
|
||||
if (StringUtil.isNotEmpty(tableName)
|
||||
&& tableName.toLowerCase().contains(YunzhupaasKeyConsts.CHILD_TABLE_PREFIX)) {
|
||||
FieLdsModel fieLdsModel = fields.stream().filter(t -> t.getVModel().equalsIgnoreCase(tableName)).findFirst()
|
||||
.orElse(null);
|
||||
if (fieLdsModel != null) {
|
||||
realTableName = fieLdsModel.getConfig().getTableName();
|
||||
}
|
||||
}
|
||||
String finalRealTableName = realTableName;
|
||||
TableModel tableModel = tableModels.stream().filter(t -> t.getTable().equals(finalRealTableName)).findFirst()
|
||||
.orElse(null);
|
||||
List<OnlineDynamicSqlModel> sqlModelList = new ArrayList<>();
|
||||
OnlineDynamicSqlModel sqlModel = new OnlineDynamicSqlModel();
|
||||
SqlTable sqlTable = SqlTable.of(tableModel.getTable());
|
||||
sqlModel.setSqlTable(sqlTable);
|
||||
sqlModel.setTableName(tableModel.getTable());
|
||||
sqlModelList.add(sqlModel);
|
||||
SuperJsonModel ruleJsonModel = null;
|
||||
// 组装查询条件
|
||||
if (ObjectUtil.isNotEmpty(ruleList)) {
|
||||
ruleJsonModel = new SuperJsonModel();
|
||||
ruleJsonModel.setMatchLogic(model.getRuleMatchLogic());
|
||||
List<SuperQueryJsonModel> superQueryJsonModelList = new ArrayList<>();
|
||||
for (Object obj : ruleList) {
|
||||
SuperQueryJsonModel ruleQueryModel = JsonUtil.getJsonToBean(obj, SuperQueryJsonModel.class);
|
||||
List<FieLdsModel> groups = ruleQueryModel.getGroups();
|
||||
if (ObjectUtil.isNotEmpty(groups)) {
|
||||
groups.stream().forEach(group -> {
|
||||
if (group.getId().toLowerCase().contains(YunzhupaasKeyConsts.CHILD_TABLE_PREFIX)) {
|
||||
group.setVModel(group.getId().split("-")[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
superQueryJsonModelList.add(ruleQueryModel);
|
||||
}
|
||||
ruleJsonModel.setConditionList(superQueryJsonModelList);
|
||||
}
|
||||
DynamicDataSourceUtil.switchToDataSource(linkEntity);
|
||||
try {
|
||||
@Cleanup
|
||||
Connection conn = ConnUtil.getConnOrDefault(linkEntity);
|
||||
String dbType = conn.getMetaData().getDatabaseProductName().trim();
|
||||
String pkeyId = flowFormDataUtil.getKey(tableModel, dbType);
|
||||
List<Object> idStringList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(ruleJsonModel)) {
|
||||
QueryExpressionDSL<SelectModel>.QueryExpressionWhereBuilder where = SqlBuilder
|
||||
.selectDistinct(sqlTable.column(pkeyId)).from(sqlTable).where();
|
||||
OnlineProductSqlUtils.getSuperSql(where, ruleJsonModel, sqlModelList, dbType, null, false);
|
||||
List<Map<String, Object>> dataList = flowFormDataMapper
|
||||
.selectManyMappedRows(where.build().render(RenderingStrategies.MYBATIS3));
|
||||
idStringList = dataList.stream().map(m -> m.get(pkeyId)).distinct().collect(Collectors.toList());
|
||||
if (ObjectUtil.isEmpty(idStringList)) {
|
||||
idStringList.add("nodata");
|
||||
}
|
||||
}
|
||||
// if (logicalDelete) {
|
||||
// SqlTable sqlt = SqlTable.of(tableModel.getTable());
|
||||
// UpdateDSL<UpdateModel> updateModelUpdateDSL = SqlBuilder.update(sqlt);
|
||||
// updateModelUpdateDSL.set(sqlt.column(TableFeildsEnum.DELETEMARK.getField())).equalTo(1);
|
||||
// updateModelUpdateDSL.set(sqlt.column(TableFeildsEnum.DELETETIME.getField())).equalTo(new
|
||||
// Date());
|
||||
// updateModelUpdateDSL.set(sqlt.column(TableFeildsEnum.DELETEUSERID.getField())).equalTo(UserProvider.getUser().getUserId());
|
||||
// UpdateDSL<UpdateModel>.UpdateWhereBuilder whereU =
|
||||
// updateModelUpdateDSL.where();
|
||||
// if (ObjectUtil.isNotEmpty(idStringList)) {
|
||||
// whereU.and(sqlTable.column(pkeyId), SqlBuilder.isIn(idStringList));
|
||||
// }
|
||||
// flowFormDataMapper.update(whereU.build().render(RenderingStrategies.MYBATIS3));
|
||||
// } else {
|
||||
DeleteDSL<DeleteModel>.DeleteWhereBuilder whereD = SqlBuilder.deleteFrom(SqlTable.of(tableModel.getTable()))
|
||||
.where();
|
||||
if (ObjectUtil.isNotEmpty(idStringList)) {
|
||||
whereD.and(sqlTable.column(pkeyId), SqlBuilder.isIn(idStringList));
|
||||
}
|
||||
flowFormDataMapper.delete(whereD.build().render(RenderingStrategies.MYBATIS3));
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new DataException(MsgCode.FA103.get());
|
||||
} finally {
|
||||
DynamicDataSourceUtil.clearSwitchDataSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.model.CheckFormModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
import com.yunzhupaas.base.model.VisualLogModel;
|
||||
import com.yunzhupaas.base.model.flow.DataModel;
|
||||
import com.yunzhupaas.base.model.flow.FlowFormDataModel;
|
||||
import com.yunzhupaas.base.util.FlowFormDataUtil;
|
||||
import com.yunzhupaas.base.util.FormCheckUtils;
|
||||
import com.yunzhupaas.base.util.ServiceBaseUtil;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.database.model.entity.DbLinkEntity;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.FormCloumnUtil;
|
||||
import com.yunzhupaas.model.visualJson.FormDataModel;
|
||||
import com.yunzhupaas.model.visualJson.TableModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormAllModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.RecursionForm;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineInfoModel;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogForm;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevInfoService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualLogService;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.TableFeildsEnum;
|
||||
import com.yunzhupaas.util.UserProvider;
|
||||
import org.mybatis.dynamic.sql.SqlTable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自定义流程表单处理
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.5
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/10/21
|
||||
*/
|
||||
@Component
|
||||
public class FlowFormCustomUtils {
|
||||
|
||||
@Autowired
|
||||
private FlowFormDataUtil flowDataUtil;
|
||||
@Autowired
|
||||
private FormCheckUtils formCheckUtils;
|
||||
@Autowired
|
||||
private ServiceBaseUtil serviceUtil;
|
||||
@Autowired
|
||||
private VisualLogService visualLogService;
|
||||
@Autowired
|
||||
private VisualDevInfoService visualDevInfoService;
|
||||
|
||||
public void create(VisualdevEntity visualdevEntity, FlowFormDataModel flowFormDataModel) throws WorkFlowException {
|
||||
String id = flowFormDataModel.getId();
|
||||
Map<String, Object> map = flowFormDataModel.getMap();
|
||||
UserEntity delegateUser = flowFormDataModel.getDelegateUser();
|
||||
List<Map<String, Object>> listFlowOperate = flowFormDataModel.getFormOperates();
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
List<FieLdsModel> list = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
DbLinkEntity linkEntity = serviceUtil.getDbLink(visualdevEntity.getDbLinkId());
|
||||
|
||||
//递归遍历模板
|
||||
RecursionForm recursionForm = new RecursionForm(list, tableModels);
|
||||
List<FormAllModel> formAllModel = new ArrayList<>();
|
||||
FormCloumnUtil.recursionForm(recursionForm, formAllModel);
|
||||
//是否开启并发锁
|
||||
Boolean concurrency = false;
|
||||
Integer primaryKeyPolicy = formData.getPrimaryKeyPolicy();
|
||||
if (formData.getConcurrencyLock()) {
|
||||
//初始化version值
|
||||
map.put(TableFeildsEnum.VERSION.getField(), 0);
|
||||
concurrency = true;
|
||||
}
|
||||
//单行唯一校验
|
||||
CheckFormModel checkFormModel = CheckFormModel.builder().formFieldList(list).dataMap(map).linkEntity(linkEntity).tableModelList(tableModels)
|
||||
.visualdevEntity(visualdevEntity).id(null).isTransfer(flowFormDataModel.getIsTransfer()).build();
|
||||
String b = formCheckUtils.checkForm(checkFormModel);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
throw new WorkFlowException(b);
|
||||
}
|
||||
String mainId = id;
|
||||
UserEntity userEntity;
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
if (delegateUser != null) {
|
||||
delegateUser.setId(userInfo.getUserId());
|
||||
userEntity = delegateUser;
|
||||
} else {
|
||||
userEntity = serviceUtil.getUserInfo(userInfo.getUserId());
|
||||
}
|
||||
DataModel dataModel = DataModel.builder().visualId(visualdevEntity.getId())
|
||||
.dataNewMap(map).fieLdsModelList(list).tableModelList(tableModels).formAllModel(formAllModel).mainId(mainId).link(linkEntity)
|
||||
.userEntity(userEntity).concurrencyLock(concurrency).primaryKeyPolicy(primaryKeyPolicy).flowFormOperates(listFlowOperate).build();
|
||||
flowDataUtil.create(dataModel);
|
||||
|
||||
//数据日志
|
||||
if (formData.isDataLog()) {
|
||||
visualLogService.createEventLog(VisualLogForm.builder().modelId(visualdevEntity.getId()).dataId(dataModel.getMainId()).newData(map).type(0).build());
|
||||
}
|
||||
}
|
||||
|
||||
public DataModel update(VisualdevEntity visualdevEntity, FlowFormDataModel flowFormDataModel) throws WorkFlowException, SQLException, DataException {
|
||||
Map<String, Object> map = flowFormDataModel.getMap();
|
||||
String id = flowFormDataModel.getId();
|
||||
List<Map<String, Object>> listFlowOperate = flowFormDataModel.getFormOperates();
|
||||
FormDataModel formData = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
TableModel mainT = tableModels.stream().filter(t -> t.getTypeId().equals("1")).findFirst().orElse(null);
|
||||
DbLinkEntity linkEntity = serviceUtil.getDbLink(visualdevEntity.getDbLinkId());
|
||||
List<FieLdsModel> list = JsonUtil.getJsonToList(formData.getFields(), FieLdsModel.class);
|
||||
|
||||
//递归遍历模板
|
||||
RecursionForm recursionForm = new RecursionForm(list, tableModels);
|
||||
List<FormAllModel> formAllModel = new ArrayList<>();
|
||||
FormCloumnUtil.recursionForm(recursionForm, formAllModel);
|
||||
//是否开启并发锁
|
||||
Boolean isConcurrencyLock = false;
|
||||
Integer primaryKeyPolicy = formData.getPrimaryKeyPolicy();
|
||||
if (formData.getConcurrencyLock()) {
|
||||
if (map.get(TableFeildsEnum.VERSION.getField()) == null) {
|
||||
map.put(TableFeildsEnum.VERSION.getField(), 0);
|
||||
} else {
|
||||
Object realId = id;
|
||||
if (Objects.equals(primaryKeyPolicy, 2)) {
|
||||
realId = Long.parseLong(id);
|
||||
}
|
||||
boolean version = flowDataUtil.getVersion(mainT.getTable(), linkEntity, map, realId);
|
||||
if (!version) {
|
||||
throw new WorkFlowException(MsgCode.VS405.get());
|
||||
} else {
|
||||
Integer vs = Integer.valueOf(String.valueOf(map.get(TableFeildsEnum.VERSION.getField())));
|
||||
map.put(TableFeildsEnum.VERSION.getField(), vs + 1);
|
||||
}
|
||||
}
|
||||
isConcurrencyLock = true;
|
||||
}
|
||||
|
||||
CheckFormModel checkFormModel = CheckFormModel.builder().formFieldList(list).dataMap(map).linkEntity(linkEntity).tableModelList(tableModels)
|
||||
.visualdevEntity(visualdevEntity).id(id).isTransfer(flowFormDataModel.getIsTransfer()).build();
|
||||
String b = formCheckUtils.checkForm(checkFormModel);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
throw new WorkFlowException(b);
|
||||
}
|
||||
|
||||
//数据日志
|
||||
VisualdevModelDataInfoVO resOld = visualDevInfoService.getDetailsDataInfo(id, visualdevEntity,
|
||||
OnlineInfoModel.builder().needRlationFiled(true).needSwap(false).formAllModel(formAllModel).build());
|
||||
Map<String, Object> oldData = JsonUtil.stringToMap(resOld.getData());
|
||||
|
||||
UserInfo userInfo = UserProvider.getUser();
|
||||
UserEntity userEntity = serviceUtil.getUserInfo(userInfo.getUserId());
|
||||
DataModel dataModel = DataModel.builder().visualId(visualdevEntity.getId())
|
||||
.dataNewMap(map).fieLdsModelList(list).formAllModel(formAllModel).tableModelList(tableModels).mainId(id).link(linkEntity)
|
||||
.userEntity(userEntity).concurrencyLock(isConcurrencyLock).primaryKeyPolicy(primaryKeyPolicy).flowFormOperates(listFlowOperate)
|
||||
.logicalDelete(formData.getLogicalDelete()).build();
|
||||
flowDataUtil.update(dataModel);
|
||||
|
||||
VisualdevModelDataInfoVO res = visualDevInfoService.getDetailsDataInfo(id, visualdevEntity,
|
||||
OnlineInfoModel.builder().needRlationFiled(true).needSwap(false).formAllModel(formAllModel).build());
|
||||
Map<String, Object> newData = JsonUtil.stringToMap(res.getData());
|
||||
VisualLogForm form = VisualLogForm.builder().modelId(visualdevEntity.getId()).dataId(id).oldData(oldData).newData(newData).type(1).build();
|
||||
|
||||
//处理变更字段信息-任务流程用
|
||||
List<VisualLogModel> listLog = new ArrayList<>();
|
||||
visualLogService.addLog(form, listLog);
|
||||
dataModel.setListLog(listLog);
|
||||
//数据日志
|
||||
if (formData.isDataLog()) {
|
||||
form.setListLog(listLog);
|
||||
visualLogService.createEventLog(form);
|
||||
}
|
||||
return dataModel;
|
||||
}
|
||||
|
||||
public DataModel saveOrUpdate(VisualdevEntity visualdevEntity, FlowFormDataModel flowFormDataModel) throws WorkFlowException, SQLException, DataException {
|
||||
List<TableModel> tableModels = JsonUtil.getJsonToList(visualdevEntity.getVisualTables(), TableModel.class);
|
||||
TableModel mainT = tableModels.stream().filter(t -> t.getTypeId().equals("1")).findFirst().orElse(null);
|
||||
DbLinkEntity linkEntity = serviceUtil.getDbLink(visualdevEntity.getDbLinkId());
|
||||
FormDataModel formDataModel = JsonUtil.getJsonToBean(visualdevEntity.getFormData(), FormDataModel.class);
|
||||
boolean autoIncrement = Objects.equals(formDataModel.getPrimaryKeyPolicy(), 2);
|
||||
String id = flowFormDataModel.getId();
|
||||
Object mainId = id;
|
||||
if (autoIncrement) {
|
||||
mainId = Long.parseLong(id);
|
||||
}
|
||||
SqlTable sqlTable = SqlTable.of(mainT.getTable());
|
||||
String realId = formCheckUtils.getCount(mainId, sqlTable, mainT, linkEntity);
|
||||
|
||||
if (StringUtil.isNotEmpty(realId)) {
|
||||
flowFormDataModel.setId(realId);
|
||||
return this.update(visualdevEntity, flowFormDataModel);
|
||||
} else {
|
||||
this.create(visualdevEntity, flowFormDataModel);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> info(VisualdevEntity visualdevEntity, String id) {
|
||||
return flowDataUtil.getEditDataInfo(visualdevEntity, id, OnlineInfoModel.builder().build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yunzhupaas.database.model.dbfield.JdbcColumnModel;
|
||||
import com.yunzhupaas.database.model.dto.PrepSqlDTO;
|
||||
import com.yunzhupaas.database.model.entity.DbLinkEntity;
|
||||
import com.yunzhupaas.database.util.JdbcUtil;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.OnlineColumnFieldModel;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.OnlineDevListDataVO;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.VisualColumnSearchVO;
|
||||
import com.yunzhupaas.base.util.FormPublicUtils;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/7/28
|
||||
*/
|
||||
public class OnlineDatabaseUtils {
|
||||
public static List<OnlineDevListDataVO> getTableDataList(DbLinkEntity dbLinkEntity, String sql, String pKeyName,
|
||||
List<OnlineColumnFieldModel> childFieldList) {
|
||||
List<OnlineDevListDataVO> list = new ArrayList<>();
|
||||
try {
|
||||
List<List<JdbcColumnModel>> fieldMods = JdbcUtil
|
||||
.queryJdbcColumns(new PrepSqlDTO(sql).withConn(dbLinkEntity)).setIsValue(true).get();
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
|
||||
for (List<JdbcColumnModel> dblist : fieldMods) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
HashMap<String, Object> collect = dblist.stream()
|
||||
.collect(Collectors.toMap(s -> Optional.ofNullable(s.getField()).orElse(""),
|
||||
s -> Optional.ofNullable(s.getValue()).orElse(""), (a, b) -> b, HashMap::new));
|
||||
dataMap.putAll(collect);
|
||||
for (OnlineColumnFieldModel on : childFieldList) {
|
||||
// 需要替换的子表字段
|
||||
JdbcColumnModel fieldMod = dblist.stream()
|
||||
.filter(dbMod -> dbMod.getTable().equalsIgnoreCase(on.getTableName())
|
||||
&& dbMod.getField().equalsIgnoreCase(on.getField()))
|
||||
.findFirst().orElse(null);
|
||||
// 将数据转成map格式
|
||||
if (ObjectUtil.isNotEmpty(fieldMod)) {
|
||||
dataMap.remove(fieldMod.getField());
|
||||
dataMap.put(on.getOriginallyField(), fieldMod.getValue());
|
||||
}
|
||||
}
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
|
||||
for (Map<String, Object> dataMap : dataList) {
|
||||
OnlineDevListDataVO dataVo = new OnlineDevListDataVO();
|
||||
dataMap = toLowerKey(dataMap);
|
||||
dataVo.setData(dataMap);
|
||||
if (dataMap.containsKey(pKeyName.toUpperCase())) {
|
||||
dataVo.setId(String.valueOf(dataMap.get(pKeyName.toUpperCase())));
|
||||
}
|
||||
list.add(dataVo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Map<String, Object> toLowerKey(Map<String, Object> map) {
|
||||
Map<String, Object> resultMap = new HashMap<>(16);
|
||||
Set<String> sets = map.keySet();
|
||||
for (String key : sets) {
|
||||
resultMap.put(key.toLowerCase(), map.get(key));
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public static Boolean existKey(List<String> feilds, String pKeyName) {
|
||||
if (feilds.size() > 0) {
|
||||
for (String feild : feilds) {
|
||||
if (feild.equals(pKeyName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<OnlineDevListDataVO> setDataId(String keyName, List<OnlineDevListDataVO> DevList) {
|
||||
keyName = keyName.toLowerCase();
|
||||
for (OnlineDevListDataVO dataVo : DevList) {
|
||||
Map<String, Object> dataMap = dataVo.getData();
|
||||
if (dataMap.get(keyName) != null) {
|
||||
dataVo.setId(String.valueOf(dataMap.get(keyName)));
|
||||
}
|
||||
}
|
||||
return DevList;
|
||||
}
|
||||
|
||||
public static List<Object> getValueList(List<VisualColumnSearchVO> searchVOList) {
|
||||
List<Object> valueList = new LinkedList<>();
|
||||
for (VisualColumnSearchVO vo : searchVOList) {
|
||||
String yunzhupaasKey = vo.getConfig().getYunzhupaasKey();
|
||||
String format;
|
||||
switch (yunzhupaasKey) {
|
||||
case YunzhupaasKeyConsts.MODIFYTIME:
|
||||
case YunzhupaasKeyConsts.CREATETIME:
|
||||
case YunzhupaasKeyConsts.DATE:
|
||||
JSONArray timeStampArray = (JSONArray) vo.getValue();
|
||||
Long o1 = (Long) timeStampArray.get(0);
|
||||
Long o2 = (Long) timeStampArray.get(1);
|
||||
format = StringUtil.isEmpty(vo.getFormat()) ? "yyyy-MM-dd HH:mm:ss" : vo.getFormat();
|
||||
// 时间戳转string格式
|
||||
String startTime = OnlinePublicUtils.getDateByFormat(o1, format);
|
||||
String endTime = OnlinePublicUtils.getDateByFormat(o2, format);
|
||||
// 处理时间查询条件范围
|
||||
endTime = endTime.substring(0, 10);
|
||||
String firstTimeDate = OnlineDatabaseUtils.getTimeFormat(startTime);
|
||||
String lastTimeDate = OnlineDatabaseUtils.getLastTimeFormat(endTime);
|
||||
valueList.add(firstTimeDate);
|
||||
valueList.add(lastTimeDate);
|
||||
break;
|
||||
case YunzhupaasKeyConsts.TIME:
|
||||
JSONArray timeArray = (JSONArray) vo.getValue();
|
||||
String start = String.valueOf(timeArray.get(0));
|
||||
String end = String.valueOf(timeArray.get(1));
|
||||
valueList.add(start);
|
||||
valueList.add(end);
|
||||
break;
|
||||
case YunzhupaasKeyConsts.NUM_INPUT:
|
||||
case YunzhupaasKeyConsts.CALCULATE:
|
||||
List<String> searchArray = (List<String>) vo.getValue();
|
||||
Integer firstValue = null;
|
||||
Integer secondValue = null;
|
||||
for (int i = 0; i < searchArray.size(); i++) {
|
||||
String name = searchArray.get(i);
|
||||
if (StringUtil.isNotEmpty(name)) {
|
||||
if (i == 0) {
|
||||
firstValue = Integer.valueOf(name);
|
||||
} else {
|
||||
secondValue = Integer.valueOf(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (firstValue != null) {
|
||||
valueList.add(firstValue);
|
||||
}
|
||||
if (secondValue != null) {
|
||||
valueList.add(secondValue);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
valueList.add(vo.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return valueList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换时间格式
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static String getTimeFormat(String time) {
|
||||
return FormPublicUtils.getTimeFormat(time);
|
||||
}
|
||||
|
||||
public static String getLastTimeFormat(String time) {
|
||||
return FormPublicUtils.getLastTimeFormat(time);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,728 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.model.datainterface.DataInterfaceActionVo;
|
||||
import com.yunzhupaas.base.service.DataInterfaceService;
|
||||
import com.yunzhupaas.base.service.DictionaryDataService;
|
||||
import com.yunzhupaas.base.service.ProvinceService;
|
||||
import com.yunzhupaas.base.service.VisualdevService;
|
||||
import com.yunzhupaas.base.util.DateTimeFormatConstant;
|
||||
import com.yunzhupaas.base.util.FormInfoUtils;
|
||||
import com.yunzhupaas.base.util.FormPublicUtils;
|
||||
import com.yunzhupaas.model.OnlineDevData;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormModel;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.MultipleControlEnum;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.OnlineDataTypeEnum;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevInfoService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualdevModelDataService;
|
||||
import com.yunzhupaas.permission.entity.*;
|
||||
import com.yunzhupaas.permission.service.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.yunzhupaas.util.Constants.ADMIN_KEY;
|
||||
|
||||
/**
|
||||
* 在线详情编辑工具类
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/10/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OnlineDevInfoUtils {
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private DictionaryDataService dictionaryDataApi;
|
||||
@Autowired
|
||||
private UserService userApi;
|
||||
@Autowired
|
||||
private FormInfoUtils formInfoUtils;
|
||||
@Autowired
|
||||
private PositionService positionApi;
|
||||
@Autowired
|
||||
private OrganizeService organizeApi;
|
||||
@Autowired
|
||||
private VisualdevService visualdevService;
|
||||
@Autowired
|
||||
private VisualdevModelDataService visualdevModelDataService;
|
||||
@Autowired
|
||||
private DataInterfaceService dataInterFaceApi;
|
||||
@Autowired
|
||||
private VisualDevInfoService visualDevInfoService;
|
||||
@Autowired
|
||||
private ProvinceService areaApi;
|
||||
@Autowired
|
||||
private RoleService roleApi;
|
||||
@Autowired
|
||||
private GroupService groupApi;
|
||||
|
||||
private Map<String, String> nullDatamap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 数据转换(不取缓存)
|
||||
*
|
||||
* @param modelList
|
||||
* @param dataMap
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> swapChildTableDataInfo(List<FieLdsModel> modelList, Map<String, Object> dataMap,
|
||||
List<FormModel> codeList) {
|
||||
Map<String, Object> dataCopyMap = new HashMap<>();
|
||||
dataCopyMap.putAll(dataMap);
|
||||
|
||||
Map<String, Map<String, Object>> dataDetailMap = new HashMap<>();
|
||||
try {
|
||||
for (FieLdsModel swapDataVo : modelList) {
|
||||
String yunzhupaasKey = swapDataVo.getConfig().getYunzhupaasKey();
|
||||
String dataType = swapDataVo.getConfig().getDataType();
|
||||
String vModel = swapDataVo.getVModel();
|
||||
Object val = dataMap.get(vModel);
|
||||
String modelValue = String.valueOf(val);
|
||||
if (StringUtil.isEmpty(modelValue) || "null".equals(modelValue)) {
|
||||
continue;
|
||||
}
|
||||
if (dataType != null) {
|
||||
// 数据接口的数据存放
|
||||
String label = swapDataVo.getProps() != null ? swapDataVo.getProps().getLabel() : "";
|
||||
String value = swapDataVo.getProps() != null ? swapDataVo.getProps().getValue() : "";
|
||||
String Children = swapDataVo.getProps() != null ? swapDataVo.getProps().getChildren() : "";
|
||||
List<Map<String, Object>> options = new ArrayList<>();
|
||||
|
||||
if (dataType.equals(OnlineDataTypeEnum.STATIC.getType())) {
|
||||
if (StringUtil.isNotEmpty(swapDataVo.getOptions())) {
|
||||
options = JsonUtil.getJsonToListMap(swapDataVo.getOptions());
|
||||
|
||||
JSONArray data = JsonUtil.getListToJsonArray(options);
|
||||
OnlineDevListUtils.getOptions(label, value, Children, data, options);
|
||||
} else {
|
||||
options = JsonUtil.getJsonToListMap(swapDataVo.getOptions());
|
||||
}
|
||||
}
|
||||
if (dataType.equals(OnlineDataTypeEnum.DYNAMIC.getType())) {
|
||||
ActionResult data = dataInterFaceApi.infoToId(swapDataVo.getInterfaceId(), null, nullDatamap);
|
||||
// api调用 序列化为linkedHashMap
|
||||
LinkedHashMap<String, List<Map<String, Object>>> actionVo = (LinkedHashMap<String, List<Map<String, Object>>>) data
|
||||
.getData();
|
||||
if (actionVo != null) {
|
||||
List<Map<String, Object>> dataList = actionVo.get("data");
|
||||
JSONArray dataAll = JsonUtil.getListToJsonArray(dataList);
|
||||
treeToList(label, value, Children, dataAll, options);
|
||||
}
|
||||
}
|
||||
if (dataType.equals(OnlineDataTypeEnum.DICTIONARY.getType())) {
|
||||
List<DictionaryDataEntity> list = dictionaryDataApi
|
||||
.getDicList(swapDataVo.getConfig().getDictionaryType());
|
||||
options = list.stream().map(dic -> {
|
||||
Map<String, Object> dictionaryMap = new HashMap<>(16);
|
||||
dictionaryMap.put("id", dic.getId());
|
||||
dictionaryMap.put("enCode", dic.getEnCode());
|
||||
dictionaryMap.put("fullName", dic.getFullName());
|
||||
return dictionaryMap;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, String> dataInterfaceMap = new HashMap<>(16);
|
||||
options.stream().forEach(o -> {
|
||||
dataInterfaceMap.put(String.valueOf(o.get(value)), String.valueOf(o.get(label)));
|
||||
});
|
||||
|
||||
List<String> valueList = new ArrayList<>();
|
||||
if (OnlinePublicUtils.getMultiple(modelValue,
|
||||
MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] data = JsonUtil.getJsonToBean(modelValue, String[][].class);
|
||||
for (String[] casData : data) {
|
||||
for (String s : casData) {
|
||||
valueList.add(s);
|
||||
}
|
||||
}
|
||||
} else if (OnlinePublicUtils.getMultiple(modelValue,
|
||||
MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
valueList = JsonUtil.getJsonToList(modelValue, String.class);
|
||||
} else {
|
||||
valueList.add(modelValue);
|
||||
}
|
||||
String allValue = valueList.stream().map(va -> dataInterfaceMap.get(va))
|
||||
.collect(Collectors.joining(","));
|
||||
dataMap.put(vModel, allValue);
|
||||
} else {
|
||||
switch (yunzhupaasKey) {
|
||||
// 公司组件
|
||||
case YunzhupaasKeyConsts.COMSELECT:
|
||||
// 部门组件
|
||||
case YunzhupaasKeyConsts.DEPSELECT:
|
||||
// 所属部门
|
||||
case YunzhupaasKeyConsts.CURRDEPT:
|
||||
dataMap.put(vModel, getOrgValue(modelValue));
|
||||
break;
|
||||
|
||||
// 所属组织
|
||||
case YunzhupaasKeyConsts.CURRORGANIZE:
|
||||
boolean isAll = "all".equals(swapDataVo.getShowLevel());
|
||||
if (isAll) {
|
||||
List<OrganizeEntity> organizeList = new ArrayList<>();
|
||||
organizeApi.getOrganizeId(modelValue, organizeList);
|
||||
Collections.reverse(organizeList);
|
||||
String value = organizeList.stream().map(OrganizeEntity::getFullName)
|
||||
.collect(Collectors.joining("/"));
|
||||
dataMap.put(vModel, value);
|
||||
} else {
|
||||
OrganizeEntity organizeEntity = organizeApi.getInfo(modelValue);
|
||||
dataMap.put(vModel,
|
||||
Objects.nonNull(organizeEntity) ? organizeEntity.getFullName() : modelValue);
|
||||
}
|
||||
break;
|
||||
|
||||
// 岗位组件
|
||||
case YunzhupaasKeyConsts.POSSELECT:
|
||||
// 所属岗位
|
||||
case YunzhupaasKeyConsts.CURRPOSITION:
|
||||
dataMap.put(vModel, getPosValue(modelValue));
|
||||
break;
|
||||
|
||||
// 用户组件
|
||||
case YunzhupaasKeyConsts.USERSELECT:
|
||||
// 创建用户
|
||||
case YunzhupaasKeyConsts.CREATEUSER:
|
||||
// 修改用户
|
||||
case YunzhupaasKeyConsts.MODIFYUSER:
|
||||
if (ADMIN_KEY.equals(modelValue)) {
|
||||
dataMap.put(vModel, "管理员");
|
||||
} else {
|
||||
dataMap.put(vModel, getUserValue(modelValue));
|
||||
}
|
||||
break;
|
||||
|
||||
// 省市区联动
|
||||
case YunzhupaasKeyConsts.ADDRESS:
|
||||
String value = String.valueOf(dataMap.get(vModel));
|
||||
if (OnlinePublicUtils.getMultiple(value,
|
||||
MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] data = JsonUtil.getJsonToBean(value, String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] AddressData : data) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : AddressData) {
|
||||
adList.add(s);
|
||||
}
|
||||
addList.add(String.join("/", areaApi.getProList(adList).stream()
|
||||
.map(pro -> pro.getFullName()).collect(Collectors.toList())));
|
||||
}
|
||||
dataMap.put(vModel, String.join(";", addList));
|
||||
} else {
|
||||
List<String> proDataS = JsonUtil.getJsonToList(value, String.class);
|
||||
dataMap.put(vModel, String.join(",", areaApi.getProList(proDataS).stream()
|
||||
.map(pro -> pro.getFullName()).collect(Collectors.toList())));
|
||||
}
|
||||
break;
|
||||
|
||||
case YunzhupaasKeyConsts.RELATIONFORM:
|
||||
VisualdevEntity entity = visualdevService.getInfo(swapDataVo.getModelId());
|
||||
VisualdevModelDataInfoVO infoVO;
|
||||
String keyId = String.valueOf(dataMap.get(vModel));
|
||||
Map<String, Object> formDataMap = new HashMap<>(16);
|
||||
if (!StringUtil.isEmpty(entity.getVisualTables())
|
||||
&& !OnlineDevData.TABLE_CONST.equals(entity.getVisualTables())) {
|
||||
infoVO = visualDevInfoService.getDetailsDataInfo(keyId, entity);
|
||||
} else {
|
||||
infoVO = visualdevModelDataService.infoDataChange(keyId, entity);
|
||||
}
|
||||
formDataMap = JsonUtil.stringToMap(infoVO.getData());
|
||||
String relationField = swapDataVo.getRelationField();
|
||||
if (formDataMap != null && formDataMap.size() > 0) {
|
||||
dataMap.put(vModel + "_id", dataMap.get(vModel));
|
||||
dataMap.put(vModel, formDataMap.get(relationField));
|
||||
dataDetailMap.put(vModel, formDataMap);
|
||||
}
|
||||
break;
|
||||
|
||||
case YunzhupaasKeyConsts.POPUPSELECT:
|
||||
ActionResult data = dataInterFaceApi.infoToId(swapDataVo.getInterfaceId(), null,
|
||||
nullDatamap);
|
||||
// api调用 序列化为linkedHashMap
|
||||
LinkedHashMap<String, List<Map<String, Object>>> actionVo = (LinkedHashMap<String, List<Map<String, Object>>>) data
|
||||
.getData();
|
||||
List<Map<String, Object>> mapList = actionVo.get("data") != null ? actionVo.get("data")
|
||||
: new ArrayList<>();
|
||||
Map<String, Object> PopMap = mapList.stream()
|
||||
.filter(map -> map.get(swapDataVo.getPropsValue()).equals(dataMap.get(vModel)))
|
||||
.findFirst().orElse(null);
|
||||
if (PopMap.size() > 0) {
|
||||
dataMap.put(vModel + "_id", dataMap.get(vModel));
|
||||
dataMap.put(vModel, PopMap.get(swapDataVo.getColumnOptions().get(0).getValue()));
|
||||
dataDetailMap.put(vModel, PopMap);
|
||||
}
|
||||
break;
|
||||
case YunzhupaasKeyConsts.POPUPTABLESELECT:
|
||||
Object popData = dataInterFaceApi.infoToId(swapDataVo.getInterfaceId(), null, null)
|
||||
.getData();
|
||||
DataInterfaceActionVo actionPo = (DataInterfaceActionVo) popData;
|
||||
List<Map<String, Object>> popMapList = new ArrayList<>();
|
||||
if (actionPo.getData() instanceof List) {
|
||||
popMapList = (List<Map<String, Object>>) actionPo.getData();
|
||||
}
|
||||
String popValue = String.valueOf(dataMap.get(vModel));
|
||||
List<String> idList = new ArrayList<>();
|
||||
if (popValue.contains("[")) {
|
||||
idList = JsonUtil.getJsonToList(popValue, String.class);
|
||||
} else {
|
||||
idList.add(popValue);
|
||||
}
|
||||
List<String> swapValue = new ArrayList<>();
|
||||
for (String id : idList) {
|
||||
popMapList.stream().filter(map -> map.get(swapDataVo.getPropsValue()).equals(id))
|
||||
.forEach(
|
||||
modelMap -> swapValue.add(
|
||||
String.valueOf(modelMap.get(swapDataVo.getRelationField()))));
|
||||
}
|
||||
dataMap.put(vModel, swapValue.stream().collect(Collectors.joining(",")));
|
||||
break;
|
||||
case YunzhupaasKeyConsts.MODIFYTIME:
|
||||
case YunzhupaasKeyConsts.CREATETIME:
|
||||
case YunzhupaasKeyConsts.DATE:
|
||||
// 判断是否为时间戳格式
|
||||
String format;
|
||||
String dateData = String.valueOf(dataMap.get(vModel));
|
||||
String dateSwapInfo = swapDataVo.getFormat() != null ? swapDataVo.getFormat()
|
||||
: swapDataVo.getType() != null
|
||||
&& swapDataVo.getType().equals(YunzhupaasKeyConsts.DATE) ? "yyyy-MM-dd"
|
||||
: "yyyy-MM-dd HH:mm:ss";
|
||||
if (!dateData.contains("-") && !dateData.contains(":") && dateData.length() > 10) {
|
||||
DateTimeFormatter ftf = DateTimeFormatter.ofPattern(dateSwapInfo);
|
||||
format = ftf.format(LocalDateTime
|
||||
.ofInstant(Instant.ofEpochMilli((Long) dataMap.get(vModel)), ZoneId.of("+8")));
|
||||
} else {
|
||||
format = dateData;
|
||||
}
|
||||
if (format.contains(".")) {
|
||||
format = format.substring(0, format.lastIndexOf("."));
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(dateSwapInfo);
|
||||
try {
|
||||
Date date = sdf.parse(format);
|
||||
String outTime = sdf.format(sdf.parse(DateUtil.dateFormat(date)));
|
||||
dataMap.put(vModel, outTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
|
||||
// 开关 滑块
|
||||
case YunzhupaasKeyConsts.SWITCH:
|
||||
String switchValue = String.valueOf(dataMap.get(vModel)).equals("1")
|
||||
? swapDataVo.getActiveTxt()
|
||||
: swapDataVo.getInactiveTxt();
|
||||
dataMap.put(vModel, switchValue);
|
||||
break;
|
||||
case YunzhupaasKeyConsts.RATE:
|
||||
BigDecimal ratevalue = new BigDecimal(0);
|
||||
if (dataMap.get(vModel) != null) {
|
||||
ratevalue = new BigDecimal(dataMap.get(vModel).toString());
|
||||
}
|
||||
dataMap.put(vModel, ratevalue);
|
||||
break;
|
||||
case YunzhupaasKeyConsts.SLIDER:
|
||||
dataMap.put(vModel,
|
||||
dataMap.get(vModel) != null ? Integer.parseInt(String.valueOf(dataMap.get(vModel)))
|
||||
: null);
|
||||
break;
|
||||
|
||||
case YunzhupaasKeyConsts.UPLOADFZ:
|
||||
case YunzhupaasKeyConsts.UPLOADIMG:
|
||||
List<Map<String, Object>> fileList = JsonUtil
|
||||
.getJsonToListMap(String.valueOf(dataMap.get(vModel)));
|
||||
dataMap.put(vModel, fileList);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 转换二维码
|
||||
swapCodeDataInfo(codeList, dataMap, dataCopyMap);
|
||||
// 关联选择属性
|
||||
if (dataDetailMap.size() > 0) {
|
||||
getDataAttr(modelList, dataMap, dataDetailMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换数据格式(编辑页)
|
||||
*
|
||||
* @param modelList 控件
|
||||
* @param dataMap 数据
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> swapDataInfoType(List<FieLdsModel> modelList, Map<String, Object> dataMap) {
|
||||
return formInfoUtils.swapDataInfoType(modelList, dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换数据格式(编辑页)
|
||||
*
|
||||
* @param modelList 控件
|
||||
* @param dataMap 数据
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getInitLineData(List<FieLdsModel> modelList, Map<String, Object> dataMap) {
|
||||
for (FieLdsModel swapDataVo : modelList) {
|
||||
String yunzhupaasKey = swapDataVo.getConfig().getYunzhupaasKey();
|
||||
String vModel = swapDataVo.getVModel();
|
||||
Object value = dataMap.get(vModel);
|
||||
if (value == null || ObjectUtil.isEmpty(value)) {
|
||||
continue;
|
||||
}
|
||||
switch (yunzhupaasKey) {
|
||||
case YunzhupaasKeyConsts.RATE:
|
||||
case YunzhupaasKeyConsts.SLIDER:
|
||||
BigDecimal ratevalue = new BigDecimal(0);
|
||||
if (dataMap.get(vModel) != null) {
|
||||
ratevalue = new BigDecimal(dataMap.get(vModel).toString());
|
||||
}
|
||||
dataMap.put(vModel, ratevalue);
|
||||
break;
|
||||
case YunzhupaasKeyConsts.UPLOADFZ:
|
||||
case YunzhupaasKeyConsts.UPLOADIMG:
|
||||
List<Map<String, Object>> fileList = JsonUtil.getJsonToListMap(String.valueOf(value));
|
||||
dataMap.put(vModel, fileList);
|
||||
break;
|
||||
|
||||
case YunzhupaasKeyConsts.DATE:
|
||||
Long dateTime = DateTimeFormatConstant.getDateObjToLong(dataMap.get(vModel));
|
||||
dataMap.put(vModel, dateTime != null ? dateTime : dataMap.get(vModel));
|
||||
break;
|
||||
|
||||
case YunzhupaasKeyConsts.SWITCH:
|
||||
dataMap.put(vModel, value != null ? Integer.parseInt(String.valueOf(value)) : null);
|
||||
break;
|
||||
// 系统自动生成控件
|
||||
case YunzhupaasKeyConsts.CURRORGANIZE:
|
||||
case YunzhupaasKeyConsts.CURRDEPT:
|
||||
// 多级组
|
||||
String orgIds = String.valueOf(dataMap.get(vModel));
|
||||
String orgId = "";
|
||||
String orgName = "";
|
||||
try {
|
||||
List<String> jsonToList = JsonUtil.getJsonToList(orgIds, String.class);
|
||||
orgId = jsonToList.get(jsonToList.size() - 1);
|
||||
} catch (Exception e) {
|
||||
orgId = orgIds;
|
||||
}
|
||||
OrganizeEntity organizeEntity = StringUtil.isNotEmpty(orgId) ? organizeApi.getInfo(orgId) : null;
|
||||
if ("all".equals(swapDataVo.getShowLevel())) {
|
||||
if (organizeEntity != null) {
|
||||
List<OrganizeEntity> organizeList = new ArrayList<>();
|
||||
organizeApi.getOrganizeId(orgId, organizeList);
|
||||
Collections.reverse(organizeList);
|
||||
orgName = organizeList.stream().map(OrganizeEntity::getFullName)
|
||||
.collect(Collectors.joining("/"));
|
||||
}
|
||||
} else {
|
||||
if (organizeEntity != null) {
|
||||
orgName = organizeEntity.getFullName();
|
||||
} else {
|
||||
orgName = " ";
|
||||
}
|
||||
}
|
||||
dataMap.put(vModel, orgName);
|
||||
break;
|
||||
case YunzhupaasKeyConsts.CURRPOSITION:
|
||||
PositionEntity positionEntity = positionApi.getInfo(String.valueOf(value));
|
||||
dataMap.put(vModel, Objects.nonNull(positionEntity) ? positionEntity.getFullName() : value);
|
||||
break;
|
||||
|
||||
case YunzhupaasKeyConsts.CREATEUSER:
|
||||
case YunzhupaasKeyConsts.MODIFYUSER:
|
||||
UserEntity userEntity = userApi.getInfo(String.valueOf(value));
|
||||
String userValue = Objects.nonNull(userEntity)
|
||||
? userEntity.getRealName() + "/" + userEntity.getAccount()
|
||||
: String.valueOf(value);
|
||||
dataMap.put(vModel, userValue);
|
||||
break;
|
||||
default:
|
||||
dataMap.put(vModel, FormPublicUtils.getDataConversion(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 二维码 条形码详情数据
|
||||
*
|
||||
* @param codeList 控件集合
|
||||
* @param swapDataMap 转换后的数据
|
||||
* @param dataMap 转换前
|
||||
* @return
|
||||
*/
|
||||
public static void swapCodeDataInfo(List<FormModel> codeList, Map<String, Object> swapDataMap,
|
||||
Map<String, Object> dataMap) {
|
||||
for (FormModel formModel : codeList) {
|
||||
String yunzhupaasKey = formModel.getConfig().getYunzhupaasKey();
|
||||
if (yunzhupaasKey.equals(YunzhupaasKeyConsts.QR_CODE)
|
||||
|| yunzhupaasKey.equals(YunzhupaasKeyConsts.BARCODE)) {
|
||||
String codeDataType = formModel.getDataType();
|
||||
if (OnlineDataTypeEnum.RELATION.getType().equals(codeDataType)) {
|
||||
String relationFiled = formModel.getRelationField();
|
||||
if (StringUtil.isNotEmpty(relationFiled)) {
|
||||
Object relationValue = dataMap.get(relationFiled);
|
||||
if (ObjectUtil.isNotEmpty(relationValue)) {
|
||||
swapDataMap.put(relationFiled + "_id", relationValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void treeToList(String value, String label, String children, JSONArray data,
|
||||
List<Map<String, Object>> result) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject ob = data.getJSONObject(i);
|
||||
Map<String, Object> tree = new HashMap<>(16);
|
||||
tree.put(value, String.valueOf(ob.get(value)));
|
||||
tree.put(label, String.valueOf(ob.get(label)));
|
||||
result.add(tree);
|
||||
if (ob.get(children) != null) {
|
||||
JSONArray childArray = ob.getJSONArray(children);
|
||||
treeToList(value, label, children, childArray, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成关联属性(弹窗选择属性,关联表单属性)
|
||||
*
|
||||
* @param fieLdsModelList
|
||||
* @param dataMap
|
||||
* @param dataDetailMap
|
||||
*/
|
||||
private static void getDataAttr(List<FieLdsModel> fieLdsModelList, Map<String, Object> dataMap,
|
||||
Map<String, Map<String, Object>> dataDetailMap) {
|
||||
for (FieLdsModel fieLdsModel : fieLdsModelList) {
|
||||
String yunzhupaasKey = fieLdsModel.getConfig().getYunzhupaasKey();
|
||||
if (yunzhupaasKey.equals(YunzhupaasKeyConsts.RELATIONFORM_ATTR)
|
||||
|| yunzhupaasKey.equals(YunzhupaasKeyConsts.POPUPSELECT_ATTR)) {
|
||||
String relationField = fieLdsModel.getRelationField();
|
||||
String showField = fieLdsModel.getShowField();
|
||||
Map<String, Object> formDataMap = dataDetailMap.get(relationField);
|
||||
dataMap.put(relationField + "_" + showField, formDataMap.get(showField));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换组织
|
||||
*
|
||||
* @param modelValue
|
||||
* @return
|
||||
*/
|
||||
private String getOrgValue(String modelValue) {
|
||||
String orgValue;
|
||||
List<String> valueList;
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] prgArray = JsonUtil.getJsonToBean(modelValue, String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] prgData : prgArray) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : prgData) {
|
||||
OrganizeEntity info = organizeApi.getInfo(s);
|
||||
adList.add(Objects.nonNull(info) ? info.getFullName() : "");
|
||||
}
|
||||
String porData = adList.stream().collect(Collectors.joining("/"));
|
||||
addList.add(porData);
|
||||
}
|
||||
orgValue = String.join(";", addList);
|
||||
} else {
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
valueList = JsonUtil.getJsonToList(modelValue, String.class);
|
||||
} else {
|
||||
valueList = Stream.of(modelValue.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
String allValue = valueList.stream().map(va -> {
|
||||
OrganizeEntity organizeEntity = organizeApi.getInfo(va);
|
||||
return Objects.nonNull(organizeEntity) ? organizeEntity.getFullName() : va;
|
||||
}).collect(Collectors.joining(","));
|
||||
orgValue = allValue;
|
||||
}
|
||||
return orgValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换岗位
|
||||
*
|
||||
* @param modelValue
|
||||
* @return
|
||||
*/
|
||||
private String getPosValue(String modelValue) {
|
||||
String posValue;
|
||||
List<String> valueList;
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] prgArray = JsonUtil.getJsonToBean(modelValue, String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] prgData : prgArray) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : prgData) {
|
||||
PositionEntity info = positionApi.getInfo(s);
|
||||
adList.add(Objects.nonNull(info) ? info.getFullName() : "");
|
||||
}
|
||||
String porData = adList.stream().collect(Collectors.joining("/"));
|
||||
addList.add(porData);
|
||||
}
|
||||
posValue = String.join(";", addList);
|
||||
} else {
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
valueList = JsonUtil.getJsonToList(modelValue, String.class);
|
||||
} else {
|
||||
valueList = Stream.of(modelValue.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
String allValue = valueList.stream().map(va -> {
|
||||
PositionEntity positionEntity = positionApi.getInfo(va);
|
||||
return Objects.nonNull(positionEntity) ? positionEntity.getFullName() : va;
|
||||
}).collect(Collectors.joining(","));
|
||||
posValue = allValue;
|
||||
}
|
||||
return posValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换用户
|
||||
*
|
||||
* @param modelValue
|
||||
* @return
|
||||
*/
|
||||
private String getUserValue(String modelValue) {
|
||||
String userValue;
|
||||
List<String> valueList;
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] prgArray = JsonUtil.getJsonToBean(modelValue, String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] prgData : prgArray) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : prgData) {
|
||||
UserEntity info = userApi.getInfo(s);
|
||||
adList.add(Objects.nonNull(info) ? info.getRealName() + "/" + info.getAccount() : "");
|
||||
}
|
||||
String porData = adList.stream().collect(Collectors.joining("/"));
|
||||
addList.add(porData);
|
||||
}
|
||||
userValue = String.join(";", addList);
|
||||
} else {
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
valueList = JsonUtil.getJsonToList(modelValue, String.class);
|
||||
} else {
|
||||
valueList = Stream.of(modelValue.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
String allValue = valueList.stream().map(va -> {
|
||||
UserEntity userEntity = userApi.getInfo(va);
|
||||
return Objects.nonNull(userEntity) ? userEntity.getRealName() + "/" + userEntity.getAccount() : va;
|
||||
}).collect(Collectors.joining(","));
|
||||
userValue = allValue;
|
||||
}
|
||||
return userValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换角色
|
||||
*
|
||||
* @param modelValue
|
||||
* @return
|
||||
*/
|
||||
private String getRoleValue(String modelValue) {
|
||||
String value;
|
||||
List<String> valueList;
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] prgArray = JsonUtil.getJsonToBean(modelValue, String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] prgData : prgArray) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : prgData) {
|
||||
RoleEntity info = roleApi.getInfo(s);
|
||||
adList.add(Objects.nonNull(info) ? info.getFullName() : "");
|
||||
}
|
||||
String porData = adList.stream().collect(Collectors.joining("/"));
|
||||
addList.add(porData);
|
||||
}
|
||||
value = String.join(";", addList);
|
||||
} else {
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
valueList = JsonUtil.getJsonToList(modelValue, String.class);
|
||||
} else {
|
||||
valueList = Stream.of(modelValue.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
String allValue = valueList.stream().map(va -> {
|
||||
RoleEntity userEntity = roleApi.getInfo(va);
|
||||
return Objects.nonNull(userEntity) ? userEntity.getFullName() : va;
|
||||
}).collect(Collectors.joining(","));
|
||||
value = allValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换分组
|
||||
*
|
||||
* @param modelValue
|
||||
* @return
|
||||
*/
|
||||
private String getGroupValue(String modelValue) {
|
||||
String value;
|
||||
List<String> valueList;
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] prgArray = JsonUtil.getJsonToBean(modelValue, String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] prgData : prgArray) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : prgData) {
|
||||
GroupEntity info = groupApi.getInfo(s);
|
||||
adList.add(Objects.nonNull(info) ? info.getFullName() : "");
|
||||
}
|
||||
String porData = adList.stream().collect(Collectors.joining("/"));
|
||||
addList.add(porData);
|
||||
}
|
||||
value = String.join(";", addList);
|
||||
} else {
|
||||
if (OnlinePublicUtils.getMultiple(modelValue, MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
valueList = JsonUtil.getJsonToList(modelValue, String.class);
|
||||
} else {
|
||||
valueList = Stream.of(modelValue.split(",")).collect(Collectors.toList());
|
||||
}
|
||||
String allValue = valueList.stream().map(va -> {
|
||||
GroupEntity info = groupApi.getInfo(va);
|
||||
return Objects.nonNull(info) ? info.getFullName() : va;
|
||||
}).collect(Collectors.joining(","));
|
||||
value = allValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,679 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.model.datainterface.DataInterfaceActionVo;
|
||||
import com.yunzhupaas.base.service.DataInterfaceService;
|
||||
import com.yunzhupaas.base.service.DictionaryDataService;
|
||||
import com.yunzhupaas.base.service.ProvinceService;
|
||||
import com.yunzhupaas.base.service.VisualdevService;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.MultipleControlEnum;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.OnlineDataTypeEnum;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.OnlineDevListDataVO;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.VisualColumnSearchVO;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevInfoService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualdevModelDataService;
|
||||
import com.yunzhupaas.permission.service.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/7/28
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OnlineDevListUtils {
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private DictionaryDataService dictionaryDataApi;
|
||||
@Autowired
|
||||
private UserService userApi;
|
||||
@Autowired
|
||||
private PositionService positionApi;
|
||||
@Autowired
|
||||
private OrganizeService organizeApi;
|
||||
@Autowired
|
||||
private VisualdevService visualdevService;
|
||||
@Autowired
|
||||
private VisualdevModelDataService visualdevModelDataService;
|
||||
@Autowired
|
||||
private DataInterfaceService dataInterFaceApi;
|
||||
@Autowired
|
||||
private VisualDevInfoService visualDevInfoService;
|
||||
@Autowired
|
||||
private ProvinceService areaApi;
|
||||
@Autowired
|
||||
private OnlineDevInfoUtils onlineDevInfoUtils;
|
||||
|
||||
private Map<String, String> nullDatamap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
* @param list
|
||||
* @param searchList
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> getNoSwapList(List<Map<String, Object>> list,
|
||||
List<VisualColumnSearchVO> searchList) {
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
if (searchList == null) {
|
||||
return list;
|
||||
}
|
||||
for (Map<String, Object> dataVo : list) {
|
||||
int i = 0;
|
||||
for (VisualColumnSearchVO vo : searchList) {
|
||||
Object dataModel = dataVo.get(vo.getVModel());
|
||||
if (dataModel == null || ObjectUtil.isEmpty(dataModel)) {
|
||||
continue;
|
||||
}
|
||||
// 多选框默认添加多选属性
|
||||
if (vo.getConfig().getYunzhupaasKey().equals(YunzhupaasKeyConsts.CHECKBOX)
|
||||
|| YunzhupaasKeyConsts.CASCADER.equals(vo.getConfig().getYunzhupaasKey())) {
|
||||
vo.setMultiple(true);
|
||||
}
|
||||
if (vo.getSearchType().equals("1")) {
|
||||
// 多选框筛选
|
||||
if (vo.getMultiple() != null && vo.getMultiple() == true) {
|
||||
List<String> asList;
|
||||
if (String.valueOf(dataModel).contains("[")) {
|
||||
asList = JsonUtil.getJsonToList(String.valueOf(dataModel), String.class);
|
||||
} else {
|
||||
String[] multipleList = String.valueOf(dataModel).split(",");
|
||||
asList = Arrays.asList(multipleList);
|
||||
}
|
||||
boolean b = asList.stream().anyMatch(t -> vo.getValue().toString().contains(t));
|
||||
if (b) {
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
if (String.valueOf(vo.getValue()).equals(String.valueOf(dataModel))) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vo.getSearchType().equals("2")) {
|
||||
if (String.valueOf(dataModel).contains(String.valueOf(vo.getValue()))) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (vo.getSearchType().equals("3")) {
|
||||
String key = vo.getConfig().getYunzhupaasKey();
|
||||
switch (key) {
|
||||
case YunzhupaasKeyConsts.MODIFYTIME:
|
||||
case YunzhupaasKeyConsts.CREATETIME:
|
||||
JSONArray timeStampArray = (JSONArray) vo.getValue();
|
||||
Long o1 = (Long) timeStampArray.get(0);
|
||||
Long o2 = (Long) timeStampArray.get(1);
|
||||
|
||||
// 时间戳转string格式
|
||||
String startTime = DateUtil.daFormat(o1);
|
||||
String endTime = DateUtil.daFormat(o2);
|
||||
// 处理时间查询条件范围
|
||||
endTime = endTime.substring(0, 10);
|
||||
String firstTimeDate = OnlineDatabaseUtils.getTimeFormat(startTime);
|
||||
String lastTimeDate = OnlineDatabaseUtils.getLastTimeFormat(endTime);
|
||||
|
||||
String value = String.valueOf(dataModel);
|
||||
if (value.contains(".")) {
|
||||
value = value.substring(0, value.lastIndexOf("."));
|
||||
}
|
||||
// 只判断到日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
boolean b = DateUtil.isEffectiveDate(sdf.parse(value), sdf.parse(firstTimeDate),
|
||||
sdf.parse(lastTimeDate));
|
||||
if (b) {
|
||||
i++;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YunzhupaasKeyConsts.NUM_INPUT:
|
||||
case YunzhupaasKeyConsts.CALCULATE:
|
||||
Float firstValue = null;
|
||||
Float secondValue = null;
|
||||
JSONArray objects = (JSONArray) vo.getValue();
|
||||
for (int k = 0; k < objects.size(); k++) {
|
||||
Object n = objects.get(k);
|
||||
if (ObjectUtil.isNotEmpty(n)) {
|
||||
if (k == 0) {
|
||||
firstValue = Float.parseFloat(String.valueOf(n));
|
||||
} else {
|
||||
secondValue = Float.parseFloat(String.valueOf(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据
|
||||
Float numValue = Float.parseFloat(String.valueOf(dataModel));
|
||||
|
||||
// 条件1,2组合的情况
|
||||
if (firstValue != null && secondValue == null) {
|
||||
if (numValue >= firstValue) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (firstValue != null && secondValue != null) {
|
||||
if (numValue >= firstValue && numValue <= secondValue) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (firstValue == null && secondValue != null) {
|
||||
if (numValue <= secondValue) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case YunzhupaasKeyConsts.DATE:
|
||||
String starTimeDates;
|
||||
String endTimeDates;
|
||||
if (dataModel == null) {
|
||||
break;
|
||||
}
|
||||
// 时间戳
|
||||
if (!String.valueOf(vo.getValue()).contains(":")
|
||||
&& !String.valueOf(vo.getValue()).contains("-")) {
|
||||
JSONArray DateTimeStampArray = (JSONArray) vo.getValue();
|
||||
Long d1 = (Long) DateTimeStampArray.get(0);
|
||||
Long d2 = (Long) DateTimeStampArray.get(1);
|
||||
long d1FirstTime = Long.parseLong(String.valueOf(d1));
|
||||
long d2LastTime = Long.parseLong(String.valueOf(d2));
|
||||
|
||||
// 时间戳转string格式
|
||||
starTimeDates = DateUtil.daFormat(d1FirstTime);
|
||||
endTimeDates = DateUtil.daFormat(d2LastTime);
|
||||
|
||||
} else {
|
||||
// 时间字符串
|
||||
String[] keyArray = String.valueOf(vo.getValue()).split(",");
|
||||
starTimeDates = keyArray[0];
|
||||
endTimeDates = keyArray[1];
|
||||
}
|
||||
if (vo.getFormat() == null) {
|
||||
starTimeDates = starTimeDates.substring(0, 10);
|
||||
endTimeDates = endTimeDates.substring(0, 10);
|
||||
}
|
||||
starTimeDates = OnlineDatabaseUtils.getTimeFormat(starTimeDates);
|
||||
endTimeDates = OnlineDatabaseUtils.getLastTimeFormat(endTimeDates);
|
||||
|
||||
String dateValue = dataModel.toString();
|
||||
if (!dateValue.contains(":") && !dateValue.contains("-")) {
|
||||
// 时间戳
|
||||
Long timeResult = (Long) dataModel;
|
||||
dateValue = DateUtil.daFormat(timeResult);
|
||||
}
|
||||
if (dateValue.contains(".")) {
|
||||
dateValue = dateValue.substring(0, dateValue.lastIndexOf("."));
|
||||
}
|
||||
dateValue = OnlineDatabaseUtils.getTimeFormat(dateValue);
|
||||
// 只判断到日期
|
||||
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
Boolean b = DateUtil.isEffectiveDate(sdfDate.parse(dateValue),
|
||||
sdfDate.parse(starTimeDates), sdfDate.parse(endTimeDates));
|
||||
if (b) {
|
||||
i++;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case YunzhupaasKeyConsts.TIME:
|
||||
JSONArray timeArray = (JSONArray) vo.getValue();
|
||||
String start = String.valueOf(timeArray.get(0));
|
||||
String end = String.valueOf(timeArray.get(1));
|
||||
start = OnlineDatabaseUtils.getTimeFormat(start);
|
||||
end = OnlineDatabaseUtils.getLastTimeFormat(end);
|
||||
String timeValue = OnlineDatabaseUtils.getTimeFormat(String.valueOf(dataModel));
|
||||
SimpleDateFormat timeSim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
boolean b = DateUtil.isEffectiveDate(timeSim.parse(timeValue), timeSim.parse(start),
|
||||
timeSim.parse(end));
|
||||
if (b) {
|
||||
i++;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == searchList.size()) {
|
||||
resultList.add(dataVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取出列表所用到的 用户 组织 岗位的id
|
||||
*
|
||||
* @param list 数据
|
||||
* @param swapDataVoList 控件
|
||||
*/
|
||||
public static void pageIdList(List<OnlineDevListDataVO> list, List<FieLdsModel> swapDataVoList,
|
||||
Map<String, Object> localCache) {
|
||||
Set<String> userList = (Set<String>) localCache.get("__user_list");
|
||||
Set<String> orgList = (Set<String>) localCache.get("__org_list");
|
||||
Set<String> posList = (Set<String>) localCache.get("__pos_list");
|
||||
Set<String> AllOrgList = (Set<String>) localCache.get("__allOrg_list");
|
||||
Set<String> roleList = (Set<String>) localCache.get("__role_list");
|
||||
for (FieLdsModel swapDataVo : swapDataVoList) {
|
||||
String yunzhupaasKey = swapDataVo.getConfig().getYunzhupaasKey();
|
||||
String vModel = swapDataVo.getVModel();
|
||||
for (OnlineDevListDataVO listVo : list) {
|
||||
Map<String, Object> dataMap = listVo.getData();
|
||||
if (StringUtil.isEmpty(String.valueOf(dataMap.get(vModel))) || dataMap.get(vModel) == null) {
|
||||
continue;
|
||||
}
|
||||
if (String.valueOf(dataMap.get(vModel)).equals("[]")
|
||||
|| String.valueOf(dataMap.get(vModel)).equals("null")) {
|
||||
continue;
|
||||
} else {
|
||||
switch (yunzhupaasKey) {
|
||||
// 公司组件
|
||||
case YunzhupaasKeyConsts.COMSELECT:
|
||||
// 部门组件
|
||||
case YunzhupaasKeyConsts.DEPSELECT:
|
||||
// 所属部门
|
||||
case YunzhupaasKeyConsts.CURRDEPT:
|
||||
// 所属公司
|
||||
case YunzhupaasKeyConsts.CURRORGANIZE:
|
||||
if ("all".equals(swapDataVo.getShowLevel())) {
|
||||
getIdInMethod(AllOrgList, dataMap.get(vModel));
|
||||
} else {
|
||||
getIdInMethod(orgList, dataMap.get(vModel));
|
||||
}
|
||||
break;
|
||||
// 角色
|
||||
case YunzhupaasKeyConsts.ROLESELECT:
|
||||
getIdInMethod(roleList, dataMap.get(vModel));
|
||||
break;
|
||||
// 岗位组件
|
||||
case YunzhupaasKeyConsts.POSSELECT:
|
||||
// 所属岗位
|
||||
case YunzhupaasKeyConsts.CURRPOSITION:
|
||||
getIdInMethod(posList, dataMap.get(vModel));
|
||||
break;
|
||||
|
||||
// 用户组件
|
||||
case YunzhupaasKeyConsts.USERSELECT:
|
||||
// 创建用户
|
||||
case YunzhupaasKeyConsts.CREATEUSER:
|
||||
// 修改用户
|
||||
case YunzhupaasKeyConsts.MODIFYUSER:
|
||||
getIdInMethod(userList, dataMap.get(vModel));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 存取对应id集合
|
||||
*
|
||||
* @param idList
|
||||
* @param modelData
|
||||
* @return
|
||||
*/
|
||||
public static Collection<String> getIdInMethod(Collection<String> idList, Object modelData) {
|
||||
if (OnlinePublicUtils.getMultiple(String.valueOf(modelData),
|
||||
MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] data = JsonUtil.getJsonToBean(String.valueOf(modelData), String[][].class);
|
||||
for (String[] AddressData : data) {
|
||||
for (String s : AddressData) {
|
||||
idList.add(s);
|
||||
}
|
||||
}
|
||||
} else if (OnlinePublicUtils.getMultiple(String.valueOf(modelData),
|
||||
MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
idList.addAll(JsonUtil.getJsonToList(String.valueOf(modelData), String.class));
|
||||
} else {
|
||||
String[] modelDatas = String.valueOf(modelData).split(",");
|
||||
for (int i = 0; i < modelDatas.length; i++) {
|
||||
idList.add(modelDatas[i]);
|
||||
}
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组页面
|
||||
*
|
||||
* @param realList
|
||||
* @param columnDataModel
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> groupData(List<Map<String, Object>> realList,
|
||||
ColumnDataModel columnDataModel) {
|
||||
List<Map<String, Object>> columnList = JsonUtil.getJsonToListMap(columnDataModel.getColumnList());
|
||||
String firstField;
|
||||
String groupField = columnDataModel.getGroupField();
|
||||
List<Map<String, Object>> collect = columnList.stream().filter(t -> "left".equals(t.get("fixed"))
|
||||
&& !String.valueOf(t.get("prop")).equals(columnDataModel.getGroupField())).collect(Collectors.toList());
|
||||
Map<String, Object> map = null;
|
||||
if (CollectionUtil.isNotEmpty(collect)) {
|
||||
map = collect.stream().filter(t -> !String.valueOf(t.get("prop")).equals(columnDataModel.getGroupField()))
|
||||
.findFirst().orElse(null);
|
||||
} else {
|
||||
map = columnList.stream()
|
||||
.filter(t -> !String.valueOf(t.get("prop")).equals(columnDataModel.getGroupField())).findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
if (map == null) {
|
||||
map = columnList.stream().filter(t -> String.valueOf(t.get("prop")).equals(columnDataModel.getGroupField()))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
firstField = String.valueOf(map.get("prop"));
|
||||
|
||||
Map<String, List<Map<String, Object>>> twoMap = new LinkedHashMap<>(16);
|
||||
|
||||
for (Map<String, Object> realMap : realList) {
|
||||
String value = String.valueOf(realMap.get(groupField));
|
||||
if (realMap.get(groupField) instanceof Double) {
|
||||
value = realMap.get(groupField).toString().replaceAll(".0+?$", "").replaceAll("[.]$", "");
|
||||
}
|
||||
boolean isKey = twoMap.get(value) != null;
|
||||
if (isKey) {
|
||||
List<Map<String, Object>> maps = twoMap.get(value);
|
||||
maps.add(realMap);
|
||||
twoMap.put(value, maps);
|
||||
} else {
|
||||
List<Map<String, Object>> childrenList = new ArrayList<>();
|
||||
childrenList.add(realMap);
|
||||
twoMap.put(value, childrenList);
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (String key : twoMap.keySet()) {
|
||||
Map<String, Object> thirdMap = new HashMap<>(16);
|
||||
thirdMap.put(firstField, !key.equals("null") ? key : "");
|
||||
thirdMap.put("top", true);
|
||||
thirdMap.put("id", RandomUtil.uuId());
|
||||
thirdMap.put("children", twoMap.get(key));
|
||||
resultList.add(thirdMap);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询
|
||||
*
|
||||
* @param label
|
||||
* @param value
|
||||
* @param Children
|
||||
* @param data
|
||||
* @param options
|
||||
*/
|
||||
public static void getOptions(String label, String value, String Children, JSONArray data,
|
||||
List<Map<String, Object>> options) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject ob = data.getJSONObject(i);
|
||||
Map<String, Object> tree = new HashMap<>(16);
|
||||
tree.put(value, String.valueOf(ob.get(value)));
|
||||
tree.put(label, String.valueOf(ob.get(label)));
|
||||
options.add(tree);
|
||||
if (ob.get(Children) != null) {
|
||||
JSONArray childrenArray = ob.getJSONArray(Children);
|
||||
getOptions(label, value, Children, childrenArray, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 树形列表页面
|
||||
*
|
||||
* @param realList
|
||||
* @param columnDataModel
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> treeListData(List<Map<String, Object>> realList,
|
||||
ColumnDataModel columnDataModel) {
|
||||
String parentField = columnDataModel.getParentField() + "_id";
|
||||
String childField = columnDataModel.getSubField();
|
||||
for (int i = 0; i < realList.size(); i++) {
|
||||
Map<String, Object> item = realList.get(i);
|
||||
if ((item.get(parentField) != null && !StringUtil.isNotEmpty(item.get(parentField).toString()))
|
||||
|| (item.get(parentField) != null && !"[]".equals(item.get(parentField).toString()))) {
|
||||
if (addChild(item, realList, parentField, childField) && realList.size() > 0) {
|
||||
realList.remove(item);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return realList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 级联递归
|
||||
*
|
||||
* @param value
|
||||
* @param label
|
||||
* @param children
|
||||
* @param data
|
||||
* @param result
|
||||
*/
|
||||
private static void treeToList(String value, String label, String children, JSONArray data,
|
||||
List<Map<String, Object>> result) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject ob = data.getJSONObject(i);
|
||||
Map<String, Object> tree = new HashMap<>(16);
|
||||
tree.put(value, String.valueOf(ob.get(value)));
|
||||
tree.put(label, String.valueOf(ob.get(label)));
|
||||
result.add(tree);
|
||||
if (ob.get(children) != null) {
|
||||
JSONArray childArray = ob.getJSONArray(children);
|
||||
treeToList(value, label, children, childArray, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 递归
|
||||
private static boolean addChild(Map<String, Object> node, List<Map<String, Object>> list, String parentField,
|
||||
String childField) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map<String, Object> ele = list.get(i);
|
||||
if (ele.get(childField).equals(node.get(parentField))) {
|
||||
if (ele.get("children") == null) {
|
||||
ele.put("children", new ArrayList<>());
|
||||
}
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) ele.get("children");
|
||||
children.add(node);
|
||||
ele.put("children", children);
|
||||
return true;
|
||||
}
|
||||
if (ele.get("children") != null) {
|
||||
List<Map<String, Object>> children = (List<Map<String, Object>>) ele.get("children");
|
||||
if (addChild(node, children, parentField, childField)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存需要转换的数据到redis(系统控件)
|
||||
*
|
||||
* @param swapDataVoList
|
||||
*/
|
||||
public void sysNeedSwapData(List<FieLdsModel> swapDataVoList, String visualDevId, Map<String, Object> localCache) {
|
||||
|
||||
// 公共数据
|
||||
String dsName = Optional.ofNullable(TenantHolder.getDatasourceId()).orElse("");
|
||||
|
||||
String redisKey;
|
||||
try {
|
||||
for (FieLdsModel swapDataVo : swapDataVoList) {
|
||||
String yunzhupaasKey = swapDataVo.getConfig().getYunzhupaasKey();
|
||||
String dataType = swapDataVo.getConfig().getDataType();
|
||||
switch (yunzhupaasKey) {
|
||||
// 省市区联动
|
||||
case YunzhupaasKeyConsts.ADDRESS:
|
||||
redisKey = "";
|
||||
if (!redisUtil.exists("")) {
|
||||
List<ProvinceEntity> provinceEntityList = new ArrayList<>();
|
||||
Map<String, String> provinceMap = new HashMap<>(16);
|
||||
provinceEntityList.stream().forEach(p -> provinceMap.put(p.getId(), p.getFullName()));
|
||||
redisUtil.insert(redisKey, provinceMap, RedisUtil.CAHCEWEEK);
|
||||
}
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
localCache.put(redisKey, redisUtil.getMap(redisKey));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (dataType != null) {
|
||||
// 数据接口的数据存放
|
||||
String label = swapDataVo.getProps().getLabel();
|
||||
String value = swapDataVo.getProps().getValue();
|
||||
String children = swapDataVo.getProps().getChildren();
|
||||
List<Map<String, Object>> options = new ArrayList<>();
|
||||
Map<String, String> dataInterfaceMap = new HashMap<>(16);
|
||||
|
||||
// 静态数据
|
||||
if (dataType.equals(OnlineDataTypeEnum.STATIC.getType())) {
|
||||
redisKey = String.format("%s-%s-%s", visualDevId, swapDataVo.getVModel(),
|
||||
OnlineDataTypeEnum.STATIC.getType());
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
if (swapDataVo.getOptions() != null) {
|
||||
options = JsonUtil.getJsonToListMap(swapDataVo.getOptions());
|
||||
String Children = swapDataVo.getProps().getChildren();
|
||||
JSONArray data = JsonUtil.getListToJsonArray(options);
|
||||
getOptions(label, value, Children, data, options);
|
||||
} else {
|
||||
options = JsonUtil.getJsonToListMap(swapDataVo.getOptions());
|
||||
}
|
||||
options.stream().forEach(o -> {
|
||||
dataInterfaceMap.put(String.valueOf(o.get(value)), String.valueOf(o.get(label)));
|
||||
});
|
||||
String staticData = JsonUtil.getObjectToString(dataInterfaceMap);
|
||||
redisUtil.insert(redisKey, staticData, 60 * 5);
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
localCache.put(redisKey, dataInterfaceMap);
|
||||
}
|
||||
} else {
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
String staticDataString = redisUtil.getString(redisKey).toString();
|
||||
localCache.put(redisKey, JsonUtil.stringToMap(staticDataString));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 远端数据
|
||||
if (dataType.equals(OnlineDataTypeEnum.DYNAMIC.getType())) {
|
||||
redisKey = String.format("%s-%s-%s", dsName, OnlineDataTypeEnum.DYNAMIC.getType(),
|
||||
swapDataVo.getConfig().getPropsUrl());
|
||||
String redisKey2 = String.format("%s-%s-%s-%s-%s-%s", dsName,
|
||||
OnlineDataTypeEnum.DYNAMIC.getType(), swapDataVo.getConfig().getPropsUrl(), label,
|
||||
value, children);
|
||||
if (!redisUtil.exists(redisKey2)) {
|
||||
ActionResult data = null;
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
data = dataInterFaceApi.infoToId(swapDataVo.getConfig().getPropsUrl(), null, null);
|
||||
// 缓存接口全部数据
|
||||
redisUtil.insert(redisKey, JSONObject.toJSONString(data), 60 * 5);
|
||||
} else {
|
||||
data = JSONObject.parseObject(String.valueOf(redisUtil.getString(redisKey)),
|
||||
ActionResult.class);
|
||||
}
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
localCache.put(redisKey, data);
|
||||
}
|
||||
if (data != null && data.getData() != null) {
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
if (data.getData() instanceof DataInterfaceActionVo) {
|
||||
DataInterfaceActionVo actionVo = (DataInterfaceActionVo) data.getData();
|
||||
if (actionVo.getData() instanceof List) {
|
||||
dataList = (List<Map<String, Object>>) actionVo.getData();
|
||||
}
|
||||
} else if (data.getData() instanceof List) {
|
||||
dataList = (List<Map<String, Object>>) data.getData();
|
||||
}
|
||||
JSONArray dataAll = JsonUtil.getListToJsonArray(dataList);
|
||||
treeToList(label, value, children, dataAll, options);
|
||||
options.stream().forEach(o -> {
|
||||
dataInterfaceMap.put(String.valueOf(o.get(value)), String.valueOf(o.get(label)));
|
||||
});
|
||||
|
||||
// 缓存接口根据特定字段转换后的全部数据
|
||||
String dynamicData = JsonUtil.getObjectToString(dataInterfaceMap);
|
||||
redisUtil.insert(redisKey2, dynamicData, 60 * 5);
|
||||
localCache.put(redisKey2, dataInterfaceMap);
|
||||
}
|
||||
} else {
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
localCache.put(redisKey, JSONObject.parseObject(
|
||||
String.valueOf(redisUtil.getString(redisKey)), ActionResult.class));
|
||||
}
|
||||
if (!localCache.containsKey(redisKey2)) {
|
||||
// 转成map格式
|
||||
String dynamicString = redisUtil.getString(redisKey2).toString();
|
||||
localCache.put(redisKey2, JsonUtil.stringToMap(dynamicString));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据字典
|
||||
if (dataType.equals(OnlineDataTypeEnum.DICTIONARY.getType())) {
|
||||
redisKey = String.format("%s-%s-%s", dsName, OnlineDataTypeEnum.DICTIONARY.getType(),
|
||||
swapDataVo.getConfig().getDictionaryType());
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
List<DictionaryDataEntity> list = dictionaryDataApi
|
||||
.getDicList(swapDataVo.getConfig().getDictionaryType());
|
||||
options = list.stream().map(dic -> {
|
||||
Map<String, Object> dictionaryMap = new HashMap<>(16);
|
||||
dictionaryMap.put("id", dic.getId());
|
||||
dictionaryMap.put("enCode", dic.getEnCode());
|
||||
dictionaryMap.put("fullName", dic.getFullName());
|
||||
return dictionaryMap;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
String dictionaryData = JsonUtil.getObjectToString(options);
|
||||
redisUtil.insert(redisKey, dictionaryData, 60 * 5);
|
||||
localCache.put(redisKey, options);
|
||||
} else {
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
String dictionaryStringData = redisUtil.getString(redisKey).toString();
|
||||
localCache.put(redisKey, JsonUtil.getJsonToListMap(dictionaryStringData));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("在线开发转换数据异常:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,658 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.entity.DictionaryDataEntity;
|
||||
import com.yunzhupaas.base.entity.ProvinceEntity;
|
||||
import com.yunzhupaas.base.model.datainterface.DataInterfaceModel;
|
||||
import com.yunzhupaas.base.model.datainterface.DataInterfacePage;
|
||||
import com.yunzhupaas.base.service.DataInterfaceService;
|
||||
import com.yunzhupaas.base.service.DictionaryDataService;
|
||||
import com.yunzhupaas.base.service.ProvinceService;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.TemplateJsonModel;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.CacheKeyEnum;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.OnlineDataTypeEnum;
|
||||
import com.yunzhupaas.permission.service.*;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.RedisUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.ThreadPoolExecutorUtil;
|
||||
import com.yunzhupaas.util.data.DataSourceContextHolder;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlineSwapDataUtils.NEEDCACHE_REMOTE;
|
||||
|
||||
/**
|
||||
* 在线开发数据缓存获取,多线程
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.5.x
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2023/12/19
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class OnlineExecutor {
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private UserService userApi;
|
||||
@Autowired
|
||||
private OrganizeService organizeApi;
|
||||
@Autowired
|
||||
private PositionService positionApi;
|
||||
@Autowired
|
||||
private RoleService roleApi;
|
||||
@Autowired
|
||||
private GroupService groupApi;
|
||||
@Autowired
|
||||
private ProvinceService areaApi;
|
||||
@Autowired
|
||||
private DictionaryDataService dictionaryDataApi;
|
||||
@Autowired
|
||||
private DataInterfaceService dataInterFaceApi;
|
||||
|
||||
private String dsName = "";
|
||||
private static long DEFAULT_CACHE_TIME = OnlineSwapDataUtils.DEFAULT_CACHE_TIME;
|
||||
private static final String KEY_USER = "user";
|
||||
private static final String KEY_ORG = "org";
|
||||
private static final String KEY_POS = "pos";
|
||||
private static final String KEY_ROLE = "role";
|
||||
private static final String KEY_GROUP = "group";
|
||||
private static final String KEY_PROVINCE = "province";
|
||||
private static final String KEY_POP = "pop";
|
||||
private static final String KEY_SELECT = "select";
|
||||
private static final String KEY_DATATYPE = "datatype";
|
||||
private static final String KEY_ORGTREE = "orgtree";
|
||||
|
||||
/**
|
||||
* 遍历需要多线程缓存
|
||||
*/
|
||||
public void executorRedis(Map<String, Object> localCache, List<FieLdsModel> swapDataVoList, String visualDevId,
|
||||
Boolean inlineEdit,
|
||||
List<Map<String, Object>> list, Map<String, Object> mainAndMast) {
|
||||
dsName = Optional.ofNullable(DataSourceContextHolder.getDatasourceId()).orElse("");
|
||||
Map<String, OnlineExecutorParam> listExecutor = new HashMap<>();
|
||||
for (int x = 0; x < list.size(); x++) {
|
||||
Map<String, Object> dataMap = list.get(x);
|
||||
if (dataMap == null) {
|
||||
continue;
|
||||
}
|
||||
for (FieLdsModel swapDataVo : swapDataVoList) {
|
||||
String yunzhupaasKey = swapDataVo.getConfig().getYunzhupaasKey();
|
||||
if (StringUtil.isEmpty(swapDataVo.getVModel())) {
|
||||
continue;
|
||||
}
|
||||
String swapVModel = swapDataVo.getVModel();
|
||||
String dataType = swapDataVo.getConfig().getDataType();
|
||||
String redisKey;
|
||||
boolean needUser = false, needOrg = false, needPos = false, needRole = false, needGroup = false,
|
||||
needProvince = false, needOrgTree = false;
|
||||
|
||||
switch (yunzhupaasKey) {
|
||||
// 用户组件
|
||||
case YunzhupaasKeyConsts.USERSELECT:
|
||||
// 创建用户
|
||||
case YunzhupaasKeyConsts.CREATEUSER:
|
||||
// 修改用户
|
||||
case YunzhupaasKeyConsts.MODIFYUSER:
|
||||
needUser = true;
|
||||
break;
|
||||
// 公司组件
|
||||
case YunzhupaasKeyConsts.COMSELECT:
|
||||
// 部门组件
|
||||
case YunzhupaasKeyConsts.DEPSELECT:
|
||||
// 所属部门
|
||||
case YunzhupaasKeyConsts.CURRDEPT:
|
||||
// 所属组织
|
||||
case YunzhupaasKeyConsts.CURRORGANIZE:
|
||||
needOrg = true;
|
||||
needOrgTree = true;
|
||||
break;
|
||||
// 岗位组件
|
||||
case YunzhupaasKeyConsts.POSSELECT:
|
||||
// 所属岗位
|
||||
case YunzhupaasKeyConsts.CURRPOSITION:
|
||||
needPos = true;
|
||||
break;
|
||||
// 角色选择
|
||||
case YunzhupaasKeyConsts.ROLESELECT:
|
||||
needRole = true;
|
||||
break;
|
||||
// 分组选择
|
||||
case YunzhupaasKeyConsts.GROUPSELECT:
|
||||
needGroup = true;
|
||||
break;
|
||||
// 用户选择组件
|
||||
case YunzhupaasKeyConsts.CUSTOMUSERSELECT:
|
||||
needUser = needOrg = needPos = needGroup = needRole = true;
|
||||
break;
|
||||
// 省市区选择组件
|
||||
case YunzhupaasKeyConsts.ADDRESS:
|
||||
needProvince = true;
|
||||
break;
|
||||
case YunzhupaasKeyConsts.POPUPSELECT:
|
||||
case YunzhupaasKeyConsts.POPUPTABLESELECT:
|
||||
List<TemplateJsonModel> templateJsonModels = JsonUtil
|
||||
.getJsonToList(swapDataVo.getTemplateJson(), TemplateJsonModel.class);
|
||||
if (dataMap.get(swapVModel) == null)
|
||||
continue;
|
||||
String value = String.valueOf(dataMap.get(swapVModel));
|
||||
List<DataInterfaceModel> listParam = new ArrayList<>();
|
||||
for (TemplateJsonModel templateJsonModel : templateJsonModels) {
|
||||
String relationField = templateJsonModel.getRelationField();
|
||||
DataInterfaceModel dataInterfaceModel = JsonUtil.getJsonToBean(templateJsonModel,
|
||||
DataInterfaceModel.class);
|
||||
if (StringUtil.isEmpty(relationField)) {
|
||||
listParam.add(dataInterfaceModel);
|
||||
continue;
|
||||
}
|
||||
String obj = inlineEdit ? ""
|
||||
: Optional.ofNullable(dataMap.get(relationField)).orElse("").toString();
|
||||
if (relationField.toLowerCase().contains(YunzhupaasKeyConsts.CHILD_TABLE_PREFIX)) {
|
||||
String childField = relationField.split("-")[1];
|
||||
obj = Optional.ofNullable(dataMap.get(childField)).orElse("").toString();
|
||||
} else if (mainAndMast != null) {
|
||||
obj = Optional.ofNullable(mainAndMast.get(relationField)).orElse("").toString();
|
||||
}
|
||||
dataInterfaceModel.setDefaultValue(obj);
|
||||
listParam.add(dataInterfaceModel);
|
||||
}
|
||||
DataInterfacePage dataInterfacePage = new DataInterfacePage();
|
||||
dataInterfacePage.setParamList(listParam);
|
||||
dataInterfacePage.setInterfaceId(swapDataVo.getInterfaceId());
|
||||
List<String> ids = new ArrayList<>();
|
||||
if (value.startsWith("[")) {
|
||||
ids = JsonUtil.getJsonToList(value, String.class);
|
||||
} else {
|
||||
ids.add(value);
|
||||
}
|
||||
dataInterfacePage.setIds(ids);
|
||||
// 缓存Key 租户-远端数据-base64({id, params, ids})
|
||||
redisKey = String.format("%s-%s-%s-%s", dsName, OnlineDataTypeEnum.DYNAMIC.getType(),
|
||||
swapDataVo.getInterfaceId(),
|
||||
Base64.getEncoder().encodeToString(JsonUtil.getObjectToString(dataInterfacePage)
|
||||
.getBytes(StandardCharsets.UTF_8)));
|
||||
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
dataInterfacePage.setPropsValue(swapDataVo.getPropsValue());
|
||||
dataInterfacePage.setRelationField(swapDataVo.getRelationField());
|
||||
listExecutor.putIfAbsent(redisKey,
|
||||
new OnlineExecutorParam(redisKey, KEY_POP, swapDataVo.getInterfaceId(),
|
||||
dataInterfacePage, swapDataVo.getConfig().getUseCache()));
|
||||
}
|
||||
break;
|
||||
case YunzhupaasKeyConsts.CASCADER:
|
||||
case YunzhupaasKeyConsts.RADIO:
|
||||
case YunzhupaasKeyConsts.CHECKBOX:
|
||||
case YunzhupaasKeyConsts.SELECT:
|
||||
case YunzhupaasKeyConsts.TREESELECT:
|
||||
// 动态
|
||||
List<TemplateJsonModel> templateList = JsonUtil
|
||||
.getJsonToList(swapDataVo.getConfig().getTemplateJson(), TemplateJsonModel.class);
|
||||
if (templateList.size() > 0) {
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
for (TemplateJsonModel templateJsonModel : templateList) {
|
||||
String relationField = templateJsonModel.getRelationField();
|
||||
String Field = templateJsonModel.getField();
|
||||
String obj = inlineEdit ? ""
|
||||
: Optional.ofNullable(dataMap.get(relationField)).orElse("").toString();
|
||||
if (StringUtil.isEmpty(relationField)) {
|
||||
paramMap.put(Field, templateJsonModel.getDefaultValue());
|
||||
continue;
|
||||
}
|
||||
if (relationField.toLowerCase().contains(YunzhupaasKeyConsts.CHILD_TABLE_PREFIX)) {
|
||||
String childField = relationField.split("-")[1];
|
||||
obj = Optional.ofNullable(dataMap.get(childField)).orElse("").toString();
|
||||
} else if (mainAndMast != null) {
|
||||
obj = Optional.ofNullable(mainAndMast.get(relationField)).orElse("").toString();
|
||||
}
|
||||
paramMap.put(Field, obj);
|
||||
}
|
||||
// 缓存Key 租户-远端数据-id-base64({params})
|
||||
redisKey = String.format("%s-%s-%s-%s", dsName, OnlineDataTypeEnum.DYNAMIC.getType(),
|
||||
swapDataVo.getConfig().getPropsUrl(),
|
||||
Base64.getEncoder().encodeToString(
|
||||
JsonUtil.getObjectToString(paramMap).getBytes(StandardCharsets.UTF_8)));
|
||||
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey,
|
||||
new OnlineExecutorParam(redisKey, KEY_SELECT,
|
||||
swapDataVo.getConfig().getPropsUrl(), paramMap,
|
||||
swapDataVo.getConfig().getUseCache()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (dataType != null) {
|
||||
// 数据接口的数据存放
|
||||
String label = swapDataVo.getProps().getLabel() != null ? swapDataVo.getProps().getLabel() : "";
|
||||
String value = swapDataVo.getProps().getValue() != null ? swapDataVo.getProps().getValue() : "";
|
||||
String children = swapDataVo.getProps().getChildren() != null ? swapDataVo.getProps().getChildren()
|
||||
: "";
|
||||
if (swapDataVo.getConfig().getYunzhupaasKey().equals(YunzhupaasKeyConsts.POPUPSELECT)
|
||||
|| swapDataVo.getConfig().getYunzhupaasKey().equals(YunzhupaasKeyConsts.POPUPTABLESELECT)) {
|
||||
label = swapDataVo.getRelationField();
|
||||
value = swapDataVo.getPropsValue();
|
||||
}
|
||||
// 静态数据
|
||||
if (dataType.equals(OnlineDataTypeEnum.STATIC.getType())) {
|
||||
redisKey = String.format("%s-%s-%s", visualDevId,
|
||||
swapDataVo.getConfig().getRelationTable() + swapDataVo.getVModel(),
|
||||
OnlineDataTypeEnum.STATIC.getType());
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey,
|
||||
new OnlineExecutorParam(redisKey, KEY_DATATYPE, null, swapDataVo));
|
||||
}
|
||||
}
|
||||
// 远端数据
|
||||
if (dataType.equals(OnlineDataTypeEnum.DYNAMIC.getType())) {
|
||||
// 联动状态下不做缓存, 具体查数据时做缓存
|
||||
boolean dynamicIsNeedCache = swapDataVo.getConfig().getTemplateJson().size() == 0;
|
||||
if (dynamicIsNeedCache) {
|
||||
redisKey = String.format("%s-%s-%s-%s-%s-%s", dsName, OnlineDataTypeEnum.DYNAMIC.getType(),
|
||||
swapDataVo.getConfig().getPropsUrl(), value, label, children);
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_DATATYPE, null,
|
||||
swapDataVo, swapDataVo.getConfig().getUseCache()));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据字典
|
||||
if (dataType.equals(OnlineDataTypeEnum.DICTIONARY.getType())) {
|
||||
redisKey = String.format("%s-%s-%s", dsName, OnlineDataTypeEnum.DICTIONARY.getType(),
|
||||
swapDataVo.getConfig().getDictionaryType());
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey,
|
||||
new OnlineExecutorParam(redisKey, KEY_DATATYPE, null, swapDataVo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needUser) {
|
||||
// 人员
|
||||
redisKey = dsName + CacheKeyEnum.USER.getName();
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_USER, null, null));
|
||||
}
|
||||
}
|
||||
if (needOrg) {
|
||||
// 组织
|
||||
redisKey = dsName + CacheKeyEnum.ORG.getName();
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_ORG, null, null));
|
||||
}
|
||||
}
|
||||
if (needPos) {
|
||||
// 岗位
|
||||
redisKey = dsName + CacheKeyEnum.POS.getName();
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_POS, null, null));
|
||||
}
|
||||
}
|
||||
if (needRole) {
|
||||
// 角色
|
||||
redisKey = dsName + CacheKeyEnum.ROLE.getName();
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_ROLE, null, null));
|
||||
}
|
||||
}
|
||||
if (needGroup) {
|
||||
// 分组
|
||||
redisKey = dsName + CacheKeyEnum.GROUP.getName();
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_GROUP, null, null));
|
||||
}
|
||||
}
|
||||
// 地区数据过大, 取消缓存
|
||||
/*
|
||||
* if (needProvince) {
|
||||
* //省市区
|
||||
* redisKey = String.format("%s-%s-%d", dsName, "province", 1);
|
||||
* if (!localCache.containsKey(redisKey)) {
|
||||
* listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey,
|
||||
* KEY_PROVINCE, null, null));
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
if (needOrgTree) {
|
||||
// 分组
|
||||
redisKey = dsName + CacheKeyEnum.ORGTREE.getName();
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
listExecutor.putIfAbsent(redisKey, new OnlineExecutorParam(redisKey, KEY_ORGTREE, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 执行多线程方法
|
||||
if (!listExecutor.isEmpty()) {
|
||||
this.execute(localCache, listExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行多线程
|
||||
*/
|
||||
private void execute(Map<String, Object> localCache, Map<String, OnlineExecutorParam> listExecutor) {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(listExecutor.size());
|
||||
for (String key : listExecutor.keySet()) {
|
||||
OnlineExecutorParam item = listExecutor.get(key);
|
||||
String redisKey = item.getRedisKey();
|
||||
ThreadPoolExecutorUtil.getExecutor().execute(() -> {
|
||||
try {
|
||||
switch (item.getType()) {
|
||||
case KEY_USER:
|
||||
// 人员
|
||||
Map<String, Object> userMap;
|
||||
if (redisUtil.exists(redisKey)) {
|
||||
userMap = redisUtil.getMap(redisKey);
|
||||
userMap = Optional.ofNullable(userMap).orElse(new HashMap<>(20));
|
||||
} else {
|
||||
userMap = userApi.getUserMap();
|
||||
if (OnlineSwapDataUtils.NEEDCACHE_SYS) {
|
||||
redisUtil.insert(redisKey, userMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
localCache.put("__user_map", userMap);
|
||||
break;
|
||||
case KEY_ORG:
|
||||
Map<String, Object> orgMap;
|
||||
if (redisUtil.exists(redisKey)) {
|
||||
orgMap = redisUtil.getMap(redisKey);
|
||||
orgMap = Optional.ofNullable(orgMap).orElse(new HashMap<>(20));
|
||||
} else {
|
||||
orgMap = organizeApi.getOrgMap();
|
||||
if (OnlineSwapDataUtils.NEEDCACHE_SYS) {
|
||||
redisUtil.insert(redisKey, orgMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
localCache.put("__org_map", orgMap);
|
||||
break;
|
||||
case KEY_POS:
|
||||
Map<String, Object> posMap;
|
||||
if (redisUtil.exists(redisKey)) {
|
||||
posMap = redisUtil.getMap(redisKey);
|
||||
posMap = Optional.ofNullable(posMap).orElse(new HashMap<>(20));
|
||||
} else {
|
||||
posMap = positionApi.getPosMap();
|
||||
if (OnlineSwapDataUtils.NEEDCACHE_SYS) {
|
||||
redisUtil.insert(redisKey, posMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
localCache.put("__pos_map", posMap);
|
||||
break;
|
||||
case KEY_ROLE:
|
||||
Map<String, Object> roleMap;
|
||||
if (redisUtil.exists(redisKey)) {
|
||||
roleMap = redisUtil.getMap(redisKey);
|
||||
roleMap = Optional.ofNullable(roleMap).orElse(new HashMap<>(20));
|
||||
} else {
|
||||
roleMap = roleApi.getRoleMap();
|
||||
if (OnlineSwapDataUtils.NEEDCACHE_SYS) {
|
||||
redisUtil.insert(redisKey, roleMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
localCache.put("__role_map", roleMap);
|
||||
break;
|
||||
case KEY_GROUP:
|
||||
Map<String, Object> groupMap;
|
||||
if (redisUtil.exists(redisKey)) {
|
||||
groupMap = redisUtil.getMap(redisKey);
|
||||
groupMap = Optional.ofNullable(groupMap).orElse(new HashMap<>(20));
|
||||
} else {
|
||||
groupMap = groupApi.getGroupMap();
|
||||
if (OnlineSwapDataUtils.NEEDCACHE_SYS) {
|
||||
redisUtil.insert(redisKey, groupMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
localCache.put("__group_map", groupMap);
|
||||
break;
|
||||
case KEY_PROVINCE:
|
||||
// 省市区
|
||||
Map<Object, Object> proMap = redisUtil.getMap(redisKey);
|
||||
List<Map<String, String>> proMapList = new ArrayList<>();
|
||||
if (proMap.size() == 0) {
|
||||
// 分级存储
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
String redisKeyEach = String.format("%s-%s-%d", dsName, "province", i);
|
||||
if (!redisUtil.exists(redisKeyEach)) {
|
||||
List<ProvinceEntity> provinceEntityList = areaApi
|
||||
.getProListBytype(String.valueOf(i));
|
||||
Map<String, String> provinceMap = new HashMap<>(16);
|
||||
if (provinceEntityList != null) {
|
||||
provinceEntityList.stream()
|
||||
.forEach(p -> provinceMap.put(p.getId(), p.getFullName()));
|
||||
}
|
||||
proMapList.add(provinceMap);
|
||||
// 区划基本不修改 不做是否缓存判断
|
||||
redisUtil.insert(redisKeyEach, provinceMap, RedisUtil.CAHCEWEEK);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
proMapList.add(redisUtil.getMap(String.format("%s-%s-%d", dsName, "province", i)));
|
||||
}
|
||||
}
|
||||
localCache.put("__pro_maplist", proMapList);
|
||||
break;
|
||||
case KEY_POP:
|
||||
List<Map<String, Object>> mapList = null;
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
mapList = dataInterFaceApi.infoToInfo(item.getInterfaceId(),
|
||||
(DataInterfacePage) item.getParam());
|
||||
if (NEEDCACHE_REMOTE && mapList != null && mapList.size() > 0 && item.getUseCache()) {
|
||||
redisUtil.insert(item.getRedisKey(), mapList, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
} else {
|
||||
List<Object> tmpList = redisUtil.get(redisKey, 0, -1);
|
||||
List<Map<String, Object>> tmpMapList = new ArrayList<>();
|
||||
tmpList.forEach(itemx -> {
|
||||
tmpMapList.add(JsonUtil.entityToMap(itemx));
|
||||
});
|
||||
mapList = tmpMapList;
|
||||
}
|
||||
localCache.put(item.getRedisKey(), mapList);
|
||||
break;
|
||||
case KEY_SELECT:
|
||||
List<Map<String, Object>> dataList = null;
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
ActionResult data = dataInterFaceApi.infoToId(item.getInterfaceId(), null,
|
||||
(Map) item.getParam());
|
||||
if (data != null && data.getData() != null) {
|
||||
if (data.getData() instanceof List) {
|
||||
dataList = (List<Map<String, Object>>) data.getData();
|
||||
if (NEEDCACHE_REMOTE && CollectionUtils.isNotEmpty(dataList)
|
||||
&& item.getUseCache()) {
|
||||
redisUtil.insert(redisKey, dataList, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<Object> tmpList = redisUtil.get(redisKey, 0, -1);
|
||||
List<Map<String, Object>> tmpMapList = new ArrayList<>();
|
||||
tmpList.forEach(itemx -> {
|
||||
tmpMapList.add(JsonUtil.entityToMap(itemx));
|
||||
});
|
||||
dataList = tmpMapList;
|
||||
}
|
||||
localCache.put(redisKey, dataList);
|
||||
break;
|
||||
case KEY_DATATYPE:
|
||||
// 数据接口的数据存放
|
||||
FieLdsModel swapDataVo = (FieLdsModel) item.getParam();
|
||||
String dataType = swapDataVo.getConfig().getDataType();
|
||||
String label = swapDataVo.getProps().getLabel() != null ? swapDataVo.getProps().getLabel()
|
||||
: "";
|
||||
String value = swapDataVo.getProps().getValue() != null ? swapDataVo.getProps().getValue()
|
||||
: "";
|
||||
String children = swapDataVo.getProps().getChildren() != null
|
||||
? swapDataVo.getProps().getChildren()
|
||||
: "";
|
||||
List<Map<String, Object>> options = new ArrayList<>();
|
||||
if (swapDataVo.getConfig().getYunzhupaasKey().equals(YunzhupaasKeyConsts.POPUPSELECT)
|
||||
|| swapDataVo.getConfig().getYunzhupaasKey()
|
||||
.equals(YunzhupaasKeyConsts.POPUPTABLESELECT)) {
|
||||
label = swapDataVo.getRelationField();
|
||||
value = swapDataVo.getPropsValue();
|
||||
}
|
||||
Map<String, String> dataInterfaceMap = new HashMap<>(16);
|
||||
String finalValue = value;
|
||||
String finalLabel = label;
|
||||
// 静态数据
|
||||
if (dataType.equals(OnlineDataTypeEnum.STATIC.getType())) {
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
if (swapDataVo.getOptions() != null) {
|
||||
options = JsonUtil.getJsonToListMap(swapDataVo.getOptions());
|
||||
OnlineSwapDataUtils.getOptions(label, value, children,
|
||||
JsonUtil.getListToJsonArray(options), options);
|
||||
} else {
|
||||
options = JsonUtil.getJsonToListMap(swapDataVo.getOptions());
|
||||
}
|
||||
|
||||
options.stream().forEach(o -> {
|
||||
dataInterfaceMap.put(String.valueOf(o.get(finalValue)),
|
||||
String.valueOf(o.get(finalLabel)));
|
||||
});
|
||||
if (NEEDCACHE_REMOTE) {
|
||||
redisUtil.insert(redisKey, dataInterfaceMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
localCache.put(redisKey, dataInterfaceMap);
|
||||
} else {
|
||||
localCache.put(redisKey, redisUtil.getMap(redisKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 远端数据
|
||||
if (dataType.equals(OnlineDataTypeEnum.DYNAMIC.getType())) {
|
||||
// 联动状态下不做缓存, 具体查数据时做缓存
|
||||
boolean dynamicIsNeedCache = swapDataVo.getConfig().getTemplateJson().size() == 0;
|
||||
if (dynamicIsNeedCache) {
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
ActionResult dataRes = dataInterFaceApi
|
||||
.infoToId(swapDataVo.getConfig().getPropsUrl(), null, null);
|
||||
if (dataRes != null && dataRes.getData() != null) {
|
||||
List<Map<String, Object>> dataList2 = new ArrayList<>();
|
||||
if (dataRes.getData() instanceof List) {
|
||||
dataList2 = (List<Map<String, Object>>) dataRes.getData();
|
||||
}
|
||||
JSONArray dataAll = JsonUtil.getListToJsonArray(dataList2);
|
||||
OnlineSwapDataUtils.treeToList(label, value, children, dataAll,
|
||||
options);
|
||||
options.stream().forEach(o -> {
|
||||
dataInterfaceMap.put(String.valueOf(o.get(finalValue)),
|
||||
String.valueOf(o.get(finalLabel)));
|
||||
});
|
||||
if (NEEDCACHE_REMOTE && CollectionUtils.isNotEmpty(dataList2)
|
||||
&& item.getUseCache()) {
|
||||
redisUtil.insert(redisKey, dataInterfaceMap, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
localCache.put(redisKey, dataInterfaceMap);
|
||||
}
|
||||
} else {
|
||||
localCache.put(redisKey, redisUtil.getMap(redisKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据字典
|
||||
if (dataType.equals(OnlineDataTypeEnum.DICTIONARY.getType())) {
|
||||
if (!localCache.containsKey(redisKey)) {
|
||||
if (!redisUtil.exists(redisKey)) {
|
||||
List<DictionaryDataEntity> list = dictionaryDataApi
|
||||
.getDicList(swapDataVo.getConfig().getDictionaryType());
|
||||
options = list.stream().map(dic -> {
|
||||
Map<String, Object> dictionaryMap = new HashMap<>(16);
|
||||
dictionaryMap.put("id", dic.getId());
|
||||
dictionaryMap.put("enCode", dic.getEnCode());
|
||||
dictionaryMap.put("fullName", dic.getFullName());
|
||||
return dictionaryMap;
|
||||
}).collect(Collectors.toList());
|
||||
String dictionaryData = JsonUtil.getObjectToString(options);
|
||||
if (NEEDCACHE_REMOTE) {
|
||||
redisUtil.insert(redisKey, dictionaryData, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
localCache.put(redisKey, options);
|
||||
} else {
|
||||
String dictionaryStringData = redisUtil.getString(redisKey).toString();
|
||||
localCache.put(redisKey, JsonUtil.getJsonToListMap(dictionaryStringData));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_ORGTREE:
|
||||
Map<String, Object> orgTree;
|
||||
if (redisUtil.exists(redisKey)) {
|
||||
orgTree = redisUtil.getMap(redisKey);
|
||||
orgTree = Optional.ofNullable(orgTree).orElse(new HashMap<>(20));
|
||||
} else {
|
||||
orgTree = organizeApi.getAllOrgsTreeName();
|
||||
if (OnlineSwapDataUtils.NEEDCACHE_SYS) {
|
||||
redisUtil.insert(redisKey, orgTree, DEFAULT_CACHE_TIME);
|
||||
}
|
||||
}
|
||||
localCache.put("__orgTree_map", orgTree);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("线程执行错误:" + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
} finally {
|
||||
// 每执行一次数值减少一
|
||||
countDownLatch.countDown();
|
||||
// 也可以给await()设置超时时间,如果超过300s(也可以是时,分)则不再等待,直接执行下面代码。
|
||||
// countDownLatch.await(300,TimeUnit.SECONDS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// 等待计数器归零
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
log.error("线程计数错误:" + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
class OnlineExecutorParam {
|
||||
private String redisKey;
|
||||
private String type;
|
||||
private String interfaceId;
|
||||
private Object param;
|
||||
private Boolean useCache;
|
||||
|
||||
public OnlineExecutorParam(String redisKey, String type, String interfaceId, Object param) {
|
||||
this.redisKey = redisKey;
|
||||
this.type = type;
|
||||
this.interfaceId = interfaceId;
|
||||
this.param = param;
|
||||
this.useCache = false;
|
||||
}
|
||||
|
||||
public OnlineExecutorParam(String redisKey, String type, String interfaceId, Object param, Boolean useCache) {
|
||||
this.redisKey = redisKey;
|
||||
this.type = type;
|
||||
this.interfaceId = interfaceId;
|
||||
this.param = param;
|
||||
this.useCache = useCache;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,757 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import com.yunzhupaas.base.entity.DataInterfaceEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevReleaseEntity;
|
||||
import com.yunzhupaas.base.model.ColumnDataModel;
|
||||
import com.yunzhupaas.base.model.Template6.ColumnListField;
|
||||
import com.yunzhupaas.base.model.VisualDevJsonModel;
|
||||
import com.yunzhupaas.base.model.VisualWebTypeEnum;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.database.model.superQuery.SuperJsonModel;
|
||||
import com.yunzhupaas.database.model.superQuery.SuperQueryJsonModel;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.model.OnlineDevData;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.FormDataModel;
|
||||
import com.yunzhupaas.model.visualJson.TableModel;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormEnum;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormModel;
|
||||
import com.yunzhupaas.model.visualJson.config.ConfigModel;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevEnum.MultipleControlEnum;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.StringUtil;
|
||||
import com.yunzhupaas.util.XSSEscape;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 在线开发公用
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/7/28
|
||||
*/
|
||||
public class OnlinePublicUtils {
|
||||
/**
|
||||
* 判断有表无表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Boolean isUseTables(String tableJson) {
|
||||
if (!StringUtil.isEmpty(tableJson) && !OnlineDevData.TABLE_CONST.equals(tableJson)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* map key转小写
|
||||
*
|
||||
* @param requestMap
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> mapKeyToLower(Map<String, ?> requestMap) {
|
||||
// 非空校验
|
||||
if (requestMap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 初始化放转换后数据的Map
|
||||
Map<String, Object> responseMap = new HashMap<>(16);
|
||||
// 使用迭代器进行循环遍历
|
||||
Set<String> requestSet = requestMap.keySet();
|
||||
Iterator<String> iterator = requestSet.iterator();
|
||||
iterator.forEachRemaining(obj -> {
|
||||
// 判断Key对应的Value是否为Map
|
||||
if ((requestMap.get(obj) instanceof Map)) {
|
||||
// 递归调用,将value中的Map的key转小写
|
||||
responseMap.put(obj.toLowerCase(), mapKeyToLower((Map) requestMap.get(obj)));
|
||||
} else {
|
||||
// 直接将key小写放入responseMap
|
||||
responseMap.put(obj.toLowerCase(), requestMap.get(obj));
|
||||
}
|
||||
});
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取map中第一个数据值
|
||||
*
|
||||
* @param map 数据源
|
||||
* @return
|
||||
*/
|
||||
public static Object getFirstOrNull(Map<String, Object> map) {
|
||||
Object obj = null;
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
obj = entry.getValue();
|
||||
if (obj != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除列表里无用的控件
|
||||
*
|
||||
* @param fieldsModelList
|
||||
* @return
|
||||
*/
|
||||
public static void removeUseless(List<FieLdsModel> fieldsModelList) {
|
||||
for (int i = 0; i < fieldsModelList.size(); i++) {
|
||||
if (fieldsModelList.get(i).getConfig().getYunzhupaasKey() == null) {
|
||||
continue;
|
||||
}
|
||||
if (fieldsModelList.get(i).getConfig().getYunzhupaasKey().equals(YunzhupaasKeyConsts.CHILD_TABLE)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归控件
|
||||
*
|
||||
* @param allFields
|
||||
* @param fieLdsModelList
|
||||
* @return
|
||||
*/
|
||||
public static void recursionFields(List<FieLdsModel> allFields, List<FieLdsModel> fieLdsModelList) {
|
||||
for (FieLdsModel fieLdsModel : fieLdsModelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
String yunzhupaasKey = config.getYunzhupaasKey();
|
||||
if (YunzhupaasKeyConsts.CHILD_TABLE.equals(yunzhupaasKey)) {
|
||||
allFields.add(fieLdsModel);
|
||||
continue;
|
||||
} else {
|
||||
if (config.getChildren() != null) {
|
||||
recursionFields(allFields, config.getChildren());
|
||||
} else {
|
||||
if (yunzhupaasKey == null) {
|
||||
continue;
|
||||
}
|
||||
allFields.add(fieLdsModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否有某个字符存在
|
||||
*
|
||||
* @param var1 完整字符串
|
||||
* @param var2 统计字符
|
||||
* @return
|
||||
*/
|
||||
public static Boolean getMultiple(String var1, String var2) {
|
||||
if (var1.startsWith(var2)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据字典处理(从缓存中取出)
|
||||
*
|
||||
* @param dataList
|
||||
* @param swapModel
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> getDataMap(List<Map<String, Object>> dataList, FieLdsModel swapModel) {
|
||||
String label = swapModel.getProps() != null ? swapModel.getProps().getLabel() : "";
|
||||
String value = swapModel.getProps() != null ? swapModel.getProps().getValue() : "";
|
||||
Map<String, Object> dataInterfaceMap = new HashMap<>();
|
||||
dataList.stream().forEach(data -> {
|
||||
dataInterfaceMap.put(String.valueOf(data.get(value)), String.valueOf(data.get(label)));
|
||||
});
|
||||
return dataInterfaceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间(+8)
|
||||
*
|
||||
* @param date
|
||||
* @param format
|
||||
* @return
|
||||
*/
|
||||
public static String getDateByFormat(Long date, String format) {
|
||||
DateTimeFormatter ftf = DateTimeFormatter.ofPattern(format);
|
||||
String dateString = ftf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(date), ZoneId.of("+8")));
|
||||
return dateString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归表单控件
|
||||
*
|
||||
* @param modelList 所有控件
|
||||
* @param mainFields 主表
|
||||
* @param childFields 子表
|
||||
* @param models 二维码 条形码
|
||||
*/
|
||||
public static void recurseFiled(List<FieLdsModel> modelList, List<FieLdsModel> mainFields,
|
||||
List<FieLdsModel> childFields, List<FormModel> models) {
|
||||
for (FieLdsModel fieLdsModel : modelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
String yunzhupaaskey = config.getYunzhupaasKey();
|
||||
List<FieLdsModel> childrenList = config.getChildren();
|
||||
boolean isYunzhupaasKey = StringUtil.isEmpty(yunzhupaaskey);
|
||||
List<String> keyList = new ArrayList() {
|
||||
{
|
||||
this.add(FormEnum.collapseItem.getMessage());
|
||||
this.add(FormEnum.collapseItem.getMessage());
|
||||
this.add(FormEnum.row.getMessage());
|
||||
this.add(FormEnum.card.getMessage());
|
||||
this.add(FormEnum.tab.getMessage());
|
||||
this.add(FormEnum.collapse.getMessage());
|
||||
this.add(FormEnum.tableGrid.getMessage());
|
||||
this.add(FormEnum.tableGridTr.getMessage());
|
||||
this.add(FormEnum.tableGridTd.getMessage());
|
||||
}
|
||||
};
|
||||
if (keyList.contains(yunzhupaaskey) || isYunzhupaasKey) {
|
||||
if (childrenList.size() > 0) {
|
||||
recurseFiled(childrenList, mainFields, childFields, models);
|
||||
} else {
|
||||
mainFields.add(fieLdsModel);
|
||||
}
|
||||
} else if (FormEnum.table.getMessage().equals(yunzhupaaskey)) {
|
||||
childFields.add(fieLdsModel);
|
||||
} else if (FormEnum.groupTitle.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.divider.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.YUNZHUPAASText.getMessage().equals(yunzhupaaskey)) {
|
||||
|
||||
} else if (FormEnum.QR_CODE.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.BARCODE.getMessage().equals(yunzhupaaskey)) {
|
||||
FormModel formModel = JsonUtil.getJsonToBean(fieLdsModel, FormModel.class);
|
||||
models.add(formModel);
|
||||
} else {
|
||||
mainFields.add(fieLdsModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归控件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static void recursionFormFields(List<FieLdsModel> allFields, List<FieLdsModel> fieLdsModelList) {
|
||||
for (FieLdsModel fieLdsModel : fieLdsModelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
String yunzhupaasKey = config.getYunzhupaasKey();
|
||||
if (YunzhupaasKeyConsts.CHILD_TABLE.equals(yunzhupaasKey)) {
|
||||
allFields.add(fieLdsModel);
|
||||
continue;
|
||||
} else {
|
||||
if (config.getChildren() != null) {
|
||||
recursionFormFields(allFields, config.getChildren());
|
||||
} else {
|
||||
allFields.add(fieLdsModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归控件(取出所有子集)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static void recursionFormChildFields(List<FieLdsModel> allFields, List<FieLdsModel> fieLdsModelList) {
|
||||
for (FieLdsModel fieLdsModel : fieLdsModelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
String yunzhupaasKey = config.getYunzhupaasKey();
|
||||
if (YunzhupaasKeyConsts.CHILD_TABLE.equals(yunzhupaasKey)) {
|
||||
String childVmodel = fieLdsModel.getVModel();
|
||||
for (FieLdsModel child : Optional.ofNullable(fieLdsModel.getConfig().getChildren())
|
||||
.orElse(new ArrayList<>())) {
|
||||
if (child.getVModel() != null) {
|
||||
child.setVModel(childVmodel + "-" + child.getVModel());
|
||||
allFields.add(child);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (config.getChildren() != null) {
|
||||
recursionFormChildFields(allFields, config.getChildren());
|
||||
} else {
|
||||
if (StringUtil.isNotEmpty(fieLdsModel.getVModel())) {
|
||||
allFields.add(fieLdsModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void recurseOnlineFiled(List<FieLdsModel> modelList, List<FieLdsModel> mainFields,
|
||||
List<FieLdsModel> childFields) {
|
||||
for (FieLdsModel fieLdsModel : modelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
String yunzhupaaskey = config.getYunzhupaasKey();
|
||||
List<FieLdsModel> childrenList = config.getChildren();
|
||||
boolean isYunzhupaasKey = StringUtil.isEmpty(yunzhupaaskey);
|
||||
if (FormEnum.row.getMessage().equals(yunzhupaaskey) || FormEnum.card.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.tab.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.collapse.getMessage().equals(yunzhupaaskey)
|
||||
|| isYunzhupaasKey) {
|
||||
if (childrenList.size() > 0) {
|
||||
recurseOnlineFiled(childrenList, mainFields, childFields);
|
||||
} else {
|
||||
mainFields.add(fieLdsModel);
|
||||
}
|
||||
} else if (FormEnum.table.getMessage().equals(yunzhupaaskey)) {
|
||||
childFields.add(fieLdsModel);
|
||||
} else if (FormEnum.groupTitle.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.divider.getMessage().equals(yunzhupaaskey)
|
||||
|| FormEnum.YUNZHUPAASText.getMessage().equals(yunzhupaaskey)) {
|
||||
|
||||
} else {
|
||||
mainFields.add(fieLdsModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redisMap 缓存集合
|
||||
* @param modelData 数据
|
||||
* @param isMultiple 是否多选
|
||||
* @return
|
||||
*/
|
||||
public static String getDataInMethod(Map<String, Object> redisMap, Object modelData, Boolean isMultiple) {
|
||||
if (redisMap == null || redisMap.isEmpty()) {
|
||||
return modelData.toString();
|
||||
}
|
||||
String Separator = isMultiple ? ";" : "/";
|
||||
String s2;
|
||||
if (OnlinePublicUtils.getMultiple(String.valueOf(modelData),
|
||||
MultipleControlEnum.MULTIPLE_JSON_TWO.getMultipleChar())) {
|
||||
String[][] data = JsonUtil.getJsonToBean(String.valueOf(modelData), String[][].class);
|
||||
List<String> addList = new ArrayList<>();
|
||||
for (String[] AddressData : data) {
|
||||
List<String> adList = new ArrayList<>();
|
||||
for (String s : AddressData) {
|
||||
adList.add(String.valueOf(redisMap.get(s)));
|
||||
}
|
||||
addList.add(String.join("/", adList));
|
||||
}
|
||||
s2 = String.join(";", addList);
|
||||
} else if (OnlinePublicUtils.getMultiple(String.valueOf(modelData),
|
||||
MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
List<String> modelDataList = JsonUtil.getJsonToList(String.valueOf(modelData), String.class);
|
||||
modelDataList = modelDataList.stream().map(s -> String.valueOf(redisMap.get(s)))
|
||||
.collect(Collectors.toList());
|
||||
s2 = String.join(Separator, modelDataList);
|
||||
} else {
|
||||
String[] modelDatas = String.valueOf(modelData).split(",");
|
||||
StringBuilder dynamicData = new StringBuilder();
|
||||
for (int i = 0; i < modelDatas.length; i++) {
|
||||
modelDatas[i] = String
|
||||
.valueOf(Objects.nonNull(redisMap.get(modelDatas[i])) ? redisMap.get(modelDatas[i]) : "");
|
||||
dynamicData.append(modelDatas[i] + Separator);
|
||||
}
|
||||
s2 = dynamicData.deleteCharAt(dynamicData.length() - 1).toString();
|
||||
}
|
||||
return StringUtil.isEmpty(s2) ? modelData.toString() : s2;
|
||||
}
|
||||
|
||||
public static List<String> getDataNoSwapInMethod(Object modelData) {
|
||||
List<String> dataValueList = new ArrayList<>();
|
||||
if (OnlinePublicUtils.getMultiple(String.valueOf(modelData),
|
||||
MultipleControlEnum.MULTIPLE_JSON_ONE.getMultipleChar())) {
|
||||
List<String> modelDataList = JsonUtil.getJsonToList(String.valueOf(modelData), String.class);
|
||||
dataValueList = modelDataList;
|
||||
} else {
|
||||
String[] modelDatas = String.valueOf(modelData).split(",");
|
||||
for (int i = 0; i < modelDatas.length; i++) {
|
||||
dataValueList.add(modelDatas[i]);
|
||||
}
|
||||
}
|
||||
return dataValueList;
|
||||
}
|
||||
|
||||
public static VisualDevJsonModel getVisualJsonModel(VisualdevEntity entity) {
|
||||
VisualDevJsonModel jsonModel = new VisualDevJsonModel();
|
||||
if (entity.getColumnData() != null) {
|
||||
jsonModel.setColumnData(JsonUtil.getJsonToBean(entity.getColumnData(), ColumnDataModel.class));
|
||||
}
|
||||
if (entity.getAppColumnData() != null) {
|
||||
jsonModel.setAppColumnData(JsonUtil.getJsonToBean(entity.getAppColumnData(), ColumnDataModel.class));
|
||||
}
|
||||
FormDataModel formDataModel = JsonUtil.getJsonToBean(entity.getFormData(), FormDataModel.class);
|
||||
jsonModel.setFormData(formDataModel);
|
||||
if (!VisualWebTypeEnum.DATA_VIEW.getType().equals(entity.getWebType())) {
|
||||
jsonModel.setFormListModels(JsonUtil.getJsonToList(formDataModel.getFields(), FieLdsModel.class));
|
||||
}
|
||||
jsonModel.setVisualTables(JsonUtil.getJsonToList(entity.getVisualTables(), TableModel.class));
|
||||
jsonModel.setId(entity.getId());
|
||||
jsonModel.setDbLinkId(entity.getDbLinkId());
|
||||
jsonModel.setFullName(entity.getFullName());
|
||||
jsonModel.setType(entity.getType());
|
||||
jsonModel.setWebType(entity.getWebType());
|
||||
return jsonModel;
|
||||
}
|
||||
|
||||
public static VisualDevJsonModel getVisualJsonModel(VisualdevReleaseEntity entity) throws WorkFlowException {
|
||||
if (entity == null)
|
||||
throw new WorkFlowException(MsgCode.VS412.get());
|
||||
VisualDevJsonModel jsonModel = new VisualDevJsonModel();
|
||||
if (entity.getColumnData() != null) {
|
||||
jsonModel.setColumnData(JsonUtil.getJsonToBean(entity.getColumnData(), ColumnDataModel.class));
|
||||
}
|
||||
if (entity.getAppColumnData() != null) {
|
||||
jsonModel.setAppColumnData(JsonUtil.getJsonToBean(entity.getAppColumnData(), ColumnDataModel.class));
|
||||
}
|
||||
FormDataModel formDataModel = JsonUtil.getJsonToBean(entity.getFormData(), FormDataModel.class);
|
||||
jsonModel.setFormData(formDataModel);
|
||||
if (!VisualWebTypeEnum.DATA_VIEW.getType().equals(entity.getWebType())) {
|
||||
jsonModel.setFormListModels(JsonUtil.getJsonToList(formDataModel.getFields(), FieLdsModel.class));
|
||||
}
|
||||
jsonModel.setVisualTables(JsonUtil.getJsonToList(entity.getVisualTables(), TableModel.class));
|
||||
jsonModel.setId(entity.getId());
|
||||
jsonModel.setDbLinkId(entity.getDbLinkId());
|
||||
jsonModel.setFullName(entity.getFullName());
|
||||
jsonModel.setType(entity.getType());
|
||||
jsonModel.setWebType(entity.getWebType());
|
||||
return jsonModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mapList
|
||||
* @return List<Map < String, Object>>
|
||||
* @Date 21:51 2020/11/11
|
||||
* @Description 将map中的所有key转化为小写
|
||||
*/
|
||||
public static List<Map<String, Object>> toLowerKeyList(List<Map<String, Object>> mapList) {
|
||||
List<Map<String, Object>> newMapList = new ArrayList<>();
|
||||
for (Map<String, Object> map : mapList) {
|
||||
Map<String, Object> resultMap = new HashMap(16);
|
||||
Set<String> sets = map.keySet();
|
||||
for (String key : sets) {
|
||||
resultMap.put(key.toLowerCase(), map.get(key));
|
||||
}
|
||||
newMapList.add(resultMap);
|
||||
}
|
||||
return newMapList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数组
|
||||
*
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public static Object getDataConversion(Object value) {
|
||||
Object dataValue = getDataConversion(null, value, false, "/");
|
||||
return dataValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数组
|
||||
*
|
||||
* @param redis 转换对象
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public static Object getDataConversion(Map<String, Object> redis, Object value, boolean isMultiple,
|
||||
String separator) {
|
||||
Object dataValue = value;
|
||||
boolean iszhuanhuan = redis != null;
|
||||
try {
|
||||
List<List> list = JsonUtil.getJsonToList(String.valueOf(value), List.class);
|
||||
dataValue = list;
|
||||
if (iszhuanhuan) {
|
||||
// 一级分隔符
|
||||
StringJoiner joiner = new StringJoiner(",");
|
||||
for (List listChild : list) {
|
||||
StringJoiner aa = new StringJoiner(separator);
|
||||
for (Object object : listChild) {
|
||||
String value1 = redis.get(String.valueOf(object)) != null
|
||||
? String.valueOf(redis.get(String.valueOf(object)))
|
||||
: "";
|
||||
if (StringUtil.isNotEmpty(value1)) {
|
||||
aa.add(value1);
|
||||
}
|
||||
}
|
||||
joiner.add(aa.toString());
|
||||
}
|
||||
dataValue = joiner.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
List<String> list = JsonUtil.getJsonToList(String.valueOf(value), String.class);
|
||||
dataValue = list;
|
||||
if (iszhuanhuan) {
|
||||
if (isMultiple) {// 一级分隔符
|
||||
separator = ",";
|
||||
}
|
||||
StringJoiner joiner = new StringJoiner(separator);
|
||||
for (Object listChild : list) {
|
||||
String value1 = redis.get(String.valueOf(listChild)) != null
|
||||
? String.valueOf(redis.get(String.valueOf(listChild)))
|
||||
: "";
|
||||
if (StringUtil.isNotEmpty(value1)) {
|
||||
joiner.add(value1);
|
||||
}
|
||||
}
|
||||
dataValue = joiner.toString();
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
dataValue = String.valueOf(value);
|
||||
if (iszhuanhuan) {
|
||||
dataValue = redis.get(String.valueOf(value)) != null
|
||||
? String.valueOf(redis.get(String.valueOf(value)))
|
||||
: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 视图sql条件拼接
|
||||
*
|
||||
* @param info
|
||||
* @param queryCondition
|
||||
* @param parameterMap
|
||||
* @return
|
||||
*/
|
||||
public static void getViewQuerySql(DataInterfaceEntity info, List<FieLdsModel> queryCondition,
|
||||
Map<String, String> parameterMap, Map<String, Object> extraMap) {
|
||||
if (Objects.equals(info.getType(), 1) && queryCondition.size() > 0) {
|
||||
String searchSqlStr = "";
|
||||
for (FieLdsModel item : queryCondition) {
|
||||
switch (item.getSearchType()) {
|
||||
case 1:
|
||||
if (StringUtil.isNotEmpty(searchSqlStr)) {
|
||||
searchSqlStr += " and t." + item.getVModel() + " = '"
|
||||
+ XSSEscape.escape(item.getFieldValue()) + "'";
|
||||
} else {
|
||||
searchSqlStr = "t." + item.getVModel() + " = '" + XSSEscape.escape(item.getFieldValue())
|
||||
+ "'";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (StringUtil.isNotEmpty(searchSqlStr)) {
|
||||
searchSqlStr += " and t." + item.getVModel() + " like '%"
|
||||
+ XSSEscape.escape(item.getFieldValue()) + "%'";
|
||||
} else {
|
||||
searchSqlStr = "t." + item.getVModel() + " like '%" + XSSEscape.escape(item.getFieldValue())
|
||||
+ "%'";
|
||||
}
|
||||
break;
|
||||
case 3:// between
|
||||
if (StringUtil.isNotEmpty(searchSqlStr)) {
|
||||
searchSqlStr += " and t." + item.getVModel() + " between '"
|
||||
+ XSSEscape.escape(String.valueOf(item.getFieldValueOne()))
|
||||
+ "' and '" + XSSEscape.escape(String.valueOf(item.getFieldValueTwo())) + "'";
|
||||
} else {
|
||||
searchSqlStr = "t." + item.getVModel() + " between '"
|
||||
+ XSSEscape.escape(String.valueOf(item.getFieldValueOne()))
|
||||
+ "' and '" + XSSEscape.escape(String.valueOf(item.getFieldValueTwo())) + "'";
|
||||
}
|
||||
break;
|
||||
case 4:// 包含
|
||||
List<String> dataList = item.getDataList();
|
||||
if (dataList.size() > 0) {
|
||||
if (StringUtil.isNotEmpty(searchSqlStr)) {
|
||||
searchSqlStr += " and (";
|
||||
} else {
|
||||
searchSqlStr += " 1=1 and (";
|
||||
}
|
||||
int n = 0;
|
||||
for (String value : dataList) {
|
||||
if (n > 0) {
|
||||
searchSqlStr += " or t." + item.getVModel() + " like '%" + value + "%'";
|
||||
} else {
|
||||
searchSqlStr += "t." + item.getVModel() + " like '%" + value + "%'";
|
||||
}
|
||||
n++;
|
||||
}
|
||||
searchSqlStr += ") ";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 页签条件额外拼接
|
||||
if (MapUtils.isNotEmpty(extraMap)) {
|
||||
for (String key : extraMap.keySet()) {
|
||||
if (StringUtil.isNotEmpty(searchSqlStr)) {
|
||||
searchSqlStr += " and t." + key + " = '" + XSSEscape.escape(extraMap.get(key).toString()) + "'";
|
||||
} else {
|
||||
searchSqlStr = "t." + key + " = '" + XSSEscape.escape(extraMap.get(key).toString()) + "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
parameterMap.put("searchSqlStr", searchSqlStr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 视图非sql条件过滤
|
||||
*
|
||||
* @param info
|
||||
* @param queryCondition
|
||||
* @param dataRes
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> getViewQueryNotSql(DataInterfaceEntity info,
|
||||
List<FieLdsModel> queryCondition, List<Map<String, Object>> dataRes, Map<String, Object> extraMap) {
|
||||
// 是否包含页签参数
|
||||
boolean hasExtra = false;
|
||||
String key = "";
|
||||
if (MapUtils.isNotEmpty(extraMap)) {
|
||||
hasExtra = true;
|
||||
List<String> keyList = new ArrayList<>(extraMap.keySet());
|
||||
key = keyList.get(0);
|
||||
}
|
||||
List<Map<String, Object>> dataInterfaceList = new ArrayList<>();
|
||||
if (!Objects.equals(info.getType(), 1) && queryCondition.size() > 0) {
|
||||
for (Map<String, Object> map : dataRes) {
|
||||
if (OnlinePublicUtils.mapCompar(queryCondition, map)) {
|
||||
if (hasExtra) {
|
||||
if (Objects.equals(map.get(key), extraMap.get(key)))
|
||||
dataInterfaceList.add(map);
|
||||
} else {
|
||||
dataInterfaceList.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Map<String, Object> map : dataRes) {
|
||||
if (hasExtra) {
|
||||
if (Objects.equals(map.get(key), extraMap.get(key)))
|
||||
dataInterfaceList.add(map);
|
||||
} else {
|
||||
dataInterfaceList.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataInterfaceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个map有相同key-value
|
||||
*
|
||||
* @return
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/1/5
|
||||
*/
|
||||
public static boolean mapCompar(List<FieLdsModel> searchList, Map<String, Object> hashMap2) {
|
||||
boolean isChange = false;
|
||||
for (FieLdsModel item : searchList) {
|
||||
String realValue = hashMap2.get(item.getVModel()) == null ? "" : (String) hashMap2.get(item.getVModel());
|
||||
switch (item.getSearchType()) {
|
||||
case 2:
|
||||
if (realValue.indexOf(item.getFieldValue()) >= 0) {
|
||||
isChange = true;
|
||||
}
|
||||
break;
|
||||
case 3:// between
|
||||
List<String> longList = new ArrayList() {
|
||||
{
|
||||
add(YunzhupaasKeyConsts.NUM_INPUT);
|
||||
add(YunzhupaasKeyConsts.DATE);
|
||||
}
|
||||
};
|
||||
if (longList.contains(item.getConfig().getYunzhupaasKey())) {
|
||||
Long valueLong = Long.parseLong(realValue);
|
||||
Long valueLongOne = (Long) item.getFieldValueOne();
|
||||
Long valueLongTwo = (Long) item.getFieldValueTwo();
|
||||
if (valueLong >= valueLongOne && valueLong <= valueLongTwo) {
|
||||
isChange = true;
|
||||
}
|
||||
} else {
|
||||
String valueLongOne = (String) item.getFieldValueOne();
|
||||
String valueLongTwo = (String) item.getFieldValueTwo();
|
||||
if (realValue.compareTo(valueLongOne) >= 0 && realValue.compareTo(valueLongTwo) <= 0) {
|
||||
isChange = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:// 包含
|
||||
List<String> dataList = item.getDataList();
|
||||
for (String value : dataList) {
|
||||
isChange = value.indexOf(realValue) >= 0;
|
||||
}
|
||||
if (isChange) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:// 1,其他条件都按等于查询
|
||||
isChange = item.getFieldValue().equals(realValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有有使用的表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getAllTableName(List<ColumnListField> modelList, List<SuperJsonModel> listQuery,
|
||||
Map<String, String> fieldTableMap) {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
for (ColumnListField item : modelList) {
|
||||
String table = StringUtil.isNotEmpty(item.getConfig().getRelationTable())
|
||||
? item.getConfig().getRelationTable()
|
||||
: item.getConfig().getTableName();
|
||||
if (StringUtil.isBlank(table)) {
|
||||
table = fieldTableMap.get(item.getConfig().getParentVModel());
|
||||
}
|
||||
list.add(table);
|
||||
}
|
||||
for (SuperJsonModel superJsonModel : listQuery) {
|
||||
if (superJsonModel.getConditionList() != null && superJsonModel.getConditionList().size() > 0) {
|
||||
List<SuperQueryJsonModel> conditionList = superJsonModel.getConditionList();
|
||||
for (SuperQueryJsonModel sqj : conditionList) {
|
||||
if (sqj.getGroups() != null && sqj.getGroups().size() > 0) {
|
||||
List<FieLdsModel> groups = sqj.getGroups();
|
||||
for (FieLdsModel item : groups) {
|
||||
String table = StringUtil.isNotEmpty(item.getConfig().getRelationTable())
|
||||
? item.getConfig().getRelationTable()
|
||||
: item.getConfig().getTableName();
|
||||
list.add(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归控件(取出所有子集=-字段不变)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static void getAllFields(List<FieLdsModel> allFields, List<FieLdsModel> fieLdsModelList) {
|
||||
for (FieLdsModel fieLdsModel : fieLdsModelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
String yunzhupaasKey = config.getYunzhupaasKey();
|
||||
if (YunzhupaasKeyConsts.CHILD_TABLE.equals(yunzhupaasKey)) {
|
||||
allFields.addAll(config.getChildren());
|
||||
} else {
|
||||
if (config.getChildren() != null) {
|
||||
getAllFields(allFields, config.getChildren());
|
||||
} else {
|
||||
if (StringUtil.isNotEmpty(fieLdsModel.getVModel())) {
|
||||
allFields.add(fieLdsModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yunzhupaas.database.model.superQuery.SuperQueryJsonModel;
|
||||
import com.yunzhupaas.emnus.SearchMethodEnum;
|
||||
import com.yunzhupaas.model.visualJson.FieLdsModel;
|
||||
import com.yunzhupaas.model.visualJson.config.ConfigModel;
|
||||
import com.yunzhupaas.permission.model.authorize.OnlineDynamicSqlModel;
|
||||
import com.yunzhupaas.util.visiual.YunzhupaasKeyConsts;
|
||||
import lombok.Data;
|
||||
import org.mybatis.dynamic.sql.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OnlineQuerySqlUtils {
|
||||
|
||||
/**
|
||||
* 运算符
|
||||
*/
|
||||
private SearchMethodEnum symbol;
|
||||
/**
|
||||
* 逻辑拼接符号
|
||||
*/
|
||||
private boolean and;
|
||||
/**
|
||||
* 组件标识
|
||||
*/
|
||||
private String yunzhupaasKey;
|
||||
/**
|
||||
* 字段key
|
||||
*/
|
||||
private String vModel;
|
||||
/**
|
||||
* 自定义的值
|
||||
*/
|
||||
private Object fieldValue;
|
||||
/**
|
||||
* 自定义的值2
|
||||
*/
|
||||
private Object fieldValueTwo;
|
||||
|
||||
private VisitableCondition sqlCondition = null;
|
||||
private BindableColumn<Object> sqlColumn = null;
|
||||
private List<AndOrCriteriaGroup> groupList = new ArrayList<>();
|
||||
private boolean isSqlServer = false;
|
||||
private boolean isOracle = false;
|
||||
private boolean isAddMatchLogic = false;
|
||||
|
||||
private List<String> dataList = new ArrayList<>();
|
||||
|
||||
public List<AndOrCriteriaGroup> getSuperSql(List<SuperQueryJsonModel> conditionList,
|
||||
List<OnlineDynamicSqlModel> sqlModelList, String databaseProductName, String matchLogic) {
|
||||
isSqlServer = databaseProductName.equalsIgnoreCase("Microsoft SQL Server");
|
||||
isOracle = databaseProductName.equalsIgnoreCase("oracle");
|
||||
isAddMatchLogic = SearchMethodEnum.And.getSymbol().equalsIgnoreCase(matchLogic);
|
||||
List<AndOrCriteriaGroup> groupQueryList = new ArrayList<>();
|
||||
OnlineProductSqlUtils.superList(conditionList, false);
|
||||
for (SuperQueryJsonModel queryJsonModel : conditionList) {
|
||||
List<FieLdsModel> fieLdsModelList = queryJsonModel.getGroups();
|
||||
String logic = queryJsonModel.getLogic();
|
||||
and = SearchMethodEnum.And.getSymbol().equalsIgnoreCase(logic);
|
||||
List<AndOrCriteriaGroup> groupListAll = new ArrayList<>();
|
||||
for (FieLdsModel fieLdsModel : fieLdsModelList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
sqlCondition = null;
|
||||
sqlColumn = null;
|
||||
groupList = new ArrayList<>();
|
||||
yunzhupaasKey = config.getYunzhupaasKey();
|
||||
symbol = SearchMethodEnum.getSearchMethod(fieLdsModel.getSymbol());
|
||||
vModel = fieLdsModel.getVModel();
|
||||
fieldValue = fieLdsModel.getFieldValueOne();
|
||||
fieldValueTwo = fieLdsModel.getFieldValueTwo();
|
||||
dataList = fieLdsModel.getDataList();
|
||||
String tableName = ObjectUtil.isNotEmpty(config.getRelationTable()) ? config.getRelationTable()
|
||||
: config.getTableName();
|
||||
OnlineDynamicSqlModel onlineDynamicSqlModel = sqlModelList.stream()
|
||||
.filter(sql -> sql.getTableName().equals(tableName)).findFirst().orElse(null);
|
||||
if (onlineDynamicSqlModel != null) {
|
||||
getSymbolWrapper(onlineDynamicSqlModel);
|
||||
groupListAll.addAll(groupList);
|
||||
}
|
||||
}
|
||||
if (groupListAll.size() > 0) {
|
||||
if (isAddMatchLogic) {
|
||||
groupQueryList.add(SqlBuilder.and(DerivedColumn.of("1"), SqlBuilder.isEqualTo(and ? 1 : 2),
|
||||
groupListAll.toArray(new AndOrCriteriaGroup[groupListAll.size()])));
|
||||
} else {
|
||||
groupQueryList.add(SqlBuilder.or(DerivedColumn.of("1"), SqlBuilder.isEqualTo(and ? 1 : 2),
|
||||
groupListAll.toArray(new AndOrCriteriaGroup[groupListAll.size()])));
|
||||
}
|
||||
}
|
||||
}
|
||||
return groupQueryList;
|
||||
}
|
||||
|
||||
private void getSymbolWrapper(OnlineDynamicSqlModel onlineDynamicSqlModel) {
|
||||
SqlTable sqlTable = onlineDynamicSqlModel.getSqlTable();
|
||||
sqlColumn = sqlTable.column(vModel);
|
||||
List<AndOrCriteriaGroup> list = new ArrayList<>();
|
||||
switch (symbol) {
|
||||
case IsNull:
|
||||
sqlCondition = SqlBuilder.isNull();
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case IsNotNull:
|
||||
sqlCondition = SqlBuilder.isNotNull();
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case Equal:
|
||||
sqlCondition = SqlBuilder.isEqualTo(fieldValue);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case NotEqual:
|
||||
sqlCondition = SqlBuilder.isNotEqualTo(fieldValue);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case GreaterThan:
|
||||
sqlCondition = SqlBuilder.isGreaterThan(fieldValue);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case LessThan:
|
||||
sqlCondition = SqlBuilder.isLessThan(fieldValue);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case GreaterThanOrEqual:
|
||||
sqlCondition = SqlBuilder.isGreaterThanOrEqualTo(fieldValue);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case LessThanOrEqual:
|
||||
sqlCondition = SqlBuilder.isLessThanOrEqualTo(fieldValue);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case Like:
|
||||
if (isSqlServer) {
|
||||
fieldValue = String.valueOf(fieldValue).replaceAll("\\[", "[[]");
|
||||
}
|
||||
sqlCondition = SqlBuilder.isLike("%" + fieldValue + "%");
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case NotLike:
|
||||
if (isSqlServer) {
|
||||
fieldValue = String.valueOf(fieldValue).replaceAll("\\[", "[[]");
|
||||
}
|
||||
sqlCondition = SqlBuilder.isNotLike("%" + fieldValue + "%");
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), sqlCondition));
|
||||
break;
|
||||
case Included:
|
||||
case NotIncluded:
|
||||
getInWrapper(sqlTable, list);
|
||||
break;
|
||||
case Between:
|
||||
sqlCondition = SqlBuilder.isBetween(fieldValue).and(fieldValueTwo);
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), SqlBuilder.isBetween(fieldValue).and(fieldValueTwo)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
int n = 1;
|
||||
if (symbol.equals(SearchMethodEnum.Included)) {
|
||||
n = 2;
|
||||
}
|
||||
if (and) {
|
||||
groupList.add(SqlBuilder.and(DerivedColumn.of("1"), SqlBuilder.isEqualTo(n),
|
||||
list.toArray(new AndOrCriteriaGroup[list.size()])));
|
||||
} else {
|
||||
groupList.add(SqlBuilder.or(DerivedColumn.of("1"), SqlBuilder.isEqualTo(n),
|
||||
list.toArray(new AndOrCriteriaGroup[list.size()])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void getInWrapper(SqlTable sqlTable, List<AndOrCriteriaGroup> list) {
|
||||
for (String value : dataList) {
|
||||
if (isSqlServer) {
|
||||
value = String.valueOf(value).replaceAll("\\[", "[[]");
|
||||
}
|
||||
switch (symbol) {
|
||||
case Included:
|
||||
sqlCondition = SqlBuilder.isLike("%" + value + "%");
|
||||
list.add(SqlBuilder.or(sqlTable.column(vModel), SqlBuilder.isLike("%" + value + "%")));
|
||||
break;
|
||||
default:
|
||||
sqlCondition = SqlBuilder.isNotLike("%" + value + "%");
|
||||
list.add(SqlBuilder.and(sqlTable.column(vModel), SqlBuilder.isNotLike("%" + value + "%")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
package com.yunzhupaas.onlinedev.util.onlineDevUtil;
|
||||
|
||||
import com.yunzhupaas.onlinedev.model.OnlineDevListModel.VisualColumnSearchVO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* 关联表单工具类
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2022/1/7
|
||||
*/
|
||||
public class RelationFormUtils {
|
||||
|
||||
/**
|
||||
* 转后后查询
|
||||
* @param dataVOList
|
||||
* @param searchVOList
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> getRelationListByKeyword(List<Map<String, Object>> dataVOList, List<VisualColumnSearchVO> searchVOList){
|
||||
List<Map<String, Object>> passDataList = new ArrayList<>();
|
||||
for (Map<String, Object> dataMap : dataVOList){
|
||||
int i =0;
|
||||
for (VisualColumnSearchVO searchVO : searchVOList){
|
||||
String s = String.valueOf(dataMap.get(searchVO.getVModel()));
|
||||
if (s.contains(String.valueOf(searchVO.getValue()))){
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i>0){
|
||||
passDataList.add(dataMap);
|
||||
}
|
||||
}
|
||||
return passDataList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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-onlinedev</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-visualdev-onlinedev-controller</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-onlinedev-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-visualdev-integrate-biz</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yunzhupaas.onlinedev.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.PageListVO;
|
||||
import com.yunzhupaas.base.vo.PaginationVO;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualLogEntity;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogPage;
|
||||
import com.yunzhupaas.onlinedev.model.log.VisualLogVo;
|
||||
import com.yunzhupaas.onlinedev.service.VisualLogService;
|
||||
import com.yunzhupaas.permission.entity.UserEntity;
|
||||
import com.yunzhupaas.permission.service.UserService;
|
||||
import com.yunzhupaas.util.DateUtil;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.UploaderUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Tag(name = "在线开发数据日志", description = "OnlineLog")
|
||||
@RestController
|
||||
@RequestMapping("/api/visualdev/OnlineLog")
|
||||
public class VisualLogController {
|
||||
@Autowired
|
||||
private VisualLogService visualLogService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@GetMapping
|
||||
public ActionResult<PageListVO<VisualLogVo>> list(VisualLogPage page) {
|
||||
List<VisualLogEntity> list = visualLogService.getLogList(page);
|
||||
List<String> userId = list.stream().map(t -> t.getCreatorUserId()).collect(Collectors.toList());
|
||||
List<UserEntity> userList = userService.getUserName(userId);
|
||||
List<VisualLogVo> listVo = new ArrayList<>();
|
||||
for (VisualLogEntity entity : list) {
|
||||
VisualLogVo vo = JsonUtil.getJsonToBean(entity, VisualLogVo.class);
|
||||
UserEntity userEntity = userList.stream().filter(t -> vo.getCreatorUserId().equals(t.getId())).findFirst().orElse(null);
|
||||
if (userEntity != null) {
|
||||
vo.setCreatorUserName(userEntity.getRealName());
|
||||
vo.setHeadIcon(UploaderUtil.uploaderImg(userEntity.getHeadIcon()));
|
||||
}
|
||||
vo.setCreatorTime(DateUtil.dateToString(entity.getCreatorTime(), "yyyy-MM-dd HH:mm"));
|
||||
listVo.add(vo);
|
||||
}
|
||||
PaginationVO paginationVO = JsonUtil.getJsonToBean(page, PaginationVO.class);
|
||||
return ActionResult.page(listVo, paginationVO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.yunzhupaas.onlinedev.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.constant.MsgCode;
|
||||
import com.yunzhupaas.onlinedev.entity.VisualPersonalEntity;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.*;
|
||||
import com.yunzhupaas.onlinedev.service.VisualPersonalService;
|
||||
import com.yunzhupaas.util.JsonUtil;
|
||||
import com.yunzhupaas.util.RandomUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 个性化列表视图控制器
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/6 10:25:31
|
||||
*/
|
||||
@Slf4j
|
||||
@Tag(name = "在线开发个性化列表", description = "OnlinePersonal")
|
||||
@RestController
|
||||
@RequestMapping("/api/visualdev/personal")
|
||||
public class VisualPersonalController {
|
||||
|
||||
@Autowired
|
||||
private VisualPersonalService visualPersonalService;
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@Parameters({
|
||||
@Parameter(name = "menuId", description = "菜单id")
|
||||
})
|
||||
@GetMapping
|
||||
public ActionResult getList(VisualPersPagiantion pagiantion) {
|
||||
StpUtil.checkPermissionOr(pagiantion.getMenuId());
|
||||
List<VisualPersonalVo> listVo = visualPersonalService.getListVo(pagiantion.getMenuId());
|
||||
return ActionResult.success(listVo);
|
||||
}
|
||||
|
||||
@Operation(summary = "新建")
|
||||
@Parameters({
|
||||
@Parameter(name = "form", description = "个性化列表视图表单")
|
||||
})
|
||||
@PostMapping
|
||||
public ActionResult create(@RequestBody VisualPersonalForm form) {
|
||||
StpUtil.checkPermissionOr(form.getMenuId());
|
||||
VisualPersonalEntity entity = JsonUtil.getJsonToBean(form, VisualPersonalEntity.class);
|
||||
if (ObjectUtil.isEmpty(form.getId()) || VisualPersConst.SYSTEM_ID.equals(form.getId())) {
|
||||
if (form.getFullName().length() > 6) {
|
||||
return ActionResult.fail(MsgCode.EXIST005.get());
|
||||
}
|
||||
if (visualPersonalService.isExistByFullName(form.getFullName(), null, form.getMenuId())) {
|
||||
return ActionResult.fail(MsgCode.EXIST001.get());
|
||||
}
|
||||
List<VisualPersonalEntity> list = visualPersonalService.getList(form.getMenuId());
|
||||
if (list.size() >= 5) {
|
||||
return ActionResult.fail(MsgCode.VS028.get());
|
||||
}
|
||||
entity.setId(RandomUtil.uuId());
|
||||
entity.setStatus(0);
|
||||
entity.setType(1);
|
||||
visualPersonalService.save(entity);
|
||||
}
|
||||
return ActionResult.success(MsgCode.SU001.get(), entity.getId());
|
||||
}
|
||||
|
||||
@Operation(summary = "详情")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "个性化id"),
|
||||
@Parameter(name = "menuId", description = "菜单id"),
|
||||
})
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id, VisualPersPagiantion pagiantion) {
|
||||
StpUtil.checkPermissionOr(pagiantion.getMenuId());
|
||||
VisualPersonalInfo info = visualPersonalService.getInfo(id);
|
||||
return ActionResult.success(info);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "视图id"),
|
||||
@Parameter(name = "form", description = "表单数据")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public ActionResult update(@PathVariable("id") String id, @RequestBody VisualPersonalForm form) {
|
||||
StpUtil.checkPermissionOr(form.getMenuId());
|
||||
if (visualPersonalService.getById(id) != null) {
|
||||
if (form.getFullName().length() > 6) {
|
||||
return ActionResult.fail(MsgCode.EXIST005.get());
|
||||
}
|
||||
if (visualPersonalService.isExistByFullName(form.getFullName(), id, form.getMenuId())) {
|
||||
return ActionResult.fail(MsgCode.EXIST001.get());
|
||||
}
|
||||
VisualPersonalEntity entity = JsonUtil.getJsonToBean(form, VisualPersonalEntity.class);
|
||||
boolean b = visualPersonalService.updateById(entity);
|
||||
if (b) {
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}
|
||||
}
|
||||
return ActionResult.success(MsgCode.FA002.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "设置默认")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "视图id"),
|
||||
@Parameter(name = "menuId", description = "菜单id")
|
||||
})
|
||||
@PutMapping("/{id}/setDefault")
|
||||
public ActionResult updateStatus(@PathVariable("id") String id, VisualPersPagiantion pagiantion) {
|
||||
StpUtil.checkPermissionOr(pagiantion.getMenuId());
|
||||
|
||||
List<VisualPersonalEntity> list = visualPersonalService.getList(pagiantion.getMenuId());
|
||||
for (VisualPersonalEntity entity : list) {
|
||||
if (entity.getId().equals(id)) {
|
||||
entity.setStatus(1);
|
||||
} else {
|
||||
entity.setStatus(0);
|
||||
}
|
||||
}
|
||||
boolean b = visualPersonalService.updateBatchById(list);
|
||||
if (b) {
|
||||
return ActionResult.success(MsgCode.SU004.get());
|
||||
}
|
||||
return ActionResult.success(MsgCode.FA002.get());
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "视图id"),
|
||||
@Parameter(name = "menuId", description = "菜单id")
|
||||
})
|
||||
@DeleteMapping("/{id}")
|
||||
public ActionResult delete(@PathVariable("id") String id, VisualPersPagiantion pagiantion) {
|
||||
StpUtil.checkPermissionOr(pagiantion.getMenuId());
|
||||
if (visualPersonalService.getById(id) != null) {
|
||||
boolean b = visualPersonalService.removeById(id);
|
||||
if (b) {
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
}
|
||||
}
|
||||
return ActionResult.success(MsgCode.FA003.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.yunzhupaas.onlinedev.controller;
|
||||
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.entity.VisualdevReleaseEntity;
|
||||
import com.yunzhupaas.base.model.VisualDevJsonModel;
|
||||
import com.yunzhupaas.base.model.flow.DataModel;
|
||||
import com.yunzhupaas.base.model.flow.FlowFormDataModel;
|
||||
import com.yunzhupaas.base.service.DbLinkService;
|
||||
import com.yunzhupaas.base.service.FlowFormRelationService;
|
||||
import com.yunzhupaas.base.service.VisualdevReleaseService;
|
||||
import com.yunzhupaas.base.service.VisualdevService;
|
||||
import com.yunzhupaas.base.util.FlowFormDataUtil;
|
||||
import com.yunzhupaas.base.util.FlowFormHttpReqUtils;
|
||||
import com.yunzhupaas.database.model.entity.DbLinkEntity;
|
||||
import com.yunzhupaas.exception.DataException;
|
||||
import com.yunzhupaas.onlinedev.model.OnlineInfoModel;
|
||||
import com.yunzhupaas.onlinedev.model.PaginationModel;
|
||||
import com.yunzhupaas.base.model.OnlineImport.VisualdevModelDataInfoVO;
|
||||
import com.yunzhupaas.onlinedev.model.VisualParamModel;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevInfoService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualDevListService;
|
||||
import com.yunzhupaas.onlinedev.service.VisualdevModelDataService;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.FlowFormCustomUtils;
|
||||
import com.yunzhupaas.onlinedev.util.onlineDevUtil.OnlinePublicUtils;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.visual.service.VisualdevApi;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class VisualdevForFlowController implements VisualdevApi {
|
||||
|
||||
@Autowired
|
||||
private VisualdevReleaseService visualdevReleaseService;
|
||||
@Autowired
|
||||
private VisualdevService visualdevService;
|
||||
@Autowired
|
||||
private VisualDevListService visualDevListService;
|
||||
@Autowired
|
||||
private VisualDevInfoService visualDevInfoService;
|
||||
@Autowired
|
||||
private FlowFormHttpReqUtils flowFormHttpReqUtils;
|
||||
@Autowired
|
||||
private FlowFormCustomUtils flowFormCustomUtils;
|
||||
@Autowired
|
||||
private FlowFormDataUtil flowDataUtil;
|
||||
@Autowired
|
||||
private DbLinkService dblinkService;
|
||||
@Autowired
|
||||
private FlowFormRelationService flowFormRelationService;
|
||||
@Autowired
|
||||
private VisualdevModelDataService visualdevModelDataService;
|
||||
|
||||
@Override
|
||||
public ActionResult saveOrUpdate(FlowFormDataModel flowFormDataModel) {
|
||||
DataModel dataModel = null;
|
||||
try {
|
||||
String id = flowFormDataModel.getId();
|
||||
String formId = flowFormDataModel.getFormId();
|
||||
String flowId = flowFormDataModel.getFlowId();
|
||||
Map<String, Object> map = flowFormDataModel.getMap();
|
||||
List<Map<String, Object>> formOperates = flowFormDataModel.getFormOperates();
|
||||
VisualdevReleaseEntity entity = visualdevReleaseService.getById(formId);
|
||||
VisualdevEntity visualdevEntity = JsonUtil.getJsonToBean(entity, VisualdevEntity.class);
|
||||
|
||||
map.put(FlowFormConstant.FLOWID, flowId);
|
||||
if (map.get(TableFeildsEnum.VERSION.getField().toUpperCase()) != null) {//针对Oracle数据库大小写敏感,出现大写字段补充修复
|
||||
map.put(TableFeildsEnum.VERSION.getField(), map.get(TableFeildsEnum.VERSION.getField().toUpperCase()));
|
||||
}
|
||||
|
||||
//系统表单
|
||||
if (entity.getType() == 2) {
|
||||
map.put("formOperates", formOperates);
|
||||
flowFormHttpReqUtils.saveOrUpdate(visualdevEntity, id, UserProvider.getToken(), map);
|
||||
} else {
|
||||
try {
|
||||
dataModel = flowFormCustomUtils.saveOrUpdate(visualdevEntity, flowFormDataModel);
|
||||
} catch (SQLException sqlException) {
|
||||
sqlException.printStackTrace();
|
||||
} catch (DataException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail(e.getMessage());
|
||||
}
|
||||
return ActionResult.success(dataModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(String formId, String id) {
|
||||
try {
|
||||
VisualdevReleaseEntity entity = visualdevReleaseService.getById(formId);
|
||||
VisualdevEntity visualdevEntity = JsonUtil.getJsonToBean(entity, VisualdevEntity.class);
|
||||
//系统表单
|
||||
if (entity.getType() == 2) {
|
||||
flowFormHttpReqUtils.delete(visualdevEntity, id, UserProvider.getToken());
|
||||
} else {
|
||||
VisualDevJsonModel visualJsonModel = OnlinePublicUtils.getVisualJsonModel(visualdevEntity);
|
||||
DbLinkEntity linkEntity = StringUtil.isNotEmpty(visualdevEntity.getDbLinkId()) ? dblinkService.getInfo(visualdevEntity.getDbLinkId()) : null;
|
||||
flowDataUtil.deleteTable(id, visualJsonModel, linkEntity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult info(String formId, String id) {
|
||||
ActionResult result = new ActionResult();
|
||||
Map<String, Object> allDataMap = new HashMap();
|
||||
VisualdevReleaseEntity entity = visualdevReleaseService.getById(formId);
|
||||
VisualdevEntity visualdevEntity = JsonUtil.getJsonToBean(entity, VisualdevEntity.class);
|
||||
result.setCode(visualdevEntity == null ? 400 : 200);
|
||||
result.setMsg(visualdevEntity == null ? "表单信息不存在" : "");
|
||||
if (visualdevEntity != null) {
|
||||
//判断是否为系统表单
|
||||
boolean b = visualdevEntity.getType() == 2;
|
||||
if (b) {
|
||||
allDataMap.putAll(flowFormHttpReqUtils.info(visualdevEntity, id, UserProvider.getToken()));
|
||||
} else {
|
||||
allDataMap.putAll(flowFormCustomUtils.info(visualdevEntity, id));
|
||||
}
|
||||
}
|
||||
result.setData(allDataMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevEntity getFormConfig(String formId) {
|
||||
VisualdevReleaseEntity entity = visualdevReleaseService.getById(formId);
|
||||
VisualdevEntity visualdevEntity = JsonUtil.getJsonToBean(entity, VisualdevEntity.class);
|
||||
return visualdevEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VisualdevEntity> getFormConfigList(List<String> formIds) {
|
||||
List<VisualdevReleaseEntity> list = visualdevReleaseService.selectByIds(formIds,
|
||||
VisualdevReleaseEntity::getId,
|
||||
VisualdevReleaseEntity::getEnCode,
|
||||
VisualdevReleaseEntity::getFullName,
|
||||
VisualdevReleaseEntity::getType);
|
||||
return CollectionUtils.isNotEmpty(list) ? JsonUtil.getJsonToList(list, VisualdevEntity.class) : new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFlowIdByFormIds(String flowId, List<String> formIds) {
|
||||
flowFormRelationService.saveFlowIdByFormIds(flowId, formIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevEntity getReleaseInfo(String formId) {
|
||||
return visualdevService.getReleaseInfo(formId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getListWithTableList(VisualDevJsonModel visualDevJsonModel, PaginationModel pagination, UserInfo userInfo) {
|
||||
return visualDevListService.getListWithTableList(visualDevJsonModel, pagination, userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualdevModelDataInfoVO getEditDataInfo(String id, VisualdevEntity visualdevEntity) {
|
||||
return visualDevInfoService.getEditDataInfo(id, visualdevEntity, OnlineInfoModel.builder().build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataModel visualCreate(VisualParamModel model) throws Exception {
|
||||
return visualdevModelDataService.visualCreate(VisualParamModel.builder().visualdevEntity(model.getVisualdevEntity()).data(model.getData()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataModel visualUpdate(VisualParamModel model) throws Exception {
|
||||
return visualdevModelDataService.visualUpdate(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualDelete(VisualParamModel model) throws Exception {
|
||||
visualdevModelDataService.visualDelete(model.getVisualdevEntity(), model.getDataList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByTableName(FlowFormDataModel model) throws Exception {
|
||||
visualdevModelDataService.deleteByTableName(model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.yunzhupaas.onlinedev.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import com.yunzhupaas.base.ActionResult;
|
||||
import com.yunzhupaas.base.vo.DownloadVO;
|
||||
import com.yunzhupaas.base.service.VisualdevService;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.config.ConfigValueUtil;
|
||||
import com.yunzhupaas.constant.MsgCode;
|
||||
import com.yunzhupaas.emnus.ExportModelTypeEnum;
|
||||
import com.yunzhupaas.exception.WorkFlowException;
|
||||
import com.yunzhupaas.onlinedev.model.*;
|
||||
import com.yunzhupaas.util.*;
|
||||
import com.yunzhupaas.emnus.ModuleTypeEnum;
|
||||
import com.yunzhupaas.util.FileExport;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 0代码app无表开发
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2023/09/27
|
||||
*/
|
||||
@Tag(name = "0代码app无表开发", description = "ModelAppData")
|
||||
@RestController
|
||||
@RequestMapping("/api/visualdev/OnlineDev/App")
|
||||
public class VisualdevModelAppController {
|
||||
|
||||
@Autowired
|
||||
private VisualdevService visualdevService;
|
||||
@Autowired
|
||||
private FileExport fileExport;
|
||||
@Autowired
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "功能导出")
|
||||
@PostMapping("/{modelId}/Actions/ExportData")
|
||||
public ActionResult exportData(@PathVariable("modelId") String modelId){
|
||||
VisualdevEntity visualdevEntity = visualdevService.getInfo(modelId);
|
||||
BaseDevModelVO vo = JsonUtil.getJsonToBean(visualdevEntity,BaseDevModelVO.class);
|
||||
vo.setModelType(ExportModelTypeEnum.App.getMessage());
|
||||
DownloadVO downloadVO=fileExport.exportFile(vo,configValueUtil.getTemporaryFilePath(), visualdevEntity.getFullName(), ModuleTypeEnum.VISUAL_APP.getTableName());
|
||||
return ActionResult.success(downloadVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "功能导入")
|
||||
@PostMapping(value = "/Model/Actions/ImportData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ActionResult ImportData(@RequestPart("file") MultipartFile multipartFile) throws WorkFlowException {
|
||||
//判断是否为.json结尾
|
||||
if (FileUtil.existsSuffix(multipartFile, ModuleTypeEnum.VISUAL_APP.getTableName())) {
|
||||
return ActionResult.fail(MsgCode.IMP002.get());
|
||||
}
|
||||
//获取文件内容
|
||||
String fileContent = FileUtil.getFileContent(multipartFile);
|
||||
BaseDevModelVO vo = JsonUtil.getJsonToBean(fileContent, BaseDevModelVO.class);
|
||||
if (vo.getModelType() == null || !vo.getModelType().equals(ExportModelTypeEnum.App.getMessage())) {
|
||||
return ActionResult.fail(MsgCode.VS410.get());
|
||||
}
|
||||
VisualdevEntity visualdevEntity = JsonUtil.getJsonToBean(vo, VisualdevEntity.class);
|
||||
String modelId = visualdevEntity.getId();
|
||||
if (StringUtil.isNotEmpty(modelId)) {
|
||||
VisualdevEntity entity = visualdevService.getInfo(modelId);
|
||||
if (entity != null) {
|
||||
return ActionResult.fail(MsgCode.VS411.get());
|
||||
}
|
||||
}
|
||||
visualdevEntity.setCreatorTime(DateUtil.getNowDate());
|
||||
visualdevEntity.setLastModifyTime(null);
|
||||
visualdevService.create(visualdevEntity);
|
||||
return ActionResult.success(MsgCode.IMP001.get());
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
<?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-onlinedev</artifactId>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<version>5.2.0-RELEASE</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>yunzhupaas-visualdev-onlinedev-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yunzhupaas</groupId>
|
||||
<artifactId>yunzhupaas-common-all</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,45 @@
|
||||
package com.yunzhupaas.onlinedev.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 在线开发-数据日志实体类
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/8/27 15:50:10
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_visual_log")
|
||||
public class VisualLogEntity extends SuperEntity<String> {
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
@TableField("F_MODEL_ID")
|
||||
private String modelId;
|
||||
|
||||
/**
|
||||
* 日志类型:0-新建,1-编辑
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 数据id
|
||||
*/
|
||||
@TableField("F_DATA_ID")
|
||||
private String dataId;
|
||||
|
||||
/**
|
||||
* 日志内容
|
||||
*/
|
||||
@TableField("F_DATA_LOG")
|
||||
private String dataLog;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.yunzhupaas.onlinedev.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yunzhupaas.base.entity.SuperEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 列表个性视图
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 16:47:24
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_visual_personal")
|
||||
public class VisualPersonalEntity extends SuperEntity<String> {
|
||||
/**
|
||||
* 菜单id
|
||||
*/
|
||||
@TableField("F_MENU_ID")
|
||||
private String menuId;
|
||||
/**
|
||||
* 个性视图名称
|
||||
*/
|
||||
@TableField("F_full_name")
|
||||
private String fullName;
|
||||
/**
|
||||
* 类型:0-系统,1-其他
|
||||
*/
|
||||
@TableField("F_TYPE")
|
||||
private Integer type;
|
||||
/**
|
||||
* 状态:0-其他,1-默认
|
||||
*/
|
||||
@TableField("F_STATUS")
|
||||
private Integer status;
|
||||
/**
|
||||
* 查询字段
|
||||
*/
|
||||
@TableField("F_SEARCH_LIST")
|
||||
private String searchList;
|
||||
/**
|
||||
* 列表字段
|
||||
*/
|
||||
@TableField("F_COLUMN_LIST")
|
||||
private String columnList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yunzhupaas.onlinedev.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.yunzhupaas.base.entity.SuperExtendEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* 0代码功能数据表
|
||||
* 版本: V3.0.0
|
||||
* 版权: 深圳市乐程软件有限公司
|
||||
* 作者: 管理员/admin
|
||||
* 日期: 2020-07-24 11:59
|
||||
*/
|
||||
@Data
|
||||
//@TableName("base_visualdev_modeldata")
|
||||
public class VisualdevModelDataEntity extends SuperExtendEntity<String> {
|
||||
|
||||
@TableField("F_VISUALDEVID")
|
||||
private String visualDevId;
|
||||
|
||||
@TableField("F_SORTCODE")
|
||||
private Long sortcode;
|
||||
|
||||
@TableField("F_ENABLEDMARK")
|
||||
private Integer enabledmark;
|
||||
|
||||
@TableField("F_CREATORTIME")
|
||||
private Date creatortime;
|
||||
|
||||
@TableField("F_CREATORUSERID")
|
||||
private String creatoruserid;
|
||||
|
||||
@TableField("F_LASTMODIFYTIME")
|
||||
private Date lastmodifytime;
|
||||
|
||||
@TableField("F_LASTMODIFYUSERID")
|
||||
private String lastmodifyuserid;
|
||||
|
||||
@TableField("F_DELETEMARK")
|
||||
private Integer deletemark;
|
||||
|
||||
@TableField("F_DELETETIME")
|
||||
private Date deletetime;
|
||||
|
||||
@TableField("F_DELETEUSERID")
|
||||
private String deleteuserid;
|
||||
@TableField("F_DATA")
|
||||
private String data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.model.flow.DataModel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 类的描述
|
||||
*
|
||||
* @author YUNZHUPAASYUNZHUPAAS开发组
|
||||
* @version 5.0.x
|
||||
* @since 2024/12/19 17:12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class AsyncExecuteModel {
|
||||
private String modelId;
|
||||
private Integer trigger;
|
||||
private List<String> dataId;
|
||||
private List<Map<String, Object>> dataMap;
|
||||
private UserInfo userInfo;
|
||||
private DataModel dataModel;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能设计导入导出模型
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/7/15
|
||||
*/
|
||||
@Data
|
||||
public class BaseDevModelVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String description;
|
||||
|
||||
private String sortCode;
|
||||
|
||||
private String enabledMark;
|
||||
|
||||
private String creatorTime;
|
||||
|
||||
private String creatorUser;
|
||||
|
||||
private String lastModifyTime;
|
||||
|
||||
private String lastModifyUser;
|
||||
|
||||
private String deleteMark;
|
||||
|
||||
private String deleteTime;
|
||||
|
||||
private String deleteUserId;
|
||||
|
||||
private String fullName;
|
||||
|
||||
private String enCode;
|
||||
|
||||
private String state;
|
||||
|
||||
private String type;
|
||||
|
||||
private String tables;
|
||||
|
||||
private String category;
|
||||
|
||||
private String formData;
|
||||
|
||||
private String columnData;
|
||||
|
||||
private String appColumnData;
|
||||
|
||||
private String dbLinkId;
|
||||
|
||||
private String webType;
|
||||
|
||||
private String flowTemplateJson;
|
||||
|
||||
private String modelType;
|
||||
|
||||
private String enableFlow;
|
||||
|
||||
private String interfaceId;
|
||||
|
||||
private String interfaceParam;
|
||||
|
||||
//以下系统表单属性
|
||||
private String urlAddress;
|
||||
|
||||
private String appUrlAddress;
|
||||
|
||||
private String interfaceUrl;
|
||||
|
||||
private String aliasListJson;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 批量删除id集合
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/6/17
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="批量处理参数")
|
||||
public class BatchRemoveIdsVo {
|
||||
@Schema(description = "批量处理数据id")
|
||||
private String[] ids;
|
||||
|
||||
@Schema(description = "流程id")
|
||||
private String flowId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
public class ColumnDataInfoVO {
|
||||
private String columnData;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.model.visualJson.TableFields;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersonalInfo;
|
||||
import com.yunzhupaas.onlinedev.model.personalList.VisualPersonalVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
public class DataInfoVO {
|
||||
private String id;
|
||||
private String formData;
|
||||
private String columnData;
|
||||
private String appColumnData;
|
||||
private String webType;
|
||||
private String flowTemplateJson;
|
||||
private String flowEnCode;
|
||||
private String flowId;
|
||||
private String fullName;
|
||||
private Integer enableFlow;
|
||||
private Integer type;
|
||||
private String urlAddress;
|
||||
private String enCode;
|
||||
private String appUrlAddress;
|
||||
private String interfaceId;
|
||||
|
||||
@Schema(description = "个性化视图列表")
|
||||
private List<VisualPersonalVo> personalList;
|
||||
@Schema(description = "个性化视图默认视图")
|
||||
private VisualPersonalInfo defaultView;
|
||||
|
||||
@Schema(description = "存字段列表")
|
||||
private List<TableFields> propsValueList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.4.3
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2022/9/21
|
||||
*/
|
||||
@Data
|
||||
public class ExcelImFieldModel {
|
||||
private String id;
|
||||
private String fullName;
|
||||
private String yunzhupaasKey;
|
||||
private List<ExcelImFieldModel> children;
|
||||
|
||||
public ExcelImFieldModel(String id, String fullName, List<ExcelImFieldModel> children) {
|
||||
this.id = id;
|
||||
this.fullName = fullName;
|
||||
this.children = children;
|
||||
}
|
||||
public ExcelImFieldModel(String id, String fullName) {
|
||||
this.id = id;
|
||||
this.fullName = fullName;
|
||||
}
|
||||
|
||||
public ExcelImFieldModel(String id, String fullName, String yunzhupaasKey, List<ExcelImFieldModel> children) {
|
||||
this.id = id;
|
||||
this.fullName = fullName;
|
||||
this.yunzhupaasKey = yunzhupaasKey;
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public ExcelImFieldModel(String id, String fullName, String yunzhupaasKey) {
|
||||
this.id = id;
|
||||
this.fullName = fullName;
|
||||
this.yunzhupaasKey = yunzhupaasKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
public class FormDataInfoVO {
|
||||
private String formData;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevEnum;
|
||||
|
||||
/**
|
||||
*
|
||||
* 在线开发缓存的key
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/7/31
|
||||
*/
|
||||
public enum CacheKeyEnum {
|
||||
/**
|
||||
* 修改用户,创建用户,用户组件
|
||||
*/
|
||||
USER("_user","用户"),
|
||||
|
||||
POS("_position","岗位"),
|
||||
|
||||
ORG("_organization","组织"),
|
||||
|
||||
ORGTREE("_organizeTree","组织多级"),
|
||||
|
||||
PRO("_province","省份"),
|
||||
|
||||
ROLE("_role","角色"),
|
||||
|
||||
GROUP("_group","分组");
|
||||
private final String name;
|
||||
private final String message;
|
||||
|
||||
CacheKeyEnum(String name, String message) {
|
||||
this.name = name;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevEnum;
|
||||
|
||||
/**
|
||||
* 控件多选字符
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.3
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/2/14
|
||||
*/
|
||||
|
||||
public enum MultipleControlEnum {
|
||||
/**
|
||||
* 数组
|
||||
*/
|
||||
MULTIPLE_JSON_ONE("[",1),
|
||||
/**
|
||||
* 二维数组
|
||||
*/
|
||||
MULTIPLE_JSON_TWO("[[",2),
|
||||
/**
|
||||
* 普通字符
|
||||
*/
|
||||
MULTIPLE_JSON_THREE("",3);
|
||||
|
||||
|
||||
MultipleControlEnum(String multipleChar, int dataType) {
|
||||
MultipleChar = multipleChar;
|
||||
DataType = dataType;
|
||||
}
|
||||
|
||||
public String getMultipleChar() {
|
||||
return MultipleChar;
|
||||
}
|
||||
|
||||
public int getDataType() {
|
||||
return DataType;
|
||||
}
|
||||
|
||||
private String MultipleChar;
|
||||
private int DataType;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevEnum;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 数据接口类型
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/7/31
|
||||
*/
|
||||
|
||||
public enum OnlineDataTypeEnum {
|
||||
/**
|
||||
* 静态数据
|
||||
*/
|
||||
STATIC("static","静态数据"),
|
||||
/**
|
||||
* 数据字典
|
||||
*/
|
||||
DICTIONARY("dictionary","数据字典"),
|
||||
/**
|
||||
* 远端数据
|
||||
*/
|
||||
DYNAMIC("dynamic","远端数据"),
|
||||
|
||||
/**
|
||||
* 二维码 条形码类型
|
||||
*/
|
||||
STATIC_CODE("static","固定值"),
|
||||
|
||||
RELATION("relation","关联组件")
|
||||
;
|
||||
|
||||
private final String type;
|
||||
private final String message;
|
||||
|
||||
|
||||
OnlineDataTypeEnum(String type, String message) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InterefaceParamModel {
|
||||
/**
|
||||
* 字段
|
||||
*/
|
||||
private String field ;
|
||||
/**
|
||||
* 作为查询字段
|
||||
*/
|
||||
private Boolean useSearch;
|
||||
/**
|
||||
* 参数值
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
private String dataType;
|
||||
private String parameter;
|
||||
private String disabled;
|
||||
private String id;
|
||||
private String required;
|
||||
|
||||
private String fieldName;
|
||||
private String yunzhupaasKey;
|
||||
private String relationField;
|
||||
private Integer sourceType = 1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 列表子表
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/10/16
|
||||
*/
|
||||
@Data
|
||||
public class OnlineColumnChildFieldModel {
|
||||
/**
|
||||
* 子表表名
|
||||
*/
|
||||
private String table;
|
||||
/**
|
||||
* 关联外键
|
||||
*/
|
||||
private String tableField;
|
||||
|
||||
/**
|
||||
* 关联主键
|
||||
*/
|
||||
private String relationField;
|
||||
|
||||
/**
|
||||
* 子表字段集合
|
||||
*/
|
||||
private List<String> fieldList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 列表字段
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/10/16
|
||||
*/
|
||||
@Data
|
||||
public class OnlineColumnFieldModel {
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 字段
|
||||
*/
|
||||
private String field;
|
||||
|
||||
/**
|
||||
* 原本字段
|
||||
*/
|
||||
private String OriginallyField;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
private String otherName;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
|
||||
|
||||
import com.yunzhupaas.model.visualJson.config.RegListModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/8/5
|
||||
*/
|
||||
@Data
|
||||
public class OnlineConfigModel {
|
||||
private String label;
|
||||
private String labelWidth;
|
||||
private Boolean showLabel;
|
||||
private Boolean changeTag;
|
||||
private Boolean border;
|
||||
private String tag;
|
||||
private String tagIcon;
|
||||
private Boolean required;
|
||||
private String layout;
|
||||
private String dataType;
|
||||
private Integer span;
|
||||
private String yunzhupaasKey;
|
||||
private String dictionaryType;
|
||||
private Integer formId;
|
||||
private Long renderKey;
|
||||
private Integer columnWidth;
|
||||
private List<RegListModel> regList;
|
||||
private Object defaultValue;
|
||||
/**
|
||||
* app静态数据
|
||||
*/
|
||||
private String options;
|
||||
/**
|
||||
* 判断defaultValue类型
|
||||
*/
|
||||
private String valueType;
|
||||
private String propsUrl;
|
||||
private String optionType;
|
||||
/**
|
||||
* 子表添加字段
|
||||
*/
|
||||
private String showTitle;
|
||||
private String tableName;
|
||||
private List<OnlineFieldsModel> children;
|
||||
/**
|
||||
* 单据规则使用
|
||||
*/
|
||||
private String rule;
|
||||
|
||||
/**
|
||||
* 验证规则触发方式
|
||||
*/
|
||||
private String trigger = "blur" ;
|
||||
/**
|
||||
* 隐藏
|
||||
*/
|
||||
private Boolean noShow = false;
|
||||
private String yunzhupaasKeyName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/7/28
|
||||
*/
|
||||
@Data
|
||||
public class OnlineDevListDataVO {
|
||||
private String id;
|
||||
private Map<String,Object> data;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*在线开发formData
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/8/2
|
||||
*/
|
||||
@Data
|
||||
public class OnlineFieldsModel {
|
||||
private StringBuilder sql;
|
||||
private List<OnlineColumnFieldModel> mastTableList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OnlineListSqlModel {
|
||||
/**
|
||||
* 主表
|
||||
*/
|
||||
private String mainTable;
|
||||
/**
|
||||
* 用到的字段
|
||||
*/
|
||||
private String fields;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String pKeyName;
|
||||
/**
|
||||
* 数据权限条件
|
||||
*/
|
||||
private String resultSql;
|
||||
|
||||
private String defaultSidx;
|
||||
private String sort;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* props父级
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/8/3
|
||||
*/
|
||||
@Data
|
||||
public class PropsFatherModel {
|
||||
private PropsModel props;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/8/3
|
||||
*/
|
||||
@Data
|
||||
public class PropsModel {
|
||||
private String children;
|
||||
private String value;
|
||||
private String label;
|
||||
private boolean multiple;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* slot
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/8/2
|
||||
*/
|
||||
@Data
|
||||
public class SlotModel {
|
||||
private List<Map<String,Object>> options;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.yunzhupaas.onlinedev.model.OnlineDevListModel;
|
||||
|
||||
import com.yunzhupaas.model.visualJson.TemplateJsonModel;
|
||||
import com.yunzhupaas.model.visualJson.config.ConfigModel;
|
||||
import com.yunzhupaas.model.visualJson.props.PropsModel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.2.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2024/8/9
|
||||
*/
|
||||
@Data
|
||||
public class VisualColumnSearchVO {
|
||||
/**
|
||||
* 查询字段全key:如tableField113-datePickerField117
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 查询字段全名:如设计子表-子表年月日
|
||||
*/
|
||||
private String fullName;
|
||||
/**
|
||||
* 查询条件类型 1.等于 2.模糊 3.范围
|
||||
*/
|
||||
private String searchType;
|
||||
private String vModel;
|
||||
/**
|
||||
* 查询值
|
||||
*/
|
||||
private Object value;
|
||||
/**
|
||||
* 是否多选
|
||||
*/
|
||||
private Boolean multiple;
|
||||
|
||||
private Boolean searchMultiple;
|
||||
|
||||
private ConfigModel config;
|
||||
/**
|
||||
* 省市区
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 时间类型格式
|
||||
*/
|
||||
private String format;
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 数据库字段
|
||||
*/
|
||||
private String field;
|
||||
private String table;
|
||||
|
||||
private PropsModel props;
|
||||
private SlotModel slot;
|
||||
private String options;
|
||||
|
||||
private List<TemplateJsonModel> templateJson = new ArrayList();
|
||||
private String interfaceId;
|
||||
|
||||
private String selectType;
|
||||
private String ableDepIds;
|
||||
private String ableIds;
|
||||
private String ablePosIds;
|
||||
private String ableUserIds;
|
||||
private String ableRoleIds;
|
||||
private String ableGroupIds;
|
||||
|
||||
/**
|
||||
* 列表字段是否关键词
|
||||
*/
|
||||
private Boolean isKeyword = false;
|
||||
|
||||
/**
|
||||
* 是否选中数据及子信息(只针对视图)
|
||||
*/
|
||||
private Boolean isIncludeSubordinate = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.model.visualJson.analysis.FormAllModel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class OnlineInfoModel {
|
||||
/**
|
||||
* 是否需要关联表单字段
|
||||
*/
|
||||
private boolean needRlationFiled = false;
|
||||
/**
|
||||
* 是否转换
|
||||
*/
|
||||
private boolean needSwap = false;
|
||||
/**
|
||||
* 存储字段
|
||||
*/
|
||||
private String propsValue;
|
||||
|
||||
@Schema(description = "解析后字段")
|
||||
private List<FormAllModel> formAllModel;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.base.Pagination;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="查询条件模型")
|
||||
public class PaginationModel extends Pagination {
|
||||
@Schema(description = "查询条件json")
|
||||
private String queryJson;
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
@Schema(description = "关联字段")
|
||||
private String relationField;
|
||||
@Schema(description = "字段对象")
|
||||
private String columnOptions;
|
||||
@Schema(description = "数据类型")
|
||||
private String dataType;
|
||||
@Schema(description = "高级查询条件json")
|
||||
private String superQueryJson;
|
||||
@Schema(description = "异步查询父id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "关联表单查询类型:0-简易查询(单行,多行,数字,下拉补全),1-全部字段")
|
||||
private Integer queryType = 1;
|
||||
|
||||
@Schema(description = "页签查询")
|
||||
private String extraQueryJson;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description="导出参数")
|
||||
public class PaginationModelExport extends PaginationModel {
|
||||
@Schema(description = "导出selectKey")
|
||||
private String[] selectKey;
|
||||
@Schema(description = "导出选中数据")
|
||||
private Object[] selectIds;
|
||||
@Schema(description = "导出json")
|
||||
private String json;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yunzhupaas.onlinedev.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,19 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Schema(description = "错误信息对象")
|
||||
public class VisualErrInfo {
|
||||
@Schema(description = "错误信息")
|
||||
private String errMsg;
|
||||
@Schema(description = "主键id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "流程任务id")
|
||||
private String flowTaskId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "详情接口传参")
|
||||
@Data
|
||||
public class VisualInfoParam {
|
||||
@Schema(description = "数据值")
|
||||
private Object id;
|
||||
@Schema(description = "数据字段")
|
||||
private String propsValue;
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yunzhupaas.base.UserInfo;
|
||||
import com.yunzhupaas.base.entity.VisualdevEntity;
|
||||
import com.yunzhupaas.base.model.VisualDevJsonModel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Schema(description = "在线方法接口变量")
|
||||
public class VisualParamModel {
|
||||
private String menuId;
|
||||
private VisualDevJsonModel visualDevJsonModel;
|
||||
private PaginationModel pagination;
|
||||
private UserInfo userInfo;
|
||||
|
||||
private VisualdevEntity visualdevEntity;
|
||||
private Map<String, Object> data;
|
||||
private List<Map<String, Object>> dataList;
|
||||
private String id;
|
||||
@Schema(description = "是否外链")
|
||||
@Builder.Default
|
||||
private Boolean isLink = false;
|
||||
|
||||
@Schema(description = "子表仅修改")
|
||||
@Builder.Default
|
||||
private Boolean isUpload = false;
|
||||
|
||||
@Schema(description = "子表仅修改")
|
||||
@Builder.Default
|
||||
private Boolean onlyUpdate = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
@Schema(description="功能数据创建表单")
|
||||
public class VisualdevModelDataCrForm {
|
||||
@Schema(description = "判断新增")
|
||||
private String id;
|
||||
@Schema(description = "引擎主键")
|
||||
private String flowId;
|
||||
@Schema(description = "数据内容")
|
||||
private String data;
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
@Schema(description = "流程候选人列表")
|
||||
private Map<String, List<String>> candidateList;
|
||||
@Schema(description = "流程紧急度")
|
||||
private Integer flowUrgent = 1;
|
||||
@Schema(description = "是否外链")
|
||||
private Boolean isLink = false;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yunzhupaas.onlinedev.model;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @author 云筑产品开发平台组
|
||||
* @date 2024/3/16
|
||||
*/
|
||||
@Data
|
||||
public class VisualdevModelDataListVO {
|
||||
|
||||
private Map<String, Object> data;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yunzhupaas.onlinedev.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 VisualdevModelDataUpForm extends VisualdevModelDataCrForm {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.yunzhupaas.onlinedev.model.fields.autosize;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AutosizeModel {
|
||||
private Integer minRows;
|
||||
private Integer maxRows;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yunzhupaas.onlinedev.model.fields.options;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version V3.1.0
|
||||
* @copyright 深圳市乐程软件有限公司(http://www.szlecheng.cn)
|
||||
* @date 2021/6/29
|
||||
*/
|
||||
@Data
|
||||
public class ColumnOptionModel {
|
||||
private String value;
|
||||
private String label;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.yunzhupaas.onlinedev.model.fields.options;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OptionsModel {
|
||||
private Integer id;
|
||||
private Integer value;
|
||||
private String label;
|
||||
private List<OptionsModel> children;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.yunzhupaas.onlinedev.model.fields.picker;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PickerOptionsModel {
|
||||
private String selectableRange;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.yunzhupaas.onlinedev.model.fields.style;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StyleModel {
|
||||
private String width;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yunzhupaas.onlinedev.model.fields.style;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class textStyleModel {
|
||||
private String color;
|
||||
private String textalign;
|
||||
private String fontweight;
|
||||
private String fontstyle;
|
||||
private String textdecoration;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunzhupaas.onlinedev.model.personalList;
|
||||
|
||||
/**
|
||||
* 个性化视图静态参数
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 18:01:25
|
||||
*/
|
||||
public class VisualPersConst {
|
||||
|
||||
public final static String SYSTEM_ID = "systemId";
|
||||
|
||||
public final static String SYSTEM_NAME = "系统视图";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yunzhupaas.onlinedev.model.personalList;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 个性化视图参数对象
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/6 10:08:30
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "个性化视图参数对象")
|
||||
public class VisualPersPagiantion {
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
|
||||
@Schema(description = "功能id")
|
||||
private String modelId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunzhupaas.onlinedev.model.personalList;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 个性列表表单
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 18:01:45
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "个性化列表表单")
|
||||
public class VisualPersonalForm {
|
||||
@Schema(description = "列表视图")
|
||||
private String id;
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
@Schema(description = "列表视图")
|
||||
private String fullName;
|
||||
@Schema(description = "视图状态:0-其他,1-默认")
|
||||
private Integer status;
|
||||
@Schema(description = "视图状态:0-系统,1-其他")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "查询字段")
|
||||
private String searchList;
|
||||
@Schema(description = "列表字段")
|
||||
private String columnList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yunzhupaas.onlinedev.model.personalList;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 个性列表设置详情
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 18:01:45
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "列表视图详情")
|
||||
public class VisualPersonalInfo {
|
||||
@Schema(description = "列表视图")
|
||||
private String id;
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
@Schema(description = "列表视图")
|
||||
private String fullName;
|
||||
@Schema(description = "视图状态:0-其他,1-默认")
|
||||
private Integer status;
|
||||
@Schema(description = "视图状态:0-系统,1-其他")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "查询字段")
|
||||
private String searchList;
|
||||
@Schema(description = "列表字段")
|
||||
private String columnList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunzhupaas.onlinedev.model.personalList;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 个性化设置json属性
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 18:02:11
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "个性化设置json属性")
|
||||
public class VisualPersonalJson {
|
||||
@Schema(description = "字段名称")
|
||||
private String label;
|
||||
@Schema(description = "字段key")
|
||||
private String key;
|
||||
@Schema(description = "是否展示")
|
||||
private boolean show;
|
||||
@Schema(description = "对齐方式")
|
||||
private String fixed;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunzhupaas.onlinedev.model.personalList;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 个性化视图列表对象
|
||||
*
|
||||
* @author 云筑产品开发平台组
|
||||
* @version v5.1.0
|
||||
* @copyright 深圳市乐程软件有限公司
|
||||
* @date 2024/11/5 18:02:33
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "个性化视图列表对象")
|
||||
public class VisualPersonalVo {
|
||||
@Schema(description = "数据id")
|
||||
private String id;
|
||||
@Schema(description = "视图名称")
|
||||
private String fullName;
|
||||
@Schema(description = "视图状态:0-其他,1-默认")
|
||||
private Integer status;
|
||||
@Schema(description = "视图类型:0-系统,1-其他")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "查询字段")
|
||||
private String searchList;
|
||||
@Schema(description = "列表字段")
|
||||
private String columnList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.yunzhupaas.onlinedev.model.visualdevmodelApp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppDataInfoVO {
|
||||
private String formData;
|
||||
private String columnData;
|
||||
private String tables;
|
||||
private String webType;
|
||||
private String flowTemplateJson;
|
||||
private String flowEnCode;
|
||||
private String flowId;
|
||||
private String fullName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user