Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # srt-cloud-data-governance/src/main/java/net/srt/controller/StandardController.java # srt-cloud-data-governance/src/main/java/net/srt/service/impl/MetadataServiceImpl.java # srt-cloud-data-service/src/main/java/net/srt/controller/ApiConfigController.java # srt-cloud-data-service/src/main/java/net/srt/controller/ApiGroupController.java # srt-cloud-data-service/src/main/java/net/srt/convert/DataServiceApiAuthConvert.java # srt-cloud-data-service/src/main/java/net/srt/dao/ApiConfigDao.java # srt-cloud-data-service/src/main/java/net/srt/dao/DataServiceApiAuthDao.java # srt-cloud-data-service/src/main/java/net/srt/dto/ApiConfigDto.java # srt-cloud-data-service/src/main/java/net/srt/dto/AppToken.java # srt-cloud-data-service/src/main/java/net/srt/dto/SqlDto.java # srt-cloud-data-service/src/main/java/net/srt/service/impl/ApiConfigServiceImpl.java # srt-cloud-data-service/src/main/java/net/srt/service/impl/ApiGroupServiceImpl.java # srt-cloud-data-service/src/main/resources/mapper/ApiConfigDao.xmldev
commit
efd89a17ab
2
pom.xml
2
pom.xml
|
@ -24,7 +24,7 @@
|
|||
<module>srt-cloud-gateway</module>
|
||||
<module>srt-data-development</module>
|
||||
<module>srt-cloud-data-governance</module>
|
||||
<module>srt-cloud-data-service</module>
|
||||
<module>srt-cloud-data-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -9,10 +9,7 @@ import net.srt.framework.common.utils.Result;
|
|||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.service.DatastandardService;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.MetamodelPropertyVO;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.MetadataCollectRecordConvert;
|
||||
import net.srt.entity.MetadataCollectRecordEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.MetadataCollectRecordQuery;
|
||||
import net.srt.service.MetadataCollectRecordService;
|
||||
import net.srt.vo.MetadataCollectRecordVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("metadata-collect-record")
|
||||
@Tag(name = "数据治理-元数据采集任务记录")
|
||||
@AllArgsConstructor
|
||||
public class MetadataCollectRecordController {
|
||||
private final MetadataCollectRecordService metadataCollectRecordService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<MetadataCollectRecordVO>> page(@Valid MetadataCollectRecordQuery query){
|
||||
PageResult<MetadataCollectRecordVO> page = metadataCollectRecordService.page(query);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<MetadataCollectRecordVO> get(@PathVariable Long id){
|
||||
MetadataCollectRecordEntity entity = metadataCollectRecordService.getById(id);
|
||||
return Result.ok(MetadataCollectRecordConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList) {
|
||||
metadataCollectRecordService.delete(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.MetadataStandardRelConvert;
|
||||
import net.srt.entity.MetadataStandardRelEntity;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.service.MetadataStandardRelService;
|
||||
import net.srt.vo.MetadataStandardRelVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("standard-rel")
|
||||
@Tag(name = "数据治理-元数据标准关联表")
|
||||
@AllArgsConstructor
|
||||
public class MetadataStandarRelController {
|
||||
private final MetadataStandardRelService metadataStandardRelService;
|
||||
|
||||
@GetMapping("/{metadataId}/{metadata-rel}")
|
||||
@Operation(summary = "根据metadataId获取标准字段")
|
||||
public Result<MetadataStandardRelVO> getMetadataRel(@PathVariable("metadataId") Long metadataId){
|
||||
MetadataStandardRelVO standardRelVO = metadataStandardRelService.getMetadataRel(metadataId);
|
||||
return Result.ok(standardRelVO);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<MetadataStandardRelVO> get(@PathVariable("id") Long id) {
|
||||
MetadataStandardRelEntity entity = metadataStandardRelService.getById(id);
|
||||
return Result.ok(MetadataStandardRelConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String> save(@RequestBody MetadataStandardRelVO vo){
|
||||
metadataStandardRelService.save(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{metadataId}/{standardId}")
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@PathVariable Long metadataId,@PathVariable Long standardId){
|
||||
metadataStandardRelService.delete(metadataId,standardId);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package net.srt.controller;
|
|||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.tags.Tags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.MetamodelConvert;
|
||||
import net.srt.entity.MetamodelEntity;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import cn.hutool.db.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import cn.hutool.db.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.srt.controller;
|
|||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.tags.Tags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.QualityTaskConvert;
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.srt.convert;
|
|||
|
||||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataCollectRecordDto;
|
||||
import net.srt.entity.MetadataCollectRecordEntity;
|
||||
import net.srt.vo.MetadataCollectRecordVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MetadataCollectRecordConvert {
|
||||
MetadataCollectRecordConvert INSTANCE = Mappers.getMapper(MetadataCollectRecordConvert.class);
|
||||
|
||||
MetadataCollectRecordEntity convert(MetadataCollectRecordVO vo);
|
||||
|
||||
MetadataCollectRecordEntity convert(DataGovernanceMetadataCollectRecordDto dto);
|
||||
|
||||
MetadataCollectRecordVO convert(MetadataCollectRecordEntity entity);
|
||||
|
||||
List<MetadataCollectRecordVO> convertList(List<MetadataCollectRecordEntity> list);
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ package net.srt.convert;
|
|||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataPropertyDto;
|
||||
import net.srt.entity.MetadataPropertyEntity;
|
||||
import net.srt.vo.MetadataPropertyVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.MetadataStandardRelEntity;
|
||||
import net.srt.vo.MetadataStandardRelVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MetadataStandardRelConvert {
|
||||
MetadataStandardRelConvert INSTANCE = Mappers.getMapper(MetadataStandardRelConvert.class);
|
||||
|
||||
MetadataStandardRelEntity convert(MetadataStandardRelVO vo);
|
||||
|
||||
MetadataStandardRelVO convert(MetadataStandardRelEntity entity);
|
||||
|
||||
List<MetadataStandardRelVO> convertList(List<MetadataStandardRelEntity> list);
|
||||
|
||||
}
|
|
@ -4,7 +4,6 @@ import net.srt.entity.MetamodelEntity;
|
|||
import net.srt.vo.MetamodelVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@Mapper
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.QualityQueryEntity;
|
||||
import net.srt.entity.QualityTaskColumnEntity;
|
||||
import net.srt.vo.QualityRuleVo;
|
||||
import net.srt.vo.QualityTaskColumnVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.controller.QualityTaskController;
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.MetadataCollectRecordEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MetadataCollectRecordDao extends BaseDao<MetadataCollectRecordEntity> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.MetadataStandardRelEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MetadataStandardRelDao extends BaseDao<MetadataStandardRelEntity> {
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.QualityTaskColumnEntity;
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_governance_metadata_collect_record")
|
||||
public class MetadataCollectRecordEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 采集任务id
|
||||
*/
|
||||
private Long metadataCollectId;
|
||||
|
||||
/**
|
||||
* 1-成功 0-失败 2-运行中
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 实时日志
|
||||
*/
|
||||
private String realTimeLog;
|
||||
|
||||
/**
|
||||
* 错误日志
|
||||
*/
|
||||
private String errorLog;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 项目(租户)id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_governance_standard")
|
||||
public class MetadataStandardEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 所属目录id
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 标准英文名称
|
||||
*/
|
||||
private String engName;
|
||||
|
||||
/**
|
||||
* 标准中文名称
|
||||
*/
|
||||
private String cnName;
|
||||
|
||||
/**
|
||||
* 编码数
|
||||
*/
|
||||
private Integer codeNum;
|
||||
|
||||
/**
|
||||
* 数据类型 数字,字符串,日期,小数
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private Integer dataLength;
|
||||
|
||||
/**
|
||||
* 精度
|
||||
*/
|
||||
private Integer dataPrecision;
|
||||
|
||||
/**
|
||||
* 非空 0-否 1-是
|
||||
*/
|
||||
private Integer nullable;
|
||||
|
||||
/**
|
||||
* 标准码表id
|
||||
*/
|
||||
private Integer standardCodeId;
|
||||
|
||||
/**
|
||||
* 1-标准字段 2-标准码表
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 项目(租户)id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_governance_metadata_standard_rel")
|
||||
public class MetadataStandardRelEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 元数据id
|
||||
*/
|
||||
private Long metadataId;
|
||||
|
||||
/**
|
||||
* 标准字段id
|
||||
*/
|
||||
private Long standardId;
|
||||
|
||||
/**
|
||||
* 真删除
|
||||
*/
|
||||
private Integer deleted;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package net.srt.init;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.srt.service.MetadataCollectRecordService;
|
||||
import net.srt.service.QualityTaskService;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class BusinessInitializer implements ApplicationRunner {
|
||||
|
||||
private final MetadataCollectRecordService metadataCollectRecordService;
|
||||
private final QualityTaskService qualityTaskService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
initScheduleMonitor();
|
||||
}
|
||||
|
||||
/**
|
||||
* init task monitor
|
||||
*/
|
||||
private void initScheduleMonitor() {
|
||||
//处理没执行完的采集任务
|
||||
metadataCollectRecordService.dealNotFinished();
|
||||
//处理没执行完的质量检测任务
|
||||
qualityTaskService.dealNotFinished();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package net.srt.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.common.query.Query;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "数据治理-源数据采集任务记录查询")
|
||||
public class MetadataCollectRecordQuery extends Query {
|
||||
private Long metadataCollectId;
|
||||
@Schema(description = "开始时间")
|
||||
@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
@Schema(description = "结束时间")
|
||||
@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
private Integer status;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.MetadataCollectQuery;
|
||||
import net.srt.entity.MetadataCollectRecordEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.MetadataCollectRecordQuery;
|
||||
import net.srt.vo.MetadataCollectRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MetadataCollectRecordService extends BaseService<MetadataCollectRecordEntity> {
|
||||
PageResult<MetadataCollectRecordVO> page(MetadataCollectRecordQuery query);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.MetadataStandardRelEntity;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.vo.MetadataStandardRelVO;
|
||||
|
||||
public interface MetadataStandardRelService extends BaseService<MetadataStandardRelEntity> {
|
||||
void delete(Long metadataId, Long standardId);
|
||||
|
||||
MetadataStandardRelVO getMetadataRel(Long metadataId);
|
||||
|
||||
void save(MetadataStandardRelVO vo);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.MetadataCollectRecordConvert;
|
||||
import net.srt.dao.MetadataCollectRecordDao;
|
||||
import net.srt.entity.MetadataCollectRecordEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.MetadataCollectRecordQuery;
|
||||
import net.srt.service.MetadataCollectRecordService;
|
||||
import net.srt.vo.MetadataCollectRecordVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MetadataCollectRecordServiceImpl extends BaseServiceImpl<MetadataCollectRecordDao, MetadataCollectRecordEntity> implements MetadataCollectRecordService {
|
||||
@Override
|
||||
public PageResult<MetadataCollectRecordVO> page(MetadataCollectRecordQuery query) {
|
||||
IPage<MetadataCollectRecordEntity> page = baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
return new PageResult<>(MetadataCollectRecordConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MetadataCollectRecordEntity> getWrapper(MetadataCollectRecordQuery query) {
|
||||
LambdaQueryWrapper<MetadataCollectRecordEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(query.getMetadataCollectId() != null,MetadataCollectRecordEntity::getMetadataCollectId,query.getMetadataCollectId())
|
||||
.eq(query.getStatus() != null, MetadataCollectRecordEntity::getStatus,query.getStatus())
|
||||
.gt(query.getStartTime()!=null,MetadataCollectRecordEntity::getStartTime,query.getStartTime())
|
||||
.lt(query.getEndTime()!=null,MetadataCollectRecordEntity::getEndTime,query.getEndTime())
|
||||
.orderByDesc(MetadataCollectRecordEntity::getId);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,8 +10,10 @@ import net.srt.api.module.data.governance.constant.MetadataCollectType;
|
|||
import net.srt.api.module.quartz.QuartzDataGovernanceMetadataCollectApi;
|
||||
import net.srt.convert.MetadataCollectConvert;
|
||||
import net.srt.dao.MetadataCollectDao;
|
||||
import net.srt.dao.MetadataCollectRecordDao;
|
||||
import net.srt.entity.MetadataCollectEntity;
|
||||
import net.srt.entity.MetadataCollectQuery;
|
||||
import net.srt.entity.MetadataCollectRecordEntity;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
|
@ -29,6 +31,7 @@ import java.util.List;
|
|||
public class MetadataCollectServiceImpl extends BaseServiceImpl<MetadataCollectDao, MetadataCollectEntity> implements MetadataCollectService {
|
||||
|
||||
private final QuartzDataGovernanceMetadataCollectApi metadataCollectApi;
|
||||
private final MetadataCollectRecordDao collectRecordDao;
|
||||
|
||||
@Override
|
||||
public PageResult<MetadataCollectVO> page(MetadataCollectQuery query) {
|
||||
|
@ -78,10 +81,12 @@ public class MetadataCollectServiceImpl extends BaseServiceImpl<MetadataCollectD
|
|||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
// for (Long id : idList) {
|
||||
// LambdaQueryWrapper<MetadataCollectEntity> wrapper = Wrappers.lambdaQuery();
|
||||
//
|
||||
// }
|
||||
|
||||
for (Long id : idList) {
|
||||
LambdaQueryWrapper<MetadataCollectRecordEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(MetadataCollectRecordEntity::getMetadataCollectId,id);
|
||||
collectRecordDao.delete(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkParam(MetadataCollectVO vo){
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.MetadataStandardRelConvert;
|
||||
import net.srt.dao.MetadataStandardRelDao;
|
||||
import net.srt.dao.StandardDao;
|
||||
import net.srt.entity.MetadataStandardRelEntity;
|
||||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.service.MetadataStandardRelService;
|
||||
import net.srt.vo.MetadataStandardRelVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MetadataStandardRelServiceImpl extends BaseServiceImpl<MetadataStandardRelDao, MetadataStandardRelEntity> implements MetadataStandardRelService {
|
||||
private final StandardDao standardDao;
|
||||
|
||||
@Override
|
||||
public MetadataStandardRelVO getMetadataRel(Long metadataId) {
|
||||
LambdaQueryWrapper<MetadataStandardRelEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(MetadataStandardRelEntity::getMetadataId,metadataId).last("limit 1");
|
||||
MetadataStandardRelEntity relEntity = baseMapper.selectOne(wrapper);
|
||||
if(relEntity!=null){
|
||||
StandardEntity standardEntity = standardDao.selectById(relEntity.getStandardId());
|
||||
MetadataStandardRelVO convert = MetadataStandardRelConvert.INSTANCE.convert(relEntity);
|
||||
convert.setStandardCategoryId(standardEntity.getParentId());
|
||||
return convert;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(MetadataStandardRelVO vo) {
|
||||
MetadataStandardRelEntity entity = MetadataStandardRelConvert.INSTANCE.convert(vo);
|
||||
LambdaQueryWrapper<MetadataStandardRelEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(MetadataStandardRelEntity::getMetadataId,vo.getMetadataId()).eq(MetadataStandardRelEntity::getStandardId,vo.getStandardId()).last("limit 1");
|
||||
MetadataStandardRelEntity relEntity = baseMapper.selectOne(wrapper);
|
||||
if(relEntity!=null) {
|
||||
entity.setId(relEntity.getId());
|
||||
baseMapper.updateById(entity);
|
||||
}else {
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long metadataId, Long standardId) {
|
||||
LambdaQueryWrapper<MetadataStandardRelEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(MetadataStandardRelEntity::getMetadataId,metadataId).eq(MetadataStandardRelEntity::getStandardId,standardId);
|
||||
baseMapper.delete(wrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : DatastandardVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:05
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "标准管理查询")
|
||||
public class DatastandardVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
private Integer codeNum;
|
||||
private String dataType;
|
||||
private Integer dataLength;
|
||||
private Integer dataPrecision;
|
||||
private Integer nullable;
|
||||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private String creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
private Integer ifStandardRel;
|
||||
private String group;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "数据治理-元数据标准关联表")
|
||||
public class MetadataCollectRecordRelVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "元数据id")
|
||||
private Long metadataId;
|
||||
|
||||
@Schema(description = "标准字段id")
|
||||
private Long standardId;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Long updater;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
|
||||
private Long standardCategoryId;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "数据治理-元数据采集任务记录")
|
||||
public class MetadataCollectRecordVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "采集任务id")
|
||||
private Long metadataCollectId;
|
||||
|
||||
@Schema(description = "1-成功 0-失败 2-运行中")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "实时日志")
|
||||
private String realTimeLog;
|
||||
|
||||
@Schema(description = "错误日志")
|
||||
private String errorLog;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
|
||||
@Schema(description = "项目(租户)id")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Long updater;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "数据治理-元数据标准关联表")
|
||||
public class MetadataStandardRelVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "元数据id")
|
||||
private Long metadataId;
|
||||
|
||||
@Schema(description = "标准字段id")
|
||||
private Long standardId;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Long updater;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
|
||||
private Long standardCategoryId;
|
||||
|
||||
|
||||
}
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-质量规则配置")
|
||||
public class QualityConfigVo implements Serializable {
|
||||
public class QualityConfigVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "自增id")
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -0,0 +1,204 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.srt</groupId>
|
||||
<artifactId>srt-cloud</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>srt-cloud-data-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.srt</groupId>
|
||||
<artifactId>srt-cloud-api</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<!--使用log42j-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.srt</groupId>
|
||||
<artifactId>srt-cloud-mybatis</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.srt</groupId>
|
||||
<artifactId>srt-cloud-dbswitch</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-springdoc-ui</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- <finalName>${project.artifactId}</finalName>-->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>appassembler-maven-plugin</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<!-- 如果不配置 generate-daemons,则打包命令为 mvn clean package appassembler:assemble -->
|
||||
<!-- 如果配置了 generate-daemons,打包命令可以是 mvn clean package 也可以是 mvn clean package appassembler:assemble -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-jsw-scripts</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>generate-daemons</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
<configuration>
|
||||
<!-- flat与lib共同决定将项目用的的所有jar包复制到lib目录下 -->
|
||||
<repositoryLayout>flat</repositoryLayout>
|
||||
<!--从哪里copy配置文件-->
|
||||
<configurationSourceDirectory>src/main/resources</configurationSourceDirectory>
|
||||
<includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
|
||||
<!--是否copy配置文件-->
|
||||
<copyConfigurationDirectory>true</copyConfigurationDirectory>
|
||||
<!--配置文件存放在conf目录路径-->
|
||||
<configurationDirectory>conf</configurationDirectory>
|
||||
<!-- 打包的jar,以及maven依赖的jar放到这个目录里面 -->
|
||||
<repositoryName>lib</repositoryName>
|
||||
<!-- 可执行脚本的目录 -->
|
||||
<binFolder>bin</binFolder>
|
||||
<encoding>UTF-8</encoding>
|
||||
<logsDirectory>logs</logsDirectory>
|
||||
|
||||
<daemons>
|
||||
<daemon>
|
||||
<id>${project.artifactId}</id>
|
||||
<mainClass>net.srt.DataServiceApplication</mainClass>
|
||||
<platforms>
|
||||
<platform>jsw</platform>
|
||||
</platforms>
|
||||
<generatorConfigurations>
|
||||
<generatorConfiguration>
|
||||
<generator>jsw</generator>
|
||||
<includes>
|
||||
<include>linux-x86-32</include>
|
||||
<include>linux-x86-64</include>
|
||||
<include>windows-x86-32</include>
|
||||
<include>windows-x86-64</include>
|
||||
</includes>
|
||||
<configuration>
|
||||
<property>
|
||||
<name>configuration.directory.in.classpath.first</name>
|
||||
<value>conf</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>wrapper.ping.timeout</name>
|
||||
<value>120</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>set.default.REPO_DIR</name>
|
||||
<value>lib</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>wrapper.logfile</name>
|
||||
<value>logs/wrapper.log</value>
|
||||
</property>
|
||||
</configuration>
|
||||
</generatorConfiguration>
|
||||
</generatorConfigurations>
|
||||
<jvmSettings>
|
||||
<!-- jvm参数 -->
|
||||
<!--<systemProperties>
|
||||
<systemProperty>com.sun.management.jmxremote</systemProperty>
|
||||
<systemProperty>com.sun.management.jmxremote.port=1984</systemProperty>
|
||||
<systemProperty>com.sun.management.jmxremote.authenticate=false</systemProperty>
|
||||
<systemProperty>com.sun.management.jmxremote.ssl=false</systemProperty>
|
||||
</systemProperties>-->
|
||||
<extraArguments>
|
||||
<extraArgument>-server</extraArgument>
|
||||
<extraArgument>-Dfile.encoding=utf-8</extraArgument>
|
||||
<extraArgument>-Xms128m</extraArgument>
|
||||
<extraArgument>-Xmx1024m</extraArgument>
|
||||
<extraArgument>-XX:+PrintGCDetails</extraArgument><!--输出GC的详细日志-->
|
||||
<extraArgument>-XX:+PrintGCDateStamps</extraArgument><!--输出GC的时间戳-->
|
||||
<extraArgument>-Xloggc:logs/gc.log</extraArgument><!--日志文件的输出路径-->
|
||||
</extraArguments>
|
||||
</jvmSettings>
|
||||
</daemon>
|
||||
</daemons>
|
||||
<programs>
|
||||
<program>
|
||||
<mainClass>net.srt.DataServiceApplication</mainClass>
|
||||
<id>${project.artifactId}</id>
|
||||
</program>
|
||||
</programs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--打包 日常调试打包可以把该组件注释掉,不然install的速度比较慢-->
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${project.parent.basedir}/assembly/assembly-win.xml</descriptor>
|
||||
<descriptor>${project.parent.basedir}/assembly/assembly-linux.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -5,17 +5,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @ClassName : ${NAME}
|
||||
* @Description : ${description}
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-22 20:44
|
||||
*/
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class ServiceApplication {
|
||||
public class DataServiceApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceApplication.class, args);
|
||||
SpringApplication.run(DataServiceApplication.class, args);
|
||||
System.out.println("==============启动成功===================");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.dto.ApiConfigDto;
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.service.ApiConfigService;
|
||||
import net.srt.vo.ApiConfig;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api-config")
|
||||
@AllArgsConstructor
|
||||
public class ApiConfigController {
|
||||
|
||||
private final ApiConfigService apiConfigService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询文件分组树
|
||||
*
|
||||
* @return 结果列表
|
||||
*/
|
||||
@GetMapping("/api-group")
|
||||
@Operation(summary = "查询文件分组树")
|
||||
public Result<List<TreeNodeVo>> listTree() {
|
||||
return Result.ok(apiConfigService.listTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询API配置
|
||||
* @param query API配置查询对象
|
||||
* @return 分页结果
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
||||
public Result<PageResult<ApiConfig>> page(@Valid ApiConfigQuery query) {
|
||||
PageResult<ApiConfig> page = apiConfigService.page(query);
|
||||
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取IP和端口信息
|
||||
*
|
||||
* @return 返回IP和端口信息
|
||||
*/
|
||||
@GetMapping("/getIpPort")
|
||||
public Result<String> getIpPort() {
|
||||
return Result.ok(apiConfigService.getIpPort());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取API配置信息
|
||||
*
|
||||
* @param id API配置ID
|
||||
* @return API配置实体对象
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "查看")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:info')")
|
||||
public Result<ApiConfigEntity> get(@PathVariable("id") Long id) {
|
||||
ApiConfigEntity apiConfig = apiConfigService.getByI(id);
|
||||
|
||||
return Result.ok(apiConfig);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "修改")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:update')")
|
||||
public Result<ApiConfigEntity> update(@PathVariable Long id, @RequestBody @Valid ApiConfigEntity vo) {
|
||||
apiConfigService.update(id,vo);
|
||||
return Result.ok();
|
||||
}
|
||||
@PutMapping("/{id}/offline")
|
||||
@Operation(summary = "下线")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:update')")
|
||||
public Result<ApiConfigEntity> xia(@PathVariable Long id) {
|
||||
apiConfigService.xia(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/online")
|
||||
@Operation(summary = "上线")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:update')")
|
||||
public Result<ApiConfigEntity> shang(@PathVariable Long id) {
|
||||
apiConfigService.shang(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:save')")
|
||||
public Result<String> insert(@RequestBody ApiConfig vo) {
|
||||
apiConfigService.sav(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:delete')")
|
||||
public Result<String> delete(@RequestBody List<Long> idList) {
|
||||
apiConfigService.removeByI(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.ApiGroupConvert;
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.service.ApiGroupService;
|
||||
import net.srt.vo.ApiGroup;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据服务-api分组
|
||||
*
|
||||
* @author zrx 985134801@qq.com
|
||||
* @since 1.0.0 2023-01-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api-group")
|
||||
@AllArgsConstructor
|
||||
public class ApiGroupController {
|
||||
private final ApiGroupService apiGroupService;
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "查询文件分组树")
|
||||
public Result<List<TreeNodeVo>> listTree() {
|
||||
return Result.ok(apiGroupService.listTree());
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
@PreAuthorize("hasAuthority('data-service:api-group:info')")
|
||||
public Result<ApiGroup> get(@PathVariable("id") Long id){
|
||||
ApiGroupEntity entity = apiGroupService.getById(id);
|
||||
return Result.ok(ApiGroupConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
@PreAuthorize("hasAuthority('data-service:api-group:save')")
|
||||
public Result<String> save(@RequestBody ApiGroup vo) {
|
||||
apiGroupService.save(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
@PreAuthorize("hasAuthority('data-service:api-group:update')")
|
||||
public Result<String> update(@RequestBody @Valid ApiGroup vo) {
|
||||
apiGroupService.update(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除")
|
||||
@PreAuthorize("hasAuthority('data-service:api-group:delete')")
|
||||
public Result<String> delete(@PathVariable Long id) {
|
||||
apiGroupService.delete(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.query.ApiLogQuery;
|
||||
import net.srt.service.ApiLogService;
|
||||
import net.srt.vo.ApiConfig;
|
||||
import net.srt.vo.ApiLog;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @ClassName ApiTest
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/log")
|
||||
@AllArgsConstructor
|
||||
public class ApiTest {
|
||||
|
||||
@Autowired
|
||||
ApiLogService apiLogService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "日志列表")
|
||||
@PreAuthorize("hasAuthority('data-service:api-config:page')")
|
||||
public Result<PageResult<ApiLog>> page(@Valid ApiLogQuery query) {
|
||||
PageResult<ApiLog> page = apiLogService.pag(query);
|
||||
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.dto.ApiConfigDto;
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.vo.ApiConfig;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据服务-api配置
|
||||
*
|
||||
* @author zrx 985134801@qq.com
|
||||
* @since 1.0.0 2023-01-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiConfigConvert {
|
||||
ApiConfigConvert INSTANCE = Mappers.getMapper(ApiConfigConvert.class);
|
||||
|
||||
ApiConfigEntity convert(ApiConfig vo);
|
||||
|
||||
ApiConfig convert(ApiConfigEntity entity);
|
||||
|
||||
ApiConfigDto convertDto(ApiConfigEntity entity);
|
||||
|
||||
List<ApiConfig> convertList(List<ApiConfigEntity> list);
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.vo.ApiGroup;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据服务-api分组
|
||||
*
|
||||
* @author zrx 985134801@qq.com
|
||||
* @since 1.0.0 2023-01-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiGroupConvert {
|
||||
ApiGroupConvert INSTANCE = Mappers.getMapper(ApiGroupConvert.class);
|
||||
|
||||
ApiGroupEntity convert(ApiGroup vo);
|
||||
|
||||
ApiGroup convert(ApiGroupEntity entity);
|
||||
|
||||
List<ApiGroup> convertList(List<ApiGroupEntity> list);
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.ApiLogEntity;
|
||||
import net.srt.vo.ApiLog;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLogConvert
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiLogConvert {
|
||||
|
||||
ApiLogConvert INSTANCE = Mappers.getMapper(ApiLogConvert.class);
|
||||
|
||||
ApiLogEntity convert(ApiLog vo);
|
||||
|
||||
ApiLog convert(ApiLogEntity entity);
|
||||
|
||||
List<ApiLog> convertList(List<ApiLogEntity> list);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package net.srt.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class ApiConfigDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long id;
|
||||
private Long groupId;
|
||||
private String path;
|
||||
private String type;
|
||||
private String name;
|
||||
private String note;
|
||||
private String sqlText;
|
||||
private String sqlSeparator;
|
||||
private Integer sqlMaxRow;
|
||||
private String sqlParam;
|
||||
private String jsonParam;
|
||||
private String responseResult;
|
||||
private String contentType;
|
||||
private Integer status;
|
||||
private Date releaseTime;
|
||||
private Long releaseUserId;
|
||||
private Integer sqlDbType;
|
||||
private Long databaseId;
|
||||
private Integer previlege;
|
||||
private Integer openTrans;
|
||||
private Long projectId;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private Long creator;
|
||||
private Date createTime;
|
||||
private Long updater;
|
||||
private Date updateTime;
|
||||
private Integer requestedTimes;
|
||||
private Integer requestedSuccessTimes;
|
||||
private Integer requestedFailedTimes;
|
||||
private Long authId;
|
||||
private String group;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("data_dispatch_catalogue")
|
||||
public class ApiConfigEntity extends BaseEntity {
|
||||
/**
|
||||
* 父级id(顶级为0)
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分组序号
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 分组路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
private Long id;
|
||||
|
||||
// 私有属性,状态
|
||||
private Integer status;
|
||||
// 私有属性,发布用户ID
|
||||
private Long releaseUserId;
|
||||
// 自定义注解,日期格式化,格式为"yyyy-MM-dd HH:mm:ss"
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date releaseTime;
|
||||
// 私有属性,内容类型
|
||||
private String contentType;
|
||||
private Integer previlege;
|
||||
private Integer openTrans;
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
@Data
|
||||
@TableName(value = "data_dispatch_catalogue",autoResultMap = true)
|
||||
public class ApiGroupEntity extends BaseEntity {
|
||||
/**
|
||||
* 父级id(顶级为0)
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分组序号
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 分组路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLogEntity
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "data_service_api_log",autoResultMap = true)
|
||||
public class ApiLogEntity extends BaseEntity {
|
||||
// private Integer id;
|
||||
private String url;
|
||||
private Integer duration;
|
||||
private String ip;
|
||||
private Integer apiId;
|
||||
private String error;
|
||||
private Integer projectId;
|
||||
// private String deleted;
|
||||
// private Integer creator;
|
||||
// private String createTime;
|
||||
// private Integer updater;
|
||||
private Date updateTime;
|
||||
private String apiName;
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package net.srt.mapper;
|
||||
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface ApiConfigDao extends BaseDao<ApiConfigEntity> {
|
||||
void xia(@Param("id") Long id);
|
||||
|
||||
void shang(@Param("id") Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package net.srt.mapper;
|
||||
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ApiGroupDao extends BaseDao<ApiGroupEntity> {
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package net.srt.mapper;
|
||||
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.entity.ApiLogEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLogDao
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiLogDao extends BaseDao<ApiLogEntity> {
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package net.srt.query;
|
||||
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.query.Query;
|
||||
|
||||
@Data
|
||||
public class ApiConfigQuery extends Query {
|
||||
|
||||
private Long groupId;
|
||||
private Long resourceId;
|
||||
private Long appId;
|
||||
private String name;
|
||||
private String path;
|
||||
private String contentType;
|
||||
private Integer status;
|
||||
private Integer sqlDbType;
|
||||
private Long databaseId;
|
||||
private Integer privates;
|
||||
private Integer openTrans;
|
||||
private Integer queryApply;
|
||||
private Integer ifMarket;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.srt.query;
|
||||
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.query.Query;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLogQuery
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Data
|
||||
public class ApiLogQuery extends Query {
|
||||
|
||||
private String ip;
|
||||
private String apiName;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.dto.ApiConfigDto;
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.vo.ApiConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApiConfigService extends BaseService<ApiConfigEntity> {
|
||||
String getIpPort();
|
||||
|
||||
List<TreeNodeVo> listTree();
|
||||
|
||||
|
||||
PageResult<ApiConfig> page(ApiConfigQuery query);
|
||||
|
||||
ApiConfigEntity getByI(Long id);
|
||||
|
||||
|
||||
void update(Long id, ApiConfigEntity vo);
|
||||
|
||||
void xia(Long id);
|
||||
|
||||
|
||||
void shang(Long id);
|
||||
|
||||
|
||||
|
||||
void sav(ApiConfig vo);
|
||||
|
||||
void removeByI(List<Long> idList);
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.vo.ApiGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApiGroupService extends BaseService<ApiGroupEntity> {
|
||||
List<TreeNodeVo> listTree();
|
||||
|
||||
void save(ApiGroup vo);
|
||||
|
||||
void update(ApiGroup vo);
|
||||
|
||||
void delete(Long id);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.ApiLogEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.ApiLogQuery;
|
||||
import net.srt.vo.ApiLog;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLogService
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
public interface ApiLogService extends BaseService<ApiLogEntity> {
|
||||
|
||||
PageResult<ApiLog> pag(ApiLogQuery query);
|
||||
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.ApiConfigConvert;
|
||||
import net.srt.convert.ApiGroupConvert;
|
||||
import net.srt.dto.ApiConfigDto;
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.mapper.ApiConfigDao;
|
||||
import net.srt.query.ApiConfigQuery;
|
||||
import net.srt.service.ApiConfigService;
|
||||
import net.srt.vo.ApiConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ApiConfigServiceImpl extends BaseServiceImpl<ApiConfigDao, ApiConfigEntity> implements ApiConfigService {
|
||||
@Override
|
||||
public String getIpPort() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从数据库中查询并返回树结构的节点列表
|
||||
* @return List<TreeNodeVo> 树节点列表
|
||||
*/
|
||||
@Override
|
||||
public List<TreeNodeVo> listTree() {
|
||||
// 创建查询条件
|
||||
LambdaQueryWrapper<ApiConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
// 设置查询条件,排除组织id
|
||||
dataScopeWithoutOrgId(wrapper);
|
||||
// 按照排序字段升序排序
|
||||
wrapper.orderByAsc(ApiConfigEntity::getOrderNo);
|
||||
// 从数据库中查询列表数据
|
||||
List<ApiConfigEntity> dataFileCategoryEntities = baseMapper.selectList(wrapper);
|
||||
// 将数据转换为树节点vo列表
|
||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(dataFileCategoryEntities, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||
// 设置树节点的标签为名称
|
||||
newItem.setLabel(oldItem.getName());
|
||||
// 设置树节点的值为id
|
||||
newItem.setValue(oldItem.getId());
|
||||
// 设置树节点是否不可用,类型为0表示不可用
|
||||
newItem.setDisabled(oldItem.getType() == 0);
|
||||
// 如果树节点路径包含斜杠,则设置父路径为路径截取到倒数第一个斜杠的位置
|
||||
if (newItem.getPath().contains("/")) {
|
||||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
// 调用工具类构建树结构
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询API配置信息
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public PageResult<ApiConfig> page(ApiConfigQuery query) {
|
||||
// 调用Mapper层方法,查询分页数据
|
||||
IPage<ApiConfigEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
|
||||
// 将查询结果转换为ApiConfig对象列表
|
||||
// 返回分页结果
|
||||
return new PageResult<>(ApiConfigConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID获取ApiConfigEntity对象
|
||||
*
|
||||
* @param id ID值
|
||||
* @return ApiConfigEntity对象
|
||||
*/
|
||||
@Override
|
||||
public ApiConfigEntity getByI(Long id) {
|
||||
return id != null ? baseMapper.selectById(id) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Long id,ApiConfigEntity vo) {
|
||||
baseMapper.deleteById(id);
|
||||
baseMapper.insert(vo);
|
||||
// if (vo.getType() == 0) {
|
||||
// ApiGroupEntity apiGroupEntity = new ApiGroupEntity();
|
||||
// apiGroupEntity.setId(vo.getId());
|
||||
// apiGroupEntity.setVersion(vo.getVersion());
|
||||
// apiGroupEntity.setDeleted(vo.getDeleted());
|
||||
// apiGroupEntity.setUpdateTime(vo.getUpdateTime());
|
||||
// apiGroupEntity.setCreateTime(vo.getCreateTime());
|
||||
// apiGroupEntity.setUpdater(vo.getUpdater());
|
||||
// }
|
||||
}
|
||||
|
||||
@Resource
|
||||
ApiConfigDao apiConfigDto;
|
||||
|
||||
@Override
|
||||
public void xia(Long id) {
|
||||
apiConfigDto.xia(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void shang(Long id) {
|
||||
apiConfigDto.shang(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void sav(ApiConfig vo) {
|
||||
|
||||
|
||||
ApiConfigEntity entity = ApiConfigConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeByI(List<Long> idList) {
|
||||
baseMapper.deleteBatchIds(idList);
|
||||
}
|
||||
|
||||
private String recursionPath(ApiConfigEntity groupEntity, String path) {
|
||||
if (StringUtil.isBlank(path)) {
|
||||
path = groupEntity.getName();
|
||||
}
|
||||
if (groupEntity.getParentId() != 0) {
|
||||
ApiConfigEntity parent = getById(groupEntity.getParentId());
|
||||
path = parent.getName() + "/" + path;
|
||||
return recursionPath(parent, path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper getWrapper(ApiConfigQuery query) {
|
||||
LambdaQueryWrapper<ApiConfigEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()), ApiConfigEntity::getName, query.getName());
|
||||
wrapper.like(StringUtil.isNotBlank(query.getPath()), ApiConfigEntity::getPath, query.getPath());
|
||||
// wrapper.eq(StringUtil.isNotBlank(query.getContentType()), ApiConfigEntity::getContentType, query.getContentType());
|
||||
// wrapper.eq(query.getStatus()!= null, ApiConfigEntity::getStatus, query.getStatus());
|
||||
// wrapper.eq(query.getSqlDbType() != null, ApiConfigEntity::getSqlDbType, query.getSqlDbType());
|
||||
//
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.ApiGroupConvert;
|
||||
import net.srt.entity.ApiConfigEntity;
|
||||
import net.srt.entity.ApiGroupEntity;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.mapper.ApiGroupDao;
|
||||
import net.srt.service.ApiConfigService;
|
||||
import net.srt.service.ApiGroupService;
|
||||
import net.srt.vo.ApiGroup;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ApiGroupServiceImpl extends BaseServiceImpl<ApiGroupDao, ApiGroupEntity> implements ApiGroupService{
|
||||
// private final ApiConfigService apiConfigService;
|
||||
@Override
|
||||
public List<TreeNodeVo> listTree() {
|
||||
List<TreeNodeVo> treeNodeVos = getTreeNodeVos();
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
private List<TreeNodeVo> getTreeNodeVos() {
|
||||
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
dataScopeWithoutOrgId(wrapper);
|
||||
wrapper.orderByAsc(ApiGroupEntity::getOrderNo);
|
||||
List<ApiGroupEntity> apiGroupEntities = baseMapper.selectList(wrapper);
|
||||
return BeanUtil.copyListProperties(apiGroupEntities, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||
newItem.setLabel(oldItem.getName());
|
||||
newItem.setValue(oldItem.getId());
|
||||
newItem.setDisabled(oldItem.getType() == 1);
|
||||
if (newItem.getPath().contains("/")) {
|
||||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ApiGroup vo) {
|
||||
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity); // 使用 insertSelective() 方法进行插入操作
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ApiGroup vo) {
|
||||
ApiGroupEntity entity = ApiGroupConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
private String recursionPath(ApiGroupEntity groupEntity, String path) {
|
||||
if (StringUtil.isBlank(path)) {
|
||||
path = groupEntity.getName();
|
||||
}
|
||||
if (groupEntity.getParentId() != 0) {
|
||||
ApiGroupEntity parent = getById(groupEntity.getParentId());
|
||||
path = parent.getName() + "/" + path;
|
||||
return recursionPath(parent, path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
//查询有没有子节点
|
||||
LambdaQueryWrapper<ApiGroupEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ApiGroupEntity::getParentId, id).last(" limit 1");
|
||||
ApiGroupEntity one = baseMapper.selectOne(wrapper);
|
||||
if (one != null) {
|
||||
throw new ServerException("存在子节点,不允许删除!");
|
||||
}
|
||||
// //查询有没有api与之关联
|
||||
// LambdaQueryWrapper<ApiConfigEntity> serviceApiConfigWrapper = new LambdaQueryWrapper<>();
|
||||
// serviceApiConfigWrapper.eq(ApiConfigEntity::getParentId, id).last(" limit 1");
|
||||
// ApiConfigEntity apiConfigEntity = apiConfigService.getOne(serviceApiConfigWrapper);
|
||||
// if (apiConfigEntity != null) {
|
||||
// throw new ServerException("节点下有 api 与之关联,不允许删除!");
|
||||
// }
|
||||
// removeById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import net.srt.convert.ApiLogConvert;
|
||||
|
||||
|
||||
import net.srt.entity.ApiLogEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.mapper.ApiLogDao;
|
||||
|
||||
import net.srt.query.ApiLogQuery;
|
||||
|
||||
import net.srt.service.ApiLogService;
|
||||
import net.srt.vo.ApiLog;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLogServiceImpl
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ApiLogServiceImpl extends BaseServiceImpl<ApiLogDao, ApiLogEntity> implements ApiLogService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<ApiLog> pag(ApiLogQuery query) {
|
||||
// 调用Mapper层方法,查询分页数据
|
||||
IPage<ApiLogEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
|
||||
|
||||
// 将查询结果转换为ApiConfig对象列表
|
||||
// 返回分页结果
|
||||
return new PageResult<>(ApiLogConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper getWrapper(ApiLogQuery query) {
|
||||
LambdaQueryWrapper<ApiLogEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getApiName()), ApiLogEntity::getApiName, query.getApiName());
|
||||
wrapper.like(StringUtil.isNotBlank(query.getIp()), ApiLogEntity::getIp, query.getIp());
|
||||
// wrapper.eq(StringUtil.isNotBlank(query.getContentType()), ApiConfigEntity::getContentType, query.getContentType());
|
||||
// wrapper.eq(query.getStatus()!= null, ApiConfigEntity::getStatus, query.getStatus());
|
||||
// wrapper.eq(query.getSqlDbType() != null, ApiConfigEntity::getSqlDbType, query.getSqlDbType());
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 数据服务-api配置
|
||||
*
|
||||
* @author zrx 985134801@qq.com
|
||||
* @since 1.0.0 2023-01-28
|
||||
*/
|
||||
@Data
|
||||
public class ApiConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Integer parentId;
|
||||
private Integer type;
|
||||
private String name;
|
||||
private Integer orderNo;
|
||||
private String description;
|
||||
private String path;
|
||||
private Integer projectId;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private Integer creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private Integer updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
private Integer status;
|
||||
private String contentType;
|
||||
private Integer releaseUserId;
|
||||
private Date releaseTime;
|
||||
private Integer previlege;
|
||||
private Integer openTrans;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @TableId(value = "id", type = IdType.AUTO)
|
||||
// private Long id;
|
||||
// private Long groupId;
|
||||
// private String path;
|
||||
// private String type;
|
||||
// private String name;
|
||||
//// private String note;
|
||||
// private String sqlText;
|
||||
// private String sqlSeparator;
|
||||
// private Integer sqlMaxRow;
|
||||
// private String sqlParam;
|
||||
// private String jsonParam;
|
||||
// private String responseResult;
|
||||
// private Integer contentType;
|
||||
// private Integer status
|
||||
// private Date releaseTime;
|
||||
// private Long releaseUserId;
|
||||
// private Integer sqlDbType;
|
||||
// private Long databaseId;
|
||||
// private Integer previlege;
|
||||
// private Integer openTrans;
|
||||
// private Long projectId;
|
||||
// private Integer version;
|
||||
// private Integer deleted;
|
||||
// private Long creator;
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
// private Date createTime;
|
||||
// private Long updater;
|
||||
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
// private Date updateTime;
|
||||
// private Integer requestedTimes;
|
||||
// private Integer requestedSuccessTimes;
|
||||
// private Integer requestedFailedTimes;
|
||||
// private Long authId;
|
||||
// private String group;
|
||||
// private String groupPath;
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ApiGroup implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long id;
|
||||
private Long parentId;
|
||||
private Integer type;
|
||||
private String name;
|
||||
private String description;
|
||||
private Integer orderNo;
|
||||
private String path;
|
||||
private Long projectId;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private Long creator;
|
||||
private Date createTime;
|
||||
private Long updater;
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName ApiLog
|
||||
* @Description 描述
|
||||
* @Author 栗永斌
|
||||
*/
|
||||
@Data
|
||||
public class ApiLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private Integer id;
|
||||
private String url;
|
||||
private Integer duration;
|
||||
private String ip;
|
||||
private Integer apiId;
|
||||
private String error;
|
||||
private Integer projectId;
|
||||
private String deleted;
|
||||
private Integer creator;
|
||||
private String createTime;
|
||||
private Integer updater;
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
auth:
|
||||
ignore_urls:
|
||||
- /auth/captcha
|
||||
- /auth/login
|
||||
- /auth/send/code
|
||||
- /auth/mobile
|
||||
- /upload/**
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--status用于设置log4j2框架内部的日志信息输出,设置成OFF将禁止log4j2内部日志输出,毕竟这个日志对我们没有什么作用,如果设置成trace,你会看到log4j2内部各种详细输出;monitorInterval是监控间隔,例如下面的设置是指:log4j2每隔600秒自动监控该配置文件是否有变化,如果有变化,则根据文件内容新的配置生成日志-->
|
||||
<configuration status="OFF" monitorInterval="600">
|
||||
<Properties>
|
||||
<property name="LOG_PATH">./logs/</property>
|
||||
<property name="LOG_FILE">srt-cloud-system</property>
|
||||
</Properties>
|
||||
<!--定义添加器-->
|
||||
<appenders>
|
||||
<!--Console是输出控制台的标签,target可以控制往控制台输出日志的颜色,例如SYSTEM_OUT就是蓝色的,SYSTEM_ERR就是红色的-->
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<!--控制台只输出level及以上级别的信息,onMatch为true代表符合level标准的才输出,onMismatch为true代表不符合level标准的就不输出-->
|
||||
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="ACCEPT"/>
|
||||
<!--这个是输出日志的格式,如果对里面的参数不理解,可以去看我的这篇文章,网址是:“https://blog.csdn.net/qq_42449963/article/details/104617356”-->
|
||||
<!--<PatternLayout pattern=" %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>-->
|
||||
<PatternLayout
|
||||
pattern=" %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%6p} %style{%5pid}{bright,magenta} --- [%15.15t] %style{%c{20}}{bright,cyan}: %m%n"/>
|
||||
</Console>
|
||||
|
||||
<!--这种存储文件的方式更加合理,可以设置多长时间把文件归档一次,也可以设置多大文件归档一次,如果都把所有的日志存在一个文件里面,文件会受不了的,解释一下参数信息:fileName后面如果后面不跟/,例如dev/logs/app.log,那就会把日志文件放在project工程下面,不是所属的项目下面如果后面跟/,例如/dev/logs/app.log,那就会把日志文件直接放在项目所在盘符的根目录下,例如项目在E盘存放,那就会把日志文件直接放在E盘的根目录下,如果后面直接加盘符,那就会存在特定的位置,例如F:/dev/logs/app.log,那就会直接放在F盘中特定的位置,上面都是经过测验的,fileName后面的app.log文件相当于是一个缓存文件,我们会把日志信息先放在app.log中,当达到我们设置的要求之后会把app.log中的日志信息转移到filePattern指定的日志文件中,转移的内容就会从app.log日志文件中清除,没有转移的内容还存放在app.log中,等到下一次符合要求的时候在进行一次转移-->
|
||||
<!--$${date:yyyy-MM}用在文件上面,输出的是目录的名字,例如2020-03,%d{MM-dd-yyyy}输入的就是月日年,例如03-02-2020,%i按照轮询输出,毕竟一天可能有符合要求的多个日志文件生成,所以需要在后面加一个类似于后缀的东西,当天的第一个日志文件可能是-1.log.gz,第二个文件就是-2.log.gz-->
|
||||
<RollingFile name="RollingFile" fileName="${LOG_PATH}/${LOG_FILE}.log"
|
||||
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${LOG_FILE}-%d{yyyy-MM-dd}-%i.log">
|
||||
<!--%thread:线程名;%-5level:级别从左显示5个字符宽度;%msg:在代码中需要输出的日志消息;%class{36}:估计显示的是完整类名-->
|
||||
<PatternLayout pattern=" %d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n"/>
|
||||
<!--<SizeBasedTriggeringPolicy size="300MB"/>-->
|
||||
<Policies>
|
||||
<!--TimeBasedTriggeringPolicy基于时间的触发策略,integer属性和上面<RollingFile>标签中的filePattern的值有关,例如:filePattern=”xxx%d{yyyy-MM-dd}xx” interval=”1” 表示将1天一个日志文件;filePattern=”xxx%d{yyyy-MM-dd-HH}xxx” interval=”1”表示一个小时一个日志文件,也就是说interval的单位取决于filePattern中的最小时间单位;modulate是(boolean)以0点钟为边界进行偏移计算,应该就是假设你中午启动项目,晚上0点也是一天了,而不是经过24小时才算一天-->
|
||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
||||
<!--当app.log文件大小到达100MB的时候,就归档一次日志文件,也就是把app.log中的那前面100MB文件取出来,放到上面<RollingFile >中的filePattern后面的路径中-->
|
||||
<SizeBasedTriggeringPolicy size="100MB"/>
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
</appenders>
|
||||
|
||||
<loggers>
|
||||
<logger name="net.srt.system.dao" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="Console"/>
|
||||
</logger>
|
||||
<!--level="info"代表只能打印出info及其以上的信息;Console是上面Console标签的名字,往这一写,就可以往控制台上输出内容了,RollingFile是上面RollingFile标签的名字,往这一写,就会往设定的文件中输出内容了;当程序运行的时候就会被创建日志输出文件,不过里面没有任何日志内容,是否往里面输入日志,是通过下面的appender-ref标签控制的-->
|
||||
<root level="info">
|
||||
<appender-ref ref="Console"/>
|
||||
<!--一般不使用这个,只是让你知道有这个输出日志文件的方式而已-->
|
||||
<!--<appender-ref ref="File"/>-->
|
||||
<appender-ref ref="RollingFile"/>
|
||||
</root>
|
||||
</loggers>
|
||||
</configuration>
|
|
@ -0,0 +1,14 @@
|
|||
<?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="net.srt.mapper.ApiConfigDao">
|
||||
|
||||
|
||||
<update id="xia" parameterType="java.lang.Long">
|
||||
update data_dispatch_catalogue set status = 0 where id = #{id}
|
||||
</update>
|
||||
<update id="shang" parameterType="java.lang.Long">
|
||||
update data_dispatch_catalogue set status = 1 where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,40 @@
|
|||
package net.srt;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class DataServiceApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataServiceApplication.class, args);
|
||||
System.out.println("\n" +
|
||||
"/**\n" +
|
||||
" * _ooOoo_\n" +
|
||||
" * o8888888o\n" +
|
||||
" * 88\" . \"88\n" +
|
||||
" * (| -_- |)\n" +
|
||||
" * O\\ = /O\n" +
|
||||
" * ____/`---'\\____\n" +
|
||||
" * . ' \\\\| |// `.\n" +
|
||||
" * / \\\\||| : |||// \\\n" +
|
||||
" * / _||||| -:- |||||- \\\n" +
|
||||
" * | | \\\\\\ - /// | |\n" +
|
||||
" * | \\_| ''\\---/'' | |\n" +
|
||||
" * \\ .-\\__ `-` ___/-. /\n" +
|
||||
" * ___`. .' /--.--\\ `. . __\n" +
|
||||
" * .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
|
||||
" * | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
|
||||
" * \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
|
||||
" * ======`-.____`-.___\\_____/___.-`____.-'======\n" +
|
||||
" * `=---='\n" +
|
||||
" *\n" +
|
||||
" * .............................................\n" +
|
||||
" * 佛祖保佑 代码 启动 永无BUG\n" +
|
||||
" */\n" +
|
||||
"————————代码——启动————————");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.srt.controller;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApiAuthController
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-26 15:22
|
||||
*/
|
||||
public class DataServiceApiAuthController {
|
||||
}
|
|
@ -85,4 +85,5 @@ public class DataServiceAppController {
|
|||
dataServiceAppService.cancelAuth(authId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package net.srt.service;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApiAuthService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-26 15:23
|
||||
*/
|
||||
public interface DataServiceApiAuthService {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApiAuthServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-26 15:23
|
||||
*/
|
||||
public class DataServiceApiAuthServiceImpl {
|
||||
}
|
|
@ -14,8 +14,8 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
server-addr: 101.34.77.101:8848
|
||||
# 命名空间,默认:public
|
||||
namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040
|
||||
# 命名空间,默认:public、
|
||||
namespace: a60b2ca1-a8c6-47ae-94f1-741105674655
|
||||
service: ${spring.application.name}
|
||||
group: srt2.0
|
||||
config:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -198,13 +198,20 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
|
|||
/**
|
||||
* MyBatis-Plus 数据权限
|
||||
*/
|
||||
protected void dataScopeWithoutOrgId(LambdaQueryWrapper<T> queryWrapper) {
|
||||
DataScope dataScope = getDataScope(null, null, null, null, false, true);
|
||||
if (dataScope != null) {
|
||||
queryWrapper.apply(dataScope.getSqlFilter());
|
||||
}
|
||||
}
|
||||
// protected void dataScopeWithoutOrgId(LambdaQueryWrapper<T> queryWrapper) {
|
||||
// DataScope dataScope = getDataScope(null, null, null, null, false, true);
|
||||
// if (dataScope != null) {
|
||||
// queryWrapper.apply(dataScope.getSqlFilter());
|
||||
// }
|
||||
// }
|
||||
|
||||
protected void dataScopeWithoutOrgId(LambdaQueryWrapper<T> queryWrapper) {
|
||||
DataScope dataScope = this.getDataScope((String)null, (String)null, (String)null, (String)null, false, true);
|
||||
if (dataScope != null) {
|
||||
queryWrapper.apply(dataScope.getSqlFilter(), new Object[0]);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* MyBatis-Plus 数据权限
|
||||
*/
|
||||
|
|
|
@ -101,11 +101,11 @@
|
|||
|
||||
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=mysqlreader -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.datax</groupId>
|
||||
<artifactId>mysqlreader</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.datax</groupId>-->
|
||||
<!-- <artifactId>mysqlreader</artifactId>-->
|
||||
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=mysqlwriter -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
||||
-->
|
||||
|
@ -117,11 +117,11 @@
|
|||
<!-- mvn install:install-file -Dfile=lib/datax-core-0.0.1-SNAPSHOT.jar -DgroupId=com.alibaba.datax -DartifactId=oraclereader -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.datax</groupId>
|
||||
<artifactId>oraclereader</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.datax</groupId>-->
|
||||
<!-- <artifactId>oraclereader</artifactId>-->
|
||||
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!--httpclient-->
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue