Commit fee92cd6 by renrui

[add]五大架构资产

1 parent e7eabd4d
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.ArchiAsseAddDTO;
import org.arch.common.modules.archoverall.dto.asset.ArchiAssetDTO;
import org.arch.common.modules.archoverall.entity.ArchiAssetDesignedInfo;
import org.arch.common.modules.archoverall.vo.ArchiVersionVO;
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.ArchiAssetDesignedInfoService;
import org.arch.overall.service.ArchiAssetInfoService;
import org.arch.overall.service.ArchiAssetService;
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;
import org.arch.common.modules.archoverall.dto.ArchiAssetDesignedAddDTO;
/**
* <p>
* 架构资产
* </p>
*
* @author author
* @since 2024-01-09
*/
@Api(value = "/arc-ast-cn", tags = {"五大架构资产"})
@RestController
@RequestMapping("/archi-asset-view")
@RequiredArgsConstructor
public class ArchiAssetViewController {
private final ArchiAssetService archiAssetService;
private final ArchiAssetInfoService archiAssetInfoService;
private final ArchiAssetDesignedInfoService archiAssetDesignedInfoService;
@ApiOperation(value = "总体架构资产自动图形化")
@PostMapping(value = "/automaticGraphing")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "总体架构资产自动图形化", moduleName = "五大架构资产")
public Result automaticGraphing(@RequestBody ArchiAssetDTO params) {
return Result.success(archiAssetService.automaticGraphing(params));
}
@ApiOperation(value = "总体架构资产智能搜索")
@PostMapping(value = "/assetTree")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "总体架构资产智能搜索", moduleName = "五大架构资产")
public Result assetTree(@RequestBody ArchiAssetDTO params) {
return Result.success(archiAssetService.treeList(params));
}
@ApiOperation(value = "总体架构资可视化展示")
@PostMapping(value = "/assetLevel")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "总体架构资可视化展示", moduleName = "五大架构资产")
public Result assetLevel(@RequestBody ArchiAssetDTO params) {
return Result.success(archiAssetService.treeListView(params));
}
@ApiOperation(value = "架构资产版本")
@PostMapping(value = "/assetV")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "架构资产版本", moduleName = "五大架构资产")
public Result assetV(@RequestBody ArchiVersionVO params) {
return Result.success(archiAssetService.queryArchiVersion(params));
}
//--------------------------数据成图---------------------------
@ApiOperation(value = "数据成图-勾选列表")
@PostMapping(value = "/assetTickList")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "数据成图-勾选列表", moduleName = "五大架构资产")
public Result assetTickList(@RequestBody ArchiAsseAddDTO params) {
return Result.success(archiAssetDesignedInfoService.assetTickList(params));
}
@ApiOperation(value = "数据成图-资产详情")
@PostMapping(value = "/assetTickInfo")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "数据成图-资产详情", moduleName = "五大架构资产")
public Result assetTickInfo(@RequestBody ArchiAsseAddDTO params) {
return Result.success(archiAssetInfoService.info(params.getAssetId()));
}
@ApiOperation(value = "数据成图-删除")
@PostMapping(value = "/assetTickDel")
//@AutoLog(value = LogEventTypeEnum.DELETE, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.HIGH)
@OperLog(value = LogOperTypeEnum.DELETE, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "数据成图-删除", moduleName = "五大架构资产")
public Result delete(@RequestBody BathRemoveDTO model) {
boolean b = archiAssetDesignedInfoService.removeByIds(model.getIds());
return b ? Result.success("删除成功") : Result.error("删除失败");
}
@ApiOperation(value = "数据成图-状态变更")
@PostMapping(value = "/assetTickState")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "数据成图-状态变更", moduleName = "五大架构资产")
public Result assetTickState(@RequestBody ArchiAsseAddDTO model) {
ArchiAssetDesignedInfo wrapper = new ArchiAssetDesignedInfo();
wrapper.setArchiAssetType(model.getArchiAssetType());
wrapper.setAssetId(model.getAssetId());
boolean b = archiAssetDesignedInfoService.updateById(wrapper);
return b ? Result.success("更新成功") : Result.error("更新失败");
}
@ApiOperation(value = "勾选资产列表-提交")
@PostMapping(value = "/assetAddBatch")
//@AutoLog(value = LogEventTypeEnum.INSERT, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.MIDDLE)
@OperLog(value = LogOperTypeEnum.ADD, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "勾选资产列表-提交", moduleName = "五大架构资产")
public Result assetAddBatch(@RequestBody ArchiAssetDesignedAddDTO params) {
boolean b = archiAssetDesignedInfoService.assetAddBatch(params);
return b ? Result.success("提交成功") : Result.error("提交失败");
}
@ApiOperation(value = "资产编号查重")
@PostMapping(value = "/assetByNumber")
//@AutoLog(value = LogEventTypeEnum.SEARCH, LogTypeValue = LogTypeEnum.BUSI_LOG, LogLevValue = LogLevEnum.LOW)
@OperLog(value = LogOperTypeEnum.QUERY, logTypeValue = LogTypeEnum.BUSI_LOG, operDes = "资产编号查重", moduleName = "五大架构资产")
public Result assetByNumber(@RequestBody ArchiAssetDesignedInfo params) {
boolean b = archiAssetDesignedInfoService.assetByNumber(params);
return b ? Result.success("资产编号无重复") : Result.error("资产编号有重复");
}
}
package org.arch.overall.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import org.arch.common.modules.archoverall.dto.ArchiAsseAddDTO;
import org.arch.common.modules.archoverall.entity.ArchiAssetDesignedInfo;
import java.util.List;
public interface ArchiAssetDesignedInfoMapper extends MPJBaseMapper<ArchiAssetDesignedInfo> {
/**
* 数据成图-勾选列表
*
* @return {@link List}<{@link ArchiAssetDesignedInfo}>
*/
List<ArchiAssetDesignedInfo> assetTickList(ArchiAsseAddDTO params);
}
\ No newline at end of file
package org.arch.overall.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.arch.common.modules.archoverall.dto.ArchiAsseAddDTO;
import org.arch.common.modules.archoverall.dto.ArchiAssetDesignedAddDTO;
import org.arch.common.modules.archoverall.entity.ArchiAssetDesignedInfo;
import java.util.List;
public interface ArchiAssetDesignedInfoService extends IService<ArchiAssetDesignedInfo> {
/**
* 数据成图-勾选列表
*
* @param params 参数
* @return {@link List}<>
*/
List<ArchiAssetDesignedInfo> assetTickList(ArchiAsseAddDTO params);
boolean assetAddBatch(ArchiAssetDesignedAddDTO params);
boolean assetByNumber(ArchiAssetDesignedInfo params);
}
package org.arch.overall.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import com.alibaba.cloud.commons.lang.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.arch.base.enums.ArchiAssetType;
import org.arch.common.modules.archoverall.dto.ArchiAsseAddDTO;
import org.arch.common.modules.archoverall.dto.ArchiAssetDesignedAddDTO;
import org.arch.common.modules.archoverall.dto.ArchiAssetDesignedInfoDTO;
import org.arch.common.modules.archoverall.entity.ArchiAssetDesignedInfo;
import org.arch.common.modules.archoverall.entity.AssetInfo;
import org.arch.overall.mapper.ArchiAssetDesignedInfoMapper;
import org.arch.overall.mapper.ArchiAssetInfoMapper;
import org.arch.overall.service.ArchiAssetDesignedInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Service
@Slf4j
public class ArchiAssetDesignedInfoServiceImpl extends ServiceImpl<ArchiAssetDesignedInfoMapper, ArchiAssetDesignedInfo> implements ArchiAssetDesignedInfoService {
@Autowired
private ArchiAssetDesignedInfoMapper archiAssetDesignedInfoMapper;
@Autowired
private ArchiAssetInfoMapper archiAssetInfoMapper;
@Override
public List<ArchiAssetDesignedInfo> assetTickList(ArchiAsseAddDTO params) {
return baseMapper.assetTickList(params);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean assetAddBatch(ArchiAssetDesignedAddDTO params) {
if (params == null || params.getAssetAddBatch() == null || params.getAssetAddBatch().isEmpty()) {
log.error("新增参数为空或新增列表为空,无法执行批量新增操作。");
return false;
}
List<ArchiAssetDesignedInfoDTO> assetList = params.getAssetAddBatch();
for (ArchiAssetDesignedInfoDTO it : assetList) {
ArchiAssetDesignedInfo assets = new ArchiAssetDesignedInfo();
Integer archiAssetType = it.getArchiAssetType();
Assert.isFalse(archiAssetType == null, "架构资产类型不能为空");
// 遵从
if (ArchiAssetType.FOLLOW.getCode() == archiAssetType) {
AssetInfo assetInfo = archiAssetInfoMapper.selectById(it.getAssetId());
Assert.notNull(assetInfo, "架构资产信息不存在");
BeanUtil.copyProperties(assetInfo, assets);
} else { // 3.新增 2.完善
BeanUtil.copyProperties(it, assets);
}
assets.setOrignAssetId(it.getAssetId());// 原始ID
assets.setAssetId(null);// 重置ID
assets.setAssetCode(IdUtil.fastUUID());
// 上级元素
List<String> parentElements = it.getParentElement();
if (parentElements != null && !parentElements.isEmpty()) {
String parentElementString = String.join(", ", parentElements);
assets.setParentElement(parentElementString);
}
baseMapper.insert(assets);
}
return true;
}
@Override
public boolean assetByNumber(ArchiAssetDesignedInfo params) {
Long l = archiAssetDesignedInfoMapper.selectCount(Wrappers.<ArchiAssetDesignedInfo>lambdaQuery()
.eq(StringUtils.isNotBlank(params.getAssetNumber()), ArchiAssetDesignedInfo::getAssetNumber, params.getAssetNumber())
.eq(Objects.nonNull(params.getArchiBelongId()), ArchiAssetDesignedInfo::getArchiBelongId, params.getArchiBelongId())
.eq(Objects.nonNull(params.getArchiStage()), ArchiAssetDesignedInfo::getArchiStage, params.getArchiStage())
.eq(Objects.nonNull(params.getArchiAssetState()), ArchiAssetDesignedInfo::getArchiAssetState, params.getArchiAssetState()));
return l <= 0;
}
}
<?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.ArchiAssetDesignedInfoMapper">
<resultMap id="BaseResultMap" type="org.arch.common.modules.archoverall.entity.ArchiAssetDesignedInfo">
<!--@mbg.generated-->
<!--@Table archi_asset_designed_info-->
<id column="asset_id" jdbcType="BIGINT" property="assetId"/>
<id column="version_id" jdbcType="BIGINT" property="versionId"/>
<result column="asset_name" jdbcType="VARCHAR" property="assetName"/>
<result column="asset_code" jdbcType="VARCHAR" property="assetCode"/>
<result column="parent_asset_id" jdbcType="BIGINT" property="parentAssetId"/>
<result column="parent_asset_name" jdbcType="VARCHAR" property="parentAssetName"/>
<result column="parent_code" jdbcType="VARCHAR" property="parentCode"/>
<result column="archi_ele_id" jdbcType="BIGINT" property="archiEleId"/>
<result column="ele_name" jdbcType="VARCHAR" property="eleName"/>
<result column="archi_type" jdbcType="VARCHAR" property="archiType"/>
<result column="archi_belong_id" jdbcType="TINYINT" property="archiBelongId"/>
<result column="archi_asset_state" jdbcType="TINYINT" property="archiAssetState"/>
<result column="archi_asset_type" jdbcType="TINYINT" property="archiAssetType"/>
<result column="archi_stage" jdbcType="TINYINT" property="archiStage"/>
<result column="archi_asset_type_id" jdbcType="BIGINT" property="archiAssetTypeId"/>
<result column="target_asset" jdbcType="VARCHAR" property="targetAsset"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_man" jdbcType="BIGINT" property="createMan"/>
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
<result column="last_update_man" jdbcType="BIGINT" property="lastUpdateMan"/>
<result column="fields_value" jdbcType="VARCHAR" property="fieldsValue"/>
<result column="column01" jdbcType="VARCHAR" property="column01"/>
<result column="column02" jdbcType="LONGVARCHAR" property="column02"/>
<result column="orign_version_id" jdbcType="BIGINT" property="orignVersionId"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="is_show" jdbcType="TINYINT" property="isShow"/>
<result column="orign_asset_id" jdbcType="BIGINT" property="orignAssetId"/>
<result column="state" jdbcType="TINYINT" property="state"/>
<result column="version" jdbcType="VARCHAR" property="version"/>
<result column="is_extend" jdbcType="TINYINT" property="isExtend"/>
<result column="build_type" jdbcType="TINYINT" property="buildType"/>
<result column="parent_element" jdbcType="VARCHAR" property="parentElement"/>
<result column="color" jdbcType="VARCHAR" property="color"/>
<result column="asset_number" jdbcType="VARCHAR" property="assetNumber"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="graph_id" jdbcType="BIGINT" property="graphId"/>
<result column="view_id" jdbcType="BIGINT" property="viewId"/>
<result column="tpl_id" jdbcType="BIGINT" property="tplId"/>
<result column="icon" property="icon"/>
<result column="icon_name" property="iconName"/>
</resultMap>
<!--数据成图-勾选列表-->
<select id="assetTickList" resultMap="BaseResultMap">
select aai.asset_id,
aai.asset_name,
aai.asset_code,
aai.parent_asset_id,
aai.parent_asset_name,
aai.parent_code,
aai.version_id,
aai.archi_ele_id,
aai.ele_name,
aai.archi_type,
aai.archi_belong_id,
aai.archi_asset_state,
aai.archi_asset_type,
aai.archi_stage,
aai.archi_asset_type_id,
aai.target_asset,
aai.create_time,
aai.create_man,
aai.last_update_time,
aai.last_update_man,
aai.fields_value,
aai.column01,
aai.column02,
aai.orign_version_id,
aai.sort,
aai.is_show,
aai.orign_asset_id,
aai.del_flag,
aai.`state`,
aai.version,
aai.is_extend,
aai.build_type,
aai.parent_element,
aai.color,
aai.asset_number,
aai.graph_id,
aai.view_id,
aai.tpl_id,
gmi.icon,
gmi.graph_name as icon_name
from archi_asset_designed_info aai
left join graph_meta_info gmi on (aai.graph_id = gmi.graph_id)
where aai.view_id = #{viewId}
and aai.del_flag = 0
</select>
</mapper>
\ No newline at end of file
package org.arch.common.modules.archoverall.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 资产DTO
*
* @author admin
* @date 2024/02/21
*/
@Data
@ApiModel(value = "资产")
public class ArchiAsseAddDTO {
@ApiModelProperty("资产ID")
private Long assetId;
@ApiModelProperty("视图ID")
private Long viewId;
@ApiModelProperty(value = "架构资产类型(3.新增、2.完善、1.遵从)")
private Integer archiAssetType;
}
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 com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.arch.common.BaseEntity;
import java.util.List;
/**
* 架构资产
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "架构资产")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "archi_asset_designed_info")
public class ArchiAssetDesignedInfo extends BaseEntity {
@ApiModelProperty(value = "架构组件ID")
@TableId(value = "asset_id", type = IdType.AUTO)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long assetId;
@ApiModelProperty(value = "架构组件名称")
private String assetName;
@ApiModelProperty(value = "资产编码,采用8位阶梯设计编码,通过编码识别层级")
private String assetCode;
@ApiModelProperty(value = "上级架构组件ID")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long parentAssetId;
@ApiModelProperty(value = "上级架构组件名称")
private String parentAssetName;
@ApiModelProperty(value = "父级编码")
private String parentCode;
@ApiModelProperty(value = "版本ID")
private Long versionId;
@ApiModelProperty(value = "架构元素Id")
private Long archiEleId;
@ApiModelProperty(value = "架构类型")
private String archiType;
@ApiModelProperty(value = "架构归属")
private Integer archiBelongId;
@ApiModelProperty(value = "架构资产状态(字典中读取,1:现状态;2:目标态)")
private Integer archiAssetState;
@ApiModelProperty(value = "架构阶段(1:总体架构;2:系统架构),必传")
private Integer archiStage;
@ApiModelProperty(value = "架构资产类型关联的ID,目前架构视图关联archi_view表,必传")
private Long archiAssetTypeId;
@ApiModelProperty(value = "关联资产,实际用作兄弟关系连线,可支持多个target")
private String targetAsset;
@ApiModelProperty(value = "JSON综合字段;将架构元素的属性和值利用Json数据存储")
private String fieldsValue;
@ApiModelProperty(value = "扩展字段")
private String column01;
@ApiModelProperty(value = "扩展字段")
private String column02;
@ApiModelProperty(value = "组件类型名称")
private String eleName;
@ApiModelProperty(value = "旧版本ID")
private Long orignVersionId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "是否首页展示 0 展示 1 不展示")
private Byte isShow;
@ApiModelProperty(value = "原架构ID")
private Long orignAssetId;
@ApiModelProperty(value = "资产常量,必传。")
@TableField(exist = false)
private String assetConstant;
@ApiModelProperty(value = "版本")
private String version;
@ApiModelProperty(value = "状态 0:已停用 1:已发布 2:暂存")
private Integer state;
@ApiModelProperty(value = "承建类型:1统推,2自建")
private Integer buildType;
@ApiModelProperty(value = "来源:0系统资产,1总体资产,2概设关联业务管理同步更新")
private Integer isExtend;
@TableField(exist = false) // 表示数据库里不存在此字段
@ApiModelProperty(value = "架构资产子节点树")
private List<AssetInfo> children;
@ApiModelProperty(value = "颜色")
private String color;
@ApiModelProperty(value = "上级元素名称")
private String parentElement;
@ApiModelProperty(value = "资产编号")
private String assetNumber;
@ApiModelProperty(value = "图形库ID")
private Long graphId;
@ApiModelProperty(value = "图标")
@TableField(exist = false)
private String icon;
@ApiModelProperty(value = "图形名称")
@TableField(exist = false)
private String iconName;
@ApiModelProperty(value = "架构资产类型(3.新增、2.完善、1.遵从)")
private Integer archiAssetType;
@ApiModelProperty(value = "视图ID")
private Long viewId;
@ApiModelProperty(value = "视图模板ID")
private Long tplId;
@ApiModelProperty(value = "一层级")
@TableField(exist = false)
private String assetFirstName;
@ApiModelProperty(value = "二层级")
@TableField(exist = false)
private String assetSecondName;
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!