Commit 73a1e505 authored by sml's avatar sml

冲突解决

parents b596a5e8 c8ead692
......@@ -221,7 +221,6 @@
<artifactId>hibernate-validator</artifactId>
<version>6.1.6.Final</version>
</dependency>
</dependencies>
<build>
<finalName>jz-dmp-service</finalName>
......
......@@ -7,7 +7,9 @@ import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@SpringBootApplication
@EnableCaching
public class DmpApplication implements HealthIndicator {
......
package com.jz.common.page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**分页信息封装
* @author ybz
*
*/
@ApiModel(value = "分页参数对象", description = "分页参数对象")
public class BasePageBean {
@ApiModelProperty(value = "当前页码值")
private int pageNum = 1;
@ApiModelProperty(value = "每页条数")
private int pageSize = 10;
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
}
package com.jz.common.page;
import com.github.pagehelper.PageInfo;
import com.jz.common.constant.JsonResult;
/**
* @author ybz
*
*/
public class PageInfoResponse<T> extends JsonResult {
private PageInfo<T> data;
public PageInfo<T> getData() {
return data;
}
public void setData(PageInfo<T> data) {
this.data = data;
}
}
package com.jz.dmp.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @ClassName: SwaggerConfiguration
* @Author Bellamy
* @Date 2020/11/26
*/
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.jz.dmp.modules.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("数据中台 APIs")
.description("swagger-bootstrap-ui")
.termsOfServiceUrl("http://localhost:5050/")
.contact("Bellamy")
.version("1.0")
.build();
}
}
package com.jz.dmp.modules.controller.DataIntegration;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.service.OfflineSynchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description:数据源
* @ClassName: DataSourceController
* @Author Bellamy
* @Date 2020/12/20
*/
@RestController
@RequestMapping("/dataSource")
@Api(tags = "数据集成--数据源")
public class DataSourceController {
@Autowired
private OfflineSynchService offlineSynchService;
/**
* 数据源列表分页查询
* @return
*/
@ApiOperation(value = "数据源列表分页查询", notes = "数据源列表分页查询")
@PostMapping(value = "/delRedisKeys")
public JsonResult delRedisKeys(String key) {
return new JsonResult();
}
}
package com.jz.dmp.modules.controller.DataIntegration;
import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import com.jz.dmp.modules.service.OfflineSynchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* @Description:离线同步
* @ClassName: OfflineSynchController
* @Author Bellamy
* @Date 2020/12/20
*/
@RestController
@RequestMapping("/offlineSynch")
@Api(tags = "数据集成--离线同步")
public class OfflineSynchController {
@Autowired
private OfflineSynchService offlineSynchService;
/**
* 任务列表分页查询
* @return
*/
@ApiOperation(value = "任务列表分页查询", notes = "任务列表分页查询")
@PostMapping(value = "/taskListPage")
public PageInfoResponse<TaskListPageDto> getTaskListPage(@RequestBody @Validated TaskListPageReq taskListPageReq) {
PageInfoResponse<TaskListPageDto> pageInfo = new PageInfoResponse<TaskListPageDto>();
try {
pageInfo = offlineSynchService.queryTaskListPage(taskListPageReq);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return pageInfo;
}
}
package com.jz.dmp.modules.controller.DataIntegration.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: TaskListPageDto
* @Description: 离线同步任务列表返回参数
* @Author
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel(value = "离线同步--任务列表返回参数对象", description = "任务列表返回参数对象")
public class TaskListPageDto {
/*
* id
* */
@ApiModelProperty(value = "id")
String id;
/*
* treeId
* */
@ApiModelProperty(value = "treeId")
String treeId;
/*
* 同步时间
* */
@ApiModelProperty(value = "同步时间")
String syncTime;
/*
* 同步状态
* */
@ApiModelProperty(value = "同步状态")
String syncResult;
/*
*校验状态
* */
@ApiModelProperty(value = "校验状态")
String chkResult;
/*
* 校验时间
* */
@ApiModelProperty(value = "校验时间")
String chkTime;
/*
* 创建时间
* */
@ApiModelProperty(value = "创建时间")
String creTime;
/*
* 更改时间
* */
@ApiModelProperty(value = "更改时间")
String uptTime;
public String getSyncTime() {
return syncTime;
}
public void setSyncTime(String syncTime) {
this.syncTime = syncTime;
}
public String getSyncResult() {
return syncResult;
}
public void setSyncResult(String syncResult) {
this.syncResult = syncResult;
}
public String getChkResult() {
return chkResult;
}
public void setChkResult(String chkResult) {
this.chkResult = chkResult;
}
public String getChkTime() {
return chkTime;
}
public void setChkTime(String chkTime) {
this.chkTime = chkTime;
}
public String getCreTime() {
return creTime;
}
public void setCreTime(String creTime) {
this.creTime = creTime;
}
public String getUptTime() {
return uptTime;
}
public void setUptTime(String uptTime) {
this.uptTime = uptTime;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTreeId() {
return treeId;
}
public void setTreeId(String treeId) {
this.treeId = treeId;
}
}
package com.jz.dmp.modules.controller.DataIntegration.bean;
import com.jz.common.page.BasePageBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
* @ClassName: TaskListPageReq
* @Description: 离线任务列表参数对象
* @Author:Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel(value = "离线同步--任务列表请求参数对象", description = "任务列表请求参数对象")
public class TaskListPageReq extends BasePageBean {
/*
* 项目ID
* */
@NotNull(message = "项目ID不能空")
@ApiModelProperty(value = "项目ID")
private String projectId;
/*
* 父类ID
* */
//@NotNull(message = "父类ID不能空")
@ApiModelProperty(value = "父类ID")
private String parentId;
/*
* 源数据id
* */
@ApiModelProperty(value = "源数据id")
private String sourceDb;
/*
* 目标数据库id
* */
@ApiModelProperty(value = "目标数据库id")
private String targetDb;
/*
* 源数据库表
* */
@ApiModelProperty(value = "源数据库表")
private String sourceTable;
/*
* 目标数据库表
* */
@ApiModelProperty(value = "目标数据库表")
private String targetTable;
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getSourceDb() {
return sourceDb;
}
public void setSourceDb(String sourceDb) {
this.sourceDb = sourceDb;
}
public String getTargetDb() {
return targetDb;
}
public void setTargetDb(String targetDb) {
this.targetDb = targetDb;
}
public String getSourceTable() {
return sourceTable;
}
public void setSourceTable(String sourceTable) {
this.sourceTable = sourceTable;
}
public String getTargetTable() {
return targetTable;
}
public void setTargetTable(String targetTable) {
this.targetTable = targetTable;
}
}
package com.jz.dmp.modules.controller;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.service.AtomBaseCacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.jz.common.constant.JsonResult;
import com.jz.dmp.modules.service.AtomBaseCacheService;
/**
* 暂时注释
* @author 86186
......
package com.jz.dmp.modules.dao;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import java.util.List;
import java.util.Map;
/**
* @author Bellamy
* @since 2020-12-020
*/
public interface OfflineSynchDao {
List<TaskListPageDto> queryTaskListPage(TaskListPageReq taskListPageReq) throws Exception;
}
\ No newline at end of file
package com.jz.dmp.modules.service;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
/**
* @ClassName: OfflineSynchService
* @Description:
* @Author:Bellamy
* @Date 2020/12/19
* @Version 1.0
*/
public interface OfflineSynchService {
PageInfoResponse<TaskListPageDto> queryTaskListPage(TaskListPageReq taskListPageReq) throws Exception;
}
package com.jz.dmp.modules.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import com.jz.dmp.modules.dao.OfflineSynchDao;
import com.jz.dmp.modules.service.OfflineSynchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description:离线同步服务层
* @ClassName: OfflineSynchServiceImpl
* @Author Bellamy
* @Date 2020/12/20
*/
@Service("offlineSynchService")
@Transactional
public class OfflineSynchServiceImpl implements OfflineSynchService {
@Autowired
private OfflineSynchDao offlineSynchDao;
@Override
public PageInfoResponse<TaskListPageDto> queryTaskListPage(TaskListPageReq taskListPageReq) throws Exception {
PageInfoResponse<TaskListPageDto> pageInfoResponse = new PageInfoResponse<>();
Map param = new HashMap();
//param.put("userId", user.getUserId());
//param.put("pageNum", pageBean.getPageNum());
//param.put("pageSize", pageBean.getPageSize());
PageHelper.startPage(taskListPageReq.getPageNum(), taskListPageReq.getPageSize());
List<TaskListPageDto> list = offlineSynchDao.queryTaskListPage(taskListPageReq);
PageInfo<TaskListPageDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(ResultCode.SUCCESS);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
}
# 测试环境配置
server:
port: 7180
port: 7181
#contextPath: /resource
management:
......@@ -104,3 +104,15 @@ dmp:
evn:
open: false
name:
#mybatis的配置
#mybatis:
# #配置mapper.xml文件所在路径
# mapper-locations: classpath:mapper.*/*.xml
# #配置映射类所在的包名
# type-aliases-package: com.jz.dmp.modules.model
#日志打印
logging:
level:
com.jz.dmp: debug
<?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="com.jz.dmp.modules.dao.OfflineSynchDao">
<select id="queryTaskListPage" resultType="com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto"
parameterType="com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq">
SELECT * FROM (
SELECT cast(ddt.script AS char) AS script,
ddt.chk_result AS chkResult,
ddt.sync_result AS syncResult,
ddt.id AS id,
ddt.tree_id AS treeId,
dnt.name AS treeName,
DATE_FORMAT(ddt.create_time,'%Y-%m-%d %H:%i:%s') AS createTime,
DATE_FORMAT(ddt.update_time ,'%Y-%m-%d %H:%i:%s') AS updateTime,
DATE_FORMAT(ddt.chk_time,'%Y-%m-%d %H:%i:%s') AS chkTime,
DATE_FORMAT(ddt.sync_time,'%Y-%m-%d %H:%i:%s') AS syncTime,
dsdt.datasource_type AS dbType
FROM dmp_develop_task AS ddt
INNER JOIN dmp_navigation_tree AS dnt ON ddt.TREE_ID = dnt.ID
LEFT JOIN dmp_syncing_datasource AS dsd ON
instr(script,concat('"targetDbConnection":"',dsd.datasource_name,'"'))>0
LEFT JOIN dmp_syncing_datasource_type AS dsdt ON dsd.datasource_type = dsdt.id
WHERE ddt.data_status ='1' AND ddt.TYPE='3' AND ddt.TASK_TYPE ='2'
AND dnt.CATEGORY='2' AND dnt.TYPE ='3'
AND dnt.IS_LEVEL ='1'
AND dnt.PROJECT_ID =#{projectId}
AND dsd.PROJECT_ID=#{projectId}
) AS a
WHERE 1=1
<if test="sourceDb !=null and sourceDb !=''">
AND a.SCRIPT LIKE CONCAT('%','"dbConnection":','"',#{sourceDb},'"','%')
</if>
<if test="targetDb !=null and targetDb !=''">
AND a.SCRIPT LIKE CONCAT('%','"targetDbConnection":','"',#{targetDb},'"','%')
</if>
<if test="sourceTable !=null and sourceTable !=''">
AND a.SCRIPT LIKE CONCAT('%','"registerTableName":','"',#{sourceTable},'"','%')
</if>
<if test="targetTable !=null and targetTable !=''">
AND a.SCRIPT LIKE CONCAT('%','"targetTable":','"',#{targetTable},'"','%')
</if>
ORDER BY a.createTime DESC
</select>
</mapper>
\ No newline at end of file
......@@ -16,7 +16,7 @@
<setting name="callSettersOnNulls" value="true"/>
</settings>
<typeAliases>
<package name="cn.jz.tag.modules.model"/>
<package name="com.jz.dmp.modules.model"/>
</typeAliases>
<plugins>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment