资产展示的测试代码

master
冷调 2024-08-30 20:42:21 +08:00
parent 6f41f53152
commit 91feeae686
10 changed files with 224 additions and 156 deletions

View File

@ -0,0 +1,23 @@
//package com.muyu.source.access.data.base;
//
///**
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:42
// * @ Version1.0
// * @ Description数据接入抽象类
// * @author Lenovo
// */
//public abstract class BaseDataAbsSource implements BaseDataSource{
//
// public void setQuery(BaseQuery baseQuery){
// BaseQueryHandler.set(baseQuery);
// }
//
// public <T> T getQuery(){
// return BaseQueryHandler.get();
// }
//
//
//
//}

View File

@ -0,0 +1,22 @@
//package com.muyu.source.access.data.base;
//
//import com.muyu.source.core.DataValue;
//
///**
// * @author Lenovo
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:27
// * @ Version1.0
// * @ Description数据源基准
// */
//public interface BaseDataSource {
//
// public void setQuery(BaseQuery baseQuery);
//
// public <T> T getQuery();
//
// public DataValue getDataValue();
// DataValue[] getRow();
// DataValue[][] getRows();
//}

View File

@ -0,0 +1,16 @@
//package com.muyu.source.access.data.base;
//
//import lombok.Data;
//
///**
// * @author Lenovo
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:36
// * @ Version1.0
// * @ Description基础查询
// */
//@Data
//public class BaseQuery {
//
//}

View File

@ -0,0 +1,24 @@
//package com.muyu.source.access.data.base;
//
///**
// * @author Lenovo
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:38
// * @ Version1.0
// * @ Description基础查询
// */
//public class BaseQueryHandler {
//
//
// private static final ThreadLocal<BaseQuery> BASE_QUERY_THREAD_LOCAL=new ThreadLocal<>();
//
// public static void set(BaseQuery baseQuery){
// BASE_QUERY_THREAD_LOCAL.set(baseQuery);
// }
//
// public static <T> T get(){
// return (T)BASE_QUERY_THREAD_LOCAL.get();
// }
//
//}

View File

@ -0,0 +1,31 @@
//package com.muyu.source.access.data.mysql;
//
//import com.muyu.source.access.data.base.BaseDataAbsSource;
//import com.muyu.source.core.DataValue;
//
///**
// * @author Lenovo
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:33
// * @ Version1.0
// * @ Description数据源
// */
//public class MySqlDataSource extends BaseDataAbsSource {
//
// @Override
// public DataValue getDataValue() {
// Object query = getQuery();
// return null;
// }
//
// @Override
// public DataValue[] getRow() {
// return new DataValue[0];
// }
//
// @Override
// public DataValue[][] getRows() {
// return new DataValue[0][];
// }
//}

View File

@ -0,0 +1,31 @@
//package com.muyu.source.access.data.mysql;
//
//import com.muyu.source.access.data.base.BaseQuery;
//import lombok.AllArgsConstructor;
//import lombok.Data;
//import lombok.EqualsAndHashCode;
//import lombok.NoArgsConstructor;
//import lombok.experimental.SuperBuilder;
//
//import java.util.Map;
//
///**
// * @author Lenovo
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:36
// * @ Version1.0
// * @ Descriptionmysql查询
// */
//
//@Data
//@SuperBuilder
//@AllArgsConstructor
//@NoArgsConstructor
//@EqualsAndHashCode(callSuper = true)
//public class MySqlQuery extends BaseQuery {
//
// private String sql;
//
// private Map<String,Object> params;
//}

View File

@ -0,0 +1,29 @@
//package com.muyu.source.access.data.redis;
//
//import com.muyu.source.access.data.base.BaseDataAbsSource;
//import com.muyu.source.core.DataValue;
//
///**
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-08-30-10:35
// * @ Version1.0
// * @ Descriptionredis
// * @author Lenovo
// */
//public class RedisDataSource extends BaseDataAbsSource {
// @Override
// public DataValue getDataValue() {
// return null;
// }
//
// @Override
// public DataValue[] getRow() {
// return new DataValue[0];
// }
//
// @Override
// public DataValue[][] getRows() {
// return new DataValue[0][];
// }
//}

View File

@ -0,0 +1,29 @@
package com.muyu.source.core;
import java.util.Date;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-30-10:03
* @ Version1.0
* @ Description
*/
public enum DataType {
INT("int", Integer.class),
BIGINT("bigint", Long.class),
DECIMAL("decimal", Double.class),
DATE("date", Date.class),
TIMESTAMP("timestamp", Date.class),
BOOLEAN("boolean", Boolean.class),
TEXT("text", String.class),
VERCHAR("varchar", String.class);
private final String sourceType;
private final Class<?> targetType;
DataType(String sourceType, Class<?> targetType) {
this.sourceType = sourceType;
this.targetType = targetType;
}
}

