最新一版
parent
e17ee79fa3
commit
72b9a08bbc
|
@ -23,7 +23,7 @@ public class MetadataController {
|
||||||
@GetMapping("/list-child")
|
@GetMapping("/list-child")
|
||||||
@Operation(summary = "根据父级id获取信息")
|
@Operation(summary = "根据父级id获取信息")
|
||||||
public Result<List<TreeNodeVo>> listByParentId(@RequestParam Long parentId){
|
public Result<List<TreeNodeVo>> listByParentId(@RequestParam Long parentId){
|
||||||
List<TreeNodeVo> treeNodeVos = metadataService.listByParentId(parentId);
|
List<TreeNodeVo> treeNodeVos = metadataService.listByPatenId(parentId);
|
||||||
return Result.ok(treeNodeVos);
|
return Result.ok(treeNodeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class MetadataController {
|
||||||
@GetMapping("/list-keyword")
|
@GetMapping("/list-keyword")
|
||||||
@Operation(summary = "模糊查询")
|
@Operation(summary = "模糊查询")
|
||||||
public Result<List<TreeNodeVo>> listByKeyword(String keyword){
|
public Result<List<TreeNodeVo>> listByKeyword(String keyword){
|
||||||
List<TreeNodeVo> treeNodeVos = metadataService.listByKeyword(keyword);
|
List<TreeNodeVo> treeNodeVos = metadataService.listKeyword(keyword);
|
||||||
return Result.ok(treeNodeVos);
|
return Result.ok(treeNodeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,13 +78,13 @@ public class MetadataController {
|
||||||
@PostMapping("/neo4j")
|
@PostMapping("/neo4j")
|
||||||
@Operation(summary = "更新neo4j的url")
|
@Operation(summary = "更新neo4j的url")
|
||||||
public Result<String> upNeo4jInfo(@RequestBody Neo4jInfo neo4jInfo){
|
public Result<String> upNeo4jInfo(@RequestBody Neo4jInfo neo4jInfo){
|
||||||
metadataService.upNeo4jInfo(neo4jInfo);
|
metadataService.updateNeo4j(neo4jInfo);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/neo4j")
|
@GetMapping("/neo4j")
|
||||||
@Operation(summary = "获取neo4j的url")
|
@Operation(summary = "获取neo4j的url")
|
||||||
public Result<Neo4jInfo> getNeo4jInfo(){
|
public Result<Neo4jInfo> getNeo4jInfo(){
|
||||||
return Result.ok(metadataService.getNeo4jInfo());
|
return Result.ok(metadataService.getNeo4j());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.common.utils.Result;
|
import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.query.QualityConfigQuery;
|
import net.srt.query.QualityConfigQuery;
|
||||||
import net.srt.service.QualityConfigService;
|
import net.srt.service.QualityConfigService;
|
||||||
import net.srt.vo.QualityConfigVO;
|
import net.srt.vo.QualityConfigVo;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
@ -28,26 +28,26 @@ public class QualityConfigController {
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
public Result<PageResult<QualityConfigVO>> page(@Valid QualityConfigQuery query){
|
public Result<PageResult<QualityConfigVo>> page(@Valid QualityConfigQuery query){
|
||||||
PageResult<QualityConfigVO> page= qualityConfigService.page(query);
|
PageResult<QualityConfigVo> page= qualityConfigService.page(query);
|
||||||
return Result.ok(page);
|
return Result.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@Operation(summary = "信息")
|
@Operation(summary = "信息")
|
||||||
public Result<QualityConfigVO> get(@PathVariable("id") Long id){
|
public Result<QualityConfigVo> get(@PathVariable("id") Long id){
|
||||||
return Result.ok(qualityConfigService.get(id));
|
return Result.ok(qualityConfigService.get(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "保存")
|
@Operation(summary = "保存")
|
||||||
public Result<String> save(@RequestBody QualityConfigVO vo){
|
public Result<String> save(@RequestBody QualityConfigVo vo){
|
||||||
qualityConfigService.save(vo);
|
qualityConfigService.save(vo);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
public Result<String> update(@RequestBody @Valid QualityConfigVO vo){
|
public Result<String> update(@RequestBody @Valid QualityConfigVo vo){
|
||||||
qualityConfigService.update(vo);
|
qualityConfigService.update(vo);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package net.srt.convert;
|
package net.srt.convert;
|
||||||
|
|
||||||
import net.srt.entity.QualityConfigEntity;
|
import net.srt.entity.QualityConfigEntity;
|
||||||
import net.srt.vo.QualityConfigVO;
|
import net.srt.vo.QualityConfigVo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ import java.util.List;
|
||||||
public interface QualityConfigConvert {
|
public interface QualityConfigConvert {
|
||||||
QualityConfigConvert INSTANCE = Mappers.getMapper(QualityConfigConvert.class);
|
QualityConfigConvert INSTANCE = Mappers.getMapper(QualityConfigConvert.class);
|
||||||
|
|
||||||
QualityConfigVO convert(QualityConfigEntity entity);
|
QualityConfigVo convert(QualityConfigEntity entity);
|
||||||
|
|
||||||
QualityConfigEntity convert(QualityConfigVO vo);
|
QualityConfigEntity convert(QualityConfigVo vo);
|
||||||
|
|
||||||
List<QualityConfigVO> convertList(List<QualityConfigEntity> list);
|
List<QualityConfigVo> convertList(List<QualityConfigEntity> list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.srt.entity.QualityConfigEntity;
|
||||||
import net.srt.framework.common.page.PageResult;
|
import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.mybatis.service.BaseService;
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
import net.srt.query.QualityConfigQuery;
|
import net.srt.query.QualityConfigQuery;
|
||||||
import net.srt.vo.QualityConfigVO;
|
import net.srt.vo.QualityConfigVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@ import java.util.List;
|
||||||
* @CreateTime: 2023/12/24 19:33
|
* @CreateTime: 2023/12/24 19:33
|
||||||
*/
|
*/
|
||||||
public interface QualityConfigService extends BaseService<QualityConfigEntity> {
|
public interface QualityConfigService extends BaseService<QualityConfigEntity> {
|
||||||
PageResult<QualityConfigVO> page(QualityConfigQuery query);
|
PageResult<QualityConfigVo> page(QualityConfigQuery query);
|
||||||
|
|
||||||
QualityConfigVO get(Long id);
|
QualityConfigVo get(Long id);
|
||||||
|
|
||||||
void save(QualityConfigVO vo);
|
void save(QualityConfigVo vo);
|
||||||
|
|
||||||
void update(QualityConfigVO vo);
|
void update(QualityConfigVo vo);
|
||||||
|
|
||||||
void online(Long id);
|
void online(Long id);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
import net.srt.query.QualityConfigQuery;
|
import net.srt.query.QualityConfigQuery;
|
||||||
import net.srt.service.QualityConfigService;
|
import net.srt.service.QualityConfigService;
|
||||||
import net.srt.vo.QualityConfigVO;
|
import net.srt.vo.QualityConfigVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
@ -37,39 +37,39 @@ public class QualityConfigServiceimpl extends BaseServiceImpl<QualityConfigDao,
|
||||||
private final QuartzDataGovernanceQualityApi quartzDataGovernanceQualityApi;
|
private final QuartzDataGovernanceQualityApi quartzDataGovernanceQualityApi;
|
||||||
private final MetadataDao metadataDao;
|
private final MetadataDao metadataDao;
|
||||||
@Override
|
@Override
|
||||||
public PageResult<QualityConfigVO> page(QualityConfigQuery query) {
|
public PageResult<QualityConfigVo> page(QualityConfigQuery query) {
|
||||||
IPage<QualityConfigEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
IPage<QualityConfigEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||||
return new PageResult<>(QualityConfigConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
return new PageResult<>(QualityConfigConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QualityConfigVO get(Long id) {
|
public QualityConfigVo get(Long id) {
|
||||||
QualityConfigVO QualityConfigVO= QualityConfigConvert.INSTANCE.convert(baseMapper.selectById(id));
|
QualityConfigVo QualityConfigVo= QualityConfigConvert.INSTANCE.convert(baseMapper.selectById(id));
|
||||||
List<Integer> metadataIds=QualityConfigVO.getMetadataIds();
|
List<Integer> metadataIds=QualityConfigVo.getMetadataIds();
|
||||||
LambdaQueryWrapper<MetadataEntity> metadataWrapper= Wrappers.lambdaQuery();
|
LambdaQueryWrapper<MetadataEntity> metadataWrapper= Wrappers.lambdaQuery();
|
||||||
metadataWrapper.in(MetadataEntity::getId,metadataIds);
|
metadataWrapper.in(MetadataEntity::getId,metadataIds);
|
||||||
List<MetadataEntity> metadataEntities=metadataDao.selectList(metadataWrapper);
|
List<MetadataEntity> metadataEntities=metadataDao.selectList(metadataWrapper);
|
||||||
if (CollectionUtils.isEmpty(metadataEntities)){
|
if (CollectionUtils.isEmpty(metadataEntities)){
|
||||||
QualityConfigVO.setMetadataStrs("检测字段已删除,请检查数据信息");
|
QualityConfigVo.setMetadataStrs("检测字段已删除,请检查数据信息");
|
||||||
}else {
|
}else {
|
||||||
QualityConfigVO.setMetadataStrs(metadataEntities.stream().map(MetadataEntity::getPath).collect(Collectors.joining(";")));
|
QualityConfigVo.setMetadataStrs(metadataEntities.stream().map(MetadataEntity::getPath).collect(Collectors.joining(";")));
|
||||||
}
|
}
|
||||||
if (BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(QualityConfigVO.getRuleId())){
|
if (BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(QualityConfigVo.getRuleId())){
|
||||||
QualityConfigParam param = QualityConfigVO.getParam();
|
QualityConfigParam param = QualityConfigVo.getParam();
|
||||||
Integer columnMetaId = param.getColumnMetaId();
|
Integer columnMetaId = param.getColumnMetaId();
|
||||||
MetadataEntity entity = metadataDao.selectById(columnMetaId);
|
MetadataEntity entity = metadataDao.selectById(columnMetaId);
|
||||||
if (entity!= null){
|
if (entity!= null){
|
||||||
QualityConfigVO.setRelMetadataStr(entity.getPath());
|
QualityConfigVo.setRelMetadataStr(entity.getPath());
|
||||||
}else {
|
}else {
|
||||||
QualityConfigVO.setMetadataStrs("关联字段已被删除,请检查元数据信息");
|
QualityConfigVo.setMetadataStrs("关联字段已被删除,请检查元数据信息");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QualityConfigVO;
|
return QualityConfigVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(QualityConfigVO vo) {
|
public void save(QualityConfigVo vo) {
|
||||||
QualityConfigEntity entity=QualityConfigConvert.INSTANCE.convert(vo);
|
QualityConfigEntity entity=QualityConfigConvert.INSTANCE.convert(vo);
|
||||||
entity.setProjectId(getProjectId());
|
entity.setProjectId(getProjectId());
|
||||||
if (!BuiltInQualityRule.UNIQUENESS.getId().equals(entity.getRuleId())&&!BuiltInQualityRule.LENGTH_CHECK.getId().equals(entity.getRuleId())&& !BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(entity.getRuleId())&&!BuiltInQualityRule.TIMELINESS.getId().equals(entity.getRuleId())){
|
if (!BuiltInQualityRule.UNIQUENESS.getId().equals(entity.getRuleId())&&!BuiltInQualityRule.LENGTH_CHECK.getId().equals(entity.getRuleId())&& !BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(entity.getRuleId())&&!BuiltInQualityRule.TIMELINESS.getId().equals(entity.getRuleId())){
|
||||||
|
@ -79,7 +79,7 @@ public class QualityConfigServiceimpl extends BaseServiceImpl<QualityConfigDao,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(QualityConfigVO vo) {
|
public void update(QualityConfigVo vo) {
|
||||||
if (!BuiltInQualityRule.UNIQUENESS.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.LENGTH_CHECK.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.TIMELINESS.getId().equals(vo.getRuleId())){
|
if (!BuiltInQualityRule.UNIQUENESS.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.LENGTH_CHECK.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.TIMELINESS.getId().equals(vo.getRuleId())){
|
||||||
vo.setParam(null);
|
vo.setParam(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -15,7 +15,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -15,7 +15,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -15,7 +15,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public、
|
# 命名空间,默认:public、
|
||||||
namespace: a60b2ca1-a8c6-47ae-94f1-741105674655
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -40,7 +40,6 @@ public class SecurityFilterConfig {
|
||||||
.and().authorizeRequests()
|
.and().authorizeRequests()
|
||||||
.antMatchers(permits).permitAll()
|
.antMatchers(permits).permitAll()
|
||||||
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
||||||
.antMatchers("/datax/**").permitAll()
|
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and().exceptionHandling().authenticationEntryPoint(new SecurityAuthenticationEntryPoint())
|
.and().exceptionHandling().authenticationEntryPoint(new SecurityAuthenticationEntryPoint())
|
||||||
.and().headers().frameOptions().disable()
|
.and().headers().frameOptions().disable()
|
||||||
|
|
|
@ -11,7 +11,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -11,7 +11,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -11,7 +11,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
<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">
|
<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">
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.srt</groupId>
|
<groupId>net.srt</groupId>
|
||||||
<artifactId>srt-cloud-module</artifactId>
|
<artifactId>srt-cloud-module</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>srt-cloud-quartz</artifactId>
|
<artifactId>srt-cloud-quartz</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>srt-cloud-api</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
<!--数据血缘-->
|
<!--数据血缘-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.srt</groupId>
|
<groupId>net.srt</groupId>
|
||||||
|
@ -31,41 +36,41 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.srt</groupId>
|
|
||||||
<artifactId>srt-cloud-mybatis</artifactId>
|
|
||||||
<version>2.0.0</version>
|
|
||||||
</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>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
|
||||||
<artifactId>quartz</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.srt</groupId>
|
<groupId>net.srt</groupId>
|
||||||
<artifactId>srt-cloud-datax</artifactId>
|
<artifactId>srt-cloud-mybatis</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</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>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
|
<artifactId>quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>srt-cloud-api</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<!--<finalName>${project.artifactId}</finalName>-->
|
<!--<finalName>${project.artifactId}</finalName>-->
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>appassembler-maven-plugin</artifactId>
|
<artifactId>appassembler-maven-plugin</artifactId>
|
||||||
|
@ -165,35 +170,36 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!--打包 日常调试打包可以把该组件注释掉,不然install的速度比较慢-->
|
<!--打包 日常调试打包可以把该组件注释掉,不然install的速度比较慢-->
|
||||||
|
<!-- <plugin>-->
|
||||||
|
<!-- <artifactId>maven-assembly-plugin</artifactId>-->
|
||||||
|
<!-- <configuration>-->
|
||||||
|
<!-- <descriptors>-->
|
||||||
|
<!-- <descriptor>../../../srt-cloud-3z/assembly/assembly-win.xml</descriptor>-->
|
||||||
|
<!-- <descriptor>../../../srt-cloud-3z/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>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptors>
|
<skipTests>true</skipTests>
|
||||||
<descriptor>${project.parent.parent.basedir}/assembly/assembly-win.xml</descriptor>
|
|
||||||
<descriptor>${project.parent.parent.basedir}/assembly/assembly-linux.xml</descriptor>
|
|
||||||
</descriptors>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>make-assembly</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<!--<plugin>
|
</plugins>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</build>
|
||||||
<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>
|
</project>
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.context.annotation.ComponentScan;
|
||||||
@EnableFeignClients
|
@EnableFeignClients
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ComponentScan(basePackages = "net.srt.framework.common.cache")
|
|
||||||
public class QuartzApplication {
|
public class QuartzApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.srt.api.module.data.integrate.dto.DataAccessDto;
|
||||||
import net.srt.api.module.data.integrate.dto.DataAccessTaskDto;
|
import net.srt.api.module.data.integrate.dto.DataAccessTaskDto;
|
||||||
import net.srt.api.module.quartz.QuartzDataAccessApi;
|
import net.srt.api.module.quartz.QuartzDataAccessApi;
|
||||||
import net.srt.api.module.quartz.constant.QuartzJobType;
|
import net.srt.api.module.quartz.constant.QuartzJobType;
|
||||||
import net.srt.datax.feign.DataAccessFeign;
|
|
||||||
import net.srt.framework.common.utils.Result;
|
import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.quartz.entity.ScheduleJobEntity;
|
import net.srt.quartz.entity.ScheduleJobEntity;
|
||||||
import net.srt.quartz.enums.JobGroupEnum;
|
import net.srt.quartz.enums.JobGroupEnum;
|
||||||
|
@ -32,7 +31,6 @@ public class QuartzDataAccessApiImpl implements QuartzDataAccessApi {
|
||||||
private final Scheduler scheduler;
|
private final Scheduler scheduler;
|
||||||
private final DataAccessApi dataAccessApi;
|
private final DataAccessApi dataAccessApi;
|
||||||
private final ScheduleJobService jobService;
|
private final ScheduleJobService jobService;
|
||||||
private final DataAccessFeign feign;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<String> releaseAccess(Long id) {
|
public Result<String> releaseAccess(Long id) {
|
||||||
|
@ -53,24 +51,48 @@ public class QuartzDataAccessApiImpl implements QuartzDataAccessApi {
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动运行任务
|
||||||
|
* @param id 任务ID
|
||||||
|
* @return 运行结果
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> handRun(Long id) {
|
public Result<String> handRun(Long id) {
|
||||||
|
// 构建任务实体
|
||||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||||
|
// 设置任务为单例,且不保存日志
|
||||||
jobEntity.setOnce(true);
|
jobEntity.setOnce(true);
|
||||||
jobEntity.setSaveLog(false);
|
jobEntity.setSaveLog(false);
|
||||||
|
// 执行任务
|
||||||
ScheduleUtils.run(scheduler, jobEntity);
|
ScheduleUtils.run(scheduler, jobEntity);
|
||||||
|
// 返回运行结果
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id构建调度任务实体
|
||||||
|
* @param id 调度任务id
|
||||||
|
* @return 调度任务实体
|
||||||
|
*/
|
||||||
private ScheduleJobEntity buildJobEntity(Long id) {
|
private ScheduleJobEntity buildJobEntity(Long id) {
|
||||||
DataAccessDto dataAccessDto = dataAccessApi.getById(id).getData();
|
DataAccessDto dataAccessDto = dataAccessApi.getById(id).getData();
|
||||||
if (dataAccessDto.getIsDatax().equals("datax")){
|
return ScheduleJobEntity.builder()
|
||||||
feign.execute(dataAccessDto);
|
.typeId(id)
|
||||||
}
|
.projectId(dataAccessDto.getProjectId())
|
||||||
return ScheduleJobEntity.builder().isDatax(dataAccessDto.getIsDatax()).typeId(id).projectId(dataAccessDto.getProjectId()).jobType(QuartzJobType.DATA_ACCESS.getValue()).jobName(String.format("[%s]%s", id.toString(), dataAccessDto.getTaskName())).concurrent(ScheduleConcurrentEnum.NO.getValue())
|
.jobType(QuartzJobType.DATA_ACCESS.getValue())
|
||||||
.beanName("dataAccessTask").method("run").jobGroup(JobGroupEnum.DATA_ACCESS.getValue()).saveLog(true).cronExpression(dataAccessDto.getCron()).status(ScheduleStatusEnum.NORMAL.getValue())
|
.jobName(String.format("[%s]%s", id.toString(), dataAccessDto.getTaskName()))
|
||||||
.params(String.valueOf(id)).once(TaskType.ONE_TIME_FULL_SYNC.getCode().equals(dataAccessDto.getTaskType())).build();
|
.concurrent(ScheduleConcurrentEnum.NO.getValue())
|
||||||
|
.beanName("dataAccessTask")
|
||||||
|
.method("run")
|
||||||
|
.jobGroup(JobGroupEnum.DATA_ACCESS.getValue())
|
||||||
|
.saveLog(true)
|
||||||
|
.cronExpression(dataAccessDto.getCron())
|
||||||
|
.status(ScheduleStatusEnum.NORMAL.getValue())
|
||||||
|
.params(String.valueOf(id))
|
||||||
|
.once(TaskType.ONE_TIME_FULL_SYNC.getCode().equals(dataAccessDto.getTaskType()))
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.srt.quartz.utils;
|
package net.srt.quartz.utils;
|
||||||
|
|
||||||
import net.srt.datax.feign.DataAccessFeign;
|
|
||||||
import net.srt.framework.common.exception.ServerException;
|
import net.srt.framework.common.exception.ServerException;
|
||||||
import net.srt.quartz.entity.ScheduleJobEntity;
|
import net.srt.quartz.entity.ScheduleJobEntity;
|
||||||
import net.srt.quartz.enums.ScheduleConcurrentEnum;
|
import net.srt.quartz.enums.ScheduleConcurrentEnum;
|
||||||
|
|
|
@ -11,7 +11,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -14,7 +14,7 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 101.34.77.101:8848
|
server-addr: 101.34.77.101:8848
|
||||||
# 命名空间,默认:public
|
# 命名空间,默认:public
|
||||||
namespace: 7e34f104-f333-4828-b36a-02146e521c9a
|
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||||
service: ${spring.application.name}
|
service: ${spring.application.name}
|
||||||
group: srt2.0
|
group: srt2.0
|
||||||
config:
|
config:
|
||||||
|
|
|
@ -2,20 +2,6 @@ server:
|
||||||
port: 8094
|
port: 8094
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
|
||||||
druid:
|
|
||||||
stat-view-servlet:
|
|
||||||
enabled: true
|
|
||||||
loginUsername: bwie
|
|
||||||
loginPassword: 123456
|
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
||||||
url: jdbc:mysql://101.34.77.101:3306/12.5yk?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: cbx@123
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
mvc:
|
|
||||||
servlet:
|
|
||||||
load-on-startup: 1
|
|
||||||
application:
|
application:
|
||||||
name: srt-cloud-data-development
|
name: srt-cloud-data-development
|
||||||
profiles:
|
profiles:
|
||||||
|
|
Loading…
Reference in New Issue