Commit 9c2401f6 by 袁伟铭

对接调试共享平台接口

parent 5cf557dc
......@@ -19,6 +19,8 @@ public class IdVo {
private String id;
private String note;
private Set<String> ids;
public Set<String> getIds() {
......
......@@ -6,10 +6,8 @@ import com.zq.common.vo.IdVo;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.entity.DataCategoryItem;
import com.zq.resource.service.CategoryService;
import com.zq.resource.vo.DataCategoryFindVo;
import com.zq.resource.vo.DataCategoryItemFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
......@@ -43,7 +41,7 @@ public class CategoryController {
return ResultVo.success(categoryService.getAllCategoryList(vo));
}
@ApiOperation("获取目录列表")
@ApiOperation("获取目录信息")
@PostMapping(value = "/getCategoryInfo/{categoryId}")
public ResultVo getCategoryInfo(@PathVariable String categoryId) {
AssertUtils.hasText(categoryId, "ID不能为空");
......@@ -99,40 +97,4 @@ public class CategoryController {
return ResultVo.success();
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓目录信息项↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("获取目录信息项列表")
@PostMapping(value = "/getCategoryItemList")
public ResultVo<PageVo<DataCategoryItem>> getCategoryItemList(@RequestBody DataCategoryItemFindVo vo) {
return ResultVo.success(categoryService.getCategoryItemList(vo));
}
@ApiOperation("获取目录信息项")
@PostMapping(value = "/getCategoryItemInfo/{id}")
public ResultVo<DataCategoryItem> getCategoryItemInfo(@PathVariable String id) {
AssertUtils.hasText(id, "ID不能为空");
return ResultVo.success(categoryService.getCategoryItemInfo(id));
}
@ApiOperation("添加目录信息项")
@PostMapping(value = "/addCategoryItem")
public ResultVo addCategoryItem(@RequestBody DataCategoryItem vo) {
AssertUtils.hasText(vo.getCategoryId(), "目录ID不能为空");
AssertUtils.hasText(vo.getCnName(), "名称不能为空");
AssertUtils.hasText(vo.getDataFormat(), "数据类型不能为空");
AssertUtils.notNull(vo.getLength(), "数据长度不能为空");
categoryService.addCategoryItem(vo);
return ResultVo.success();
}
@ApiOperation("修改目录信息项")
@PostMapping(value = "/modifyCategoryItem")
public ResultVo modifyCategory(@RequestBody DataCategoryItem vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryService.modifyCategoryItem(vo);
return ResultVo.success();
}
}
......@@ -7,11 +7,12 @@ import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.CategoryInterface;
import com.zq.resource.entity.CategoryInterfaceAttach;
import com.zq.resource.entity.CategoryInterfaceInput;
import com.zq.resource.entity.CategoryInterfaceOutput;
import com.zq.resource.service.CategoryInterfaceService;
import com.zq.resource.vo.CategoryInterfaceFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
......@@ -27,6 +28,8 @@ public class CategoryInterfaceController {
private final CategoryInterfaceService categoryInterfaceService;
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓接口资源↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("接口资源列表")
@PostMapping(value = "/getCategoryInterfaceList")
public ResultVo<PageVo<CategoryInterface>> getCategoryInterfaceList(@RequestBody CategoryInterfaceFindVo vo) {
......@@ -75,13 +78,16 @@ public class CategoryInterfaceController {
@ApiOperation("接口资源撤销")
@PostMapping(value = "/share/cancelCategoryInterface")
public ResultVo cancelCategoryInterface(@RequestBody IdVo vo, @ApiParam("撤销原因") @RequestParam String note) {
public ResultVo cancelCategoryInterface(@RequestBody IdVo vo) {
AssertUtils.notEmpty(vo.getIds(), "至少选择一项");
AssertUtils.hasText(vo.getNote(), "原因不能为空");
categoryInterfaceService.cancelCategoryInterface(vo.getIds(), note);
categoryInterfaceService.cancelCategoryInterface(vo.getIds(), vo.getNote());
return ResultVo.success();
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓接口资源附件↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("接口资源附件列表")
@PostMapping(value = "/getCategoryInterfaceAttachList")
public ResultVo<PageVo<CategoryInterfaceAttach>> getCategoryInterfaceAttachList(@RequestBody KeywordFindVo vo) {
......@@ -114,4 +120,93 @@ public class CategoryInterfaceController {
return ResultVo.success();
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓接口资源输入参数↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("接口资源输入参数列表")
@PostMapping(value = "/getCategoryInterfaceInputList")
public ResultVo<PageVo<CategoryInterfaceInput>> getCategoryInterfaceInputList(@RequestBody KeywordFindVo vo) {
return ResultVo.success(categoryInterfaceService.getCategoryInterfaceInputList(vo));
}
@ApiOperation("获取接口资源输入参数信息")
@PostMapping(value = "/getCategoryInterfaceInputInfo/{id}")
public ResultVo<CategoryInterfaceInput> getCategoryInterfaceInputInfo(@PathVariable String id) {
return ResultVo.success(categoryInterfaceService.getCategoryInterfaceInputInfo(id));
}
@ApiOperation("添加接口资源输入参数")
@PostMapping(value = "/addCategoryInterfaceInput")
public ResultVo addCategoryInterfaceInput(@RequestBody CategoryInterfaceInput vo) {
AssertUtils.notNull(vo.getCategoryInterfaceId(), "缺少接口资源ID");
AssertUtils.hasText(vo.getParamName(), "缺少参数名");
AssertUtils.hasText(vo.getParamType(), "缺少参数类型");
AssertUtils.notNull(vo.getMustfill(), "缺少是否不能为空");
AssertUtils.hasText(vo.getRemark(), "缺少说明备注");
categoryInterfaceService.addCategoryInterfaceInput(vo);
return ResultVo.success();
}
@ApiOperation("修改接口资源输入参数")
@PostMapping(value = "/modifyCategoryInterfaceInput")
public ResultVo modifyCategoryInterfaceInput(@RequestBody CategoryInterfaceInput vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryInterfaceService.modifyCategoryInterfaceInput(vo);
return ResultVo.success();
}
@ApiOperation("删除接口资源输入参数")
@DeleteMapping(value = "/deleteCategoryInterfaceInput/{id}")
public ResultVo modifyCategoryInterfaceInput(@PathVariable String id) {
AssertUtils.hasText(id, "ID不能为空");
categoryInterfaceService.deleteCategoryInterfaceInput(id);
return ResultVo.success();
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓接口资源输出参数↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
@ApiOperation("接口资源输出参数列表")
@PostMapping(value = "/getCategoryInterfaceOutputList")
public ResultVo<PageVo<CategoryInterfaceOutput>> getCategoryInterfaceOutputList(@RequestBody KeywordFindVo vo) {
return ResultVo.success(categoryInterfaceService.getCategoryInterfaceOutputList(vo));
}
@ApiOperation("获取接口资源输出参数信息")
@PostMapping(value = "/getCategoryInterfaceOutputInfo/{id}")
public ResultVo<CategoryInterfaceOutput> getCategoryInterfaceOutputInfo(@PathVariable String id) {
return ResultVo.success(categoryInterfaceService.getCategoryInterfaceOutputInfo(id));
}
@ApiOperation("添加接口资源输出参数")
@PostMapping(value = "/addCategoryInterfaceOutput")
public ResultVo addCategoryInterfaceOutput(@RequestBody CategoryInterfaceOutput vo) {
AssertUtils.notNull(vo.getCategoryInterfaceId(), "缺少接口资源ID");
AssertUtils.hasText(vo.getParamName(), "缺少参数名");
AssertUtils.hasText(vo.getParamType(), "缺少参数类型");
AssertUtils.hasText(vo.getRemark(), "缺少说明备注");
categoryInterfaceService.addCategoryInterfaceOutput(vo);
return ResultVo.success();
}
@ApiOperation("修改接口资源输出参数")
@PostMapping(value = "/modifyCategoryInterfaceOutput")
public ResultVo modifyCategoryInterfaceOutput(@RequestBody CategoryInterfaceOutput vo) {
AssertUtils.hasText(vo.getId(), "ID不能为空");
categoryInterfaceService.modifyCategoryInterfaceOutput(vo);
return ResultVo.success();
}
@ApiOperation("删除接口资源输入参数")
@DeleteMapping(value = "/deleteCategoryInterfaceOutput/{id}")
public ResultVo deleteCategoryInterfaceOutput(@PathVariable String id) {
AssertUtils.hasText(id, "ID不能为空");
categoryInterfaceService.deleteCategoryInterfaceOutput(id);
return ResultVo.success();
}
}
......@@ -71,20 +71,20 @@ public class DbInfoController {
@ApiOperation("注册库表资源")
@PostMapping(value = "/share/registerDbInfo")
public ResultVo registerDbInfo(@RequestBody IdVo vo, @RequestParam String mappingId) {
public ResultVo registerDbInfo(@RequestBody IdVo vo) {
AssertUtils.isTrue(CollUtil.isNotEmpty(vo.getIds()), "至少选择一项");
AssertUtils.hasText(mappingId, "缺少映射ID");
dbInfoService.registerDbInfo(vo.getIds(), mappingId);
dbInfoService.registerDbInfo(vo.getIds());
return ResultVo.success();
}
@ApiOperation("撤销库表资源")
@PostMapping(value = "/share/cancelDbInfo")
public ResultVo cancelDbInfo(@RequestBody IdVo vo) {
AssertUtils.isTrue(CollUtil.isNotEmpty(vo.getIds()), "至少选择一项");
AssertUtils.notEmpty(vo.getIds(), "至少选择一项");
AssertUtils.hasText(vo.getNote(), "请输入原因");
dbInfoService.cancelDbInfo(vo.getIds());
dbInfoService.cancelDbInfo(vo.getIds(), vo.getNote());
return ResultVo.success();
}
......
......@@ -155,6 +155,15 @@ public class DeptDutyController {
return ResultVo.success();
}
@ApiOperation("删除事项-标签")
@PostMapping(value = "/deleteDeptLiabilityLabel/{id}")
public ResultVo deleteDeptLiabilityLabel(@RequestBody String id) {
AssertUtils.hasText(id, "ID不能为空");
deptDutyService.deleteDeptLiabilityLabel(id);
return ResultVo.success();
}
@ApiOperation("获取事项-标签列表")
@PostMapping(value = "/getDeptLiabilityLabelList")
public ResultVo<PageVo<DeptLiabilityLabel>> getDeptLiabilityLabelList(@RequestBody KeywordFindVo vo) {
......
package com.zq.resource.controller.admin;
import cn.hutool.core.collection.CollUtil;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.IdVo;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.FileResource;
import com.zq.resource.service.FileResourceService;
import com.zq.resource.vo.FileResourceFindVo;
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 = "/resource/file")
public class FileResourceController {
private final FileResourceService fileResourceService;
@ApiOperation("添加文件资源")
@PostMapping(value = "/addFileResource")
public ResultVo addFileResource(@RequestBody FileResource vo) {
AssertUtils.notNull(vo.getCategoryId(), "缺少目录ID");
AssertUtils.hasText(vo.getFtpIp(), "缺少FTP IP");
AssertUtils.hasText(vo.getFtpPort(), "缺少FTP 端口");
AssertUtils.hasText(vo.getFtpUser(), "缺少FTP 账号");
AssertUtils.hasText(vo.getFtpPwd(), "缺少FTP 密码");
AssertUtils.hasText(vo.getFolderName(), "缺少FTP 文件名称");
fileResourceService.addFileResource(vo);
return ResultVo.success();
}
@ApiOperation("修改文件资源")
@PostMapping(value = "/modifyFileResource")
public ResultVo modifyFileResource(@RequestBody FileResource vo) {
AssertUtils.notNull(vo.getId(), "缺少ID");
fileResourceService.modifyFileResource(vo);
return ResultVo.success();
}
@ApiOperation("获取文件资源列表")
@PostMapping(value = "/getFileResourceList")
public ResultVo<PageVo<FileResource>> getFileResourceList(@RequestBody FileResourceFindVo vo) {
return ResultVo.success(fileResourceService.getFileResourceList(vo));
}
@ApiOperation("获取文件资源信息")
@GetMapping(value = "/getFileResourceInfo/{id}")
public ResultVo<FileResource> getFileResourceInfo(@PathVariable String id) {
return ResultVo.success(fileResourceService.getFileResourceInfo(id));
}
@ApiOperation("注册文件资源")
@PostMapping(value = "/share/registerFileResource")
public ResultVo registerFileResource(@RequestBody IdVo vo) {
AssertUtils.isTrue(CollUtil.isNotEmpty(vo.getIds()), "至少选择一项");
fileResourceService.registerFileResource(vo.getIds());
return ResultVo.success();
}
@ApiOperation("撤销文件资源")
@PostMapping(value = "/share/cancelFileResource")
public ResultVo cancelFileResource(@RequestBody IdVo vo) {
AssertUtils.notEmpty(vo.getIds(), "至少选择一项");
AssertUtils.hasText(vo.getNote(), "原因不能为空");
fileResourceService.cancelFileResource(vo.getIds(), vo.getNote());
return ResultVo.success();
}
}
......@@ -36,7 +36,7 @@ public class StandardDataController {
@ApiOperation("添加数据元")
@PostMapping(value = "/addStandardData")
public ResultVo addStandardData(@RequestBody StandardData vo) {
AssertUtils.notNull(vo.getCategoryId(), "缺少领域ID");
AssertUtils.notNull(vo.getCategoryId(), "缺少目录ID");
AssertUtils.hasText(vo.getStandardName(), "缺少数据源名称");
AssertUtils.hasText(vo.getStandardDataType(), "缺少数据元类型");
AssertUtils.hasText(vo.getStandardDataLength(), "缺少数据元长度");
......@@ -45,7 +45,7 @@ public class StandardDataController {
AssertUtils.hasText(vo.getEnglishName(), "缺少英文名");
AssertUtils.hasText(vo.getStandardLevel(), "缺少标准级别");
AssertUtils.hasText(vo.getIdentification(), "缺少内部标识");
AssertUtils.notNull(vo.getNotNull(), "缺少是否非空");
AssertUtils.notNull(vo.getIsNull(), "缺少是否非空");
AssertUtils.hasText(vo.getStandardNum(), "缺少数据标准编目");
AssertUtils.hasText(vo.getLabel(), "缺少编目名称");
AssertUtils.hasText(vo.getCategoryNum(), "缺少所属领域编码");
......@@ -108,11 +108,11 @@ public class StandardDataController {
AssertUtils.hasText(vo.getStandardId(), "缺少数据元ID");
AssertUtils.hasText(vo.getTableName(), "缺少表名");
AssertUtils.hasText(vo.getTableSqlname(), "缺少数据库表名");
AssertUtils.hasText(vo.getFieldName(), "缺少列名");
AssertUtils.hasText(vo.getFieldType(), "缺少列类型");
AssertUtils.notNull(vo.getLength(), "缺少列长度");
AssertUtils.notNull(vo.getFieldPrecision(), "缺少列精度");
AssertUtils.notNull(vo.getIsPk(), "确实是否主键");
// AssertUtils.hasText(vo.getFieldName(), "缺少列名");
// AssertUtils.hasText(vo.getFieldType(), "缺少列类型");
// AssertUtils.notNull(vo.getLength(), "缺少列长度");
// AssertUtils.notNull(vo.getFieldPrecision(), "缺少列精度");
// AssertUtils.notNull(vo.getIsPk(), "确实是否主键");
AssertUtils.hasText(vo.getStandardNum(), "缺少数据标准编目");
AssertUtils.hasText(vo.getConnecttionName(), "缺少数据源名称");
AssertUtils.hasText(vo.getCreditCode(), "缺少统一信用码");
......
......@@ -31,7 +31,7 @@ public class AreaApi {
@ApiOperation("指定条件获取区域列表")
@PostMapping(value = "/getAreaList")
public ResultVo<List<SystemArea>> getAreaList(@RequestBody SystemArea vo) {
public ResultVo<List<SystemArea>> getAreaList(@RequestBody SystemArea vo, String id) {
return ResultVo.success(areaService.getAreaList(vo));
}
......
package com.zq.resource.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.resource.entity.CategoryInterfaceInput;
import org.springframework.stereotype.Repository;
/**
* 接口资源-输入参数(CategoryInterfaceInput)表数据库访问层
*
* @author makejava
* @since 2021-09-14 10:04:18
*/
@Repository
public interface CategoryInterfaceInputDao extends BaseMapper<CategoryInterfaceInput> {
}
\ No newline at end of file
package com.zq.resource.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.resource.entity.CategoryInterfaceOutput;
import org.springframework.stereotype.Repository;
/**
* 接口资源-输出参数(CategoryInterfaceOutput)表数据库访问层
*
* @author makejava
* @since 2021-09-14 10:04:18
*/
@Repository
public interface CategoryInterfaceOutputDao extends BaseMapper<CategoryInterfaceOutput> {
}
\ No newline at end of file
package com.zq.resource.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.resource.entity.DataCategoryItem;
import com.zq.resource.entity.FileResource;
import org.springframework.stereotype.Repository;
/**
* 资源目录管理表(DataCategoryItem)表数据库访问层
* 文件资源(FileResource)表数据库访问层
*
* @author makejava
* @since 2021-08-31 15:23:37
* @since 2021-09-13 17:59:17
*/
@Repository
public interface DataCategoryItemDao extends BaseMapper<DataCategoryItem> {
public interface FileResourceDao extends BaseMapper<FileResource> {
}
\ No newline at end of file
......@@ -150,4 +150,8 @@ public class CategoryInterface {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录名称")
@TableField(exist = false)
private String categoryName;
}
\ No newline at end of file
......@@ -72,4 +72,8 @@ public class CategoryInterfaceAttach {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("接口资源名称")
@TableField(exist = false)
private String categoryInterfaceName;
}
\ No newline at end of file
......@@ -9,63 +9,58 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* 资源目录管理表(DataCategory)实体类
* 接口资源-输入参数(CategoryInterfaceInput)实体类
*
* @author makejava
* @since 2021-08-31 15:23:37
* @since 2021-09-14 10:04:18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "DATA_CATEGORY_ITEM", schema = "ZY")
public class DataCategoryItem {
@TableName(value = "CATEGORY_INTERFACE_INPUT", schema = "ZY")
public class CategoryInterfaceInput {
/**
* ID
* 自增
*/
@ApiModelProperty("ID")
@ApiModelProperty("自增")
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 目录ID
* 参数字段名
*/
@ApiModelProperty("目录ID")
private String categoryId;
@ApiModelProperty("参数字段名")
private String paramName;
/**
* 信息项名称
* 参数类型
*/
@ApiModelProperty("信息项名称")
private String cnName;
@ApiModelProperty("参数类型")
private String paramType;
/**
* 数据类型编码(见附录数据字典.数据类型)
* 是否必填
*/
@ApiModelProperty("数据类型编码(见附录数据字典.数据类型)")
private String dataFormat;
@ApiModelProperty("是否必填")
private BigDecimal mustfill;
/**
* 数据长度
* 参数描述
*/
@ApiModelProperty("数据长度")
private Integer length;
@ApiModelProperty("参数描述")
private String remark;
/**
* 数值类型选填精度
* 接口资源ID
*/
@ApiModelProperty("数值类型选填精度")
private String fieldPrecision;
/**
* 排序编号
*/
@ApiModelProperty("排序编号")
private Integer orderId;
@ApiModelProperty("接口资源ID")
private String categoryInterfaceId;
/**
* 创建时间
......@@ -78,4 +73,5 @@ public class DataCategoryItem {
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.vo;
package com.zq.resource.entity;
import com.zq.common.vo.PageReqVo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -10,56 +12,59 @@ import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源目录管理表(DataCategory)实体类
* 接口资源-输出参数(CategoryInterfaceOutput)实体类
*
* @author makejava
* @since 2021-08-31 15:23:37
* @since 2021-09-14 10:04:18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DataCategoryItemFindVo extends PageReqVo {
@TableName(value = "CATEGORY_INTERFACE_OUTPUT", schema = "ZY")
public class CategoryInterfaceOutput {
/**
* ID
* 自增
*/
@ApiModelProperty("ID")
@ApiModelProperty("自增")
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 信息项名称
* 参数字段名
*/
@ApiModelProperty("信息项名称")
private String cnName;
@ApiModelProperty("参数字段名")
private String paramName;
/**
* 数据类型编码(见附录数据字典.数据类型)
* 参数类型
*/
@ApiModelProperty("数据类型编码(见附录数据字典.数据类型)")
private String dataFormat;
@ApiModelProperty("参数类型")
private String paramType;
/**
* 数据长度
* 参数描述
*/
@ApiModelProperty("数据长度")
private Integer length;
@ApiModelProperty("参数描述")
private String remark;
/**
* 数值类型选填精度
* 接口资源ID
*/
@ApiModelProperty("数值类型选填精度")
private String fieldPrecision;
@ApiModelProperty("接口资源ID")
private String categoryInterfaceId;
/**
* 排序编号
* 创建时间
*/
@ApiModelProperty("排序编号")
private Integer orderId;
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
......@@ -72,4 +72,7 @@ public class CodeItem {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("代码项主项名称")
@TableField(exist = false)
private String codeMainName;
}
\ No newline at end of file
......@@ -78,4 +78,12 @@ public class CodeMain {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("系统名称")
@TableField(exist = false)
private String systemName;
@ApiModelProperty("部门名称")
@TableField(exist = false)
private String deptName;
}
\ No newline at end of file
......@@ -30,15 +30,9 @@ public class DataCategory {
private String id;
/**
* 国家平台目录ID区共享平台返回的目录ID,UUID
* 目录分类ID
*/
@ApiModelProperty("国家平台目录ID区共享平台返回的目录ID,UUID")
private String cataId;
/**
* 区共享平台返回的目录分类ID
*/
@ApiModelProperty("区共享平台返回的目录分类ID")
@ApiModelProperty("目录分类ID")
private String groupId;
/**
......@@ -185,4 +179,12 @@ public class DataCategory {
@ApiModelProperty("注册接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录分类名称")
@TableField(exist = false)
private String groupName;
@ApiModelProperty("目录分类授权部门名称")
@TableField(exist = false)
private String deptName;
}
\ No newline at end of file
......@@ -83,4 +83,12 @@ public class DataCategoryGroup {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("父目录分类名称")
@TableField(exist = false)
private String parentName;
@ApiModelProperty("目录分类授权部门名称")
@TableField(exist = false)
private String deptName;
}
\ No newline at end of file
......@@ -108,4 +108,12 @@ public class DbInfo {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录名称")
@TableField(exist = false)
private String categoryName;
@ApiModelProperty("系统名称")
@TableField(exist = false)
private String systemName;
}
\ No newline at end of file
......@@ -66,4 +66,8 @@ public class DeptLiability {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("职责名称")
@TableField(exist = false)
private String deptDutyName;
}
\ No newline at end of file
package com.zq.resource.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;
/**
* 文件资源(FileResource)实体类
*
* @author makejava
* @since 2021-09-13 17:59:17
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "FILE_RESOURCE", schema = "ZY")
public class FileResource {
/**
* ID
*/
@ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 目录ID
*/
@ApiModelProperty("目录ID")
private String categoryId;
/**
* 数据字典:主题分类
*/
@ApiModelProperty("数据字典:主题分类")
private String business;
/**
* 是否使用sftp
*/
@ApiModelProperty("是否使用sftp")
private Integer isSftp;
/**
* 描述
*/
@ApiModelProperty("描述")
private String remark;
/**
* ftp服务器IP
*/
@ApiModelProperty("ftp服务器IP")
private String ftpIp;
/**
* ftp服务器端口
*/
@ApiModelProperty("ftp服务器端口")
private String ftpPort;
/**
* ftp账号
*/
@ApiModelProperty("ftp账号")
private String ftpUser;
/**
* ftp密码
*/
@ApiModelProperty("ftp密码")
private String ftpPwd;
/**
* 文件名称
*/
@ApiModelProperty("文件名称")
private String folderName;
/**
* 创建时间
*/
@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;
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ public class StandardCategoryName {
* 是否通用
*/
@ApiModelProperty("是否通用")
private Boolean isGeneral;
private Integer isGeneral;
/**
* 区平台对应的领域编码
......
......@@ -30,12 +30,24 @@ public class StandardData {
private String id;
/**
* 所属领域id
* 目录ID
*/
@ApiModelProperty("所属领域id")
@ApiModelProperty("目录ID")
private String categoryId;
/**
* 表映射ID
*/
@ApiModelProperty("表映射ID")
private String mappingId;
/**
* 信息项ID
*/
@ApiModelProperty("信息项ID")
private String infoItemId;
/**
* 数据元名称
*/
@ApiModelProperty("数据元名称")
......@@ -84,10 +96,22 @@ public class StandardData {
private String identification;
/**
* 是否
* 是否允许为
*/
@ApiModelProperty("是否非空")
private String notNull;
@ApiModelProperty("是否允许为空")
private Integer isNull;
/**
* 是否主键
*/
@ApiModelProperty("是否主键")
private Integer isPk;
/**
* 排序编号,默认为0
*/
@ApiModelProperty("排序编号,默认为0")
private Integer orderNum;
/**
* 数据标准编目
......@@ -132,4 +156,8 @@ public class StandardData {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录名称")
@TableField(exist = false)
private String categoryName;
}
\ No newline at end of file
......@@ -81,7 +81,7 @@ public class StandardDataMapping {
* 是否主键
*/
@ApiModelProperty("是否主键")
private Boolean isPk;
private Integer isPk;
/**
* 数据标准编目
......@@ -139,9 +139,18 @@ public class StandardDataMapping {
private String cascadeguid;
/**
* 是否在库表资源注册: 0-未注册 1-已注册
* 注册接口返回的ID
*/
@ApiModelProperty("是否在库表资源注册: 0-未注册 1-已注册")
private Integer regTableState;
@ApiModelProperty("注册库表接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String tableCascadeguid;
@ApiModelProperty("数据库名称")
@TableField(exist = false)
private String dbName;
@ApiModelProperty("数据元名称")
@TableField(exist = false)
private String standardName;
}
\ No newline at end of file
......@@ -114,4 +114,8 @@ public class SystemInfo {
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
@ApiModelProperty("目录分类授权部门名称")
@TableField(exist = false)
private String deptName;
}
\ No newline at end of file
......@@ -12,11 +12,14 @@ import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.config.ShareApiConfig;
import com.zq.resource.constant.ShareApiEnum;
import com.zq.resource.dao.*;
import com.zq.resource.dao.DataCategoryDao;
import com.zq.resource.dao.DataCategoryGroupDao;
import com.zq.resource.dao.OrgDeptDao;
import com.zq.resource.dao.StandardDataDao;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.entity.DataCategoryGroup;
import com.zq.resource.entity.DataCategoryItem;
import com.zq.resource.entity.OrgDept;
import com.zq.resource.entity.StandardData;
import com.zq.resource.utils.ShareApiUtils;
import com.zq.resource.utils.TreeUtils;
import com.zq.resource.vo.*;
......@@ -37,10 +40,8 @@ public class CategoryService {
private final DataCategoryDao dataCategoryDao;
private final DataCategoryGroupDao dataCategoryGroupDao;
private final DataCategoryItemDao dataCategoryItemDao;
private final StandardDataDao standardDataDao;
private final OrgDeptDao orgDeptDao;
private final CategoryInterfaceDao categoryInterfaceDao;
private final CategoryInterfaceAttachDao categoryInterfaceAttachDao;
private final ShareApiConfig shareApiConfig;
public PageVo<DataCategory> getCategoryList(DataCategoryFindVo vo) {
......@@ -50,8 +51,14 @@ public class CategoryService {
lambdaQuery.like(DataCategory::getCataTitle, vo.getCataTitle());
vo.setCataTitle(null);
}
return PagingUtils.paging(vo, dataCategoryDao, DataCategory.class, lambdaQuery);
PageVo<DataCategory> paging = PagingUtils.paging(vo, dataCategoryDao, DataCategory.class, lambdaQuery);
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) {
......@@ -173,18 +180,18 @@ public class CategoryService {
* @return
*/
public List<Map<String, Object>> getColumnList(String categoryId) {
List<DataCategoryItem> dataCategoryItemList = dataCategoryItemDao.selectList(Wrappers.lambdaQuery(DataCategoryItem.builder().build()));
List<StandardData> standardDataList = standardDataDao.selectList(Wrappers.lambdaQuery(StandardData.builder().categoryId(categoryId).build()));
List<Map<String, Object>> itemList = new ArrayList<>();
for (DataCategoryItem dataCategoryItem : dataCategoryItemList) {
for (StandardData standardData : standardDataList) {
Map<String, Object> dataItem = new HashMap<>();
dataItem.put("columnid", dataCategoryItem.getId());
dataItem.put("namecn", dataCategoryItem.getCnName());
dataItem.put("dataformat", dataCategoryItem.getDataFormat());
dataItem.put("length", dataCategoryItem.getLength());
dataItem.put("precision", dataCategoryItem.getFieldPrecision());
dataItem.put("order_id", dataCategoryItem.getOrderId());
dataItem.put("updatetime", dataCategoryItem.getUpdateTime());
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);
}
......@@ -221,11 +228,12 @@ public class CategoryService {
dataCategoryDao.updateById(dataCategory);
List<DataCategoryItem> dataCategoryItemList = dataCategoryItemDao.selectList(Wrappers.lambdaQuery(DataCategoryItem.builder().categoryId(dataCategory.getId()).build()));
for (DataCategoryItem dataCategoryItem : dataCategoryItemList) {
dataCategoryItemDao.update(null, Wrappers.lambdaUpdate(DataCategoryItem.class)
.set(DataCategoryItem::getId, IdUtil.randomUUID())
.eq(DataCategoryItem::getId, dataCategoryItem.getId()));
List<StandardData> standardDataList = standardDataDao.selectList(Wrappers.lambdaQuery(StandardData.builder().categoryId(dataCategory.getId()).build()));
for (StandardData standardData : standardDataList) {
standardData.setInfoItemId(IdUtil.randomUUID());
standardData.setUpdateTime(DateUtil.date());
standardDataDao.updateById(standardData);
}
}
}
......@@ -325,7 +333,16 @@ public class CategoryService {
vo.setRemark(null);
}
return PagingUtils.paging(vo, dataCategoryGroupDao, DataCategoryGroup.class, lambdaQuery);
PageVo<DataCategoryGroup> paging = PagingUtils.paging(vo, dataCategoryGroupDao, DataCategoryGroup.class, lambdaQuery);
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 void registerCategoryGroup(Set<String> ids) {
......@@ -393,47 +410,4 @@ public class CategoryService {
return TreeUtils.buildTree(collect, null);
}
public PageVo<DataCategoryItem> getCategoryItemList(DataCategoryItemFindVo vo) {
LambdaQueryWrapper<DataCategoryItem> lambdaQuery = Wrappers.lambdaQuery(DataCategoryItem.class);
if (StringUtils.isNotBlank(vo.getCnName())) {
lambdaQuery.like(DataCategoryItem::getCnName, vo.getCnName());
vo.setCnName(null);
}
return PagingUtils.paging(vo, dataCategoryItemDao, DataCategoryItem.class, lambdaQuery);
}
public DataCategoryItem getCategoryItemInfo(String id) {
return dataCategoryItemDao.selectById(id);
}
public void addCategoryItem(DataCategoryItem vo) {
DataCategory dataCategory = dataCategoryDao.selectById(vo.getCategoryId());
AssertUtils.notNull(dataCategory, "目录不存在");
if (vo.getOrderId() == null) {
vo.setOrderId(0);
}
vo.setId(IdUtil.randomUUID());
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
dataCategoryItemDao.insert(vo);
}
public void modifyCategoryItem(DataCategoryItem vo) {
DataCategoryItem dataCategoryItem = dataCategoryItemDao.selectById(vo.getId());
AssertUtils.notNull(dataCategoryItem, "无此信息项");
dataCategoryItem.setCnName(vo.getCnName());
dataCategoryItem.setDataFormat(vo.getDataFormat());
dataCategoryItem.setLength(vo.getLength());
dataCategoryItem.setFieldPrecision(vo.getFieldPrecision());
dataCategoryItem.setOrderId(vo.getOrderId());
dataCategoryItem.setUpdateTime(vo.getUpdateTime());
dataCategoryItemDao.updateById(dataCategoryItem);
}
}
......@@ -10,9 +10,11 @@ import com.zq.resource.constant.ShareApiEnum;
import com.zq.resource.dao.CodeItemDao;
import com.zq.resource.dao.CodeMainDao;
import com.zq.resource.dao.OrgDeptDao;
import com.zq.resource.dao.SystemInfoDao;
import com.zq.resource.entity.CodeItem;
import com.zq.resource.entity.CodeMain;
import com.zq.resource.entity.OrgDept;
import com.zq.resource.entity.SystemInfo;
import com.zq.resource.utils.ShareApiUtils;
import com.zq.resource.vo.CodeItemFindVo;
import com.zq.resource.vo.CodeMainFindVo;
......@@ -35,8 +37,14 @@ public class CodeService {
private final CodeMainDao codeMainDao;
private final CodeItemDao codeItemDao;
private final OrgDeptDao orgDeptDao;
private final SystemInfoDao systemInfoDao;
public void addCodeMain(CodeMain vo) {
SystemInfo systemInfo = systemInfoDao.selectById(vo.getAppId());
AssertUtils.notNull(systemInfo, "系统不存在");
OrgDept orgDept = orgDeptDao.selectById(vo.getDeptId());
AssertUtils.notNull(orgDept, "机构不存在");
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
......@@ -46,6 +54,10 @@ public class CodeService {
public void modifyCodeMain(CodeMain vo) {
CodeMain codeMain = codeMainDao.selectById(vo.getId());
AssertUtils.notNull(codeMain, "无此代码主项");
if (StringUtils.isNotBlank(vo.getAppId())) {
SystemInfo systemInfo = systemInfoDao.selectById(vo.getAppId());
AssertUtils.notNull(systemInfo, "系统不存在");
}
codeMain.setDeptId(vo.getDeptId());
codeMain.setAppId(vo.getAppId());
......@@ -68,7 +80,14 @@ public class CodeService {
vo.setDescription(null);
}
return PagingUtils.paging(vo, codeMainDao, CodeMain.class, lambdaQuery);
PageVo<CodeMain> paging = PagingUtils.paging(vo, codeMainDao, CodeMain.class, lambdaQuery);
paging.getRows().forEach(codeMain -> {
OrgDept orgDept = orgDeptDao.selectById(codeMain.getDeptId());
codeMain.setDeptName(orgDept.getDeptName());
SystemInfo systemInfo = systemInfoDao.selectById(codeMain.getAppId());
codeMain.setSystemName(systemInfo.getSystemName());
});
return paging;
}
public CodeMain getCodeMainInfo(String codeMainId) {
......@@ -143,7 +162,12 @@ public class CodeService {
vo.setItemText(null);
}
return PagingUtils.paging(vo, codeItemDao, CodeItem.class, lambdaQuery);
PageVo<CodeItem> paging = PagingUtils.paging(vo, codeItemDao, CodeItem.class, lambdaQuery);
paging.getRows().forEach(codeItem -> {
CodeMain codeMain = codeMainDao.selectById(codeItem.getCodeMainId());
codeItem.setCodeMainName(codeMain.getCodeName());
});
return paging;
}
public CodeItem getCodeItemInfo(String codeItemId) {
......
......@@ -17,10 +17,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author wilmiam
......@@ -83,7 +80,14 @@ public class DbInfoService {
vo.setRemark(null);
}
return PagingUtils.paging(vo, dbInfoDao, DbInfo.class, lambdaQuery);
PageVo<DbInfo> paging = PagingUtils.paging(vo, dbInfoDao, DbInfo.class, lambdaQuery);
paging.getRows().forEach(dbInfo -> {
DataCategory dataCategory = dataCategoryDao.selectById(dbInfo.getCategoryId());
dbInfo.setCategoryName(dataCategory.getCataTitle());
SystemInfo systemInfo = systemInfoDao.selectById(dbInfo.getSystemId());
dbInfo.setSystemName(systemInfo.getSystemName());
});
return paging;
}
public List<DbInfo> getAllDbInfoList(DbInfoFindVo vo) {
......@@ -111,16 +115,16 @@ public class DbInfoService {
return dbInfoDao.selectById(id);
}
public void registerDbInfo(Set<String> ids, String mappingId) {
public void registerDbInfo(Set<String> ids) {
for (String id : ids) {
DbInfo dbInfo = dbInfoDao.selectById(id);
if (dbInfo != null && StringUtils.isBlank(dbInfo.getCascadeguid())) {
StandardDataMapping standardDataMapping = standardDataMappingDao.selectById(id);
if (standardDataMapping != null && StringUtils.isBlank(standardDataMapping.getTableCascadeguid())) {
DbInfo dbInfo = dbInfoDao.selectById(standardDataMapping.getDbId());
DataCategory dataCategory = dataCategoryDao.selectById(dbInfo.getCategoryId());
AssertUtils.hasText(dataCategory.getCascadeguid(), "目录未注册");
SystemInfo systemInfo = systemInfoDao.selectById(dbInfo.getSystemId());
AssertUtils.hasText(systemInfo.getCascadeguid(), "系统未注册");
OrgDept orgDept = orgDeptDao.selectById(dataCategory.getDeptId());
StandardDataMapping standardDataMapping = standardDataMappingDao.selectById(mappingId);
Map<String, Object> params = new HashMap<>();
params.put("resource_name", dataCategory.getCataTitle());
......@@ -139,12 +143,7 @@ public class DbInfoService {
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.TABLE_REGISTER);
if (shareApiResponse.isSuccess()) {
dbInfo.setCascadeguid(shareApiResponse.getString("cascadeguid"));
dbInfo.setUpdateTime(DateUtil.date());
dbInfoDao.updateById(dbInfo);
standardDataMapping.setRegTableState(1);
standardDataMapping.setTableCascadeguid(shareApiResponse.getString("cascadeguid"));
standardDataMapping.setUpdateTime(DateUtil.date());
standardDataMappingDao.updateById(standardDataMapping);
}
......@@ -153,13 +152,45 @@ public class DbInfoService {
}
public Map<String, Object> getTableJson(StandardDataMapping standardDataMapping) {
standardDataDao.selectList(Wrappers.lambdaQuery(StandardData.builder().build()));
return null;
Map<String, Object> tableParams = new HashMap<>();
tableParams.put("table_name", standardDataMapping.getTableName());
tableParams.put("table_sqlname", standardDataMapping.getTableSqlname());
List<StandardData> standardDataList = standardDataDao.selectList(Wrappers.lambdaQuery(StandardData.builder().mappingId(standardDataMapping.getId()).build()));
ArrayList<Map<String, Object>> columnsList = new ArrayList<>();
for (StandardData standardData : standardDataList) {
Map<String, Object> columnsParams = new HashMap<>();
columnsParams.put("desc", standardData.getStandardName());
columnsParams.put("name", standardData.getEnglishName());
columnsParams.put("type", standardData.getStandardDataType());
columnsParams.put("length", standardData.getStandardDataLength());
columnsParams.put("precision", standardData.getFieldPrecision());
columnsParams.put("is_pk", standardData.getIsPk());
columnsParams.put("is_null", standardData.getIsNull());
columnsParams.put("columnid", standardData.getInfoItemId());
columnsList.add(columnsParams);
}
tableParams.put("table_columns", columnsList);
return tableParams;
}
public void cancelDbInfo(Set<String> ids) {
public void cancelDbInfo(Set<String> ids, String note) {
for (String id : ids) {
StandardDataMapping standardDataMapping = standardDataMappingDao.selectById(id);
if (standardDataMapping != null && StringUtils.isNotBlank(standardDataMapping.getTableCascadeguid())) {
Map<String, Object> params = new HashMap<>();
params.put("table_id", standardDataMapping.getTableCascadeguid());
params.put("note", note);
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.TABLE_CANCEL);
if (shareApiResponse.isSuccess()) {
standardDataMapping.setTableCascadeguid("");
standardDataMapping.setUpdateTime(DateUtil.date());
standardDataMappingDao.updateById(standardDataMapping);
}
}
}
}
}
......@@ -114,7 +114,12 @@ public class DeptDutyService {
lambdaQuery.like(DeptLiability::getBusinessName, vo.getKeyword());
}
return PagingUtils.paging(vo, deptLiabilityDao, lambdaQuery);
PageVo<DeptLiability> paging = PagingUtils.paging(vo, deptLiabilityDao, lambdaQuery);
paging.getRows().forEach(deptLiability -> {
DeptDuty deptDuty = deptDutyDao.selectById(deptLiability.getDeptDutyId());
deptLiability.setDeptDutyName(deptDuty.getDuties());
});
return paging;
}
public DeptLiability getDeptLiabilityInfo(String liabilityId) {
......@@ -165,6 +170,10 @@ public class DeptDutyService {
deptLiabilityLabelDao.updateById(deptLiabilityLabel);
}
public void deleteDeptLiabilityLabel(String id) {
deptLiabilityLabelDao.deleteById(id);
}
public PageVo<DeptLiabilityLabel> getDeptLiabilityLabelList(KeywordFindVo vo) {
LambdaQueryWrapper<DeptLiabilityLabel> lambdaQuery = Wrappers.lambdaQuery(DeptLiabilityLabel.builder().deptLiabilityId(vo.getAssocId()).build());
......
package com.zq.resource.service;
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.resource.constant.ShareApiEnum;
import com.zq.resource.dao.DataCategoryDao;
import com.zq.resource.dao.FileResourceDao;
import com.zq.resource.dao.OrgDeptDao;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.entity.FileResource;
import com.zq.resource.entity.OrgDept;
import com.zq.resource.utils.ShareApiUtils;
import com.zq.resource.vo.FileResourceFindVo;
import com.zq.resource.vo.ShareApiResponse;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* @author wilmiam
* @since 2021-09-13 18:12
*/
@Service
@RequiredArgsConstructor
public class FileResourceService {
private final FileResourceDao fileResourceDao;
private final DataCategoryDao dataCategoryDao;
private final OrgDeptDao orgDeptDao;
public void addFileResource(FileResource vo) {
DataCategory dataCategory = dataCategoryDao.selectById(vo.getCategoryId());
AssertUtils.notNull(dataCategory, "目录不存在");
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
fileResourceDao.insert(vo);
}
public void modifyFileResource(FileResource vo) {
FileResource fileResource = fileResourceDao.selectById(vo.getId());
AssertUtils.notNull(fileResource, "文件不存在");
fileResource.setState(vo.getState());
fileResource.setCategoryId(vo.getCategoryId());
fileResource.setBusiness(vo.getBusiness());
fileResource.setIsSftp(vo.getIsSftp());
fileResource.setRemark(vo.getRemark());
fileResource.setFtpIp(vo.getFtpIp());
fileResource.setFtpPort(vo.getFtpPort());
fileResource.setFtpUser(vo.getFtpUser());
fileResource.setFtpPwd(vo.getFtpPwd());
fileResource.setFolderName(vo.getFolderName());
fileResource.setUpdateTime(DateUtil.date());
fileResourceDao.updateById(fileResource);
}
public PageVo<FileResource> getFileResourceList(FileResourceFindVo vo) {
LambdaQueryWrapper<FileResource> lambdaQuery = Wrappers.lambdaQuery(FileResource.class);
if (StringUtils.isNotBlank(vo.getFolderName())) {
lambdaQuery.like(FileResource::getFolderName, vo.getFolderName());
vo.setFolderName(null);
}
PageVo<FileResource> paging = PagingUtils.paging(vo, fileResourceDao, FileResource.class, lambdaQuery);
paging.getRows().forEach(fileResource -> {
DataCategory dataCategory = dataCategoryDao.selectById(fileResource.getCategoryId());
fileResource.setCategoryName(dataCategory.getCataTitle());
});
return paging;
}
public FileResource getFileResourceInfo(String id) {
return fileResourceDao.selectById(id);
}
public void registerFileResource(Set<String> ids) {
for (String id : ids) {
FileResource fileResource = fileResourceDao.selectById(id);
if (fileResource != null && StringUtils.isBlank(fileResource.getCascadeguid())) {
DataCategory dataCategory = dataCategoryDao.selectById(fileResource.getCategoryId());
AssertUtils.hasText(dataCategory.getCascadeguid(), "目录未注册");
OrgDept orgDept = orgDeptDao.selectById(dataCategory.getDeptId());
Map<String, Object> params = new HashMap<>();
params.put("resource_name", dataCategory.getCataTitle());
params.put("cata_id", dataCategory.getCascadeguid());
params.put("resour_system_id", "");
params.put("credit_code", orgDept.getCreditCode());
params.put("business", fileResource.getBusiness());
params.put("issftp", fileResource.getIsSftp());
params.put("remark", fileResource.getRemark());
params.put("ftp_ip", fileResource.getFtpIp());
params.put("ftp_port", fileResource.getFtpPort());
params.put("ftp_user", fileResource.getFtpUser());
params.put("ftp_pwd", fileResource.getFtpPwd());
params.put("folder_name", fileResource.getFolderName());
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.FILE_REGISTER);
if (shareApiResponse.isSuccess()) {
fileResource.setCascadeguid(shareApiResponse.getString("cascadeguid"));
fileResource.setUpdateTime(DateUtil.date());
fileResourceDao.updateById(fileResource);
}
}
}
}
public void cancelFileResource(Set<String> ids, String note) {
for (String id : ids) {
FileResource fileResource = fileResourceDao.selectById(id);
if (fileResource != null && StringUtils.isNotBlank(fileResource.getCascadeguid())) {
Map<String, Object> params = new HashMap<>();
params.put("file_id", fileResource.getCascadeguid());
params.put("note", note);
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.FILE_CANCEL);
if (shareApiResponse.isSuccess()) {
fileResource.setCascadeguid("");
fileResource.setUpdateTime(DateUtil.date());
fileResourceDao.updateById(fileResource);
}
}
}
}
}
......@@ -2,20 +2,15 @@ package com.zq.resource.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
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.resource.constant.ShareApiEnum;
import com.zq.resource.dao.DbInfoDao;
import com.zq.resource.dao.StandardCategoryNameDao;
import com.zq.resource.dao.StandardDataDao;
import com.zq.resource.dao.StandardDataMappingDao;
import com.zq.resource.entity.DbInfo;
import com.zq.resource.entity.StandardCategoryName;
import com.zq.resource.entity.StandardData;
import com.zq.resource.entity.StandardDataMapping;
import com.zq.resource.dao.*;
import com.zq.resource.entity.*;
import com.zq.resource.utils.ShareApiUtils;
import com.zq.resource.utils.TreeUtils;
import com.zq.resource.vo.*;
......@@ -40,8 +35,14 @@ public class StandardDataService {
private final StandardDataMappingDao standardDataMappingDao;
private final StandardCategoryNameDao standardCategoryNameDao;
private final DbInfoDao dbInfoDao;
private final DataCategoryDao dataCategoryDao;
private final DataDictDao dataDictDao;
public void addStandardData(StandardData vo) {
DataCategory dataCategory = dataCategoryDao.selectById(vo.getCategoryId());
AssertUtils.notNull(dataCategory, "目录不存在");
vo.setInfoItemId(IdUtil.randomUUID());
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
......@@ -51,6 +52,8 @@ public class StandardDataService {
public void modifyStandardData(StandardData vo) {
StandardData standardData = standardDataDao.selectById(vo.getId());
AssertUtils.notNull(standardData, "无此数据元");
DataCategory dataCategory = dataCategoryDao.selectById(vo.getCategoryId());
AssertUtils.notNull(dataCategory, "目录不存在");
standardData.setCategoryId(vo.getCategoryId());
standardData.setStandardName(vo.getStandardName());
......@@ -61,7 +64,9 @@ public class StandardDataService {
standardData.setEnglishName(vo.getEnglishName());
standardData.setStandardLevel(vo.getStandardLevel());
standardData.setIdentification(vo.getIdentification());
standardData.setNotNull(vo.getNotNull());
standardData.setIsNull(vo.getIsNull());
standardData.setIsPk(vo.getIsPk());
standardData.setOrderNum(vo.getOrderNum());
standardData.setStandardNum(vo.getStandardNum());
standardData.setLabel(vo.getLabel());
standardData.setCategoryNum(vo.getCategoryNum());
......@@ -90,7 +95,12 @@ public class StandardDataService {
vo.setLabel(null);
}
return PagingUtils.paging(vo, standardDataDao, StandardData.class, lambdaQuery);
PageVo<StandardData> paging = PagingUtils.paging(vo, standardDataDao, StandardData.class, lambdaQuery);
paging.getRows().forEach(standardData -> {
DataCategory dataCategory = dataCategoryDao.selectById(standardData.getCategoryId());
standardData.setCategoryName(dataCategory.getCataTitle());
});
return paging;
}
public List<StandardData> getAllStandardDataList(StandardDataFindVo vo) {
......@@ -173,7 +183,14 @@ public class StandardDataService {
vo.setCreditCode(null);
}
return PagingUtils.paging(vo, standardDataMappingDao, StandardDataMapping.class, lambdaQuery);
PageVo<StandardDataMapping> paging = PagingUtils.paging(vo, standardDataMappingDao, StandardDataMapping.class, lambdaQuery);
paging.getRows().forEach(standardDataMapping -> {
DbInfo dbInfo = dbInfoDao.selectById(standardDataMapping.getDbId());
standardDataMapping.setDbName(dbInfo.getDbName());
StandardData standardData = standardDataDao.selectById(standardDataMapping.getStandardId());
standardDataMapping.setStandardName(standardData.getStandardName());
});
return paging;
}
public List<StandardDataMapping> getAllStandardDataMappingList(StandardDataMappingFindVo vo) {
......@@ -311,11 +328,11 @@ public class StandardDataService {
params.put("englishName", standardData.getEnglishName());
params.put("standardLevel", standardData.getStandardLevel());
params.put("identification", standardData.getIdentification());
params.put("notNull", standardData.getNotNull());
params.put("notNull", standardData.getIsNull());
params.put("standardNum", standardData.getStandardNum());
params.put("categoryName", standardData.getCategoryNum());
params.put("categoryName", "");
params.put("label", standardData.getLabel());
params.put("categoryNum", standardData.getCategoryId());
params.put("categoryNum", standardData.getCategoryNum());
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.STANDARD_ADD);
if (shareApiResponse.isSuccess()) {
......@@ -364,7 +381,7 @@ public class StandardDataService {
params.put("Fieldtype", standardDataMapping.getFieldType());
params.put("length", standardDataMapping.getLength());
params.put("precision", standardDataMapping.getFieldPrecision());
params.put("is_pk", standardDataMapping.getIsPk() ? 1 : 0);
params.put("is_pk", standardDataMapping.getIsPk());
params.put("standardNum", standardDataMapping.getStandardNum());
params.put("standardName", standardData.getStandardName());
params.put("connecttion_name", standardDataMapping.getConnecttionName());
......
......@@ -43,7 +43,12 @@ public class SystemInfoService {
vo.setSystemName(null);
}
return PagingUtils.paging(vo, systemInfoDao, SystemInfo.class, lambdaQuery);
PageVo<SystemInfo> paging = PagingUtils.paging(vo, systemInfoDao, SystemInfo.class, lambdaQuery);
paging.getRows().forEach(systemInfo -> {
OrgDept orgDept = orgDeptDao.selectById(systemInfo.getBelongDeptId());
systemInfo.setDeptName(orgDept.getDeptName());
});
return paging;
}
public List<SystemInfo> getAllSystemList(SystemInfoFindVo vo) {
......
package com.zq.resource.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;
/**
* 文件资源(FileResource)实体类
*
* @author makejava
* @since 2021-09-13 17:59:17
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class FileResourceFindVo extends PageReqVo {
/**
* ID
*/
@ApiModelProperty("ID")
private String id;
/**
* 目录ID
*/
@ApiModelProperty("目录ID")
private String categoryId;
/**
* 数据字典:主题分类
*/
@ApiModelProperty("数据字典:主题分类")
private String business;
/**
* 是否使用sftp
*/
@ApiModelProperty("是否使用sftp")
private Integer isSftp;
/**
* 描述
*/
@ApiModelProperty("描述")
private String remark;
/**
* ftp服务器IP
*/
@ApiModelProperty("ftp服务器IP")
private String ftpIp;
/**
* ftp服务器端口
*/
@ApiModelProperty("ftp服务器端口")
private String ftpPort;
/**
* ftp账号
*/
@ApiModelProperty("ftp账号")
private String ftpUser;
/**
* ftp密码
*/
@ApiModelProperty("ftp密码")
private String ftpPwd;
/**
* 文件名称
*/
@ApiModelProperty("文件名称")
private String folderName;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
private String cascadeguid;
}
\ No newline at end of file
package com.zq.resource.vo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -28,12 +30,24 @@ public class StandardDataFindVo extends PageReqVo {
private String id;
/**
* 所属领域id
* 目录ID
*/
@ApiModelProperty("所属领域id")
@ApiModelProperty("目录ID")
private String categoryId;
/**
* 表映射ID
*/
@ApiModelProperty("表映射ID")
private String mappingId;
/**
* 信息项ID
*/
@ApiModelProperty("信息项ID")
private String infoItemId;
/**
* 数据元名称
*/
@ApiModelProperty("数据元名称")
......@@ -82,10 +96,22 @@ public class StandardDataFindVo extends PageReqVo {
private String identification;
/**
* 是否非空
* 是否允许为空
*/
@ApiModelProperty("是否允许为空")
private Integer isNull;
/**
* 是否主键
*/
@ApiModelProperty("是否非空")
private Boolean notNull;
@ApiModelProperty("是否主键")
private Integer isPk;
/**
* 排序编号,默认为0
*/
@ApiModelProperty("排序编号,默认为0")
private Integer orderNum;
/**
* 数据标准编目
......@@ -117,4 +143,17 @@ public class StandardDataFindVo extends PageReqVo {
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 状态: 1-正常, 2-删除
*/
@ApiModelProperty("状态: 1-正常, 2-删除")
private Integer state;
/**
* 注册接口返回的ID
*/
@ApiModelProperty("注册接口返回的ID")
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
private String cascadeguid;
}
\ No newline at end of file
......@@ -6,9 +6,9 @@
<select id="getDeptLiabilityCategoryList" resultType="com.zq.resource.vo.DeptLiabilityCategoryVo">
SELECT LC.ID, LC.DEPT_LIABILITY_ID, LC.CATEGORY_ID, LC.CREATE_TIME, LC.UPDATE_TIME,
C.CATA_TITLE 'categoryName', L.BUSINESS_NAME 'deptLiabilityName'
FROM DEPT_LIABILITY_CATEGORY LC
LEFT JOIN DATA_CATEGORY C ON LC.CATEGORY_ID = C.ID
LEFT JOIN DEPT_LIABILITY L ON LC.DEPT_LIABILITY_ID = L.ID
FROM `ZY`.DEPT_LIABILITY_CATEGORY LC
LEFT JOIN `ZY`.DATA_CATEGORY C ON LC.CATEGORY_ID = C.ID
LEFT JOIN `ZY`.DEPT_LIABILITY L ON LC.DEPT_LIABILITY_ID = L.ID
<where>
<if test="id != null and id != ''">
AND LC.ID = #{id, jdbcType=VARCHAR}
......
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