数据视图更新到2.0版本
This commit is contained in:
parent
64857adc03
commit
1fb9e0e322
@ -17,6 +17,7 @@ import jakarta.annotation.Resource;
|
|||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ public class ChartDataController {
|
|||||||
@Operation(summary = "获取图表数据")
|
@Operation(summary = "获取图表数据")
|
||||||
@OperationLog(type = "01", module = "数据可视化", description = "获取图表数据")
|
@OperationLog(type = "01", module = "数据可视化", description = "获取图表数据")
|
||||||
@PostMapping("getData")
|
@PostMapping("getData")
|
||||||
public ResponseResult getData(ChartViewDTO chartViewDTO) throws Exception {
|
public ResponseResult getData(@RequestBody ChartViewDTO chartViewDTO) throws Exception {
|
||||||
try {
|
try {
|
||||||
// 从模板数据获取
|
// 从模板数据获取
|
||||||
DatasetUtils.viewDecode(chartViewDTO);
|
DatasetUtils.viewDecode(chartViewDTO);
|
||||||
|
@ -8,11 +8,13 @@ import com.stdproject.config.WebConfig;
|
|||||||
import com.stdproject.entity.AppOptLog;
|
import com.stdproject.entity.AppOptLog;
|
||||||
import com.stdproject.entity.LoginUser;
|
import com.stdproject.entity.LoginUser;
|
||||||
import com.stdproject.entity.User;
|
import com.stdproject.entity.User;
|
||||||
|
import com.stdproject.entity.vo.CurIpVO;
|
||||||
import com.stdproject.service.IAppOptLogService;
|
import com.stdproject.service.IAppOptLogService;
|
||||||
import com.stdproject.service.IUserService;
|
import com.stdproject.service.IUserService;
|
||||||
import com.stdproject.utils.JwtUtils;
|
import com.stdproject.utils.JwtUtils;
|
||||||
import com.stdproject.utils.RsaUtils;
|
import com.stdproject.utils.RsaUtils;
|
||||||
import com.stdproject.utils.commonUtils;
|
import com.stdproject.utils.commonUtils;
|
||||||
|
import io.gisbi.utils.IPUtils;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import io.micrometer.common.util.StringUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -276,4 +278,13 @@ private Long jwtExpirationMs;
|
|||||||
sysLogService.save(sysLog);
|
sysLogService.save(sysLog);
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/ipInfo")
|
||||||
|
public CurIpVO ipInfo() {
|
||||||
|
CurIpVO curIpVO = new CurIpVO();
|
||||||
|
curIpVO.setAccount("admin");
|
||||||
|
curIpVO.setName("管理员");
|
||||||
|
curIpVO.setIp(IPUtils.get());
|
||||||
|
return curIpVO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.stdproject.controller;
|
||||||
|
|
||||||
|
import com.stdproject.common.OperationLog;
|
||||||
|
import com.stdproject.config.ResponseResult;
|
||||||
|
import com.stdproject.entity.dto.LinkageInfoDTO;
|
||||||
|
import com.stdproject.entity.dto.VisualizationLinkJumpDTO;
|
||||||
|
import com.stdproject.entity.dto.VisualizationLinkJumpInfoDTO;
|
||||||
|
import com.stdproject.mapper.ExtVisualizationLinkJumpMapper;
|
||||||
|
import com.stdproject.mapper.ExtVisualizationLinkageMapper;
|
||||||
|
import com.stdproject.response.VisualizationLinkJumpBaseResponse;
|
||||||
|
import io.gisbi.constant.CommonConstants;
|
||||||
|
import io.gisbi.utils.AuthUtils;
|
||||||
|
import io.gisbi.utils.ModelUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/linkJump")
|
||||||
|
public class VisualizationLinkJumpController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ExtVisualizationLinkJumpMapper extVisualizationLinkJumpMapper;
|
||||||
|
|
||||||
|
@Operation(summary = "根据可视化资源ID查询跳转信息")
|
||||||
|
@OperationLog(type = "01", module = "数据可视化", description = "根据可视化资源ID查询跳转信息")
|
||||||
|
@GetMapping("/queryVisualizationJumpInfo/{dvId}/{resourceTable}")
|
||||||
|
public ResponseResult queryVisualizationJumpInfo(@PathVariable Long dvId,@PathVariable String resourceTable) throws Exception {
|
||||||
|
Map<String, VisualizationLinkJumpInfoDTO> resultBase = new HashMap<>();
|
||||||
|
List<VisualizationLinkJumpDTO> resultLinkJumpList = null;
|
||||||
|
// String userid=com.stdproject.utils.AuthUtils.getUserId();
|
||||||
|
String userid="1922852335260831746";
|
||||||
|
if (CommonConstants.RESOURCE_TABLE.SNAPSHOT.equals(resourceTable)) {
|
||||||
|
resultLinkJumpList = extVisualizationLinkJumpMapper.queryWithDvIdSnapshot(dvId, Long.parseLong(userid), false);
|
||||||
|
} else {
|
||||||
|
resultLinkJumpList = extVisualizationLinkJumpMapper.queryWithDvId(dvId,Long.parseLong(userid), false);
|
||||||
|
}
|
||||||
|
Optional.ofNullable(resultLinkJumpList).orElse(new ArrayList<>()).forEach(resultLinkJump -> {
|
||||||
|
if (resultLinkJump.getChecked()) {
|
||||||
|
Long sourceViewId = resultLinkJump.getSourceViewId();
|
||||||
|
Optional.ofNullable(resultLinkJump.getLinkJumpInfoArray()).orElse(new ArrayList<>()).forEach(linkJumpInfo -> {
|
||||||
|
if (linkJumpInfo.getChecked()) {
|
||||||
|
String sourceJumpInfo = sourceViewId + "#" + linkJumpInfo.getSourceFieldId();
|
||||||
|
// 内部仪表板跳转 需要设置好仪表板ID
|
||||||
|
if ("inner".equals(linkJumpInfo.getLinkType())) {
|
||||||
|
if (linkJumpInfo.getTargetDvId() != null) {
|
||||||
|
resultBase.put(sourceJumpInfo, linkJumpInfo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 外部跳转
|
||||||
|
resultBase.put(sourceJumpInfo, linkJumpInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
VisualizationLinkJumpBaseResponse result = new VisualizationLinkJumpBaseResponse(resultBase, null);
|
||||||
|
return ResponseResult.successData(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.stdproject.controller;
|
||||||
|
|
||||||
|
import com.stdproject.common.OperationLog;
|
||||||
|
import com.stdproject.config.ResponseResult;
|
||||||
|
import com.stdproject.entity.dto.LinkageInfoDTO;
|
||||||
|
import com.stdproject.mapper.ExtVisualizationLinkageMapper;
|
||||||
|
import com.stdproject.service.manage.ChartDataManage;
|
||||||
|
import com.stdproject.utils.DatasetUtils;
|
||||||
|
import io.gisbi.constant.CommonConstants;
|
||||||
|
import io.gisbi.exception.DEException;
|
||||||
|
import io.gisbi.extensions.view.dto.ChartViewDTO;
|
||||||
|
import io.gisbi.result.ResultCode;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/linkage")
|
||||||
|
public class VisualizationLinkageController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ExtVisualizationLinkageMapper extVisualizationLinkageMapper;
|
||||||
|
|
||||||
|
@Operation(summary = "根据资源ID查询联动信息")
|
||||||
|
@OperationLog(type = "01", module = "数据可视化", description = "根据资源ID查询联动信息")
|
||||||
|
@GetMapping("/getVisualizationAllLinkageInfo/{dvId}/{resourceTable}")
|
||||||
|
public ResponseResult getVisualizationAllLinkageInfo(@PathVariable Long dvId,@PathVariable String resourceTable) throws Exception {
|
||||||
|
List<LinkageInfoDTO> info = null;
|
||||||
|
if (CommonConstants.RESOURCE_TABLE.SNAPSHOT.equals(resourceTable)) {
|
||||||
|
info = extVisualizationLinkageMapper.getPanelAllLinkageInfoSnapshot(dvId);
|
||||||
|
}else{
|
||||||
|
info = extVisualizationLinkageMapper.getPanelAllLinkageInfo(dvId);
|
||||||
|
}
|
||||||
|
info = info.stream().map(item -> {
|
||||||
|
item.setTargetInfoList(item.getTargetInfoList().stream().map(targetInfo -> {
|
||||||
|
if (targetInfo.contains(".")) {
|
||||||
|
String[] split = targetInfo.split("\\.");
|
||||||
|
if (split.length == 2) {
|
||||||
|
targetInfo = split[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return targetInfo;
|
||||||
|
}).collect(Collectors.toList()));
|
||||||
|
return item;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return ResponseResult.successData( info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
18
backend/src/main/java/com/stdproject/entity/vo/CurIpVO.java
Normal file
18
backend/src/main/java/com/stdproject/entity/vo/CurIpVO.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package com.stdproject.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CurIpVO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -3025566841330382707L;
|
||||||
|
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
}
|
@ -17,41 +17,5 @@ public interface ExtVisualizationLinkJumpMapper {
|
|||||||
|
|
||||||
List<VisualizationLinkJumpDTO> queryWithDvIdSnapshot(@Param("dvId") Long dvId,@Param("uid") Long uid,@Param("isDesktop") Boolean isDesktop);
|
List<VisualizationLinkJumpDTO> queryWithDvIdSnapshot(@Param("dvId") Long dvId,@Param("uid") Long uid,@Param("isDesktop") Boolean isDesktop);
|
||||||
|
|
||||||
VisualizationLinkJumpDTO queryWithViewId(@Param("dvId") Long dvId,@Param("viewId") Long viewId,@Param("uid") Long uid,@Param("isDesktop") Boolean isDesktop);
|
|
||||||
|
|
||||||
void deleteJumpTargetViewInfoSnapshot(@Param("dvId") Long dvId,@Param("viewId") Long viewId);
|
|
||||||
|
|
||||||
void deleteJumpInfoSnapshot(@Param("dvId") Long dvId,@Param("viewId") Long viewId);
|
|
||||||
|
|
||||||
void deleteJumpSnapshot(@Param("dvId") Long dvId,@Param("viewId") Long viewId);
|
|
||||||
|
|
||||||
void deleteJumpTargetViewInfoWithVisualization(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
void deleteJumpInfoWithVisualization(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
void deleteJumpWithVisualization(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
void deleteJumpTargetViewInfoWithVisualizationSnapshot(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
void deleteJumpInfoWithVisualizationSnapshot(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
void deleteJumpWithVisualizationSnapshot(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
List<VisualizationLinkJumpDTO> getTargetVisualizationJumpInfo(@Param("request") VisualizationLinkJumpBaseRequest request);
|
|
||||||
|
|
||||||
List<VisualizationLinkJumpDTO> getTargetVisualizationJumpInfoSnapshot(@Param("request") VisualizationLinkJumpBaseRequest request);
|
|
||||||
|
|
||||||
void copyLinkJump(@Param("copyId")Long copyId);
|
|
||||||
|
|
||||||
void copyLinkJumpInfo(@Param("copyId")Long copyId);
|
|
||||||
|
|
||||||
void copyLinkJumpTarget(@Param("copyId")Long copyId);
|
|
||||||
|
|
||||||
List<VisualizationLinkJumpVO> findLinkJumpWithDvId(@Param("dvId")Long dvId);
|
|
||||||
|
|
||||||
List<VisualizationLinkJumpInfoVO> findLinkJumpInfoWithDvId(@Param("dvId")Long dvId);
|
|
||||||
|
|
||||||
List<VisualizationViewTableVO> getViewTableDetails(@Param("dvId")Long dvId);
|
|
||||||
|
|
||||||
List<VisualizationOutParamsJumpVO> queryOutParamsTargetWithDvId(@Param("dvId")Long dvId);
|
|
||||||
}
|
}
|
||||||
|
@ -13,32 +13,6 @@ import java.util.List;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ExtVisualizationLinkageMapper {
|
public interface ExtVisualizationLinkageMapper {
|
||||||
|
List<LinkageInfoDTO> getPanelAllLinkageInfo(@Param("dvId") Long dvId);
|
||||||
List<VisualizationLinkageDTO> getViewLinkageGather(@Param("dvId") Long dvId, @Param("sourceViewId") Long sourceViewId, @Param("targetViewIds") List<String> targetViewIds);
|
List<LinkageInfoDTO> getPanelAllLinkageInfoSnapshot(@Param("dvId") Long dvId);
|
||||||
|
|
||||||
List<LinkageInfoDTO> getPanelAllLinkageInfo(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
List<VisualizationLinkageDTO> getViewLinkageGatherSnapshot(@Param("dvId") Long dvId, @Param("sourceViewId") Long sourceViewId, @Param("targetViewIds") List<String> targetViewIds);
|
|
||||||
|
|
||||||
List<LinkageInfoDTO> getPanelAllLinkageInfoSnapshot(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
List<DatasetTableFieldDTO> queryTableField(@Param("table_id") Long tableId);
|
|
||||||
|
|
||||||
List<DatasetTableFieldDTO> queryTableFieldWithViewId(@Param("viewId") Long viewId);
|
|
||||||
|
|
||||||
void deleteViewLinkage(@Param("dvId") Long dvId,@Param("sourceViewId") Long sourceViewId);
|
|
||||||
|
|
||||||
void deleteViewLinkageField(@Param("dvId") Long dvId,@Param("sourceViewId") Long sourceViewId);
|
|
||||||
|
|
||||||
void deleteViewLinkageSnapshot(@Param("dvId") Long dvId,@Param("sourceViewId") Long sourceViewId);
|
|
||||||
|
|
||||||
void deleteViewLinkageFieldSnapshot(@Param("dvId") Long dvId,@Param("sourceViewId") Long sourceViewId);
|
|
||||||
|
|
||||||
void copyViewLinkage(@Param("copyId") Long copyId);
|
|
||||||
|
|
||||||
void copyViewLinkageField(@Param("copyId") Long copyId);
|
|
||||||
|
|
||||||
List<VisualizationLinkage> findLinkageWithDvId(@Param("dvId") Long dvId);
|
|
||||||
|
|
||||||
List<VisualizationLinkageField> findLinkageFieldWithDvId(@Param("dvId") Long dvId);
|
|
||||||
}
|
}
|
||||||
|
@ -251,9 +251,7 @@ public class ChartViewManege {
|
|||||||
ChartFieldCompareDTO chartFieldCompareDTO = new ChartFieldCompareDTO();
|
ChartFieldCompareDTO chartFieldCompareDTO = new ChartFieldCompareDTO();
|
||||||
chartFieldCompareDTO.setType("none");
|
chartFieldCompareDTO.setType("none");
|
||||||
dto.setCompareCalc(chartFieldCompareDTO);
|
dto.setCompareCalc(chartFieldCompareDTO);
|
||||||
|
dto.setFormatterCfg(new FormatterCfgDTO());
|
||||||
dto.setFormatterCfg(new FormatterCfgDTO().setUnitLanguage(Lang.isChinese() ? "ch" : "en"));
|
|
||||||
|
|
||||||
dto.setSort("none");
|
dto.setSort("none");
|
||||||
dto.setFilter(Collections.emptyList());
|
dto.setFilter(Collections.emptyList());
|
||||||
return dto;
|
return dto;
|
||||||
|
@ -8,10 +8,7 @@ import com.stdproject.entity.CoreDatasource;
|
|||||||
import com.stdproject.entity.union.*;
|
import com.stdproject.entity.union.*;
|
||||||
import com.stdproject.mapper.CoreDatasetGroupMapper;
|
import com.stdproject.mapper.CoreDatasetGroupMapper;
|
||||||
import com.stdproject.mapper.CoreDatasourceMapper;
|
import com.stdproject.mapper.CoreDatasourceMapper;
|
||||||
import com.stdproject.utils.DatasetTableTypeConstants;
|
import com.stdproject.utils.*;
|
||||||
import com.stdproject.utils.SqlUtils;
|
|
||||||
import com.stdproject.utils.SqlparserUtils;
|
|
||||||
import com.stdproject.utils.TableUtils;
|
|
||||||
import io.gisbi.constant.SQLConstants;
|
import io.gisbi.constant.SQLConstants;
|
||||||
import io.gisbi.exception.DEException;
|
import io.gisbi.exception.DEException;
|
||||||
import io.gisbi.extensions.datasource.api.PluginManageApi;
|
import io.gisbi.extensions.datasource.api.PluginManageApi;
|
||||||
@ -480,8 +477,8 @@ public class DatasetSQLManage {
|
|||||||
if (coreDatasource.getType().contains(DatasourceConfiguration.DatasourceType.Excel.name()) || coreDatasource.getType().contains(DatasourceConfiguration.DatasourceType.API.name())) {
|
if (coreDatasource.getType().contains(DatasourceConfiguration.DatasourceType.Excel.name()) || coreDatasource.getType().contains(DatasourceConfiguration.DatasourceType.API.name())) {
|
||||||
coreDatasource = engineManage.getDeEngine();
|
coreDatasource = engineManage.getDeEngine();
|
||||||
}
|
}
|
||||||
|
String config= String.valueOf(EncryptUtils.aesDecrypt(coreDatasource.getConfiguration()));
|
||||||
Map map = JsonUtil.parseObject(coreDatasource.getConfiguration(), Map.class);
|
Map map=JsonUtil.parseObject(config, Map.class);
|
||||||
if (!isCross && ObjectUtils.isNotEmpty(map.get("schema"))) {
|
if (!isCross && ObjectUtils.isNotEmpty(map.get("schema"))) {
|
||||||
schemaAlias = (String) map.get("schema");
|
schemaAlias = (String) map.get("schema");
|
||||||
} else {
|
} else {
|
||||||
|
@ -478,8 +478,8 @@ public class CalciteProvider extends Provider {
|
|||||||
public Map<String, Object> jdbcFetchResultField(DatasourceRequest datasourceRequest) throws BusinessException {
|
public Map<String, Object> jdbcFetchResultField(DatasourceRequest datasourceRequest) throws BusinessException {
|
||||||
DatasourceSchemaDTO value = datasourceRequest.getDsList().entrySet().iterator().next().getValue();
|
DatasourceSchemaDTO value = datasourceRequest.getDsList().entrySet().iterator().next().getValue();
|
||||||
datasourceRequest.setDatasource(value);
|
datasourceRequest.setDatasource(value);
|
||||||
|
String config=String.valueOf(EncryptUtils.aesDecrypt(datasourceRequest.getDatasource().getConfiguration()));
|
||||||
DatasourceConfiguration datasourceConfiguration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), DatasourceConfiguration.class);
|
DatasourceConfiguration datasourceConfiguration = JsonUtil.parseObject(config, DatasourceConfiguration.class);
|
||||||
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
List<TableField> fieldList = new ArrayList<>();
|
List<TableField> fieldList = new ArrayList<>();
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
package com.stdproject.utils;
|
package com.stdproject.utils;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.KeyGenerator;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.interfaces.RSAPrivateKey;
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
import java.security.interfaces.RSAPublicKey;
|
import java.security.interfaces.RSAPublicKey;
|
||||||
@ -15,8 +21,11 @@ import java.security.spec.X509EncodedKeySpec;
|
|||||||
* @date 2020-05-18
|
* @date 2020-05-18
|
||||||
**/
|
**/
|
||||||
public class RsaUtils {
|
public class RsaUtils {
|
||||||
|
public static final String IV_KEY = "0000000000000000";
|
||||||
private static final String SRC = "123456";
|
private static final String SRC = "123456";
|
||||||
|
private static final String ALGORITHM = "AES";
|
||||||
|
public static String symmetricKey = null;
|
||||||
|
private static final int KEY_SIZE = 128;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
System.out.println("\n");
|
System.out.println("\n");
|
||||||
@ -30,6 +39,7 @@ public class RsaUtils {
|
|||||||
System.out.println("\n");
|
System.out.println("\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,6 +79,8 @@ public class RsaUtils {
|
|||||||
System.out.println("***************** 私钥加密公钥解密结束 *****************");
|
System.out.println("***************** 私钥加密公钥解密结束 *****************");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公钥解密
|
* 公钥解密
|
||||||
*
|
*
|
||||||
@ -156,8 +168,61 @@ public class RsaUtils {
|
|||||||
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
|
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
|
||||||
return new RsaKeyPair(publicKeyString, privateKeyString);
|
return new RsaKeyPair(publicKeyString, privateKeyString);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 生成AES对称加密密钥
|
||||||
|
* @return Base64编码的密钥字符串
|
||||||
|
*/
|
||||||
|
public static String generateSymmetricKey() {
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(symmetricKey)) {
|
||||||
|
KeyGenerator keyGenerator = KeyGenerator.getInstance(ALGORITHM);
|
||||||
|
keyGenerator.init(KEY_SIZE, new SecureRandom());
|
||||||
|
SecretKey secretKey = keyGenerator.generateKey();
|
||||||
|
symmetricKey = java.util.Base64.getEncoder().encodeToString(secretKey.getEncoded());
|
||||||
|
}
|
||||||
|
return symmetricKey;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 使用AES对称密钥进行加密
|
||||||
|
* @param data 待加密的数据
|
||||||
|
* @return 加密后的Base64编码字符串
|
||||||
|
*/
|
||||||
|
public static String symmetricEncrypt(String data) {
|
||||||
|
try {
|
||||||
|
byte[] iv = IV_KEY.getBytes(StandardCharsets.UTF_8);
|
||||||
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(java.util.Base64.getDecoder().decode(generateSymmetricKey()), ALGORITHM);
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
|
||||||
|
byte[] ciphertext = cipher.doFinal(data.getBytes("UTF-8"));
|
||||||
|
return java.util.Base64.getEncoder().encodeToString(ciphertext);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用AES对称密钥进行解密
|
||||||
|
* @param data 待解密的Base64编码字符串
|
||||||
|
* @return 解密后的原始数据
|
||||||
|
*/
|
||||||
|
public static String symmetricDecrypt(String data) {
|
||||||
|
try {
|
||||||
|
byte[] iv = IV_KEY.getBytes(StandardCharsets.UTF_8);
|
||||||
|
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
|
||||||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(java.util.Base64.getDecoder().decode(generateSymmetricKey()), ALGORITHM);
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
|
||||||
|
byte[] decodedCiphertext = java.util.Base64.getDecoder().decode(data);
|
||||||
|
byte[] decryptedText = cipher.doFinal(decodedCiphertext);
|
||||||
|
return new String(decryptedText, "UTF-8");
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* RSA密钥对对象
|
* RSA密钥对对象
|
||||||
*/
|
*/
|
||||||
|
@ -279,7 +279,8 @@ public class Utils {
|
|||||||
|
|
||||||
public static String replaceSchemaAlias(String sql, Map<Long, DatasourceSchemaDTO> dsMap) {
|
public static String replaceSchemaAlias(String sql, Map<Long, DatasourceSchemaDTO> dsMap) {
|
||||||
DatasourceSchemaDTO value = dsMap.entrySet().iterator().next().getValue();
|
DatasourceSchemaDTO value = dsMap.entrySet().iterator().next().getValue();
|
||||||
Map map = JsonUtil.parseObject(value.getConfiguration(), Map.class);
|
String config= String.valueOf(EncryptUtils.aesDecrypt(value.getConfiguration()));
|
||||||
|
Map map = JsonUtil.parseObject(config, Map.class);
|
||||||
if (ObjectUtils.isNotEmpty(map.get("schema"))) {
|
if (ObjectUtils.isNotEmpty(map.get("schema"))) {
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ spring:
|
|||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
datasource:
|
datasource:
|
||||||
url: ${DB_URL:jdbc:mysql://121.37.111.42:3306/gisbi-demodb?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true}
|
url: ${DB_URL:jdbc:mysql://192.168.1.58:3306/gisbi-demodb?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true}
|
||||||
username: ${DB_USERNAME:root}
|
username: ${DB_USERNAME:root}
|
||||||
password: ${DB_PASSWORD:mysql_F8ysiK@2024}
|
password: ${DB_PASSWORD:123456}
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
# HikariCP连接池配置
|
# HikariCP连接池配置
|
||||||
hikari:
|
hikari:
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
<result column="table_id" property="tableId"/>
|
<result column="table_id" property="tableId"/>
|
||||||
<result column="type" property="type"/>
|
<result column="type" property="type"/>
|
||||||
<result column="render" property="render"/>
|
<result column="render" property="render"/>
|
||||||
<collection property="tableFields" ofType="com.stdproject.entity.vo.CoreDatasetTableFieldVO">
|
<collection property="tableFields" ofType="io.gisbi.extensions.datasource.dto.DatasetTableFieldDTO">
|
||||||
<result column="field_id" jdbcType="VARCHAR" property="id"/>
|
<result column="field_id" jdbcType="VARCHAR" property="id"/>
|
||||||
<result column="origin_name" jdbcType="VARCHAR" property="originName"/>
|
<result column="origin_name" jdbcType="VARCHAR" property="originName"/>
|
||||||
<result column="field_name" jdbcType="VARCHAR" property="name"/>
|
<result column="field_name" jdbcType="VARCHAR" property="name"/>
|
||||||
|
@ -0,0 +1,112 @@
|
|||||||
|
<?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.stdproject.mapper.ExtVisualizationLinkJumpMapper">
|
||||||
|
<resultMap id="LinkJumpBaseResultMap" type="com.stdproject.entity.vo.VisualizationLinkJumpVO">
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||||
|
<result column="source_dv_id" jdbcType="BIGINT" property="sourceDvId"/>
|
||||||
|
<result column="source_view_id" jdbcType="BIGINT" property="sourceViewId"/>
|
||||||
|
<result column="link_jump_info" jdbcType="VARCHAR" property="linkJumpInfo"/>
|
||||||
|
<result column="checked" jdbcType="BIT" property="checked"/>
|
||||||
|
<result column="copy_from" jdbcType="BIGINT" property="copyFrom"/>
|
||||||
|
<result column="copy_id" jdbcType="BIGINT" property="copyId"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="LinkJumpInfoBaseResultMap" type="com.stdproject.entity.vo.VisualizationLinkJumpInfoVO">
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||||
|
<result column="link_jump_id" jdbcType="BIGINT" property="linkJumpId"/>
|
||||||
|
<result column="link_type" jdbcType="VARCHAR" property="linkType"/>
|
||||||
|
<result column="jump_type" jdbcType="VARCHAR" property="jumpType"/>
|
||||||
|
<result column="window_size" jdbcType="VARCHAR" property="windowSize"/>
|
||||||
|
<result column="target_dv_id" jdbcType="BIGINT" property="targetDvId"/>
|
||||||
|
<result column="source_field_id" jdbcType="BIGINT" property="sourceFieldId"/>
|
||||||
|
<result column="content" jdbcType="VARCHAR" property="content"/>
|
||||||
|
<result column="checked" jdbcType="BIT" property="checked"/>
|
||||||
|
<result column="attach_params" jdbcType="BIT" property="attachParams"/>
|
||||||
|
<result column="copy_from" jdbcType="BIGINT" property="copyFrom"/>
|
||||||
|
<result column="copy_id" jdbcType="BIGINT" property="copyId"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMapDTO" type="com.stdproject.entity.dto.VisualizationLinkJumpDTO"
|
||||||
|
extends="LinkJumpBaseResultMap">
|
||||||
|
<collection property="linkJumpInfoArray" ofType="com.stdproject.entity.dto.VisualizationLinkJumpInfoDTO"
|
||||||
|
column="{id=id,source_view_id=source_view_id,uid=queryUid, isDesktop=isDesktop}"
|
||||||
|
select="getLinkJumpInfo">
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMapDTOSnapshot" type="com.stdproject.entity.dto.VisualizationLinkJumpDTO"
|
||||||
|
extends="LinkJumpBaseResultMap">
|
||||||
|
<collection property="linkJumpInfoArray" ofType="com.stdproject.entity.dto.VisualizationLinkJumpInfoDTO"
|
||||||
|
column="{id=id,source_view_id=source_view_id,uid=queryUid, isDesktop=isDesktop}"
|
||||||
|
select="getLinkJumpInfoSnapshot">
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="LinkJumpInfoMap" type="com.stdproject.entity.dto.VisualizationLinkJumpInfoDTO"
|
||||||
|
extends="LinkJumpInfoBaseResultMap">
|
||||||
|
<result column="target_dv_type" jdbcType="VARCHAR" property="targetDvType"/>
|
||||||
|
<result column="source_field_id" jdbcType="BIGINT" property="sourceFieldId"/>
|
||||||
|
<result column="source_de_type" jdbcType="INTEGER" property="sourceDeType"/>
|
||||||
|
<result column="source_field_name" jdbcType="VARCHAR" property="sourceFieldName"/>
|
||||||
|
<result column="publicJumpId" jdbcType="VARCHAR" property="publicJumpId"/>
|
||||||
|
<collection property="targetViewInfoList"
|
||||||
|
ofType="com.stdproject.entity.vo.VisualizationLinkJumpTargetViewInfoVO">
|
||||||
|
<result column="target_id" jdbcType="BIGINT" property="targetId"/>
|
||||||
|
<result column="target_view_id" jdbcType="BIGINT" property="targetViewId"/>
|
||||||
|
<result column="target_field_id" jdbcType="BIGINT" property="targetFieldId"/>
|
||||||
|
<result column="source_field_active_id" jdbcType="VARCHAR" property="sourceFieldActiveId"/>
|
||||||
|
<result column="target_type" jdbcType="VARCHAR" property="targetType"/>
|
||||||
|
<result column="outer_params_name" jdbcType="VARCHAR" property="outerParamsName"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="ViewTableFieldDetailsMap" type="com.stdproject.entity.vo.VisualizationViewTableVO">
|
||||||
|
<result column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="title" jdbcType="VARCHAR" property="title"/>
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||||
|
<result column="dv_id" jdbcType="BIGINT" property="dvId"/>
|
||||||
|
<collection property="tableFields"
|
||||||
|
ofType="io.gisbi.extensions.datasource.dto.DatasetTableFieldDTO">
|
||||||
|
<result column="field_id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="origin_name" jdbcType="VARCHAR" property="originName"/>
|
||||||
|
<result column="field_name" jdbcType="VARCHAR" property="name"/>
|
||||||
|
<result column="field_type" jdbcType="VARCHAR" property="type"/>
|
||||||
|
<result column="de_type" jdbcType="VARCHAR" property="deType"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="AllJumpMap" type="com.stdproject.entity.dto.VisualizationLinkJumpDTO">
|
||||||
|
<result column="sourceInfo" jdbcType="VARCHAR" property="sourceInfo"/>
|
||||||
|
<collection property="targetInfoList" ofType="String">
|
||||||
|
<result column="targetInfo" jdbcType="VARCHAR"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="queryWithDvId" resultMap="BaseResultMapDTO">
|
||||||
|
SELECT ccv.id AS source_view_id,
|
||||||
|
#{uid} as queryUid,
|
||||||
|
#{isDesktop} as isDesktop,
|
||||||
|
vlj.id,
|
||||||
|
#{dvId} as source_dv_id, vlj.link_jump_info,
|
||||||
|
ifnull(ccv.jump_active, 0) AS checked
|
||||||
|
FROM core_chart_view ccv
|
||||||
|
LEFT JOIN visualization_link_jump vlj ON ccv.id = vlj.source_view_id
|
||||||
|
WHERE vlj.source_dv_id = #{dvId}
|
||||||
|
and ccv.jump_active = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryWithDvIdSnapshot" resultMap="BaseResultMapDTOSnapshot">
|
||||||
|
SELECT ccv.id AS source_view_id,
|
||||||
|
#{uid} as queryUid,
|
||||||
|
#{isDesktop} as isDesktop,
|
||||||
|
vlj.id,
|
||||||
|
#{dvId} as source_dv_id, vlj.link_jump_info,
|
||||||
|
ifnull(ccv.jump_active, 0) AS checked
|
||||||
|
FROM snapshot_core_chart_view ccv
|
||||||
|
LEFT JOIN snapshot_visualization_link_jump vlj ON ccv.id = vlj.source_view_id
|
||||||
|
WHERE vlj.source_dv_id = #{dvId}
|
||||||
|
and ccv.jump_active = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,43 @@
|
|||||||
|
<?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.stdproject.mapper.ExtVisualizationLinkageMapper">
|
||||||
|
|
||||||
|
<resultMap id="AllLinkageMap" type="com.stdproject.entity.dto.LinkageInfoDTO">
|
||||||
|
<result column="sourceInfo" jdbcType="VARCHAR" property="sourceInfo"/>
|
||||||
|
<collection property="targetInfoList" ofType="String">
|
||||||
|
<result column="targetInfo" jdbcType="VARCHAR"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getPanelAllLinkageInfo" resultMap="AllLinkageMap">
|
||||||
|
SELECT DISTINCT
|
||||||
|
CONCAT( vl.source_view_id, '#', vlf.source_field ) AS sourceInfo,
|
||||||
|
CONCAT( vl.target_view_id, '#', vlf.target_field ) AS targetInfo
|
||||||
|
FROM
|
||||||
|
visualization_linkage vl
|
||||||
|
LEFT JOIN core_chart_view ccv ON vl.source_view_id = ccv.id
|
||||||
|
LEFT JOIN visualization_linkage_field vlf ON vl.id = vlf.linkage_id
|
||||||
|
WHERE
|
||||||
|
vl.dv_id = #{dvId}
|
||||||
|
AND ccv.linkage_active = 1
|
||||||
|
AND vl.linkage_active = 1
|
||||||
|
AND vlf.id IS NOT NULL
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getPanelAllLinkageInfoSnapshot" resultMap="AllLinkageMap">
|
||||||
|
SELECT DISTINCT
|
||||||
|
CONCAT( vl.source_view_id, '#', vlf.source_field ) AS sourceInfo,
|
||||||
|
CONCAT( vl.target_view_id, '#', vlf.target_field ) AS targetInfo
|
||||||
|
FROM
|
||||||
|
snapshot_visualization_linkage vl
|
||||||
|
LEFT JOIN snapshot_core_chart_view ccv ON vl.source_view_id = ccv.id
|
||||||
|
LEFT JOIN snapshot_visualization_linkage_field vlf ON vl.id = vlf.linkage_id
|
||||||
|
WHERE
|
||||||
|
vl.dv_id = #{dvId}
|
||||||
|
AND ccv.linkage_active = 1
|
||||||
|
AND vl.linkage_active = 1
|
||||||
|
AND vlf.id IS NOT NULL
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user