View File

@ -0,0 +1,19 @@
package com.muyu.source.core;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-30-10:01
* @ Version1.0
* @ Description
* @author Lenovo
*/
public class DataValue {
private String label;
private String key;
private String value;
private String type;
}

View File

@ -1,156 +0,0 @@
package com.muyu.source.pool;//package com.muyu.etl.property.pool;
//
//import com.muyu.etl.property.domain.EtlDataScore;
//import com.muyu.etl.property.pool.exeption.RedisConnException;
//import lombok.extern.log4j.Log4j2;
//
//import java.util.Queue;
//import java.util.concurrent.LinkedBlockingQueue;
//import java.util.concurrent.atomic.AtomicInteger;
//
///**
// * @Author作者姓名
// * @Packagecom.muyu.etl.property.pool
// * @Projectcloud-etl-property
// * @nameRedisPool
// * @Date2024/8/26 9:12
// */
//@Log4j2
//public class RedisPool implements BasePool<Jedis>{
//
// /**
// * 空闲队列
// */
// private Queue<Jedis> jedisBaseConnQueue = null;
//
// /**
// * 活动队列
// */
// private Queue<Jedis> jedisActiveConnQueue = null;
//
// /**
// * 总连接数
// */
// private AtomicInteger count=null;
//
// /**
// * redisPoolConfig
// */
//
// private EtlDataScore etlDataScore=null;
//
// /**
// * 实例化
// * @param etlDataScore
// */
// public RedisPool(EtlDataScore etlDataScore) {
// log.info("redis连接池实例化完成");
// this.etlDataScore = etlDataScore;
// }
//
// @Override
// public void init() {
//
// Integer maxCount = this.etlDataScore.getMaxCount();
//
// this.jedisBaseConnQueue = new LinkedBlockingQueue<Jedis>(maxCount);
// this.jedisActiveConnQueue = new LinkedBlockingQueue<Jedis>(maxCount);
//
// this.count = new AtomicInteger();
//
// Integer initCount = this.etlDataScore.getInitCount();
//
//
// for (Integer i = 0; i < initCount; i++) {
// this.jedisBaseConnQueue.offer(createConn());
// count.incrementAndGet();
// }
// log.info("redis连接池初始化完成!");
// }
//
// @Override
// public Jedis getConn() {
// long startTime = System.currentTimeMillis();
//
//
// while (true){
// Jedis jedis = this.jedisBaseConnQueue.poll();
// if (jedis!=null){
// this.jedisActiveConnQueue.offer(jedis);
// return jedis;
// }
//
// if (count.get()<this.etlDataScore.getMaxCount()){
// jedis = createConn();
// this.jedisActiveConnQueue.offer(jedis);
// count.incrementAndGet();
// return jedis;
// }
//
// if (System.currentTimeMillis() -startTime > this.dataSources.getMaxTime()){
// throw new RedisConnException("redis获取连接超时!");
// }
//
// }
//
// }
//
// @Override
// public void replease(Jedis conn) {
// if (this.jedisActiveConnQueue.remove(conn)){
// this.jedisBaseConnQueue.offer(conn);
// }else {
// count.decrementAndGet();
// }
//
// }
//
// @Override
// public Jedis createConn() {
// String ip = this.etlDataScore.getHost();
// String port = this.etlDataScore.getPort();
// Jedis jedis = new Jedis(ip, Integer.parseInt(port));
// log.info("初始化了一个redis的连接,{ip:"+ip+" port:"+port+"}");
// return jedis;
// }
//
// @Override
// public void closeConn() {
// closeJedisBaseConn();
// closeJedisActiveConn();
// }
//
// public void closeJedisBaseConn(){
// Jedis jedis = this.jedisBaseConnQueue.poll();
//
// if (jedis!=null){
// try {
// jedis.close();
// } catch (Exception e) {
// if (!jedis.isConnected()){
// this.jedisBaseConnQueue.offer(jedis);
// }
// throw new RuntimeException(e);
// }finally {
// closeJedisBaseConn();
// }
// }
// }
// public void closeJedisActiveConn(){
// Jedis jedis = this.jedisActiveConnQueue.poll();
//
// if (jedis!=null){
// try {
// jedis.close();
// } catch (Exception e) {
// if (!jedis.isConnected()){
// this.jedisActiveConnQueue.offer(jedis);
// }
// throw new RuntimeException(e);
// }finally {
// closeJedisActiveConn();
// }
// }
// }
//
//}