Merge branch 'dev' into pr@dev_dataset_source

This commit is contained in:
dataeaseShu 2022-09-19 16:14:37 +08:00
commit eb367e1c09
42 changed files with 861 additions and 143 deletions

View File

@ -68,7 +68,8 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/**/*.json", ANON);
filterChainDefinitionMap.put("/system/ui/**", ANON);
filterChainDefinitionMap.put("/system/file/**", ANON);
filterChainDefinitionMap.put("/system/filedown/**", ANON);
filterChainDefinitionMap.put("/system/showpicture/**", ANON);
filterChainDefinitionMap.put("/**/*.js", ANON);
filterChainDefinitionMap.put("/**/*.css", ANON);
filterChainDefinitionMap.put("/**/*.map", ANON);

View File

@ -110,6 +110,8 @@ public interface ParamConstants {
enum BASIC implements ParamConstants {
FRONT_TIME_OUT("basic.frontTimeOut"),
MSG_TIME_OUT("basic.msgTimeOut"),
DS_CHECK_INTERVAL("basic.dsCheckInterval"),
DS_CHECK_INTERVAL_TYPE("basic.dsCheckIntervalType"),
DEFAULT_LOGIN_TYPE("basic.loginType"),
OPEN_HOME_PAGE("ui.openHomePage"),

View File

@ -70,11 +70,11 @@ public class DataSetTableController {
@ApiOperation("修改")
@PostMapping("alter")
@DeLog(
operatetype = SysLogConstants.OPERATE_TYPE.MODIFY,
sourcetype = SysLogConstants.SOURCE_TYPE.DATASET,
value = "id",
positionIndex = 0,
positionKey = "sceneId"
operatetype = SysLogConstants.OPERATE_TYPE.MODIFY,
sourcetype = SysLogConstants.SOURCE_TYPE.DATASET,
value = "id",
positionIndex = 0,
positionKey = "sceneId"
)
public void alter(@RequestBody DataSetTableRequest request) throws Exception {
dataSetTableService.alter(request);
@ -135,6 +135,16 @@ public class DataSetTableController {
return dataSetTableService.getPreviewData(dataSetTableRequest, page, pageSize, null);
}
@ApiOperation("db数据库表预览数据")
@PostMapping("dbPreview")
@DePermissions(value = {
@DePermission(type = DePermissionType.DATASET, value = "id", level = ResourceAuthLevel.DATASET_LEVEL_USE),
@DePermission(type = DePermissionType.DATASOURCE, value = "dataSourceId", level = ResourceAuthLevel.DATASOURCE_LEVEL_USE)
}, logical = Logical.AND)
public Map<String, Object> getDBPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
return dataSetTableService.getDBPreview(dataSetTableRequest);
}
@ApiOperation("根据sql查询预览数据")
@PostMapping("sqlPreview")
@DePermissions(value = {
@ -212,7 +222,13 @@ public class DataSetTableController {
@ApiOperation("根据仪表板视图ID查询数据集变量")
@PostMapping("/paramsWithIds/{type}")
List<SqlVariableDetails> paramsWithIds(@PathVariable String type, @RequestBody List<String> viewIds){
List<SqlVariableDetails> paramsWithIds(@PathVariable String type, @RequestBody List<String> viewIds) {
return dataSetTableService.paramsWithIds(type, viewIds);
};
}
@ApiOperation("根据数据集文件夹ID查询数据集名称")
@PostMapping("/getDatasetNameFromGroup/{sceneId}")
public List<String> getDatasetNameFromGroup(@PathVariable String sceneId) {
return dataSetTableService.getDatasetNameFromGroup(sceneId);
}
}

View File

@ -4,7 +4,6 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.plugins.common.base.domain.DatasetTableTask;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.utils.PageUtils;
@ -12,6 +11,7 @@ import io.dataease.commons.utils.Pager;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.plugins.common.base.domain.DatasetTableTask;
import io.dataease.service.dataset.DataSetTableTaskLogService;
import io.dataease.service.dataset.DataSetTableTaskService;
import io.swagger.annotations.Api;
@ -62,6 +62,14 @@ public class DataSetTableTaskController {
return dataSetTableTaskService.list(datasetTableTask);
}
@DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("分页查询")
@PostMapping("list/{goPage}/{pageSize}")
public Pager<List<DatasetTableTask>> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, dataSetTableTaskService.list(datasetTableTask));
}
@ApiOperation("分页查询")
@PostMapping("/pageList/{goPage}/{pageSize}")
public Pager<List<DataSetTaskDTO>> taskList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {

View File

@ -1,6 +1,6 @@
package io.dataease.controller.sys;
import io.dataease.plugins.common.base.domain.FileMetadata;
import io.dataease.plugins.common.base.domain.SystemParameter;
import io.dataease.commons.constants.ParamConstants;
import io.dataease.controller.sys.response.BasicInfo;
@ -8,6 +8,7 @@ import io.dataease.controller.sys.response.MailInfo;
import io.dataease.dto.SystemParameterDTO;
import io.dataease.listener.DatasetCheckListener;
import io.dataease.listener.util.CacheUtils;
import io.dataease.plugins.common.util.GlobalFileUtil;
import io.dataease.plugins.xpack.cas.dto.CasSaveResult;
import io.dataease.service.FileService;
import io.dataease.service.system.EmailService;
@ -22,7 +23,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -108,21 +109,16 @@ public class SystemParameterController {
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
}
@GetMapping("/file/down/{fileId}/{fileName}")
public ResponseEntity<ByteArrayResource> down(@PathVariable("fileId") String fileId, @PathVariable("fileName") String fileName) throws Exception{
@GetMapping("/filedown/{fileId}/{fileName}")
public ResponseEntity<ByteArrayResource> down(@PathVariable("fileId") String fileId, @PathVariable("fileName") String fileName) throws Exception {
FileMetadata fileMetadata = fileService.getFileMetadataById(fileId);
String type = fileMetadata.getType();
if (!StringUtils.endsWith(fileName.toUpperCase(), type.toUpperCase())) {
fileName += ("." + type);
}
byte[] bytes = fileService.loadFileAsBytes(fileId);
ByteArrayResource bar = new ByteArrayResource(bytes);
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
ContentDisposition contentDisposition = ContentDisposition.parse("attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
headers.setContentDisposition(contentDisposition);
return new ResponseEntity<>(bar, headers, HttpStatus.OK);
return GlobalFileUtil.down(fileId, fileName);
}
@GetMapping(value = "/showpicture/{fileId}", produces = {MediaType.IMAGE_JPEG_VALUE, MediaType.IMAGE_PNG_VALUE})
public ResponseEntity<byte[]> showPicture(@PathVariable("fileId") String fileId) throws Exception {
return GlobalFileUtil.showPicture(fileId);
}
@PostMapping(value = "/save/ui", consumes = {"multipart/form-data"})

View File

@ -22,5 +22,9 @@ public class BasicInfo implements Serializable {
private String templateAccessKey;
@ApiModelProperty("显示模板市场")
private String openMarketPage;
@ApiModelProperty("数据源检测时间间隔")
private String dsCheckInterval;
@ApiModelProperty("数据源检测时间间隔类型")
private String dsCheckIntervalType;
}

View File

@ -0,0 +1,22 @@
package io.dataease.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class TaskInstance implements Serializable{
private String taskId;
private Long executeTime;
private Long finishTime;
private String status;
private String info;
private String qrtzInstance;
}

View File

@ -0,0 +1,17 @@
package io.dataease.ext;
import io.dataease.dto.TaskInstance;
import java.util.List;
public interface ExtTaskInstanceMapper {
int runningCount(String taskId);
void resetRunnings(String taskId);
void update(TaskInstance taskInstance);
List<TaskInstance> select();
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.dataease.ext.ExtTaskInstanceMapper">
<select id="runningCount" resultType="java.lang.Integer">
select count(*) from task_instance where task_id = #{taskId} and status = 'RUNNING'
</select>
<update id="resetRunnings">
update task_instance set status = 'ERROR', info = 'System Interrupt Error' where task_id = #{taskId} and 'RUNNING'
</update>
<update id="update" parameterType="io.dataease.dto.TaskInstance">
update task_instance
set `task_id` = #{taskId,jdbcType=VARCHAR},
`execute_time` = #{executeTime,jdbcType=BIGINT},
`finish_time` = #{finishTime,jdbcType=BIGINT},
status = #{status,jdbcType=VARCHAR},
info = #{info,jdbcType=VARCHAR},
qrtz_instance = #{qrtzInstance,jdbcType=VARCHAR}
where task_id = #{taskId,jdbcType=VARCHAR}
</update>
<select id="select" resultType="io.dataease.dto.TaskInstance">
select * from task_instance where task_id = 'Datasource_check_status' and status = 'RUNNING'
</select>
</mapper>

View File

@ -22,9 +22,9 @@ public class Schedular {
dataSetTableService.updateDatasetTableStatus();
}
@QuartzScheduled(cron = "0 0/30 * * * ?")
@QuartzScheduled(cron = "0 0/3 * * * ?")
public void updateDatasourceStatus() {
datasourceService.updateDatasourceStatus();
datasourceService.checkDatasourceJob();
}
@QuartzScheduled(cron = "0 0/30 * * * ?")

View File

@ -0,0 +1,98 @@
package io.dataease.job.sechedule.strategy.impl;
import com.google.gson.Gson;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.commons.utils.LogUtil;
import io.dataease.dto.TaskInstance;
import io.dataease.ext.ExtTaskInstanceMapper;
import io.dataease.job.sechedule.ScheduleManager;
import io.dataease.job.sechedule.strategy.TaskHandler;
import io.dataease.plugins.common.entity.GlobalTaskEntity;
import io.dataease.service.datasource.DatasourceService;
import org.quartz.*;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service("dsTaskHandler")
public class DsTaskHandler extends TaskHandler implements Job {
private static final String RUNNING = "RUNNING";
private static final String SUCCESS = "SUCCESS";
private static final String ERROR = "ERROR";
@Override
protected JobDataMap jobDataMap(GlobalTaskEntity taskEntity) {
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put("taskEntity", taskEntity);
return jobDataMap;
}
@Override
public void resetRunningInstance(Long taskId) {
}
@Override
protected Boolean taskIsRunning(Long taskId) {
return null;
}
@Override
public void addTask(ScheduleManager scheduleManager, GlobalTaskEntity taskEntity) throws Exception {
JobKey jobKey = new JobKey(taskEntity.getJobKey());
TriggerKey triggerKey = new TriggerKey(taskEntity.getJobKey());
Date start = new Date(taskEntity.getStartTime());
Date end = null;
Class<? extends TaskHandler> executor = this.getClass();
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, executor, taskEntity.getCron(), start, end, jobDataMap(taskEntity));
}
@Override
public void removeTask(ScheduleManager scheduleManager, GlobalTaskEntity taskEntity) {
JobKey jobKey = new JobKey(taskEntity.getJobKey());
TriggerKey triggerKey = new TriggerKey(taskEntity.getJobKey());
scheduleManager.removeJob(jobKey, triggerKey);
}
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
GlobalTaskEntity taskEntity = (GlobalTaskEntity) jobDataMap.get("taskEntity");
taskEntity.getJobKey();
if (isRunning(taskEntity.getJobKey())) {
LogUtil.info("Skip synchronization task: {} ,due to task status is {}", taskEntity.getJobKey(), "running");
return;
}
LogUtil.info("start check datasource status...");
TaskInstance taskInstance = new TaskInstance();
taskInstance.setTaskId("Datasource_check_status");
taskInstance.setExecuteTime(System.currentTimeMillis());
taskInstance.setFinishTime(null);
taskInstance.setStatus(RUNNING);
taskInstance.setQrtzInstance(context.getFireInstanceId());
ExtTaskInstanceMapper extTaskInstanceMapper = CommonBeanFactory.getBean(ExtTaskInstanceMapper.class);
extTaskInstanceMapper.update(taskInstance);
DatasourceService datasourceService = CommonBeanFactory.getBean(DatasourceService.class);
datasourceService.updateDatasourceStatus();
taskInstance.setFinishTime(System.currentTimeMillis());
taskInstance.setStatus(SUCCESS);
extTaskInstanceMapper.update(taskInstance);
LogUtil.info("end check datasource status.");
}
private Boolean isRunning(String taskId) {
ExtTaskInstanceMapper extTaskInstanceMapper = CommonBeanFactory.getBean(ExtTaskInstanceMapper.class);
return extTaskInstanceMapper.runningCount(taskId) > 0;
}
}

View File

@ -5,6 +5,7 @@ import io.dataease.auth.entity.TokenInfo;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.service.impl.AuthUserServiceImpl;
import io.dataease.auth.util.JWTUtils;
import io.dataease.commons.exception.DEException;
import io.dataease.dto.PermissionProxy;
import io.dataease.ext.ExtTaskMapper;
import io.dataease.commons.utils.CommonBeanFactory;
@ -16,10 +17,16 @@ import io.dataease.job.sechedule.strategy.TaskHandler;
import io.dataease.plugins.common.entity.GlobalTaskEntity;
import io.dataease.plugins.common.entity.GlobalTaskInstance;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.dingtalk.dto.entity.DingtalkMsgResult;
import io.dataease.plugins.xpack.dingtalk.service.DingtalkXpackService;
import io.dataease.plugins.xpack.email.dto.request.XpackEmailTaskRequest;
import io.dataease.plugins.xpack.email.dto.request.XpackPixelEntity;
import io.dataease.plugins.xpack.email.dto.response.XpackEmailTemplateDTO;
import io.dataease.plugins.xpack.email.service.EmailXpackService;
import io.dataease.plugins.xpack.lark.dto.entity.LarkMsgResult;
import io.dataease.plugins.xpack.lark.service.LarkXpackService;
import io.dataease.plugins.xpack.wecom.dto.entity.WecomMsgResult;
import io.dataease.plugins.xpack.wecom.service.WecomXpackService;
import io.dataease.service.chart.ViewExportExcel;
import io.dataease.service.system.EmailService;
import org.apache.commons.lang3.ObjectUtils;
@ -30,6 +37,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@ -176,9 +184,54 @@ public class EmailTaskHandler extends TaskHandler implements Job {
proxy.setUserId(user.getUserId());
files = viewExportExcel.export(panelId, viewIdList, proxy);
}
emailService.sendWithImageAndFiles(recipients, emailTemplateDTO.getTitle(), contentStr, bytes, files);
List<String> channels = null;
String recisetting = emailTemplateDTO.getRecisetting();
if (StringUtils.isBlank(recisetting)) {
channels = new ArrayList<>();
channels.add("email");
} else {
channels = Arrays.stream(recisetting.split(",")).collect(Collectors.toList());
}
List<String> reciLists = Arrays.stream(recipients.split(",")).collect(Collectors.toList());
for (int i = 0; i < channels.size(); i++) {
String channel = channels.get(i);
switch (channel) {
case "email" :
emailService.sendWithImageAndFiles(recipients, emailTemplateDTO.getTitle(), contentStr, bytes, files);
break;
case "wecom" :
if (SpringContextUtil.getBean(AuthUserService.class).supportWecom()) {
WecomXpackService wecomXpackService = SpringContextUtil.getBean(WecomXpackService.class);
WecomMsgResult wecomMsgResult = wecomXpackService.pushOaMsg(reciLists, emailTemplateDTO.getTitle(), contentStr, bytes, files);
if (wecomMsgResult.getErrcode() != 0) {
DEException.throwException(wecomMsgResult.getErrmsg());
}
}
break;
case "dingtalk" :
if (SpringContextUtil.getBean(AuthUserService.class).supportDingtalk()) {
DingtalkXpackService dingtalkXpackService = SpringContextUtil.getBean(DingtalkXpackService.class);
DingtalkMsgResult dingtalkMsgResult = dingtalkXpackService.pushOaMsg(reciLists, emailTemplateDTO.getTitle(), contentStr, bytes, files);
if (dingtalkMsgResult.getErrcode() != 0) {
DEException.throwException(dingtalkMsgResult.getErrmsg());
}
}
break;
case "lark" :
if (SpringContextUtil.getBean(AuthUserService.class).supportLark()) {
LarkXpackService larkXpackService = SpringContextUtil.getBean(LarkXpackService.class);
LarkMsgResult larkMsgResult = larkXpackService.pushOaMsg(reciLists, emailTemplateDTO.getTitle(), contentStr, bytes, files);
if (larkMsgResult.getCode() != 0) {
DEException.throwException(larkMsgResult.getMsg());
}
}
break;
default:
break;
}
}
success(taskInstance);
} catch (Exception e) {
error(taskInstance, e);
@ -186,6 +239,7 @@ public class EmailTaskHandler extends TaskHandler implements Job {
}
}
private XpackPixelEntity buildPixel(XpackEmailTemplateDTO emailTemplateDTO) {
XpackPixelEntity pixelEntity = new XpackPixelEntity();
String pixelStr = emailTemplateDTO.getPixel();

View File

@ -22,8 +22,10 @@ public class DataSourceInitStartListener implements ApplicationListener<Applicat
@Override
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
datasourceService.initAllDataSourceConnectionPool();
datasourceService.initDsCheckJob();
dataSetTableService.updateDatasetTableStatus();
engineService.initSimpleEngine();
}

View File

@ -119,7 +119,7 @@ public class XDingtalkServer {
LogUtil.error(e);
Cookie cookie_error = new Cookie("DingtalkError", msg);
cookie_error.setPath("/");
response.addCookie(cookie_error);
return modelAndView;
} catch (UnsupportedEncodingException e1) {
e.printStackTrace();

View File

@ -123,7 +123,7 @@ public class XLarkServer {
LogUtil.error(e);
Cookie cookie_error = new Cookie("LarkError", msg);
cookie_error.setPath("/");
response.addCookie(cookie_error);
return modelAndView;
} catch (UnsupportedEncodingException e1) {
e.printStackTrace();

View File

@ -124,7 +124,7 @@ public class XWecomServer {
LogUtil.error(e);
Cookie cookie_error = new Cookie("WecomError", msg);
cookie_error.setPath("/");
response.addCookie(cookie_error);
return modelAndView;
} catch (UnsupportedEncodingException e1) {
e.printStackTrace();

View File

@ -33,6 +33,7 @@ import io.dataease.plugins.common.base.mapper.ChartViewMapper;
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
import io.dataease.plugins.common.base.mapper.PanelViewMapper;
import io.dataease.plugins.common.constants.DatasetType;
import io.dataease.plugins.common.constants.datasource.SQLConstants;
import io.dataease.plugins.common.dto.chart.ChartFieldCompareDTO;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
@ -55,6 +56,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.pentaho.di.core.util.UUIDUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -114,6 +117,8 @@ public class ChartViewService {
@Resource
private DatasetTableFieldMapper datasetTableFieldMapper;
private static final Logger logger = LoggerFactory.getLogger(ChartViewService.class);
//默认使用非公平
private ReentrantLock lock = new ReentrantLock();
@ -659,7 +664,8 @@ public class ChartViewService {
}
boolean hasParameters = false;
if (StringUtils.isNotEmpty(table.getSqlVariableDetails())) {
List<SqlVariableDetails> sqlVariables = new Gson().fromJson(table.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {}.getType());
List<SqlVariableDetails> sqlVariables = new Gson().fromJson(table.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {
}.getType());
for (String parameter : Optional.ofNullable(request.getParameters()).orElse(new ArrayList<>())) {
if (sqlVariables.stream().map(SqlVariableDetails::getVariableName).collect(Collectors.toList()).contains(parameter)) {
hasParameters = true;
@ -816,7 +822,7 @@ public class ChartViewService {
|| StringUtils.containsIgnoreCase(view.getType(), "scatter")
|| StringUtils.containsIgnoreCase(view.getType(), "mix")
) {
assistFields = getAssistFields(dynamicAssistFields);
assistFields = getAssistFields(dynamicAssistFields, yAxis);
}
// 如果是插件视图 走插件内部的逻辑
@ -866,9 +872,6 @@ public class ChartViewService {
} else {
datasourceRequest.setQuery(qp.getSQL(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
}
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(qp.getSQLSummary(dataTableInfoDTO.getTable(), assistFields, null, null, null, view, ds));
}
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.SQL.name())) {
String sql = dataTableInfoDTO.isBase64Encryption() ? new String(java.util.Base64.getDecoder().decode(dataTableInfoDTO.getSql())) : dataTableInfoDTO.getSql();
sql = handleVariable(sql, requestList, qp, table);
@ -883,9 +886,6 @@ public class ChartViewService {
} else {
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
}
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(qp.getSQLSummaryAsTmp(sql, assistFields, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
}
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.CUSTOM.name())) {
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
@ -901,9 +901,6 @@ public class ChartViewService {
} else {
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
}
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(qp.getSQLSummaryAsTmp(sql, assistFields, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
}
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.UNION.name())) {
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dt, ds);
@ -920,12 +917,11 @@ public class ChartViewService {
} else {
datasourceRequest.setQuery(qp.getSQLAsTmp(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
}
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(qp.getSQLSummaryAsTmp(sql, assistFields, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
}
}
data = datasourceProvider.getData(datasourceRequest);
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(assistSQL(datasourceRequest.getQuery(), assistFields));
logger.info(datasourceAssistRequest.getQuery());
assistData = datasourceProvider.getData(datasourceAssistRequest);
}
} else if (table.getMode() == 1) {// 抽取
@ -946,7 +942,8 @@ public class ChartViewService {
datasourceRequest.setQuery(qp.getSQL(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, ds, view));
}
if (CollectionUtils.isNotEmpty(assistFields)) {
datasourceAssistRequest.setQuery(qp.getSQLSummary(tableName, assistFields, fieldCustomFilter, rowPermissionsTree, extFilterList, view, ds));
datasourceAssistRequest.setQuery(assistSQL(datasourceRequest.getQuery(), assistFields));
logger.info(datasourceAssistRequest.getQuery());
assistData = datasourceProvider.getData(datasourceAssistRequest);
}
// 仪表板有参数不使用缓存
@ -1143,6 +1140,19 @@ public class ChartViewService {
return res;
}
public String assistSQL(String sql, List<ChartViewFieldDTO> assistFields) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < assistFields.size(); i++) {
ChartViewFieldDTO dto = assistFields.get(i);
if (i == (assistFields.size() - 1)) {
stringBuilder.append(dto.getSummary() + "(" + dto.getOriginName() + ")");
} else {
stringBuilder.append(dto.getSummary() + "(" + dto.getOriginName() + "),");
}
}
return "SELECT " + stringBuilder + " FROM (" + sql + ") tmp";
}
public ChartViewDTO uniteViewResult(String sql, Map<String, Object> chartData, Map<String, Object> tabelData, ChartViewDTO view, Boolean isDrill, List<ChartExtFilterRequest> drillFilters, List<ChartSeniorAssistDTO> dynamicAssistFields, List<String[]> assistData) {
Map<String, Object> map = new HashMap<>();
@ -1563,7 +1573,8 @@ public class ChartViewService {
private String handleVariable(String sql, ChartExtRequest requestList, QueryProvider qp, DataSetTableDTO table) throws Exception {
List<SqlVariableDetails> sqlVariables = new Gson().fromJson(table.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {}.getType());
List<SqlVariableDetails> sqlVariables = new Gson().fromJson(table.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {
}.getType());
if (requestList != null && CollectionUtils.isNotEmpty(requestList.getFilter())) {
for (ChartExtFilterRequest chartExtFilterRequest : requestList.getFilter()) {
@ -1577,7 +1588,7 @@ public class ChartViewService {
for (String parameter : chartExtFilterRequest.getParameters()) {
List<SqlVariableDetails> parameters = sqlVariables.stream().filter(item -> item.getVariableName().equalsIgnoreCase(parameter)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(parameters)) {
String filter = qp.transFilter(chartExtFilterRequest,parameters.get(0));
String filter = qp.transFilter(chartExtFilterRequest, parameters.get(0));
sql = sql.replace("${" + parameter + "}", filter);
}
@ -1658,10 +1669,14 @@ public class ChartViewService {
String senior = view.getSenior();
JSONObject jsonObject = JSONObject.parseObject(senior);
JSONArray assistLine = jsonObject.getJSONArray("assistLine");
List<ChartSeniorAssistDTO> list = new ArrayList<>();
if (ObjectUtils.isEmpty(assistLine) || StringUtils.isBlank(assistLine.toJSONString())) {
return list;
}
List<ChartSeniorAssistDTO> assistLines = gson.fromJson(assistLine.toJSONString(), new TypeToken<List<ChartSeniorAssistDTO>>() {
}.getType());
List<ChartSeniorAssistDTO> list = new ArrayList<>();
for (ChartSeniorAssistDTO dto : assistLines) {
if (StringUtils.equalsIgnoreCase(dto.getField(), "0")) {
continue;
@ -1683,13 +1698,28 @@ public class ChartViewService {
return list;
}
private List<ChartViewFieldDTO> getAssistFields(List<ChartSeniorAssistDTO> list) {
private List<ChartViewFieldDTO> getAssistFields(List<ChartSeniorAssistDTO> list, List<ChartViewFieldDTO> yAxis) {
List<ChartViewFieldDTO> res = new ArrayList<>();
for (ChartSeniorAssistDTO dto : list) {
DatasetTableField curField = dto.getCurField();
ChartViewFieldDTO yField = null;
String alias = "";
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO field = yAxis.get(i);
if (StringUtils.equalsIgnoreCase(field.getId(), curField.getId())) {
yField = field;
alias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
break;
}
}
if (ObjectUtils.isEmpty(yField)) {
continue;
}
ChartViewFieldDTO chartViewFieldDTO = new ChartViewFieldDTO();
BeanUtils.copyBean(chartViewFieldDTO, curField);
chartViewFieldDTO.setSummary(dto.getSummary());
chartViewFieldDTO.setOriginName(alias);// yAxis的字段别名就是查找的字段名
res.add(chartViewFieldDTO);
}
return res;
@ -1701,8 +1731,10 @@ public class ChartViewService {
}
String[] strings = assistData.get(0);
for (int i = 0; i < dynamicAssistFields.size(); i++) {
ChartSeniorAssistDTO chartSeniorAssistDTO = dynamicAssistFields.get(i);
chartSeniorAssistDTO.setValue(strings[i]);
if (i < strings.length) {
ChartSeniorAssistDTO chartSeniorAssistDTO = dynamicAssistFields.get(i);
chartSeniorAssistDTO.setValue(strings[i]);
}
}
}
}

View File

@ -46,7 +46,7 @@ public class DataSetGroupService {
@Resource
private SysAuthService sysAuthService;
// @DeCleaner(value = DePermissionType.DATASET, key = "pid")
@DeCleaner(value = DePermissionType.DATASET, key = "pid")
public DataSetGroupDTO save(DatasetGroup datasetGroup) throws Exception {
checkName(datasetGroup);
if (StringUtils.isEmpty(datasetGroup.getId())) {

View File

@ -153,6 +153,8 @@ public class DataSetTableService {
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
// 保存之前校验table名称
checkNames(datasetTable);
for (DataSetTableRequest table : datasetTable) {
save(table);
// 清理权限缓存
@ -382,6 +384,13 @@ public class DataSetTableService {
}
}
public List<String> getDatasetNameFromGroup(String sceneId) {
DatasetTableExample example = new DatasetTableExample();
example.createCriteria().andSceneIdEqualTo(sceneId);
List<DatasetTable> datasetTables = datasetTableMapper.selectByExample(example);
return datasetTables.stream().map(DatasetTable::getName).collect(Collectors.toList());
}
public List<DataSetTableDTO> list(DataSetTableRequest dataSetTableRequest) {
dataSetTableRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
dataSetTableRequest.setTypeFilter(dataSetTableRequest.getTypeFilter());
@ -936,7 +945,7 @@ public class DataSetTableService {
return new ArrayList<>();
}
if(!Arrays.asList("DATE", "TEXT", "NUM").contains(type)){
if (!Arrays.asList("DATE", "TEXT", "NUM").contains(type)) {
return new ArrayList<>();
}
ChartViewExample chartViewExample = new ChartViewExample();
@ -965,24 +974,28 @@ public class DataSetTableService {
}
}
}
switch (type){
switch (type) {
case "DATE":
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("DATETIME")).collect(Collectors.toList());
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("DATETIME")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {
if(item.getType().size()> 1){
if (item.getType().size() > 1) {
item.setAlias(item.getVariableName() + "[" + item.getType().get(1) + "]");
}else {
} else {
item.setAlias(item.getVariableName());
}
});
break;
case "TEXT":
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("TEXT")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {item.setAlias(item.getVariableName());});
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("TEXT")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {
item.setAlias(item.getVariableName());
});
break;
case "NUM":
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("LONG") || item.getType().get(0).contains("DOUBLE")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {item.setAlias(item.getVariableName());});
sqlVariableDetails = sqlVariableDetails.stream().filter(item -> item.getType().get(0).contains("LONG") || item.getType().get(0).contains("DOUBLE")).collect(Collectors.toList());
sqlVariableDetails.forEach(item -> {
item.setAlias(item.getVariableName());
});
break;
}
return sqlVariableDetails;
@ -1072,7 +1085,7 @@ public class DataSetTableService {
return handleWith(plainSelect, select);
}
private String handleWith(PlainSelect plainSelect, Select select)throws Exception{
private String handleWith(PlainSelect plainSelect, Select select) throws Exception {
StringBuilder builder = new StringBuilder();
if (CollectionUtils.isNotEmpty(select.getWithItemsList())) {
builder.append("WITH");
@ -1089,6 +1102,45 @@ public class DataSetTableService {
builder.append(" " + plainSelect);
return builder.toString();
}
public Map<String, Object> getDBPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ds == null) {
throw new Exception(Translator.get("i18n_invalid_ds"));
}
Provider datasourceProvider = ProviderFactory.getProvider(ds.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
DataTableInfoDTO dataTableInfo = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class);
String sql = "SELECT * FROM " + dataTableInfo.getTable();
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
String sqlAsTable = qp.createSQLPreview(sql, null);
datasourceRequest.setQuery(sqlAsTable);
Map<String, List> result = datasourceProvider.fetchResultAndField(datasourceRequest);
List<String[]> data = result.get("dataList");
List<TableField> fields = result.get("fieldList");
String[] fieldArray = fields.stream().map(TableField::getFieldName).toArray(String[]::new);
if (checkIsRepeat(fieldArray)) {
DataEaseException.throwException(Translator.get("i18n_excel_field_repeat"));
}
List<Map<String, Object>> jsonArray = new ArrayList<>();
if (CollectionUtils.isNotEmpty(data)) {
jsonArray = data.stream().map(ele -> {
Map<String, Object> map = new HashMap<>();
for (int i = 0; i < ele.length; i++) {
map.put(fieldArray[i], ele[i]);
}
return map;
}).collect(Collectors.toList());
}
Map<String, Object> map = new HashMap<>();
map.put("fields", fields);
map.put("data", jsonArray);
return map;
}
public Map<String, Object> getSQLPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
if (ds == null) {
@ -2090,6 +2142,31 @@ public class DataSetTableService {
}
}
private void checkNames(List<DataSetTableRequest> datasetTable) {
if (CollectionUtils.isEmpty(datasetTable)) {
return;
}
Set<String> nameSet = new HashSet<>();
for (DataSetTableRequest table : datasetTable) {
nameSet.add(table.getName());
}
if (nameSet.size() != datasetTable.size()) {
throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
}
DatasetTableExample datasetTableExample = new DatasetTableExample();
DatasetTableExample.Criteria criteria = datasetTableExample.createCriteria();
if (StringUtils.isNotEmpty(datasetTable.get(0).getSceneId())) {
criteria.andSceneIdEqualTo(datasetTable.get(0).getSceneId());
}
if (CollectionUtils.isNotEmpty(nameSet)) {
criteria.andNameIn(new ArrayList<>(nameSet));
}
List<DatasetTable> list = datasetTableMapper.selectByExample(datasetTableExample);
if (list.size() > 0) {
throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
}
}
public DataSetDetail getDatasetDetail(String id) {
DataSetDetail dataSetDetail = new DataSetDetail();
DatasetTable table = datasetTableMapper.selectByPrimaryKey(id);

View File

@ -790,6 +790,7 @@ public class ExtractDataService {
Thread.sleep(1000);
}
if (jobStatus.getStatusDescription().equals("Finished")) {
LogUtil.info(datasetTable.getId()+ ": " + jobStatus.getLoggingString());
return;
} else {
DataEaseException.throwException(jobStatus.getLoggingString());

View File

@ -9,7 +9,10 @@ import io.dataease.auth.annotation.DeCleaner;
import io.dataease.commons.constants.RedisConstants;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.dto.TaskInstance;
import io.dataease.ext.ExtDataSourceMapper;
import io.dataease.ext.ExtTaskInstanceMapper;
import io.dataease.ext.UtilMapper;
import io.dataease.ext.query.GridExample;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.SysAuthConstants;
@ -31,17 +34,20 @@ import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.*;
import io.dataease.plugins.common.base.mapper.DatasetTableMapper;
import io.dataease.plugins.common.base.mapper.DatasourceMapper;
import io.dataease.plugins.common.base.mapper.QrtzSchedulerStateMapper;
import io.dataease.plugins.common.constants.DatasetType;
import io.dataease.plugins.common.constants.DatasourceCalculationMode;
import io.dataease.plugins.common.constants.DatasourceTypes;
import io.dataease.plugins.common.dto.datasource.DataSourceType;
import io.dataease.plugins.common.dto.datasource.TableDesc;
import io.dataease.plugins.common.entity.GlobalTaskEntity;
import io.dataease.plugins.common.request.datasource.DatasourceRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import io.dataease.plugins.datasource.provider.Provider;
import io.dataease.provider.ProviderFactory;
import io.dataease.provider.datasource.ApiProvider;
import io.dataease.service.ScheduleService;
import io.dataease.service.dataset.DataSetGroupService;
import io.dataease.service.message.DeMsgutil;
import io.dataease.service.sys.SysAuthService;
@ -49,6 +55,7 @@ import io.dataease.service.system.SystemParameterService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -77,6 +84,14 @@ public class DatasourceService {
private Environment env;
@Resource
private SystemParameterService systemParameterService;
@Autowired
private ScheduleService scheduleService;
@Resource
private QrtzSchedulerStateMapper qrtzSchedulerStateMapper;
@Resource
private UtilMapper utilMapper;
@Resource
private ExtTaskInstanceMapper extTaskInstanceMapper;
public Collection<DataSourceType> types() {
Collection<DataSourceType> types = new ArrayList<>();
@ -432,6 +447,24 @@ public class DatasourceService {
}
}
public void checkDatasourceJob() {
List<QrtzSchedulerState> qrtzSchedulerStates = qrtzSchedulerStateMapper.selectByExample(null);
List<String> activeQrtzInstances = qrtzSchedulerStates.stream()
.filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime()
+ qrtzSchedulerState.getCheckinInterval() + 1000 > utilMapper.currentTimestamp())
.map(QrtzSchedulerStateKey::getInstanceName).collect(Collectors.toList());
List<TaskInstance> taskInstances = extTaskInstanceMapper.select();
taskInstances.forEach(taskInstance -> {
if (StringUtils.isNotEmpty(taskInstance.getQrtzInstance()) && !activeQrtzInstances.contains(taskInstance.getQrtzInstance().substring(0, taskInstance.getQrtzInstance().length() - 13))) {
TaskInstance update = new TaskInstance();
update.setTaskId("Datasource_check_status");
extTaskInstanceMapper.update(update);
}
});
}
public void updateDatasourceStatus() {
List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample());
datasources.forEach(datasource -> checkAndUpdateDatasourceStatus(datasource, true));
@ -496,4 +529,57 @@ public class DatasourceService {
DeMsgutil.sendMsg(userId, typeId, content, gson.toJson(param));
});
}
public void updateDatasourceStatusJob(BasicInfo basicInfo, List<SystemParameter> parameters) {
String type = "";
Integer interval = 30;
boolean changeDsCheckTime = false;
basicInfo.getDsCheckInterval();
basicInfo.getDsCheckIntervalType();
for (SystemParameter parameter : parameters) {
if (parameter.getParamKey().equalsIgnoreCase("basic.dsCheckInterval") && !parameter.getParamValue().equalsIgnoreCase(basicInfo.getDsCheckInterval())) {
changeDsCheckTime = true;
interval = Integer.valueOf(parameter.getParamValue());
}
if (parameter.getParamKey().equalsIgnoreCase("basic.dsCheckIntervalType") && !parameter.getParamValue().equalsIgnoreCase(basicInfo.getDsCheckInterval())) {
changeDsCheckTime = true;
type = parameter.getParamValue();
}
}
if(!changeDsCheckTime){
return;
}
addJob(type, interval);
}
private void addJob(String type, Integer interval) {
String cron = "";
switch (type){
case "hour":
cron = "0 0 0/hour * * ? *".replace("hour", interval.toString());
break;
default:
cron = "0 0/minute * * * ? *".replace("minute", interval.toString());
}
GlobalTaskEntity globalTask = new GlobalTaskEntity();
globalTask.setCron(cron);
globalTask.setCreateTime(System.currentTimeMillis());
globalTask.setJobKey("Datasource_check_status");
globalTask.setTaskName("Datasource check status");
globalTask.setTaskType("dsTaskHandler");
globalTask.setStartTime(System.currentTimeMillis());
try {
scheduleService.addSchedule(globalTask);
}catch (Exception e){
e.printStackTrace();
}
}
public void initDsCheckJob(){
BasicInfo basicInfo = systemParameterService.basicInfo();
addJob(basicInfo.getDsCheckIntervalType(), Integer.valueOf(basicInfo.getDsCheckInterval()));
}
}

View File

@ -8,7 +8,6 @@ import io.dataease.controller.sys.response.BasicInfo;
import io.dataease.dto.SystemParameterDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.plugins.common.base.domain.FileMetadata;
import io.dataease.plugins.common.base.domain.SysParamAssist;
import io.dataease.plugins.common.base.domain.SystemParameter;
import io.dataease.plugins.common.base.domain.SystemParameterExample;
import io.dataease.plugins.common.base.mapper.SystemParameterMapper;
@ -17,10 +16,11 @@ import io.dataease.plugins.xpack.cas.dto.CasSaveResult;
import io.dataease.plugins.xpack.cas.service.CasXpackService;
import io.dataease.plugins.xpack.display.service.DisplayXpackService;
import io.dataease.service.FileService;
import io.dataease.service.datasource.DatasourceService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -29,7 +29,6 @@ import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
@ -47,6 +46,9 @@ public class SystemParameterService {
private ExtSystemParameterMapper extSystemParameterMapper;
@Resource
private FileService fileService;
@Resource
@Lazy
private DatasourceService datasourceService;
public String searchEmail() {
return extSystemParameterMapper.email();
@ -86,7 +88,12 @@ public class SystemParameterService {
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_ACCESS_KEY.getValue())) {
result.setTemplateAccessKey(param.getParamValue());
}
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DS_CHECK_INTERVAL.getValue())) {
result.setDsCheckInterval(param.getParamValue());
}
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.DS_CHECK_INTERVAL_TYPE.getValue())) {
result.setDsCheckIntervalType(param.getParamValue());
}
}
}
return result;
@ -109,6 +116,7 @@ public class SystemParameterService {
@Transactional
public CasSaveResult editBasic(List<SystemParameter> parameters) {
CasSaveResult casSaveResult = afterSwitchDefaultLogin(parameters);
BasicInfo basicInfo = basicInfo();
for (int i = 0; i < parameters.size(); i++) {
SystemParameter parameter = parameters.get(i);
SystemParameterExample example = new SystemParameterExample();
@ -121,9 +129,11 @@ public class SystemParameterService {
}
example.clear();
}
datasourceService.updateDatasourceStatusJob(basicInfo, parameters);
return casSaveResult;
}
@Transactional
public void resetCas() {
Map<String, CasXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((CasXpackService.class));
@ -188,7 +198,6 @@ public class SystemParameterService {
}
public String getVersion() {
return System.getenv("MS_VERSION");
}
@ -302,10 +311,11 @@ public class SystemParameterService {
}
}
public BasicInfo templateMarketInfo(){
public BasicInfo templateMarketInfo() {
BasicInfo basicInfo = new BasicInfo();
List<SystemParameter> result = this.getParamList("basic.template");
if(CollectionUtils.isNotEmpty(result)){
if (CollectionUtils.isNotEmpty(result)) {
result.stream().forEach(param -> {
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) {
basicInfo.setTemplateMarketUlr(param.getParamValue());
@ -315,7 +325,7 @@ public class SystemParameterService {
}
});
}
if(StringUtils.isEmpty(basicInfo.getTemplateMarketUlr())|| StringUtils.isEmpty(basicInfo.getTemplateAccessKey())){
if (StringUtils.isEmpty(basicInfo.getTemplateMarketUlr()) || StringUtils.isEmpty(basicInfo.getTemplateAccessKey())) {
DataEaseException.throwException("Please check market setting info");
}
return basicInfo;

View File

@ -9,6 +9,20 @@ CREATE TABLE `sys_external_token` (
UPDATE `sys_menu` set `component` = 'system/datasource/DsForm' where `component` = 'system/datasource/form';
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.dsCheckInterval', 30, 'text', 1);
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.dsCheckIntervalType', 'minute', 'text', 1);
CREATE TABLE `task_instance` (
`task_id` VARCHAR(128) NOT NULL COMMENT '任务ID',
`execute_time` bigint(13) DEFAULT NULL COMMENT '执行时间',
`finish_time` bigint(13) DEFAULT NULL COMMENT '完成时间',
`status` VARCHAR(128) DEFAULT NULL COMMENT '状态',
`info` longtext COMMENT '执行信息',
`qrtz_instance` VARCHAR(128) DEFAULT NULL COMMENT '任务实例ID',
PRIMARY KEY (`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
INSERT INTO `task_instance` (`task_id`) VALUES ('Datasource_check_status');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (41, 1, 1, 1, '应用管理', 'system-template-app', 'panel/templateApp/index', 13, 'display-setting', 'panel/templateApp/index', 0, 0, 0, 'template:read', NULL, NULL, NULL, 1620444227389);
@ -40,3 +54,13 @@ INSERT INTO `sys_menu` VALUES (800, 0, 0, 1, '数据集表单', 'dataset-form',
INSERT INTO `sys_msg_channel` VALUES (3, 'webmsg.channel_wecom_msg', 'sendWecom');
INSERT INTO `sys_msg_channel` VALUES (4, 'webmsg.channel_dingtalk_msg', 'sendDingtalk');
INSERT INTO `sys_msg_channel` VALUES (5, 'webmsg.channel_lark_msg', 'sendLark');
UPDATE `dataset_table_function` SET `func` = 'CONCAT(s1,s2,...)' WHERE `id` = 29;
UPDATE `dataset_table_function` SET `func` = 'CONCAT(s1,s2,...)' WHERE `id` = 78;
ALTER TABLE `sys_task_email`
ADD COLUMN `recisetting` varchar(255) NULL COMMENT '消息渠道' AFTER `view_ids`,
ADD COLUMN `conditions` longtext NULL COMMENT '仪表板条件' AFTER `recisetting`;

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

View File

@ -794,6 +794,7 @@ export default {
no_more_than: 'Size no more than',
request_timeout: 'Request timeout',
message_retention_time: 'Message retention time',
ds_check_time: 'Data source detection interval',
test_mail_recipient: 'Used only as a test mail recipient',
to_enable_tsl: 'If the SMTP port is 587, you usually need to enable TSL',
to_enable_ssl: 'If the SMTP port is 465, you usually need to enable SSL',
@ -1015,7 +1016,8 @@ export default {
table_item_fontsize: 'Table font size',
table_header_bg: 'Header Background',
table_item_bg: 'Table Background',
table_item_font_color: 'Font Color',
table_header_font_color: 'Header Font',
table_item_font_color: 'Table Font',
stripe: 'Zebra pattern',
start_angle: 'Start Angle',
end_angle: 'End Angle',
@ -1328,7 +1330,10 @@ export default {
chart_group: 'Sub Type',
chart_bar_group: 'Bar Group',
field_dynamic: 'Dynamic',
aggregation: 'Aggregation'
aggregation: 'Aggregation',
filter_between: 'Between',
field_not_empty: 'Field can not be empty',
summary_not_empty: 'Summary can not be empty'
},
dataset: {
parse_filed: 'Parse Field',
@ -2362,6 +2367,11 @@ export default {
panel: 'Panel',
content: 'Content',
recipients: 'Recipients',
recisetting: 'channel',
email: 'Email',
wecom: 'Wecom',
dingtalk: 'Dingtalk',
lark: 'Lark',
pixel: 'Pixel',
default: 'Default',
custom: 'Custom',

View File

@ -794,6 +794,7 @@ export default {
no_more_than: '大小不超過',
request_timeout: '請求超時時間',
message_retention_time: '消息保留時間',
ds_check_time: '数据源檢測時間間隔',
test_mail_recipient: '僅用來作為測試郵件收件人',
to_enable_tsl: '如果SMTP埠是587通常需要啟用TSL',
to_enable_ssl: '如果SMTP埠是465通常需要啟用SSL',
@ -1015,7 +1016,8 @@ export default {
table_item_fontsize: '錶格字體大小',
table_header_bg: '錶頭背景',
table_item_bg: '錶格背景',
table_item_font_color: '字體顔色',
table_header_font_color: '表頭字體',
table_item_font_color: '表格字體',
stripe: '斑馬紋',
start_angle: '起始角度',
end_angle: '結束角度',
@ -1328,7 +1330,10 @@ export default {
chart_group: '子類別',
chart_bar_group: '分組柱狀圖',
field_dynamic: '動態值',
aggregation: '聚合方式'
aggregation: '聚合方式',
filter_between: '介於',
field_not_empty: '字段不能為空',
summary_not_empty: '聚合方式不能為空'
},
dataset: {
parse_filed: '解析字段',
@ -2359,10 +2364,15 @@ export default {
},
emailtask: {
title: '郵件主題',
title: '報告主題',
panel: '儀錶闆',
content: '郵件正文',
content: '報告正文',
recipients: '收件人',
recisetting: '接受設置',
email: '郵件',
wecom: '企業微信',
dingtalk: '釘釘',
lark: '飛書',
pixel: '分辨率',
default: '默認',
custom: '自定義',

View File

@ -847,6 +847,7 @@ export default {
no_more_than: '大小不超过',
request_timeout: '请求超时时间',
message_retention_time: '消息保留时间',
ds_check_time: '数据源检测时间间隔',
test_mail_recipient: '仅用来作为测试邮件收件人',
to_enable_tsl: '如果SMTP端口是587通常需要启用TSL',
to_enable_ssl: '如果SMTP端口是465通常需要启用SSL',
@ -1068,7 +1069,8 @@ export default {
table_item_fontsize: '表格字体大小',
table_header_bg: '表头背景',
table_item_bg: '表格背景',
table_item_font_color: '字体颜色',
table_header_font_color: '表头字体',
table_item_font_color: '表格字体',
stripe: '斑马纹',
start_angle: '起始角度',
end_angle: '结束角度',
@ -1381,7 +1383,10 @@ export default {
chart_group: '子类别',
chart_bar_group: '分组柱状图',
field_dynamic: '动态值',
aggregation: '聚合方式'
aggregation: '聚合方式',
filter_between: '介于',
field_not_empty: '字段不能为空',
summary_not_empty: '聚合方式不能为空'
},
dataset: {
parse_filed: '解析字段',
@ -2413,10 +2418,15 @@ export default {
},
emailtask: {
title: '邮件主题',
title: '报告主题',
panel: '仪表板',
content: '邮件正文',
content: '报告正文',
recipients: '收件人',
recisetting: '接受设置',
email: '邮件',
wecom: '企业微信',
dingtalk: '钉钉',
lark: '飞书',
pixel: '分辨率',
default: '默认',
custom: '自定义',

View File

@ -18,6 +18,7 @@ export const DEFAULT_COLOR_CASE = {
alpha: 100,
tableHeaderBgColor: '#6D9A49',
tableItemBgColor: '#FFFFFF',
tableHeaderFontColor: '#000000',
tableFontColor: '#000000',
tableStripe: true,
dimensionColor: '#000000',

View File

@ -231,7 +231,12 @@ export function seniorCfg(chart_option, chart) {
if (customStyle.yAxis) {
yAxis = JSON.parse(JSON.stringify(customStyle.yAxis))
}
senior.assistLine.forEach(ele => {
const fixedLines = senior.assistLine.filter(ele => ele.field === '0')
const dynamicLines = chart.data.dynamicAssistLines
const lines = fixedLines.concat(dynamicLines)
lines.forEach(ele => {
if (chart.type.includes('horizontal')) {
chart_option.series[0].markLine.data.push({
symbol: 'none',

View File

@ -658,7 +658,12 @@ export function getAnalyse(chart) {
const a = JSON.parse(JSON.stringify(customStyle.yAxis))
yAxisPosition = transAxisPosition(chart, a)
}
senior.assistLine.forEach(ele => {
const fixedLines = senior.assistLine.filter(ele => ele.field === '0')
const dynamicLines = chart.data.dynamicAssistLines
const lines = fixedLines.concat(dynamicLines)
lines.forEach(ele => {
const content = ele.name + ' : ' + parseFloat(ele.value)
assistLine.push({
type: 'line',

View File

@ -23,17 +23,17 @@ export function getCustomTheme(chart) {
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
measureText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
}
@ -45,17 +45,17 @@ export function getCustomTheme(chart) {
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
measureText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
}
@ -67,17 +67,17 @@ export function getCustomTheme(chart) {
verticalBorderColor: borderColor
},
text: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
bolderText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
},
measureText: {
fill: DEFAULT_COLOR_CASE.tableFontColor,
fill: DEFAULT_COLOR_CASE.tableHeaderFontColor,
fontSize: DEFAULT_SIZE.tableTitleFontSize,
textAlign: headerAlign
}
@ -121,23 +121,23 @@ export function getCustomTheme(chart) {
theme.cornerCell.cell.backgroundColor = h_c
theme.cornerCell.cell.horizontalBorderColor = b_c
theme.cornerCell.cell.verticalBorderColor = b_c
theme.cornerCell.bolderText.fill = c.tableFontColor
theme.cornerCell.text.fill = c.tableFontColor
theme.cornerCell.measureText.fill = c.tableFontColor
theme.cornerCell.bolderText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.cornerCell.text.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.cornerCell.measureText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.cell.backgroundColor = h_c
theme.rowCell.cell.horizontalBorderColor = b_c
theme.rowCell.cell.verticalBorderColor = b_c
theme.rowCell.bolderText.fill = c.tableFontColor
theme.rowCell.text.fill = c.tableFontColor
theme.rowCell.measureText.fill = c.tableFontColor
theme.rowCell.bolderText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.text.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.rowCell.measureText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.colCell.cell.backgroundColor = h_c
theme.colCell.cell.horizontalBorderColor = b_c
theme.colCell.cell.verticalBorderColor = b_c
theme.colCell.bolderText.fill = c.tableFontColor
theme.colCell.text.fill = c.tableFontColor
theme.colCell.measureText.fill = c.tableFontColor
theme.colCell.bolderText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.colCell.text.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.colCell.measureText.fill = c.tableHeaderFontColor ? c.tableHeaderFontColor : c.tableFontColor
theme.dataCell.cell.backgroundColor = i_c
theme.dataCell.cell.horizontalBorderColor = b_c

View File

@ -45,6 +45,7 @@ export const TYPE_CONFIGS = [
'color-selector': [
'tableHeaderBgColor',
'tableItemBgColor',
'tableHeaderFontColor',
'tableFontColor',
'tableBorderColor',
'alpha'
@ -88,6 +89,7 @@ export const TYPE_CONFIGS = [
'color-selector': [
'tableHeaderBgColor',
'tableItemBgColor',
'tableHeaderFontColor',
'tableFontColor',
'tableBorderColor',
'alpha'
@ -134,6 +136,7 @@ export const TYPE_CONFIGS = [
'color-selector': [
'tableHeaderBgColor',
'tableItemBgColor',
'tableHeaderFontColor',
'tableFontColor',
'tableBorderColor',
'alpha'
@ -1463,6 +1466,7 @@ export const TYPE_CONFIGS = [
'color-selector': [
'tableHeaderBgColor',
'tableItemBgColor',
'tableHeaderFontColor',
'tableFontColor',
'alpha'
],
@ -1499,6 +1503,7 @@ export const TYPE_CONFIGS = [
'color-selector': [
'tableHeaderBgColor',
'tableItemBgColor',
'tableHeaderFontColor',
'tableFontColor',
'alpha'
],

View File

@ -259,6 +259,10 @@ export default {
resultFormat() {
if (!this.chart.data) return
const value = this.chart.data.series[0].data[0]
if (value === null || value === undefined) {
this.result = '-'
return
}
let yAxis = []
try {
yAxis = JSON.parse(this.chart.yaxis)

View File

@ -16,10 +16,14 @@
</el-col>
<el-col :span="8">
<span v-if="item.field === '0'" :title="$t('chart.field_fixed')">{{ $t('chart.field_fixed') }}</span>
<span v-if="item.field === '1'" :title="$t('chart.field_dynamic')">{{ $t('chart.field_dynamic') }}</span>
</el-col>
<el-col :span="8">
<el-col v-if="item.field === '0'" :span="8">
<span :title="item.value">{{ item.value }}</span>
</el-col>
<el-col v-if="item.field === '1'" :span="8">
<span :title="item.curField.name + '(' + $t('chart.' + item.summary) + ')'">{{ item.curField.name + '(' + $t('chart.' + item.summary) + ')' }}</span>
</el-col>
</el-row>
</el-col>
</el-col>
@ -34,7 +38,7 @@
width="70%"
class="dialog-css"
>
<assist-line-edit :line="assistLine" @onAssistLineChange="lineChange" />
<assist-line-edit :line="assistLine" :quota-fields="quotaData" @onAssistLineChange="lineChange" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeEditLine">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" @click="changeLine">{{ $t('chart.confirm') }}</el-button>
@ -52,13 +56,18 @@ export default {
chart: {
type: Object,
required: true
},
quotaData: {
type: Array,
required: true
}
},
data() {
return {
assistLine: [],
editLineDialog: false,
lineArr: []
lineArr: [],
quotaFields: []
}
},
watch: {
@ -114,21 +123,40 @@ export default {
})
return
}
if (!ele.value) {
this.$message({
message: this.$t('chart.value_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (parseFloat(ele.value).toString() === 'NaN') {
this.$message({
message: this.$t('chart.value_error'),
type: 'error',
showClose: true
})
return
if (ele.field === '0') {
if (!ele.value) {
this.$message({
message: this.$t('chart.value_can_not_empty'),
type: 'error',
showClose: true
})
return
}
if (parseFloat(ele.value).toString() === 'NaN') {
this.$message({
message: this.$t('chart.value_error'),
type: 'error',
showClose: true
})
return
}
} else {
if (!ele.fieldId || ele.fieldId === '') {
this.$message({
message: this.$t('chart.field_not_empty'),
type: 'error',
showClose: true
})
return
}
if (!ele.summary || ele.summary === '') {
this.$message({
message: this.$t('chart.summary_not_empty'),
type: 'error',
showClose: true
})
return
}
}
}
this.assistLine = JSON.parse(JSON.stringify(this.lineArr))

View File

@ -3,7 +3,7 @@
<el-button icon="el-icon-plus" circle size="mini" style="margin-bottom: 10px;" @click="addLine" />
<div style="max-height: 50vh;overflow-y: auto;">
<el-row v-for="(item,index) in lineArr" :key="index" class="line-item">
<el-col :span="6">
<el-col :span="4">
<el-input v-model="item.name" class="value-item" :placeholder="$t('chart.name')" size="mini" clearable @change="changeAssistLine" />
</el-col>
<el-col :span="4">
@ -16,9 +16,32 @@
/>
</el-select>
</el-col>
<el-col :span="6">
<el-col v-if="item.field === '0'" :span="8">
<el-input v-model="item.value" class="value-item" :placeholder="$t('chart.drag_block_label_value')" size="mini" clearable @change="changeAssistLine" />
</el-col>
<el-col v-if="item.field === '1'" :span="8">
<el-select v-model="item.fieldId" size="mini" class="select-item" :placeholder="$t('chart.field')" @change="changeAssistLineField(item)">
<el-option
v-for="quota in quotaData"
:key="quota.id"
:label="quota.name"
:value="quota.id"
>
<span style="float: left">
<svg-icon v-if="quota.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="quota.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="quota.deType === 2 || quota.deType === 3" icon-class="field_value" class="field-icon-value" />
<svg-icon v-if="quota.deType === 5" icon-class="field_location" class="field-icon-location" />
</span>
<span style="float: left; color: #8492a6; font-size: 12px">{{ quota.name }}</span>
</el-option>
</el-select>
<el-select v-model="item.summary" size="mini" class="select-item" :placeholder="$t('chart.aggregation')" @change="changeAssistLine">
<el-option v-if="item.curField && item.curField.id" key="avg" value="avg" :label="$t('chart.avg')" />
<el-option v-if="item.curField && item.curField.id" key="max" value="max" :label="$t('chart.max')" />
<el-option v-if="item.curField && item.curField.id" key="min" value="min" :label="$t('chart.min')" />
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="item.lineType" size="mini" class="select-item" @change="changeAssistLine">
<el-option
@ -49,6 +72,10 @@ export default {
line: {
type: Array,
required: true
},
quotaFields: {
type: Array,
required: true
}
},
data() {
@ -57,31 +84,49 @@ export default {
lineObj: {
name: '辅助线',
field: '0', //
fieldId: '',
summary: 'avg',
axis: 'y', //
value: '0',
lineType: 'solid',
color: '#ff0000'
color: '#ff0000',
curField: {}
},
fieldOptions: [
{ label: this.$t('chart.field_fixed'), value: '0' }
{ label: this.$t('chart.field_fixed'), value: '0' },
{ label: this.$t('chart.field_dynamic'), value: '1' }
],
lineOptions: [
{ label: this.$t('chart.line_type_solid'), value: 'solid' },
{ label: this.$t('chart.line_type_dashed'), value: 'dashed' },
{ label: this.$t('chart.line_type_dotted'), value: 'dotted' }
],
predefineColors: COLOR_PANEL
predefineColors: COLOR_PANEL,
quotaData: []
}
},
watch: {
'quotaFields': function() {
this.initField()
}
},
mounted() {
this.initField()
this.init()
},
methods: {
initField() {
this.quotaData = this.quotaFields.filter(ele => !ele.chartId && ele.id !== 'count')
},
init() {
this.lineArr = JSON.parse(JSON.stringify(this.line))
},
addLine() {
this.lineArr.push(JSON.parse(JSON.stringify(this.lineObj)))
const obj = { ...this.lineObj,
curField: this.quotaData ? this.quotaData[0] : null,
fieldId: this.quotaData ? this.quotaData[0].id : null
}
this.lineArr.push(JSON.parse(JSON.stringify(obj)))
this.changeAssistLine()
},
removeLine(index) {
@ -91,6 +136,23 @@ export default {
changeAssistLine() {
this.$emit('onAssistLineChange', this.lineArr)
},
changeAssistLineField(item) {
item.curField = this.getQuotaField(item.fieldId)
this.changeAssistLine()
},
getQuotaField(id) {
if (!id) {
return {}
}
const fields = this.quotaData.filter(ele => {
return ele.id === id
})
if (fields.length === 0) {
return {}
} else {
return fields[0]
}
}
}
}
@ -119,7 +181,7 @@ span {
.value-item {
position: relative;
display: inline-block;
width: 120px !important;
width: 100px !important;
}
.select-item {

View File

@ -94,6 +94,9 @@
<el-form-item v-show="showProperty('tableItemBgColor')" :label="$t('chart.table_item_bg')" class="form-item">
<el-color-picker v-model="colorForm.tableItemBgColor" class="color-picker-style" :predefine="predefineColors" @change="changeColorCase('tableItemBgColor')" />
</el-form-item>
<el-form-item v-show="showProperty('tableHeaderFontColor')" :label="$t('chart.table_header_font_color')" class="form-item">
<el-color-picker v-model="colorForm.tableHeaderFontColor" class="color-picker-style" :predefine="predefineColors" @change="changeColorCase('tableHeaderFontColor')" />
</el-form-item>
<el-form-item v-show="showProperty('tableFontColor')" :label="$t('chart.table_item_font_color')" class="form-item">
<el-color-picker v-model="colorForm.tableFontColor" class="color-picker-style" :predefine="predefineColors" @change="changeColorCase('tableFontColor')" />
</el-form-item>
@ -300,6 +303,7 @@ export default {
}
this.colorForm.tableBorderColor = this.colorForm.tableBorderColor ? this.colorForm.tableBorderColor : DEFAULT_COLOR_CASE.tableBorderColor
this.colorForm.tableHeaderFontColor = this.colorForm.tableHeaderFontColor ? this.colorForm.tableHeaderFontColor : this.colorForm.tableFontColor
this.initCustomColor()
}

View File

@ -200,12 +200,12 @@ export default {
datas = []
this.resetPage()
}
datas.forEach(item =>{
Object.keys(item).forEach(key=> {
if(typeof item[key] === 'object'){
item[key] = ""
}
})
datas.forEach(item => {
Object.keys(item).forEach(key => {
if (typeof item[key] === 'object') {
item[key] = ''
}
})
})
this.$refs.plxTable.reloadData(datas)
this.$nextTick(() => {
@ -257,7 +257,7 @@ export default {
if (this.chart.customAttr) {
const customAttr = JSON.parse(this.chart.customAttr)
if (customAttr.color) {
this.table_header_class.color = customAttr.color.tableFontColor
this.table_header_class.color = customAttr.color.tableHeaderFontColor ? customAttr.color.tableHeaderFontColor : customAttr.color.tableFontColor
this.table_header_class.background = hexColorToRGBA(customAttr.color.tableHeaderBgColor, customAttr.color.alpha)
this.table_item_class.color = customAttr.color.tableFontColor
this.table_item_class.background = hexColorToRGBA(customAttr.color.tableItemBgColor, customAttr.color.alpha)

View File

@ -803,6 +803,7 @@
:param="param"
class="attr-selector"
:chart="chart"
:quota-data="view.yaxis"
@onAssistLineChange="onAssistLineChange"
/>
</el-collapse-item>
@ -2029,7 +2030,7 @@ export default {
onAssistLineChange(val) {
this.view.senior.assistLine = val
this.calcStyle()
this.calcData()
},
onThresholdChange(val) {
@ -2294,6 +2295,8 @@ export default {
closeEditDsField() {
this.editDsField = false
this.initTableField(this.table.id)
//
this.calcData()
},
editChartField() {
@ -2751,6 +2754,8 @@ export default {
this.editChartCalcField = false
this.currEditField = {}
this.initTableField(this.table.id)
//
this.calcData()
},
deleteChartCalcField(item) {
this.$confirm(this.$t('dataset.confirm_delete'), this.$t('chart.tips'), {

View File

@ -6,7 +6,7 @@
<div class="login-container">
<el-row v-loading="loading" type="flex">
<el-col :span="12">
<div v-show="qrTypes.length" class="trans" @click="showQr">
<div v-show="qrTypes.length" :class="codeShow ? 'trans-pc' : 'trans'" @click="showQr">
<div v-show="imgAppShow" class="imgApp" />
</div>
<el-form v-show="!codeShow" ref="loginForm" :model="loginForm" :rules="loginRules" size="default">
@ -233,6 +233,24 @@ export default {
this.$error(msg)
}
this.clearOidcMsg()
if (Cookies.get('WecomError')) {
this.$error(Cookies.get('WecomError'))
this.switchCodeIndex(4)
}
this.clearWecomMsg()
if (Cookies.get('DingtalkError')) {
this.$error(Cookies.get('DingtalkError'))
this.switchCodeIndex(5)
}
this.clearDingtalkMsg()
if (Cookies.get('LarkError')) {
this.$error(Cookies.get('LarkError'))
this.switchCodeIndex(6)
}
this.clearLarkMsg()
},
methods: {
@ -254,6 +272,15 @@ export default {
Cookies.remove('OidcError')
Cookies.remove('IdToken')
},
clearWecomMsg() {
Cookies.remove('WecomError')
},
clearDingtalkMsg() {
Cookies.remove('DingtalkError')
},
clearLarkMsg() {
Cookies.remove('LarkError')
},
showLoginImage(uiInfo) {
this.uiInfo = getSysUI()
if (!this.uiInfo || Object.keys(this.uiInfo).length === 0) {
@ -287,6 +314,9 @@ export default {
handleLogin() {
this.initCache()
this.clearOidcMsg()
this.clearWecomMsg()
this.clearDingtalkMsg()
this.clearLarkMsg()
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
@ -483,7 +513,14 @@ export default {
width: 64px;
height: 64px;
background-image: url(../../assets/qrcode.png) ;
// background-color: var(--primary,#3370ff); // -- 线
cursor:pointer;
}
.trans-pc {
margin-left: calc(100% - 64px);
top: 0;
width: 64px;
height: 64px;
background: var(--primary,#3370ff) url(../../assets/xianshiqi-2.png) no-repeat top right/40px;
cursor:pointer;
}
.imgApp {
@ -495,7 +532,6 @@ export default {
width: 100%;
height: 100%; //
text-align: center;
padding-top: 70px;
img {
width: 150px;
height: 150px;

View File

@ -67,6 +67,9 @@
<el-form-item :label="$t('chart.table_item_bg')" class="form-item">
<el-color-picker v-model="colorForm.tableItemBgColor" class="color-picker-style" :predefine="predefineColors" @change="changeColorCase('tableItemBgColor')" />
</el-form-item>
<el-form-item :label="$t('chart.table_header_font_color')" class="form-item">
<el-color-picker v-model="colorForm.tableHeaderFontColor" class="color-picker-style" :predefine="predefineColors" @change="changeColorCase('tableHeaderFontColor')" />
</el-form-item>
<el-form-item :label="$t('chart.table_item_font_color')" class="form-item">
<el-color-picker v-model="colorForm.tableFontColor" class="color-picker-style" :predefine="predefineColors" @change="changeColorCase('tableFontColor')" />
</el-form-item>
@ -82,7 +85,7 @@
<script>
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import { mapState } from 'vuex'
import bus from "@/utils/bus";
import bus from '@/utils/bus'
export default {
name: 'ColorSelector',
@ -183,16 +186,17 @@ export default {
]),
created() {
this.initForm()
bus.$on('onThemeColorChange',this.initForm)
bus.$on('onThemeColorChange', this.initForm)
},
beforeDestroy() {
bus.$off('onThemeColorChange',this.initForm)
bus.$off('onThemeColorChange', this.initForm)
},
mounted() {
},
methods: {
initForm() {
this.colorForm = this.canvasStyleData.chartInfo.chartColor
this.colorForm.tableHeaderFontColor = this.colorForm.tableHeaderFontColor ? this.colorForm.tableHeaderFontColor : this.colorForm.tableFontColor
},
changeColorOption(modifyName = 'value') {
const that = this

View File

@ -31,6 +31,22 @@
slot="append">{{ $t('components.day') }}</template></el-input>
</el-form-item>
<el-form-item :label="$t('system_parameter_setting.ds_check_time')" >
<el-form :inline="true" :disabled="show">
<el-form-item >
<el-input v-model="formInline.dsCheckInterval" type="number" min="1" @change="onSimpleCronChange()" />
</el-form-item>
<el-form-item class="form-item">
<el-select v-model="formInline.dsCheckIntervalType" filterable size="mini" @change="onSimpleCronChange()">
<el-option :label="$t('cron.minute_default')" value="minute" />
<el-option :label="$t('cron.hour_default')" value="hour" />
</el-select>
</el-form-item>
<el-form-item class="form-item" :label="$t('cron.every_exec')" />
</el-form>
</el-form-item>
<el-form-item v-if="loginTypes.length > 1" :label="$t('system_parameter_setting.login_type')" prop="loginType">
<el-radio-group v-model="formInline.loginType">
<el-radio :label="0" size="mini">{{
@ -175,6 +191,18 @@ export default {
type: "text",
sort: 3,
},
{
paramKey: "basic.dsCheckInterval",
paramValue: this.formInline.dsCheckInterval,
type: "text",
sort: 4,
},
{
paramKey: "basic.dsCheckIntervalType",
paramValue: this.formInline.dsCheckIntervalType,
type: "text",
sort: 5,
},
{
paramKey: "ui.openHomePage",
paramValue: this.formInline.openHomePage,
@ -234,7 +262,7 @@ export default {
window.location.reload();
} else {
this.openMessageSuccess("commons.save_failed", 'error');
}
}
});
},
cancel() {
@ -244,6 +272,29 @@ export default {
this.show = true;
this.query();
},
onSimpleCronChange() {
if (this.formInline.dsCheckIntervalType === 'minute') {
if (this.formInline.dsCheckInterval < 1 || this.formInline.dsCheckInterval > 59) {
this.$message({ message: this.$t('cron.minute_limit'), type: 'warning', showClose: true })
this.taskForm.extraData.simple_cron_value = 59
}
return
}
if (this.formInline.dsCheckIntervalType === 'hour') {
if (this.formInline.dsCheckInterval < 1 || this.formInline.dsCheckInterval > 23) {
this.$message({ message: this.$t('cron.hour_limit'), type: 'warning', showClose: true })
this.taskForm.extraData.simple_cron_value = 23
}
return
}
if (this.formInline.dsCheckIntervalType === 'day') {
if (this.formInline.dsCheckInterval < 1 || this.formInline.dsCheckInterval > 31) {
this.$message({ message: this.$t('cron.day_limit'), type: 'warning', showClose: true })
this.taskForm.extraData.simple_cron_value = 31
}
return
}
},
},
};
</script>
@ -273,4 +324,4 @@ export default {
margin-left: 2px;
}
}
</style>
</style>