parent
e69291cd38
commit
07a2fc9618
|
@ -10,11 +10,13 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.etl.domain.AssetDataDict;
|
import com.muyu.etl.domain.AssetDataDict;
|
||||||
import com.muyu.etl.domain.BasicConfigInfo;
|
import com.muyu.etl.domain.BasicConfigInfo;
|
||||||
import com.muyu.etl.domain.DictInfo;
|
import com.muyu.etl.domain.DictInfo;
|
||||||
|
import com.muyu.etl.domain.Structure;
|
||||||
import com.muyu.etl.domain.resp.BasicDictResp;
|
import com.muyu.etl.domain.resp.BasicDictResp;
|
||||||
import com.muyu.etl.domain.resp.TableTreeResp;
|
import com.muyu.etl.domain.resp.TableTreeResp;
|
||||||
import com.muyu.etl.service.AssetDataDictService;
|
import com.muyu.etl.service.AssetDataDictService;
|
||||||
import com.muyu.etl.service.BasicConfigInfoService;
|
import com.muyu.etl.service.BasicConfigInfoService;
|
||||||
import com.muyu.etl.service.DictInfoService;
|
import com.muyu.etl.service.DictInfoService;
|
||||||
|
import com.muyu.etl.service.StructureService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -37,6 +39,8 @@ public class BasicConfigInfoController extends BaseController {
|
||||||
private AssetDataDictService assetDataDictService;
|
private AssetDataDictService assetDataDictService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictInfoService dictInfoService;
|
private DictInfoService dictInfoService;
|
||||||
|
@Autowired
|
||||||
|
private StructureService structureService;
|
||||||
/**
|
/**
|
||||||
* 查询基础信息列表
|
* 查询基础信息列表
|
||||||
*/
|
*/
|
||||||
|
@ -109,6 +113,10 @@ public class BasicConfigInfoController extends BaseController {
|
||||||
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
|
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取成功链接中的
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequiresPermissions("etl:info:test")
|
@RequiresPermissions("etl:info:test")
|
||||||
@Log(title = "获取成功链接中的")
|
@Log(title = "获取成功链接中的")
|
||||||
@GetMapping("/dataConstruct")
|
@GetMapping("/dataConstruct")
|
||||||
|
@ -129,7 +137,7 @@ public class BasicConfigInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板
|
* 通过接入id查询数据库所属字典
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -155,13 +163,23 @@ public class BasicConfigInfoController extends BaseController {
|
||||||
* 添加字典详细信息
|
* 添加字典详细信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("etl:table:list")
|
@RequiresPermissions("etl:table:add")
|
||||||
@Log(title = "添加字典表")
|
@Log(title = "添加字典表")
|
||||||
@PostMapping("/insertDictInfo")
|
@PostMapping("/insertDictInfo")
|
||||||
public Result insertDict(@RequestBody DictInfo dictInfo) throws ServletException {
|
public Result insertDict(@RequestBody DictInfo dictInfo) throws ServletException {
|
||||||
return Result.success(dictInfoService.insertDictInfo(dictInfo));
|
return Result.success(dictInfoService.insertDictInfo(dictInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改资产结构中字典信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("etl:table:update")
|
||||||
|
@Log(title = "修改资产结构中字典信息")
|
||||||
|
@PutMapping("/updateStructureInfo")
|
||||||
|
public Result updateStructureInfo(@RequestBody Structure structure){
|
||||||
|
return Result.success(structureService.updateStructureInfoDict(structure),"修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 模板
|
// * 模板
|
||||||
|
|
|
@ -60,4 +60,6 @@ public interface StructureService extends IService<Structure>
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteStructureById(Long id);
|
public int deleteStructureById(Long id);
|
||||||
|
|
||||||
|
boolean updateStructureInfoDict(Structure structure);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import com.muyu.etl.service.StructureService;
|
||||||
import com.muyu.etl.service.TableInfoService;
|
import com.muyu.etl.service.TableInfoService;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -24,9 +23,6 @@ import java.sql.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +134,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
System.out.println("Connected to the MySQL server successfully.");
|
System.out.println("Connected to the MySQL server successfully.");
|
||||||
//同步数据库信息
|
//同步数据库信息
|
||||||
//树级结构,库,表
|
//树级结构,库,表
|
||||||
TableInfo tableInfo = TableInfo.builder()
|
TableInfo tableInfoInsert = TableInfo.builder()
|
||||||
.basicId(basicConfigInfo.getId())
|
.basicId(basicConfigInfo.getId())
|
||||||
.parentId(0L)
|
.parentId(0L)
|
||||||
.tableRemark("")
|
.tableRemark("")
|
||||||
|
@ -147,10 +143,12 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
.createBy(SecurityUtils.getUsername())
|
.createBy(SecurityUtils.getUsername())
|
||||||
.createTime(new Date())
|
.createTime(new Date())
|
||||||
.build();
|
.build();
|
||||||
tableInfoService.saveOrUpdate(tableInfo,new LambdaUpdateWrapper<TableInfo>(TableInfo.class){{
|
|
||||||
eq(TableInfo::getTableName,tableInfo.getTableName());
|
tableInfoService.saveOrUpdate(tableInfoInsert,new LambdaUpdateWrapper<TableInfo>(TableInfo.class){{
|
||||||
|
eq(TableInfo::getTableName,tableInfoInsert.getTableName());
|
||||||
eq(TableInfo::getBasicId,basicConfigInfo.getId());
|
eq(TableInfo::getBasicId,basicConfigInfo.getId());
|
||||||
}});
|
}});
|
||||||
|
TableInfo tableInfo = tableInfoService.selectTableInfoByName(tableInfoInsert);
|
||||||
DatabaseMetaData metaData = conn.getMetaData();
|
DatabaseMetaData metaData = conn.getMetaData();
|
||||||
ResultSet rs = metaData.getTables(databaseName,
|
ResultSet rs = metaData.getTables(databaseName,
|
||||||
null, "%", new String[]{"TABLE", "VIEW"});
|
null, "%", new String[]{"TABLE", "VIEW"});
|
||||||
|
@ -249,6 +247,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
.isNull("YES".equals(isNullable) ? "Y" : "N")
|
.isNull("YES".equals(isNullable) ? "Y" : "N")
|
||||||
.defaultValue( columnDefault)
|
.defaultValue( columnDefault)
|
||||||
.build();
|
.build();
|
||||||
|
structureService.saveOrUpdateBatch(new ArrayList<>());
|
||||||
structureService.saveOrUpdate(build,new LambdaUpdateWrapper<Structure>(){{
|
structureService.saveOrUpdate(build,new LambdaUpdateWrapper<Structure>(){{
|
||||||
eq(Structure::getTableId,build.getTableId());
|
eq(Structure::getTableId,build.getTableId());
|
||||||
eq(Structure::getColumnName,build.getColumnName());
|
eq(Structure::getColumnName,build.getColumnName());
|
||||||
|
@ -317,6 +316,7 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
|
||||||
setParentId(tableInfo.getId());
|
setParentId(tableInfo.getId());
|
||||||
}}).stream().map(info -> {
|
}}).stream().map(info -> {
|
||||||
TableInfoStructureResp callable = null;
|
TableInfoStructureResp callable = null;
|
||||||
|
//同构线程获取响应体对象
|
||||||
try {
|
try {
|
||||||
callable = new Callable<>() {
|
callable = new Callable<>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,4 +97,12 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
|
||||||
{
|
{
|
||||||
return structureMapper.deleteStructureById(id);
|
return structureMapper.deleteStructureById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateStructureInfoDict(Structure structure) {
|
||||||
|
if ("N".equals(structure.getIsDictionary())){
|
||||||
|
structure.setDictionaryTable("");
|
||||||
|
}
|
||||||
|
return this.saveOrUpdate(structure);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue