Merge branch 'dev' into pr@dev@sqlserver

This commit is contained in:
taojinlong 2021-08-03 12:23:23 +08:00
commit 41f3b001a7
83 changed files with 997 additions and 434 deletions

View File

@ -384,7 +384,7 @@
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
@ -414,6 +414,12 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>

View File

@ -1,5 +1,6 @@
package io.dataease.auth.api;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.api.dto.LoginDto;
import io.swagger.annotations.Api;
@ -12,6 +13,7 @@ import java.util.Map;
@Api(tags = "权限:权限管理")
@ApiSupport(order = 10)
@RequestMapping("/api/auth")
public interface AuthApi {

View File

@ -1,14 +1,17 @@
package io.dataease.auth.api;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.api.dto.DynamicMenuDto;
import io.dataease.controller.handler.annotation.I18n;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Api(tags = "权限:动态菜单")
@ApiSupport(order = 20)
@RequestMapping("/api/dynamicMenu")
public interface DynamicMenuApi {
@ -16,6 +19,7 @@ public interface DynamicMenuApi {
* 根据heads中获取的token 获取username 获取对应权限的菜单
* @return
*/
@ApiOperation("查询")
@PostMapping("/menus")
@I18n
List<DynamicMenuDto> menus();

View File

@ -34,10 +34,14 @@ public class F2CLinkFilter extends AnonymousFilter {
String id = resourceId.asString();
PanelLink panelLink = LinkUtil.queryLink(id);
if (ObjectUtil.isEmpty(panelLink)) return false;
String pwd;
if (!panelLink.getEnablePwd()) {
panelLink.setPwd("dataease");
pwd = panelLink.getPwd();
}else {
pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, panelLink.getPwd());
}
return JWTUtils.verifyLink(link_token, id, RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, panelLink.getPwd()));
return JWTUtils.verifyLink(link_token, id, pwd);
}catch (Exception e) {
LogUtil.error(e);
}

View File

@ -49,6 +49,9 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String authorization = httpServletRequest.getHeader("Authorization");
if (StringUtils.startsWith(authorization, "Basic")) {
return false;
}
// 当没有出现登录超时 且需要刷新token 则执行刷新token
if (JWTUtils.loginExpire(authorization)){
throw new AuthenticationException(expireMessage);

View File

@ -12,6 +12,7 @@ import io.dataease.auth.util.JWTUtils;
import io.dataease.auth.util.RsaUtil;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.LogUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.exception.DataEaseException;
@ -84,8 +85,17 @@ public class AuthServer implements AuthApi {
@Override
public String logout() {
String token = ServletUtils.getToken();
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
authUserService.clearCache(userId);
if (StringUtils.isEmpty(token) || StringUtils.equals("null", token) || StringUtils.equals("undefined", token)) {
return "success";
}
try{
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
authUserService.clearCache(userId);
}catch (Exception e) {
LogUtil.error(e);
return "fail";
}
return "success";
}

View File

@ -52,11 +52,11 @@ public class ExtAuthServiceImpl implements ExtAuthService {
}
if (!CollectionUtils.isEmpty(authMap.get("role"))) {
authURD.setUserIds(authMap.get("role").stream().map(item -> Long.parseLong(item.getAuthTarget())).collect(Collectors.toList()));
authURD.setRoleIds(authMap.get("role").stream().map(item -> Long.parseLong(item.getAuthTarget())).collect(Collectors.toList()));
}
if (!CollectionUtils.isEmpty(authMap.get("dept"))) {
authURD.setUserIds(authMap.get("dept").stream().map(item -> Long.parseLong(item.getAuthTarget())).collect(Collectors.toList()));
authURD.setDeptIds(authMap.get("dept").stream().map(item -> Long.parseLong(item.getAuthTarget())).collect(Collectors.toList()));
}
return authURD;
}

View File

@ -2,7 +2,7 @@ package io.dataease.base.mapper.ext;
import io.dataease.base.domain.SysMsgExample;
import io.dataease.base.domain.SysMsgSetting;
import io.dataease.controller.message.dto.MsgGridDto;
import io.dataease.controller.sys.response.MsgGridDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.dataease.base.mapper.ext.ExtSysMsgMapper">
<resultMap id="msgGridDto" type="io.dataease.controller.message.dto.MsgGridDto" extends="io.dataease.base.mapper.SysMsgMapper.BaseResultMap">
<resultMap id="msgGridDto" type="io.dataease.controller.sys.response.MsgGridDto" extends="io.dataease.base.mapper.SysMsgMapper.BaseResultMap">
<result column="router" property="router"></result>
<result column="callback" property="callback"></result>
</resultMap>

View File

@ -3,6 +3,7 @@ package io.dataease.config;
import cn.hutool.core.collection.CollectionUtil;
import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@ -24,6 +25,9 @@ public class Knife4jConfiguration {
private final OpenApiExtensionResolver openApiExtensionResolver;
@Value("${app.version}")
private String version;
@Autowired
public Knife4jConfiguration(OpenApiExtensionResolver openApiExtensionResolver) {
@ -63,24 +67,20 @@ public class Knife4jConfiguration {
private ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title("DataEase很棒~~~")
.license("杭州飞致云信息科技有限公司 1.0-b9")
.description("人人可用的可视化工具")
.termsOfServiceUrl("http://fit2cloud.com/")
.title("DataEase")
.description("人人可用的开源数据可视化分析工具")
.termsOfServiceUrl("https://dataease.io")
.contact(new Contact("fit2cloud","https://www.fit2cloud.com/dataease/index.html","dataease@fit2cloud.com"))
.version("1.0")
.version(version)
.build();
}
private Docket defaultApi(String groupName, String packageName) {
List<SecurityScheme> securitySchemes=new ArrayList<>();
securitySchemes.add(apiKey());
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(securityContext());
HttpAuthenticationScheme httpAuthenticationScheme = HttpAuthenticationScheme.JWT_BEARER_BUILDER
.name(HttpHeaders.AUTHORIZATION)
.description("Bearer Token")
.build();
securitySchemes.add(httpAuthenticationScheme);
Docket docket=new Docket(DocumentationType.OAS_30)
.apiInfo(apiInfo())
.groupName(groupName)
@ -100,12 +100,16 @@ public class Knife4jConfiguration {
.build();
}
private ApiKey apiKey() {
return new ApiKey("Authorization", "Authorization", "header");
}
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return CollectionUtil.newArrayList(new SecurityReference("BearerToken", authorizationScopes));
return CollectionUtil.newArrayList(new SecurityReference("Authorization", authorizationScopes));
}
}

View File

@ -1,18 +1,24 @@
package io.dataease.controller.chart;
import com.alibaba.fastjson.JSON;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "视图:视图管理")
@ApiSupport(order = 110)
@RestController
@RequestMapping("chart/table")
public class ChartController {
@ApiOperation("查询")
@PostMapping("list")
public List<JSON> list(@RequestBody DataSetTableRequest dataSetTableRequest) {
return new ArrayList<>();

View File

@ -1,40 +1,51 @@
package io.dataease.controller.chart;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.ChartGroup;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.dto.chart.ChartGroupDTO;
import io.dataease.service.chart.ChartGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@Api(tags = "视图:视图组")
@ApiSupport(order = 120)
@RestController
@RequestMapping("chart/group")
public class ChartGroupController {
@Resource
private ChartGroupService chartGroupService;
@ApiOperation("保存")
@PostMapping("/save")
public ChartGroupDTO save(@RequestBody ChartGroup ChartGroup) {
return chartGroupService.save(ChartGroup);
}
@ApiOperation("查询树")
@PostMapping("/tree")
public List<ChartGroupDTO> tree(@RequestBody ChartGroupRequest ChartGroup) {
return chartGroupService.tree(ChartGroup);
}
@ApiOperation("查询树节点")
@PostMapping("/treeNode")
public List<ChartGroupDTO> treeNode(@RequestBody ChartGroupRequest ChartGroup) {
return chartGroupService.tree(ChartGroup);
}
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void tree(@PathVariable String id) {
chartGroupService.delete(id);
}
@ApiIgnore
@PostMapping("/getScene/{id}")
public ChartGroup getScene(@PathVariable String id) {
return chartGroupService.getScene(id);

View File

@ -1,5 +1,6 @@
package io.dataease.controller.chart;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.ChartViewWithBLOBs;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.request.chart.ChartExtRequest;
@ -8,7 +9,10 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.service.chart.ChartViewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@ -18,57 +22,69 @@ import java.util.Map;
* @Author gin
* @Date 2021/3/1 1:17 下午
*/
@Api(tags = "视图:视图域")
@ApiSupport(order = 130)
@RestController
@RequestMapping("/chart/view")
public class ChartViewController {
@Resource
private ChartViewService chartViewService;
@ApiOperation("保存")
@PostMapping("/save")
public ChartViewWithBLOBs save(@RequestBody ChartViewWithBLOBs chartViewWithBLOBs) {
return chartViewService.save(chartViewWithBLOBs);
}
@ApiOperation("查询")
@PostMapping("/list")
public List<ChartViewDTO> list(@RequestBody ChartViewRequest chartViewRequest) {
return chartViewService.list(chartViewRequest);
}
@ApiOperation("查询组")
@PostMapping("/listAndGroup")
public List<ChartViewDTO> listAndGroup(@RequestBody ChartViewRequest chartViewRequest) {
return chartViewService.listAndGroup(chartViewRequest);
}
@ApiOperation("详息")
@PostMapping("/get/{id}")
public ChartViewWithBLOBs get(@PathVariable String id) {
return chartViewService.get(id);
}
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void delete(@PathVariable String id) {
chartViewService.delete(id);
}
@ApiOperation("数据")
@PostMapping("/getData/{id}")
public ChartViewDTO getData(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception {
return chartViewService.getData(id, requestList);
}
@ApiOperation("视图详情")
@PostMapping("chartDetail/{id}")
public Map<String, Object> chartDetail(@PathVariable String id) {
return chartViewService.getChartDetail(id);
}
@ApiOperation("复制")
@PostMapping("chartCopy/{id}")
public String chartCopy(@PathVariable String id) {
return chartViewService.chartCopy(id);
}
@ApiIgnore
@GetMapping("searchAdviceSceneId/{panelId}")
public String searchAdviceSceneId(@PathVariable String panelId) {
return chartViewService.searchAdviceSceneId(panelId);
}
@ApiOperation("根据权限查详情")
@PostMapping("/getOneWithPermission/{id}")
public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception {
//如果能获取用户 则添加对应的权限
@ -80,7 +96,7 @@ public class ChartViewController {
return dto;
}
@ApiOperation("搜索")
@PostMapping("search")
public List<ChartViewDTO> search(@RequestBody ChartViewRequest chartViewRequest) {
return chartViewService.search(chartViewRequest);

View File

@ -1,11 +1,15 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.dataset.ExtractDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@ -14,6 +18,8 @@ import java.util.List;
* @Author gin
* @Date 2021/2/20 8:29 下午
*/
@Api(tags = "数据集:数据集组")
@ApiSupport(order = 40)
@RestController
@RequestMapping("dataset/group")
public class DataSetGroupController {
@ -22,31 +28,37 @@ public class DataSetGroupController {
@Resource
private ExtractDataService extractDataService;
@ApiOperation("保存")
@PostMapping("/save")
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
return dataSetGroupService.save(datasetGroup);
}
@ApiOperation("查询树")
@PostMapping("/tree")
public List<DataSetGroupDTO> tree(@RequestBody DataSetGroupRequest datasetGroup) {
return dataSetGroupService.tree(datasetGroup);
}
@ApiOperation("查询树节点")
@PostMapping("/treeNode")
public List<DataSetGroupDTO> treeNode(@RequestBody DataSetGroupRequest datasetGroup) {
return dataSetGroupService.treeNode(datasetGroup);
}
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void tree(@PathVariable String id) throws Exception {
dataSetGroupService.delete(id);
}
@ApiIgnore
@PostMapping("/getScene/{id}")
public DatasetGroup getScene(@PathVariable String id) {
return dataSetGroupService.getScene(id);
}
@ApiOperation("检测kettle")
@PostMapping("/isKettleRunning")
public boolean isKettleRunning() {
return extractDataService.isKettleRunning();

View File

@ -1,5 +1,6 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetTable;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.DatasetTableIncrementalConfig;
@ -7,6 +8,8 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.datasource.dto.TableFiled;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.service.dataset.DataSetTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -18,97 +21,117 @@ import java.util.Map;
* @Author gin
* @Date 2021/2/20 8:29 下午
*/
@Api(tags = "数据集:数据集表")
@ApiSupport(order = 50)
@RestController
@RequestMapping("dataset/table")
public class DataSetTableController {
@Resource
private DataSetTableService dataSetTableService;
@ApiOperation("批量保存")
@PostMapping("batchAdd")
public void batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
dataSetTableService.batchInsert(datasetTable);
}
@ApiOperation("更新")
@PostMapping("update")
public DatasetTable save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
return dataSetTableService.save(datasetTable);
}
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) throws Exception {
dataSetTableService.delete(id);
}
@ApiOperation("查询")
@PostMapping("list")
public List<DataSetTableDTO> list(@RequestBody DataSetTableRequest dataSetTableRequest) {
return dataSetTableService.list(dataSetTableRequest);
}
@ApiOperation("查询组")
@PostMapping("listAndGroup")
public List<DataSetTableDTO> listAndGroup(@RequestBody DataSetTableRequest dataSetTableRequest) {
return dataSetTableService.listAndGroup(dataSetTableRequest);
}
@ApiOperation("详息")
@PostMapping("get/{id}")
public DatasetTable get(@PathVariable String id) {
return dataSetTableService.get(id);
}
@ApiOperation("带权限查询")
@PostMapping("getWithPermission/{id}")
public DataSetTableDTO getWithPermission(@PathVariable String id) {
return dataSetTableService.getWithPermission(id);
}
@ApiOperation("查询原始字段")
@PostMapping("getFields")
public List<TableFiled> getFields(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getFields(dataSetTableRequest);
}
@ApiOperation("查询生成字段")
@PostMapping("getFieldsFromDE")
public Map<String, List<DatasetTableField>> getFieldsFromDE(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getFieldsFromDE(dataSetTableRequest);
}
@ApiOperation("查询预览数据")
@PostMapping("getPreviewData/{page}/{pageSize}")
public Map<String, Object> getPreviewData(@RequestBody DataSetTableRequest dataSetTableRequest, @PathVariable Integer page, @PathVariable Integer pageSize) throws Exception {
return dataSetTableService.getPreviewData(dataSetTableRequest, page, pageSize);
}
@ApiOperation("根据sql查询预览数据")
@PostMapping("sqlPreview")
public Map<String, Object> getSQLPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getSQLPreview(dataSetTableRequest);
}
@ApiOperation("客户预览数据")
@PostMapping("customPreview")
public Map<String, Object> customPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getCustomPreview(dataSetTableRequest);
}
@ApiOperation("查询增量配置")
@PostMapping("incrementalConfig")
public DatasetTableIncrementalConfig incrementalConfig(@RequestBody DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
return dataSetTableService.incrementalConfig(datasetTableIncrementalConfig);
}
@ApiOperation("保存增量配置")
@PostMapping("save/incrementalConfig")
public void saveIncrementalConfig(@RequestBody DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
dataSetTableService.saveIncrementalConfig(datasetTableIncrementalConfig);
}
@ApiOperation("数据集详息")
@PostMapping("datasetDetail/{id}")
public Map<String, Object> datasetDetail(@PathVariable String id) {
return dataSetTableService.getDatasetDetail(id);
}
@ApiOperation("excel上传")
@PostMapping("excel/upload")
public Map<String, Object> excelUpload(@RequestParam("file") MultipartFile file, @RequestParam("tableId") String tableId) throws Exception {
return dataSetTableService.excelSaveAndParse(file, tableId);
}
@ApiOperation("检测doris")
@PostMapping("checkDorisTableIsExists/{id}")
public Boolean checkDorisTableIsExists(@PathVariable String id) throws Exception {
return dataSetTableService.checkDorisTableIsExists(id);
}
@ApiOperation("搜索")
@PostMapping("search")
public List<DataSetTableDTO> search(@RequestBody DataSetTableRequest dataSetTableRequest) {
return dataSetTableService.search(dataSetTableRequest);

View File

@ -1,8 +1,11 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.service.dataset.DataSetFieldService;
import io.dataease.service.dataset.DataSetTableFieldsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -15,6 +18,8 @@ import java.util.Map;
* @Author gin
* @Date 2021/2/24 4:28 下午
*/
@Api(tags = "数据集:数据集字段")
@ApiSupport(order = 60)
@RestController
@RequestMapping("/dataset/field")
public class DataSetTableFieldController {
@ -24,6 +29,7 @@ public class DataSetTableFieldController {
@Autowired
private DataSetFieldService dataSetFieldService;
@ApiOperation("查询表下属字段")
@PostMapping("list/{tableId}")
public List<DatasetTableField> list(@PathVariable String tableId) {
DatasetTableField datasetTableField = DatasetTableField.builder().build();
@ -31,6 +37,7 @@ public class DataSetTableFieldController {
return dataSetTableFieldsService.list(datasetTableField);
}
@ApiOperation("分组查询表下属字段")
@PostMapping("listByDQ/{tableId}")
public Map<String, List<DatasetTableField>> listByDQ(@PathVariable String tableId) {
DatasetTableField datasetTableField = DatasetTableField.builder().build();
@ -46,21 +53,24 @@ public class DataSetTableFieldController {
return map;
}
@ApiOperation("批量更新")
@PostMapping("batchEdit")
public void batchEdit(@RequestBody List<DatasetTableField> list) {
dataSetTableFieldsService.batchEdit(list);
}
@ApiOperation("保存")
@PostMapping("save")
public DatasetTableField save(@RequestBody DatasetTableField datasetTableField) {
return dataSetTableFieldsService.save(datasetTableField);
}
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) {
dataSetTableFieldsService.delete(id);
}
@ApiOperation("值枚举")
@PostMapping("fieldValues/{fieldId}")
public List<Object> fieldValues(@PathVariable String fieldId) {
return dataSetFieldService.fieldValues(fieldId);

View File

@ -2,6 +2,7 @@ package io.dataease.controller.dataset;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetTableTask;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -10,6 +11,7 @@ import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.service.dataset.DataSetTableTaskLogService;
import io.dataease.service.dataset.DataSetTableTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@ -20,6 +22,8 @@ import java.util.List;
* @Author gin
* @Date 2021/3/4 1:32 下午
*/
@Api(tags = "数据集:数据集任务")
@ApiSupport(order = 90)
@RestController
@RequestMapping("dataset/task")
public class DataSetTableTaskController {
@ -28,22 +32,25 @@ public class DataSetTableTaskController {
@Resource
private DataSetTableTaskLogService dataSetTableTaskLogService;
@ApiOperation("保存")
@PostMapping("save")
public DatasetTableTask save(@RequestBody DataSetTaskRequest dataSetTaskRequest) throws Exception {
return dataSetTableTaskService.save(dataSetTaskRequest);
}
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) {
dataSetTableTaskService.delete(id);
}
@ApiOperation("查询")
@PostMapping("list")
public List<DatasetTableTask> list(@RequestBody DatasetTableTask datasetTableTask) {
return dataSetTableTaskService.list(datasetTableTask);
}
@ApiOperation("查看数据集任务")
@ApiOperation("分页查询")
@PostMapping("/pageList/{goPage}/{pageSize}")
public Pager<List<DataSetTaskDTO>> taskList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
@ -51,16 +58,19 @@ public class DataSetTableTaskController {
return PageUtils.setPageInfo(page, dataSetTableTaskService.taskList4User(request));
}
@ApiOperation("上次执行时间")
@PostMapping("/lastExecStatus")
public DataSetTaskDTO lastExecStatus(@RequestBody DataSetTaskDTO datasetTableTask) {
return dataSetTableTaskLogService.lastExecStatus(datasetTableTask);
}
@ApiOperation("更新状态")
@PostMapping("/updateStatus")
public void updateStatus(@RequestBody DatasetTableTask datasetTableTask) {
dataSetTableTaskService.updateDatasetTableTaskStatus(datasetTableTask);
}
@ApiOperation("执行任务")
@PostMapping("/execTask")
public void execTask(@RequestBody DatasetTableTask datasetTableTask) throws Exception{
dataSetTableTaskService.execTask(datasetTableTask);

View File

@ -2,12 +2,15 @@ package io.dataease.controller.dataset;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetTableTaskLog;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.dataset.DataSetTaskLogDTO;
import io.dataease.service.dataset.DataSetTableTaskLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -17,22 +20,27 @@ import java.util.List;
* @Author gin
* @Date 2021/3/4 1:32 下午
*/
@Api(tags = "数据集:数据集任务执行记录")
@ApiSupport(order = 100)
@RestController
@RequestMapping("dataset/taskLog")
public class DataSetTableTaskLogController {
@Resource
private DataSetTableTaskLogService dataSetTableTaskLogService;
@ApiOperation("保存")
@PostMapping("save")
public DatasetTableTaskLog save(@RequestBody DatasetTableTaskLog datasetTableTaskLog) {
return dataSetTableTaskLogService.save(datasetTableTaskLog);
}
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) {
dataSetTableTaskLogService.delete(id);
}
@ApiOperation("分页查询")
@PostMapping("list/{type}/{goPage}/{pageSize}")
public Pager<List<DataSetTaskLogDTO>> list(@RequestBody BaseGridRequest request, @PathVariable String type, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);

View File

@ -1,8 +1,11 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetTableUnion;
import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.service.dataset.DataSetTableUnionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -12,22 +15,27 @@ import java.util.List;
* @Author gin
* @Date 2021/5/7 10:30 上午
*/
@Api(tags = "数据集:数据集关联")
@ApiSupport(order = 70)
@RestController
@RequestMapping("dataset/union")
public class DataSetTableUnionController {
@Resource
private DataSetTableUnionService dataSetTableUnionService;
@ApiOperation("保存")
@PostMapping("save")
public DatasetTableUnion save(@RequestBody DatasetTableUnion datasetTableUnion) {
return dataSetTableUnionService.save(datasetTableUnion);
}
@ApiOperation("删除")
@PostMapping("delete/{id}")
public void delete(@PathVariable String id) {
dataSetTableUnionService.delete(id);
}
@ApiOperation("查询")
@PostMapping("listByTableId/{tableId}")
public List<DataSetTableUnionDTO> listByTableId(@PathVariable String tableId) {
return dataSetTableUnionService.listByTableId(tableId);

View File

@ -1,7 +1,10 @@
package io.dataease.controller.dataset;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.DatasetTableFunction;
import io.dataease.service.dataset.DatasetFunctionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -14,12 +17,15 @@ import java.util.List;
* @Author gin
* @Date 2021/7/29 11:58 上午
*/
@Api(tags = "数据集:数据集方法")
@ApiSupport(order = 80)
@RestController
@RequestMapping("dataset/function")
public class DatasetFunctionController {
@Resource
private DatasetFunctionService datasetFunctionService;
@ApiOperation("查询")
@PostMapping("listByTableId/{tableId}")
public List<DatasetTableFunction> listByTableId(@PathVariable String tableId) {
return datasetFunctionService.listByTableId(tableId);

View File

@ -1,6 +1,9 @@
package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -10,6 +13,8 @@ import javax.annotation.Resource;
* Date: 2021-03-05
* Description:
*/
@Api(tags = "仪表板:设计")
@ApiSupport(order = 140)
@RestController
@RequestMapping("panel/design")
public class PanelDesignController {
@ -17,6 +22,7 @@ public class PanelDesignController {
@Resource
private PanelGroupService panelGroupService;
@ApiOperation("保存")
@PostMapping("/saveDesign/{id}")
public void deleteCircle(@PathVariable String id) {
panelGroupService.deleteCircle(id);

View File

@ -1,11 +1,14 @@
package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.PanelGroup;
import io.dataease.base.domain.PanelGroupWithBLOBs;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.PanelGroupRequest;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -16,6 +19,8 @@ import java.util.List;
* Date: 2021-03-05
* Description:
*/
@Api(tags = "仪表板:仪表板组")
@ApiSupport(order = 150)
@RestController
@RequestMapping("panel/group")
public class PanelGroupController {
@ -23,27 +28,32 @@ public class PanelGroupController {
@Resource
private PanelGroupService panelGroupService;
@ApiOperation("查询树")
@PostMapping("/tree")
public List<PanelGroupDTO> tree(@RequestBody PanelGroupRequest request) {
return panelGroupService.tree(request);
}
@ApiOperation("默认树")
@PostMapping("/defaultTree")
public List<PanelGroupDTO> defaultTree(@RequestBody PanelGroupRequest request) {
return panelGroupService.defaultTree(request);
}
@ApiOperation("保存")
@PostMapping("/save")
@I18n
public PanelGroup saveOrUpdate(@RequestBody PanelGroupRequest request) {
return panelGroupService.saveOrUpdate(request);
}
@ApiOperation("删除")
@PostMapping("/deleteCircle/{id}")
public void deleteCircle(@PathVariable String id) {
panelGroupService.deleteCircle(id);
}
@ApiOperation("详息")
@GetMapping("/findOne/{id}")
public PanelGroupWithBLOBs findOne(@PathVariable String id) throws Exception {
return panelGroupService.findOne(id);

View File

@ -1,8 +1,11 @@
package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.PanelSubject;
import io.dataease.controller.request.panel.PanelSubjectRequest;
import io.dataease.service.panel.PanelSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -13,6 +16,8 @@ import java.util.List;
* Date: 2021-05-06
* Description:
*/
@Api(tags = "仪表板:主题")
@ApiSupport(order = 160)
@RestController
@RequestMapping("panel/subject")
public class PanelSubjectController {
@ -20,22 +25,25 @@ public class PanelSubjectController {
@Resource
private PanelSubjectService panelSubjectService;
@ApiOperation("查询")
@PostMapping("/query")
public List<PanelSubject> query(@RequestBody PanelSubjectRequest request) {
return panelSubjectService.query(request);
}
@ApiOperation("根据仪表板查询")
@PostMapping("/querySubjectWithGroup")
public List<PanelSubject> querySubjectWithGroup(@RequestBody PanelSubjectRequest request) {
return panelSubjectService.querySubjectWithGroup(request);
}
@ApiOperation("更新")
@PostMapping("/update")
public void update(@RequestBody PanelSubjectRequest request) {
panelSubjectService.update(request);
}
@ApiOperation("删除")
@DeleteMapping("/delete/{id}")
public void update(@PathVariable String id) {
panelSubjectService.delete(id);

View File

@ -1,10 +1,13 @@
package io.dataease.controller.panel;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.PanelTemplateWithBLOBs;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.panel.PanelTemplateRequest;
import io.dataease.dto.panel.PanelTemplateDTO;
import io.dataease.service.panel.PanelTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -15,6 +18,8 @@ import java.util.List;
* Date: 2021-03-05
* Description:
*/
@Api(tags = "仪表板:模版")
@ApiSupport(order = 170)
@RestController
@RequestMapping("template")
public class PanelTemplateController {
@ -22,33 +27,38 @@ public class PanelTemplateController {
@Resource
private PanelTemplateService panelTemplateService;
@ApiOperation("查询树")
@PostMapping("/templateList")
@I18n
public List<PanelTemplateDTO> templateList(@RequestBody PanelTemplateRequest request) {
return panelTemplateService.templateList(request);
}
@ApiOperation("保存")
@PostMapping("/save")
public PanelTemplateDTO save(@RequestBody PanelTemplateRequest request) {
return panelTemplateService.save(request);
}
@ApiOperation("删除")
@DeleteMapping("/delete/{id}")
public void delete(@PathVariable String id) {
panelTemplateService.delete(id);
}
@ApiOperation("详息")
@GetMapping("/findOne/{id}")
public PanelTemplateWithBLOBs findOne(@PathVariable String id) throws Exception {
return panelTemplateService.findOne(id);
}
@ApiOperation("查询")
@PostMapping("/find")
public List<PanelTemplateDTO> find(@RequestBody PanelTemplateRequest request) {
return panelTemplateService.find(request);
}
@ApiOperation("名称校验")
@PostMapping("/nameCheck")
public String nameCheck(@RequestBody PanelTemplateRequest request) {
return panelTemplateService.nameCheck(request);

View File

@ -1,6 +1,7 @@
package io.dataease.controller.panel.api;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.panel.link.EnablePwdRequest;
import io.dataease.controller.request.panel.link.LinkRequest;
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Api(tags = "仪表板:链接管理")
@ApiSupport(order = 200)
@RequestMapping("/api/link")
public interface LinkApi {

View File

@ -1,5 +1,6 @@
package io.dataease.controller.panel.api;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.PanelShare;
import io.dataease.controller.request.panel.PanelShareFineDto;
import io.dataease.controller.request.panel.PanelShareRequest;
@ -9,6 +10,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@ -16,9 +18,11 @@ import java.util.List;
* 分享API
*/
@Api(tags = "仪表板:分享管理")
@ApiSupport(order = 180)
@RequestMapping("/api/share")
public interface ShareApi {
@ApiIgnore
@ApiOperation("创建分享")
@PostMapping("/")
void share(PanelShareRequest request);

View File

@ -1,5 +1,6 @@
package io.dataease.controller.panel.api;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.panel.PanelStoreDto;
import io.swagger.annotations.Api;
@ -16,6 +17,7 @@ import java.util.List;
*/
@Api(tags = "仪表板:收藏管理")
@ApiSupport(order = 190)
@RequestMapping("/api/store")
public interface StoreApi {

View File

@ -1,6 +1,7 @@
package io.dataease.controller.panel.api;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.ChartView;
import io.dataease.base.domain.ChartViewWithBLOBs;
import io.dataease.dto.panel.PanelViewDto;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Api(tags = "仪表板:视图管理")
@ApiSupport(order = 210)
@RequestMapping("/api/panelView")
public interface ViewApi {

View File

@ -4,10 +4,12 @@ package io.dataease.controller.sys;
import io.dataease.commons.license.F2CLicenseResponse;
import io.dataease.service.AboutService;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.Map;
@ApiIgnore
@RequestMapping("/about")
@RestController
public class AboutController {

View File

@ -6,9 +6,11 @@ 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 springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
@ApiIgnore
@RestController
@RequestMapping("common-files")
public class CommonFilesController {

View File

@ -6,10 +6,12 @@ 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 springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.io.IOException;
@ApiIgnore
@RestController
@RequestMapping
public class DisplayController {

View File

@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -17,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
/**
* Created by liqiang on 2019/4/1.
*/
@ApiIgnore
@RestController
public class I18nController {

View File

@ -11,8 +11,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
@ApiIgnore
@RestController
@RequestMapping(headers = "Accept=application/json")
public class LicenseController {

View File

@ -1,14 +1,19 @@
package io.dataease.controller.message;
package io.dataease.controller.sys;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.SysMsgChannel;
import io.dataease.base.domain.SysMsgSetting;
import io.dataease.base.domain.SysMsgType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.controller.message.dto.*;
import io.dataease.controller.sys.request.BatchSettingRequest;
import io.dataease.controller.sys.request.MsgRequest;
import io.dataease.controller.sys.request.MsgSettingRequest;
import io.dataease.controller.sys.response.MsgGridDto;
import io.dataease.controller.sys.response.SettingTreeNode;
import io.dataease.service.message.SysMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -19,6 +24,7 @@ import java.util.List;
import java.util.stream.Collectors;
@Api(tags = "系统:消息管理")
@ApiSupport(order = 230)
@RequestMapping("/api/sys_msg")
@RestController
public class MsgController {
@ -26,7 +32,7 @@ public class MsgController {
@Resource
private SysMsgService sysMsgService;
@ApiOperation("查询消息")
@ApiOperation("分页查询")
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<MsgGridDto>> messages(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody MsgRequest msgRequest) {
Long userId = AuthUtils.getUser().getUserId();
@ -40,50 +46,59 @@ public class MsgController {
return listPager;
}
@ApiOperation("设置已读")
@PostMapping("/setReaded/{msgId}")
public void setReaded(@PathVariable Long msgId) {
sysMsgService.setReaded(msgId);
}
@ApiOperation("批量设置已读")
@PostMapping("/batchRead")
public void batchRead(@RequestBody List<Long> msgIds) {
sysMsgService.setBatchReaded(msgIds);
}
@ApiOperation("批量删除")
@PostMapping("/batchDelete")
public void batchDelete(@RequestBody List<Long> msgIds) {
sysMsgService.batchDelete(msgIds);
}
@PostMapping("/treeNodes")
public List<SettingTreeNode> treeNodes() {
return sysMsgService.treeNodes();
}
@PostMapping("/channelList")
public List<SysMsgChannel> channelList() {
return sysMsgService.channelList();
}
@PostMapping("/settingList")
public List<SysMsgSetting> settingList() {
return sysMsgService.settingList();
}
@PostMapping("/updateSetting")
public void updateSetting(@RequestBody MsgSettingRequest request) {
Long userId = AuthUtils.getUser().getUserId();
sysMsgService.updateSetting(request, userId);
}
@ApiOperation("查询类型")
@PostMapping("/types")
public List<SysMsgType> allTypes() {
List<SysMsgType> sysMsgTypes = sysMsgService.queryMsgTypes();
return sysMsgTypes;
}
@ApiOperation("类型树")
@PostMapping("/treeNodes")
public List<SettingTreeNode> treeNodes() {
return sysMsgService.treeNodes();
}
@ApiOperation("查询渠道")
@PostMapping("/channelList")
public List<SysMsgChannel> channelList() {
return sysMsgService.channelList();
}
@ApiOperation("查询订阅")
@PostMapping("/settingList")
public List<SysMsgSetting> settingList() {
return sysMsgService.settingList();
}
@ApiOperation("更新订阅")
@PostMapping("/updateSetting")
public void updateSetting(@RequestBody MsgSettingRequest request) {
Long userId = AuthUtils.getUser().getUserId();
sysMsgService.updateSetting(request, userId);
}
@ApiOperation("批量更新订阅")
@PostMapping("/batchUpdate")
public void batchUpdate(@RequestBody BatchSettingRequest request) {
Long userId = AuthUtils.getUser().getUserId();

View File

@ -15,9 +15,12 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.stream.Collectors;
@ApiIgnore
@RestController
@RequiredArgsConstructor
@Api(tags = "系统:部门管理")

View File

@ -15,11 +15,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@ApiIgnore
@RestController
@RequiredArgsConstructor
@Api(tags = "系统:菜单管理")

View File

@ -13,11 +13,12 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
@ApiIgnore
@RestController
@Api(tags = "系统:插件管理")
@RequestMapping("/api/plugin")

View File

@ -14,9 +14,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@ApiIgnore
@RestController
@RequiredArgsConstructor
@Api(tags = "系统:角色管理")

View File

@ -3,6 +3,7 @@ package io.dataease.controller.sys;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
@ -16,12 +17,15 @@ import io.dataease.service.sys.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;
@RestController
@Api(tags = "系统:用户管理")
@ApiSupport(order = 220)
@RequestMapping("/api/user")
public class SysUserController {

View File

@ -11,12 +11,14 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ApiIgnore
@RestController
@RequestMapping(value = "/system")
public class SystemParameterController {

View File

@ -1,7 +1,6 @@
package io.dataease.controller.sys.base;
import io.dataease.base.mapper.ext.query.GridExample;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package io.dataease.controller.message.dto;
package io.dataease.controller.sys.request;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package io.dataease.controller.message.dto;
package io.dataease.controller.sys.request;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package io.dataease.controller.message.dto;
package io.dataease.controller.sys.request;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package io.dataease.controller.message.dto;
package io.dataease.controller.sys.response;
import io.dataease.base.domain.SysMsg;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package io.dataease.controller.message.dto;
package io.dataease.controller.sys.response;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package io.dataease.controller.message.dto;
package io.dataease.controller.sys.response;
import lombok.Data;

View File

@ -2,6 +2,7 @@ package io.dataease.datasource.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.Datasource;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
@ -11,11 +12,16 @@ import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.datasource.dto.DBTableDTO;
import io.dataease.datasource.service.DatasourceService;
import io.dataease.dto.DatasourceDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
@Api(tags = "数据源:数据源管理")
@ApiSupport(order = 30)
@RequestMapping("datasource")
@RestController
public class DatasourceController {
@ -23,16 +29,19 @@ public class DatasourceController {
@Resource
private DatasourceService datasourceService;
@ApiOperation("新增数据源")
@PostMapping("/add")
public Datasource addDatasource(@RequestBody Datasource datasource) {
return datasourceService.addDatasource(datasource);
}
@ApiOperation("验证数据源")
@PostMapping("/validate")
public void validate(@RequestBody Datasource datasource) throws Exception {
datasourceService.validate(datasource);
}
@ApiOperation("查询当前用户数据源")
@GetMapping("/list")
public List<DatasourceDTO> getDatasourceList() throws Exception {
DatasourceUnionRequest request = new DatasourceUnionRequest();
@ -40,6 +49,7 @@ public class DatasourceController {
return datasourceService.getDatasourceList(request);
}
@ApiIgnore
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<DatasourceDTO>> getDatasourceList(@RequestBody BaseGridRequest request, @PathVariable int goPage, @PathVariable int pageSize) throws Exception {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
@ -47,21 +57,25 @@ public class DatasourceController {
return PageUtils.setPageInfo(page, datasourceService.gridQuery(request));
}
@ApiOperation("删除数据源")
@PostMapping("/delete/{datasourceID}")
public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) throws Exception {
datasourceService.deleteDatasource(datasourceID);
}
@ApiOperation("更新数据源")
@PostMapping("/update")
public void updateDatasource(@RequestBody Datasource Datasource) {
datasourceService.updateDatasource(Datasource);
}
@ApiOperation("查询数据源下属所有表")
@PostMapping("/getTables")
public List<DBTableDTO> getTables(@RequestBody Datasource datasource) throws Exception {
return datasourceService.getTables(datasource);
}
@ApiIgnore
@PostMapping("/getSchema")
public List<String> getSchema(@RequestBody Datasource datasource) throws Exception {
return datasourceService.getSchema(datasource);

View File

@ -42,4 +42,6 @@ public class ChartViewFieldDTO implements Serializable {
private String dateStyle;
private String datePattern;
private Integer extField;
}

View File

@ -1,13 +1,14 @@
package io.dataease.provider.doris;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.DatasetTableFieldExample;
import io.dataease.base.mapper.DatasetTableFieldMapper;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj;
import io.dataease.provider.QueryProvider;
import io.dataease.provider.SQLConstants;
import io.dataease.provider.mysql.MySQLConstants;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -16,11 +17,12 @@ import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
@ -30,6 +32,9 @@ import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
*/
@Service("dorisQuery")
public class DorisQueryProvider extends QueryProvider {
@Resource
private DatasetTableFieldMapper datasetTableFieldMapper;
@Override
public Integer transFieldType(String field) {
switch (field) {
@ -91,7 +96,15 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(fields)) {
for (int i = 0; i < fields.size(); i++) {
DatasetTableField f = fields.get(i);
String originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
String originField;
if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(f.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
} else {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getDataeaseName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
String fieldName = "";
// 处理横轴字段
@ -181,7 +194,15 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
String originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getDataeaseName());
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getDataeaseName());
} else {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getDataeaseName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
@ -203,7 +224,15 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
} else {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -279,7 +308,15 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xList)) {
for (int i = 0; i < xList.size(); i++) {
ChartViewFieldDTO x = xList.get(i);
String originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getDataeaseName());
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getDataeaseName());
} else {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getDataeaseName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
@ -301,7 +338,15 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
} else {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -380,7 +425,15 @@ public class DorisQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
} else {
originField = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getDataeaseName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -515,7 +568,17 @@ public class DorisQueryProvider extends QueryProvider {
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getTerm());
String whereValue = "";
String originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
String originName;
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
} else {
originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
@ -557,7 +620,16 @@ public class DorisQueryProvider extends QueryProvider {
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getOperator());
String whereValue = "";
String originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
String originName;
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
} else {
originName = String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getDataeaseName());
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -580,7 +652,7 @@ public class DorisQueryProvider extends QueryProvider {
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
whereValue = String.format(DorisConstants.WHERE_BETWEEN, startTime, endTime);
} else {
whereValue = String.format(MySQLConstants.WHERE_BETWEEN, value.get(0), value.get(1));
whereValue = String.format(DorisConstants.WHERE_BETWEEN, value.get(0), value.get(1));
}
} else {
whereValue = String.format(DorisConstants.WHERE_VALUE_VALUE, value.get(0));
@ -736,4 +808,28 @@ public class DorisQueryProvider extends QueryProvider {
}
return list;
}
private String calcFieldRegex(String originField, SQLObj tableObj) {
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
String regex = "\\[(.*?)]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(originField);
Set<String> ids = new HashSet<>();
while (matcher.find()) {
String id = matcher.group(1);
ids.add(id);
}
if (CollectionUtils.isEmpty(ids)) {
return originField;
}
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
for (DatasetTableField ele : calcFields) {
originField = originField.replaceAll("\\[" + ele.getId() + "]",
String.format(DorisConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getDataeaseName()));
}
return originField;
}
}

View File

@ -1,6 +1,8 @@
package io.dataease.provider.mysql;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.DatasetTableFieldExample;
import io.dataease.base.mapper.DatasetTableFieldMapper;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
@ -15,11 +17,12 @@ import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
@ -29,6 +32,9 @@ import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
*/
@Service("mysqlQuery")
public class MysqlQueryProvider extends QueryProvider {
@Resource
private DatasetTableFieldMapper datasetTableFieldMapper;
@Override
public Integer transFieldType(String field) {
switch (field) {
@ -89,7 +95,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(fields)) {
for (int i = 0; i < fields.size(); i++) {
DatasetTableField f = fields.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(f.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
String fieldName = "";
// 处理横轴字段
@ -171,7 +185,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
@ -193,7 +215,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -270,7 +300,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xList)) {
for (int i = 0; i < xList.size(); i++) {
ChartViewFieldDTO x = xList.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
@ -292,7 +330,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -313,7 +359,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(extStack)) {
for (int i = 0; i < extStack.size(); i++) {
ChartViewFieldDTO stack = extStack.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), stack.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(stack.getExtField()) && stack.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(stack.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(stack.getExtField()) && stack.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), stack.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), stack.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
stackFields.add(getXFields(stack, originField, fieldAlias));
@ -390,7 +444,15 @@ public class MysqlQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else {
originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -522,7 +584,15 @@ public class MysqlQueryProvider extends QueryProvider {
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getTerm());
String whereValue = "";
String originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
String originName;
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else {
originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
@ -562,7 +632,16 @@ public class MysqlQueryProvider extends QueryProvider {
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getOperator());
String whereValue = "";
String originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
String originName;
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else {
originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -743,4 +822,28 @@ public class MysqlQueryProvider extends QueryProvider {
}
return list;
}
private String calcFieldRegex(String originField, SQLObj tableObj) {
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
String regex = "\\[(.*?)]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(originField);
Set<String> ids = new HashSet<>();
while (matcher.find()) {
String id = matcher.group(1);
ids.add(id);
}
if (CollectionUtils.isEmpty(ids)) {
return originField;
}
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
for (DatasetTableField ele : calcFields) {
originField = originField.replaceAll("\\[" + ele.getId() + "]",
String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
}
return originField;
}
}

View File

@ -1,13 +1,14 @@
package io.dataease.provider.oracle;
import io.dataease.base.domain.DatasetTableField;
import io.dataease.base.domain.DatasetTableFieldExample;
import io.dataease.base.mapper.DatasetTableFieldMapper;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj;
import io.dataease.provider.QueryProvider;
import io.dataease.provider.SQLConstants;
import io.dataease.provider.mysql.MySQLConstants;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -16,11 +17,12 @@ import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
@ -37,6 +39,9 @@ public class OracleQueryProvider extends QueryProvider {
private static Integer FLOAT = 3;
private static Integer BOOLEAN = 4;
@Resource
private DatasetTableFieldMapper datasetTableFieldMapper;
@Override
public Integer transFieldType(String field) {
switch (field) {
@ -118,7 +123,15 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(fields)) {
for (int i = 0; i < fields.size(); i++) {
DatasetTableField f = fields.get(i);
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(f.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
} else {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
}
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
String fieldName = "";
// 处理横轴字段
@ -206,7 +219,15 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
}
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
@ -228,7 +249,15 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
}
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i));
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -304,7 +333,15 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(xList)) {
for (int i = 0; i < xList.size(); i++) {
ChartViewFieldDTO x = xList.get(i);
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(x.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
} else {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
}
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
@ -326,7 +363,15 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
}
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i));
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -405,7 +450,15 @@ public class OracleQueryProvider extends QueryProvider {
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String originField;
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originField = calcFieldRegex(y.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
} else {
originField = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
}
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
@ -532,7 +585,17 @@ public class OracleQueryProvider extends QueryProvider {
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getTerm());
String whereValue = "";
String originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
String originName;
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(OracleConstants.FROM_UNIXTIME, cast, OracleConstants.DEFAULT_DATE_FORMAT);
@ -572,7 +635,16 @@ public class OracleQueryProvider extends QueryProvider {
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getOperator());
String whereValue = "";
String originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
String originName;
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
// 解析origin name中有关联的字段生成sql表达式
originName = calcFieldRegex(field.getOriginName(), tableObj);
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
} else {
originName = String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
}
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(OracleConstants.CAST, originName, OracleConstants.DEFAULT_INT_FORMAT) + "/1000";
@ -592,7 +664,7 @@ public class OracleQueryProvider extends QueryProvider {
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
whereValue = String.format(OracleConstants.WHERE_BETWEEN, startTime, endTime);
} else {
whereValue = String.format(MySQLConstants.WHERE_BETWEEN, value.get(0), value.get(1));
whereValue = String.format(OracleConstants.WHERE_BETWEEN, value.get(0), value.get(1));
}
} else {
whereValue = String.format(OracleConstants.WHERE_VALUE_VALUE, value.get(0));
@ -766,4 +838,28 @@ public class OracleQueryProvider extends QueryProvider {
}
return list;
}
private String calcFieldRegex(String originField, SQLObj tableObj) {
originField = originField.replaceAll("[\\t\\n\\r]]", "");
// 正则提取[xxx]
String regex = "\\[(.*?)]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(originField);
Set<String> ids = new HashSet<>();
while (matcher.find()) {
String id = matcher.group(1);
ids.add(id);
}
if (CollectionUtils.isEmpty(ids)) {
return originField;
}
DatasetTableFieldExample datasetTableFieldExample = new DatasetTableFieldExample();
datasetTableFieldExample.createCriteria().andIdIn(new ArrayList<>(ids));
List<DatasetTableField> calcFields = datasetTableFieldMapper.selectByExample(datasetTableFieldExample);
for (DatasetTableField ele : calcFields) {
originField = originField.replaceAll("\\[" + ele.getId() + "]",
String.format(OracleConstants.KEYWORD_FIX, tableObj.getTableAlias(), ele.getOriginName()));
}
return originField;
}
}

View File

@ -11,8 +11,8 @@ import io.dataease.base.mapper.ext.UtilMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.constants.ScheduleType;
import io.dataease.commons.constants.TaskStatus;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.*;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
@ -383,12 +383,14 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
} else {
// check doris table
@ -407,12 +409,14 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
}
@ -434,12 +438,14 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
} else {
// check doris table
@ -458,12 +464,14 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
@ -483,12 +491,14 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
if (datasetTable.getMode() == 0) {
@ -511,12 +521,14 @@ public class DataSetTableService {
data.addAll(datasourceProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
} else {
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
@ -531,6 +543,7 @@ public class DataSetTableService {
data.addAll(jdbcProvider.getData(datasourceRequest));
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
try {
@ -538,6 +551,7 @@ public class DataSetTableService {
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
} catch (Exception e) {
e.printStackTrace();
DEException.throwException(e.getMessage());
}
}
}
@ -972,14 +986,15 @@ public class DataSetTableService {
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(datasetTableIncrementalConfig.getTableId());
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.getFieldsByTableId(datasetTable.getId());
datasetTableFields.sort((o1, o2) -> {
if (o1.getOriginName() == null) {
if (o1.getColumnIndex() == null) {
return -1;
}
if (o2.getOriginName() == null) {
if (o2.getColumnIndex() == null) {
return 1;
}
return o1.getOriginName().compareTo(o2.getOriginName());
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
});
List<String> originNameFileds = datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList());
Datasource ds = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
@ -998,10 +1013,7 @@ public class DataSetTableService {
}catch (Exception e){
DataEaseException.throwException(Translator.get("i18n_check_sql_error") + e.getMessage());
}
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> {
sqlFileds.add(filed);
});
sort(sqlFileds);
if (!originNameFileds.equals(sqlFileds)) {
DataEaseException.throwException(Translator.get("i18n_sql_add_not_matching") + sqlFileds.toString());
}
@ -1011,28 +1023,20 @@ public class DataSetTableService {
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
datasourceRequest.setQuery(qp.wrapSql(sql));
List<String> sqlFileds = new ArrayList<>();
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> {
sqlFileds.add(filed);
});
sort(sqlFileds);
try{
datasourceProvider.fetchResultField(datasourceRequest).stream().map(TableFiled::getFieldName).forEach(filed -> {
sqlFileds.add(filed);
});
}catch (Exception e){
DataEaseException.throwException(Translator.get("i18n_check_sql_error") + e.getMessage());
}
if (!originNameFileds.equals(sqlFileds)) {
DataEaseException.throwException(Translator.get("i18n_sql_delete_not_matching") + sqlFileds.toString());
}
}
}
private void sort(List<String> sqlFileds) {
sqlFileds.sort((o1, o2) -> {
if (o1 == null) {
return -1;
}
if (o2 == null) {
return 1;
}
return o1.compareTo(o2);
});
}
private void checkName(DatasetTable datasetTable) {
// if (StringUtils.isEmpty(datasetTable.getId()) && StringUtils.equalsIgnoreCase("db", datasetTable.getType())) {
// return;
@ -1449,7 +1453,6 @@ public class DataSetTableService {
datasetTableTaskLogMapper.updateByExampleSelective(datasetTableTaskLog, datasetTableTaskLogExample);
dataSetTableTaskService.updateTaskStatus(taskIds, JobStatus.Error);
//TODO check task status
for (DatasetTable jobStoppeddDatasetTable : jobStoppeddDatasetTables) {
extractDataService.deleteFile("all_scope", jobStoppeddDatasetTable.getId());

View File

@ -1,6 +1,5 @@
package io.dataease.service.dataset;
import com.google.gson.Gson;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.DatasetTableMapper;
import io.dataease.base.mapper.DatasetTableTaskMapper;
@ -201,6 +200,7 @@ public class DataSetTableTaskService {
datasetTableTask.setStatus(TaskStatus.Stopped.name());
}else {
datasetTableTask = datasetTableTaskMapper.selectByPrimaryKey(datasetTableTask.getId());
datasetTableTask.setLastExecStatus(lastExecStatus.name());
if(StringUtils.isNotEmpty(datasetTableTask.getEnd()) && datasetTableTask.getEnd().equalsIgnoreCase("1")){
BaseGridRequest request = new BaseGridRequest();
ConditionEntity conditionEntity = new ConditionEntity();

View File

@ -123,8 +123,7 @@ public class ExtractDataService {
"else\n" +
" echo $result\n" +
" exit 1\n" +
"fi\n" +
"rm -rf %s\n";
"fi\n";
public synchronized boolean existSyncTask(DatasetTable datasetTable, DatasetTableTask datasetTableTask, Long startTime) {
datasetTable.setSyncStatus(JobStatus.Underway.name());
@ -185,15 +184,15 @@ public class ExtractDataService {
replaceTable(DorisTableUtils.dorisName(datasetTableId));
saveSucessLog(datasetTableTaskLog);
// sendWebMsg(datasetTable, null, true);
deleteFile("all_scope", datasetTableId);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
} catch (Exception e) {
saveErrorLog(datasetTableId, null, e);
// sendWebMsg(datasetTable, null, false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
deleteFile("all_scope", datasetTableId);
} finally {
deleteFile("all_scope", datasetTableId);
deleteFile(new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getData());
}
break;
@ -211,9 +210,9 @@ public class ExtractDataService {
saveErrorLog(datasetTableId, null, e);
// sendWebMsg(datasetTable, null, false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
} finally {
deleteFile("incremental_add", datasetTableId);
deleteFile("incremental_delete", datasetTableId);
} finally {
}
break;
}
@ -931,38 +930,36 @@ public class ExtractDataService {
case "all_scope":
transName = "trans_" + DorisTableUtils.dorisName(dataSetTableId);
jobName = "job_" + DorisTableUtils.dorisName(dataSetTableId);
fileName = DorisTableUtils.dorisTmpName(dataSetTableId);
fileName = DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(dataSetTableId));
break;
case "incremental_add":
transName = "trans_add_" + DorisTableUtils.dorisName(dataSetTableId);
jobName = "job_add_" + DorisTableUtils.dorisName(dataSetTableId);
fileName = DorisTableUtils.dorisAddName(dataSetTableId);
fileName = DorisTableUtils.dorisAddName(DorisTableUtils.dorisName(dataSetTableId));
break;
case "incremental_delete":
transName = "trans_delete_" + DorisTableUtils.dorisName(dataSetTableId);
jobName = "job_delete_" + DorisTableUtils.dorisName(dataSetTableId);
fileName = DorisTableUtils.dorisDeleteName(dataSetTableId);
fileName = DorisTableUtils.dorisDeleteName(DorisTableUtils.dorisName(dataSetTableId));
break;
default:
break;
}
try {
File file = new File(root_path + fileName + "." + extention);
FileUtils.forceDelete(file);
} catch (Exception e) {
deleteFile(root_path + fileName + "." + extention);
deleteFile(root_path + jobName + ".kjb");
deleteFile(root_path + transName + ".ktr");
}
private void deleteFile(String filePath){
if(StringUtils.isEmpty(filePath)){
return;
}
try {
File file = new File(root_path + jobName + ".kjb");
FileUtils.forceDelete(file);
} catch (Exception e) {
}
try {
File file = new File(root_path + transName + ".ktr");
File file = new File(filePath);
FileUtils.forceDelete(file);
} catch (Exception e) {
}
}
public boolean isKettleRunning() {
try {
if (!InetAddress.getByName(carte).isReachable(1000)) {

View File

@ -1,7 +1,7 @@
package io.dataease.service.message;
import io.dataease.controller.message.dto.SubscribeNode;
import io.dataease.controller.sys.response.SubscribeNode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.aspectj.lang.ProceedingJoinPoint;

View File

@ -10,7 +10,12 @@ import io.dataease.base.mapper.ext.ExtSysMsgMapper;
import io.dataease.commons.constants.SysMsgConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.controller.message.dto.*;
import io.dataease.controller.sys.request.BatchSettingRequest;
import io.dataease.controller.sys.request.MsgRequest;
import io.dataease.controller.sys.request.MsgSettingRequest;
import io.dataease.controller.sys.response.MsgGridDto;
import io.dataease.controller.sys.response.SettingTreeNode;
import io.dataease.controller.sys.response.SubscribeNode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheEvict;

View File

@ -26,11 +26,15 @@ mybatis.configuration.map-underscore-to-camel-case=true
# knife4j
knife4j.enable=true
knife4j.setting.enableFooter=false
knife4j.setting.enableFooterCustom=true
knife4j.setting.footerCustomContent=杭州飞致云信息科技有限公司 1.0-b9
knife4j.setting.enableFooterCustom=false
knife4j.setting.footerCustomContent=fit2cloud 1.0-b9
knife4j.setting.enableSwaggerModels=false
knife4j.setting.enableDocumentManage=false
knife4j.setting.enableSearch=false
knife4j.setting.enableOpenApi=false
knife4j.setting.enableAfterScript=false
app.version=@project.version@
logging.file.path=/opt/dataease/logs/${spring.application.name}

View File

@ -111,7 +111,7 @@ export function batchEdit(data) {
})
}
export function post(url, data, showLoading = true, timeout = 10000) {
export function post(url, data, showLoading = true, timeout = 20000) {
return request({
url: url,
method: 'post',

View File

@ -64,6 +64,7 @@ import { query, updateStatus } from '@/api/system/msg'
import { getTypeName, loadMsgTypes } from '@/utils/webMsg'
import { mapGetters } from 'vuex'
import bus from '@/utils/bus'
import { getToken } from '@/utils/auth'
export default {
data() {
return {
@ -172,6 +173,11 @@ export default {
query(currentPage, pageSize, param).then(response => {
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
}).catch(() => {
const token = getToken()
if (!token || token === 'null' || token === 'undefined') {
this.timer && clearInterval(this.timer)
}
})
},
getTypeName(value) {

View File

@ -4,7 +4,9 @@
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
class="component"
@click="handleClick"
@mousedown="elementMouseDown"
>
<edit-bar v-if="config === curComponent" @showViewDetails="showViewDetails" />
<de-out-widget
v-if="config.type==='custom'"
:id="'component' + config.id"
@ -16,6 +18,7 @@
/>
<component
ref="wrapperChild"
:is="config.component"
v-else
:out-style="config.style"
@ -33,8 +36,10 @@ import runAnimation from '@/components/canvas/utils/runAnimation'
import { mixins } from '@/components/canvas/utils/events'
import { mapState } from 'vuex'
import DeOutWidget from '@/components/dataease/DeOutWidget'
import EditBar from '@/components/canvas/components/Editor/EditBar'
export default {
components: { DeOutWidget },
components: { DeOutWidget, EditBar },
mixins: [mixins],
props: {
config: {
@ -60,7 +65,8 @@ export default {
},
computed: {
...mapState([
'canvasStyleData'
'canvasStyleData',
'curComponent'
])
},
mounted() {
@ -94,6 +100,20 @@ export default {
Object.keys(events).forEach(event => {
this[event](events[event])
})
},
elementMouseDown(e) {
debugger
// private
this.$store.commit('setClickComponentStatus', true)
if (this.config.component !== 'v-text' && this.config.component !== 'rect-shape' && this.config.component !== 'de-input-search' && this.config.component !== 'de-number-range') {
e.preventDefault()
}
//
e.stopPropagation()
this.$store.commit('setCurComponent', { component: this.config, index: this.index })
},
showViewDetails(){
this.$refs.wrapperChild.openChartDetailsDialog();
}
}
}

View File

@ -0,0 +1,70 @@
<template>
<div class="bar-main">
<i v-if="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails" />
<i v-if="activeModel==='edit'" class="icon iconfont icon-shezhi" @click.stop="showViewDetails" />
</div>
</template>
<script>
import { mapState } from 'vuex'
import eventBus from '@/components/canvas/utils/eventBus'
export default {
props: {
active: {
type: Boolean,
required: false,
default: false
},
// preview edit
activeModel: {
type: String,
required: false,
default: 'preview'
}
},
data() {
return {
componentType: null,
editFilter: [
'view',
'custom'
]
}
},
computed: mapState([
'menuTop',
'menuLeft',
'menuShow',
'curComponent',
'componentData',
'canvasStyleData'
]),
methods: {
showViewDetails() {
this.$emit('showViewDetails')
}
}
}
</script>
<style lang="scss" scoped>
.bar-main{
position: absolute;
right: 0px;
float:right;
z-index: 2;
border-radius:2px;
padding-left: 5px;
padding-right: 2px;
cursor:pointer!important;
background-color: #0a7be0;
}
.bar-main i{
color: white;
float: right;
margin-right: 3px;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div id="canvasInfoTemp" :style="customStyle" class="bg">
<div id="canvasInfoTemp" :style="customStyle" class="bg" @mouseup="deselectCurComponent" @mousedown="handleMouseDown">
<el-row v-if="componentDataShow.length===0" style="height: 100%;" class="custom-position">
{{ $t('panel.panelNull') }}
</el-row>
@ -121,6 +121,8 @@ export default {
return this.componentDataShow
},
...mapState([
'isClickComponent',
'curComponent',
'componentData',
'canvasStyleData'
])
@ -204,6 +206,17 @@ export default {
},
exportExcel() {
this.$refs['userViewDialog'].exportExcel()
},
deselectCurComponent(e) {
debugger
if (!this.isClickComponent) {
this.$store.commit('setCurComponent', { component: null, index: null })
}
},
handleMouseDown() {
// console.log('handleMouseDown123')
this.$store.commit('setClickComponentStatus', false)
}
}
}

View File

@ -8,7 +8,7 @@
'rect-shape'
]"
>
<i v-if="requestStatus==='success'" style="right:25px;position: absolute;z-index: 2" class="icon iconfont icon-fangda" @click.stop="openChartDetailsDialog" />
<!-- <i v-if="requestStatus==='success'" style="right:25px;position: absolute;z-index: 2" class="icon iconfont icon-fangda" @click.stop="openChartDetailsDialog" />-->
<div v-if="requestStatus==='error'" class="chart-error-class">
<div style="font-size: 12px; color: #9ea6b2;height: 100%;display: flex;align-items: center;justify-content: center;">
{{ message }},{{ $t('chart.chart_show_error') }}
@ -66,6 +66,10 @@ export default {
type: Boolean,
required: false,
default: false
},
componentIndex: {
type: Number,
required: false
}
},
data() {
@ -128,7 +132,6 @@ export default {
this.getData(this.element.propValue.viewId)
},
mounted() {
},
methods: {
mergeStyle() {

View File

@ -126,7 +126,8 @@ export default {
expires: 'Login token expired, please login again',
tokenError: 'Token error, please login again',
username_error: 'Please enter the correct ID',
password_error: 'The password can not be less than 8 digits'
password_error: 'The password can not be less than 8 digits',
login_again: 'Login again'
},
commons: {
no_target_permission: 'No permission',
@ -333,7 +334,9 @@ export default {
input_pwd: 'Please input password',
message_box: {
alert: 'Alert',
confirm: 'Confirm'
confirm: 'Confirm',
ok: 'Confirm',
cancel: 'Cancel'
}
},
documentation: {
@ -751,7 +754,6 @@ export default {
chart_funnel: 'Funnel',
chart_radar: 'Radar',
chart_gauge: 'Gauge',
chart_map: 'Map',
dateStyle: 'Date Style',
datePattern: 'Date Format',
y: 'Year',
@ -820,11 +822,6 @@ export default {
drag_block_funnel_split: 'Funnel Split',
drag_block_radar_length: 'Branch Length',
drag_block_radar_label: 'Branch Label',
stack_item: 'Stack Item',
map_range: 'Map range',
select_map_range: 'Please select map range',
area: 'Area',
placeholder_field: 'Drag Field To Here',
axis_label_rotate: 'Label Rotate'
},
dataset: {
@ -979,18 +976,7 @@ export default {
right_join: 'RIGHT JOIN',
inner_join: 'INNER JOIN',
full_join: 'FULL JOIN',
can_not_union_diff_datasource: 'Union dataset must have same data source',
operator: 'Operator',
d_q_trans: 'Dimension/Quota Transform',
add_calc_field: 'Create calc field',
input_name: 'Please input name',
field_exp: 'Field Expression',
data_type: 'Data Type',
click_ref_field: 'Click Quote Field',
click_ref_function: 'Click Quote Function',
field_manage: 'Field Manage',
edit_calc_field: 'Edit calc field',
calc_field: 'Calc Field'
can_not_union_diff_datasource: 'Union dataset must have same data source'
},
datasource: {
datasource: 'Data Source',
@ -1304,54 +1290,5 @@ export default {
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
i18n_msg_type_all: 'All type',
channel_inner_msg: 'On site news'
},
denumberrange: {
label: 'Number range',
split_placeholder: 'To',
please_key_min: 'Please key min value',
please_key_max: 'Please key max value',
out_of_min: 'The min value cannot be less than the min integer -2³²',
out_of_max: 'The max value cannot be more than the max integer 2³²-1',
must_int: 'Please key interger',
min_out_max: 'The min value must be less than the max value',
max_out_min: 'The max value must be more than the min value'
},
denumberselect: {
label: 'Number selector',
placeholder: 'Please select'
},
deinputsearch: {
label: 'Text search',
placeholder: 'Please key keyword'
},
detextselect: {
label: 'Text selector',
placeholder: 'Please select'
},
detextgridselect: {
label: 'Text list',
placeholder: 'Please select'
},
denumbergridselect: {
label: 'Number list',
placeholder: 'Please select'
},
dedaterange: {
label: 'Date range',
to_placeholder: 'End date',
from_placeholder: 'Start date',
split_placeholder: 'To'
},
dedate: {
label: 'Date',
placeholder: 'Please select date'
},
deyearmonth: {
label: 'Month',
placeholder: 'Please select month'
},
deyear: {
label: 'Year',
placeholder: 'Please select year'
}
}

View File

@ -109,24 +109,25 @@ export default {
navbar: {
dashboard: '首頁',
github: '項目地址',
logOut: '退出登',
logOut: '退出登',
profile: '個人中心',
theme: '換膚',
size: '佈局大小'
},
login: {
title: '系統登',
title: '系統登',
welcome: '歡迎使用',
logIn: '登',
logIn: '登',
username: '帳號',
password: '密碼',
any: '任意字符',
thirdparty: '第三方登',
thirdparty: '第三方登',
thirdpartyTips: '本地不能模擬,請結合自己業務進行模擬!!!',
expires: '登陸信息過期,請重新登陸',
tokenError: '信息錯誤,請重新登',
expires: '登錄信息過期,請重新登錄',
tokenError: '信息錯誤,請重新登',
username_error: '請輸入正確的 ID',
password_error: '密碼不小於 8 位'
password_error: '密碼不小於 8 位',
login_again: '重新登錄'
},
commons: {
no_target_permission: '沒有權限',
@ -183,7 +184,7 @@ export default {
prompt: '提示',
operating: '操作',
input_limit: '長度在 {0} 到 {1} 個字符',
login: '登',
login: '登',
welcome: '一站式開源數據分析平臺',
username: '姓名',
password: '密碼',
@ -255,7 +256,7 @@ export default {
remove: '移除',
remove_cancel: '移除取消',
remove_success: '移除成功',
tips: '認證信息已過期,請重新登',
tips: '認證信息已過期,請重新登',
not_performed_yet: '尚未執行',
incorrect_input: '輸入內容不正確',
delete_confirm: '請輸入以下內容,確認刪除:',
@ -333,7 +334,9 @@ export default {
input_pwd: '請輸入密碼',
message_box: {
alert: '警告',
confirm: '確認'
confirm: '確認',
ok: '確認',
cancel: '取消'
}
},
documentation: {
@ -751,7 +754,6 @@ export default {
chart_funnel: '漏鬥圖',
chart_radar: '雷達圖',
chart_gauge: '儀表盤',
chart_map: '地圖',
dateStyle: '日期顯示',
datePattern: '日期格式',
y: '年',
@ -820,11 +822,6 @@ export default {
drag_block_funnel_split: '漏鬥分層',
drag_block_radar_length: '分支長度',
drag_block_radar_label: '分支標簽',
map_range: '地圖範圍',
select_map_range: '請選擇地圖範圍',
area: '地區',
stack_item: '堆疊項',
placeholder_field: '拖動字段至此處',
axis_label_rotate: '標簽角度'
},
dataset: {
@ -979,18 +976,7 @@ export default {
right_join: '右連接',
inner_join: '內連接',
full_join: '全連接',
can_not_union_diff_datasource: '被關聯數據集必須與當前數據集的數據源一致',
operator: '操作',
d_q_trans: '維度/指標轉換',
add_calc_field: '新建计算字段',
input_name: '請輸入名稱',
field_exp: '字段表達式',
data_type: '數據類型',
click_ref_field: '點擊引用字段',
click_ref_function: '點擊引用函數',
field_manage: '字段管理',
edit_calc_field: '編輯計算字段',
calc_field: '計算字段'
can_not_union_diff_datasource: '被關聯數據集必須與當前數據集的數據源一致'
},
datasource: {
datasource: '數據源',
@ -1143,7 +1129,7 @@ export default {
lineHeight: '行高',
letterSpacing: '字間距',
textAlign: '左右對齊',
opacity: '透明度',
opacity: '透明度',
verticalAlign: '上下對齊',
text_align_left: '左對齊',
text_align_center: '左右居中',
@ -1182,9 +1168,9 @@ export default {
},
display: {
logo: '頭部系統 Logo',
loginLogo: '登頁面頭部 Logo',
loginImage: '登頁面右側圖片',
loginTitle: '登頁面標題',
loginLogo: '登頁面頭部 Logo',
loginImage: '登頁面右側圖片',
loginTitle: '登頁面標題',
title: '系統名稱',
advice_size: '建議圖片大小'
},
@ -1304,54 +1290,5 @@ export default {
i18n_msg_type_dataset_sync_faild: '數據集同步失敗',
i18n_msg_type_all: '全部類型',
channel_inner_msg: '站內消息'
},
denumberrange: {
label: '數值區間',
split_placeholder: '至',
please_key_min: '請輸入最小值',
please_key_max: '請輸入最大值',
out_of_min: '最小值不能小于最小整數-2³²',
out_of_max: '最大值不能大于最大整數2³²-1',
must_int: '請輸入整數',
min_out_max: '最小值必須小于最大值',
max_out_min: '最大值必須大于最小值'
},
denumberselect: {
label: '數字下拉',
placeholder: '請選擇'
},
deinputsearch: {
label: '文本搜索',
placeholder: '請輸入關鍵字'
},
detextselect: {
label: '文本下拉',
placeholder: '請選擇'
},
detextgridselect: {
label: '文本列表',
placeholder: '請選擇'
},
denumbergridselect: {
label: '數字列表',
placeholder: '請選擇'
},
dedaterange: {
label: '日期範圍',
to_placeholder: '結束日期',
from_placeholder: '開始日期',
split_placeholder: '至'
},
dedate: {
label: '日期',
placeholder: '請選擇日期'
},
deyearmonth: {
label: '年月',
placeholder: '請選擇年月'
},
deyear: {
label: '年份',
placeholder: '請選擇年份'
}
}

View File

@ -126,7 +126,8 @@ export default {
expires: '登录信息过期,请重新登录',
tokenError: '登陆信息错误,请重新登录',
username_error: '请输入正确的 ID',
password_error: '密码不小于 8 位'
password_error: '密码不小于 8 位',
login_again: '重新登录'
},
commons: {
no_target_permission: '没有权限',
@ -333,7 +334,9 @@ export default {
input_pwd: '请输入密码',
message_box: {
alert: '警告',
confirm: '确认'
confirm: '确认',
ok: '确认',
cancel: '取消'
}
},
documentation: {
@ -751,7 +754,6 @@ export default {
chart_funnel: '漏斗图',
chart_radar: '雷达图',
chart_gauge: '仪表盘',
chart_map: '地图',
dateStyle: '日期显示',
datePattern: '日期格式',
y: '年',
@ -820,11 +822,6 @@ export default {
drag_block_funnel_split: '漏斗分层',
drag_block_radar_length: '分支长度',
drag_block_radar_label: '分支标签',
map_range: '地图范围',
select_map_range: '请选择地图范围',
area: '地区',
stack_item: '堆叠项',
placeholder_field: '拖动字段至此处',
axis_label_rotate: '标签角度'
},
dataset: {
@ -979,18 +976,7 @@ export default {
right_join: '右连接',
inner_join: '内连接',
full_join: '全连接',
can_not_union_diff_datasource: '被关联数据集必须与当前数据集的数据源一致',
operator: '操作',
d_q_trans: '维度/指标转换',
add_calc_field: '新建计算字段',
input_name: '请输入名称',
field_exp: '字段表达式',
data_type: '数据类型',
click_ref_field: '点击引用字段',
click_ref_function: '点击引用函数',
field_manage: '字段管理',
edit_calc_field: '编辑计算字段',
calc_field: '计算字段'
can_not_union_diff_datasource: '被关联数据集必须与当前数据集的数据源一致'
},
datasource: {
datasource: '数据源',
@ -1023,7 +1009,8 @@ export default {
oracle_service_name: '服务名',
get_schema: '获取 Schema',
schema: '数据库 Schema',
please_choose_schema: '请选择数据库 Schema'
please_choose_schema: '请选择数据库 Schema',
edit_datasource_msg: '修改数据源信息,可能会导致改数据源下的数据集不可用,确认修改?'
},
pblink: {
key_pwd: '请输入密码打开链接',
@ -1144,7 +1131,7 @@ export default {
lineHeight: '行高',
letterSpacing: '字间距',
textAlign: '左右对齐',
opacity: '透明度',
opacity: '透明度',
verticalAlign: '上下对齐',
text_align_left: '左对齐',
text_align_center: '左右居中',
@ -1306,54 +1293,5 @@ export default {
i18n_msg_type_dataset_sync_faild: '数据集同步失败',
i18n_msg_type_all: '全部类型',
channel_inner_msg: '站内消息'
},
denumberrange: {
label: '数值区间',
split_placeholder: '至',
please_key_min: '请输入最小值',
please_key_max: '请输入最大值',
out_of_min: '最小值不能小于最小整数-2³²',
out_of_max: '最大值不能大于最大整数2³²-1',
must_int: '请输入整数',
min_out_max: '最小值必须小于最大值',
max_out_min: '最大值必须大于最小值'
},
denumberselect: {
label: '数字下拉',
placeholder: '请选择'
},
deinputsearch: {
label: '文本搜索',
placeholder: '请输入关键字'
},
detextselect: {
label: '文本下拉',
placeholder: '请选择'
},
detextgridselect: {
label: '文本列表',
placeholder: '请选择'
},
denumbergridselect: {
label: '数字列表',
placeholder: '请选择'
},
dedaterange: {
label: '日期范围',
to_placeholder: '结束日期',
from_placeholder: '开始日期',
split_placeholder: '至'
},
dedate: {
label: '日期',
placeholder: '请选择日期'
},
deyearmonth: {
label: '年月',
placeholder: '请选择年月'
},
deyear: {
label: '年份',
placeholder: '请选择年份'
}
}

View File

@ -9,8 +9,8 @@ export const $alert = (message, callback, options) => {
export const $confirm = (message, callback, options = {}) => {
const defaultOptions = {
confirmButtonText: i18n.t('common.button.ok'),
cancelButtonText: i18n.t('common.button.cancel'),
confirmButtonText: i18n.t('commons.message_box.ok'),
cancelButtonText: i18n.t('commons.message_box.cancel'),
type: 'warning',
...options
}

View File

@ -16,7 +16,7 @@ const LinkTokenKey = Config.LinkTokenKey
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
timeout: 10000 // request timeout
timeout: 20000 // request timeout
})
// request interceptor
@ -62,6 +62,9 @@ const checkAuth = response => {
store.dispatch('user/logout').then(() => {
location.reload()
})
}, {
confirmButtonText: i18n.t('login.login_again'),
showClose: false
})
}
@ -71,6 +74,9 @@ const checkAuth = response => {
store.dispatch('user/logout').then(() => {
location.reload()
})
}, {
confirmButtonText: i18n.t('login.login_again'),
showClose: false
})
}
// token到期后自动续命 刷新token

View File

@ -508,11 +508,7 @@ export const BASE_RADAR = {
},
indicator: []
},
series: [{
type: 'radar',
// areaStyle: {normal: {}},
data: []
}]
series: []
}
export const BASE_GAUGE = {

View File

@ -36,8 +36,20 @@ export function baseRadarOption(chart_option, chart) {
y.label = customAttr.label
}
chart_option.legend.data.push(y.name)
const d = {
name: y.name,
type: 'radar',
data: [
{
value: y.data,
name: y.name,
label: y.label
}
]
}
y.value = JSON.parse(JSON.stringify(y.data))
chart_option.series[0].data.push(y)
chart_option.series.push(d)
maxValues.push(Math.max.apply(null, y.value))
}

View File

@ -315,7 +315,6 @@
<script>
import { post, chartGroupTree } from '@/api/chart/chart'
import { authModel } from '@/api/system/sysAuth'
import TableSelector from '../view/TableSelector'
import GroupMoveSelector from '../components/TreeSelector/GroupMoveSelector'
import ChartMoveSelector from '../components/TreeSelector/ChartMoveSelector'
@ -563,7 +562,7 @@ export default {
// this.chartTree()
this.refreshNodeBy(view.sceneId)
// this.$router.push('/chart/home')
this.$emit('switchComponent', { name: '' })
// this.$emit('switchComponent', { name: '' })
this.$store.dispatch('chart/setTable', null)
})
} else {

View File

@ -1256,8 +1256,8 @@ export default {
fieldFilter(val) {
if (val && val !== '') {
this.dimensionData = JSON.parse(JSON.stringify(this.dimension.filter(ele => { return ele.name.includes(val) })))
this.quotaData = JSON.parse(JSON.stringify(this.quota.filter(ele => { return ele.name.includes(val) })))
this.dimensionData = JSON.parse(JSON.stringify(this.dimension.filter(ele => { return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
this.quotaData = JSON.parse(JSON.stringify(this.quota.filter(ele => { return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
} else {
this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
this.quotaData = JSON.parse(JSON.stringify(this.quota))

View File

@ -33,7 +33,7 @@
</el-select>
</el-form-item>
<el-form-item class="form-item" v-if="mode === '1'">
<el-form-item v-if="mode === '1'" class="form-item">
<el-select v-model="syncType" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
<el-option :label="$t('dataset.sync_now')" value="sync_now" />
<el-option :label="$t('dataset.sync_latter')" value="sync_latter" />
@ -100,7 +100,7 @@ export default {
},
searchTable(val) {
if (val && val !== '') {
this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.name.includes(val) })))
this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
} else {
this.tableData = JSON.parse(JSON.stringify(this.tables))
}

View File

@ -202,7 +202,7 @@ export default {
},
search(val) {
if (val && val !== '') {
this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.name.includes(val) })))
this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
} else {
this.tableData = JSON.parse(JSON.stringify(this.tables))
}

View File

@ -163,16 +163,17 @@ export default {
this.unionDataChange()
},
'table': function() {
if (this.table && this.table.sceneId) {
post('dataset/group/getScene/' + this.table.sceneId, {}, false).then(response => {
this.currGroup = response.data
this.$nextTick(function() {
this.sceneMode = true
this.tableTree()
})
})
}
// if (this.table && this.table.sceneId) {
// post('dataset/group/getScene/' + this.table.sceneId, {}, false).then(response => {
// this.currGroup = response.data
//
// this.$nextTick(function() {
// this.sceneMode = true
// this.tableTree()
// })
// })
// }
this.treeNode(this.groupForm)
},
search(val) {
this.$emit('switchComponent', { name: '' })
@ -236,7 +237,7 @@ export default {
this.tableData = []
if (this.currGroup) {
this.dsLoading = true
this.tables = [];
this.tables = []
post('/dataset/table/list', {
sort: 'type asc,name asc,create_time desc',
sceneId: this.currGroup.id,
@ -247,7 +248,7 @@ export default {
if (response.data[i].mode === 1 && this.kettleRunning === false) {
this.$set(response.data[i], 'disabled', true)
}
if(hasDataPermission(this.privileges, response.data[i].privileges)){
if (hasDataPermission(this.privileges, response.data[i].privileges)) {
this.tables.push(response.data[i])
}
}
@ -352,7 +353,7 @@ export default {
if (!this.isTreeSearch) {
if (node.data.id) {
this.dsLoading = true
this.tables = [];
this.tables = []
post('/dataset/table/listAndGroup', {
sort: 'type asc,name asc,create_time desc',
sceneId: node.data.id,
@ -364,7 +365,7 @@ export default {
if (response.data[i].mode === 1 && this.kettleRunning === false) {
this.$set(response.data[i], 'disabled', true)
}
if(hasDataPermission(this.privileges, response.data[i].privileges)){
if (hasDataPermission(this.privileges, response.data[i].privileges)) {
this.tables.push(response.data[i])
}
}

View File

@ -55,19 +55,26 @@
</el-row>
</el-col>
<el-col :span="10" style="height: 100%;border-left: 1px solid #E6E6E6;">
<el-col :span="12" style="height: 100%">
<el-col :span="12" style="height: 100%" class="padding-lr">
<span>{{ $t('dataset.click_ref_field') }}</span>
<div class="padding-lr field-height">
<el-input
v-model="searchField"
size="mini"
:placeholder="$t('dataset.search')"
prefix-icon="el-icon-search"
clearable
/>
<div class="field-height">
<span>{{ $t('chart.dimension') }}</span>
<draggable
v-model="tableFields.dimensionList"
v-model="dimensionData"
:options="{group:{name: 'drag',pull:'clone'},sort: true}"
animation="300"
class="drag-list"
:disabled="true"
>
<transition-group>
<span v-for="item in tableFields.dimensionList.filter(ele => ele.extField === 0)" :key="item.id" class="item-dimension" :title="item.name" @click="insertParamToCodeMirror('['+item.id+']')">
<span v-for="item in dimensionData" :key="item.id" class="item-dimension" :title="item.name" @click="insertParamToCodeMirror('['+item.id+']')">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
@ -77,17 +84,17 @@
</transition-group>
</draggable>
</div>
<div class="padding-lr field-height">
<div class="field-height">
<span>{{ $t('chart.quota') }}</span>
<draggable
v-model="tableFields.quotaList"
v-model="quotaData"
:options="{group:{name: 'drag',pull:'clone'},sort: true}"
animation="300"
class="drag-list"
:disabled="true"
>
<transition-group>
<span v-for="item in tableFields.quotaList.filter(ele => ele.extField === 0)" :key="item.id" class="item-quota" :title="item.name" @click="insertParamToCodeMirror('['+item.id+']')">
<span v-for="item in quotaData" :key="item.id" class="item-quota" :title="item.name" @click="insertParamToCodeMirror('['+item.id+']')">
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="item.deType === 2 || item.deType === 3" icon-class="field_value" class="field-icon-value" />
@ -98,11 +105,18 @@
</draggable>
</div>
</el-col>
<el-col :span="12" style="height: 100%">
<el-col :span="12" style="height: 100%" class="padding-lr">
<span>{{ $t('dataset.click_ref_function') }}</span>
<el-row class="padding-lr function-height">
<el-input
v-model="searchFunction"
size="mini"
:placeholder="$t('dataset.search')"
prefix-icon="el-icon-search"
clearable
/>
<el-row class="function-height">
<el-popover
v-for="(item,index) in functions"
v-for="(item,index) in functionData"
:key="index"
class="function-pop"
placement="right"
@ -205,7 +219,12 @@ export default {
{ label: this.$t('dataset.value') + '(' + this.$t('dataset.float') + ')', value: 3 },
{ label: this.$t('dataset.location'), value: 5 }
],
functions: []
functions: [],
searchField: '',
searchFunction: '',
dimensionData: [],
quotaData: [],
functionData: []
}
},
computed: {
@ -222,6 +241,26 @@ export default {
this.initField()
},
deep: true
},
'tableFields': function() {
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList)).filter(ele => ele.extField === 0)
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList)).filter(ele => ele.extField === 0)
},
'searchField': function(val) {
if (val && val !== '') {
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList.filter(ele => ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) && ele.extField === 0)))
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList.filter(ele => ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) && ele.extField === 0)))
} else {
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList)).filter(ele => ele.extField === 0)
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList)).filter(ele => ele.extField === 0)
}
},
'searchFunction': function(val) {
if (val && val !== '') {
this.functionData = JSON.parse(JSON.stringify(this.functions.filter(ele => { return ele.func.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
} else {
this.functionData = JSON.parse(JSON.stringify(this.functions))
}
}
},
mounted() {
@ -230,6 +269,8 @@ export default {
})
this.initFunctions()
this.initField()
this.dimensionData = JSON.parse(JSON.stringify(this.tableFields.dimensionList)).filter(ele => ele.extField === 0)
this.quotaData = JSON.parse(JSON.stringify(this.tableFields.quotaList)).filter(ele => ele.extField === 0)
},
methods: {
onCmReady(cm) {
@ -253,6 +294,7 @@ export default {
initFunctions() {
post('/dataset/function/listByTableId/' + this.param.id, null).then(response => {
this.functions = response.data
this.functionData = JSON.parse(JSON.stringify(this.functions))
})
},
@ -292,6 +334,10 @@ export default {
size: 0,
extField: 2
}
this.dimensionData = []
this.quotaData = []
this.searchField = ''
this.searchFunction = ''
}
}
}
@ -322,7 +368,7 @@ export default {
}
.padding-lr {
padding: 0 6px;
padding: 0 4px;
}
.field-height{
height: calc(50% - 20px);

View File

@ -354,8 +354,8 @@ export default {
filterField(val) {
if (val && val !== '') {
this.tableFields.dimensionListData = JSON.parse(JSON.stringify(this.tableFields.dimensionListData.filter(ele => { return ele.name.includes(val) })))
this.tableFields.quotaListData = JSON.parse(JSON.stringify(this.tableFields.quotaList.filter(ele => { return ele.name.includes(val) })))
this.tableFields.dimensionListData = JSON.parse(JSON.stringify(this.tableFields.dimensionListData.filter(ele => { return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
this.tableFields.quotaListData = JSON.parse(JSON.stringify(this.tableFields.quotaList.filter(ele => { return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) })))
} else {
this.tableFields.dimensionListData = JSON.parse(JSON.stringify(this.tableFields.dimensionList))
this.tableFields.quotaListData = JSON.parse(JSON.stringify(this.tableFields.quotaList))

View File

@ -105,7 +105,7 @@
width="500"
trigger="click"
>
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" :mode="table.mode" @getTable="getTable" />
<dataset-group-selector-tree :fix-height="true" show-mode="union" :table="table" :custom-type="customType" :mode="table.mode" @getTable="getTable" />
<el-button slot="reference" size="mini" style="width: 100%;">
<p class="table-name-css" :title="targetTable.name || $t('dataset.pls_slc_union_table')">{{ targetTable.name || $t('dataset.pls_slc_union_table') }}</p>
</el-button>
@ -206,6 +206,8 @@ export default {
if (this.table.id) {
if (this.table.mode === 0) {
this.customType = ['db']
} else {
this.customType = ['db', 'sql', 'excel']
}
post('dataset/union/listByTableId/' + this.table.id, {}).then(response => {
// console.log(response)

View File

@ -341,8 +341,7 @@
</template>
<script>
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, post , isKettleRunning} from '@/api/dataset/dataset'
import { authModel } from '@/api/system/sysAuth'
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, post, isKettleRunning} from '@/api/dataset/dataset'
import GroupMoveSelector from './GroupMoveSelector'
import DsMoveSelector from './DsMoveSelector'

View File

@ -8,7 +8,9 @@
<complex-table
:data="data"
:columns="columns"
:hide-columns="true"
:pagination-config="paginationConfig"
:search-config="searchConfig"
@select="select"
@search="search"
@selection-change="handleSelectionChange"
@ -93,7 +95,11 @@ export default {
pageSize: 10,
total: 0
},
multipleSelection: []
multipleSelection: [],
searchConfig: {
useQuickSearch: false,
useComplexSearch: false
}
}
},
computed: {

View File

@ -26,10 +26,10 @@
</el-form-item>
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.host')" prop="configuration.host">
<el-input v-model="form.configuration.host" autocomplete="off" :disabled="formType=='modify'" />
<el-input v-model="form.configuration.host" autocomplete="off" />
</el-form-item>
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.data_base')" prop="configuration.dataBase">
<el-input v-model="form.configuration.dataBase" autocomplete="off" :disabled="formType=='modify'" />
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
</el-form-item>
<el-form-item v-if="form.type=='oracle'" :label="$t('datasource.oracle_connection_type')" prop="configuration.connectionType">
@ -38,7 +38,7 @@
</el-form-item>
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.user_name')" prop="configuration.username">
<el-input v-model="form.configuration.username" autocomplete="off" :disabled="formType=='modify'" />
<el-input v-model="form.configuration.username" autocomplete="off" />
</el-form-item>
<el-form-item v-if="form.configuration.dataSourceType=='jdbc'" :label="$t('datasource.password')" prop="configuration.password">
<el-input v-model="form.configuration.password" autocomplete="off" show-password />
@ -53,7 +53,7 @@
</el-form-item>
<el-form-item v-if="form.type=='oracle'" :label="$t('datasource.schema')">
<el-select filterable v-model="form.configuration.schema" :placeholder="$t('datasource.please_choose_schema')" class="select-width" :disabled="formType=='modify'">
<el-select filterable v-model="form.configuration.schema" :placeholder="$t('datasource.please_choose_schema')" class="select-width">
<el-option
v-for="item in schemas"
:key="item"
@ -79,6 +79,8 @@
<script>
import LayoutContent from '@/components/business/LayoutContent'
import { addDs, editDs, getSchema, validateDs } from '@/api/system/datasource'
import { $confirm } from '@/utils/message'
export default {
name: 'DsForm',
components: { LayoutContent },
@ -105,7 +107,8 @@ export default {
},
allTypes: [{ name: 'mysql', label: 'MySQL', type: 'jdbc' }, { name: 'oracle', label: 'Oracle', type: 'jdbc' }],
schemas: [],
canEdit: false
canEdit: false,
originConfiguration: {}
}
},
@ -140,6 +143,7 @@ export default {
edit(row) {
this.formType = 'modify'
this.form = Object.assign({}, row)
this.originConfiguration = this.form.configuration
this.form.configuration = JSON.parse(this.form.configuration)
},
@ -156,11 +160,21 @@ export default {
const method = this.formType === 'add' ? addDs : editDs
const form = JSON.parse(JSON.stringify(this.form))
form.configuration = JSON.stringify(form.configuration)
method(form).then(res => {
this.$success(this.$t('commons.save_success'))
this.refreshTree()
this.backToList()
})
if(this.formType !== 'add' && this.originConfiguration !== form.configuration) {
$confirm(this.$t('datasource.edit_datasource_msg'), () => {
method(form).then(res => {
this.$success(this.$t('commons.save_success'))
this.refreshTree()
this.backToList()
})
})
}else {
method(form).then(res => {
this.$success(this.$t('commons.save_success'))
this.refreshTree()
this.backToList()
})
}
} else {
return false
}

View File

@ -56,6 +56,7 @@ import ComplexTable from '@/components/business/complex-table'
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { post } from '@/api/dataset/dataset'
import {loadMenus} from "@/permission";
export default {
name: 'TaskRecord',
@ -116,7 +117,8 @@ export default {
last_condition: null,
show_error_massage: false,
error_massage: '',
matchLogId: null
matchLogId: null,
lastRequestComplete: true
}
},
computed: {
@ -139,7 +141,7 @@ export default {
if (!this.timer) {
this.timer = setInterval(() => {
this.search(this.last_condition, false)
}, 10000)
}, 1000)
}
},
destroyTimer() {
@ -167,6 +169,12 @@ export default {
select(selection) {
},
search(condition, showLoading = true) {
if(!this.lastRequestComplete){
return;
}else {
this.lastRequestComplete = false;
}
this.last_condition = condition
condition = formatQuickCondition(condition, 'dataset_table_task.name')
const temp = formatCondition(condition)
@ -175,6 +183,9 @@ export default {
post('/dataset/taskLog/list/notexcel/' + this.paginationConfig.currentPage + '/' + this.paginationConfig.pageSize, param, showLoading).then(response => {
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
this.lastRequestComplete = true;
}).catch(() => {
this.lastRequestComplete = true;
})
},
showErrorMassage(massage) {