mirror of
https://github.com/dataease/dataease.git
synced 2025-03-01 16:13:09 +08:00
commit
e6bb228196
@ -50,6 +50,7 @@ public class ShiroConfig {
|
||||
filterMap.put("f2cPerms", new F2CPermissionsFilter());
|
||||
filterMap.put("jwt", new JWTFilter());
|
||||
filterMap.put("logout", new F2CLogoutFilter());
|
||||
filterMap.put("link", new F2CLinkFilter());
|
||||
factoryBean.setSecurityManager(securityManager);
|
||||
factoryBean.setLoginUrl("/login");
|
||||
factoryBean.setUnauthorizedUrl("/login");
|
||||
|
@ -0,0 +1,51 @@
|
||||
package io.dataease.auth.filter;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.interfaces.Claim;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import io.dataease.auth.config.RsaProperties;
|
||||
import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.auth.util.LinkUtil;
|
||||
import io.dataease.auth.util.RsaUtil;
|
||||
import io.dataease.base.domain.PanelLink;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.web.filter.authc.AnonymousFilter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class F2CLinkFilter extends AnonymousFilter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(F2CLogoutFilter.class);
|
||||
|
||||
private static final String LINK_TOKEN_KEY = "LINK-PWD-TOKEN";
|
||||
|
||||
@Override
|
||||
protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) {
|
||||
try{
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
String link_token = req.getHeader(LINK_TOKEN_KEY);
|
||||
DecodedJWT jwt = JWT.decode(link_token);
|
||||
Claim resourceId = jwt.getClaim("resourceId");
|
||||
String id = resourceId.asString();
|
||||
PanelLink panelLink = LinkUtil.queryLink(id);
|
||||
if (ObjectUtil.isEmpty(panelLink)) return false;
|
||||
if (!panelLink.getEnablePwd()) {
|
||||
panelLink.setPwd("dataease");
|
||||
}
|
||||
return JWTUtils.verifyLink(link_token, id, RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, panelLink.getPwd()));
|
||||
}catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -41,8 +41,7 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
|
||||
//验证链接
|
||||
filterChainDefinitionMap.put("/api/link/validate**", ANON);
|
||||
filterChainDefinitionMap.put("/panel/group/findOne/**", ANON);
|
||||
filterChainDefinitionMap.put("/chart/view/getData/**", ANON);
|
||||
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/system/ui/**", ANON);
|
||||
@ -59,9 +58,16 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/tokenExpired", ANON);
|
||||
filterChainDefinitionMap.put("/downline", ANON);
|
||||
filterChainDefinitionMap.put("/common-files/**", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/api/auth/logout", "logout");
|
||||
|
||||
filterChainDefinitionMap.put("/api/link/resourceDetail/**", "link");
|
||||
filterChainDefinitionMap.put("/api/link/viewDetail/**", "link");
|
||||
|
||||
filterChainDefinitionMap.put("/**", "authc");
|
||||
|
||||
filterChainDefinitionMap.put("/**", "jwt");
|
||||
|
||||
return filterChainDefinitionMap;
|
||||
}
|
||||
|
||||
|
22
backend/src/main/java/io/dataease/auth/util/LinkUtil.java
Normal file
22
backend/src/main/java/io/dataease/auth/util/LinkUtil.java
Normal file
@ -0,0 +1,22 @@
|
||||
package io.dataease.auth.util;
|
||||
|
||||
import io.dataease.base.domain.PanelLink;
|
||||
import io.dataease.service.panel.PanelLinkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LinkUtil {
|
||||
|
||||
|
||||
private static PanelLinkService panelLinkService;
|
||||
|
||||
@Autowired
|
||||
public void setPanelLinkService(PanelLinkService panelLinkService) {
|
||||
LinkUtil.panelLinkService = panelLinkService;
|
||||
}
|
||||
|
||||
public static PanelLink queryLink(String resourceId) {
|
||||
return panelLinkService.findOne(resourceId);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DatasetTableFunction implements Serializable {
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String func;
|
||||
|
||||
private String dbType;
|
||||
|
||||
private Integer funcType;
|
||||
|
||||
private String desc;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,530 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetTableFunctionExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public DatasetTableFunctionExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Long value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Long value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Long value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Long value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNull() {
|
||||
addCriterion("`name` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("`name` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("`name` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("`name` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("`name` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`name` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("`name` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("`name` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("`name` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("`name` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("`name` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("`name` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("`name` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("`name` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncIsNull() {
|
||||
addCriterion("func is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncIsNotNull() {
|
||||
addCriterion("func is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncEqualTo(String value) {
|
||||
addCriterion("func =", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotEqualTo(String value) {
|
||||
addCriterion("func <>", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncGreaterThan(String value) {
|
||||
addCriterion("func >", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("func >=", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncLessThan(String value) {
|
||||
addCriterion("func <", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncLessThanOrEqualTo(String value) {
|
||||
addCriterion("func <=", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncLike(String value) {
|
||||
addCriterion("func like", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotLike(String value) {
|
||||
addCriterion("func not like", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncIn(List<String> values) {
|
||||
addCriterion("func in", values, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotIn(List<String> values) {
|
||||
addCriterion("func not in", values, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncBetween(String value1, String value2) {
|
||||
addCriterion("func between", value1, value2, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotBetween(String value1, String value2) {
|
||||
addCriterion("func not between", value1, value2, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeIsNull() {
|
||||
addCriterion("db_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeIsNotNull() {
|
||||
addCriterion("db_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeEqualTo(String value) {
|
||||
addCriterion("db_type =", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotEqualTo(String value) {
|
||||
addCriterion("db_type <>", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeGreaterThan(String value) {
|
||||
addCriterion("db_type >", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("db_type >=", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeLessThan(String value) {
|
||||
addCriterion("db_type <", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("db_type <=", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeLike(String value) {
|
||||
addCriterion("db_type like", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotLike(String value) {
|
||||
addCriterion("db_type not like", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeIn(List<String> values) {
|
||||
addCriterion("db_type in", values, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotIn(List<String> values) {
|
||||
addCriterion("db_type not in", values, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeBetween(String value1, String value2) {
|
||||
addCriterion("db_type between", value1, value2, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("db_type not between", value1, value2, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeIsNull() {
|
||||
addCriterion("func_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeIsNotNull() {
|
||||
addCriterion("func_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeEqualTo(Integer value) {
|
||||
addCriterion("func_type =", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeNotEqualTo(Integer value) {
|
||||
addCriterion("func_type <>", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeGreaterThan(Integer value) {
|
||||
addCriterion("func_type >", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("func_type >=", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeLessThan(Integer value) {
|
||||
addCriterion("func_type <", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("func_type <=", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeIn(List<Integer> values) {
|
||||
addCriterion("func_type in", values, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeNotIn(List<Integer> values) {
|
||||
addCriterion("func_type not in", values, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeBetween(Integer value1, Integer value2) {
|
||||
addCriterion("func_type between", value1, value2, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("func_type not between", value1, value2, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package io.dataease.base.mapper;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableFunction;
|
||||
import io.dataease.base.domain.DatasetTableFunctionExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface DatasetTableFunctionMapper {
|
||||
long countByExample(DatasetTableFunctionExample example);
|
||||
|
||||
int deleteByExample(DatasetTableFunctionExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(DatasetTableFunction record);
|
||||
|
||||
int insertSelective(DatasetTableFunction record);
|
||||
|
||||
List<DatasetTableFunction> selectByExampleWithBLOBs(DatasetTableFunctionExample example);
|
||||
|
||||
List<DatasetTableFunction> selectByExample(DatasetTableFunctionExample example);
|
||||
|
||||
DatasetTableFunction selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") DatasetTableFunction record, @Param("example") DatasetTableFunctionExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") DatasetTableFunction record, @Param("example") DatasetTableFunctionExample example);
|
||||
|
||||
int updateByExample(@Param("record") DatasetTableFunction record, @Param("example") DatasetTableFunctionExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(DatasetTableFunction record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(DatasetTableFunction record);
|
||||
|
||||
int updateByPrimaryKey(DatasetTableFunction record);
|
||||
}
|
@ -0,0 +1,270 @@
|
||||
<?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.base.mapper.DatasetTableFunctionMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.DatasetTableFunction">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="func" jdbcType="VARCHAR" property="func" />
|
||||
<result column="db_type" jdbcType="VARCHAR" property="dbType" />
|
||||
<result column="func_type" jdbcType="INTEGER" property="funcType" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.DatasetTableFunction">
|
||||
<result column="desc" jdbcType="LONGVARCHAR" property="desc" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, func, db_type, func_type
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
`desc`
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.DatasetTableFunctionExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from dataset_table_function
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.DatasetTableFunctionExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from dataset_table_function
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from dataset_table_function
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from dataset_table_function
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.DatasetTableFunctionExample">
|
||||
delete from dataset_table_function
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.DatasetTableFunction">
|
||||
insert into dataset_table_function (id, `name`, func,
|
||||
db_type, func_type, `desc`
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{func,jdbcType=VARCHAR},
|
||||
#{dbType,jdbcType=VARCHAR}, #{funcType,jdbcType=INTEGER}, #{desc,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTableFunction">
|
||||
insert into dataset_table_function
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="func != null">
|
||||
func,
|
||||
</if>
|
||||
<if test="dbType != null">
|
||||
db_type,
|
||||
</if>
|
||||
<if test="funcType != null">
|
||||
func_type,
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
`desc`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="func != null">
|
||||
#{func,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dbType != null">
|
||||
#{dbType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="funcType != null">
|
||||
#{funcType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
#{desc,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.DatasetTableFunctionExample" resultType="java.lang.Long">
|
||||
select count(*) from dataset_table_function
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update dataset_table_function
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.func != null">
|
||||
func = #{record.func,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.dbType != null">
|
||||
db_type = #{record.dbType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.funcType != null">
|
||||
func_type = #{record.funcType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.desc != null">
|
||||
`desc` = #{record.desc,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update dataset_table_function
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
func = #{record.func,jdbcType=VARCHAR},
|
||||
db_type = #{record.dbType,jdbcType=VARCHAR},
|
||||
func_type = #{record.funcType,jdbcType=INTEGER},
|
||||
`desc` = #{record.desc,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update dataset_table_function
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
func = #{record.func,jdbcType=VARCHAR},
|
||||
db_type = #{record.dbType,jdbcType=VARCHAR},
|
||||
func_type = #{record.funcType,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.DatasetTableFunction">
|
||||
update dataset_table_function
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="func != null">
|
||||
func = #{func,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dbType != null">
|
||||
db_type = #{dbType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="funcType != null">
|
||||
func_type = #{funcType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
`desc` = #{desc,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.DatasetTableFunction">
|
||||
update dataset_table_function
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
func = #{func,jdbcType=VARCHAR},
|
||||
db_type = #{dbType,jdbcType=VARCHAR},
|
||||
func_type = #{funcType,jdbcType=INTEGER},
|
||||
`desc` = #{desc,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.DatasetTableFunction">
|
||||
update dataset_table_function
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
func = #{func,jdbcType=VARCHAR},
|
||||
db_type = #{dbType,jdbcType=VARCHAR},
|
||||
func_type = #{funcType,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
@ -10,12 +10,13 @@
|
||||
|
||||
<resultMap id="TaskResult" type="io.dataease.dto.dataset.DataSetTaskDTO" extends="io.dataease.base.mapper.DatasetTableTaskMapper.BaseResultMap">
|
||||
<result column="table_name" jdbcType="VARCHAR" property="datasetName"/>
|
||||
<result column="privileges" jdbcType="VARCHAR" property="privileges"/>
|
||||
<result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextExecTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="list" resultMap="BaseResult" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
|
||||
SELECT dataset_table_task_log.*, dataset_table_task.name, dataset_table.name as dataset_name
|
||||
FROM dataset_table_task_log
|
||||
FROM (select GET_V_AUTH_MODEL_WITH_PRIVILEGE (#{extendCondition}, 'dataset',1) cids) t, dataset_table_task_log
|
||||
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
|
||||
LEFT JOIN dataset_table ON dataset_table_task_log.table_id = dataset_table.id
|
||||
<if test="_parameter != null">
|
||||
@ -30,8 +31,8 @@
|
||||
</select>
|
||||
|
||||
<select id="taskList" resultMap="TaskResult" parameterType="io.dataease.base.mapper.ext.query.GridExample">
|
||||
SELECT dataset_table.name as table_name, dataset_table_task.* , qrtz_triggers.*
|
||||
FROM dataset_table_task
|
||||
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
|
||||
FROM (select GET_V_AUTH_MODEL_WITH_PRIVILEGE (#{extendCondition}, 'dataset', 1) cids) t, dataset_table_task
|
||||
left join dataset_table on dataset_table.id=dataset_table_task.table_id
|
||||
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
|
||||
<if test="_parameter != null">
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.base.domain.PanelView;
|
||||
import io.dataease.dto.panel.PanelViewDto;
|
||||
import io.dataease.dto.panel.po.PanelViewInsertDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -7,9 +7,9 @@
|
||||
</delete>
|
||||
|
||||
<insert id="savePluginMenu">
|
||||
INSERT INTO `plugin_sys_menu` ( menu_id, title, pid, sub_count, permission, hidden ) VALUES
|
||||
INSERT INTO `plugin_sys_menu` ( menu_id, title, pid, sub_count, permission, hidden,i_frame ) VALUES
|
||||
<foreach collection="menuList" item="menu" index="index" separator=",">
|
||||
(#{menu.menuId},#{menu.title},#{menu.pid},#{menu.subCount},#{menu.permission},#{menu.hidden})
|
||||
(#{menu.menuId},#{menu.title},#{menu.pid},#{menu.subCount},#{menu.permission},#{menu.hidden},ifnull(#{menu.hidden},0))
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
@ -2,7 +2,6 @@ package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.base.domain.SysMsgExample;
|
||||
import io.dataease.base.domain.SysMsgSetting;
|
||||
import io.dataease.controller.message.dto.BatchSettingRequest;
|
||||
import io.dataease.controller.message.dto.MsgGridDto;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
@ -171,6 +171,9 @@ public class GridExample {
|
||||
case "not null":
|
||||
addNotNullCriterion(field + " is not null ");
|
||||
break;
|
||||
case "extra":
|
||||
addCriterion(field);
|
||||
break;
|
||||
}
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
@ -4,9 +4,7 @@ import io.dataease.datasource.dto.TableFiled;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExcelReaderUtil {
|
||||
//excel2003扩展名
|
||||
|
@ -1,19 +1,16 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.datasource.dto.TableFiled;
|
||||
import io.dataease.dto.dataset.ExcelSheetData;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.poi.hssf.eventusermodel.*;
|
||||
import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord;
|
||||
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord;
|
||||
import org.apache.poi.hssf.model.HSSFFormulaParser;
|
||||
import org.apache.poi.hssf.record.*;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDataFormatter;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -1,13 +1,9 @@
|
||||
package io.dataease.commons.utils;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.datasource.dto.TableFiled;
|
||||
import io.dataease.dto.dataset.ExcelSheetData;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.service.message.MsgAop;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.xssf.eventusermodel.XSSFReader;
|
||||
import org.apache.poi.xssf.model.SharedStringsTable;
|
||||
@ -254,13 +250,16 @@ public class ExcelXlsxReader extends DefaultHandler {
|
||||
preRef = ref;
|
||||
}
|
||||
//补全单元格之间的空单元格
|
||||
if (!ref.equals(preRef)) {
|
||||
if (!"A".equals(preRef.substring(0, 1)) && curRow==1 && preRef.equalsIgnoreCase(ref)) {
|
||||
throw new RuntimeException(Translator.get("i18n_excel_empty_column"));
|
||||
}else if (!ref.equals(preRef)) {
|
||||
int len = countNullCell(ref, preRef);
|
||||
for (int i = 0; i < len; i++) {
|
||||
cellList.add(curCol, "");
|
||||
curCol++;
|
||||
}
|
||||
}
|
||||
|
||||
cellList.add(curCol, value);
|
||||
curCol++;
|
||||
//如果里面某个单元格含有值,则标识该行不为空行
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.controller.chart;
|
||||
|
||||
import io.dataease.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.chart.ChartViewRequest;
|
||||
import io.dataease.dto.chart.ChartViewDTO;
|
||||
@ -65,4 +66,15 @@ public class ChartViewController {
|
||||
public String searchAdviceSceneId(@PathVariable String panelId){
|
||||
return chartViewService.searchAdviceSceneId(panelId);
|
||||
}
|
||||
|
||||
@PostMapping("/getOneWithPermission/{id}")
|
||||
public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception {
|
||||
//如果能获取用户 则添加对应的权限
|
||||
ChartViewDTO dto = chartViewService.getData(id, requestList);
|
||||
if(dto!=null && AuthUtils.getUser()!=null){
|
||||
ChartViewDTO permissionDto = chartViewService.getOneWithPermission(dto.getId());
|
||||
dto.setPrivileges(permissionDto.getPrivileges());
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,16 @@ public class DataSetTableFieldController {
|
||||
dataSetTableFieldsService.batchEdit(list);
|
||||
}
|
||||
|
||||
@PostMapping("save")
|
||||
public DatasetTableField save(@RequestBody DatasetTableField datasetTableField) {
|
||||
return dataSetTableFieldsService.save(datasetTableField);
|
||||
}
|
||||
|
||||
@PostMapping("delete/{id}")
|
||||
public void delete(@PathVariable String id) {
|
||||
dataSetTableFieldsService.delete(id);
|
||||
}
|
||||
|
||||
@PostMapping("fieldValues/{fieldId}")
|
||||
public List<Object> fieldValues(@PathVariable String fieldId) {
|
||||
return dataSetFieldService.fieldValues(fieldId);
|
||||
|
@ -0,0 +1,27 @@
|
||||
package io.dataease.controller.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableFunction;
|
||||
import io.dataease.service.dataset.DatasetFunctionService;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/7/29 11:58 上午
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("dataset/function")
|
||||
public class DatasetFunctionController {
|
||||
@Resource
|
||||
private DatasetFunctionService datasetFunctionService;
|
||||
|
||||
@PostMapping("listByTableId/{tableId}")
|
||||
public List<DatasetTableFunction> listByTableId(@PathVariable String tableId) {
|
||||
return datasetFunctionService.listByTableId(tableId);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.controller.panel.api;
|
||||
|
||||
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.panel.link.EnablePwdRequest;
|
||||
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||
@ -40,4 +41,12 @@ public interface LinkApi {
|
||||
@ApiOperation("验证密码")
|
||||
@PostMapping("/validatePwd")
|
||||
boolean validatePwd(PasswordRequest request) throws Exception;
|
||||
|
||||
@ApiOperation("资源详息")
|
||||
@PostMapping("/resourceDetail/{resourceId}")
|
||||
Object resourceDetail(@PathVariable String resourceId);
|
||||
|
||||
@ApiOperation("视图详息")
|
||||
@PostMapping("/viewDetail/{viewId}")
|
||||
Object viewDetail(@PathVariable String viewId, @RequestBody ChartExtRequest requestList) throws Exception;
|
||||
}
|
||||
|
@ -4,18 +4,22 @@ package io.dataease.controller.panel.server;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.PanelLink;
|
||||
import io.dataease.controller.panel.api.LinkApi;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.panel.link.EnablePwdRequest;
|
||||
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||
import io.dataease.controller.request.panel.link.ValidateRequest;
|
||||
import io.dataease.dto.panel.link.GenerateDto;
|
||||
import io.dataease.dto.panel.link.ValidateDto;
|
||||
import io.dataease.service.chart.ChartViewService;
|
||||
import io.dataease.service.panel.PanelLinkService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -27,6 +31,9 @@ public class LinkServer implements LinkApi {
|
||||
@Autowired
|
||||
private PanelLinkService panelLinkService;
|
||||
|
||||
@Resource
|
||||
private ChartViewService chartViewService;
|
||||
|
||||
|
||||
@Override
|
||||
public void replacePwd(@RequestBody PasswordRequest request) {
|
||||
@ -73,4 +80,14 @@ public class LinkServer implements LinkApi {
|
||||
public boolean validatePwd(@RequestBody PasswordRequest request) throws Exception {
|
||||
return panelLinkService.validatePwd(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resourceDetail(@PathVariable String resourceId) {
|
||||
return panelLinkService.resourceInfo(resourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object viewDetail(String viewId, ChartExtRequest requestList) throws Exception{
|
||||
return chartViewService.getData(viewId, requestList);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.dataease.dto.chart;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.dataease.dto.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import io.dataease.base.domain.DatasetTableTaskLog;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -16,4 +15,5 @@ public class DataSetTaskDTO extends DatasetTableTask {
|
||||
private Long nextExecTime;
|
||||
private String taskStatus;
|
||||
private String msg;
|
||||
private String privileges;
|
||||
}
|
||||
|
@ -20,17 +20,17 @@ public abstract class QueryProvider {
|
||||
|
||||
public abstract String createSQLPreview(String sql, String orderBy);
|
||||
|
||||
public abstract String createQuerySQL(String table, List<DatasetTableField> fields);
|
||||
public abstract String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup);
|
||||
|
||||
public abstract String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields);
|
||||
public abstract String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields, boolean isGroup);
|
||||
|
||||
public abstract String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize);
|
||||
public abstract String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup);
|
||||
|
||||
public abstract String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit);
|
||||
public abstract String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit, boolean isGroup);
|
||||
|
||||
public abstract String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit);
|
||||
public abstract String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit, boolean isGroup);
|
||||
|
||||
public abstract String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize);
|
||||
public abstract String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup);
|
||||
|
||||
public abstract String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList);
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields) {
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(DorisConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -129,7 +129,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
ST st_sql = stg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", isGroup);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
if ((fields.size() > 0)) {
|
||||
@ -144,28 +145,28 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
|
||||
return createQuerySQL("(" + sql + ")", fields);
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields, boolean isGroup) {
|
||||
return createQuerySQL("(" + sql + ")", fields, isGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQL(table, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup) {
|
||||
return createQuerySQL(table, fields, isGroup) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit) {
|
||||
return createQuerySQL(table, fields) + " LIMIT 0," + limit;
|
||||
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
|
||||
return createQuerySQL(table, fields, isGroup) + " LIMIT 0," + limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit) {
|
||||
return createQuerySQLAsTmp(sql, fields) + " LIMIT 0," + limit;
|
||||
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
|
||||
return createQuerySQLAsTmp(sql, fields, isGroup) + " LIMIT 0," + limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQLAsTmp(sql, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup) {
|
||||
return createQuerySQLAsTmp(sql, fields, isGroup) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -185,7 +186,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -283,7 +284,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
|
@ -80,7 +80,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields) {
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -127,35 +127,36 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
ST st_sql = stg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", isGroup);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
return st_sql.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
|
||||
return createQuerySQL("(" + sqlFix(sql) + ")", fields);
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields, boolean isGroup) {
|
||||
return createQuerySQL("(" + sqlFix(sql) + ")", fields, isGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQL(table, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup) {
|
||||
return createQuerySQL(table, fields, isGroup) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit) {
|
||||
return createQuerySQL(table, fields) + " LIMIT 0," + limit;
|
||||
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
|
||||
return createQuerySQL(table, fields, isGroup) + " LIMIT 0," + limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit) {
|
||||
return createQuerySQLAsTmp(sql, fields) + " LIMIT 0," + limit;
|
||||
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
|
||||
return createQuerySQLAsTmp(sql, fields, isGroup) + " LIMIT 0," + limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQLAsTmp(sql, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup) {
|
||||
return createQuerySQLAsTmp(sql, fields, isGroup) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -175,7 +176,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -274,7 +275,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
|
@ -93,7 +93,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields) {
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields, boolean isGroup) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(OracleConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(OracleConstants.ALIAS_FIX, String.format(TABLE_ALIAS_PREFIX, 0)))
|
||||
@ -101,7 +101,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
List<SQLObj> xFields = xFields(table, fields);
|
||||
|
||||
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
ST st_sql = stg.getInstanceOf("previewSql");
|
||||
st_sql.add("isGroup", isGroup);
|
||||
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
return st_sql.render();
|
||||
@ -164,33 +165,33 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
|
||||
return createQuerySQL("(" + sqlFix(sql) + ")", fields);
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields, boolean isGroup) {
|
||||
return createQuerySQL("(" + sqlFix(sql) + ")", fields, isGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup) {
|
||||
List<SQLObj> xFields = xFields(table, fields);
|
||||
|
||||
return MessageFormat.format("SELECT {0} FROM ( SELECT DE_TMP.*, rownum r FROM ( {1} ) DE_TMP WHERE rownum <= {2} ) WHERE r > {3} ",
|
||||
sqlColumn(xFields), createQuerySQL(table, fields), Integer.valueOf(page * realSize).toString(), Integer.valueOf((page - 1) * pageSize).toString());
|
||||
sqlColumn(xFields), createQuerySQL(table, fields, isGroup), Integer.valueOf(page * realSize).toString(), Integer.valueOf((page - 1) * pageSize).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit) {
|
||||
public String createQueryTableWithLimit(String table, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
|
||||
return String.format("SELECT %s.* from %s WHERE rownum <= %s ", table, table, limit.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit) {
|
||||
public String createQuerySqlWithLimit(String sql, List<DatasetTableField> fields, Integer limit, boolean isGroup) {
|
||||
return String.format("SELECT * from %s WHERE rownum <= %s ", "(" + sqlFix(sql) + ")", limit.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize, boolean isGroup) {
|
||||
List<SQLObj> xFields = xFields("(" + sqlFix(sql) + ")", fields);
|
||||
return MessageFormat.format("SELECT {0} FROM ( SELECT DE_TMP.*, rownum r FROM ( {1} ) DE_TMP WHERE rownum <= {2} ) WHERE r > {3} ",
|
||||
sqlColumn(xFields), createQuerySQLAsTmp(sql, fields), Integer.valueOf(page * realSize).toString(), Integer.valueOf((page - 1) * pageSize).toString());
|
||||
sqlColumn(xFields), createQuerySQLAsTmp(sql, fields, isGroup), Integer.valueOf(page * realSize).toString(), Integer.valueOf((page - 1) * pageSize).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -210,7 +211,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -308,7 +309,7 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@ package io.dataease.service.dataset;
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.base.domain.DatasetTableFieldExample;
|
||||
import io.dataease.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.commons.utils.DorisTableUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -32,6 +33,13 @@ public class DataSetTableFieldsService {
|
||||
public DatasetTableField save(DatasetTableField datasetTableField) {
|
||||
if (StringUtils.isEmpty(datasetTableField.getId())) {
|
||||
datasetTableField.setId(UUID.randomUUID().toString());
|
||||
// 若dataeasename为空,则用MD5(id)作为dataeasename
|
||||
if (StringUtils.isEmpty(datasetTableField.getDataeaseName())) {
|
||||
datasetTableField.setDataeaseName(DorisTableUtils.dorisFieldName(datasetTableField.getId()));
|
||||
}
|
||||
if (ObjectUtils.isEmpty(datasetTableField.getLastSyncTime())) {
|
||||
datasetTableField.setLastSyncTime(System.currentTimeMillis());
|
||||
}
|
||||
datasetTableFieldMapper.insert(datasetTableField);
|
||||
} else {
|
||||
datasetTableFieldMapper.updateByPrimaryKeySelective(datasetTableField);
|
||||
@ -86,4 +94,8 @@ public class DataSetTableFieldsService {
|
||||
public DatasetTableField get(String id) {
|
||||
return datasetTableFieldMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
datasetTableFieldMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
}
|
||||
|
@ -329,14 +329,15 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = dataTableInfoDTO.getTable();
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -352,14 +353,15 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -378,14 +380,15 @@ public class DataSetTableService {
|
||||
|
||||
String sql = dataTableInfoDTO.getSql();
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -401,14 +404,15 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -425,14 +429,15 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -452,14 +457,15 @@ public class DataSetTableService {
|
||||
|
||||
String sql = getCustomSQLDatasource(dt, list, ds);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQuerySqlWithLimit(sql, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(datasourceProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -471,7 +477,8 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize, false));
|
||||
map.put("sql", datasourceRequest.getQuery());
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
@ -479,7 +486,7 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow())));
|
||||
datasourceRequest.setQuery(qp.createQueryTableWithLimit(table, fields, Integer.valueOf(dataSetTableRequest.getRow()), false));
|
||||
dataSetPreviewPage.setTotal(jdbcProvider.getData(datasourceRequest).size());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -5,6 +5,7 @@ import io.dataease.base.domain.DatasetTableTaskLogExample;
|
||||
import io.dataease.base.mapper.DatasetTableTaskLogMapper;
|
||||
import io.dataease.base.mapper.ext.ExtDataSetTaskMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.dto.dataset.DataSetTaskDTO;
|
||||
@ -56,10 +57,17 @@ public class DataSetTableTaskLogService {
|
||||
conditionEntities = new ArrayList<>();
|
||||
}
|
||||
conditionEntities.add(entity);
|
||||
|
||||
ConditionEntity entity2 = new ConditionEntity();
|
||||
entity2.setOperator("extra");
|
||||
entity2.setField(" FIND_IN_SET(dataset_table_task_log.table_id,cids) ");
|
||||
conditionEntities.add(entity2);
|
||||
|
||||
request.setConditions(conditionEntities);
|
||||
}
|
||||
|
||||
GridExample gridExample = request.convertExample();
|
||||
gridExample.setExtendCondition(AuthUtils.getUser().getUserId().toString());
|
||||
List<DataSetTaskLogDTO> dataSetTaskLogDTOS = extDataSetTaskMapper.list(gridExample);
|
||||
dataSetTaskLogDTOS.forEach(dataSetTaskLogDTO -> {
|
||||
if(StringUtils.isEmpty(dataSetTaskLogDTO.getName())){
|
||||
|
@ -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;
|
||||
@ -11,11 +10,10 @@ import io.dataease.commons.constants.JobStatus;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.commons.constants.TaskStatus;
|
||||
import io.dataease.commons.constants.TriggerType;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.request.dataset.DataSetTaskRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.controller.sys.response.SysUserGridResponse;
|
||||
import io.dataease.controller.sys.response.SysUserRole;
|
||||
import io.dataease.dto.dataset.DataSetTaskDTO;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.i18n.Translator;
|
||||
@ -29,10 +27,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
@ -121,7 +119,8 @@ public class DataSetTableTaskService {
|
||||
example.or(example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusIsNull());
|
||||
Boolean existSyncTask = datasetTableMapper.updateByExampleSelective(datasetTable, example) == 0;
|
||||
if(!existSyncTask){
|
||||
datasetTableTask.setLastExecTime(System.currentTimeMillis());
|
||||
Long startTime = System.currentTimeMillis();
|
||||
datasetTableTask.setLastExecTime(startTime);
|
||||
datasetTableTask.setLastExecStatus(JobStatus.Underway.name());
|
||||
datasetTableTask.setStatus(TaskStatus.Exec.name());
|
||||
update(datasetTableTask);
|
||||
@ -129,7 +128,7 @@ public class DataSetTableTaskService {
|
||||
datasetTableTaskLog.setTableId(datasetTableTask.getTableId());
|
||||
datasetTableTaskLog.setTaskId(datasetTableTask.getId());
|
||||
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
|
||||
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
|
||||
datasetTableTaskLog.setStartTime(startTime);
|
||||
datasetTableTaskLog.setTriggerType(TriggerType.Custom.name());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
}
|
||||
@ -216,7 +215,14 @@ public class DataSetTableTaskService {
|
||||
}
|
||||
|
||||
public List<DataSetTaskDTO> taskList(BaseGridRequest request) {
|
||||
List<ConditionEntity> conditionEntities = request.getConditions() == null ? new ArrayList<>() : request.getConditions();
|
||||
ConditionEntity entity = new ConditionEntity();
|
||||
entity.setOperator("extra");
|
||||
entity.setField(" FIND_IN_SET(dataset_table_task.table_id,cids) ");
|
||||
conditionEntities.add(entity);
|
||||
request.setConditions(conditionEntities);
|
||||
GridExample gridExample = request.convertExample();
|
||||
gridExample.setExtendCondition(AuthUtils.getUser().getUserId().toString());
|
||||
List<DataSetTaskDTO> dataSetTaskDTOS = extDataSetTaskMapper.taskList(gridExample);
|
||||
return dataSetTaskDTOS;
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package io.dataease.service.dataset;
|
||||
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.DatasetTableFunctionMapper;
|
||||
import io.dataease.commons.utils.DorisTableUtils;
|
||||
import io.dataease.datasource.service.DatasourceService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/7/29 11:58 上午
|
||||
*/
|
||||
@Service
|
||||
public class DatasetFunctionService {
|
||||
@Resource
|
||||
private DatasetTableFunctionMapper datasetTableFunctionMapper;
|
||||
@Resource
|
||||
private DataSetTableService dataSetTableService;
|
||||
@Resource
|
||||
private DatasourceService datasourceService;
|
||||
|
||||
public DatasetTableFunction get(Long id) {
|
||||
return datasetTableFunctionMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<DatasetTableFunction> list(DatasetTableFunction datasetTableFunction) {
|
||||
DatasetTableFunctionExample datasetTableFunctionExample = new DatasetTableFunctionExample();
|
||||
DatasetTableFunctionExample.Criteria criteria = datasetTableFunctionExample.createCriteria();
|
||||
if (StringUtils.isNotEmpty(datasetTableFunction.getDbType())) {
|
||||
criteria.andDbTypeEqualTo(datasetTableFunction.getDbType());
|
||||
}
|
||||
return datasetTableFunctionMapper.selectByExampleWithBLOBs(datasetTableFunctionExample);
|
||||
}
|
||||
|
||||
public List<DatasetTableFunction> listByTableId(String id) {
|
||||
DatasetTable datasetTable = dataSetTableService.get(id);
|
||||
String dbType;
|
||||
if (datasetTable.getMode() == 0) {
|
||||
Datasource datasource = datasourceService.get(datasetTable.getDataSourceId());
|
||||
dbType = datasource.getType();
|
||||
} else {
|
||||
dbType = "doris";
|
||||
}
|
||||
DatasetTableFunction datasetTableFunction = new DatasetTableFunction();
|
||||
datasetTableFunction.setDbType(dbType);
|
||||
return list(datasetTableFunction);
|
||||
}
|
||||
}
|
@ -124,7 +124,7 @@ public class ExtractDataService {
|
||||
"fi\n" +
|
||||
"rm -rf %s\n";
|
||||
|
||||
public synchronized boolean existSyncTask(DatasetTable datasetTable, DatasetTableTask datasetTableTask) {
|
||||
public synchronized boolean existSyncTask(DatasetTable datasetTable, DatasetTableTask datasetTableTask, Long startTime) {
|
||||
datasetTable.setSyncStatus(JobStatus.Underway.name());
|
||||
DatasetTableExample example = new DatasetTableExample();
|
||||
example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusNotEqualTo(JobStatus.Underway.name());
|
||||
@ -141,7 +141,7 @@ public class ExtractDataService {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
datasetTableTask.setLastExecTime(System.currentTimeMillis());
|
||||
datasetTableTask.setLastExecTime(startTime);
|
||||
datasetTableTask.setLastExecStatus(JobStatus.Underway.name());
|
||||
datasetTableTask.setStatus(TaskStatus.Exec.name());
|
||||
dataSetTableTaskService.update(datasetTableTask);
|
||||
@ -238,12 +238,13 @@ public class ExtractDataService {
|
||||
LogUtil.info("Skip synchronization task, task ID : " + datasetTableTask.getId());
|
||||
return;
|
||||
}
|
||||
if (existSyncTask(datasetTable, datasetTableTask)) {
|
||||
|
||||
Long startTime = System.currentTimeMillis();
|
||||
if (existSyncTask(datasetTable, datasetTableTask, startTime)) {
|
||||
LogUtil.info("Skip synchronization task for dataset, dataset ID : " + datasetTableId);
|
||||
return;
|
||||
}
|
||||
|
||||
DatasetTableTaskLog datasetTableTaskLog = getDatasetTableTaskLog(datasetTableId, taskId);
|
||||
DatasetTableTaskLog datasetTableTaskLog = getDatasetTableTaskLog(datasetTableId, taskId, startTime);
|
||||
UpdateType updateType = UpdateType.valueOf(type);
|
||||
if (context != null) {
|
||||
datasetTable.setQrtzInstance(context.getFireInstanceId());
|
||||
@ -267,6 +268,9 @@ public class ExtractDataService {
|
||||
});
|
||||
String dorisTablColumnSql = createDorisTablColumnSql(datasetTableFields);
|
||||
|
||||
boolean msg = false;
|
||||
JobStatus jobStatus = JobStatus.Completed;
|
||||
Long execTime = null;
|
||||
switch (updateType) {
|
||||
case all_scope: // 全量更新
|
||||
try {
|
||||
@ -281,29 +285,22 @@ public class ExtractDataService {
|
||||
} else {
|
||||
generateJobFile("all_scope", datasetTable, String.join(",", datasetTableFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList())));
|
||||
}
|
||||
Long execTime = System.currentTimeMillis();
|
||||
execTime = System.currentTimeMillis();
|
||||
extractData(datasetTable, "all_scope");
|
||||
replaceTable(DorisTableUtils.dorisName(datasetTableId));
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
|
||||
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, true);
|
||||
|
||||
deleteFile("all_scope", datasetTableId);
|
||||
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
|
||||
|
||||
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
|
||||
|
||||
msg = true;
|
||||
jobStatus = JobStatus.Completed;
|
||||
} catch (Exception e) {
|
||||
saveErrorLog(datasetTableId, taskId, e);
|
||||
|
||||
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
|
||||
|
||||
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
|
||||
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
|
||||
deleteFile("all_scope", datasetTableId);
|
||||
msg = false;
|
||||
jobStatus = JobStatus.Error;
|
||||
} finally {
|
||||
try { deleteFile("all_scope", datasetTableId); }catch (Exception ignore){}
|
||||
try { sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, msg); }catch (Exception ignore){}
|
||||
try { dataSetTableTaskService.updateTaskStatus(datasetTableTask, jobStatus); }catch (Exception ignore){}
|
||||
try { updateTableStatus(datasetTableId, datasetTable, jobStatus, execTime); }catch (Exception ignore){}
|
||||
try { dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId))); }catch (Exception ignore){}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -323,7 +320,7 @@ public class ExtractDataService {
|
||||
if (datasetTableTask == null ) {
|
||||
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableId, taskId);
|
||||
}
|
||||
Long execTime = System.currentTimeMillis();
|
||||
execTime = System.currentTimeMillis();
|
||||
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd()) && StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, datasetTable.getLastUpdateTime().toString())
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
|
||||
@ -341,28 +338,17 @@ public class ExtractDataService {
|
||||
}
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
|
||||
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,true);
|
||||
|
||||
deleteFile("incremental_add", datasetTableId);
|
||||
deleteFile("incremental_delete", datasetTableId);
|
||||
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
|
||||
|
||||
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
|
||||
msg = true;
|
||||
jobStatus = JobStatus.Completed;
|
||||
} catch (Exception e) {
|
||||
saveErrorLog(datasetTableId, taskId, e);
|
||||
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
|
||||
|
||||
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
|
||||
|
||||
deleteFile("incremental_add", datasetTableId);
|
||||
deleteFile("incremental_delete", datasetTableId);
|
||||
msg = false;
|
||||
jobStatus = JobStatus.Error;
|
||||
} finally {
|
||||
if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
datasetTableTask.setStatus(TaskStatus.Stopped.name());
|
||||
dataSetTableTaskService.update(datasetTableTask);
|
||||
}
|
||||
try { deleteFile("incremental_add", datasetTableId); deleteFile("incremental_delete", datasetTableId); }catch (Exception ignore){}
|
||||
try { sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, msg); }catch (Exception ignore){}
|
||||
try { dataSetTableTaskService.updateTaskStatus(datasetTableTask, jobStatus); }catch (Exception ignore){}
|
||||
try { updateTableStatus(datasetTableId, datasetTable, jobStatus, execTime); }catch (Exception ignore){}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -535,11 +521,12 @@ public class ExtractDataService {
|
||||
}
|
||||
}
|
||||
|
||||
private DatasetTableTaskLog getDatasetTableTaskLog(String datasetTableId, String taskId) {
|
||||
private DatasetTableTaskLog getDatasetTableTaskLog(String datasetTableId, String taskId, Long startTime) {
|
||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||
datasetTableTaskLog.setTableId(datasetTableId);
|
||||
datasetTableTaskLog.setTaskId(taskId);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
|
||||
datasetTableTaskLog.setTriggerType(TriggerType.Custom.name());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.select(datasetTableTaskLog);
|
||||
if (CollectionUtils.isNotEmpty(datasetTableTaskLogs)) {
|
||||
@ -550,7 +537,8 @@ public class ExtractDataService {
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
|
||||
datasetTableTaskLog.setTriggerType(TriggerType.Cron.name());
|
||||
datasetTableTaskLog.setStartTime(startTime);
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
return datasetTableTaskLog;
|
||||
}
|
||||
|
@ -9,11 +9,13 @@ import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
import io.dataease.datasource.service.DatasourceService;
|
||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import io.dataease.service.dataset.DataSetFieldService;
|
||||
import io.dataease.service.dataset.DataSetTableFieldsService;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
import io.dataease.service.dataset.DataSetTableUnionService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -28,17 +30,14 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service("directDataSetFieldService")
|
||||
public class DirectFieldService implements DataSetFieldService {
|
||||
|
||||
|
||||
@Resource
|
||||
private DataSetTableFieldsService dataSetTableFieldsService;
|
||||
|
||||
@Resource
|
||||
private DataSetTableService dataSetTableService;
|
||||
|
||||
|
||||
@Resource
|
||||
private DatasourceService datasourceService;
|
||||
@Resource
|
||||
private DataSetTableUnionService dataSetTableUnionService;
|
||||
|
||||
@Override
|
||||
public List<Object> fieldValues(String fieldId) {
|
||||
@ -68,9 +67,14 @@ public class DirectFieldService implements DataSetFieldService {
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "db")) {
|
||||
datasourceRequest.setTable(dataTableInfoDTO.getTable());
|
||||
datasourceRequest.setQuery(qp.createQuerySQL(dataTableInfoDTO.getTable(), Collections.singletonList(field)));
|
||||
datasourceRequest.setQuery(qp.createQuerySQL(dataTableInfoDTO.getTable(), Collections.singletonList(field), true));
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmp(dataTableInfoDTO.getSql(), Collections.singletonList(field)));
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmp(dataTableInfoDTO.getSql(), Collections.singletonList(field), true));
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
DataTableInfoDTO dt = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
||||
List<DataSetTableUnionDTO> listUnion = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
|
||||
String sql = dataSetTableService.getCustomSQLDatasource(dt, listUnion, ds);
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmp(sql, Collections.singletonList(field), true));
|
||||
}
|
||||
} else if (datasetTable.getMode() == 1) {// 抽取
|
||||
// 连接doris,构建doris数据源查询
|
||||
@ -81,7 +85,7 @@ public class DirectFieldService implements DataSetFieldService {
|
||||
tableName = "ds_" + datasetTable.getId().replaceAll("-", "_");
|
||||
datasourceRequest.setTable(tableName);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQL(tableName, Collections.singletonList(field)));
|
||||
datasourceRequest.setQuery(qp.createQuerySQL(tableName, Collections.singletonList(field), true));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -273,10 +273,12 @@ public class SysMsgService {
|
||||
@Cacheable(value = SysMsgConstants.SYS_MSG_USER_SUBSCRIBE, key = "#userId")
|
||||
public List<SubscribeNode> subscribes(Long userId) {
|
||||
SysMsgSettingExample example = new SysMsgSettingExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId).andEnableEqualTo(true);
|
||||
/*example.createCriteria().andUserIdEqualTo(userId).andEnableEqualTo(true);*/
|
||||
example.createCriteria().andUserIdEqualTo(userId);
|
||||
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
|
||||
// 添加默认订阅
|
||||
sysMsgSettings = addDefault(sysMsgSettings);
|
||||
sysMsgSettings = sysMsgSettings.stream().filter(SysMsgSetting::getEnable).collect(Collectors.toList());
|
||||
// sysMsgSettings.addAll(defaultSettings());
|
||||
List<SubscribeNode> resultLists = sysMsgSettings.stream().map(item -> {
|
||||
SubscribeNode subscribeNode = new SubscribeNode();
|
||||
|
@ -4,7 +4,9 @@ import com.google.gson.Gson;
|
||||
import io.dataease.auth.config.RsaProperties;
|
||||
import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.auth.util.RsaUtil;
|
||||
import io.dataease.base.domain.PanelGroupWithBLOBs;
|
||||
import io.dataease.base.domain.PanelLink;
|
||||
import io.dataease.base.mapper.PanelGroupMapper;
|
||||
import io.dataease.base.mapper.PanelLinkMapper;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.controller.request.panel.link.EnablePwdRequest;
|
||||
@ -32,6 +34,9 @@ public class PanelLinkService {
|
||||
@Resource
|
||||
private PanelLinkMapper mapper;
|
||||
|
||||
@Resource
|
||||
private PanelGroupMapper panelGroupMapper;
|
||||
|
||||
public void changeValid(LinkRequest request){
|
||||
PanelLink po = new PanelLink();
|
||||
po.setResourceId(request.getResourceId());
|
||||
@ -117,7 +122,16 @@ public class PanelLinkService {
|
||||
public Boolean validateHeads(PanelLink panelLink) throws Exception{
|
||||
HttpServletRequest request = ServletUtils.request();
|
||||
String token = request.getHeader("LINK-PWD-TOKEN");
|
||||
if (StringUtils.isEmpty(token) || StringUtils.equals("undefined", token) || StringUtils.equals("null", token)) return false;
|
||||
if (!panelLink.getEnablePwd() || StringUtils.isEmpty(token) || StringUtils.equals("undefined", token) || StringUtils.equals("null", token)) {
|
||||
String resourceId = panelLink.getResourceId();
|
||||
String pwd = "dataease";
|
||||
String tk = JWTUtils.signLink(resourceId, pwd);
|
||||
HttpServletResponse httpServletResponse = ServletUtils.response();
|
||||
httpServletResponse.addHeader("Access-Control-Expose-Headers", "LINK-PWD-TOKEN");
|
||||
httpServletResponse.setHeader("LINK-PWD-TOKEN", tk);
|
||||
return false;
|
||||
}
|
||||
if (StringUtils.isEmpty(panelLink.getPwd())) return false;
|
||||
boolean verify = JWTUtils.verifyLink(token, panelLink.getResourceId(), decryptParam(panelLink.getPwd()));
|
||||
return verify;
|
||||
}
|
||||
@ -137,4 +151,9 @@ public class PanelLinkService {
|
||||
return pass;
|
||||
}
|
||||
|
||||
public PanelGroupWithBLOBs resourceInfo(String resourceId) {
|
||||
return panelGroupMapper.selectByPrimaryKey(resourceId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,7 @@ package io.dataease.service.panel;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.dataease.base.domain.PanelGroup;
|
||||
import io.dataease.base.domain.PanelGroupWithBLOBs;
|
||||
import io.dataease.base.mapper.PanelViewMapper;
|
||||
import io.dataease.base.mapper.ext.ExtPanelViewMapper;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
@ -21,7 +19,6 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -30,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -0,0 +1 @@
|
||||
UPDATE `chart_view` SET `custom_filter` = '[]';
|
@ -1,4 +1,3 @@
|
||||
ALTER TABLE `chart_view` ADD COLUMN `ext_stack` LONGTEXT COMMENT '堆叠项' AFTER `y_axis`;
|
||||
|
||||
UPDATE `chart_view` SET `ext_stack` = '[]';
|
||||
UPDATE `chart_view` SET `custom_filter` = '[]';
|
@ -1,3 +1,6 @@
|
||||
ALTER TABLE `chart_view` ADD COLUMN `ext_stack` LONGTEXT COMMENT '堆叠项' AFTER `y_axis`;
|
||||
UPDATE `chart_view` SET `ext_stack` = '[]';
|
||||
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
@ -2936,3 +2939,62 @@ INSERT INTO `area_mapping` VALUES (2897, '澳门特别行政区', '156820000', '
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE `dataset_table_field` MODIFY COLUMN `origin_name` LONGTEXT;
|
||||
|
||||
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : local
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50730
|
||||
Source Host : 127.0.0.1:3306
|
||||
Source Schema : dataease
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50730
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 29/07/2021 11:55:10
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for dataset_table_function
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `dataset_table_function`;
|
||||
CREATE TABLE `dataset_table_function` (
|
||||
`id` bigint(20) NOT NULL COMMENT 'ID',
|
||||
`name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '函数名称',
|
||||
`func` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '函数表达式',
|
||||
`db_type` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '所属数据库',
|
||||
`func_type` int(10) DEFAULT NULL COMMENT '函数类型:0-聚合函数;1-快速计算函数;2-数学和三角函数;3-日期函数;4-文本函数;5-逻辑函数;6-其它函数',
|
||||
`desc` longtext COLLATE utf8mb4_bin COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dataset_table_function
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `dataset_table_function` VALUES (1, 'ABS', 'ABS(x)', 'mysql', 2, '返回x的绝对值');
|
||||
INSERT INTO `dataset_table_function` VALUES (2, 'PI', 'PI()', 'mysql', 2, '返回圆周率π,默认显示6位小数');
|
||||
INSERT INTO `dataset_table_function` VALUES (3, 'CHAR_LENGTH', 'CHAR_LENGTH(str)', 'mysql', 4, '计算字符串字符个数');
|
||||
INSERT INTO `dataset_table_function` VALUES (4, 'TRIM', 'TRIM(s)', 'mysql', 4, '返回字符串s删除了两边空格之后的字符串');
|
||||
INSERT INTO `dataset_table_function` VALUES (5, 'REPLACE', 'REPLACE(s,s1,s2)', 'mysql', 4, '返回一个字符串,用字符串s2替代字符串s中所有的字符串s1');
|
||||
INSERT INTO `dataset_table_function` VALUES (6, 'SUBSTRING', 'SUBSTRING(s,n,len)', 'mysql', 4, '获取从字符串s中的第n个位置开始长度为len的字符串');
|
||||
INSERT INTO `dataset_table_function` VALUES (7, 'IF', 'IF(expr,v1,v2)', 'mysql', 5, '如果expr是TRUE则返回v1,否则返回v2');
|
||||
INSERT INTO `dataset_table_function` VALUES (8, 'IFNULL', 'IFNULL(v1,v2)', 'mysql', 5, '如果v1不为NULL,则返回v1,否则返回v2');
|
||||
INSERT INTO `dataset_table_function` VALUES (9, 'FLOOR', 'FLOOR(x)', 'mysql', 2, '返回不大于x的最大整数');
|
||||
INSERT INTO `dataset_table_function` VALUES (10, 'ROUND', 'ROUND(x)', 'mysql', 2, '返回离x最近的整数');
|
||||
INSERT INTO `dataset_table_function` VALUES (11, 'ROUND', 'ROUND(x,y)', 'mysql', 2, '保留x小数点后y位的值,但截断时要进行四舍五入');
|
||||
INSERT INTO `dataset_table_function` VALUES (12, 'ABS', 'ABS(x)', 'doris', 2, '返回x的绝对值');
|
||||
INSERT INTO `dataset_table_function` VALUES (13, 'SUBSTR', 'SUBSTR(char, position, substring_length)', 'oracle', 4, '获取从字符串char中的第position个位置开始长度为substring_lenght的字符串');
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
@ -1,6 +1,6 @@
|
||||
DROP FUNCTION IF EXISTS `GET_CHART_VIEW_COPY_NAME`;
|
||||
delimiter ;;
|
||||
CREATE DEFINER=`root`@`%` FUNCTION `GET_CHART_VIEW_COPY_NAME`(chartId varchar(255)) RETURNS varchar(255) CHARSET utf8
|
||||
CREATE FUNCTION `GET_CHART_VIEW_COPY_NAME`(chartId varchar(255)) RETURNS varchar(255) CHARSET utf8
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
|
||||
<!--要生成的数据库表 -->
|
||||
|
||||
<table tableName="chart_view"/>
|
||||
<table tableName="dataset_table_function"/>
|
||||
<!-- <table tableName="sys_dict"/>-->
|
||||
<!-- <table tableName="sys_dict_item"/>-->
|
||||
<!-- <table tableName="dataset_table_field"/>-->
|
||||
|
@ -26,3 +26,33 @@ ORDER BY
|
||||
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
|
||||
<endif>
|
||||
>>
|
||||
|
||||
|
||||
previewSql(groups, aggregators, filters, orders, table, isGroup)
|
||||
::=<<
|
||||
SELECT
|
||||
<if(!groups && !aggregators)>
|
||||
*
|
||||
<endif>
|
||||
<if(groups)>
|
||||
<groups:{group|<if(group)><group.fieldName> AS <group.fieldAlias><endif>}; separator=",\n">
|
||||
<endif>
|
||||
<if(groups && aggregators)>,<endif>
|
||||
<if(aggregators)>
|
||||
<aggregators:{agg|<if(agg)><agg.fieldName> AS <agg.fieldAlias><endif>}; separator=",\n">
|
||||
<endif>
|
||||
FROM
|
||||
<table.tableName> <table.tableAlias>
|
||||
<if(filters)>
|
||||
WHERE
|
||||
<filters:{filter|<if(filter)><filter.whereField> <filter.whereTermAndValue><endif>}; separator="\nAND ">
|
||||
<endif>
|
||||
<if(isGroup && groups)>
|
||||
GROUP BY
|
||||
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
|
||||
<endif>
|
||||
<if(orders)>
|
||||
ORDER BY
|
||||
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
|
||||
<endif>
|
||||
>>
|
||||
|
@ -24,7 +24,7 @@
|
||||
"element-ui": "2.13.0",
|
||||
"file-save": "^0.2.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"fit2cloud-ui": "1.2.0",
|
||||
"fit2cloud-ui": "1.5.0-beta.0",
|
||||
"html2canvasde": "^v1.1.4-de",
|
||||
"js-cookie": "2.2.0",
|
||||
"jsencrypt": "^3.0.0-rc.1",
|
||||
|
@ -11,7 +11,7 @@ export function post(url, data) {
|
||||
|
||||
export function ajaxGetData(id, data) {
|
||||
return request({
|
||||
url: '/chart/view/getData/' + id,
|
||||
url: '/chart/view/getOneWithPermission/' + id,
|
||||
method: 'post',
|
||||
loading: true,
|
||||
hideMsg: true,
|
||||
|
@ -51,7 +51,17 @@ export function loadGenerate(resourceId) {
|
||||
|
||||
export function loadResource(resourceId) {
|
||||
return request({
|
||||
url: 'panel/group/findOne/' + resourceId,
|
||||
method: 'get'
|
||||
url: 'api/link/resourceDetail/' + resourceId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function viewInfo(id, data) {
|
||||
return request({
|
||||
url: 'api/link/viewDetail/' + id,
|
||||
method: 'post',
|
||||
timeout: 30000,
|
||||
hideMsg: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -1463,7 +1463,7 @@ export default {
|
||||
|
||||
// 记录当前样式 矩阵处理
|
||||
recordMatrixCurStyle() {
|
||||
debugger
|
||||
// debugger
|
||||
const left = Math.round(this.left / this.curCanvasScale.matrixStyleWidth) * this.curCanvasScale.matrixStyleWidth
|
||||
const top = Math.round(this.top / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight
|
||||
const width = Math.round(this.width / this.curCanvasScale.matrixStyleWidth) * this.curCanvasScale.matrixStyleWidth
|
||||
|
@ -120,17 +120,30 @@ export default {
|
||||
if (this.$route && this.$route.name && this.$route.name === row.router) {
|
||||
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
|
||||
row.callback && bus.$emit(row.callback, param)
|
||||
} else {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
}
|
||||
|
||||
row.status || this.setReaded(row.msgId)
|
||||
} else {
|
||||
if (this.hasPermissionRoute(row.router)) {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
row.status || this.setReaded(row.msgId)
|
||||
return
|
||||
}
|
||||
this.$warning(this.$t('commons.no_target_permission'))
|
||||
}
|
||||
},
|
||||
remove(row) {
|
||||
|
||||
},
|
||||
msgSetting() {
|
||||
|
||||
},
|
||||
hasPermissionRoute(name, permission_routes) {
|
||||
permission_routes = permission_routes || this.permission_routes
|
||||
for (let index = 0; index < permission_routes.length; index++) {
|
||||
const route = permission_routes[index]
|
||||
if (route.name && route.name === name) return true
|
||||
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
showMore() {
|
||||
const routerName = 'sys-msg-web-all'
|
||||
@ -184,7 +197,7 @@ export default {
|
||||
line-height: 14px;
|
||||
display: inline-block;
|
||||
position: fixed;
|
||||
right: 155px;
|
||||
right: 178px;
|
||||
top: 8px;
|
||||
background: red;
|
||||
color: #fff;
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div>
|
||||
<slot name="toolbar" />
|
||||
</div>
|
||||
<fu-search-bar v-bind="searchConfig" @exec="search">
|
||||
<fu-search-bar v-bind="searchConfig" @exec="search" ref="search">
|
||||
<template #complex>
|
||||
<slot name="complex" />
|
||||
</template>
|
||||
@ -57,11 +57,20 @@ export default {
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
searchConfig: Object,
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
paginationConfig: Object
|
||||
paginationConfig: Object,
|
||||
transCondition: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
condition: {}
|
||||
condition: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.transCondition !== null) {
|
||||
this.$refs.search.setConditions(this.transCondition)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -104,6 +104,9 @@ export default {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.component:hover {
|
||||
box-shadow:0px 0px 7px #0a7be0;
|
||||
}
|
||||
.gap_class{
|
||||
padding:3px;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
<el-dropdown-item icon="el-icon-download" @click.native="bottomComponent">{{ $t('panel.bottomComponent') }}</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-arrow-up" @click.native="upComponent">{{ $t('panel.upComponent') }}</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-arrow-down" @click.native="downComponent">{{ $t('panel.downComponent') }}</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-link" @click.native="linkageSetting">联动设置</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
@ -119,6 +120,9 @@ export default {
|
||||
bottomComponent() {
|
||||
this.$store.commit('bottomComponent')
|
||||
this.$store.commit('recordSnapshot')
|
||||
},
|
||||
linkageSetting() {
|
||||
this.$store.commit('setLinkageSettingStatus', true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
<script>
|
||||
|
||||
import { viewData } from '@/api/panel/panel'
|
||||
import { viewInfo } from '@/api/link'
|
||||
import ChartComponent from '@/views/chart/components/ChartComponent.vue'
|
||||
import TableNormal from '@/views/chart/components/table/TableNormal'
|
||||
import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
|
||||
@ -35,7 +36,7 @@ import { isChange } from '@/utils/conditionUtil'
|
||||
import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||
|
||||
import { getToken, getLinkToken } from '@/utils/auth'
|
||||
export default {
|
||||
name: 'UserView',
|
||||
components: { ChartComponent, TableNormal, LabelNormal },
|
||||
@ -161,7 +162,14 @@ export default {
|
||||
if (id) {
|
||||
this.requestStatus = 'waiting'
|
||||
this.message = null
|
||||
viewData(id, this.filter).then(response => {
|
||||
|
||||
// 增加判断 仪表板公共连接中使用viewInfo 正常使用viewData
|
||||
let method = viewData
|
||||
if (!getToken() && getLinkToken()) {
|
||||
method = viewInfo
|
||||
}
|
||||
|
||||
method(id, this.filter).then(response => {
|
||||
// 将视图传入echart组件
|
||||
if (response.success) {
|
||||
this.chart = response.data
|
||||
|
@ -151,8 +151,7 @@ export default {
|
||||
}
|
||||
.first-element-contaner {
|
||||
width: calc(100% - 10px);
|
||||
background: #fff;
|
||||
border: 1px solid #d7dae2;
|
||||
background: initial;
|
||||
position:absolute;
|
||||
bottom: 5px;
|
||||
margin: 0 4px;
|
||||
@ -161,6 +160,8 @@ export default {
|
||||
}
|
||||
}
|
||||
.first-element-grid-contaner {
|
||||
background: #fff;
|
||||
border: 1px solid #d7dae2;
|
||||
top: 5px;
|
||||
}
|
||||
.condition-main-line {
|
||||
|
@ -129,6 +129,7 @@ export default {
|
||||
password_error: 'The password can not be less than 8 digits'
|
||||
},
|
||||
commons: {
|
||||
no_target_permission: 'No permission',
|
||||
success: 'Success',
|
||||
switch_lang: 'Switch Language Success',
|
||||
close: 'Close',
|
||||
@ -823,7 +824,8 @@ export default {
|
||||
map_range: 'Map range',
|
||||
select_map_range: 'Please select map range',
|
||||
area: 'Area',
|
||||
placeholder_field: 'Drag Field To Here'
|
||||
placeholder_field: 'Drag Field To Here',
|
||||
axis_label_rotate: 'Label Rotate'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
|
||||
@ -873,6 +875,7 @@ export default {
|
||||
sync_now: 'Update Now',
|
||||
add_task: 'Add Task',
|
||||
task_name: 'Task Name',
|
||||
task_id: 'Task ID',
|
||||
start_time: 'Start Time',
|
||||
end_time: 'End Time',
|
||||
status: 'State',
|
||||
@ -985,7 +988,9 @@ export default {
|
||||
data_type: 'Data Type',
|
||||
click_ref_field: 'Click Quote Field',
|
||||
click_ref_function: 'Click Quote Function',
|
||||
field_manage: 'Field Manage'
|
||||
field_manage: 'Field Manage',
|
||||
edit_calc_field: 'Edit calc field',
|
||||
calc_field: 'Calc Field'
|
||||
},
|
||||
datasource: {
|
||||
datasource: 'Data Source',
|
||||
|
@ -129,6 +129,7 @@ export default {
|
||||
password_error: '密碼不小於 8 位'
|
||||
},
|
||||
commons: {
|
||||
no_target_permission: '沒有權限',
|
||||
success: '成功',
|
||||
switch_lang: '切換語言成功',
|
||||
close: '關閉',
|
||||
@ -823,7 +824,8 @@ export default {
|
||||
select_map_range: '請選擇地圖範圍',
|
||||
area: '地區',
|
||||
stack_item: '堆疊項',
|
||||
placeholder_field: '拖動字段至此處'
|
||||
placeholder_field: '拖動字段至此處',
|
||||
axis_label_rotate: '標簽角度'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: '有多個sheet頁面,默認抽取第一個',
|
||||
@ -873,6 +875,7 @@ export default {
|
||||
sync_now: '立即更新',
|
||||
add_task: '添加任務',
|
||||
task_name: '任務名稱',
|
||||
task_id: '任務ID',
|
||||
start_time: '開始時間',
|
||||
end_time: '結束時間',
|
||||
status: '狀態',
|
||||
@ -985,7 +988,9 @@ export default {
|
||||
data_type: '數據類型',
|
||||
click_ref_field: '點擊引用字段',
|
||||
click_ref_function: '點擊引用函數',
|
||||
field_manage: '字段管理'
|
||||
field_manage: '字段管理',
|
||||
edit_calc_field: '編輯計算字段',
|
||||
calc_field: '計算字段'
|
||||
},
|
||||
datasource: {
|
||||
datasource: '數據源',
|
||||
|
@ -129,6 +129,7 @@ export default {
|
||||
password_error: '密码不小于 8 位'
|
||||
},
|
||||
commons: {
|
||||
no_target_permission: '没有权限',
|
||||
success: '成功',
|
||||
switch_lang: '切换语言成功',
|
||||
close: '关闭',
|
||||
@ -823,7 +824,8 @@ export default {
|
||||
select_map_range: '请选择地图范围',
|
||||
area: '地区',
|
||||
stack_item: '堆叠项',
|
||||
placeholder_field: '拖动字段至此处'
|
||||
placeholder_field: '拖动字段至此处',
|
||||
axis_label_rotate: '标签角度'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
|
||||
@ -873,6 +875,7 @@ export default {
|
||||
sync_now: '立即更新',
|
||||
add_task: '添加任务',
|
||||
task_name: '任务名称',
|
||||
task_id: '任务ID',
|
||||
start_time: '开始时间',
|
||||
end_time: '结束时间',
|
||||
status: '状态',
|
||||
@ -985,7 +988,9 @@ export default {
|
||||
data_type: '数据类型',
|
||||
click_ref_field: '点击引用字段',
|
||||
click_ref_function: '点击引用函数',
|
||||
field_manage: '字段管理'
|
||||
field_manage: '字段管理',
|
||||
edit_calc_field: '编辑计算字段',
|
||||
calc_field: '计算字段'
|
||||
},
|
||||
datasource: {
|
||||
datasource: '数据源',
|
||||
|
@ -44,9 +44,10 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-dropdown class="top-dropdown" style="display: flex;align-items: center;">
|
||||
<span class="el-dropdown-link" style="font-size: 14px;">
|
||||
{{ name }}<i class="el-icon-arrow-down el-icon--right" />
|
||||
<el-dropdown class="top-dropdown" style="display: flex;align-items: center; width:100px;">
|
||||
<span class="el-dropdown-link" style="font-size: 14px;max-width: 80px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
{{ name }}
|
||||
<i class="el-icon-arrow-down el-icon--right" />
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<router-link to="/person-info/index">
|
||||
|
@ -48,7 +48,9 @@ const data = {
|
||||
// 点击画布时是否点中组件,主要用于取消选中组件用。
|
||||
// 如果没点中组件,并且在画布空白处弹起鼠标,则取消当前组件的选中状态
|
||||
isClickComponent: false,
|
||||
canvasCommonStyleData: DEFAULT_COMMON_CANVAS_STYLE_STRING
|
||||
canvasCommonStyleData: DEFAULT_COMMON_CANVAS_STYLE_STRING,
|
||||
// 联动设置状态
|
||||
linkageSettingStatus: false
|
||||
},
|
||||
mutations: {
|
||||
...animation.mutations,
|
||||
@ -173,6 +175,10 @@ const data = {
|
||||
index = state.curComponentIndex
|
||||
}
|
||||
state.componentData.splice(index, 1)
|
||||
},
|
||||
setLinkageSettingStatus(state, status) {
|
||||
state.linkageSettingStatus = status
|
||||
console.log('linkageSettingStatus:', state.linkageSettingStatus)
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
|
@ -79,8 +79,8 @@ const checkAuth = response => {
|
||||
store.dispatch('user/refreshToken', refreshToken)
|
||||
}
|
||||
|
||||
if (response.headers[LinkTokenKey.toLocaleLowerCase()]) {
|
||||
const linkToken = response.headers[LinkTokenKey.toLocaleLowerCase()]
|
||||
if (response.headers[LinkTokenKey.toLocaleLowerCase()] || (response.config.headers && response.config.headers[LinkTokenKey.toLocaleLowerCase()])) {
|
||||
const linkToken = response.headers[LinkTokenKey.toLocaleLowerCase()] || response.config.headers[LinkTokenKey.toLocaleLowerCase()]
|
||||
setLinkToken(linkToken)
|
||||
}
|
||||
// 许可状态改变 刷新页面
|
||||
|
@ -15,13 +15,10 @@
|
||||
<el-form-item :label="$t('chart.name')" class="form-item">
|
||||
<el-input v-model="axisForm.name" size="mini" @blur="changeXAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.rotate')" class="form-item form-item-slider">
|
||||
<el-slider v-model="axisForm.axisLabel.rotate" show-input :show-input-controls="false" :min="-90" :max="90" input-size="mini" @change="changeXAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_name_color')" class="form-item">
|
||||
<el-color-picker v-model="axisForm.nameTextStyle.color" class="color-picker-style" @change="changeXAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_name_fontsize')" class="form-item form-item-slider">
|
||||
<el-form-item :label="$t('chart.axis_name_fontsize')" class="form-item">
|
||||
<el-select v-model="axisForm.nameTextStyle.fontSize" :placeholder="$t('chart.axis_name_fontsize')" @change="changeXAxisStyle">
|
||||
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
|
||||
</el-select>
|
||||
@ -53,7 +50,10 @@
|
||||
<el-form-item :label="$t('chart.axis_label_color')" class="form-item">
|
||||
<el-color-picker v-model="axisForm.axisLabel.color" class="el-color-picker" @change="changeXAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_label_fontsize')" class="form-item form-item-slider">
|
||||
<el-form-item :label="$t('chart.axis_label_rotate')" class="form-item form-item-slider">
|
||||
<el-slider v-model="axisForm.axisLabel.rotate" show-input :show-input-controls="false" :min="-90" :max="90" input-size="mini" @change="changeXAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_label_fontsize')" class="form-item">
|
||||
<el-select v-model="axisForm.axisLabel.fontSize" :placeholder="$t('chart.axis_label_fontsize')" @change="changeXAxisStyle">
|
||||
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
|
||||
</el-select>
|
||||
|
@ -15,13 +15,10 @@
|
||||
<el-form-item :label="$t('chart.name')" class="form-item">
|
||||
<el-input v-model="axisForm.name" size="mini" @blur="changeYAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.rotate')" class="form-item form-item-slider">
|
||||
<el-slider v-model="axisForm.axisLabel.rotate" show-input :show-input-controls="false" :min="-90" :max="90" input-size="mini" @change="changeYAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_name_color')" class="form-item">
|
||||
<el-color-picker v-model="axisForm.nameTextStyle.color" class="color-picker-style" @change="changeYAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_name_fontsize')" class="form-item form-item-slider">
|
||||
<el-form-item :label="$t('chart.axis_name_fontsize')" class="form-item">
|
||||
<el-select v-model="axisForm.nameTextStyle.fontSize" :placeholder="$t('chart.axis_name_fontsize')" @change="changeYAxisStyle">
|
||||
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
|
||||
</el-select>
|
||||
@ -53,7 +50,10 @@
|
||||
<el-form-item :label="$t('chart.axis_label_color')" class="form-item">
|
||||
<el-color-picker v-model="axisForm.axisLabel.color" class="el-color-picker" @change="changeYAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_label_fontsize')" class="form-item form-item-slider">
|
||||
<el-form-item :label="$t('chart.axis_label_rotate')" class="form-item form-item-slider">
|
||||
<el-slider v-model="axisForm.axisLabel.rotate" show-input :show-input-controls="false" :min="-90" :max="90" input-size="mini" @change="changeYAxisStyle" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('chart.axis_label_fontsize')" class="form-item">
|
||||
<el-select v-model="axisForm.axisLabel.fontSize" :placeholder="$t('chart.axis_label_fontsize')" @change="changeYAxisStyle">
|
||||
<el-option v-for="option in fontSize" :key="option.value" :label="option.name" :value="option.value" />
|
||||
</el-select>
|
||||
|
@ -13,7 +13,7 @@
|
||||
</el-tag>
|
||||
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
|
||||
<span class="el-dropdown-link">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'd'?'':'success'">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
|
||||
<span style="float: left">
|
||||
<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" />
|
||||
|
@ -13,7 +13,7 @@
|
||||
</el-tag>
|
||||
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
|
||||
<span class="el-dropdown-link">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'd'?'':'success'">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
|
||||
<span style="float: left">
|
||||
<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" />
|
||||
|
@ -11,7 +11,7 @@
|
||||
</el-tag>
|
||||
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
|
||||
<span class="el-dropdown-link">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'd'?'':'success'">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
|
||||
<span style="float: left">
|
||||
<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" />
|
||||
|
@ -14,7 +14,7 @@
|
||||
</el-tag>
|
||||
<el-dropdown v-else trigger="click" size="mini" @command="clickItem">
|
||||
<span class="el-dropdown-link">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'd'?'':'success'">
|
||||
<el-tag size="small" class="item-axis" :type="item.groupType === 'q'?'success':''">
|
||||
<span style="float: left">
|
||||
<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" />
|
||||
|
@ -507,14 +507,20 @@
|
||||
|
||||
<!--编辑视图使用的数据集的字段-->
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:visible="editDsField"
|
||||
:show-close="false"
|
||||
class="dialog-css"
|
||||
:destroy-on-close="true"
|
||||
:fullscreen="true"
|
||||
>
|
||||
<field-edit :param="table" @switchComponent="closeEditDsField" />
|
||||
<field-edit :param="table" />
|
||||
<div slot="title" class="dialog-footer">
|
||||
<span style="font-size: 14px;">
|
||||
{{ $t('dataset.field_manage') }}
|
||||
<span v-if="table">[{{ table.name }}]</span>
|
||||
</span>
|
||||
<el-button size="mini" style="float: right;" @click="closeEditDsField">{{ $t('chart.close') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-row>
|
||||
</template>
|
||||
@ -902,6 +908,9 @@ export default {
|
||||
this.data = response.data.data
|
||||
// console.log(JSON.stringify(this.chart))
|
||||
this.httpRequest.status = true
|
||||
if (this.chart.privileges) {
|
||||
this.param.privileges = this.chart.privileges
|
||||
}
|
||||
}).catch(err => {
|
||||
this.resetView()
|
||||
this.httpRequest.status = err.response.data.success
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<de-container>
|
||||
<de-aside-container>
|
||||
<dataset-group-selector-tree @getTable="getTable" :mode=mode :type=type :customType=customType :showMode=showMode />
|
||||
<dataset-group-selector-tree @getTable="getTable" :privileges=privileges :mode=mode :type=type :customType=customType :showMode=showMode />
|
||||
</de-aside-container>
|
||||
<de-main-container>
|
||||
<dataset-table-data :table="table" />
|
||||
@ -45,6 +45,11 @@ export default {
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
privileges: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'use'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -270,7 +270,7 @@ export default {
|
||||
type: 'excel',
|
||||
mode: parseInt(this.mode),
|
||||
// info: '{"data":"' + this.path + '"}',
|
||||
info: JSON.stringify({ data: this.path }),
|
||||
info: JSON.stringify({ data: this.path, sheets: [this.sheets[0]] }),
|
||||
editType: this.param.editType ? this.param.editType : 0
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,7 @@
|
||||
<script>
|
||||
import { isKettleRunning, post } from '@/api/dataset/dataset'
|
||||
import { authModel } from '@/api/system/sysAuth'
|
||||
import { hasDataPermission } from '@/utils/permission'
|
||||
|
||||
export default {
|
||||
name: 'DatasetGroupSelectorTree',
|
||||
@ -112,6 +113,11 @@ export default {
|
||||
type: String,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
privileges: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'use'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -236,10 +242,12 @@ export default {
|
||||
mode: this.mode < 0 ? null : this.mode,
|
||||
typeFilter: this.customType ? this.customType : null
|
||||
}, false).then(response => {
|
||||
this.tables = response.data
|
||||
for (let i = 0; i < this.tables.length; i++) {
|
||||
if (this.tables[i].mode === 1 && this.kettleRunning === false) {
|
||||
this.$set(this.tables[i], 'disabled', true)
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
if (response.data[i].mode === 1 && this.kettleRunning === false) {
|
||||
this.$set(response.data[i], 'disabled', true)
|
||||
}
|
||||
if(hasDataPermission(this.privileges, response.data[i].privileges)){
|
||||
this.tables.push(response.data[i])
|
||||
}
|
||||
}
|
||||
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
||||
@ -350,14 +358,16 @@ export default {
|
||||
type: this.type,
|
||||
typeFilter: this.customType ? this.customType : null
|
||||
}, false).then(response => {
|
||||
this.tables = response.data
|
||||
for (let i = 0; i < this.tables.length; i++) {
|
||||
if (this.tables[i].mode === 1 && this.kettleRunning === false) {
|
||||
this.$set(this.tables[i], 'disabled', true)
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
if (response.data[i].mode === 1 && this.kettleRunning === false) {
|
||||
this.$set(response.data[i], 'disabled', true)
|
||||
}
|
||||
if(hasDataPermission(this.privileges, response.data[i].privileges)){
|
||||
this.tables.push(response.data[i])
|
||||
}
|
||||
}
|
||||
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
||||
|
||||
this.tableData = JSON.parse(JSON.stringify(this.tables))
|
||||
this.$nextTick(function() {
|
||||
this.unionDataChange()
|
||||
})
|
||||
|
@ -14,7 +14,7 @@
|
||||
<span>{{ $t('dataset.field_exp') }}</span>
|
||||
<codemirror
|
||||
ref="myCm"
|
||||
v-model="fieldExp"
|
||||
v-model="fieldForm.originName"
|
||||
class="codemirror"
|
||||
:options="cmOption"
|
||||
@ready="onCmReady"
|
||||
@ -67,7 +67,7 @@
|
||||
:disabled="true"
|
||||
>
|
||||
<transition-group>
|
||||
<span v-for="item in tableFields.dimensionList" :key="item.id" class="item-dimension" :title="item.name" @click="insertParamToCodeMirror(item.id)">
|
||||
<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+']')">
|
||||
<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" />
|
||||
@ -87,7 +87,7 @@
|
||||
:disabled="true"
|
||||
>
|
||||
<transition-group>
|
||||
<span v-for="item in tableFields.quotaList" :key="item.id" class="item-quota" :title="item.name" @click="insertParamToCodeMirror(item.id)">
|
||||
<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+']')">
|
||||
<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" />
|
||||
@ -101,11 +101,31 @@
|
||||
<el-col :span="12" style="height: 100%">
|
||||
<span>{{ $t('dataset.click_ref_function') }}</span>
|
||||
<el-row class="padding-lr function-height">
|
||||
<span v-for="(item,index) in functions" :key="index" class="function-style" @click="insertParamToCodeMirror(item.name)">{{ item.name }}</span>
|
||||
<el-popover
|
||||
v-for="(item,index) in functions"
|
||||
:key="index"
|
||||
class="function-pop"
|
||||
placement="right"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
:open-delay="500"
|
||||
>
|
||||
<p class="pop-title">{{ item.name }}</p>
|
||||
<p class="pop-info">{{ item.func }}</p>
|
||||
<p class="pop-info">{{ item.desc }}</p>
|
||||
<span slot="reference" class="function-style" :title="item.func" @click="insertParamToCodeMirror(item.func)">{{ item.func }}</span>
|
||||
</el-popover>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<div class="dialog-button">
|
||||
<el-button size="mini" @click="closeCalcField">{{ $t('dataset.cancel') }}</el-button>
|
||||
<el-button :disabled="!fieldForm.name || !fieldForm.originName" type="primary" size="mini" @click="saveCalcField">{{ $t('dataset.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
@ -134,6 +154,7 @@ import 'codemirror/keymap/emacs.js'
|
||||
import 'codemirror/addon/hint/show-hint.css'
|
||||
import 'codemirror/addon/hint/sql-hint'
|
||||
import 'codemirror/addon/hint/show-hint'
|
||||
import { post } from '../../../api/dataset/dataset'
|
||||
|
||||
export default {
|
||||
name: 'CalcFieldEdit',
|
||||
@ -146,16 +167,26 @@ export default {
|
||||
tableFields: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
field: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fieldForm: {
|
||||
id: null,
|
||||
name: '',
|
||||
groupType: 'd',
|
||||
deType: 0
|
||||
deType: 0,
|
||||
originName: '',
|
||||
tableId: this.param.id,
|
||||
checked: 1,
|
||||
columnIndex: this.tableFields.dimensionList.length + this.tableFields.quotaList.length,
|
||||
size: 0,
|
||||
extField: 2
|
||||
},
|
||||
fieldExp: '',
|
||||
cmOption: {
|
||||
tabSize: 2,
|
||||
styleActiveLine: true,
|
||||
@ -174,33 +205,7 @@ export default {
|
||||
{ label: this.$t('dataset.value') + '(' + this.$t('dataset.float') + ')', value: 3 },
|
||||
{ label: this.$t('dataset.location'), value: 5 }
|
||||
],
|
||||
functions: [
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' },
|
||||
{ name: 'ABS(n)' }
|
||||
]
|
||||
functions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -208,10 +213,23 @@ export default {
|
||||
return this.$refs.myCm.codemirror
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'param': function() {
|
||||
this.initFunctions()
|
||||
},
|
||||
'field': {
|
||||
handler: function() {
|
||||
this.initField()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.myCm.codemirror.on('keypress', () => {
|
||||
this.$refs.myCm.codemirror.showHint()
|
||||
})
|
||||
this.initFunctions()
|
||||
this.initField()
|
||||
},
|
||||
methods: {
|
||||
onCmReady(cm) {
|
||||
@ -222,7 +240,7 @@ export default {
|
||||
},
|
||||
onCmCodeChange(newCode) {
|
||||
// console.log(newCode)
|
||||
this.fieldExp = newCode
|
||||
this.fieldForm.originName = newCode
|
||||
},
|
||||
insertParamToCodeMirror(param) {
|
||||
const pos1 = this.$refs.myCm.codemirror.getCursor()
|
||||
@ -230,6 +248,50 @@ export default {
|
||||
pos2.line = pos1.line
|
||||
pos2.ch = pos1.ch
|
||||
this.$refs.myCm.codemirror.replaceRange(param, pos2)
|
||||
},
|
||||
|
||||
initFunctions() {
|
||||
post('/dataset/function/listByTableId/' + this.param.id, null).then(response => {
|
||||
this.functions = response.data
|
||||
})
|
||||
},
|
||||
|
||||
initField() {
|
||||
if (this.field.id) {
|
||||
this.fieldForm = JSON.parse(JSON.stringify(this.field))
|
||||
} else {
|
||||
this.fieldForm = JSON.parse(JSON.stringify(this.fieldForm))
|
||||
}
|
||||
},
|
||||
|
||||
closeCalcField() {
|
||||
this.resetField()
|
||||
this.$emit('onEditClose', {})
|
||||
},
|
||||
|
||||
saveCalcField() {
|
||||
if (!this.fieldForm.id) {
|
||||
this.fieldForm.type = this.fieldForm.deType
|
||||
this.fieldForm.deExtractType = this.fieldForm.deType
|
||||
}
|
||||
post('/dataset/field/save', this.fieldForm).then(response => {
|
||||
this.closeCalcField()
|
||||
})
|
||||
},
|
||||
|
||||
resetField() {
|
||||
this.fieldForm = {
|
||||
id: null,
|
||||
name: '',
|
||||
groupType: 'd',
|
||||
deType: 0,
|
||||
originName: '',
|
||||
tableId: this.param.id,
|
||||
checked: 1,
|
||||
columnIndex: this.tableFields.dimensionList.length + this.tableFields.quotaList.length,
|
||||
size: 0,
|
||||
extField: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -329,9 +391,28 @@ export default {
|
||||
padding: 2px 4px;
|
||||
cursor: pointer;
|
||||
margin: 4px 0;
|
||||
overflow-x: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.function-height{
|
||||
height: calc(100% - 20px);
|
||||
overflow: auto;
|
||||
}
|
||||
.function-pop>>>.el-popover{
|
||||
padding: 6px!important;
|
||||
}
|
||||
.pop-title{
|
||||
margin: 6px 0 0 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.pop-info{
|
||||
margin: 6px 0 0 0;
|
||||
font-size: 10px;
|
||||
}
|
||||
.dialog-button{
|
||||
float: right;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<el-form-item class="form-item">
|
||||
<el-button v-if="hasDataPermission('manage',param.privileges)" size="mini" @click="addCalcField">{{ $t('dataset.add_calc_field') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item" style="float: right;">
|
||||
<el-form-item class="form-item" style="float: right;margin-right: 0;">
|
||||
<el-input
|
||||
v-model="searchField"
|
||||
size="mini"
|
||||
@ -33,24 +33,27 @@
|
||||
<el-table :data="tableFields.dimensionListData" size="mini">
|
||||
<el-table-column property="checked" :label="$t('dataset.field_check')" width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.checked" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit" />
|
||||
<el-checkbox v-model="scope.row.checked" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="name" :label="$t('dataset.field_name')" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.name" size="mini" :disabled="!hasDataPermission('manage',param.privileges)" @blur="saveEdit" @keyup.enter.native="saveEdit" />
|
||||
<el-input v-model="scope.row.name" size="mini" :disabled="!hasDataPermission('manage',param.privileges)" @blur="saveEdit(scope.row)" @keyup.enter.native="saveEdit(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!(param.mode === 0 && param.type === 'custom')" property="originName" :label="$t('dataset.field_origin_name')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span :title="scope.row.originName" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span v-if="scope.row.extField === 0" :title="scope.row.originName" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span style="font-size: 12px;">{{ scope.row.originName }}</span>
|
||||
</span>
|
||||
<span v-else-if="scope.row.extField === 2" :title="$t('dataset.calc_field')" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span style="font-size: 12px;color: #c0c0c0">{{ $t('dataset.calc_field') }}</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="deType" :label="$t('dataset.field_type')" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.deType" size="mini" style="display: inline-block;width: 26px;" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit">
|
||||
<el-select v-model="scope.row.deType" size="mini" style="display: inline-block;width: 26px;" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit(scope.row)">
|
||||
<el-option
|
||||
v-for="item in fields"
|
||||
:key="item.value"
|
||||
@ -125,7 +128,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column property="" :label="$t('dataset.operator')">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small">编辑</el-button>
|
||||
<el-button v-if="scope.row.extField !== 0" :disabled="!hasDataPermission('manage',param.privileges)" type="text" size="mini" @click="editField(scope.row)">{{ $t('dataset.edit') }}</el-button>
|
||||
<el-button v-if="scope.row.extField !== 0" :disabled="!hasDataPermission('manage',param.privileges)" type="text" size="mini" @click="deleteField(scope.row)">{{ $t('dataset.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -135,24 +139,27 @@
|
||||
<el-table :data="tableFields.quotaListData" size="mini">
|
||||
<el-table-column property="checked" :label="$t('dataset.field_check')" width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.checked" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit" />
|
||||
<el-checkbox v-model="scope.row.checked" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="name" :label="$t('dataset.field_name')" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.name" size="mini" :disabled="!hasDataPermission('manage',param.privileges)" @blur="saveEdit" @keyup.enter.native="saveEdit" />
|
||||
<el-input v-model="scope.row.name" size="mini" :disabled="!hasDataPermission('manage',param.privileges)" @blur="saveEdit(scope.row)" @keyup.enter.native="saveEdit(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!(param.mode === 0 && param.type === 'custom')" property="originName" :label="$t('dataset.field_origin_name')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span :title="scope.row.originName" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span v-if="scope.row.extField === 0" :title="scope.row.originName" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span style="font-size: 12px;">{{ scope.row.originName }}</span>
|
||||
</span>
|
||||
<span v-else-if="scope.row.extField === 2" :title="$t('dataset.calc_field')" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span style="font-size: 12px;color: #c0c0c0">{{ $t('dataset.calc_field') }}</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="deType" :label="$t('dataset.field_type')" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.deType" size="mini" style="display: inline-block;width: 26px;" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit">
|
||||
<el-select v-model="scope.row.deType" size="mini" style="display: inline-block;width: 26px;" :disabled="!hasDataPermission('manage',param.privileges)" @change="saveEdit(scope.row)">
|
||||
<el-option
|
||||
v-for="item in fields"
|
||||
:key="item.value"
|
||||
@ -227,7 +234,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column property="" :label="$t('dataset.operator')">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small">编辑</el-button>
|
||||
<el-button v-if="scope.row.extField !== 0" :disabled="!hasDataPermission('manage',param.privileges)" type="text" size="mini" @click="editField(scope.row)">{{ $t('dataset.edit') }}</el-button>
|
||||
<el-button v-if="scope.row.extField !== 0" :disabled="!hasDataPermission('manage',param.privileges)" type="text" size="mini" @click="deleteField(scope.row)">{{ $t('dataset.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -239,20 +247,16 @@
|
||||
:visible="editCalcField"
|
||||
:show-close="false"
|
||||
class="dialog-css"
|
||||
:destroy-on-close="true"
|
||||
:title="$t('dataset.add_calc_field')"
|
||||
:title="currEditField.id?$t('dataset.edit_calc_field'):$t('dataset.add_calc_field')"
|
||||
append-to-body
|
||||
>
|
||||
<calc-field-edit :param="param" :table-fields="tableFields" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeCalcField">{{ $t('chart.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini">{{ $t('chart.confirm') }}</el-button>
|
||||
</div>
|
||||
<calc-field-edit :param="param" :table-fields="tableFields" :field="currEditField" @onEditClose="closeCalcField" />
|
||||
</el-dialog>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { batchEdit, fieldListDQ } from '@/api/dataset/dataset'
|
||||
import { post, fieldListDQ } from '@/api/dataset/dataset'
|
||||
import CalcFieldEdit from './CalcFieldEdit'
|
||||
export default {
|
||||
name: 'FieldEdit',
|
||||
@ -281,7 +285,8 @@ export default {
|
||||
],
|
||||
fieldActiveNames: ['d', 'q'],
|
||||
searchField: '',
|
||||
editCalcField: false
|
||||
editCalcField: false,
|
||||
currEditField: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -315,34 +320,36 @@ export default {
|
||||
this.filterField(this.searchField)
|
||||
})
|
||||
},
|
||||
saveEdit() {
|
||||
saveEdit(item) {
|
||||
// console.log(this.tableFields)
|
||||
const list = this.tableFields.dimensionListData.concat(this.tableFields.quotaListData)
|
||||
batchEdit(list).then(response => {
|
||||
// this.closeEdit()
|
||||
// const list = this.tableFields.dimensionListData.concat(this.tableFields.quotaListData)
|
||||
// batchEdit(list).then(response => {
|
||||
// // this.closeEdit()
|
||||
// this.initField()
|
||||
// })
|
||||
|
||||
post('/dataset/field/save', item).then(response => {
|
||||
this.initField()
|
||||
})
|
||||
},
|
||||
|
||||
closeEdit() {
|
||||
this.$emit('switchComponent', { name: 'ViewTable', param: this.param })
|
||||
},
|
||||
|
||||
dqTrans(item, val) {
|
||||
if (val === 'd') {
|
||||
item.groupType = 'q'
|
||||
} else if (val === 'q') {
|
||||
item.groupType = 'd'
|
||||
}
|
||||
this.saveEdit()
|
||||
this.saveEdit(item)
|
||||
},
|
||||
|
||||
addCalcField() {
|
||||
this.currEditField = {}
|
||||
this.editCalcField = true
|
||||
},
|
||||
|
||||
closeCalcField() {
|
||||
this.editCalcField = false
|
||||
this.initField()
|
||||
},
|
||||
|
||||
filterField(val) {
|
||||
@ -353,6 +360,29 @@ export default {
|
||||
this.tableFields.dimensionListData = JSON.parse(JSON.stringify(this.tableFields.dimensionList))
|
||||
this.tableFields.quotaListData = JSON.parse(JSON.stringify(this.tableFields.quotaList))
|
||||
}
|
||||
},
|
||||
|
||||
editField(item) {
|
||||
this.currEditField = item
|
||||
this.editCalcField = true
|
||||
},
|
||||
|
||||
deleteField(item) {
|
||||
this.$confirm(this.$t('dataset.confirm_delete'), this.$t('chart.tips'), {
|
||||
confirmButtonText: this.$t('dataset.confirm'),
|
||||
cancelButtonText: this.$t('dataset.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
post('/dataset/field/delete/' + item.id, null).then(response => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('chart.delete_success'),
|
||||
showClose: true
|
||||
})
|
||||
this.initField()
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -404,7 +434,4 @@ export default {
|
||||
.dialog-css>>>.el-dialog{
|
||||
width: 800px!important;
|
||||
}
|
||||
.dialog-css>>>.el-dialog__footer{
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-col>
|
||||
<el-row>
|
||||
<el-button v-if="hasDataPermission('manage',param.privileges) || table.type !== 'excel'" icon="el-icon-setting" size="mini" @click="showConfig">
|
||||
<el-button v-if="hasDataPermission('manage',param.privileges) && table.type !== 'excel'" icon="el-icon-setting" size="mini" @click="showConfig">
|
||||
{{ $t('dataset.update_setting') }}
|
||||
</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="refreshLog">
|
||||
@ -149,13 +149,12 @@
|
||||
|
||||
<el-form-item class="form-item">
|
||||
<el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()" >
|
||||
<el-option :label="$t('cron.minute')" value="minute" />
|
||||
<el-option :label="$t('cron.hour')" value="hour" />
|
||||
<el-option :label="$t('cron.day')" value="day" />
|
||||
<el-option :label="$t('cron.minute_default')" value="minute" />
|
||||
<el-option :label="$t('cron.hour_default')" value="hour" />
|
||||
<el-option :label="$t('cron.day_default')" value="day" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item" :label="$t('cron.every_exec')">
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item" :label="$t('cron.every_exec')" />
|
||||
</el-form>
|
||||
</el-form-item>
|
||||
|
||||
@ -534,12 +533,7 @@ export default {
|
||||
this.incrementalConfig.incrementalDelete = this.sql
|
||||
}
|
||||
this.incrementalConfig.tableId = this.table.id
|
||||
let startTime = new Date(task.startTime).getTime()
|
||||
if(startTime < new Date().getTime()){
|
||||
startTime = new Date().getTime()
|
||||
}
|
||||
task.startTime = startTime
|
||||
|
||||
task.startTime = new Date(task.startTime).getTime()
|
||||
task.endTime = new Date(task.endTime).getTime()
|
||||
task.tableId = this.table.id
|
||||
const form = JSON.parse(JSON.stringify(task))
|
||||
|
@ -44,7 +44,7 @@
|
||||
</el-row>
|
||||
<el-divider />
|
||||
|
||||
<el-tabs v-model="tabActive" @tab-click="initTable(param.id)">
|
||||
<el-tabs v-model="tabActive" @tab-click="tabClick">
|
||||
<el-tab-pane :label="$t('dataset.data_preview')" name="dataPreview">
|
||||
<tab-data-preview :param="param" :table="table" :fields="fields" :data="data" :page="page" :form="tableViewRowForm" @reSearch="reSearch" />
|
||||
</el-tab-pane>
|
||||
@ -62,7 +62,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTable, post } from '@/api/dataset/dataset'
|
||||
import { post } from '@/api/dataset/dataset'
|
||||
import TabDataPreview from './TabDataPreview'
|
||||
import UpdateInfo from './UpdateInfo'
|
||||
import DatasetChartDetail from '../common/DatasetChartDetail'
|
||||
@ -207,6 +207,12 @@ export default {
|
||||
pageSize: 100,
|
||||
show: 1000
|
||||
}
|
||||
},
|
||||
|
||||
tabClick() {
|
||||
if (this.tabActive === 'dataPreview') {
|
||||
this.initTable(this.param.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="input-layout">
|
||||
<div class="input-main">
|
||||
<div class="div-input">
|
||||
<el-form ref="pwdForm" :model="form" :rules="rule" size="small">
|
||||
<el-form ref="pwdForm" :model="form" :rules="rule" size="small" @submit.native.prevent>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="form.password" maxlength="4" show-password class="real-input" :placeholder="$t('pblink.input_placeholder')" />
|
||||
</el-form-item>
|
||||
@ -65,8 +65,25 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.bindKey()
|
||||
},
|
||||
destroyed() {
|
||||
this.unBindKey()
|
||||
},
|
||||
methods: {
|
||||
entryKey(event) {
|
||||
const keyCode = event.keyCode
|
||||
if (keyCode === 13) {
|
||||
this.refresh()
|
||||
}
|
||||
},
|
||||
bindKey() {
|
||||
document.addEventListener('keypress', this.entryKey)
|
||||
},
|
||||
unBindKey() {
|
||||
document.removeEventListener('keypress', this.entryKey)
|
||||
},
|
||||
// 验证密码是否正确 如果正确 设置请求头部带LINK-PWD-TOKEN=entrypt(pwd)再刷新页面
|
||||
refresh() {
|
||||
this.$refs.pwdForm.validate(valid => {
|
||||
|
@ -55,6 +55,7 @@ import { query, updateStatus } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import bus from '@/utils/bus'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LayoutContent,
|
||||
@ -82,6 +83,11 @@ export default {
|
||||
orderConditions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permission_routes'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
@ -120,8 +126,21 @@ export default {
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
if (this.hasPermissionRoute(row.router)) {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
row.status || this.setReaded(row)
|
||||
return
|
||||
}
|
||||
this.$warning(this.$t('commons.no_target_permission'))
|
||||
},
|
||||
hasPermissionRoute(name, permission_routes) {
|
||||
permission_routes = permission_routes || this.permission_routes
|
||||
for (let index = 0; index < permission_routes.length; index++) {
|
||||
const route = permission_routes[index]
|
||||
if (route.name && route.name === name) return true
|
||||
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
// 设置已读
|
||||
setReaded(row) {
|
||||
|
@ -60,6 +60,7 @@ import ComplexTable from '@/components/business/complex-table'
|
||||
import { query } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LayoutContent,
|
||||
@ -87,6 +88,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permission_routes'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
@ -125,7 +131,21 @@ export default {
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
// this.$router.push({ name: row.router, params: param })
|
||||
if (this.hasPermissionRoute(row.router)) {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
return
|
||||
}
|
||||
this.$warning(this.$t('commons.no_target_permission'))
|
||||
},
|
||||
hasPermissionRoute(name, permission_routes) {
|
||||
permission_routes = permission_routes || this.permission_routes
|
||||
for (let index = 0; index < permission_routes.length; index++) {
|
||||
const route = permission_routes[index]
|
||||
if (route.name && route.name === name) return true
|
||||
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
sortChange({ column, prop, order }) {
|
||||
this.orderConditions = []
|
||||
|
@ -65,7 +65,7 @@ import { query, updateStatus, batchRead } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import bus from '@/utils/bus'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LayoutContent,
|
||||
@ -98,6 +98,11 @@ export default {
|
||||
orderConditions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permission_routes'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
@ -136,8 +141,23 @@ export default {
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
// this.$router.push({ name: row.router, params: param })
|
||||
// this.setReaded(row)
|
||||
if (this.hasPermissionRoute(row.router)) {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
this.setReaded(row)
|
||||
return
|
||||
}
|
||||
this.$warning(this.$t('commons.no_target_permission'))
|
||||
},
|
||||
hasPermissionRoute(name, permission_routes) {
|
||||
permission_routes = permission_routes || this.permission_routes
|
||||
for (let index = 0; index < permission_routes.length; index++) {
|
||||
const route = permission_routes[index]
|
||||
if (route.name && route.name === name) return true
|
||||
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
// 设置已读
|
||||
setReaded(row) {
|
||||
@ -153,7 +173,7 @@ export default {
|
||||
}
|
||||
const param = this.multipleSelection.map(item => item.msgId)
|
||||
batchRead(param).then(res => {
|
||||
this.$success('webmsg.mark_success')
|
||||
this.$success(this.$t('webmsg.mark_success'))
|
||||
this.search()
|
||||
})
|
||||
},
|
||||
|
@ -232,7 +232,7 @@ export default {
|
||||
height: 24px;
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
font-size: 24px;
|
||||
font-size: 24px !important;
|
||||
margin: auto;
|
||||
font-family: fineui;
|
||||
font-style: normal;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-col>
|
||||
<el-row style="margin-top: 10px;">
|
||||
<complex-table :data="data" :columns="columns" local-key="datasetTask" :search-config="searchConfig" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange">
|
||||
<el-row style="margin-top: 10px;" v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
<complex-table :data="data" :columns="columns" local-key="datasetTask" :transCondition="transCondition" :search-config="searchConfig" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange">
|
||||
<template #toolbar>
|
||||
<el-button icon="el-icon-circle-plus-outline" @click="selectDataset">{{ $t('dataset.task.create') }}</el-button>
|
||||
</template>
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
<el-table-column prop="nextExecTime" :label="$t('dataset.task.next_exec_time')">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.nextExecTime && scope.row.nextExecTime !== -1 && scope.row.rate !== 'SIMPLE'">
|
||||
<span v-if="scope.row.nextExecTime && scope.row.nextExecTime !== -1 && scope.row.rate !== 'SIMPLE'&& scope.row.status !== 'Pending'">
|
||||
{{ scope.row.nextExecTime | timestampFormatDate }}
|
||||
</span>
|
||||
<span v-if="!scope.row.nextExecTime || scope.row.rate === 'SIMPLE'" />
|
||||
@ -168,7 +168,7 @@
|
||||
|
||||
<!--添加任务-选择数据集-->
|
||||
<el-dialog v-dialogDrag :title="$t('dataset.task.create')" :visible="selectDatasetFlag" :show-close="false" width="70%" class="dialog-css" :destroy-on-close="true">
|
||||
<table-selector @getTable="getTable" :mode="1" :customType=customType showMode="datasetTask"/>
|
||||
<table-selector @getTable="getTable" privileges="manage" :mode="1" :customType=customType showMode="datasetTask"/>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeCreateTask">{{ $t('chart.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" :disabled="!table.id" @click="create(undefined)">{{ $t('chart.confirm') }}</el-button>
|
||||
@ -215,6 +215,7 @@ import 'codemirror/addon/hint/sql-hint'
|
||||
import 'codemirror/addon/hint/show-hint'
|
||||
import cron from '@/components/cron/cron'
|
||||
import TableSelector from '@/views/chart/view/TableSelector'
|
||||
import { hasDataPermission } from '@/utils/permission'
|
||||
|
||||
export default {
|
||||
name: 'DatasetTaskList',
|
||||
@ -223,6 +224,10 @@ export default {
|
||||
param: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
transCondition: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -251,7 +256,7 @@ export default {
|
||||
label: this.$t('dataset.task.exec'), icon: 'el-icon-video-play', type: 'success', click: this.execTask, disabled: this.disableExec
|
||||
},
|
||||
{
|
||||
label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.deleteTask
|
||||
label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.deleteTask, disabled: this.disableDelete
|
||||
}
|
||||
],
|
||||
searchConfig: {
|
||||
@ -259,8 +264,9 @@ export default {
|
||||
useComplexSearch: true,
|
||||
quickPlaceholder: this.$t('dataset.task.search_by_name'),
|
||||
components: [
|
||||
{ field: 'dataset_table.name', label: this.$t('dataset.name'), component: 'DeComplexInput' },
|
||||
{ field: 'dataset_table_task.name', label: this.$t('dataset.task_name'), component: 'DeComplexInput'},
|
||||
{ field: 'dataset_table_task.id', label: this.$t('dataset.task_id'), component: 'FuComplexInput' },
|
||||
{ field: 'dataset_table.name', label: this.$t('dataset.name'), component: 'DeComplexInput' },
|
||||
{ field: 'dataset_table_task.status', label: this.$t('dataset.task.task_status'), component: 'FuComplexSelect',
|
||||
options: [{ label: this.$t('dataset.task.stopped'), value: 'Stopped' }, { label: this.$t('dataset.task.underway'), value: 'Underway' }, { label: this.$t('dataset.task.pending'), value: 'Pending' }, { label: this.$t('dataset.underway'), value: 'Exec' }], multiple: false },
|
||||
{ field: 'dataset_table_task.last_exec_status', label: this.$t('dataset.task.last_exec_status'), component: 'FuComplexSelect', options: [{ label: this.$t('dataset.completed'), value: 'Completed' }, { label: this.$t('dataset.underway'), value: 'Underway' }, { label: this.$t('dataset.error'), value: 'Error' }], multiple: false }
|
||||
@ -343,19 +349,6 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.param == null) {
|
||||
this.last_condition = {}
|
||||
this.search()
|
||||
} else {
|
||||
this.last_condition = {
|
||||
'dataset_table_task.name': {
|
||||
field: 'dataset_table_task.name',
|
||||
operator: 'eq',
|
||||
value: this.param.name
|
||||
}
|
||||
}
|
||||
this.search(this.last_condition)
|
||||
}
|
||||
this.timer = setInterval(() => {
|
||||
this.search(this.last_condition, false)
|
||||
}, 5000)
|
||||
@ -559,10 +552,14 @@ export default {
|
||||
this.taskForm.cron = val
|
||||
},
|
||||
disableEdit(task) {
|
||||
return task.rate === 'SIMPLE' || task.status === 'Stopped'
|
||||
return task.rate === 'SIMPLE' || task.status === 'Stopped' || !hasDataPermission('manage',task.privileges)
|
||||
},
|
||||
disableExec(task) {
|
||||
return task.status === 'Stopped' || task.status === 'Pending' || task.rate === 'SIMPLE'
|
||||
return task.status === 'Stopped' || task.status === 'Pending' || task.rate === 'SIMPLE' || !hasDataPermission('manage',task.privileges)
|
||||
},
|
||||
disableDelete(task) {
|
||||
return false;
|
||||
// !hasDataPermission('manage',task.privileges)
|
||||
},
|
||||
deleteTask(task) {
|
||||
this.$confirm(this.$t('dataset.confirm_delete'), this.$t('dataset.tips'), {
|
||||
@ -628,12 +625,7 @@ export default {
|
||||
}
|
||||
this.incrementalConfig.tableId = task.tableId
|
||||
}
|
||||
|
||||
let startTime = new Date(task.startTime).getTime()
|
||||
if(startTime < new Date().getTime()){
|
||||
startTime = new Date().getTime()
|
||||
}
|
||||
task.startTime = startTime
|
||||
task.startTime = new Date(task.startTime).getTime()
|
||||
task.endTime = new Date(task.endTime).getTime()
|
||||
const form = JSON.parse(JSON.stringify(task))
|
||||
form.extraData = JSON.stringify(form.extraData)
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-col>
|
||||
<el-row style="margin-top: 10px;">
|
||||
<complex-table :data="data" :columns="columns" local-key="datasetTaskRecord" :search-config="searchConfig" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange">
|
||||
<el-row style="margin-top: 10px;" v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
<complex-table :data="data" :columns="columns" local-key="datasetTaskRecord" :search-config="searchConfig" :transCondition="transCondition" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange">
|
||||
<el-table-column prop="name" :label="$t('dataset.task_name')">
|
||||
<template slot-scope="scope">
|
||||
<span>
|
||||
@ -64,6 +64,10 @@ export default {
|
||||
param: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
transCondition: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -81,7 +85,8 @@ export default {
|
||||
useComplexSearch: true,
|
||||
quickPlaceholder: this.$t('dataset.task.search_by_name'),
|
||||
components: [
|
||||
{ field: 'dataset_table_task.name', label: this.$t('dataset.task_name'), component: 'DeComplexInput' },
|
||||
{ field: 'dataset_table_task.name', label: this.$t('dataset.task_name'), component: 'FuComplexInput' },
|
||||
{ field: 'dataset_table_task.id', label: this.$t('dataset.task_id'), component: 'FuComplexInput' },
|
||||
{ field: 'dataset_table.name', label: this.$t('dataset.name'), component: 'DeComplexInput' },
|
||||
{ field: 'dataset_table_task_log.status', label: this.$t('commons.status'), component: 'FuComplexSelect', options: [{ label: this.$t('dataset.completed'), value: 'Completed' }, { label: this.$t('dataset.underway'), value: 'Underway' }, { label: this.$t('dataset.error'), value: 'Error' }], multiple: false }
|
||||
]
|
||||
@ -117,37 +122,16 @@ export default {
|
||||
computed: {
|
||||
},
|
||||
created() {
|
||||
if (this.param == null) {
|
||||
this.last_condition = {}
|
||||
this.search()
|
||||
} else if (this.param.name) {
|
||||
this.last_condition = {
|
||||
'dataset_table_task.name': {
|
||||
field: 'dataset_table_task.name',
|
||||
operator: 'eq',
|
||||
value: this.param.name
|
||||
}
|
||||
}
|
||||
this.search(this.last_condition)
|
||||
} else if (this.param.taskId) {
|
||||
if (this.param !== null && this.param.taskId) {
|
||||
this.matchLogId = this.param.logId || this.matchLogId
|
||||
this.last_condition = {
|
||||
'dataset_table_task.id': {
|
||||
field: 'dataset_table_task.id',
|
||||
this.transCondition['dataset_table_task.id'] = {
|
||||
operator: 'eq',
|
||||
value: this.param.taskId
|
||||
}
|
||||
}
|
||||
this.search(this.last_condition)
|
||||
}
|
||||
|
||||
// this.timer = setInterval(() => {
|
||||
// this.search(this.last_condition, false)
|
||||
// }, 5000)
|
||||
this.createTimer()
|
||||
},
|
||||
beforeDestroy() {
|
||||
// clearInterval(this.timer)
|
||||
this.destroyTimer()
|
||||
},
|
||||
methods: {
|
||||
@ -164,25 +148,6 @@ export default {
|
||||
this.timer = null
|
||||
}
|
||||
},
|
||||
// msg2Current(routerParam) {
|
||||
// if (!routerParam || !routerParam.taskId) return
|
||||
// const taskId = routerParam.taskId
|
||||
// // console.log(taskId)
|
||||
// const current_condition = {
|
||||
// 'dataset_table_task.id': {
|
||||
// field: 'dataset_table_task.id',
|
||||
// operator: 'eq',
|
||||
// value: taskId
|
||||
// }
|
||||
// }
|
||||
// // 先把定时器干掉 否则会阻塞下面的search
|
||||
// this.destroyTimer()
|
||||
|
||||
// this.search(current_condition)
|
||||
|
||||
// // 查询完再开启定时器
|
||||
// this.createTimer()
|
||||
// },
|
||||
sortChange({ column, prop, order }) {
|
||||
this.orderConditions = []
|
||||
if (!order) {
|
||||
|
@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
|
||||
<layout-content>
|
||||
|
||||
<el-row style="height: 100%;width: 100%;">
|
||||
<el-tabs v-model="tabActive" @tab-click="changeTab">
|
||||
<el-tab-pane :label="$t('dataset.task.list')" name="DatasetTaskList">
|
||||
<dataset-task-list v-if="tabActive=='DatasetTaskList'" :param="task" @jumpTaskRecord="jumpTaskRecord" />
|
||||
<dataset-task-list v-if="tabActive=='DatasetTaskList'" :param="task" :transCondition="transCondition" @jumpTaskRecord="jumpTaskRecord" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('dataset.task.record')" name="TaskRecord">
|
||||
<task-record v-if="tabActive=='TaskRecord'" ref="task_record" :param="task" @jumpTask="jumpTask" />
|
||||
<task-record v-if="tabActive=='TaskRecord'" ref="task_record" :param="task" :trans-condition="transCondition" @jumpTask="jumpTask" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-row>
|
||||
@ -27,8 +27,9 @@ export default {
|
||||
components: { LayoutContent, DatasetTaskList, TaskRecord },
|
||||
data() {
|
||||
return {
|
||||
task: null,
|
||||
tabActive: 'DatasetTaskList'
|
||||
tabActive: 'DatasetTaskList',
|
||||
transCondition: {},
|
||||
task: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -51,14 +52,20 @@ export default {
|
||||
methods: {
|
||||
changeTab() {
|
||||
this.task = null
|
||||
console.log(this.tabActive)
|
||||
this.transCondition = {}
|
||||
},
|
||||
jumpTaskRecord(task) {
|
||||
this.task = task
|
||||
this.transCondition['dataset_table_task.id'] = {
|
||||
operator: 'eq',
|
||||
value: task.id
|
||||
}
|
||||
this.tabActive = 'TaskRecord'
|
||||
},
|
||||
jumpTask(task) {
|
||||
this.task = task
|
||||
jumpTask(taskRecord) {
|
||||
this.transCondition['dataset_table_task.id'] = {
|
||||
operator: 'eq',
|
||||
value: taskRecord.taskId
|
||||
}
|
||||
this.tabActive = 'DatasetTaskList'
|
||||
},
|
||||
toMsgShare(routerParam) {
|
||||
|
Loading…
Reference in New Issue
Block a user