Commit f2f1082e by wqc

修改成数据目录、添加接口资源模块

parent 9f70e3e4
package com.zq.common.vo;
import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashSet;
import java.util.Set;
/**
* 医院信息表(THospital)实体类
*
......@@ -17,9 +21,19 @@ import lombok.NoArgsConstructor;
@Builder
public class IdVo {
/**
* id
*/
private Long id;
private String id;
private String note;
private Set<String> ids;
public Set<String> getIds() {
if (ids == null) {
ids = new HashSet<>();
}
if (StrUtil.isNotBlank(id)) {
ids.add(id);
}
return ids;
}
}
package com.zq.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* @author wilmiam
* @since 2021-09-06 15:27
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class KeywordFindVo extends PageReqVo {
private String keyword;
@ApiModelProperty("关联ID")
private String assocId;
}
......@@ -27,8 +27,8 @@ redis.password:
jdbc.driver-class-name: com.mysql.cj.jdbc.Driver
jdbc.username: root
jdbc.password: Dk2019!23456
jdbc.master.url: jdbc:mysql://119.45.183.210:13308/visual_modeling_platform?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
jdbc.hjk.url: jdbc:mysql://119.45.183.210:13308/data_collect?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
jdbc.master.url: jdbc:mysql://119.45.183.210:13308/visual_modeling_platform?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true
jdbc.hjk.url: jdbc:mysql://119.45.183.210:13308/data_collect?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&allowPublicKeyRetrieval=true
spring:
servlet:
......
......@@ -83,7 +83,7 @@ public class BigScreenServiceImpl implements BigScreenService {
try {
DruidPooledConnection connection = connectionHolder.get(queryDb.getId());
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
resultSet = preparedStatement.executeQuery();//报错行
int columnCount = resultSet.getMetaData().getColumnCount();
results = new ArrayList<>();
while (resultSet.next()) {
......
package com.zq.dataoperation.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.dataoperation.entity.DataCollectSetting;
public interface DataCollectMapper extends BaseMapper<DataCollectSetting> {
}
package com.zq.dataoperation.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.dataoperation.entity.DataCollectTaskLog;
public interface DataCollectTaskLogMapper extends BaseMapper<DataCollectTaskLog> {
}
package com.zq.dataoperation.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author Administrator
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "data_collect_setting")
public class DataCollectSetting {
/**
* 数据类型
* 1.数据库 2.文件 3.接口 4网站
*/
private Integer dataType;
/**
* 汇聚类型
* 1.一次性导入 2.增量导入
*/
private Integer collectType;
/**
* 是否手工导入
* 0否 1是
*/
private Boolean isManually;
/**
* 汇聚到的数据库名
* 如果是非结构化文件,可以不存入数据表
*/
private Integer toDbId;
/**
* 汇聚到的数据表名
* 如果是非结构化文件,可以不存入数据表
*/
private String toTable;
/**
* 表不存在时创建表(0否 1是)
*/
private Integer createTable = 0;
/**
* 汇聚任务的名称
*/
private String taskName;
/**
* 使用序列
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 执行计划的corn表达式
* 写执行的corn表达式
*/
private String cron;
/**
* 是否运行的开关
* 0否 1是
*/
private Boolean runFlag;
/**
* 模型创建用户
*
*/
private Long userId;
/**
* 模型创建部门
*
*/
private Long deptId;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* updateTime
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}
package com.zq.dataoperation.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "data_collect_task_log")
public class DataCollectTaskLog {
/**
* 汇聚设置id
*/
private Integer dataCollectSettingId;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 花费多少秒
*/
private Integer duration;
/**
* 状态
* 1运行中 2正常结束 3异常终止
*/
private Integer status;
/**
* 错误信息
* 异常终止时记录异常信息
*/
private String error;
/**
* 使用序列
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* updateTime
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
public DataCollectTaskLog(Integer dataCollectSettingId, Date startTime, Date endTime, Integer duration, Integer status, String error) {
this.dataCollectSettingId = dataCollectSettingId;
this.startTime = startTime;
this.endTime = endTime;
this.duration = duration;
this.status = status;
this.error = error;
}
}
......@@ -10,12 +10,13 @@ import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.dataoperation.dao.DataCleanRecordDao;
import com.zq.dataoperation.dao.DataCollectMapper;
import com.zq.dataoperation.dao.DataCollectTaskLogMapper;
import com.zq.datacollect.entity.DataCollectSetting;
import com.zq.datacollect.entity.DataCollectTaskLog;
import com.zq.datacollect.mapper.DataCollectMapper;
import com.zq.datacollect.mapper.DataCollectTaskLogMapper;
import com.zq.dataoperation.dao.QueryDbDao;
import com.zq.dataoperation.entity.DataCleanRecord;
import com.zq.dataoperation.entity.DataCollectSetting;
import com.zq.dataoperation.entity.DataCollectTaskLog;
import com.zq.dataoperation.entity.QueryDb;
import com.zq.dataoperation.vo.DataCleanRecordReq;
import org.apache.commons.lang3.StringUtils;
......
......@@ -25,9 +25,9 @@ public class Swagger {
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("可视化平台1")
.enable(!"product".equals(profile)) //生产环境关闭
.enable(!"prod".equals(profile)) //生产环境关闭
.select()
.apis(RequestHandlerSelectors.basePackage("org.spiderflow.controller"))
.apis(RequestHandlerSelectors.basePackage("com.zq.spiderflow.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
......@@ -46,7 +46,7 @@ public class Swagger {
.groupName("可视化平台4")
.enable(!"prod".equals(profile)) //生产环境关闭
.select()
.apis(RequestHandlerSelectors.basePackage("org.spiderflow.controller"))
.apis(RequestHandlerSelectors.basePackage("com.zq.spiderflow.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(appInfo());
......
package com.zq.spiderflow.configuration;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "share")
public class ShareApiConfig {
private String areaName;
private String areaCode;
private String catalogName;
private String catalogCode;
private String appKey;
private String appSecret;
private String apiUrl;
private String tokenUrl;
}
package com.zq.spiderflow.constant;
import lombok.Getter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wilmiam
* @since 2021-09-01 16:45
*/
@Getter
public enum ShareApiEnum {
/**
* 机构注册
*/
ORGAN_REGISTER("/basic/organ/adminRegister", "机构注册"),
/**
* 应用系统注册接口
*/
APP_REGISTER("/basic/app/register", "应用系统注册接口"),
/**
* 应用系统注册接口
*/
APP_MODIFY("/basic/app/modify", "应用系统修改接口"),
/**
* 目录分类注册接口
*/
CATALOG_GROUP_REGISTER("/basic/catalogcategory/register", "目录分类注册接口"),
/**
* 目录分类变更接口
*/
CATALOG_GROUP_MODIFY("/basic/catalogcategory/modify", "目录分类变更接口"),
/**
* 目录分类撤销接口
*/
CATALOG_GROUP_CANCEL("/basic/catalogcategory/cancel", "目录分类撤销接口"),
/**
* 目录注册接口
*/
CATALOG_REGISTER("/basic/catalog/register", "目录注册接口"),
/**
* 目录变更接口
*/
CATALOG_MODIFY("/basic/catalog/modify", "目录变更接口"),
/**
* 目录撤销接口
*/
CATALOG_CANCEL("/basic/catalog/cancel", "目录撤销接口"),
/**
* 库表资源注册接口
*/
TABLE_REGISTER("/basic/table/register", "库表资源注册接口"),
/**
* 库表资源撤销接口
*/
TABLE_CANCEL("/basic/table/cancel", "库表资源撤销接口"),
/**
* 文件资源注册接口
*/
FILE_REGISTER("/basic/file/register", "文件资源注册接口"),
/**
* 文件资源撤销接口
*/
FILE_CANCEL("/basic/file/cancel", "文件资源撤销接口"),
/**
* 接口资源注册接口
*/
SERVICE_REGISTER("/basic/service/register", "接口资源注册接口"),
/**
* 接口资源撤销接口
*/
SERVICE_CANCEL("/basic/service/cancel", "接口资源撤销接口"),
/**
* 接口资源说明附件上传接口
*/
FILE_UPLOAD("/basic/apply/fileupload", "接口资源说明附件上传接口"),
/**
* 接口资源说明附件下载接口
*/
FILE_DOWNLOAD("/basic/apply/filedowload", "接口资源说明附件下载接口"),
/**
* 代码主项注册或修改接口
*/
CODE_MAIN_SAVE_UPDATE("/basic/code/saveOrUpdateCodeMain", "代码主项注册或修改接口"),
/**
* 代码主项删除接口
*/
CODE_MAIN_DELETE("/basic/code/deleteCodeMain", "代码主项删除接口"),
/**
* 代码子项注册或修改接口
*/
CODE_ITEM_SAVE_UPDATE("/basic/code/saveOrUpdateCodeItem", "代码子项注册或修改接口"),
/**
* 代码子项删除接口
*/
CODE_ITEM_DELETE("/basic/code/deleteCodeItem", "代码子项删除接口"),
/**
* 数据元所属领域注册修改接口
*/
STANDARD_CATEGORY_ADD("/basic/standardcategory/add", "数据元所属领域注册修改接口"),
/**
* 数据元所属领域撤销接口
*/
STANDARD_CATEGORY_DELETE("/basic/standardcategory/delete", "数据元所属领域撤销接口"),
/**
* 数据元注册修改接口
*/
STANDARD_ADD("/basic/dataStandard/add", "数据元注册修改接口"),
/**
* 数据元撤销接口
*/
STANDARD_DELETE("/basic/standardDataStandard/delete", "数据元撤销接口"),
/**
* 映射元数据注册接口
*/
STANDARD_FILE_ADD("/basic/Standardfile/add", "映射元数据注册接口"),
/**
* 映射元数据撤销接口
*/
STANDARD_FILE_DELETE("/basic/Standardfile/delete", "映射元数据撤销接口"),
/**
* 平台运行监控接口
*/
DATA_MONITOR_ADD("/basic/datamonitor/add", "平台运行监控接口"),
/**
* 处室职责注册或修改接口
*/
DUTIES_ADD_UPDATE("/basic/qzsxqd/addOrUpdateDuties", "处室职责注册或修改接口"),
/**
* 处室职责删除接口
*/
DUTIES_DELETE("/basic/qzsxqd/deleteDuties", "处室职责删除接口"),
/**
* 职责办事项注册或修改接口
*/
RESPONSIBILITY_ADD_UPDATE("/basic/qzsxqd/addOrUpdateResponsibility", "职责办事项注册或修改接口"),
/**
* 职责办事项删除接口
*/
RESPONSIBILITY_DELETE("/basic/qzsxqd/deleteResponsibility", "职责办事项删除接口"),
;
private final String url;
private final String label;
ShareApiEnum(String url, String label) {
this.url = url;
this.label = label;
}
/**
* 获取指定值得枚举对象
*
* @param url 枚举值
* @return 未找到匹配值则返回{@code null}
*/
public static ShareApiEnum ofValue(String url) {
ShareApiEnum result = null;
for (ShareApiEnum item : values()) {
if (item.url.equals(url)) {
result = item;
break;
}
}
return result;
}
/**
* 转List
*
* @return
*/
public static List<Map<String, Object>> toList() {
List<Map<String, Object>> list = new ArrayList<>();
for (ShareApiEnum item : ShareApiEnum.values()) {
Map<String, Object> obj = new HashMap<>();
obj.put("url", item.getUrl());
obj.put("label", item.getLabel());
list.add(obj);
}
return list;
}
}
package com.zq.spiderflow.constant;
import lombok.Getter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
public enum ShareStatusEnum {
/**
* 未注册
*/
NOT_REGISTERED(1, "未注册"),
/**
* 已注册
*/
REGISTERED(2, "已注册"),
/**
* 已撤销
*/
REVOKED(3, "已撤销"),
;
private final Integer value;
private final String label;
ShareStatusEnum(Integer value, String label) {
this.value = value;
this.label = label;
}
/**
* 获取指定值得枚举对象
*
* @param value 枚举值
* @return 未找到匹配值则返回{@code null}
*/
public static ShareStatusEnum ofValue(int value) {
ShareStatusEnum result = null;
for (ShareStatusEnum item : values()) {
if (item.value == value) {
result = item;
break;
}
}
return result;
}
/**
* 转List
*
* @return
*/
public static List<Map<String, Object>> toList() {
List<Map<String, Object>> list = new ArrayList<>();
for (ShareStatusEnum item : ShareStatusEnum.values()) {
Map<String, Object> obj = new HashMap<>();
obj.put("value", item.getValue());
obj.put("label", item.getLabel());
list.add(obj);
}
return list;
}
}
package com.zq.spiderflow.controller;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.spiderflow.entity.DataCategory;
import com.zq.spiderflow.service.CategoryService;
import com.zq.spiderflow.vo.DataCategoryFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "资源目录相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/spiderflow/category")
public class CategoryController {
private final CategoryService categoryService;
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓目录↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("获取目录列表")
@PostMapping(value = "/getCategoryList")
public ResultVo<PageVo<DataCategory>> getCategoryList(@RequestBody DataCategoryFindVo vo) {
vo.setState(1);
return ResultVo.success(categoryService.getCategoryList(vo));
}
@ApiOperation("获取全部目录列表")
@PostMapping(value = "/getAllCategoryList")
public ResultVo<List<DataCategory>> getAllCategoryList(@RequestBody DataCategoryFindVo vo) {
vo.setState(1);
return ResultVo.success(categoryService.getAllCategoryList(vo));
}
@ApiOperation("获取目录信息")
@PostMapping(value = "/getCategoryInfo/{categoryId}")
public ResultVo getCategoryInfo(@PathVariable String categoryId) {
AssertUtils.hasText(categoryId, "ID不能为空");
return ResultVo.success(categoryService.getCategoryInfo(categoryId));
}
@ApiOperation("添加目录")
@PostMapping(value = "/addCategory")
public ResultVo addCategory(@RequestBody DataCategory vo) {
AssertUtils.hasText(vo.getGroupId(), "缺少分组ID");
AssertUtils.hasText(vo.getCataTitle(), "缺少目录名称");
AssertUtils.hasText(vo.getDeptId(), "缺少目录提供部门ID");
AssertUtils.hasText(vo.getResourceFormat(), "缺少息资源格式分类");
AssertUtils.notNull(vo.getPublishedTime(), "缺少发布时间");
AssertUtils.notNull(vo.getSharedType(), "缺少共享类型");
AssertUtils.hasText(vo.getSharedCondition(), "缺少共享条件");
AssertUtils.hasText(vo.getSharedWay(), "缺少共享方式");
AssertUtils.notNull(vo.getOpenType(), "缺少开放类型");
AssertUtils.hasText(vo.getUpdateCycle(), "缺少更新周期");
AssertUtils.hasText(vo.getBelongField(), "缺少所属领域");
AssertUtils.hasText(vo.getHierarchyValue(), "缺少层级属性");
AssertUtils.hasText(vo.getOpenField(), "缺少开放领域");
AssertUtils.hasText(vo.getIsPublishBasicInfo(), "缺少可发布目录");
categoryService.addCategory(vo);
return ResultVo.success();
}
@ApiOperation("修改目录")
@PostMapping(value = "/modifyCategory")
public ResultVo modifyCategory(@RequestBody DataCategory vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryService.modifyCategory(vo);
return ResultVo.success();
}
}
package com.zq.spiderflow.controller;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.spiderflow.entity.DataCategoryGroup;
import com.zq.spiderflow.service.CategoryService;
import com.zq.spiderflow.vo.DataCategoryGroupFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "资源目录分组相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/spiderflow/category/group")
public class CategoryGroupController {
private final CategoryService categoryService;
@ApiOperation("获取目录分组列表")
@PostMapping(value = "/getCategoryGroupList")
public ResultVo<PageVo<DataCategoryGroup>> getCategoryGroupList(@RequestBody DataCategoryGroupFindVo vo) {
vo.setState(1);
return ResultVo.success(categoryService.getCategoryGroupList(vo));
}
@ApiOperation("获取目录分类信息")
@PostMapping(value = "/getCategoryGroupInfo/{categoryGroupId}")
public ResultVo<DataCategoryGroup> getCategoryGroupInfo(@PathVariable String categoryGroupId) {
AssertUtils.hasText(categoryGroupId, "ID不能为空");
return ResultVo.success(categoryService.getCategoryGroupInfo(categoryGroupId));
}
@ApiOperation("添加目录分类")
@PostMapping(value = "/addCategoryGroup")
public ResultVo addCategoryGroup(@RequestBody DataCategoryGroup vo) {
AssertUtils.hasText(vo.getGroupName(), "缺少目录分组名称");
categoryService.addCategoryGroupGroup(vo);
return ResultVo.success();
}
@ApiOperation("修改目录分类")
@PostMapping(value = "/modifyCategoryGroup")
public ResultVo modifyCategoryGroup(@RequestBody DataCategoryGroup vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryService.modifyCategoryGroup(vo);
return ResultVo.success();
}
@ApiOperation("获取目录类型树形数据")
@GetMapping(value = "/getCategoryGroupTree")
public ResultVo getCategoryGroupTree() {
return ResultVo.success(categoryService.getCategoryGroupTree());
}
}
package com.zq.spiderflow.controller;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.KeywordFindVo;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.spiderflow.entity.CategoryInterface;
import com.zq.spiderflow.entity.InterfaceAttach;
import com.zq.spiderflow.service.CategoryInterfaceService;
import com.zq.spiderflow.vo.CategoryInterfaceFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "接口资源相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/spiderflow/interface")
public class CategoryInterfaceController {
private final CategoryInterfaceService categoryInterfaceService;
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓接口资源↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("接口资源列表")
@PostMapping(value = "/getCategoryInterfaceList")
public ResultVo<PageVo<CategoryInterface>> getCategoryInterfaceList(@RequestBody CategoryInterfaceFindVo vo) {
return ResultVo.success(categoryInterfaceService.getCategoryInterfaceList(vo));
}
@ApiOperation("获取接口资源信息")
@PostMapping(value = "/getCategoryInterfaceInfo/{interfaceId}")
public ResultVo<CategoryInterface> getCategoryInterfaceInfo(@PathVariable String interfaceId) {
return ResultVo.success(categoryInterfaceService.getCategoryInterfaceInfo(interfaceId));
}
@ApiOperation("删除接口资源")
@DeleteMapping(value = "/deleteCategoryInterfaceInfo/{interfaceId}")
public ResultVo deleteCategoryInterfaceInfo(@PathVariable String interfaceId) {
categoryInterfaceService.deleteCategoryInterfaceInfo(interfaceId);
return ResultVo.success();
}
@ApiOperation("添加接口资源")
@PostMapping(value = "/addCategoryInterface")
public ResultVo addCategoryInterface(@RequestBody CategoryInterface vo) {
AssertUtils.hasText(vo.getCnName(), "缺少中文名");
AssertUtils.hasText(vo.getEnName(), "缺少英文名");
AssertUtils.hasText(vo.getServiceDesc(), "缺少服务描述");
AssertUtils.notNull(vo.getServiceType(), "缺少协议类型");
AssertUtils.notNull(vo.getMethodType(), "缺少方法类型");
AssertUtils.notNull(vo.getResponseType(), "缺少响应类型");
AssertUtils.notEmpty(vo.getAttachList(), "缺少附件说明");
categoryInterfaceService.addCategoryInterface(vo);
return ResultVo.success();
}
@ApiOperation("修改接口资源")
@PostMapping(value = "/modifyCategoryInterface")
public ResultVo modifyCategoryInterface(@RequestBody CategoryInterface vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryInterfaceService.modifyCategoryInterface(vo);
return ResultVo.success();
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓接口资源附件↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("接口资源附件列表")
@PostMapping(value = "/getInterfaceAttachList")
public ResultVo<PageVo<InterfaceAttach>> getInterfaceAttachList(@RequestBody KeywordFindVo vo) {
return ResultVo.success(categoryInterfaceService.getInterfaceAttachList(vo));
}
@ApiOperation("获取接口资源附件信息")
@PostMapping(value = "/getInterfaceAttachInfo/{id}")
public ResultVo<InterfaceAttach> getInterfaceAttachInfo(@PathVariable String id) {
return ResultVo.success(categoryInterfaceService.getInterfaceAttachInfo(id));
}
@ApiOperation("添加接口资源附件")
@PostMapping(value = "/addInterfaceAttach")
public ResultVo addInterfaceAttach(@RequestBody InterfaceAttach vo) {
AssertUtils.hasText(vo.getFilename(), "缺少文件名");
AssertUtils.hasText(vo.getFileContent(), "缺少文件内容");
categoryInterfaceService.addInterfaceAttach(vo);
return ResultVo.success();
}
@ApiOperation("修改接口资源附件")
@PostMapping(value = "/modifyInterfaceAttach")
public ResultVo modifyInterfaceAttach(@RequestBody InterfaceAttach vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryInterfaceService.modifyInterfaceAttach(vo);
return ResultVo.success();
}
}
......@@ -91,7 +91,7 @@ public class MetaDataCategoryController {
// }
/**
* 新增元数据类别
* 新增元数据目录
* @param metaDataCategory
* @return
*/
......@@ -99,7 +99,7 @@ public class MetaDataCategoryController {
public ResultVo add(@RequestBody MetaDataCategory metaDataCategory) {
AssertUtils.notNull(metaDataCategory.getCategoryName(), "缺少类别目录名称");
AssertUtils.notNull(metaDataCategory.getStandardLevel(), "缺少类别目录级别");
// AssertUtils.notNull(metaDataCategory.getCategoryCode(), "缺少类别目录编码");
AssertUtils.notNull(metaDataCategory.getCategoryCode(), "缺少类别目录编码");
// 根据CategoryCode查询是否存在记录
MetaDataCategory parent = metaDataCategoryService.getOne(new LambdaQueryWrapper<MetaDataCategory>()
.eq(MetaDataCategory::getId, metaDataCategory.getCategoryCode()));
......
package com.zq.spiderflow.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.spiderflow.entity.CategoryInterface;
import org.springframework.stereotype.Repository;
/**
* 资源目录-接口资源表(CategoryInterface)表数据库访问层
*
* @author makejava
* @since 2021-08-31 15:23:34
*/
@Repository
public interface CategoryInterfaceDao extends BaseMapper<CategoryInterface> {
}
package com.zq.spiderflow.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.spiderflow.entity.DataCategory;
import org.springframework.stereotype.Repository;
/**
* 资源目录管理表(DataCategory)表数据库访问层
*
* @author makejava
* @since 2021-08-31 15:23:37
*/
@Repository
public interface DataCategoryDao extends BaseMapper<DataCategory> {
}
package com.zq.spiderflow.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.spiderflow.entity.DataCategoryGroup;
import org.springframework.stereotype.Repository;
/**
* 资源目录分类(DataCategoryGroup)表数据库访问层
*
* @author makejava
* @since 2021-08-31 15:23:38
*/
@Repository
public interface DataCategoryGroupDao extends BaseMapper<DataCategoryGroup> {
}
package com.zq.spiderflow.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.spiderflow.entity.InterfaceAttach;
import org.springframework.stereotype.Repository;
/**
* 接口资源说明附件表(CategoryInterfaceAttach)表数据库访问层
*
* @author makejava
* @since 2021-08-31 15:23:34
*/
@Repository
public interface InterfaceAttachDao extends BaseMapper<InterfaceAttach> {
}
package com.zq.spiderflow.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 资源目录-接口资源表(CategoryInterface)实体类
*
* @author makejava
* @since 2021-08-31 15:23:34
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "CATEGORY_INTERFACE")
public class CategoryInterface {
/**
* ID
*/
@ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 服务中文名称
*/
@ApiModelProperty("服务中文名称")
private String cnName;
/**
* 服务英文名称
*/
@ApiModelProperty("服务英文名称")
private String enName;
/**
* 服务描述
*/
@ApiModelProperty("服务描述")
private String serviceDesc;
/**
* 目录ID
*/
@ApiModelProperty("目录ID")
private String categoryId;
/**
* 共享类型
*/
@ApiModelProperty("共享类型")
private Integer serviceshareType;
/**
* 服务的有效地址
*/
@ApiModelProperty("服务的有效地址")
private String url;
/**
* 协议类型: 0-RESTAPI; 1-WEBSERVICE
*/
@ApiModelProperty("协议类型: 0-RESTAPI; 1-WEBSERVICE")
private Integer serviceType;
/**
* 数据字典:方法类型
*/
@ApiModelProperty("数据字典:方法类型")
private Integer methodType;
/**
* 输入参数描述, 见表INPUTPARAMS_CONTENT
*/
@ApiModelProperty("输入参数描述, 见表INPUTPARAMS_CONTENT")
private String inputParams;
/**
* 返回参数描述, 见表OUTPUTPARAMS_CONTENT
*/
@ApiModelProperty("返回参数描述, 见表OUTPUTPARAMS_CONTENT")
private String outputParams;
/**
* 响应示例
*/
@ApiModelProperty("响应示例")
private String output;
/**
* 调用示例
*/
@ApiModelProperty("调用示例")
private String callExample;
/**
* 数据字典:响应类型
*/
@ApiModelProperty("数据字典:响应类型")
private String responseType;
/**
* 技术支持联系人
*/
@ApiModelProperty("技术支持联系人")
private String supporter;
/**
* 技术支持联系人手机
*/
@ApiModelProperty("技术支持联系人手机")
private String supporterPhone;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录名称")
@TableField(exist = false)
private String categoryName;
@ApiModelProperty("上传附件返回来的附件")
@TableField(exist = false)
private List<InterfaceAttach> attachList;
}
package com.zq.spiderflow.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 资源目录管理表(DataCategory)实体类
*
* @author makejava
* @since 2021-08-31 15:23:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "DATA_CATEGORY")
public class DataCategory {
/**
* ID
*/
@ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 目录分类ID
*/
@ApiModelProperty("目录分类ID")
private String groupId;
/**
* 信息资源目录名称
*/
@ApiModelProperty("信息资源目录名称")
private String cataTitle;
/**
* 资源目录提供方部门ID
*/
@ApiModelProperty("资源目录提供方部门ID")
private String deptId;
/**
* 信息资源摘要
*/
@ApiModelProperty("信息资源摘要")
private String description;
/**
* 数据字典:信息资源格式分类
*/
@ApiModelProperty("数据字典:信息资源格式分类")
private String resourceFormat;
/**
* 信息资源目录发布时间,格式为:YYYY-MM-DD HH:MM:SS
*/
@ApiModelProperty("信息资源目录发布时间,格式为: YYYY-MM-DD HH:MM:SS")
private Date publishedTime;
/**
* 数据字典:共享类型
*/
@ApiModelProperty("数据字典:共享类型")
private Integer sharedType;
/**
* 共享条件
*/
@ApiModelProperty("共享条件")
private String sharedCondition;
/**
* 数据字典:共享方式
*/
@ApiModelProperty("数据字典:共享方式")
private String sharedWay;
/**
* 向社会开放类型(数据字典:开放类型)
*/
@ApiModelProperty("向社会开放类型(数据字典:开放类型)")
private Integer openType;
/**
* 数据字典:更新周期
*/
@ApiModelProperty("数据字典:更新周期")
private String updateCycle;
/**
* 数据字典:所属领域
*/
@ApiModelProperty("数据字典:所属领域")
private String belongField;
/**
* 开放条件描述
*/
@ApiModelProperty("开放条件描述")
private String openConditionDesc;
/**
* 向社会开放条件(1:无条件开放;2:依申请开放)
*/
@ApiModelProperty("向社会开放条件(1:无条件开放;2:依申请开放)")
private Integer openCondition;
/**
* 不向社会开放理由依据
*/
@ApiModelProperty("不向社会开放理由依据")
private String useDemand;
/**
* 层级属性
*/
@ApiModelProperty("层级属性")
private String hierarchyValue;
/**
* 见数据字典 开放领域
*/
@ApiModelProperty("见数据字典 开放领域")
private String openField;
/**
* 可发布目录:1应发布目录:0(应发布目录的发布状态为未提交,可发布目录状态为发布)
*/
@ApiModelProperty("可发布目录:1 应发布目录:0(应发布目录的发布状态为未提交,可发布目录状态为发布)")
private String isPublishBasicInfo;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录分类名称")
@TableField(exist = false)
private String groupName;
@ApiModelProperty("目录分类授权部门名称")
@TableField(exist = false)
private String deptName;
@ApiModelProperty("上传附件返回来的附件")
@TableField(exist = false)
private List<InterfaceAttach> attachList;
}
package com.zq.spiderflow.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 资源目录分类(DataCategoryGroup)实体类
*
* @author makejava
* @since 2021-08-31 15:23:39
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "DATA_CATEGORY_GROUP")
public class DataCategoryGroup {
/**
* id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 目录分类名称
*/
@ApiModelProperty("目录分类名称")
private String groupName;
/**
* 父目录分类编码
*/
@ApiModelProperty("父目录分类编码")
private String parentId;
// /**
// * 目录分类授权部门的ID
// */
// @ApiModelProperty("目录分类授权部门的ID")
// private String deptId;
/**
* 目录分类描述
*/
@ApiModelProperty("目录分类描述")
private String remark;
/**
* 目录分类排序编号
*/
@ApiModelProperty("目录分类排序编号")
private Integer orderNum;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("父目录分类名称")
@TableField(exist = false)
private String parentName;
@ApiModelProperty("目录分类授权部门名称")
@TableField(exist = false)
private String deptName;
@ApiModelProperty("上传附件返回来的附件")
@TableField(exist = false)
private List<InterfaceAttach> attachList;
}
package com.zq.spiderflow.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 接口资源说明附件表(CategoryInterfaceAttach)实体类
*
* @author makejava
* @since 2021-08-31 15:23:34
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "INTERFACE_ATTACH")
public class InterfaceAttach {
/**
* ID
*/
@ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 业务ID
*/
@ApiModelProperty("业务ID")
private String businessId;
/**
* 文件名称带上后缀
*/
@ApiModelProperty("文件名称带上后缀")
private String filename;
/**
* 附件二进制内容(文件类型为:JPG,GIF,PNG,TXT,DOC,DOCX,PDF,XLS,XLSX;文件大小最大10M)
*/
@ApiModelProperty("附件二进制内容(文件类型为:JPG,GIF,PNG,TXT,DOC,DOCX,PDF,XLS,XLSX;文件大小最大10M)")
private String fileContent;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
}
package com.zq.spiderflow.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.KeywordFindVo;
import com.zq.common.vo.PageVo;
import com.zq.spiderflow.constant.ShareApiEnum;
import com.zq.spiderflow.dao.CategoryInterfaceDao;
import com.zq.spiderflow.dao.DataCategoryDao;
import com.zq.spiderflow.dao.InterfaceAttachDao;
import com.zq.spiderflow.entity.CategoryInterface;
import com.zq.spiderflow.entity.DataCategory;
import com.zq.spiderflow.entity.InterfaceAttach;
import com.zq.spiderflow.util.ShareApiUtils;
import com.zq.spiderflow.vo.CategoryInterfaceFindVo;
import com.zq.spiderflow.vo.ShareApiResponse;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author wilmiam
* @since 2021/9/6 17:36
*/
@Service
@RequiredArgsConstructor
public class CategoryInterfaceService {
private final CategoryInterfaceDao categoryInterfaceDao;
private final InterfaceAttachDao interfaceAttachDao;
private final DataCategoryDao dataCategoryDao;
// private final OrgDeptDao orgDeptDao;
public PageVo<CategoryInterface> getCategoryInterfaceList(CategoryInterfaceFindVo vo) {
LambdaQueryWrapper<CategoryInterface> lambdaQuery = Wrappers.lambdaQuery(CategoryInterface.class);
if (StringUtils.isNotBlank(vo.getCnName())) {
lambdaQuery.like(CategoryInterface::getCnName, vo.getCnName());
vo.setCnName(null);
}
if (StringUtils.isNotBlank(vo.getEnName())) {
lambdaQuery.like(CategoryInterface::getEnName, vo.getEnName());
vo.setEnName(null);
}
if (StringUtils.isNotBlank(vo.getSupporter())) {
lambdaQuery.like(CategoryInterface::getSupporter, vo.getSupporter());
vo.setSupporter(null);
}
if (StringUtils.isNotBlank(vo.getSupporterPhone())) {
lambdaQuery.like(CategoryInterface::getSupporterPhone, vo.getSupporterPhone());
vo.setSupporterPhone(null);
}
PageVo<CategoryInterface> paging = PagingUtils.paging(vo, categoryInterfaceDao, lambdaQuery,CategoryInterface.class);
paging.getRows().forEach(categoryInterface -> {
DataCategory dataCategory = dataCategoryDao.selectById(categoryInterface.getCategoryId());
categoryInterface.setCategoryName(dataCategory.getCataTitle());
});
return paging;
}
public CategoryInterface getCategoryInterfaceInfo(String interfaceId) {
CategoryInterface categoryInterface = categoryInterfaceDao.selectById(interfaceId);
List<InterfaceAttach> interfaceAttachList = interfaceAttachDao.selectList(Wrappers.lambdaQuery(InterfaceAttach.builder().businessId(categoryInterface.getId()).build()));
categoryInterface.setAttachList(interfaceAttachList);
return categoryInterface;
}
public void addCategoryInterface(CategoryInterface vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
categoryInterfaceDao.insert(vo);
if (CollUtil.isNotEmpty(vo.getAttachList())) {
vo.getAttachList().forEach(attach -> addInterfaceAttach(InterfaceAttach.builder().businessId(vo.getId()).filename(attach.getFilename()).fileContent(attach.getFileContent()).build()));
}
}
public void modifyCategoryInterface(CategoryInterface vo) {
CategoryInterface categoryInterface = categoryInterfaceDao.selectById(vo.getId());
AssertUtils.notNull(categoryInterface, "无此接口");
categoryInterface.setCategoryId(vo.getCategoryId());
categoryInterface.setCnName(vo.getCnName());
categoryInterface.setEnName(vo.getEnName());
categoryInterface.setServiceDesc(vo.getServiceDesc());
categoryInterface.setServiceshareType(vo.getServiceshareType());
categoryInterface.setUrl(vo.getUrl());
categoryInterface.setServiceType(vo.getServiceType());
categoryInterface.setMethodType(vo.getMethodType());
categoryInterface.setInputParams(vo.getInputParams());
categoryInterface.setOutputParams(vo.getOutputParams());
categoryInterface.setOutput(vo.getOutput());
categoryInterface.setCallExample(vo.getCallExample());
categoryInterface.setResponseType(vo.getResponseType());
categoryInterface.setSupporter(vo.getSupporter());
categoryInterface.setSupporterPhone(vo.getSupporterPhone());
categoryInterface.setUpdateTime(DateUtil.date());
categoryInterfaceDao.updateById(categoryInterface);
if (CollUtil.isNotEmpty(vo.getAttachList())) {
addOrUpdateAttach(vo.getAttachList(), vo.getId());
}
}
public List<Map<String, String>> getAttach(String businessId) {
List<InterfaceAttach> interfaceAttachList = interfaceAttachDao.selectList(Wrappers.lambdaQuery(InterfaceAttach.builder().businessId(businessId).build()));
List<Map<String, String>> attachList = new ArrayList<>();
for (InterfaceAttach interfaceAttach : interfaceAttachList) {
if (StringUtils.isBlank(interfaceAttach.getCascadeguid())) {
// 共享接口附件
HashMap<String, Object> attachParams = new HashMap<>();
attachParams.put("filename", interfaceAttach.getFilename());
attachParams.put("filecontent", interfaceAttach.getFileContent());
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(attachParams, ShareApiEnum.FILE_UPLOAD);
if (shareApiResponse.isSuccess()) {
interfaceAttach.setCascadeguid(shareApiResponse.getString("cascadeguid"));
interfaceAttach.setUpdateTime(DateUtil.date());
interfaceAttachDao.updateById(interfaceAttach);
}
}
HashMap<String, String> attach = new HashMap<>();
attach.put("fileid", interfaceAttach.getCascadeguid());
attach.put("filename", interfaceAttach.getFilename());
attachList.add(attach);
}
return attachList;
}
public PageVo<InterfaceAttach> getInterfaceAttachList(KeywordFindVo vo) {
LambdaQueryWrapper<InterfaceAttach> lambdaQuery = Wrappers.lambdaQuery(InterfaceAttach.builder().businessId(vo.getAssocId()).build());
if (StringUtils.isNotBlank(vo.getKeyword())) {
lambdaQuery.like(InterfaceAttach::getFilename, vo.getKeyword());
}
PageVo<InterfaceAttach> paging = PagingUtils.paging(vo, interfaceAttachDao, lambdaQuery);
return paging;
}
public InterfaceAttach getInterfaceAttachInfo(String interfaceAttachId) {
return interfaceAttachDao.selectById(interfaceAttachId);
}
public void addOrUpdateAttach(List<InterfaceAttach> attachList, String businessId) {
if (CollUtil.isNotEmpty(attachList)) {
interfaceAttachDao.delete(Wrappers.lambdaUpdate(InterfaceAttach.builder().businessId(businessId).build()));
attachList.forEach(attach -> {
attach.setBusinessId(businessId);
addInterfaceAttach(attach);
});
}
}
public void addInterfaceAttach(InterfaceAttach vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
interfaceAttachDao.insert(vo);
}
public void modifyInterfaceAttach(InterfaceAttach vo) {
InterfaceAttach interfaceAttach = interfaceAttachDao.selectById(vo.getId());
AssertUtils.notNull(interfaceAttach, "无此附件");
interfaceAttach.setBusinessId(vo.getBusinessId());
interfaceAttach.setFilename(vo.getFilename());
interfaceAttach.setFileContent(vo.getFileContent());
interfaceAttach.setUpdateTime(DateUtil.date());
interfaceAttachDao.updateById(interfaceAttach);
}
public void deleteCategoryInterfaceInfo(String interfaceId) {
cancelCategoryInterface(CollUtil.newHashSet(interfaceId), "删除接口");
categoryInterfaceDao.deleteById(interfaceId);
interfaceAttachDao.delete(Wrappers.lambdaUpdate(InterfaceAttach.builder().businessId(interfaceId).build()));
}
public void cancelCategoryInterface(Set<String> ids, String note) {
for (String id : ids) {
CategoryInterface categoryInterface = categoryInterfaceDao.selectById(id);
if (categoryInterface != null && StringUtils.isNotBlank(categoryInterface.getCascadeguid())) {
Map<String, Object> params = new HashMap<>();
params.put("service_id", categoryInterface.getCascadeguid());
params.put("note", note);
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.SERVICE_CANCEL);
if (shareApiResponse.isSuccess()) {
categoryInterface.setCascadeguid("");
categoryInterface.setUpdateTime(DateUtil.date());
categoryInterfaceDao.updateById(categoryInterface);
List<InterfaceAttach> interfaceAttachList = interfaceAttachDao.selectList(Wrappers.lambdaQuery(InterfaceAttach.builder().businessId(categoryInterface.getId()).build()));
interfaceAttachList.forEach(interfaceAttach -> {
interfaceAttach.setCascadeguid("");
interfaceAttach.setUpdateTime(DateUtil.date());
interfaceAttachDao.updateById(interfaceAttach);
});
}
}
}
}
}
package com.zq.spiderflow.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.spiderflow.constant.ShareApiEnum;
import com.zq.spiderflow.dao.DataCategoryDao;
import com.zq.spiderflow.dao.DataCategoryGroupDao;
import com.zq.spiderflow.dao.InterfaceAttachDao;
import com.zq.spiderflow.entity.DataCategory;
import com.zq.spiderflow.entity.DataCategoryGroup;
import com.zq.spiderflow.entity.InterfaceAttach;
import com.zq.spiderflow.util.ShareApiUtils;
import com.zq.spiderflow.util.TreeUtils;
import com.zq.spiderflow.vo.DataCategoryFindVo;
import com.zq.spiderflow.vo.DataCategoryGroupFindVo;
import com.zq.spiderflow.vo.DataTreeVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author wilmiam
* @since 2021/8/19 16:47
*/
@Service
@RequiredArgsConstructor
public class CategoryService {
private final DataCategoryDao dataCategoryDao;
private final DataCategoryGroupDao dataCategoryGroupDao;
// private final OrgDeptDao orgDeptDao;
// private final DbInfoDao dbInfoDao;
// private final StandardDataMappingDao standardDataMappingDao;
// private final ShareApiConfig shareApiConfig;
// private final CategoryInterfaceService categoryInterfaceService;
private final InterfaceAttachDao interfaceAttachDao;
public PageVo<DataCategory> getCategoryList(DataCategoryFindVo vo) {
LambdaQueryWrapper<DataCategory> lambdaQuery = Wrappers.lambdaQuery(DataCategory.class);
if (StringUtils.isNotBlank(vo.getCataTitle())) {
lambdaQuery.like(DataCategory::getCataTitle, vo.getCataTitle());
vo.setCataTitle(null);
}
PageVo<DataCategory> paging = PagingUtils.paging(vo, dataCategoryDao, lambdaQuery, DataCategory.class);
paging.getRows().forEach(dataCategory -> {
DataCategoryGroup dataCategoryGroup = dataCategoryGroupDao.selectById(dataCategory.getGroupId());
dataCategory.setGroupName(dataCategoryGroup.getGroupName());
// OrgDept orgDept = orgDeptDao.selectById(dataCategory.getDeptId());
// dataCategory.setDeptName(orgDept.getDeptName());
});
return paging;
}
public List<DataCategory> getAllCategoryList(DataCategoryFindVo vo) {
LambdaQueryWrapper<DataCategory> lambdaQuery = Wrappers.lambdaQuery(DataCategory.class);
if (StringUtils.isNotBlank(vo.getCataTitle())) {
lambdaQuery.like(DataCategory::getCataTitle, vo.getCataTitle());
vo.setCataTitle(null);
}
DataCategory dataCategory = BeanUtil.copyProperties(vo, DataCategory.class);
lambdaQuery.setEntity(dataCategory);
return dataCategoryDao.selectList(lambdaQuery);
}
public DataCategoryGroup getCategoryGroupInfo(String categoryGroupId) {
DataCategoryGroup dataCategoryGroup = dataCategoryGroupDao.selectById(categoryGroupId);
if (StringUtils.isNotBlank(dataCategoryGroup.getParentId())) {
DataCategoryGroup parentCategoryGroup = dataCategoryGroupDao.selectById(dataCategoryGroup.getParentId());
dataCategoryGroup.setParentName(parentCategoryGroup.getGroupName());
}
return dataCategoryGroup;
}
public void addCategory(DataCategory vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
dataCategoryDao.insert(vo);
}
public Object getCategoryInfo(String categoryId) {
DataCategory dataCategory = dataCategoryDao.selectById(categoryId);
List<InterfaceAttach> interfaceAttachList = interfaceAttachDao.selectList(Wrappers.lambdaQuery(InterfaceAttach.builder().businessId(dataCategory.getId()).build()));
dataCategory.setAttachList(interfaceAttachList);
return dataCategory;
}
public void addCategoryGroupGroup(DataCategoryGroup vo) {
if (vo.getOrderNum() == null) {
vo.setOrderNum(0);
}
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
dataCategoryGroupDao.insert(vo);
}
public void modifyCategory(DataCategory vo) {
DataCategory dataCategory = dataCategoryDao.selectById(vo.getId());
AssertUtils.notNull(dataCategory, "无此目录");
dataCategory.setState(vo.getState());
dataCategory.setGroupId(vo.getGroupId());
dataCategory.setCataTitle(vo.getCataTitle());
dataCategory.setDeptId(vo.getDeptId());
dataCategory.setDescription(vo.getDescription());
dataCategory.setResourceFormat(vo.getResourceFormat());
dataCategory.setPublishedTime(vo.getPublishedTime());
dataCategory.setSharedType(vo.getSharedType());
dataCategory.setSharedCondition(vo.getSharedCondition());
dataCategory.setSharedWay(vo.getSharedWay());
dataCategory.setOpenType(vo.getOpenType());
dataCategory.setUpdateCycle(vo.getUpdateCycle());
dataCategory.setBelongField(vo.getBelongField());
dataCategory.setOpenConditionDesc(vo.getOpenConditionDesc());
dataCategory.setOpenCondition(vo.getOpenCondition());
dataCategory.setUseDemand(vo.getUseDemand());
dataCategory.setHierarchyValue(vo.getHierarchyValue());
dataCategory.setOpenField(vo.getOpenField());
dataCategory.setIsPublishBasicInfo(vo.getIsPublishBasicInfo());
dataCategory.setUpdateTime(DateUtil.date());
dataCategoryDao.updateById(dataCategory);
}
public void modifyCategoryGroup(DataCategoryGroup vo) {
DataCategoryGroup dataCategoryGroup = dataCategoryGroupDao.selectById(vo.getId());
AssertUtils.notNull(dataCategoryGroup, "无此目录分类");
if (StringUtils.isNotBlank(vo.getParentId())) {
updateParentId(dataCategoryGroup.getId(), dataCategoryGroup.getParentId(), vo.getParentId());
}
dataCategoryGroup.setState(vo.getState());
dataCategoryGroup.setParentId(vo.getParentId());
dataCategoryGroup.setGroupName(vo.getGroupName());
dataCategoryGroup.setRemark(vo.getRemark());
dataCategoryGroup.setOrderNum(vo.getOrderNum());
dataCategoryGroup.setUpdateTime(DateUtil.date());
dataCategoryGroupDao.updateById(dataCategoryGroup);
if (StringUtils.isNotBlank(dataCategoryGroup.getCascadeguid())) {
if (vo.getState() == null || vo.getState() == 1) {
Map<String, Object> params = new HashMap<>(6);
params.put("group_id", dataCategoryGroup.getCascadeguid());
params.put("group_name", dataCategoryGroup.getGroupName());
params.put("parent_id", dataCategoryGroup.getParentId());
params.put("remark", dataCategoryGroup.getRemark());
params.put("order_num", dataCategoryGroup.getOrderNum());
ShareApiUtils.doPost(params, ShareApiEnum.CATALOG_GROUP_MODIFY);
}
}
}
public void updateParentId(String id, String oldParentId, String newParentId) {
if (StringUtils.isNotBlank(newParentId)) {
DataCategoryGroup dataCategoryGroup = dataCategoryGroupDao.selectById(newParentId);
AssertUtils.notNull(dataCategoryGroup, "无此父级ID");
if (id.equals(dataCategoryGroup.getParentId())) {
dataCategoryGroupDao.update(null, Wrappers.lambdaUpdate(DataCategoryGroup.class)
.set(DataCategoryGroup::getParentId, oldParentId)
.set(DataCategoryGroup::getUpdateTime, DateUtil.date())
.eq(DataCategoryGroup::getId, dataCategoryGroup.getId()));
} else {
updateParentId(id, oldParentId, dataCategoryGroup.getParentId());
}
}
}
/**
* 获取信息项列表
*
* @return
*/
// public List<Map<String, Object>> getColumnList(String categoryId) {
// List<Map<String, Object>> itemList = new ArrayList<>();
//
// List<DbInfo> dbInfoList = dbInfoDao.selectList(Wrappers.lambdaQuery(DbInfo.builder().categoryId(categoryId).build()));
// dbInfoList.forEach(dbInfo -> {
// List<StandardDataMapping> standardDataMappingList = standardDataMappingDao.selectList(Wrappers.lambdaQuery(StandardDataMapping.builder().dbId(dbInfo.getId()).build()));
// standardDataMappingList.forEach(standardDataMapping -> {
// List<StandardData> standardDataList = standardDataDao.selectList(Wrappers.lambdaQuery(StandardData.builder().mappingId(standardDataMapping.getId()).build()));
// standardDataList.forEach(standardData -> {
// Map<String, Object> dataItem = new HashMap<>();
// dataItem.put("columnid", standardData.getInfoItemId());
// dataItem.put("namecn", standardData.getStandardName());
// dataItem.put("dataformat", standardData.getStandardDataType());
// dataItem.put("length", standardData.getStandardDataLength());
// dataItem.put("precision", standardData.getFieldPrecision());
// dataItem.put("order_id", standardData.getOrderNum());
// dataItem.put("updatetime", standardData.getUpdateTime());
// itemList.add(dataItem);
// });
// });
// });
//
// return itemList;
// }
public PageVo<DataCategoryGroup> getCategoryGroupList(DataCategoryGroupFindVo vo) {
LambdaQueryWrapper<DataCategoryGroup> lambdaQuery = Wrappers.lambdaQuery(DataCategoryGroup.class);
if (StringUtils.isNotBlank(vo.getGroupName())) {
lambdaQuery.like(DataCategoryGroup::getGroupName, vo.getGroupName());
vo.setGroupName(null);
}
if (StringUtils.isNotBlank(vo.getRemark())) {
lambdaQuery.like(DataCategoryGroup::getRemark, vo.getRemark());
vo.setRemark(null);
}
PageVo<DataCategoryGroup> paging = PagingUtils.paging(vo, dataCategoryGroupDao, lambdaQuery, DataCategoryGroup.class);
paging.getRows().forEach(dataCategoryGroup -> {
// OrgDept orgDept = orgDeptDao.selectById(dataCategoryGroup.getDeptId());
// dataCategoryGroup.setDeptName(orgDept.getDeptName());
if (StringUtils.isNotBlank(dataCategoryGroup.getParentId())) {
DataCategoryGroup parentDataCategoryGroup = dataCategoryGroupDao.selectById(dataCategoryGroup.getParentId());
dataCategoryGroup.setParentName(parentDataCategoryGroup.getGroupName());
}
});
return paging;
}
public Object getCategoryGroupTree() {
List<DataCategoryGroup> categoryGroupList = dataCategoryGroupDao.selectList(null);
List<DataTreeVo> collect = categoryGroupList.stream().map(categoryGroup -> DataTreeVo.builder()
.value(String.valueOf(categoryGroup.getId()))
.parentId(categoryGroup.getParentId())
.label(categoryGroup.getGroupName())
.build()).collect(Collectors.toList());
return TreeUtils.buildTree(collect, null);
}
}
......@@ -176,19 +176,19 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
public ResultVo addALLMetas(List<MetaDataVo> vos) {
MetaDataCategory metaDataCategory = new MetaDataCategory();
MetaDataCategory parent = metaDataCategoryService.getOne(new LambdaQueryWrapper<MetaDataCategory>()
.eq(MetaDataCategory::getId, vos.get(1).getCategoryId()));
if (parent != null) {
metaDataCategory.setCategoryCode(parent.getId());
// 更新其subCount字段为原来的值加一
parent.setSubCount(parent.getSubCount() + 1);
parent.setStandardLevel(Integer.valueOf(vos.get(1).getDataLevel()));
}
// 如果存在记录,获取其id,并设置为新记录的parentId
BeanUtil.copyProperties(parent, metaDataCategory);
metaDataCategory.setCategoryType(1);
metaDataCategory.setCategoryName(vos.get(1).getTableName());
metaDataCategoryService.save(metaDataCategory);
// MetaDataCategory parent = metaDataCategoryService.getOne(new LambdaQueryWrapper<MetaDataCategory>()
// .eq(MetaDataCategory::getId, vos.get(1).getCategoryId()));
// if (parent != null) {
// metaDataCategory.setCategoryCode(parent.getId());
// // 更新其subCount字段为原来的值加一
// parent.setSubCount(parent.getSubCount() + 1);
// parent.setStandardLevel(Integer.valueOf(vos.get(1).getDataLevel()));
// }
// // 如果存在记录,获取其id,并设置为新记录的parentId
// BeanUtil.copyProperties(parent, metaDataCategory);
// metaDataCategory.setCategoryType(1);
// metaDataCategory.setCategoryName(vos.get(1).getTableName());
// metaDataCategoryService.save(metaDataCategory);
MetaData builder = null;
for (MetaDataVo metaVo : vos) {
......@@ -201,7 +201,7 @@ public class MetaDataService extends ServiceImpl<MetaDataDao, MetaData> {
.englishName(metaVo.getEnglishName())
.dataLevel(metaVo.getDataLevel())
.notNull(metaVo.getNotNull())
.categoryId(metaDataCategory.getId())
.categoryId(metaVo.getCategoryId())
.mutiMetaFlag(metaVo.getMutiMetaFlag())
.mutiMetaExpress(metaVo.getMutiMetaExpress())
.createTime(DateUtil.date()).build();
......
package com.zq.spiderflow.util;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zq.common.config.redis.RedisUtils;
import com.zq.common.exception.BusinessException;
import com.zq.common.utils.AssertUtils;
import com.zq.spiderflow.configuration.ShareApiConfig;
import com.zq.spiderflow.constant.ShareApiEnum;
import com.zq.spiderflow.vo.ShareApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Slf4j
@Component
public class ShareApiUtils {
private static RedisUtils redisUtils;
private static ShareApiConfig shareApiConfig;
// public ShareApiUtils(RedisUtils redisUtils, ShareApiConfig shareApiConfig) {
// ShareApiUtils.redisUtils = redisUtils;
// ShareApiUtils.shareApiConfig = shareApiConfig;
// }
public static String getAuthorization() {
return getAuthorizationMap().get("Authorization");
}
/**
* 获取token
*/
public static Map<String, String> getAuthorizationMap() {
Map<String, String> headers = new HashMap<>(2);
headers.put("Content-Type", "application/json;charset=utf-8");
String token = redisUtils.getStr("shareApiAuthorization");
if (StringUtils.isNotBlank(token)) {
headers.put("Authorization", "Bearer " + token);
} else {
Map<String, String> params = new HashMap<>();
params.put("grant_type", "client_credentials");
params.put("Content-Type", "application/x-www-form-urlencoded");
params.put("client_id", shareApiConfig.getAppKey());
params.put("client_secret", shareApiConfig.getAppSecret());
log.debug("获取token-请求URL: {}", shareApiConfig.getTokenUrl());
log.debug("获取token-请求参数: {}", JSON.toJSONString(params));
String result = HttpRequest.post(shareApiConfig.getTokenUrl())
.formStr(params)
.execute()
.body();
log.debug("获取token响应: {}", result);
JSONObject jobj = JSON.parseObject(result);
JSONObject status = jobj.getJSONObject("status");
if (status != null) {
String code = status.getString("code");
if ("1".equals(code)) {
JSONObject custom = jobj.getJSONObject("custom");
token = jobj.getJSONObject("custom").getString("access_token");
headers.put("Authorization", "Bearer " + token);
redisUtils.setStr("shareApiAuthorization", token, custom.getLong("expires_in") - 10, TimeUnit.SECONDS);
}
}
}
if (StringUtils.isNotBlank(token)) {
return headers;
}
throw new BusinessException("获取access_token失败");
}
/**
* 发送post请求
*
* @param params
* @param apiEnum
* @return
*/
public static ShareApiResponse doPost(Map<String, Object> params, ShareApiEnum apiEnum) {
return doPost(params, apiEnum, true);
}
/**
* 发送post请求
*
* @param params
* @param apiEnum
* @param isTipError
* @return
*/
public static ShareApiResponse doPost(Map<String, Object> params, ShareApiEnum apiEnum, boolean isTipError) {
String body = JSON.toJSONString(params);
log.debug(apiEnum.getLabel() + "-请求URL: {}", shareApiConfig.getApiUrl() + apiEnum.getUrl());
log.debug(apiEnum.getLabel() + "-请求参数: {}", body);
String result = HttpRequest.post(shareApiConfig.getApiUrl() + apiEnum.getUrl())
.body(body)
.header("Content-Type", "application/json;charset=utf-8")
.header("Authorization", getAuthorization())
.execute()
.body();
log.debug(apiEnum.getLabel() + "-响应: {}", result);
ShareApiResponse shareApiResponse = JSON.parseObject(result, ShareApiResponse.class);
if (isTipError) {
AssertUtils.isTrue(shareApiResponse.isSuccess(), 5000, StringUtils.isNotBlank(shareApiResponse.getMessage()) ? shareApiResponse.getMessage() : shareApiResponse.getError());
}
return shareApiResponse;
}
}
package com.zq.spiderflow.util;
import com.zq.spiderflow.vo.DataTreeVo;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author wilmiam
* @since 2021/8/20 10:27
*/
public class TreeUtils {
public static List<DataTreeVo> buildTree(List<DataTreeVo> treeDataList, String topId) {
Set<String> ids = new HashSet<>();
List<DataTreeVo> treeList = new ArrayList<>();
for (DataTreeVo treeData : treeDataList) {
if (StringUtils.isNotBlank(topId)) {
if (topId.equals(treeData.getParentId())) {
treeList.add(treeData);
}
} else {
if (StringUtils.isBlank(treeData.getParentId())) {
treeList.add(treeData);
}
}
for (DataTreeVo it : treeDataList) {
if (treeData.getValue().equals(it.getParentId())) {
if (treeData.getChildren() == null) {
treeData.setChildren(new ArrayList<>());
}
treeData.getChildren().add(it);
treeData.setChildNum(treeData.getChildNum() + 1);
ids.add(it.getValue());
}
}
}
if (treeList.size() == 0) {
treeList = treeDataList.stream().filter(s -> !ids.contains(s.getValue())).collect(Collectors.toList());
}
return treeList;
}
}
package com.zq.spiderflow.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源目录-接口资源表(CategoryInterface)实体类
*
* @author makejava
* @since 2021-08-31 15:23:34
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategoryInterfaceFindVo extends PageReqVo {
/**
* ID
*/
@ApiModelProperty("ID")
private String id;
/**
* 服务中文名称
*/
@ApiModelProperty("服务中文名称")
private String cnName;
/**
* 服务英文名称
*/
@ApiModelProperty("服务英文名称")
private String enName;
/**
* 服务描述
*/
@ApiModelProperty("服务描述")
private String serviceDesc;
/**
* 目录ID
*/
@ApiModelProperty("目录ID")
private String categoryId;
/**
* 共享类型
*/
@ApiModelProperty("共享类型")
private Integer serviceshareType;
/**
* 服务的有效地址
*/
@ApiModelProperty("服务的有效地址")
private String url;
/**
* 协议类型: 0-RESTAPI; 1-WEBSERVICE
*/
@ApiModelProperty("协议类型: 0-RESTAPI; 1-WEBSERVICE")
private Integer serviceType;
/**
* 数据字典:方法类型
*/
@ApiModelProperty("数据字典:方法类型")
private Integer methodType;
/**
* 输入参数描述, 见表INPUTPARAMS_CONTENT
*/
@ApiModelProperty("输入参数描述, 见表INPUTPARAMS_CONTENT")
private String inputParams;
/**
* 返回参数描述, 见表OUTPUTPARAMS_CONTENT
*/
@ApiModelProperty("返回参数描述, 见表OUTPUTPARAMS_CONTENT")
private String outputParams;
/**
* 响应示例
*/
@ApiModelProperty("响应示例")
private String output;
/**
* 调用示例
*/
@ApiModelProperty("调用示例")
private String callExample;
/**
* 数据字典:响应类型
*/
@ApiModelProperty("数据字典:响应类型")
private String responseType;
/**
* 技术支持联系人
*/
@ApiModelProperty("技术支持联系人")
private String supporter;
/**
* 技术支持联系人手机
*/
@ApiModelProperty("技术支持联系人手机")
private String supporterPhone;
/**
* 接口说明文档
*/
@ApiModelProperty("接口说明文档")
private String attach;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
private String cascadeguid;
@ApiModelProperty("目录名称")
private String categoryName;
}
package com.zq.spiderflow.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源目录(DataCategory)实体类
*
* @author makejava
* @since 2021-08-19 11:28:34
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DataCategoryFindVo extends PageReqVo {
/**
* ID
*/
@ApiModelProperty("ID")
private String id;
/**
* 目录分类ID
*/
@ApiModelProperty("目录分类ID")
private String groupId;
/**
* 信息资源目录名称
*/
@ApiModelProperty("信息资源目录名称")
private String cataTitle;
/**
* 信息资源目录编码
*/
@ApiModelProperty("信息资源目录编码")
private String catacode;
/**
* 资源目录提供方部门ID
*/
@ApiModelProperty("资源目录提供方部门ID")
private String deptId;
/**
* 信息资源摘要
*/
@ApiModelProperty("信息资源摘要")
private String description;
/**
* 数据字典:信息资源格式分类
*/
@ApiModelProperty("数据字典:信息资源格式分类")
private String resourceFormat;
/**
* 信息项列表(这个通过跟库、文件、接口资源表关联获得)
*/
@ApiModelProperty("信息项列表(这个通过跟库、文件、接口资源表关联获得)")
private String columnList;
/**
* 信息资源目录发布时间,格式为:YYYY-MM-DD HH:MM:SS
*/
@ApiModelProperty("信息资源目录发布时间,格式为: YYYY-MM-DD HH:MM:SS")
private Date publishedTime;
/**
* 数据字典:共享类型
*/
@ApiModelProperty("数据字典:共享类型")
private Integer sharedType;
/**
* 共享条件
*/
@ApiModelProperty("共享条件")
private String sharedCondition;
/**
* 数据字典:共享方式
*/
@ApiModelProperty("数据字典:共享方式")
private String sharedWay;
/**
* 向社会开放类型(数据字典:开放类型)
*/
@ApiModelProperty("向社会开放类型(数据字典:开放类型)")
private Integer openType;
/**
* 数据字典:更新周期
*/
@ApiModelProperty("数据字典:更新周期")
private String updateCycle;
/**
* 数据字典:所属领域
*/
@ApiModelProperty("数据字典:所属领域")
private String belongField;
/**
* 开放条件描述
*/
@ApiModelProperty("开放条件描述")
private String openConditionDesc;
/**
* 向社会开放条件(1:无条件开放;2:依申请开放)
*/
@ApiModelProperty("向社会开放条件(1:无条件开放;2:依申请开放)")
private Integer openCondition;
/**
* 不向社会开放理由依据
*/
@ApiModelProperty("不向社会开放理由依据")
private String useDemand;
/**
* 层级属性
*/
@ApiModelProperty("层级属性")
private String hierarchyValue;
/**
* 不向社会开放理由依据附件, 见表ATTACH_LIST(通过跟上传表关联获得)
*/
@ApiModelProperty("不向社会开放理由依据附件, 见表ATTACH_LIST (通过跟上传表关联获得)")
private String attach;
/**
* 见数据字典 开放领域
*/
@ApiModelProperty("见数据字典 开放领域")
private String openField;
/**
* 可发布目录:1应发布目录:0(应发布目录的发布状态为未提交,可发布目录状态为发布)
*/
@ApiModelProperty("可发布目录:1 应发布目录:0(应发布目录的发布状态为未提交,可发布目录状态为发布)")
private String isPublishBasicInfo;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
private String cascadeguid;
@ApiModelProperty("目录分类名称")
private String groupName;
@ApiModelProperty("目录分类授权部门名称")
private String deptName;
}
package com.zq.spiderflow.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源目录分类(DataCategoryGroup)实体类
*
* @author makejava
* @since 2021-08-31 15:23:39
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DataCategoryGroupFindVo extends PageReqVo {
/**
* id
*/
private String id;
/**
* 目录分类名称
*/
@ApiModelProperty("目录分类名称")
private String groupName;
/**
* 父目录分类编码
*/
@ApiModelProperty("父目录分类编码")
private String parentId;
/**
* 目录分类授权部门的ID
*/
@ApiModelProperty("目录分类授权部门的ID")
private String deptId;
/**
* 目录分类描述
*/
@ApiModelProperty("目录分类描述")
private String remark;
/**
* 目录分类排序编号
*/
@ApiModelProperty("目录分类排序编号")
private Integer orderNum;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
private String cascadeguid;
@ApiModelProperty("父目录分类名称")
private String parentName;
@ApiModelProperty("目录分类授权部门名称")
private String deptName;
}
package com.zq.spiderflow.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author wilmiam
* @since 2021/8/19 15:23
*/
@ApiModel("树结构")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DataTreeVo {
private String value;
private String parentId;
private String label;
@Builder.Default
private Integer childNum = 0;
private List<DataTreeVo> children;
}
package com.zq.spiderflow.vo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
* @author wilmiam
* @since 2021-09-04 09:38
*/
@Slf4j
@Data
public class ShareApiResponse {
private String code;
private String data;
private String message;
private String error;
private String stackError;
public boolean isSuccess() {
return "1".equals(code);
}
public String getString(String key) {
JSONObject object = getJSONObject();
return object.getString(key);
}
public Integer getInteger(String key) {
JSONObject object = getJSONObject();
return object.getInteger(key);
}
public JSONArray getJSONArray() {
JSONArray jsonArray = null;
try {
jsonArray = JSON.parseArray(data);
} catch (Exception e) {
log.error("解析响应数据DATA失败: {}", e.getMessage());
log.error("DATA数据: {}", data);
}
return jsonArray == null ? new JSONArray() : jsonArray;
}
public JSONObject getJSONObject() {
JSONObject jsonObject = null;
try {
jsonObject = JSON.parseObject(data);
} catch (Exception e) {
log.error("解析响应数据DATA失败: {}", e.getMessage());
log.error("DATA数据: {}", data);
}
return jsonObject == null ? new JSONObject() : jsonObject;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment