Commit 93e63469 by renrui

[add]系统架构资产设计

1 parent d19dacc3
Showing with 1163 additions and 19 deletions
package org.arch.common.modules.archoverall.converter;
import org.arch.common.modules.archoverall.entity.ArchiViewDetails;
import org.arch.common.modules.archoverall.vo.ArchiViewDetailsVO;
import org.mapstruct.Mapper;
/**
* <p>
*
* </p>
*
* @author makejava
* @since 2023-12-25
*/
@Mapper(componentModel = "spring")
public interface ArchiViewDetailsCovert {
ArchiViewDetailsVO convertToVO(ArchiViewDetails archiViewDetails);
}
package org.arch.common.modules.archoverall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
/**
* <p>
* 架构视图详情-DTO
* </p>
*
* @author makejava
* @since 2023-12-25
*/
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "ArchiViewDetailsDTO对象", description = "架构视图详情")
@ToString
public class ArchiViewDetailsDTO extends BasePageEntity {
@ApiModelProperty(value = "视图主键")
private Long viewId;
@ApiModelProperty(value = "主键")
private Long viewDetailsId;
@ApiModelProperty(value = "画布信息")
private String metaModelData;
@ApiModelProperty(value = "画布缩略图")
private String metaModelSvg;
@ApiModelProperty(value = "版本")
private String version;
@ApiModelProperty(value = "字典状态 0:已停用 1:已发布 2:暂存")
private Integer state;
@ApiModelProperty(value = "解析结构类型 1:线状结构;2:包含结构")
private Integer structureType;
@ApiModelProperty(value = "图形ID")
private Long graphId;
@ApiModelProperty(value = "架构ID")
private Long archiId;
@ApiModelProperty(value = "系统ID")
private Long appId;
@ApiModelProperty(value = "项目ID")
private Long prjId;
@ApiModelProperty(value = "架构阶段(1:总体架构;2:系统架构 3:概设架构 4:其他架构)")
private Integer archiStage;
}
package org.arch.common.modules.archoverall.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.arch.common.BaseEntity;
/**
* <p>
* 架构视图详情
* </p>
*
* @author makejava
* @since 2023-12-25
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@TableName("archi_view_details")
@ApiModel(value = "ArchiViewDetails对象", description = "架构视图详情")
public class ArchiViewDetails extends BaseEntity {
@ApiModelProperty(value = "主键")
@TableId(value = "view_details_id", type = IdType.AUTO)
private Long viewDetailsId;
@ApiModelProperty(value = "主键")
private String viewDetailsCode;
@ApiModelProperty(value = "架构视图,关联Id")
private Long viewId;
@ApiModelProperty(value = "编码")
private String viewCode;
@ApiModelProperty(value = "版本")
private String version;
@ApiModelProperty(value = "字典状态 0:已停用 1:已发布 2:暂存")
private Integer state;
@ApiModelProperty(value = "画布信息")
@TableField(exist = false)
private String metaModelData;
@ApiModelProperty(value = "画布缩略图")
@TableField(exist = false)
private String metaModelSvg;
@ApiModelProperty(value = "图形ID")
private Long graphId;
@ApiModelProperty(value = "架构视图模板 ID")
private String viewTemplateId;
}
package org.arch.common.modules.archoverall.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 项目架构或系统架构-视图-关系表
*
* @author admin
* @date 2024/02/28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "archi_view_relation")
public class ViewPrjApp {
/**
* 项目和系统架构视图ID
*/
@TableField(value = "archi_vr_id")
private Long archiVpsId;
/**
* 架构视图详情ID
*/
@TableField(value = "archi_views_detail_id")
private Long archiViewsDetailId;
/**
* 系统 id
*/
@TableField(value = "app_id")
private Long appId;
/**
* 项目 id
*/
@TableField(value = "prj_id")
private Long prjId;
}
\ No newline at end of file
package org.arch.common.modules.archoverall.event;
import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;
import java.time.Clock;
/**
* 资产关系事件
*
* @author admin
* @date 2024/01/18
*/
@Getter
@Setter
public class AssertEvent extends ApplicationEvent {
public AssertEvent(Object source) {
super(source);
}
public AssertEvent(Object source, Clock clock) {
super(source, clock);
}
}
package org.arch.common.modules.archoverall.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@ApiModel(value = "ArchiViewDetailsVO对象", description = "架构视图详情")
public class ArchiViewDetailsVO {
@ApiModelProperty(value = "主键")
private Long viewDetailsId;
@ApiModelProperty(value = "画布信息")
private String metaModelData;
@ApiModelProperty(value = "画布缩略图")
private String metaModelSvg;
@ApiModelProperty(value = "版本")
private String version;
@ApiModelProperty(value = "字典状态 0:已停用 1:已发布 2:暂存")
private Integer state;
@ApiModelProperty("架构视图模板 ID")
private Long viewTemplateId;
}
package org.arch.common.modules.archoverall.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* Mx元素
*
* @author MxCell
* @date 2023/12/07
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "Mx元素")
@Data
public class ViewAMxCellVO extends MxCellVO {
@ApiModelProperty(value = "id")
private String id;
/**
* 元素类型
*/
@ApiModelProperty(value = "元素类型", position = 1)
private Object elementType;
/**
* 元素编码
*/
@ApiModelProperty(value = "元素编码", position = 2)
private Object elementEncoding;
/**
* 上游元素
*/
@ApiModelProperty(value = "上游元素", position = 3)
private Object upstreamElements;
/**
* 关系
*/
@ApiModelProperty(value = "关系", position = 4)
private Object relationship;
}
\ No newline at end of file
...@@ -36,14 +36,14 @@ public class AppInfoController { ...@@ -36,14 +36,14 @@ public class AppInfoController {
@ApiOperation(value = "分页查询", notes = "分页查询", httpMethod = "POST") @ApiOperation(value = "分页查询", notes = "分页查询", httpMethod = "POST")
@PostMapping(value = "/") @PostMapping(value = "/")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统信息管理-分页查询", moduleName = "系统信息管理") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "分页查询", moduleName = "系统信息管理")
public Result iPage(@RequestBody AppInfoDTO params) { public Result iPage(@RequestBody AppInfoDTO params) {
return Result.success(appInfoService.iPage(params, PageDTO.of(params.getCurrent(), params.getPageSize()))); return Result.success(appInfoService.iPage(params, PageDTO.of(params.getCurrent(), params.getPageSize())));
} }
@ApiOperation(value = "不分页查询", notes = "不分页查询", httpMethod = "POST") @ApiOperation(value = "不分页查询", notes = "不分页查询", httpMethod = "POST")
@PostMapping(value = "/appList") @PostMapping(value = "/appList")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统信息管理-查询系统信息管理数据", moduleName = "查询系统信息管理数据") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "查询系统信息管理数据", moduleName = "系统信息管理")
public Result appList(@RequestBody AppInfoDTO params) { public Result appList(@RequestBody AppInfoDTO params) {
return Result.success(appInfoService.appList(params)); return Result.success(appInfoService.appList(params));
} }
...@@ -51,27 +51,28 @@ public class AppInfoController { ...@@ -51,27 +51,28 @@ public class AppInfoController {
@ApiOperation(value = "新增", notes = "新增", httpMethod = "POST") @ApiOperation(value = "新增", notes = "新增", httpMethod = "POST")
@PostMapping(value = "/ad") @PostMapping(value = "/ad")
//@AutoLog(value = LogEventTypeEnum.INSERT, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.MIDDLE, description = "新增系统信息管理数据") //@AutoLog(value = LogEventTypeEnum.INSERT, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.MIDDLE, description = "新增系统信息管理数据")
@OperLog(value = LogOperTypeEnum.ADD, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "新增", moduleName = "系统信息管理")
public Result create(@RequestBody AppInfo params) { public Result create(@RequestBody AppInfo params) {
return Result.success(appInfoService.insert(params)); return Result.success(appInfoService.insert(params));
} }
@ApiOperation(value = "修改", notes = "修改", httpMethod = "POST") @ApiOperation(value = "修改", notes = "修改", httpMethod = "POST")
@PostMapping(value = "/upd") @PostMapping(value = "/upd")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统信息管理-修改系统信息管理数据", moduleName = "修改系统信息管理数据") @OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "修改系统信息管理数据", moduleName = "系统信息管理")
public Result update(@RequestBody AppInfo params) { public Result update(@RequestBody AppInfo params) {
return Result.success(appInfoService.update(params)); return Result.success(appInfoService.update(params));
} }
@ApiOperation("详情") @ApiOperation("详情")
@PostMapping(value = "/dApp") @PostMapping(value = "/dApp")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统信息管理-查询系统信息管理详情数据", moduleName = "查询系统信息管理详情数据") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "查询系统信息管理详情数据", moduleName = "系统信息管理")
public Result dApp(@RequestBody AppInfoDTO params) { public Result dApp(@RequestBody AppInfoDTO params) {
return Result.success(appInfoService.info(params)); return Result.success(appInfoService.info(params));
} }
@ApiOperation("删除") @ApiOperation("删除")
@PostMapping(value = "/rApp") @PostMapping(value = "/rApp")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统信息管理-删除", moduleName = "删除") @OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "删除", moduleName = "系统信息管理")
public Result delete(@RequestBody @Validated BatchRemoveDTO params) { public Result delete(@RequestBody @Validated BatchRemoveDTO params) {
boolean b = appInfoService.delBatch(params); boolean b = appInfoService.delBatch(params);
return b ? Result.success("删除成功") : Result.error("删除失败"); return b ? Result.success("删除成功") : Result.error("删除失败");
......
...@@ -34,14 +34,14 @@ public class ArchiAssetSysController { ...@@ -34,14 +34,14 @@ public class ArchiAssetSysController {
@ApiOperation("分页查询") @ApiOperation("分页查询")
@PostMapping(value = "/") @PostMapping(value = "/")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-分页查询", moduleName = "分页查询") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "分页查询", moduleName = "系统架构资产")
public Result iPage(@RequestBody ArchiAssetInfoDTO params) { public Result iPage(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.iPage(params)); return Result.success(archiAssetSysService.iPage(params));
} }
@ApiOperation("列表查询") @ApiOperation("列表查询")
@PostMapping(value = "/assetList") @PostMapping(value = "/assetList")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-列表查询", moduleName = "列表查询") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "列表查询", moduleName = "系统架构资产")
public Result assetList(@RequestBody ArchiAssetInfoDTO params) { public Result assetList(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.assetList(params)); return Result.success(archiAssetSysService.assetList(params));
...@@ -49,42 +49,42 @@ public class ArchiAssetSysController { ...@@ -49,42 +49,42 @@ public class ArchiAssetSysController {
@ApiOperation(value = "新增", notes = "新增", httpMethod = "POST") @ApiOperation(value = "新增", notes = "新增", httpMethod = "POST")
@PostMapping(value = "/ad") @PostMapping(value = "/ad")
@OperLog(value = LogOperTypeEnum.ADD, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-新增", moduleName = "新增") @OperLog(value = LogOperTypeEnum.ADD, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "新增", moduleName = "系统架构资产")
public Result create(@RequestBody ArchiAssetInfoDTO params) { public Result create(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.inster(params)); return Result.success(archiAssetSysService.inster(params));
} }
@ApiOperation(value = "修改", notes = "修改", httpMethod = "POST") @ApiOperation(value = "修改", notes = "修改", httpMethod = "POST")
@PostMapping(value = "/upd") @PostMapping(value = "/upd")
@OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-修改", moduleName = "修改") @OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "修改", moduleName = "系统架构资产")
public Result update(@RequestBody ArchiAssetInfoDTO params) { public Result update(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.update(params)); return Result.success(archiAssetSysService.update(params));
} }
@PostMapping(value = "/delBatch") @PostMapping(value = "/delBatch")
@ApiOperation(value = "批量删除", notes = "批量删除", httpMethod = "POST") @ApiOperation(value = "批量删除", notes = "批量删除", httpMethod = "POST")
@OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-批量删除", moduleName = "批量删除") @OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "批量删除", moduleName = "系统架构资产")
public Result delBatch(@RequestBody DelDTO requestMap) { public Result delBatch(@RequestBody DelDTO requestMap) {
return archiAssetSysService.delBatch(requestMap) ? Result.success("删除成功") : Result.error("删除失败"); return archiAssetSysService.delBatch(requestMap) ? Result.success("删除成功") : Result.error("删除失败");
} }
@ApiOperation(value = "继承", notes = "继承", httpMethod = "POST") @ApiOperation(value = "继承", notes = "继承", httpMethod = "POST")
@PostMapping(value = "/extend") @PostMapping(value = "/extend")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-继承", moduleName = "继承") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "继承", moduleName = "系统架构资产")
public Result extend(@RequestBody ArchiAssetInfoDTO params) { public Result extend(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.extend(params)); return Result.success(archiAssetSysService.extend(params));
} }
@ApiOperation(value = "维护资产要素", notes = "维护资产要素", httpMethod = "POST") @ApiOperation(value = "维护资产要素", notes = "维护资产要素", httpMethod = "POST")
@PostMapping(value = "/assetInfoLevel") @PostMapping(value = "/assetInfoLevel")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-维护资产要素", moduleName = "维护资产要素") @OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "维护资产要素", moduleName = "系统架构资产")
public Result assetInfoLevel(@RequestBody ArchiAssetInfoDTO params) { public Result assetInfoLevel(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.assetInfoLevel(params)); return Result.success(archiAssetSysService.assetInfoLevel(params));
} }
@ApiOperation("停用") @ApiOperation("停用")
@PostMapping(value = "/stop") @PostMapping(value = "/stop")
@OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "系统架构资产-停用", moduleName = "停用") @OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "停用", moduleName = "系统架构资产")
public Result stop(@RequestBody ArchiAssetInfoDTO params) { public Result stop(@RequestBody ArchiAssetInfoDTO params) {
return Result.success(archiAssetSysService.stop(params)); return Result.success(archiAssetSysService.stop(params));
} }
......
package org.arch.overall.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.arch.base.Result;
import org.arch.common.modules.archoverall.dto.ArchiViewDTO;
import org.arch.common.modules.archoverall.dto.ArchiViewDetailsDTO;
import org.arch.common.modules.base.dto.BathRemoveDTO;
import org.arch.log.annotation.OperLog;
import org.arch.log.logenum.LogOperTypeEnum;
import org.arch.log.logenum.LogTypeEnum;
import org.arch.overall.service.ArchiViewDetailsService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 架构视图详情
*
* @author admin
* @date 2024/02/28
*/
@Api(tags = {"架构视图详情"})
@RestController
@RequestMapping("archi-vw-detail")
@RequiredArgsConstructor
public class ArchiViewDetailController {
private final ArchiViewDetailsService archiViewDetailsService;
@ApiOperation(value = "分页列表")
@PostMapping(value = "/")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "分页列表", moduleName = "架构视图详情")
public Result gtArchiMetaModel(@RequestBody ArchiViewDetailsDTO dto) {
return Result.success(archiViewDetailsService.page(dto));
}
@ApiOperation(value = "新增")
@PostMapping(value = "/cViewDetail")
@OperLog(value = LogOperTypeEnum.ADD, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "新增", moduleName = "架构视图详情")
public Result create(@RequestBody @Validated ArchiViewDetailsDTO model) {
return Result.success(archiViewDetailsService.insert(model));
}
@ApiOperation(value = "详情")
@PostMapping(value = "/iViewDetail")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "详情", moduleName = "架构视图详情")
public Result info(@RequestBody @Validated ArchiViewDetailsDTO model) {
return Result.success(archiViewDetailsService.info(model));
}
@ApiOperation(value = "发布")
@PostMapping(value = "/uViewDetail")
//@Lock4j(keys = {"#model.viewDetailsId"})
//@AutoLog(value = LogEventTypeEnum.UPDATE, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.MIDDLE)
@OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "发布", moduleName = "架构视图详情")
public Result update(@RequestBody @Validated ArchiViewDetailsDTO model) {
return Result.success(archiViewDetailsService.update(model));
}
@ApiOperation(value = "更新画布")
@PostMapping(value = "/upMxGraph")
//@AutoLog(value = LogEventTypeEnum.UPDATE, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.MIDDLE)
@OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "更新画布", moduleName = "架构视图详情")
public Result updateMxGraph(@RequestBody ArchiViewDetailsDTO dto) {
return Result.success(archiViewDetailsService.updateMxGraphModel(dto));
}
@ApiOperation(value = "树形列表")
@PostMapping("/qViewTree")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "树形列表", moduleName = "架构视图详情")
public Result list(@RequestBody ArchiViewDTO model) {
return Result.success(archiViewDetailsService.treeList(model));
}
@ApiOperation(value = "结构化数据")
@PostMapping("/fdVd")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "结构化数据", moduleName = "架构视图详情")
public Result fdVd(@RequestBody ArchiViewDetailsDTO dto) {
return Result.success(archiViewDetailsService.getMxCellByViewDetailId(dto));
}
@ApiOperation(value = "结构化数据Tree")
@PostMapping("/fdBmdTree")
// @AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "结构化数据Tree", moduleName = "架构视图详情")
public Result getMxCellTreeByViewDetailId(@RequestBody ArchiViewDetailsDTO dto) {
return Result.success(archiViewDetailsService.getMxCellTreeByViewDetailId(dto));
}
@ApiOperation(value = "结构化数据Table")
@PostMapping("/fdBmdTable")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "结构化数据Table", moduleName = "架构视图详情")
public Result fdBmdTree(@RequestBody ArchiViewDetailsDTO dto) {
return Result.success(archiViewDetailsService.getDynamicTable(dto));
}
@ApiOperation(value = "删除")
@PostMapping(value = "/del")
//@AutoLog(value = LogEventTypeEnum.DELETE, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.HIGH)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "删除", moduleName = "架构视图详情")
public Result delete(@RequestBody @Validated BathRemoveDTO model) {
return archiViewDetailsService.del(model) ? Result.success("删除成功") : Result.error("删除失败");
}
}
...@@ -40,7 +40,7 @@ public class PrjInfoController { ...@@ -40,7 +40,7 @@ public class PrjInfoController {
@ApiOperation(DescContent.QUERY_LIST_PROJECTS) @ApiOperation(DescContent.QUERY_LIST_PROJECTS)
@PostMapping(value = "/") @PostMapping(value = "/")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目信息管理-查询列表", moduleName = "项目信息管理") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "查询列表", moduleName = "项目信息管理")
public Result iPage(@RequestBody PrjInfoDTO params) { public Result iPage(@RequestBody PrjInfoDTO params) {
IPage<PrjInfo> aPage = prjInfoService.iPage(params, PageDTO.of(params.getCurrent(), params.getPageSize())); IPage<PrjInfo> aPage = prjInfoService.iPage(params, PageDTO.of(params.getCurrent(), params.getPageSize()));
return Result.success(aPage); return Result.success(aPage);
...@@ -48,21 +48,21 @@ public class PrjInfoController { ...@@ -48,21 +48,21 @@ public class PrjInfoController {
@ApiOperation("新增") @ApiOperation("新增")
@PostMapping(value = "/ad") @PostMapping(value = "/ad")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目信息管理-新增项目信息管理", moduleName = "新增项目信息管理") @OperLog(value = LogOperTypeEnum.ADD, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "新增项目信息管理", moduleName = "项目信息管理")
public Result ad(@RequestBody @Validated PrjInfoDTO params) { public Result ad(@RequestBody @Validated PrjInfoDTO params) {
return Result.success(prjInfoService.insert(params)); return Result.success(prjInfoService.insert(params));
} }
@ApiOperation("修改") @ApiOperation("修改")
@PostMapping(value = "/upd") @PostMapping(value = "/upd")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目信息管理-修改项目信息管理", moduleName = "修改项目信息管理") @OperLog(value = LogOperTypeEnum.UPDATE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "修改项目信息管理", moduleName = "项目信息管理")
public Result upd(@RequestBody @Validated PrjInfoDTO params) { public Result upd(@RequestBody @Validated PrjInfoDTO params) {
return Result.success(prjInfoService.update(params)); return Result.success(prjInfoService.update(params));
} }
@ApiOperation(value = "不分页查询", notes = "不分页查询", httpMethod = "POST") @ApiOperation(value = "不分页查询", notes = "不分页查询", httpMethod = "POST")
@PostMapping(value = "/prjList") @PostMapping(value = "/prjList")
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目信息管理-不分页查询项目信息管理", moduleName = "不分页查询项目信息管理") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "不分页查询项目信息管理", moduleName = "项目信息管理")
public Result prjList(@RequestBody PrjInfoDTO params) { public Result prjList(@RequestBody PrjInfoDTO params) {
List<PrjInfo> prjList = prjInfoService.prjList(params); List<PrjInfo> prjList = prjInfoService.prjList(params);
return Result.success(prjList); return Result.success(prjList);
...@@ -70,14 +70,14 @@ public class PrjInfoController { ...@@ -70,14 +70,14 @@ public class PrjInfoController {
@ApiOperation("查询项目详情") @ApiOperation("查询项目详情")
@PostMapping(value = "/qryPrj") @PostMapping(value = "/qryPrj")
@OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目信息管理-查询项目详情", moduleName = "查询项目详情") @OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "查询项目详情", moduleName = "项目信息管理")
public Result qryPrj(@RequestBody PrjInfoDTO params) { public Result qryPrj(@RequestBody PrjInfoDTO params) {
return Result.success(prjInfoService.qryPrj(params)); return Result.success(prjInfoService.qryPrj(params));
} }
@ApiOperation("项目删除") @ApiOperation("项目删除")
@PostMapping(value = "/dPrj") @PostMapping(value = "/dPrj")
@OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目信息管理-项目删除", moduleName = "项目删除") @OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "项目删除", moduleName = "项目信息管理")
public Result delete(@RequestBody @Validated BatchRemoveDTO params) { public Result delete(@RequestBody @Validated BatchRemoveDTO params) {
boolean b = prjInfoService.delBatch(params); boolean b = prjInfoService.delBatch(params);
return b ? Result.success("删除成功") : Result.error("删除失败"); return b ? Result.success("删除成功") : Result.error("删除失败");
......
package org.arch.overall.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.arch.common.modules.archoverall.dto.ArchiViewDTO;
import org.arch.common.modules.archoverall.dto.ArchiViewDetailsDTO;
import org.arch.common.modules.archoverall.entity.ArchiViewDetails;
import org.arch.common.modules.archoverall.vo.ArchiViewDetailsVO;
import org.arch.common.modules.archoverall.vo.ArchiViewVO;
import java.util.List;
/**
* <p>
* 架构视图详情 Mapper 接口
* </p>
*
* @author makejava
* @since 2023-12-25
*/
public interface ArchiViewDetailsMapper extends MPJBaseMapper<ArchiViewDetails> {
/**
* 分页列表
*
* @param dto 参数
* @return {@link Page}<{@link ArchiViewDetailsDTO}>
*/
IPage<ArchiViewDetails> page(Page<ArchiViewDetails> page, @Param("dto") ArchiViewDetailsDTO dto);
/**
* 更新 MX 图形模型
*
* @param dto DTO
* @return int
*/
Boolean updateMxGraphModel(ArchiViewDetailsDTO dto);
/**
* 架构视图树形结构
*
* @param model 参数
* @return {@link List}<{@link ArchiViewVO}>
*/
List<ArchiViewVO> treeList(ArchiViewDTO model);
/**
* 详情
*
* @param dto DTO
* @return {@link ArchiViewDetailsDTO}
*/
ArchiViewDetailsVO info(ArchiViewDetailsDTO dto);
/**
* 更新
*
* @param viewDetailsId 查看详细信息 ID
* @param version 版本
* @return int
*/
int updateStateOfPublished(@Param("viewDetailsId") Long viewDetailsId, @Param("version") String version);
/**
* 更新所有已发布状态视图为停用
*
* @param viewId 视图 ID
* @return int
*/
int updateStateOfStop(@Param("viewId") Long viewId);
/**
* 查询最大版本
*
* @param viewId 查看 ID
* @return {@link Long}
*/
Long queryMaxVersion(@Param("viewId") Long viewId);
}
package org.arch.overall.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import org.arch.common.modules.archoverall.entity.ViewPrjApp;
public interface ViewPrjAppMapper extends MPJBaseMapper<ViewPrjApp> {
}
\ No newline at end of file
package org.arch.overall.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mxgraph.model.mxCell;
import org.arch.common.modules.archoverall.dto.ArchiViewDTO;
import org.arch.common.modules.archoverall.dto.ArchiViewDetailsDTO;
import org.arch.common.modules.archoverall.entity.ArchiViewDetails;
import org.arch.common.modules.archoverall.vo.ArchiViewDetailsVO;
import org.arch.common.modules.archoverall.vo.ArchiViewVO;
import org.arch.common.modules.archoverall.vo.MxCellTreeVO;
import org.arch.common.modules.archoverall.vo.ViewAMxCellVO;
import org.arch.common.modules.base.dto.BathRemoveDTO;
import java.util.List;
import java.util.Map;
/**
* <p>
* 架构视图详情 服务类
* </p>
*
* @author makejava
* @since 2023-12-25
*/
public interface ArchiViewDetailsService extends IService<ArchiViewDetails> {
/**
* 分页列表
*
* @param dto 参数
*/
IPage<ArchiViewDetailsVO> page(ArchiViewDetailsDTO dto);
/**
* 架构视图树
*
* @param model 型
* @return {@link List}<{@link ArchiViewVO}>
*/
List<ArchiViewVO> treeList(ArchiViewDTO model);
/**
* 更新 MX 图形模型
*
* @param dto DTO
* @return int
*/
Boolean updateMxGraphModel(ArchiViewDetailsDTO dto);
/**
* 更新
*
* @param dto DTO
* @return {@link ArchiViewDetailsDTO}
*/
Boolean update(ArchiViewDetailsDTO dto);
/**
* 插入
*
* @param dto DTO
* @return {@link ArchiViewDetailsDTO}
*/
ArchiViewDetailsVO insert(ArchiViewDetailsDTO dto);
/**
* 详情
*
* @param dto DTO
* @return {@link ArchiViewDetailsDTO}
*/
ArchiViewDetailsVO info(ArchiViewDetailsDTO dto);
/**
* 根据视图id获取mxCell
*
* @param dto DTO
* @return {@link List}<{@link mxCell}>
*/
List<ViewAMxCellVO> getMxCellByViewDetailId(ArchiViewDetailsDTO dto);
/**
* 根据视图id获取mxCell的Tree
*
* @param dto DTO
* @return {@link List}<{@link mxCell}>
*/
List<MxCellTreeVO> getMxCellTreeByViewDetailId(ArchiViewDetailsDTO dto);
/**
* 根据视图id获取动态表格
*
* @param dto DTO
* @return {@link List}<{@link mxCell}>
*/
Map<String, Object> getDynamicTable(ArchiViewDetailsDTO dto);
/**
* 删除
*
* @param dto DTO
* @return boolean
*/
Boolean del(BathRemoveDTO dto);
}
package org.arch.overall.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.google.common.collect.Maps;
import com.mxgraph.model.mxCell;
import com.mxgraph.model.mxGraphModel;
import com.mxgraph.model.mxICell;
import com.mxgraph.view.mxGraph;
import lombok.RequiredArgsConstructor;
import org.arch.base.enums.ArchiBigClassEnum;
import org.arch.common.modules.archoverall.converter.ArchiViewDetailsCovert;
import org.arch.common.modules.archoverall.dto.ArchiViewDTO;
import org.arch.common.modules.archoverall.dto.ArchiViewDetailsDTO;
import org.arch.common.modules.archoverall.entity.ArchiView;
import org.arch.common.modules.archoverall.entity.ArchiViewDetails;
import org.arch.common.modules.archoverall.entity.ViewPrjApp;
import org.arch.common.modules.archoverall.event.AssertEvent;
import org.arch.common.modules.archoverall.vo.ArchiViewDetailsVO;
import org.arch.common.modules.archoverall.vo.ArchiViewVO;
import org.arch.common.modules.archoverall.vo.MxCellTreeVO;
import org.arch.common.modules.archoverall.vo.ViewAMxCellVO;
import org.arch.common.modules.base.dto.BathRemoveDTO;
import org.arch.overall.mapper.ArchiViewDetailsMapper;
import org.arch.overall.mapper.ArchiViewMapper;
import org.arch.overall.mapper.GraphRepositoryMapper;
import org.arch.overall.mapper.ViewPrjAppMapper;
import org.arch.overall.service.ArchiViewDetailsService;
import org.arch.overall.utils.MxFileUtil;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
* 架构视图详情 服务实现类
* </p>
*
* @author makejava
* @since 2023-12-25
*/
@Service
@RequiredArgsConstructor
public class ArchiViewDetailsServiceImpl extends MPJBaseServiceImpl<ArchiViewDetailsMapper, ArchiViewDetails> implements ArchiViewDetailsService {
private final ArchiViewMapper archiViewMapper;
private final ArchiViewDetailsCovert covert;
private final GraphRepositoryMapper graphRepositoryMapper;
private final ViewPrjAppMapper viewPrjAppMapper;
private final ApplicationEventPublisher publisher;
@Override
public IPage<ArchiViewDetailsVO> page(ArchiViewDetailsDTO dto) {
Long viewId = dto.getViewId();
ArchiView archiView = archiViewMapper.selectById(viewId);
dto.setArchiStage(Objects.nonNull(archiView) ? archiView.getArchiStage() : 0);
IPage<ArchiViewDetails> iPage = baseMapper.page(PageDTO.of(dto.getCurrent(), dto.getPageSize()), dto);
return iPage.convert(covert::convertToVO);
}
@Override
public List<ArchiViewVO> treeList(ArchiViewDTO model) {
model.setArchiStage(Optional.ofNullable(model.getArchiStage()).orElse(1));
return baseMapper.treeList(model);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateMxGraphModel(ArchiViewDetailsDTO dto) {
ArchiViewDetails archiMetaModel = baseMapper.selectById(dto.getViewDetailsId());
Assert.notNull(archiMetaModel, "架构视图不存在");
dto.setGraphId(archiMetaModel.getGraphId());
Integer state = archiMetaModel.getState();
Assert.isFalse(state == 1, "架构视图已发布,无法修改");
publisher.publishEvent(new AssertEvent(dto));
return baseMapper.updateMxGraphModel(dto);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean update(ArchiViewDetailsDTO dto) {
ArchiViewDetails archiViewDetails = baseMapper.selectById(dto.getViewDetailsId());
Assert.notNull(archiViewDetails, "架构视图不存在");
Integer state = archiViewDetails.getState();
Assert.isFalse(state == 1, "架构视图已发布,不可重复发布");
// 更新所有已发布状态视图为停用
baseMapper.updateStateOfStop(archiViewDetails.getViewId());
// 更新状态未已发布
return baseMapper.updateStateOfPublished(dto.getViewDetailsId(), dto.getVersion()) > 1;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ArchiViewDetailsVO insert(ArchiViewDetailsDTO dto) {
ArchiView archiView = archiViewMapper.selectById(dto.getViewId());
Assert.notNull(archiView, "架构视图不存在");
Integer archiStage = archiView.getArchiStage();
// 如果是总体架构或者为空
if (Objects.isNull(archiStage) ||
Objects.equals(ArchiBigClassEnum.TOTAL.getId(), archiStage)) {
ArchiViewDetails viewDetails = new ArchiViewDetails();
// 去除状态,发的全是暂存状态
viewDetails.setState(2);
viewDetails.setViewId(dto.getViewId());
viewDetails.setViewCode(archiView.getViewCode());
viewDetails.setViewDetailsCode(IdUtil.fastUUID());
viewDetails.setGraphId(graphRepositoryMapper.initArchiView());
// 获取最新版本
viewDetails.setVersion(this.getVersion(viewDetails));
baseMapper.insert(viewDetails);
ArchiViewDetailsVO detailsVO = new ArchiViewDetailsVO();
detailsVO.setViewDetailsId(viewDetails.getViewDetailsId());
return detailsVO;
} else {
ViewPrjApp viewPrjApp = new ViewPrjApp();
Long prjId = dto.getPrjId();
Long appId = dto.getAppId();
Assert.isFalse(Objects.nonNull(prjId) && Objects.nonNull(appId), "项目ID和系统ID只能存在一个");
MPJLambdaWrapper<ArchiViewDetails> wrapper = new MPJLambdaWrapper<ArchiViewDetails>()
.leftJoin(ViewPrjApp.class, ViewPrjApp::getArchiViewsDetailId, ArchiViewDetails::getViewDetailsId)
.eq(ArchiViewDetails::getVersion, dto.getVersion())
.eq(ArchiViewDetails::getViewId, dto.getViewId());
// 系统视图
if (Objects.equals(ArchiBigClassEnum.SYSTEM.getId(), archiStage)) {
Assert.isTrue(Objects.nonNull(appId), "请选择系统");
viewPrjApp.setAppId(appId);
wrapper.eq(ViewPrjApp::getAppId, appId);
Assert.isFalse(selectJoinCount(wrapper) > 0, "此视图版本已存在");
}
// 概设视图
if (Objects.equals(ArchiBigClassEnum.CONCEPT.getId(), archiStage) || Objects.equals(ArchiBigClassEnum.OTHER.getId(), archiStage)) {
Assert.isTrue(Objects.nonNull(prjId), "请选择项目");
viewPrjApp.setPrjId(prjId);
wrapper.eq(ViewPrjApp::getPrjId, prjId);
Assert.isFalse(selectJoinCount(wrapper) > 0, "此视图版本已存在");
}
ArchiViewDetails viewDetails = new ArchiViewDetails();
viewDetails.setViewId(dto.getViewId());
viewDetails.setViewCode(archiView.getViewCode());
viewDetails.setVersion(dto.getVersion());
viewDetails.setViewDetailsCode(IdUtil.fastUUID());
viewDetails.setGraphId(graphRepositoryMapper.initArchiView());
baseMapper.insert(viewDetails);
// 关系
viewPrjApp.setArchiViewsDetailId(viewDetails.getViewDetailsId());
viewPrjAppMapper.insert(viewPrjApp);
ArchiViewDetailsVO detailsVO = new ArchiViewDetailsVO();
detailsVO.setViewDetailsId(viewDetails.getViewDetailsId());
return detailsVO;
}
}
@Override
public ArchiViewDetailsVO info(ArchiViewDetailsDTO dto) {
return baseMapper.info(dto);
}
@Override
public List<MxCellTreeVO> getMxCellTreeByViewDetailId(ArchiViewDetailsDTO dto) {
List<MxCellTreeVO> list = new ArrayList<>();
ArchiViewDetailsVO info = info(dto);
Assert.notNull(info, "架构视图不存在");
String metaModelData = info.getMetaModelData();
mxGraph graph = MxFileUtil.initialize(metaModelData);
Object[] childCells = graph.getChildVertices(graph.getDefaultParent());
this.getChildCell(graph, list, childCells);
return list;
}
@Override
public Map<String, Object> getDynamicTable(ArchiViewDetailsDTO dto) {
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> all = Maps.newHashMap();
ArchiViewDetailsVO info = info(dto);
Assert.notNull(info, "架构视图不存在");
String metaModelData = info.getMetaModelData();
mxGraph graph = MxFileUtil.initialize(metaModelData);
mxGraphModel model = (mxGraphModel) graph.getModel();
Map<String, Object> cells = model.getCells();
cells.forEach((k, v) -> {
mxCell cell = (mxCell) v;
Map<String, Object> them = MxFileUtil.getCellData(cell);
if (MapUtil.isNotEmpty(them)) {
mxCell parent = (mxCell) cell.getParent();
if (Objects.nonNull(parent) && !parent.getId().equals("1") && !parent.getId().equals("0")) {
Map<String, Object> parItem = MxFileUtil.getCellData(parent);
them.put("parentId", Long.parseLong(parItem.get("assetId").toString()));
} else {
them.put("parentId", 0);
}
list.add(them);
}
});
List<TreeNode<Long>> collect = list.stream().map(ArchiViewDetailsServiceImpl::getTreeNode).collect(Collectors.toList());
List<Tree<Long>> build = TreeUtil.build(collect, 0L);
all.put("columns", list);
all.put("data", build);
return all;
}
/**
* 获取树节点
*
* @param map 资产
* @return {@link TreeNode}<{@link Long}>
*/
private static TreeNode<Long> getTreeNode(Map<String, Object> map) {
TreeNode<Long> treeNode = new TreeNode<>();
treeNode.setId(MapUtil.getLong(map, "assetId"));
treeNode.setParentId(MapUtil.getLong(map, "parentId"));
treeNode.setName(MapUtil.getStr(map, "assetName"));
Map<String, Object> hashMap = Maps.newHashMap();
hashMap.put("column", MapUtil.getStr(map, "eleName"));
treeNode.setExtra(hashMap);
return treeNode;
}
/**
* 获取子单元格
*
* @param graph 图
* @param list 列表
* @param childCells 子元素
*/
private void getChildCell(mxGraph graph, List<MxCellTreeVO> list, Object[] childCells) {
Arrays.stream(childCells).forEach(child -> {
MxCellTreeVO vo = new MxCellTreeVO();
if (child instanceof mxCell) {
mxCell mxCell = (mxCell) child;
vo.setId(mxCell.getId());
vo.setTopic(MxFileUtil.extractValue(mxCell));
tree(mxCell, graph, vo);
list.add(vo);
}
});
}
/**
* 递归
*
* @param cell 细胞
* @param graph 图
* @param parent 父节点
*/
private void tree(mxCell cell, mxGraph graph, MxCellTreeVO parent) {
List<MxCellTreeVO> list = new ArrayList<>();
Object[] childCells = graph.getChildVertices(cell);
if (childCells.length != 0) {
this.getChildCell(graph, list, childCells);
parent.setChildren(list);
}
}
@Override
public List<ViewAMxCellVO> getMxCellByViewDetailId(ArchiViewDetailsDTO dto) {
List<ViewAMxCellVO> list = new ArrayList<>();
ArchiViewDetailsVO info = info(dto);
Assert.notNull(info, "架构视图不存在");
String metaModelData = info.getMetaModelData();
mxGraph graph = MxFileUtil.initialize(metaModelData);
Object[] childVertices = graph.getChildVertices(graph.getDefaultParent());
this.getParentCell(graph, list, childVertices);
return CollUtil.sort(list, Comparator.comparing(ViewAMxCellVO::getSort));
}
/**
* 获取子单元格
*
* @param graph 图
* @param list 列表
* @param childCells 子元素
*/
private void getParentCell(mxGraph graph, List<ViewAMxCellVO> list, Object[] childCells) {
Arrays.stream(childCells).forEach(child -> {
ViewAMxCellVO vo = new ViewAMxCellVO();
if (child instanceof mxCell) {
mxCell mxCell = (mxCell) child;
String id = mxCell.getId();
vo.setUpstreamElements("无");
vo.setRelationship("无");
vo.setElementEncoding(id);
vo.setElementType(MxFileUtil.extractValue(mxCell));
vo.setSort(0);
this.getChildCell(mxCell, graph, list);
list.add(vo);
}
});
}
/**
* 递归
*
* @param cell 细胞
* @param graph 图
* @param list 集合
*/
private void getChildCell(mxCell cell, mxGraph graph, List<ViewAMxCellVO> list) {
Object[] childCells = graph.getChildVertices(cell);
Arrays.stream(childCells).forEach(child -> {
ViewAMxCellVO vo = new ViewAMxCellVO();
if (child instanceof mxCell) {
mxCell mxCell = (mxCell) child;
mxICell parent = mxCell.getParent();
vo.setUpstreamElements(MxFileUtil.extractValue(parent));
vo.setRelationship("父子");
String id = mxCell.getId();
vo.setElementEncoding(id);
vo.setElementType(MxFileUtil.extractValue(mxCell));
vo.setSort(1);
this.getChildCell(mxCell, graph, list);
list.add(vo);
}
});
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean del(BathRemoveDTO dto) {
List<Long> ids = dto.getIds();
ids.forEach(it -> {
ArchiViewDetails detail = baseMapper.selectById(it);
Assert.notNull(detail, "该数据不存在");
Assert.isFalse(detail.getState() == 1, "含有已发布架构视图,无法删除");
});
return removeBatchByIds(ids);
}
/**
* 总体架构试图获取版本
*
* @return {@link String}
*/
private String getVersion(ArchiViewDetails archiViewDetails) {
String version = "V";
Long l = baseMapper.queryMaxVersion(archiViewDetails.getViewId());
version += DateUtil.year(new Date()) + "-" + (l + 1);
return version;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.arch.overall.mapper.ArchiViewDetailsMapper">
<resultMap id="BaseResultMap" type="org.arch.common.modules.archoverall.entity.ArchiViewDetails">
<!--@mbg.generated-->
<!--@Table archi_view_details-->
<id column="view_details_id" jdbcType="BIGINT" property="viewDetailsId"/>
<result column="view_details_code" jdbcType="VARCHAR" property="viewDetailsCode"/>
<result column="view_id" jdbcType="BIGINT" property="viewId"/>
<result column="view_code" jdbcType="VARCHAR" property="viewCode"/>
<result column="create_man" jdbcType="BIGINT" property="createMan"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
<result column="last_update_man" jdbcType="BIGINT" property="lastUpdateMan"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="version" jdbcType="VARCHAR" property="version"/>
<result column="state" jdbcType="TINYINT" property="state"/>
<result column="view_template_id" property="viewTemplateId"/>
<result column="meta_model_data" jdbcType="LONGVARCHAR" property="metaModelData"/>
<result column="meta_model_svg" jdbcType="LONGVARCHAR" property="metaModelSvg"/>
</resultMap>
<resultMap id="ViewResultMap" type="com.eadc.modules.design.vo.ArchiViewVO">
<id column="view_id" jdbcType="BIGINT" property="viewId"/>
<result column="archi_type" property="archiType"/>
<result column="view_name" jdbcType="VARCHAR" property="viewName"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<collection property="subList" ofType="com.eadc.modules.design.vo.ArchiViewVO">
<id column="sub_view_id" jdbcType="BIGINT" property="viewId"/>
<result column="sub_view_name" jdbcType="VARCHAR" property="viewName"/>
</collection>
</resultMap>
<!--架构视图树形结构-->
<select id="treeList" resultMap="ViewResultMap">
with archi_belong as (select amdd.value as view_id,
amdd.label as view_name,
amdd.sort,
amdd.remark as archi_type
from archi_model_dict_detail amdd
left join archi_model_dict amd on (amd.id = amdd.dict_id)
where amd.type_value = 'archi_belong'
and amd.state = 1
and amdd.del_flag = 0)
select if(#{archiStage} != 4, ab.view_id, 5) as view_id,
if(#{archiStage} != 4, ab.view_name, '其他架构') as view_name,
if(#{archiStage} != 4, ab.archi_type, 'ARCHI_OTHER') as archi_type,
av.view_id as sub_view_id,
av.view_name as sub_view_name,
ab.sort
from archi_belong ab
left join archi_view av
on (ab.view_id = av.archi_belong_id
and av.state = 1
and av.del_flag = 0
and av.archi_stage = #{archiStage})
order by ab.sort, av.create_time
</select>
<!--更新画布信息和svg缩略图-->
<update id="updateMxGraphModel">
update graph_repository
set content = #{metaModelData},
icon = #{metaModelSvg},
last_update_time = now()
where graph_id = #{graphId}
</update>
<!--架构视图列表-->
<select id="page" resultMap="BaseResultMap">
select avd.view_details_id,
avd.view_details_code,
avd.view_id,
avd.view_code,
avd.version,
avd.`state`,
av.view_template_id,
gr.icon as meta_model_svg
from archi_view_details avd
left join archi_view av on (avd.view_id = av.view_id)
left join archi_view_relation avr on (avr.archi_views_detail_id = avd.view_details_id)
left join graph_repository gr on (avd.graph_id = gr.graph_id)
<where>
avd.del_flag = 0
<if test="dto.viewId != null">
and avd.view_id = #{dto.viewId}
</if>
<!--未选择视图,默认为 0-->
<if test="dto.viewId == null">
and avd.view_id = 0
</if>
<if test="dto.state != null">
and avd.state = #{dto.state}
</if>
<!--总体架构无关联-->
<choose>
<when test="dto.archiStage != 1">
<if test="dto.prjId != null">
and avr.prj_id = #{dto.prjId}
</if>
<if test="dto.appId != null">
and avr.app_id = #{dto.appId}
</if>
<if test="dto.appId == null and dto.prjId == null">
and avr.app_id = 0
</if>
</when>
</choose>
</where>
order by avd.create_time desc
</select>
<!--详情-->
<select id="info" resultType="org.arch.common.modules.archoverall.vo.ArchiViewDetailsVO">
select avd.view_details_id,
avd.version,
avd.`state`,
gr.content as meta_model_data
from archi_view_details avd
left join graph_repository gr on avd.graph_id = gr.graph_id
where avd.del_flag = 0
and avd.view_details_id = #{viewDetailsId}
</select>
<!--发布-->
<update id="updateStateOfPublished">
update archi_view_details
set state = 1,
last_update_time = now()
where view_details_id = #{viewDetailsId}
</update>
<!--更新所有已发布状态视图为停用-->
<update id="updateStateOfStop">
update archi_view_details
set state = 0
where view_id = #{viewId}
and state = 1
</update>
<!--查询最大版本-->
<select id="queryMaxVersion" resultType="java.lang.Long">
select count(*)
from archi_view_details
where view_id = #{viewId}
and version is not null
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!