Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
wangjiahao 2021-05-31 11:20:43 +08:00
commit cfd8e6eb2b
70 changed files with 1914 additions and 219 deletions

View File

@ -351,6 +351,13 @@
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<!--由于暂时插件接口未注册到公司仓库请先down下代码安装到本地仓库
https://github.com/dataease/dataease-plugins-->
<dependency>
<groupId>io.dataease</groupId>
<artifactId>dataease-plugin-xpack</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>

View File

@ -29,6 +29,8 @@ public class DynamicMenuDto implements Serializable {
private Integer type;
private Boolean isPlugin;
private List<DynamicMenuDto> children;
}

View File

@ -13,9 +13,11 @@ import io.dataease.auth.util.RsaUtil;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.ServletUtils;
/*import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.service.DePluginXpackService;*/
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
@ -108,14 +110,15 @@ public class AuthServer implements AuthApi {
SysUserEntity userById = authUserService.getUserById(4L);
String nickName = userById.getNickName();
// System.out.println(nickName);
/* Map<String, DePluginXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DePluginXpackService.class);
Map<String, DisPlayXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DisPlayXpackService.class);
for (Map.Entry entry : beansOfType.entrySet()) {
Object key = entry.getKey();
DePluginXpackService value = (DePluginXpackService)entry.getValue();
DisPlayXpackService value = (DisPlayXpackService)entry.getValue();
List<SysSettingDto> sysSettingDtos = value.systemSettings();
String name = entry.getValue().getClass().getName();
System.out.println("key: "+ key + ", value: "+ name);
}*/
}
return "apple";
}
}

View File

@ -5,6 +5,11 @@ import io.dataease.auth.entity.SysUserEntity;
import io.dataease.base.mapper.ext.AuthMapper;
import io.dataease.auth.service.AuthUserService;
import io.dataease.commons.constants.AuthConstants;
import io.dataease.plugins.common.dto.PluginSysMenu;
import io.dataease.plugins.common.service.PluginMenuService;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.util.PluginUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@ -53,6 +58,14 @@ public class AuthUserServiceImpl implements AuthUserService {
@Override
public List<String> permissions(Long userId){
List<String> permissions = authMapper.permissions(userId);
List<PluginSysMenu> pluginSysMenus = PluginUtils.pluginMenus();
if (CollectionUtils.isNotEmpty(pluginSysMenus)) {
List<Long> menuIds = authMapper.userMenuIds(userId);
List<String> pluginPermissions = pluginSysMenus.stream().
filter(sysMenu -> menuIds.contains(sysMenu.getMenuId()))
.map(menu -> menu.getPermission()).collect(Collectors.toList());
permissions.addAll(pluginPermissions);
}
return permissions.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList());
}

View File

@ -6,6 +6,9 @@ import io.dataease.auth.service.DynamicMenuService;
import io.dataease.base.domain.SysMenu;
import io.dataease.base.domain.SysMenuExample;
import io.dataease.base.mapper.SysMenuMapper;
import io.dataease.plugins.common.dto.PluginSysMenu;
import io.dataease.plugins.util.PluginUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -25,6 +28,12 @@ public class DynamicMenuServiceImpl implements DynamicMenuService {
sysMenuExample.setOrderByClause(" menu_sort ");
List<SysMenu> sysMenus = sysMenuMapper.selectByExample(sysMenuExample);
List<DynamicMenuDto> dynamicMenuDtos = sysMenus.stream().map(this::convert).collect(Collectors.toList());
//增加插件中的菜单
List<PluginSysMenu> pluginSysMenus = PluginUtils.pluginMenus();
if (CollectionUtils.isNotEmpty(pluginSysMenus) ) {
List<DynamicMenuDto> pluginDtos = pluginSysMenus.stream().map(this::convert).collect(Collectors.toList());
dynamicMenuDtos.addAll(pluginDtos);
}
List<DynamicMenuDto> result = buildTree(dynamicMenuDtos);
return result;
}
@ -44,6 +53,25 @@ public class DynamicMenuServiceImpl implements DynamicMenuService {
dynamicMenuDto.setMeta(menuMeta);
dynamicMenuDto.setPermission(sysMenu.getPermission());
dynamicMenuDto.setHidden(sysMenu.getHidden());
dynamicMenuDto.setIsPlugin(false);
return dynamicMenuDto;
}
private DynamicMenuDto convert(PluginSysMenu sysMenu){
DynamicMenuDto dynamicMenuDto = new DynamicMenuDto();
dynamicMenuDto.setId(sysMenu.getMenuId());
dynamicMenuDto.setPid(sysMenu.getPid());
dynamicMenuDto.setName(sysMenu.getName());
dynamicMenuDto.setPath(sysMenu.getPath());
dynamicMenuDto.setRedirect(null);
dynamicMenuDto.setType(sysMenu.getType());
dynamicMenuDto.setComponent(sysMenu.getComponent());
MenuMeta menuMeta = new MenuMeta();
menuMeta.setTitle(sysMenu.getTitle());
menuMeta.setIcon(sysMenu.getIcon());
dynamicMenuDto.setMeta(menuMeta);
dynamicMenuDto.setPermission(sysMenu.getPermission());
dynamicMenuDto.setHidden(sysMenu.getHidden());
dynamicMenuDto.setIsPlugin(true);
return dynamicMenuDto;
}

View File

@ -47,7 +47,7 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap.put("/system/ui/**", ANON);
filterChainDefinitionMap.put("/PluginDemo.js", ANON);
filterChainDefinitionMap.put("/SystemParam.js", ANON);
filterChainDefinitionMap.put("/DeXPack.js", ANON);
filterChainDefinitionMap.put("/api/auth/test", ANON);

View File

@ -21,6 +21,8 @@ public class DatasetTable implements Serializable {
private Long createTime;
private String qrtzInstance;
private String syncStatus;
private String info;

View File

@ -644,6 +644,76 @@ public class DatasetTableExample {
return (Criteria) this;
}
public Criteria andQrtzInstanceIsNull() {
addCriterion("qrtz_instance is null");
return (Criteria) this;
}
public Criteria andQrtzInstanceIsNotNull() {
addCriterion("qrtz_instance is not null");
return (Criteria) this;
}
public Criteria andQrtzInstanceEqualTo(String value) {
addCriterion("qrtz_instance =", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceNotEqualTo(String value) {
addCriterion("qrtz_instance <>", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceGreaterThan(String value) {
addCriterion("qrtz_instance >", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceGreaterThanOrEqualTo(String value) {
addCriterion("qrtz_instance >=", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceLessThan(String value) {
addCriterion("qrtz_instance <", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceLessThanOrEqualTo(String value) {
addCriterion("qrtz_instance <=", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceLike(String value) {
addCriterion("qrtz_instance like", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceNotLike(String value) {
addCriterion("qrtz_instance not like", value, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceIn(List<String> values) {
addCriterion("qrtz_instance in", values, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceNotIn(List<String> values) {
addCriterion("qrtz_instance not in", values, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceBetween(String value1, String value2) {
addCriterion("qrtz_instance between", value1, value2, "qrtzInstance");
return (Criteria) this;
}
public Criteria andQrtzInstanceNotBetween(String value1, String value2) {
addCriterion("qrtz_instance not between", value1, value2, "qrtzInstance");
return (Criteria) this;
}
public Criteria andSyncStatusIsNull() {
addCriterion("sync_status is null");
return (Criteria) this;

View File

@ -21,6 +21,8 @@ public class MyPlugin implements Serializable {
private String creator;
private Boolean loadMybatis;
private Long releaseTime;
private Long installTime;

View File

@ -624,6 +624,66 @@ public class MyPluginExample {
return (Criteria) this;
}
public Criteria andLoadMybatisIsNull() {
addCriterion("load_mybatis is null");
return (Criteria) this;
}
public Criteria andLoadMybatisIsNotNull() {
addCriterion("load_mybatis is not null");
return (Criteria) this;
}
public Criteria andLoadMybatisEqualTo(Boolean value) {
addCriterion("load_mybatis =", value, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisNotEqualTo(Boolean value) {
addCriterion("load_mybatis <>", value, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisGreaterThan(Boolean value) {
addCriterion("load_mybatis >", value, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisGreaterThanOrEqualTo(Boolean value) {
addCriterion("load_mybatis >=", value, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisLessThan(Boolean value) {
addCriterion("load_mybatis <", value, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisLessThanOrEqualTo(Boolean value) {
addCriterion("load_mybatis <=", value, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisIn(List<Boolean> values) {
addCriterion("load_mybatis in", values, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisNotIn(List<Boolean> values) {
addCriterion("load_mybatis not in", values, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisBetween(Boolean value1, Boolean value2) {
addCriterion("load_mybatis between", value1, value2, "loadMybatis");
return (Criteria) this;
}
public Criteria andLoadMybatisNotBetween(Boolean value1, Boolean value2) {
addCriterion("load_mybatis not between", value1, value2, "loadMybatis");
return (Criteria) this;
}
public Criteria andReleaseTimeIsNull() {
addCriterion("release_time is null");
return (Criteria) this;

View File

@ -0,0 +1,17 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class QrtzSchedulerState extends QrtzSchedulerStateKey implements Serializable {
private Long lastCheckinTime;
private Long checkinInterval;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,460 @@
package io.dataease.base.domain;
import java.util.ArrayList;
import java.util.List;
public class QrtzSchedulerStateExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public QrtzSchedulerStateExample() {
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 andSchedNameIsNull() {
addCriterion("SCHED_NAME is null");
return (Criteria) this;
}
public Criteria andSchedNameIsNotNull() {
addCriterion("SCHED_NAME is not null");
return (Criteria) this;
}
public Criteria andSchedNameEqualTo(String value) {
addCriterion("SCHED_NAME =", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameNotEqualTo(String value) {
addCriterion("SCHED_NAME <>", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameGreaterThan(String value) {
addCriterion("SCHED_NAME >", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameGreaterThanOrEqualTo(String value) {
addCriterion("SCHED_NAME >=", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameLessThan(String value) {
addCriterion("SCHED_NAME <", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameLessThanOrEqualTo(String value) {
addCriterion("SCHED_NAME <=", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameLike(String value) {
addCriterion("SCHED_NAME like", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameNotLike(String value) {
addCriterion("SCHED_NAME not like", value, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameIn(List<String> values) {
addCriterion("SCHED_NAME in", values, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameNotIn(List<String> values) {
addCriterion("SCHED_NAME not in", values, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameBetween(String value1, String value2) {
addCriterion("SCHED_NAME between", value1, value2, "schedName");
return (Criteria) this;
}
public Criteria andSchedNameNotBetween(String value1, String value2) {
addCriterion("SCHED_NAME not between", value1, value2, "schedName");
return (Criteria) this;
}
public Criteria andInstanceNameIsNull() {
addCriterion("INSTANCE_NAME is null");
return (Criteria) this;
}
public Criteria andInstanceNameIsNotNull() {
addCriterion("INSTANCE_NAME is not null");
return (Criteria) this;
}
public Criteria andInstanceNameEqualTo(String value) {
addCriterion("INSTANCE_NAME =", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameNotEqualTo(String value) {
addCriterion("INSTANCE_NAME <>", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameGreaterThan(String value) {
addCriterion("INSTANCE_NAME >", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameGreaterThanOrEqualTo(String value) {
addCriterion("INSTANCE_NAME >=", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameLessThan(String value) {
addCriterion("INSTANCE_NAME <", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameLessThanOrEqualTo(String value) {
addCriterion("INSTANCE_NAME <=", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameLike(String value) {
addCriterion("INSTANCE_NAME like", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameNotLike(String value) {
addCriterion("INSTANCE_NAME not like", value, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameIn(List<String> values) {
addCriterion("INSTANCE_NAME in", values, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameNotIn(List<String> values) {
addCriterion("INSTANCE_NAME not in", values, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameBetween(String value1, String value2) {
addCriterion("INSTANCE_NAME between", value1, value2, "instanceName");
return (Criteria) this;
}
public Criteria andInstanceNameNotBetween(String value1, String value2) {
addCriterion("INSTANCE_NAME not between", value1, value2, "instanceName");
return (Criteria) this;
}
public Criteria andLastCheckinTimeIsNull() {
addCriterion("LAST_CHECKIN_TIME is null");
return (Criteria) this;
}
public Criteria andLastCheckinTimeIsNotNull() {
addCriterion("LAST_CHECKIN_TIME is not null");
return (Criteria) this;
}
public Criteria andLastCheckinTimeEqualTo(Long value) {
addCriterion("LAST_CHECKIN_TIME =", value, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeNotEqualTo(Long value) {
addCriterion("LAST_CHECKIN_TIME <>", value, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeGreaterThan(Long value) {
addCriterion("LAST_CHECKIN_TIME >", value, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeGreaterThanOrEqualTo(Long value) {
addCriterion("LAST_CHECKIN_TIME >=", value, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeLessThan(Long value) {
addCriterion("LAST_CHECKIN_TIME <", value, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeLessThanOrEqualTo(Long value) {
addCriterion("LAST_CHECKIN_TIME <=", value, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeIn(List<Long> values) {
addCriterion("LAST_CHECKIN_TIME in", values, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeNotIn(List<Long> values) {
addCriterion("LAST_CHECKIN_TIME not in", values, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeBetween(Long value1, Long value2) {
addCriterion("LAST_CHECKIN_TIME between", value1, value2, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andLastCheckinTimeNotBetween(Long value1, Long value2) {
addCriterion("LAST_CHECKIN_TIME not between", value1, value2, "lastCheckinTime");
return (Criteria) this;
}
public Criteria andCheckinIntervalIsNull() {
addCriterion("CHECKIN_INTERVAL is null");
return (Criteria) this;
}
public Criteria andCheckinIntervalIsNotNull() {
addCriterion("CHECKIN_INTERVAL is not null");
return (Criteria) this;
}
public Criteria andCheckinIntervalEqualTo(Long value) {
addCriterion("CHECKIN_INTERVAL =", value, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalNotEqualTo(Long value) {
addCriterion("CHECKIN_INTERVAL <>", value, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalGreaterThan(Long value) {
addCriterion("CHECKIN_INTERVAL >", value, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalGreaterThanOrEqualTo(Long value) {
addCriterion("CHECKIN_INTERVAL >=", value, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalLessThan(Long value) {
addCriterion("CHECKIN_INTERVAL <", value, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalLessThanOrEqualTo(Long value) {
addCriterion("CHECKIN_INTERVAL <=", value, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalIn(List<Long> values) {
addCriterion("CHECKIN_INTERVAL in", values, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalNotIn(List<Long> values) {
addCriterion("CHECKIN_INTERVAL not in", values, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalBetween(Long value1, Long value2) {
addCriterion("CHECKIN_INTERVAL between", value1, value2, "checkinInterval");
return (Criteria) this;
}
public Criteria andCheckinIntervalNotBetween(Long value1, Long value2) {
addCriterion("CHECKIN_INTERVAL not between", value1, value2, "checkinInterval");
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);
}
}
}

View File

@ -0,0 +1,13 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class QrtzSchedulerStateKey implements Serializable {
private String schedName;
private String instanceName;
private static final long serialVersionUID = 1L;
}

View File

@ -10,6 +10,7 @@
<result column="mode" jdbcType="INTEGER" property="mode" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="qrtz_instance" jdbcType="VARCHAR" property="qrtzInstance" />
<result column="sync_status" jdbcType="VARCHAR" property="syncStatus" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.DatasetTable">
@ -74,7 +75,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, scene_id, data_source_id, `type`, `mode`, create_by, create_time, sync_status
id, `name`, scene_id, data_source_id, `type`, `mode`, create_by, create_time, qrtz_instance,
sync_status
</sql>
<sql id="Blob_Column_List">
info
@ -130,12 +132,12 @@
<insert id="insert" parameterType="io.dataease.base.domain.DatasetTable">
insert into dataset_table (id, `name`, scene_id,
data_source_id, `type`, `mode`,
create_by, create_time, sync_status,
info)
create_by, create_time, qrtz_instance,
sync_status, info)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{dataSourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{mode,jdbcType=INTEGER},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{syncStatus,jdbcType=VARCHAR},
#{info,jdbcType=LONGVARCHAR})
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{qrtzInstance,jdbcType=VARCHAR},
#{syncStatus,jdbcType=VARCHAR}, #{info,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTable">
insert into dataset_table
@ -164,6 +166,9 @@
<if test="createTime != null">
create_time,
</if>
<if test="qrtzInstance != null">
qrtz_instance,
</if>
<if test="syncStatus != null">
sync_status,
</if>
@ -196,6 +201,9 @@
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="qrtzInstance != null">
#{qrtzInstance,jdbcType=VARCHAR},
</if>
<if test="syncStatus != null">
#{syncStatus,jdbcType=VARCHAR},
</if>
@ -237,6 +245,9 @@
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.qrtzInstance != null">
qrtz_instance = #{record.qrtzInstance,jdbcType=VARCHAR},
</if>
<if test="record.syncStatus != null">
sync_status = #{record.syncStatus,jdbcType=VARCHAR},
</if>
@ -258,6 +269,7 @@
`mode` = #{record.mode,jdbcType=INTEGER},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
qrtz_instance = #{record.qrtzInstance,jdbcType=VARCHAR},
sync_status = #{record.syncStatus,jdbcType=VARCHAR},
info = #{record.info,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -274,6 +286,7 @@
`mode` = #{record.mode,jdbcType=INTEGER},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
qrtz_instance = #{record.qrtzInstance,jdbcType=VARCHAR},
sync_status = #{record.syncStatus,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -303,6 +316,9 @@
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="qrtzInstance != null">
qrtz_instance = #{qrtzInstance,jdbcType=VARCHAR},
</if>
<if test="syncStatus != null">
sync_status = #{syncStatus,jdbcType=VARCHAR},
</if>
@ -321,6 +337,7 @@
`mode` = #{mode,jdbcType=INTEGER},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
qrtz_instance = #{qrtzInstance,jdbcType=VARCHAR},
sync_status = #{syncStatus,jdbcType=VARCHAR},
info = #{info,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -334,6 +351,7 @@
`mode` = #{mode,jdbcType=INTEGER},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
qrtz_instance = #{qrtzInstance,jdbcType=VARCHAR},
sync_status = #{syncStatus,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>

View File

@ -10,6 +10,7 @@
<result column="version" jdbcType="VARCHAR" property="version" />
<result column="install_type" jdbcType="INTEGER" property="installType" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="load_mybatis" jdbcType="BIT" property="loadMybatis" />
<result column="release_time" jdbcType="BIGINT" property="releaseTime" />
<result column="install_time" jdbcType="BIGINT" property="installTime" />
<result column="module_name" jdbcType="VARCHAR" property="moduleName" />
@ -75,8 +76,8 @@
</where>
</sql>
<sql id="Base_Column_List">
plugin_id, `name`, `free`, cost, descript, version, install_type, creator, release_time,
install_time, module_name, bean_name, icon
plugin_id, `name`, `free`, cost, descript, version, install_type, creator, load_mybatis,
release_time, install_time, module_name, bean_name, icon
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.MyPluginExample" resultMap="BaseResultMap">
select
@ -111,14 +112,14 @@
<insert id="insert" parameterType="io.dataease.base.domain.MyPlugin">
insert into my_plugin (plugin_id, `name`, `free`,
cost, descript, version,
install_type, creator, release_time,
install_time, module_name, bean_name,
icon)
install_type, creator, load_mybatis,
release_time, install_time, module_name,
bean_name, icon)
values (#{pluginId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{free,jdbcType=BIT},
#{cost,jdbcType=INTEGER}, #{descript,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR},
#{installType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{releaseTime,jdbcType=BIGINT},
#{installTime,jdbcType=BIGINT}, #{moduleName,jdbcType=VARCHAR}, #{beanName,jdbcType=VARCHAR},
#{icon,jdbcType=VARCHAR})
#{installType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{loadMybatis,jdbcType=BIT},
#{releaseTime,jdbcType=BIGINT}, #{installTime,jdbcType=BIGINT}, #{moduleName,jdbcType=VARCHAR},
#{beanName,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.MyPlugin">
insert into my_plugin
@ -147,6 +148,9 @@
<if test="creator != null">
creator,
</if>
<if test="loadMybatis != null">
load_mybatis,
</if>
<if test="releaseTime != null">
release_time,
</if>
@ -188,6 +192,9 @@
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
<if test="loadMybatis != null">
#{loadMybatis,jdbcType=BIT},
</if>
<if test="releaseTime != null">
#{releaseTime,jdbcType=BIGINT},
</if>
@ -238,6 +245,9 @@
<if test="record.creator != null">
creator = #{record.creator,jdbcType=VARCHAR},
</if>
<if test="record.loadMybatis != null">
load_mybatis = #{record.loadMybatis,jdbcType=BIT},
</if>
<if test="record.releaseTime != null">
release_time = #{record.releaseTime,jdbcType=BIGINT},
</if>
@ -268,6 +278,7 @@
version = #{record.version,jdbcType=VARCHAR},
install_type = #{record.installType,jdbcType=INTEGER},
creator = #{record.creator,jdbcType=VARCHAR},
load_mybatis = #{record.loadMybatis,jdbcType=BIT},
release_time = #{record.releaseTime,jdbcType=BIGINT},
install_time = #{record.installTime,jdbcType=BIGINT},
module_name = #{record.moduleName,jdbcType=VARCHAR},
@ -301,6 +312,9 @@
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="loadMybatis != null">
load_mybatis = #{loadMybatis,jdbcType=BIT},
</if>
<if test="releaseTime != null">
release_time = #{releaseTime,jdbcType=BIGINT},
</if>
@ -328,6 +342,7 @@
version = #{version,jdbcType=VARCHAR},
install_type = #{installType,jdbcType=INTEGER},
creator = #{creator,jdbcType=VARCHAR},
load_mybatis = #{loadMybatis,jdbcType=BIT},
release_time = #{releaseTime,jdbcType=BIGINT},
install_time = #{installTime,jdbcType=BIGINT},
module_name = #{moduleName,jdbcType=VARCHAR},

View File

@ -0,0 +1,31 @@
package io.dataease.base.mapper;
import io.dataease.base.domain.QrtzSchedulerState;
import io.dataease.base.domain.QrtzSchedulerStateExample;
import io.dataease.base.domain.QrtzSchedulerStateKey;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface QrtzSchedulerStateMapper {
long countByExample(QrtzSchedulerStateExample example);
int deleteByExample(QrtzSchedulerStateExample example);
int deleteByPrimaryKey(QrtzSchedulerStateKey key);
int insert(QrtzSchedulerState record);
int insertSelective(QrtzSchedulerState record);
List<QrtzSchedulerState> selectByExample(QrtzSchedulerStateExample example);
QrtzSchedulerState selectByPrimaryKey(QrtzSchedulerStateKey key);
int updateByExampleSelective(@Param("record") QrtzSchedulerState record, @Param("example") QrtzSchedulerStateExample example);
int updateByExample(@Param("record") QrtzSchedulerState record, @Param("example") QrtzSchedulerStateExample example);
int updateByPrimaryKeySelective(QrtzSchedulerState record);
int updateByPrimaryKey(QrtzSchedulerState record);
}

View File

@ -0,0 +1,196 @@
<?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.QrtzSchedulerStateMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.QrtzSchedulerState">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" />
<id column="INSTANCE_NAME" jdbcType="VARCHAR" property="instanceName" />
<result column="LAST_CHECKIN_TIME" jdbcType="BIGINT" property="lastCheckinTime" />
<result column="CHECKIN_INTERVAL" jdbcType="BIGINT" property="checkinInterval" />
</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">
SCHED_NAME, INSTANCE_NAME, LAST_CHECKIN_TIME, CHECKIN_INTERVAL
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.QrtzSchedulerStateExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from qrtz_scheduler_state
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="io.dataease.base.domain.QrtzSchedulerStateKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from qrtz_scheduler_state
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and INSTANCE_NAME = #{instanceName,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="io.dataease.base.domain.QrtzSchedulerStateKey">
delete from qrtz_scheduler_state
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and INSTANCE_NAME = #{instanceName,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.QrtzSchedulerStateExample">
delete from qrtz_scheduler_state
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.QrtzSchedulerState">
insert into qrtz_scheduler_state (SCHED_NAME, INSTANCE_NAME, LAST_CHECKIN_TIME,
CHECKIN_INTERVAL)
values (#{schedName,jdbcType=VARCHAR}, #{instanceName,jdbcType=VARCHAR}, #{lastCheckinTime,jdbcType=BIGINT},
#{checkinInterval,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.QrtzSchedulerState">
insert into qrtz_scheduler_state
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null">
SCHED_NAME,
</if>
<if test="instanceName != null">
INSTANCE_NAME,
</if>
<if test="lastCheckinTime != null">
LAST_CHECKIN_TIME,
</if>
<if test="checkinInterval != null">
CHECKIN_INTERVAL,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null">
#{schedName,jdbcType=VARCHAR},
</if>
<if test="instanceName != null">
#{instanceName,jdbcType=VARCHAR},
</if>
<if test="lastCheckinTime != null">
#{lastCheckinTime,jdbcType=BIGINT},
</if>
<if test="checkinInterval != null">
#{checkinInterval,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.QrtzSchedulerStateExample" resultType="java.lang.Long">
select count(*) from qrtz_scheduler_state
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update qrtz_scheduler_state
<set>
<if test="record.schedName != null">
SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
</if>
<if test="record.instanceName != null">
INSTANCE_NAME = #{record.instanceName,jdbcType=VARCHAR},
</if>
<if test="record.lastCheckinTime != null">
LAST_CHECKIN_TIME = #{record.lastCheckinTime,jdbcType=BIGINT},
</if>
<if test="record.checkinInterval != null">
CHECKIN_INTERVAL = #{record.checkinInterval,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update qrtz_scheduler_state
set SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
INSTANCE_NAME = #{record.instanceName,jdbcType=VARCHAR},
LAST_CHECKIN_TIME = #{record.lastCheckinTime,jdbcType=BIGINT},
CHECKIN_INTERVAL = #{record.checkinInterval,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.QrtzSchedulerState">
update qrtz_scheduler_state
<set>
<if test="lastCheckinTime != null">
LAST_CHECKIN_TIME = #{lastCheckinTime,jdbcType=BIGINT},
</if>
<if test="checkinInterval != null">
CHECKIN_INTERVAL = #{checkinInterval,jdbcType=BIGINT},
</if>
</set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and INSTANCE_NAME = #{instanceName,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.QrtzSchedulerState">
update qrtz_scheduler_state
set LAST_CHECKIN_TIME = #{lastCheckinTime,jdbcType=BIGINT},
CHECKIN_INTERVAL = #{checkinInterval,jdbcType=BIGINT}
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and INSTANCE_NAME = #{instanceName,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -16,6 +16,8 @@ public interface AuthMapper {
List<String> permissions(@Param("userId") Long userId);
List<Long> userMenuIds(@Param("userId") Long userId);
SysUserEntity findUser(@Param("userId") Long userId);

View File

@ -42,6 +42,13 @@
where sur.user_id = #{userId}
</select>
<select id="userMenuIds" resultType="Long">
select srm.menu_id
from sys_roles_menus srm
left join sys_users_roles sur on sur.role_id = srm.role_id
where sur.user_id = #{userId}
</select>
<select id="roles" resultMap="roleMap">
select r.role_id, r.name
from sys_role r

View File

@ -4,6 +4,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.channels.FileChannel;
import java.util.Arrays;
public class DeFileUtils {
@ -112,4 +113,14 @@ public class DeFileUtils {
return null;
}
}
public static void deleteFile(String path) {
File file = new File(path);
if (file.exists()){
if (file.isDirectory()) {
Arrays.stream(file.listFiles()).forEach(item -> deleteFile(item.getAbsolutePath()));
}
file.delete();
}
}
}

View File

@ -17,7 +17,7 @@ import java.util.List;
import java.util.Properties;
@Configuration
@MapperScan(basePackages = {"io.dataease.base.mapper", "io.dataease.xpack.mapper"}, sqlSessionFactoryRef = "sqlSessionFactory")
@MapperScan(basePackages = {"io.dataease.base.mapper", "io.dataease.plugins"}, sqlSessionFactoryRef = "sqlSessionFactory")
@EnableTransactionManagement
public class MybatisConfig {

View File

@ -6,6 +6,7 @@ import io.dataease.base.domain.MyPlugin;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.request.PluginStatus;
import io.dataease.service.sys.PluginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -32,8 +33,21 @@ public class SysPluginController {
return PageUtils.setPageInfo(page, pluginService.query(request));
}
@ApiOperation("安装插件")
@PostMapping("upload")
public Map<String, Object> localUpload(@RequestParam("file") MultipartFile file) throws Exception {
return pluginService.localInstall(file);
}
@ApiOperation("卸载插件")
@PostMapping("/uninstall/{pluginId}")
public Boolean unInstall(@PathVariable Long pluginId) {
return pluginService.uninstall(pluginId);
}
@ApiOperation("切换插件状态")
@PostMapping("/changeStatus")
public Boolean changeStatus(@RequestBody PluginStatus pluginStatus) {
return pluginService.changeStatus(pluginStatus.getPluginId(), pluginStatus.getStatus());
}
}

View File

@ -0,0 +1,12 @@
package io.dataease.controller.sys.request;
import lombok.Data;
@Data
public class PluginStatus {
private Long pluginId;
private Boolean status;
}

View File

@ -18,6 +18,7 @@ import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.i18n.Translator;
import io.dataease.service.dataset.DataSetGroupService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -46,11 +47,7 @@ public class DatasourceService {
private CommonThreadPool commonThreadPool;
public Datasource addDatasource(Datasource datasource) {
DatasourceExample example = new DatasourceExample();
example.createCriteria().andNameEqualTo(datasource.getName());
if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) {
DEException.throwException("Exist data connection with the same name ");
}
checkName(datasource);
long currentTimeMillis = System.currentTimeMillis();
datasource.setId(UUID.randomUUID().toString());
datasource.setUpdateTime(currentTimeMillis);
@ -67,7 +64,7 @@ public class DatasourceService {
public List<DatasourceDTO> gridQuery(BaseGridRequest request) {
//如果没有查询条件增加一个默认的条件
if(CollectionUtils.isEmpty(request.getConditions())){
if (CollectionUtils.isEmpty(request.getConditions())) {
ConditionEntity conditionEntity = new ConditionEntity();
conditionEntity.setField("1");
conditionEntity.setOperator("eq");
@ -84,6 +81,7 @@ public class DatasourceService {
}
public void updateDatasource(Datasource datasource) {
checkName(datasource);
datasource.setCreateTime(null);
datasource.setUpdateTime(System.currentTimeMillis());
datasourceMapper.updateByPrimaryKeySelective(datasource);
@ -135,24 +133,36 @@ public class DatasourceService {
return datasourceMapper.selectByPrimaryKey(id);
}
public void initAllDataSourceConnectionPool(){
public void initAllDataSourceConnectionPool() {
List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample());
datasources.forEach(datasource -> {
try {
commonThreadPool.addTask(() ->{
commonThreadPool.addTask(() -> {
try {
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(datasource);
datasourceProvider.initDataSource(datasourceRequest);
LogUtil.error("Succsss to init datasource connection pool: " + datasource.getName());
LogUtil.info("Succsss to init datasource connection pool: " + datasource.getName());
}catch (Exception e){
LogUtil.error("Failed to init datasource connection pool: " + datasource.getName(), e);
}
});
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
});
}
private void checkName(Datasource datasource) {
DatasourceExample example = new DatasourceExample();
DatasourceExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(datasource.getName());
if (StringUtils.isNotEmpty(datasource.getId())) {
criteria.andIdNotEqualTo(datasource.getId());
}
if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) {
DEException.throwException(Translator.get("i18n_ds_name_exists"));
}
}
}

View File

@ -1,5 +1,6 @@
package io.dataease.job.sechedule;
import com.google.gson.Gson;
import io.dataease.commons.utils.LogUtil;
import org.quartz.*;

View File

@ -15,7 +15,7 @@ public class ExtractDataJob extends DeScheduleJob{
@Override
void businessExecute(JobExecutionContext context) {
extractDataService.extractData(datasetTableId, taskId, updateType);
extractDataService.extractData(datasetTableId, taskId, updateType, context);
}
}

View File

@ -1,7 +1,10 @@
package io.dataease.plugins.config;
import io.dataease.base.domain.MyPlugin;
import io.dataease.plugins.loader.ClassloaderResponsity;
import io.dataease.plugins.loader.ModuleClassLoader;
import io.dataease.plugins.loader.MybatisLoader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
@ -15,27 +18,27 @@ import java.util.Map;
@Component
public class LoadjarUtil {
public List<?> loadJar(String jarPath){
@Autowired
private MybatisLoader mybatisLoader;
public List<?> loadJar(String jarPath, MyPlugin myPlugin) throws Exception{
File jar = new File(jarPath);
URI uri = jar.toURI();
String moduleName = jarPath.substring(jarPath.lastIndexOf("/")+1,jarPath.lastIndexOf("."));
try {
if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){
ClassloaderResponsity.getInstance().removeClassLoader(moduleName);
}
ModuleClassLoader classLoader = new ModuleClassLoader(new URL[]{uri.toURL()}, Thread.currentThread().getContextClassLoader());
SpringContextUtil.getBeanFactory().setBeanClassLoader(classLoader);
Thread.currentThread().setContextClassLoader(classLoader);
classLoader.initBean();
ClassloaderResponsity.getInstance().addClassLoader(moduleName,classLoader);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){
ClassloaderResponsity.getInstance().removeClassLoader(moduleName);
}
ModuleClassLoader classLoader = new ModuleClassLoader(new URL[]{uri.toURL()}, Thread.currentThread().getContextClassLoader());
SpringContextUtil.getBeanFactory().setBeanClassLoader(classLoader);
Thread.currentThread().setContextClassLoader(classLoader);
classLoader.initBean();
mybatisLoader.loadMybatis(myPlugin);
ClassloaderResponsity.getInstance().addClassLoader(moduleName,classLoader);
return SpringContextUtil.getAllBean();
}

View File

@ -0,0 +1,53 @@
package io.dataease.plugins.config;
import io.dataease.base.domain.MyPlugin;
import io.dataease.commons.utils.DeFileUtils;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.service.sys.PluginService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.List;
@Component
public class PluginRunner implements ApplicationRunner {
@Value("${dataease.plugin.dir:/opt/dataease/plugins/}")
private String pluginDir;
@Autowired
private PluginService pluginService;
@Override
public void run(ApplicationArguments args) throws Exception {
// 执行加载插件逻辑
BaseGridRequest request = new BaseGridRequest();
List<MyPlugin> plugins = pluginService.query(request);
plugins.stream().forEach(plugin -> {
String name = plugin.getName();
String version = plugin.getVersion();
String versionDir = pluginDir + name + "/" + version + "/";
File fileDir = new File(versionDir);
File[] jarFiles = fileDir.listFiles(this::isPluginJar);
File jarFile = jarFiles[0];
String jarPath = jarFile.getAbsolutePath();
try {
pluginService.loadJar(jarPath, plugin);
} catch (Exception e) {
e.printStackTrace();
}
});
}
private boolean isPluginJar(File file) {
String name = file.getName();
return StringUtils.equals(DeFileUtils.getExtensionName(name), "jar");
}
}

View File

@ -1,6 +1,11 @@
package io.dataease.plugins.loader;
import io.dataease.plugins.common.annotation.PluginResultMap;
import io.dataease.plugins.config.SpringContextUtil;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.type.TypeAliasRegistry;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.stereotype.Component;
@ -53,15 +58,20 @@ public class ModuleClassLoader extends URLClassLoader {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if(findLoadedClass(name)==null){
return super.loadClass(name);
Class<?> aClass = super.loadClass(name);
Optional.ofNullable(aClass.getAnnotation(PluginResultMap.class)).ifPresent(anno -> {
SqlSessionFactory sqlSessionFactory = SpringContextUtil.getBean(SqlSessionFactory.class);
Configuration configuration = sqlSessionFactory.getConfiguration();
TypeAliasRegistry typeAliasRegistry = configuration.getTypeAliasRegistry();
typeAliasRegistry.registerAlias(name.toLowerCase(), aClass);
});
return aClass;
}else{
return cacheClassMap.get(name);
}
}
/**
* 方法描述 初始化类加载器保存字节码
* @method init
@ -76,8 +86,8 @@ public class ModuleClassLoader extends URLClassLoader {
JarEntry je = en.nextElement();
String name = je.getName();
//这里添加了路径扫描限制
if (name.endsWith(".class")) {
String className = name.replace(".class", "").replaceAll("/", ".");
if (name.endsWith(".class")) {String className = name.replace(".class", "").replaceAll("/", ".");
input = jarFile.getInputStream(je);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int bufferSize = 4096;
@ -89,6 +99,9 @@ public class ModuleClassLoader extends URLClassLoader {
byte[] classBytes = baos.toByteArray();
classBytesMap.put(className,classBytes);
}
/*if (name.endsWith(".xml")) {
loadMapperXml(name);
}*/
}
} catch (IOException e) {
e.printStackTrace();

View File

@ -0,0 +1,39 @@
package io.dataease.plugins.loader;
import io.dataease.plugins.config.SpringContextUtil;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class MyScanner implements BeanDefinitionRegistryPostProcessor {
@Resource
private MapperScannerConfigurer mapperScannerConfigurer;
private BeanDefinitionRegistry beanDefinitionRegistry;
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
this.beanDefinitionRegistry = beanDefinitionRegistry;
System.out.println("-----");
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
}
public void scanner() {
if (null == mapperScannerConfigurer){
mapperScannerConfigurer = SpringContextUtil.getBean(MapperScannerConfigurer.class);
}
mapperScannerConfigurer.postProcessBeanDefinitionRegistry(this.beanDefinitionRegistry);
}
}

View File

@ -0,0 +1,22 @@
package io.dataease.plugins.loader;
import io.dataease.base.domain.MyPlugin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class MybatisLoader {
@Autowired
private MyScanner myScanner;
public void loadMybatis(MyPlugin myPlugin) {
if (!myPlugin.getLoadMybatis()) return;
myScanner.scanner();
}
}

View File

@ -0,0 +1,32 @@
package io.dataease.plugins.server;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@RequestMapping("/api/display")
@RestController
public class DisplayServer {
@GetMapping("/uiInfo")
public List<SysSettingDto> uiInfo() {
DisPlayXpackService disPlayXpackService = SpringContextUtil.getBean(DisPlayXpackService.class);
return disPlayXpackService.systemSettings();
}
@PostMapping(value="/save", consumes = {"multipart/form-data"})
public void saveUIInfo(@RequestPart("request") Map<String,List<SysSettingDto>> systemParameterMap, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
DisPlayXpackService disPlayXpackService = SpringContextUtil.getBean(DisPlayXpackService.class);
disPlayXpackService.save(systemParameterMap, bodyFiles);
}
}

View File

@ -0,0 +1,65 @@
package io.dataease.plugins.server;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.plugins.common.dto.PluginSysMenu;
import io.dataease.plugins.common.service.PluginMenuService;
import io.dataease.plugins.config.SpringContextUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
@RestController
@RequestMapping("/api/pluginCommon")
public class PluginCommonServer {
@GetMapping("/async/{menuId}")
public void componentInfo(@PathVariable Long menuId) {
Map<String, PluginMenuService> pluginMenuServiceMap = SpringContextUtil.getApplicationContext().getBeansOfType(PluginMenuService.class);
pluginMenuServiceMap.values().stream().forEach(service -> {
AtomicReference<PluginSysMenu> atomicReference = new AtomicReference<>();
List<PluginSysMenu> menus = service.menus();
if (menus.stream().anyMatch(menu -> {
atomicReference.set(menu);
return menu.getMenuId() == menuId;
})) {
String jsName = atomicReference.get().getComponent();
HttpServletResponse response = ServletUtils.response();
BufferedInputStream bis = null;
InputStream inputStream = null;
OutputStream os = null; //输出流
try{
inputStream = service.vueResource(jsName);
byte[] buffer = new byte[1024];
os = response.getOutputStream();
bis = new BufferedInputStream(inputStream);
int i = bis.read(buffer);
while(i != -1){
os.write(buffer, 0, i);
i = bis.read(buffer);
}
os.flush();
}catch (Exception e) {
e.printStackTrace();
}finally {
try {
bis.close();
inputStream.close();
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return;
});
}
}

View File

@ -0,0 +1,54 @@
package io.dataease.plugins.server;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.plugins.common.entity.XpackGridRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.role.dto.response.XpackRoleDto;
import io.dataease.plugins.xpack.role.dto.response.XpackRoleItemDto;
import io.dataease.plugins.xpack.role.service.RoleXpackService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping("/plugin/role")
@RestController
public class RoleServer {
@PostMapping("/create")
public void create(@RequestBody XpackRoleDto role){
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
roleXpackService.save(role);
}
@PostMapping("/delete/{roleId}")
public void delete(@PathVariable("roleId") Long roleId){
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
roleXpackService.delete(roleId);
}
@PostMapping("/update")
public void update(@RequestBody XpackRoleDto role){
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
roleXpackService.update(role);
}
@PostMapping("/roleGrid/{goPage}/{pageSize}")
public Pager<List<XpackRoleDto>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody XpackGridRequest request) {
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
Pager<List<XpackRoleDto>> listPager = PageUtils.setPageInfo(page, roleXpackService.query(request));
return listPager;
}
@PostMapping("/all")
public List<XpackRoleItemDto> all() {
RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class);
return roleXpackService.allRoles();
}
}

View File

@ -0,0 +1,22 @@
package io.dataease.plugins.util;
import io.dataease.plugins.common.dto.PluginSysMenu;
import io.dataease.plugins.common.service.PluginMenuService;
import io.dataease.plugins.config.SpringContextUtil;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class PluginUtils {
public static List<PluginSysMenu> pluginMenus() {
Map<String, PluginMenuService> pluginMenuServiceMap = SpringContextUtil.getApplicationContext().getBeansOfType(PluginMenuService.class);
List<PluginSysMenu> menus = pluginMenuServiceMap.values().stream().flatMap(item -> item.menus().stream()).collect(Collectors.toList());
return menus;
}
}

View File

@ -66,9 +66,9 @@ public class FileService {
example2.createCriteria().andFileIdIn(ids);
fileContentMapper.deleteByExample(example2);
LoadTestFileExample example3 = new LoadTestFileExample();
/* LoadTestFileExample example3 = new LoadTestFileExample();
example3.createCriteria().andFileIdIn(ids);
loadTestFileMapper.deleteByExample(example3);
loadTestFileMapper.deleteByExample(example3);*/
}
public void deleteFileRelatedByIds(List<String> ids) {

View File

@ -1,11 +1,10 @@
package io.dataease.service.dataset;
import com.fit2cloud.quartz.anno.QuartzScheduled;
import com.google.gson.Gson;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.DatasetTableIncrementalConfigMapper;
import io.dataease.base.mapper.DatasetTableMapper;
import io.dataease.base.mapper.DatasourceMapper;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.ExtDataSetTableMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.utils.*;
@ -75,6 +74,10 @@ public class DataSetTableService {
private DataSetTableUnionService dataSetTableUnionService;
@Resource
private DataSetTableTaskLogService dataSetTableTaskLogService;
@Resource
private QrtzSchedulerStateMapper qrtzSchedulerStateMapper;
@Resource
private DatasetTableTaskLogMapper datasetTableTaskLogMapper;
@Value("${upload.file.path}")
private String path;
@ -106,7 +109,7 @@ public class DataSetTableService {
saveTableField(datasetTable);
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
commonThreadPool.addTask(() -> {
extractDataService.extractData(datasetTable.getId(), null, "all_scope");
extractDataService.extractData(datasetTable.getId(), null, "all_scope", null);
});
}
}
@ -265,18 +268,18 @@ public class DataSetTableService {
e.printStackTrace();
}
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.getByTableId(datasetTable.getId());
if (CollectionUtils.isEmpty(datasetTableTaskLogs)) {
if (StringUtils.isEmpty(datasetTable.getSyncStatus()) || datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
map.put("status", "warnning");
map.put("msg", Translator.get("i18n_processing_data"));
dataSetPreviewPage.setTotal(0);
}else if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
map.put("status", "warnning");
map.put("msg", Translator.get("i18n_processing_data"));
dataSetPreviewPage.setTotal(0);
}else if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Error.name())) {
}else if (datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Error.name())) {
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.getByTableId(datasetTable.getId());
map.put("status", "error");
map.put("msg", "Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo());
if(CollectionUtils.isNotEmpty(datasetTableTaskLogs)){
map.put("msg", "Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo());
}else {
map.put("msg", "Failed to extract data.");
}
dataSetPreviewPage.setTotal(0);
}else {
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
@ -867,22 +870,48 @@ public class DataSetTableService {
}
public Boolean checkDorisTableIsExists(String id) throws Exception {
// Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
// JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
// DatasourceRequest datasourceRequest = new DatasourceRequest();
// datasourceRequest.setDatasource(dorisDatasource);
// QueryProvider qp = ProviderFactory.getQueryProvider(dorisDatasource.getType());
// datasourceRequest.setQuery(qp.searchTable(DorisTableUtils.dorisName(id)));
// List<String[]> data = jdbcProvider.getData(datasourceRequest);
// return CollectionUtils.isNotEmpty(data);
return true;
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource);
QueryProvider qp = ProviderFactory.getQueryProvider(dorisDatasource.getType());
datasourceRequest.setQuery(qp.searchTable(DorisTableUtils.dorisName(id)));
List<String[]> data = jdbcProvider.getData(datasourceRequest);
return CollectionUtils.isNotEmpty(data);
}
@QuartzScheduled(cron = "0 0/3 * * * ?")
public void updateDatasetTableStatus(){
DatasetTable record = new DatasetTable();
record.setSyncStatus(JobStatus.Completed.name());
List<QrtzSchedulerState> qrtzSchedulerStates = qrtzSchedulerStateMapper.selectByExample(null);
List<String> activeQrtzInstances = qrtzSchedulerStates.stream().filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > System.currentTimeMillis()).map(QrtzSchedulerStateKey::getInstanceName).collect(Collectors.toList());
List<DatasetTable> jobStoppeddDatasetTables = new ArrayList<>();
DatasetTableExample example = new DatasetTableExample();
example.createCriteria().andSyncStatusEqualTo(JobStatus.Underway.name());
datasetTableMapper.selectByExample(example).forEach(datasetTable -> {
if(StringUtils.isEmpty(datasetTable.getQrtzInstance()) || !activeQrtzInstances.contains(datasetTable.getQrtzInstance().substring(0, datasetTable.getQrtzInstance().length() - 13))){
jobStoppeddDatasetTables.add(datasetTable);
}
});
if(CollectionUtils.isEmpty(jobStoppeddDatasetTables)){
return;
}
DatasetTable record = new DatasetTable();
record.setSyncStatus(JobStatus.Completed.name());
example.clear();
example.createCriteria().andSyncStatusEqualTo(JobStatus.Underway.name()).andIdIn(jobStoppeddDatasetTables.stream().map(DatasetTable::getId).collect(Collectors.toList()));
datasetTableMapper.updateByExampleSelective(record, example);
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
datasetTableTaskLog.setStatus(JobStatus.Error.name());
datasetTableTaskLog.setInfo("Job stopped due to system error.");
DatasetTableTaskLogExample datasetTableTaskLogExample = new DatasetTableTaskLogExample();
datasetTableTaskLogExample.createCriteria().andStatusEqualTo(JobStatus.Underway.name()).andTableIdIn(jobStoppeddDatasetTables.stream().map(DatasetTable::getId).collect(Collectors.toList()));
datasetTableTaskLogMapper.updateByExampleSelective(datasetTableTaskLog, datasetTableTaskLogExample);
}
}

View File

@ -4,6 +4,7 @@ import io.dataease.base.domain.DatasetTableTaskLog;
import io.dataease.base.domain.DatasetTableTaskLogExample;
import io.dataease.base.mapper.DatasetTableTaskLogMapper;
import io.dataease.base.mapper.ext.ExtDataSetTaskMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.dto.dataset.DataSetTaskLogDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -55,4 +56,19 @@ public class DataSetTableTaskLogService {
criteria.andTableIdEqualTo(datasetId);
return datasetTableTaskLogMapper.selectByExampleWithBLOBs(datasetTableTaskLogExample);
}
public List<DatasetTableTaskLog> select(DatasetTableTaskLog datasetTableTaskLog){
DatasetTableTaskLogExample example = new DatasetTableTaskLogExample();
DatasetTableTaskLogExample.Criteria criteria = example.createCriteria();
if(StringUtils.isNotEmpty(datasetTableTaskLog.getStatus())){
criteria.andStatusEqualTo(datasetTableTaskLog.getStatus());
}
if(StringUtils.isNotEmpty(datasetTableTaskLog.getTableId())){
criteria.andTableIdEqualTo(datasetTableTaskLog.getTableId());
}
if(StringUtils.isNotEmpty(datasetTableTaskLog.getTaskId())){
criteria.andTaskIdEqualTo(datasetTableTaskLog.getTaskId());
}
return datasetTableTaskLogMapper.selectByExampleWithBLOBs(example);
}
}

View File

@ -2,7 +2,10 @@ package io.dataease.service.dataset;
import io.dataease.base.domain.DatasetTableTask;
import io.dataease.base.domain.DatasetTableTaskExample;
import io.dataease.base.domain.DatasetTableTaskLog;
import io.dataease.base.mapper.DatasetTableTaskMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.constants.ScheduleType;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
import io.dataease.i18n.Translator;
import io.dataease.service.ScheduleService;
@ -33,10 +36,12 @@ public class DataSetTableTaskService {
@Resource
@Lazy
private DataSetTableService dataSetTableService;
@Resource
private ExtractDataService extractDataService;
public DatasetTableTask save(DataSetTaskRequest dataSetTaskRequest) throws Exception {
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
DatasetTableTask datasetTableTask = dataSetTaskRequest.getDatasetTableTask();
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
// check
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
@ -54,6 +59,20 @@ public class DataSetTableTaskService {
if (StringUtils.isEmpty(datasetTableTask.getId())) {
datasetTableTask.setId(UUID.randomUUID().toString());
datasetTableTask.setCreateTime(System.currentTimeMillis());
// SIMPLE 类型提前占位
if(datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())){
if(extractDataService.updateSyncStatus(dataSetTableService.get(datasetTableTask.getTableId()))){
throw new Exception(Translator.get("i18n_sync_job_exists"));
}else {
//write log
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
datasetTableTaskLog.setTableId(datasetTableTask.getTableId());
datasetTableTaskLog.setTaskId(datasetTableTask.getId());
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
dataSetTableTaskLogService.save(datasetTableTaskLog);
}
}
datasetTableTaskMapper.insert(datasetTableTask);
} else {
datasetTableTaskMapper.updateByPrimaryKeySelective(datasetTableTask);

View File

@ -3,6 +3,7 @@ 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;
import io.dataease.base.mapper.DatasourceMapper;
import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.constants.ScheduleType;
@ -63,6 +64,7 @@ import org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta;
import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDef;
import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta;
import org.pentaho.di.www.SlaveServerJobStatus;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -89,13 +91,17 @@ public class ExtractDataService {
@Resource
private DataSetTableFieldsService dataSetTableFieldsService;
@Resource
@Lazy
private DataSetTableTaskLogService dataSetTableTaskLogService;
@Resource
@Lazy
private DataSetTableTaskService dataSetTableTaskService;
@Resource
private DatasourceMapper datasourceMapper;
@Resource
private DatasetTableMapper datasetTableMapper;
@Resource
private DatasetTableTaskMapper datasetTableTaskMapper;
private static String lastUpdateTime = "${__last_update_time__}";
private static String currentUpdateTime = "${__current_update_time__}";
@ -111,15 +117,15 @@ public class ExtractDataService {
private String user;
@Value("${carte.passwd:cluster}")
private String passwd;
private static String creatTableSql = "CREATE TABLE IF NOT EXISTS `TABLE_NAME`" +
"Column_Fields" +
"UNIQUE KEY(dataease_uuid)\n" +
"DISTRIBUTED BY HASH(dataease_uuid) BUCKETS 10\n" +
"PROPERTIES(\"replication_num\" = \"1\");";
private static String dropTableSql = "DROP TABLE IF EXISTS TABLE_NAME;";
private static String shellScript = "curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load\n" +
"rm -rf %s\n";
private String createDorisTablColumnSql(List<DatasetTableField> datasetTableFields) {
String Column_Fields = "dataease_uuid varchar(50), `";
for (DatasetTableField datasetTableField : datasetTableFields) {
@ -157,13 +163,23 @@ public class ExtractDataService {
private void createDorisTable(String dorisTableName, String dorisTablColumnSql) throws Exception {
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
;
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery(creatTableSql.replace("TABLE_NAME", dorisTableName).replace("Column_Fields", dorisTablColumnSql));
jdbcProvider.exec(datasourceRequest);
}
private void dropDorisTable(String dorisTableName) {
try {
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery(dropTableSql.replace("TABLE_NAME", dorisTableName));
jdbcProvider.exec(datasourceRequest);
}catch (Exception ignore){}
}
private void replaceTable(String dorisTableName) throws Exception {
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
@ -174,18 +190,36 @@ public class ExtractDataService {
jdbcProvider.exec(datasourceRequest);
}
public void extractData(String datasetTableId, String taskId, String type) {
DatasetTable datasetTable = dataSetTableService.get(datasetTableId);
public synchronized boolean updateSyncStatus(DatasetTable datasetTable ){
datasetTable.setSyncStatus(JobStatus.Underway.name());
DatasetTableExample example = new DatasetTableExample();
example.createCriteria().andIdEqualTo(datasetTableId);
if (datasetTableMapper.updateByExampleSelective(datasetTable, example) == 0) {
example.createCriteria().andIdEqualTo(datasetTable.getId());
datasetTableMapper.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusNotEqualTo(JobStatus.Underway.name());
example.or(example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusIsNull());
return datasetTableMapper.updateByExampleSelective(datasetTable, example) == 0;
}
public void extractData(String datasetTableId, String taskId, String type, JobExecutionContext context) {
DatasetTable datasetTable = getDatasetTable(datasetTableId);
if(datasetTable == null){
LogUtil.error("Can not find DatasetTable: " + datasetTableId);
}
DatasetTableTask datasetTableTask = datasetTableTaskMapper.selectByPrimaryKey(taskId);
boolean isSIMPLEJob = (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString()));
if(updateSyncStatus(datasetTable) && !isSIMPLEJob){
LogUtil.info("Skip synchronization task for table : " + datasetTableId);
return;
}
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
UpdateType updateType = UpdateType.valueOf(type);
Datasource datasource = new Datasource();
try {
if(context != null){
datasetTable.setQrtzInstance(context.getFireInstanceId());
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
}
if (StringUtils.isNotEmpty(datasetTable.getDataSourceId())) {
datasource = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
} else {
@ -206,7 +240,7 @@ public class ExtractDataService {
switch (updateType) {
// 全量更新
case all_scope:
writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
// TODO before: check doris table column type
createDorisTable(DorisTableUtils.dorisName(datasetTableId), dorisTablColumnSql);
createDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)), dorisTablColumnSql);
@ -232,7 +266,7 @@ public class ExtractDataService {
if (CollectionUtils.isEmpty(dataSetTaskLogDTOS)) {
return;
}
writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
// 增量添加
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {
@ -256,6 +290,10 @@ public class ExtractDataService {
dataSetTableTaskLogService.save(datasetTableTaskLog);
break;
}
datasetTable.setSyncStatus(JobStatus.Completed.name());
DatasetTableExample example = new DatasetTableExample();
example.createCriteria().andIdEqualTo(datasetTableId);
datasetTableMapper.updateByExampleSelective(datasetTable, example);
} catch (Exception e) {
e.printStackTrace();
LogUtil.error("Extract data error: " + datasetTableId, e);
@ -263,25 +301,49 @@ public class ExtractDataService {
datasetTableTaskLog.setInfo(ExceptionUtils.getStackTrace(e));
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
dataSetTableTaskLogService.save(datasetTableTaskLog);
datasetTable.setSyncStatus(JobStatus.Error.name());
DatasetTableExample example = new DatasetTableExample();
example.createCriteria().andIdEqualTo(datasetTableId);
datasetTableMapper.updateByExampleSelective(datasetTable, example);
if(updateType.name().equalsIgnoreCase("all_scope")){
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
}
} finally {
DatasetTableTask datasetTableTask = dataSetTableTaskService.get(taskId);
if (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
datasetTableTask.setRate(ScheduleType.SIMPLE_COMPLETE.toString());
dataSetTableTaskService.update(datasetTableTask);
}
datasetTable.setSyncStatus(JobStatus.Completed.name());
example.clear();
example.createCriteria().andIdEqualTo(datasetTableId);
datasetTableMapper.updateByExampleSelective(datasetTable, example);
}
}
private void writeDatasetTableTaskLog(DatasetTableTaskLog datasetTableTaskLog, String datasetTableId, String taskId) {
private DatasetTable getDatasetTable(String datasetTableId){
for (int i=0;i<5;i++){
DatasetTable datasetTable = dataSetTableService.get(datasetTableId);
if(datasetTable == null){
try {
Thread.sleep(1000);
}catch (Exception ignore){}
}else {
return datasetTable;
}
}
return null;
}
private DatasetTableTaskLog writeDatasetTableTaskLog(DatasetTableTaskLog datasetTableTaskLog, String datasetTableId, String taskId) {
datasetTableTaskLog.setTableId(datasetTableId);
datasetTableTaskLog.setTaskId(taskId);
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
dataSetTableTaskLogService.save(datasetTableTaskLog);
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.select(datasetTableTaskLog);
if(CollectionUtils.isEmpty(datasetTableTaskLogs)){
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
dataSetTableTaskLogService.save(datasetTableTaskLog);
return datasetTableTaskLog;
}else {
return datasetTableTaskLogs.get(0);
}
}
private void extractData(DatasetTable datasetTable, String extractType) throws Exception {
@ -619,26 +681,27 @@ public class ExtractDataService {
}
public boolean isKettleRunning() {
try {
if (!InetAddress.getByName(carte).isReachable(1000)) {
return false;
}
HttpClient httpClient;
HttpGet getMethod = new HttpGet("http://" + carte + ":" + port);
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
clientBuilder.setConnectionTimeout(1);
clientBuilder.setCredentials(user, passwd);
httpClient = clientBuilder.build();
HttpResponse httpResponse = httpClient.execute(getMethod);
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != -1 && statusCode < 400) {
return true;
} else {
return false;
}
} catch (Exception e) {
return false;
}
return true;
// try {
// if (!InetAddress.getByName(carte).isReachable(1000)) {
// return false;
// }
// HttpClient httpClient;
// HttpGet getMethod = new HttpGet("http://" + carte + ":" + port);
// HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
// clientBuilder.setConnectionTimeout(1);
// clientBuilder.setCredentials(user, passwd);
// httpClient = clientBuilder.build();
// HttpResponse httpResponse = httpClient.execute(getMethod);
// int statusCode = httpResponse.getStatusLine().getStatusCode();
// if (statusCode != -1 && statusCode < 400) {
// return true;
// } else {
// return false;
// }
// } catch (Exception e) {
// return false;
// }
}
private static String alterColumnTypeCode = " if(\"FILED\".equalsIgnoreCase(filed)){\n" +

View File

@ -5,17 +5,16 @@ import io.dataease.base.domain.MyPlugin;
import io.dataease.base.mapper.MyPluginMapper;
import io.dataease.base.mapper.ext.ExtSysPluginMapper;
import io.dataease.base.mapper.ext.query.GridExample;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.DeFileUtils;
import io.dataease.commons.utils.ZipUtils;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.plugins.config.LoadjarUtil;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
@ -38,9 +37,10 @@ public class PluginService {
@Resource
private MyPluginMapper myPluginMapper;
@Resource
@Autowired
private LoadjarUtil loadjarUtil;
public List<MyPlugin> query(BaseGridRequest request) {
GridExample gridExample = request.convertExample();
List<MyPlugin> results = extSysPluginMapper.query(gridExample);
@ -60,6 +60,8 @@ public class PluginService {
try {
ZipUtils.upZipFile(dest, folder);
} catch (IOException e) {
DeFileUtils.deleteFile(pluginDir+"temp/");
DeFileUtils.deleteFile(folder);
// 需要删除文件
e.printStackTrace();
}
@ -67,29 +69,80 @@ public class PluginService {
File folderFile = new File(folder);
File[] jsonFiles = folderFile.listFiles(this::isPluginJson);
if (ArrayUtils.isEmpty(jsonFiles)) {
DeFileUtils.deleteFile(pluginDir+"temp/");
DeFileUtils.deleteFile(folder);
throw new RuntimeException("缺少插件描述文件");
}
MyPlugin myPlugin = formatJsonFile(jsonFiles[0]);
//4.加载jar包 失败则 直接返回错误 删除文件
File[] jarFiles = folderFile.listFiles(this::isPluginJar);
if (ArrayUtils.isEmpty(jarFiles)) {
DeFileUtils.deleteFile(pluginDir+"temp/");
DeFileUtils.deleteFile(folder);
throw new RuntimeException("缺少插件jar文件");
}
File jarFile = jarFiles[0];
String jarRoot = pluginDir+"jar/";
String jarPath = null;
String versionDir = null;
try {
jarPath = DeFileUtils.copy(jarFile, jarRoot);
} catch (IOException e) {
File jarFile = jarFiles[0];
versionDir = makeVersionDir(myPlugin);
String jarPath = null;
jarPath = DeFileUtils.copy(jarFile, versionDir);
//DeFileUtils.copy(folderFile, versionDir);
loadJar(jarPath, myPlugin);
myPluginMapper.insert(myPlugin);
} catch (Exception e) {
if (StringUtils.isNotEmpty(versionDir)) {
DeFileUtils.deleteFile(versionDir);
}
e.printStackTrace();
}finally {
DeFileUtils.deleteFile(pluginDir+"temp/");
DeFileUtils.deleteFile(folder);
}
loadjarUtil.loadJar(jarPath);
//mybatisLoader.loadMybatis(myPlugin);
//5.写表到my_plugin
myPlugin.setPluginId(0L);
myPluginMapper.insert(myPlugin);
// myPlugin.setPluginId(0L);
return null;
}
public void loadJar(String jarPath, MyPlugin myPlugin) throws Exception {
loadjarUtil.loadJar(jarPath, myPlugin);
}
private String makeVersionDir(MyPlugin myPlugin) {
String name = myPlugin.getName();
String dir = pluginDir + name + "/" + myPlugin.getVersion() + "/";
File fileDir = new File(dir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
return dir;
}
/**
* 卸载插件
* @param pluginId
* @return
*/
public Boolean uninstall(Long pluginId) {
myPluginMapper.deleteByPrimaryKey(pluginId);
return true;
}
/**
* 改变插件状态
* @param pluginId
* @param status true 使用状态 : 禁用状态
* @return
*/
public Boolean changeStatus(Long pluginId, Boolean status) {
return false;
}
//判断当前文件是否实插件描述文件
//文件名称必须plugin.json
private boolean isPluginJson(File file) {
@ -110,6 +163,7 @@ public class PluginService {
Gson gson = new Gson();
Map<String, Object> myPlugin = gson.fromJson(str, Map.class);
myPlugin.put("free", (Double)myPlugin.get("free") > 0.0);
myPlugin.put("loadMybatis", (Double)myPlugin.get("loadMybatis") > 0.0);
MyPlugin result = new MyPlugin();
try {
org.apache.commons.beanutils.BeanUtils.populate(result, myPlugin);

View File

@ -19,6 +19,7 @@ import io.dataease.controller.sys.request.SysUserPwdRequest;
import io.dataease.controller.sys.request.SysUserStateRequest;
import io.dataease.controller.sys.response.SysUserGridResponse;
import io.dataease.controller.sys.response.SysUserRole;
import io.dataease.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -78,6 +79,7 @@ public class SysUserService {
@Transactional
public int save(SysUserCreateRequest request) {
checkUsername(request);
SysUser user = BeanUtils.copyBean(new SysUser(), request);
long now = System.currentTimeMillis();
user.setCreateTime(now);
@ -106,6 +108,7 @@ public class SysUserService {
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
@Transactional
public int update(SysUserCreateRequest request) {
checkUsername(request);
if (StringUtils.isEmpty(request.getPassword())) {
request.setPassword(null);
}
@ -235,4 +238,16 @@ public class SysUserService {
sysUserMapper.updateByPrimaryKeySelective(sysUser);
}
private void checkUsername(SysUserCreateRequest request) {
SysUserExample sysUserExample = new SysUserExample();
SysUserExample.Criteria criteria = sysUserExample.createCriteria();
if (request.getUserId() != null) {
criteria.andUserIdNotEqualTo(request.getUserId());
}
criteria.andUsernameEqualTo(request.getUsername());
List<SysUser> sysUsers = sysUserMapper.selectByExample(sysUserExample);
if (CollectionUtils.isNotEmpty(sysUsers)) {
throw new RuntimeException(Translator.get("i18n_username_exists"));
}
}
}

View File

@ -40,7 +40,7 @@ DROP TABLE IF EXISTS `datasource`;
CREATE TABLE `datasource` (
`id` varchar(50) NOT NULL DEFAULT '' COMMENT 'ID',
`name` varchar(50) NOT NULL COMMENT '名称',
`desc` varchar(50) NOT NULL COMMENT '描述',
`desc` varchar(50) COMMENT '描述',
`type` varchar(50) NOT NULL COMMENT '类型',
`configuration` longtext NOT NULL COMMENT '详细信息',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
@ -164,21 +164,22 @@ CREATE TABLE `sys_users_roles` (
DROP TABLE IF EXISTS `my_plugin`;
CREATE TABLE `my_plugin` (
`plugin_id` bigint(20) NOT NULL COMMENT '主键',
`name` varchar(255) DEFAULT NULL COMMENT '插件名称',
`free` tinyint(1) DEFAULT NULL COMMENT '是否免费',
`cost` int(10) DEFAULT NULL COMMENT '费用',
`descript` varchar(255) DEFAULT NULL COMMENT '描述',
`version` varchar(255) DEFAULT NULL COMMENT '版本号',
`install_type` int(4) DEFAULT NULL COMMENT '安装类型',
`creator` varchar(255) DEFAULT NULL COMMENT '开发者',
`release_time` bigint(13) DEFAULT NULL COMMENT '发布时间',
`install_time` bigint(13) DEFAULT NULL COMMENT '安装时间',
`module_name` varchar(255) DEFAULT NULL COMMENT 'jar包名称',
`bean_name` varchar(40) DEFAULT NULL COMMENT 'bean名称',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
PRIMARY KEY (`plugin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
`plugin_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) DEFAULT NULL COMMENT '插件名称',
`free` tinyint(1) DEFAULT '0' COMMENT '是否免费',
`cost` int(10) DEFAULT NULL COMMENT '费用',
`descript` varchar(255) DEFAULT NULL COMMENT '描述',
`version` varchar(255) DEFAULT NULL COMMENT '版本号',
`install_type` int(4) DEFAULT NULL COMMENT '安装类型',
`creator` varchar(255) DEFAULT NULL COMMENT '开发者',
`load_mybatis` tinyint(1) DEFAULT '0' COMMENT '是否需要加载mybatis',
`release_time` bigint(13) DEFAULT NULL COMMENT '发布时间',
`install_time` bigint(13) DEFAULT NULL COMMENT '安装时间',
`module_name` varchar(255) DEFAULT NULL COMMENT 'jar包名称',
`bean_name` varchar(40) DEFAULT NULL COMMENT 'bean名称',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
PRIMARY KEY (`plugin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='插件表';
DROP TABLE IF EXISTS `license`;
CREATE TABLE `license` (

View File

@ -12,15 +12,16 @@ COMMIT;
BEGIN;
INSERT INTO `sys_menu` VALUES (1, 0, 3, 0, '系统管理', 'system', 'Layout', 6, 'system', '/system', NULL, b'0', b'0', 'dir:sys', NULL, NULL, NULL, 1614916695777);
INSERT INTO `sys_menu` VALUES (2, 1, 4, 1, '用户管理', 'system-user', 'system/user/index', 1, 'peoples', 'user', NULL, b'0', b'0', 'user:read', NULL, NULL, NULL, 1620281952752);
INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '菜单管理', 'system-menu', 'system/menu/index', 2, 'menu', 'menu', NULL, b'0', b'0', 'menu:read', NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (4, 1, 3, 1, '组织管理', 'system-dept', 'system/dept/index', 3, 'dept', 'dept', NULL, b'0', b'0', 'dept:read', NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '角色管理', 'system-role', 'system/role/index', 4, 'role', 'role', b'0', b'0', b'0', 'role:read', NULL, NULL, 1614683852133, 1614683852133);
INSERT INTO `sys_menu` VALUES (6, 1, 0, 1, '参数管理', 'system-param', 'system/systemParamSettings/index', 5, 'sys-tools', 'systemParamSettings', NULL, b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1615790294169);
/*INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '菜单管理', 'system-menu', 'system/menu/index', 2, 'menu', 'menu', NULL, b'0', b'0', 'menu:read', NULL, NULL, NULL, NULL);*/
/*INSERT INTO `sys_menu` VALUES (4, 1, 3, 1, '组织管理', 'system-dept', 'system/dept/index', 3, 'dept', 'dept', NULL, b'0', b'0', 'dept:read', NULL, NULL, NULL, NULL);*/
/*INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '角色管理', 'system-role', 'system/role/index', 4, 'role', 'role', b'0', b'0', b'0', 'role:read', NULL, NULL, 1614683852133, 1614683852133);
INSERT INTO `sys_menu` VALUES (6, 1, 0, 1, '参数管理', 'system-param', 'system/systemParamSettings/index', 5, 'sys-tools', 'systemParamSettings', NULL, b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1615790294169);*/
INSERT INTO `sys_menu` VALUES (8, 0, 0, 1, '数据集', 'dataset', 'dataset/index', 3, '', '/dataset', NULL, b'0', b'0', 'data:read', NULL, NULL, NULL, 1614916684821);
INSERT INTO `sys_menu` VALUES (10, 0, 0, 1, '视图', 'view', 'chart/index', 2, '', '/chart', NULL, b'0', b'0', 'chart:read', NULL, NULL, NULL, 1614915491036);
INSERT INTO `sys_menu` VALUES (12, 3, 0, 2, '创建菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:add', NULL, NULL, 1614924617327, 1614924617327);
/*INSERT INTO `sys_menu` VALUES (12, 3, 0, 2, '创建菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:add', NULL, NULL, 1614924617327, 1614924617327);
INSERT INTO `sys_menu` VALUES (13, 3, 0, 2, '删除菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:del', NULL, NULL, 1614924667808, 1614924667808);
INSERT INTO `sys_menu` VALUES (14, 3, 0, 2, '编辑菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:edit', NULL, NULL, 1614930734224, 1614936429773);
INSERT INTO `sys_menu` VALUES (14, 3, 0, 2, '编辑菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:edit', NULL, NULL, 1614930734224, 1614936429773);*/
INSERT INTO `sys_menu` VALUES (15, 2, 0, 2, '创建用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:add', NULL, NULL, 1614930862373, 1614930862373);
INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '删除用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:del', NULL, NULL, 1614930903502, 1614930903502);
INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529);
@ -38,9 +39,9 @@ INSERT INTO `sys_menu` VALUES (28, 2, 0, 2, '修改密码', NULL, NULL, 999, NUL
INSERT INTO `sys_menu` VALUES (30, 0, 0, 1, '仪表板', 'panel', 'panel/index', 1, NULL, '/panel', b'0', b'0', b'0', 'panel:read', NULL, NULL, NULL, 1619081449067);
INSERT INTO `sys_menu` VALUES (34, 0, 4, 1, '数据源', 'datasource', 'system/datasource/index', 4, NULL, '/datasource', b'0', b'0', b'0', 'datasource:read', NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (35, 1, 0, 1, '用户表单', 'system-user-form', 'system/user/form', 10, '', 'user-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (36, 1, 0, 1, '菜单表单', 'system-menu-form', 'system/menu/form', 11, '', 'menu-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (37, 1, 0, 1, '组织表单', 'system-dept-form', 'system/dept/form', 12, '', 'dept-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', 'system-role-form', 'system/role/form', 13, '', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
/*INSERT INTO `sys_menu` VALUES (36, 1, 0, 1, '菜单表单', 'system-menu-form', 'system/menu/form', 11, '', 'menu-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/
/*INSERT INTO `sys_menu` VALUES (37, 1, 0, 1, '组织表单', 'system-dept-form', 'system/dept/form', 12, '', 'dept-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/
/*INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', 'system-role-form', 'system/role/form', 13, '', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/
INSERT INTO `sys_menu` VALUES (39, 0, 0, 1, '数据源表单', 'datasource-form', 'system/datasource/form', 5, NULL, '/ds-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (40, 1, 0, 1, '模板管理', 'system-template', 'panel/template/index', 13, 'dashboard', 'panel/template/index', NULL, b'0', b'0', 'template:read', NULL, NULL, NULL, 1620444227389);
INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', 'system-auth', 'system/authority/index', 14, 'password', 'system/authority/index', b'0', b'0', b'0', 'auth:read', NULL, NULL, NULL, 1620447312657);
@ -57,8 +58,8 @@ COMMIT;
BEGIN;
INSERT INTO `sys_role` VALUES (3, '管理员', 'www', NULL, NULL, NULL, 1619685033918);
INSERT INTO `sys_role` VALUES (4, '普通员工', 'ceshi', NULL, NULL, NULL, 1619684053527);
INSERT INTO `sys_role` VALUES (3, '管理员', 'www', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null);
INSERT INTO `sys_role` VALUES (4, '普通员工', 'ceshi', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null);
COMMIT;

View File

@ -1 +1,2 @@
ALTER TABLE `dataease`.`dataset_table` ADD COLUMN `sync_status` VARCHAR(45) NULL AFTER `create_time`;
ALTER TABLE `dataset_table` ADD COLUMN `sync_status` VARCHAR(45) NULL AFTER `create_time`;
ALTER TABLE `dataset_table` ADD COLUMN `qrtz_instance` VARCHAR(1024) NULL AFTER `create_time`;

View File

@ -240,4 +240,6 @@ i18n_union_already_exists=Union relation already exists
i18n_union_field_exists=The same field can't in two dataset
i18n_cron_time_error=Start time can't greater then end time
i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled
i18n_username_exists=ID is already exists
i18n_ds_name_exists=Datasource name exists
i18n_sync_job_exists=There is already a synchronization task running, please try again later

View File

@ -242,3 +242,6 @@ i18n_union_already_exists=关联关系已存在
i18n_union_field_exists=两个数据集之间关联不能出现多次相同字段
i18n_cron_time_error=开始时间不能大于结束时间
i18n_auth_source_be_canceled=当前资源授权权限已经被取消
i18n_username_exists=用户ID已存在
i18n_ds_name_exists=数据源名称已存在
i18n_sync_job_exists=已经有同步任务在运行,稍后重试

View File

@ -242,3 +242,6 @@ i18n_union_already_exists=關聯關系已存在
i18n_union_field_exists=兩個數據集之間關聯不能出現多次相同字段
i18n_cron_time_error=開始時間不能大於結束時間
i18n_auth_source_be_canceled=當前資源授權權限已經被取消
i18n_username_exists=用戶ID已存在
i18n_ds_name_exists=數據源名稱已存在
i18n_sync_job_exists=已經有同步任務在運行,稍後重試

View File

@ -0,0 +1,22 @@
import request from '@/utils/request'
export function get(url) {
return request({
url: url,
method: 'get'
})
}
export function execute(options) {
if (!options || !options.url) {
return null
}
options.type = options.type || 'post'
return request({
url: options.url,
method: options.type,
loading: true,
data: options.data
})
}

View File

@ -1,6 +1,7 @@
import request from '@/utils/request'
const pathMap = {
queryPath: '/api/plugin/pluginGrid/'
queryPath: '/api/plugin/pluginGrid/',
uninstallPath: 'api/plugin/uninstall/'
}
export function pluginLists(page, size, data) {
return request({
@ -11,3 +12,11 @@ export function pluginLists(page, size, data) {
})
}
export function uninstall(pluginId) {
return request({
url: pathMap.queryPath + pluginId,
method: 'post',
loading: true
})
}

View File

@ -7,7 +7,9 @@
</template>
<script>
import Axios from 'axios'
// import Axios from 'axios'
import { get } from '@/api/system/dynamic'
export default {
name: 'AsyncComponent',
@ -36,13 +38,15 @@ export default {
}
let res
if (!window.SyncComponentCache[this.url]) {
window.SyncComponentCache[this.url] = Axios.get(this.url)
window.SyncComponentCache[this.url] = get(this.url)
// window.SyncComponentCache[this.url] = Axios.get(this.url)
res = await window.SyncComponentCache[this.url]
} else {
res = await window.SyncComponentCache[this.url]
}
const Fn = Function
this.mode = new Fn(`return ${res.data}`)()
this.mode = new Fn(`return ${res.data || res}`)()
}
}
},

View File

@ -278,7 +278,7 @@ export default {
default_module: 'Default Module'
},
datasource: 'Datasource',
char_can_not_more_50: 'Name can not more 50 char',
char_can_not_more_50: 'Can not more 50 char',
share_success: 'Share Success'
},
documentation: {
@ -435,7 +435,8 @@ export default {
current_user: 'Current User',
origin_passwd: 'Origin Password',
new_passwd: 'New Password',
confirm_passwd: 'Confirm Password'
confirm_passwd: 'Confirm Password',
change_password: 'Change Password'
},
role: {
menu_authorization: 'Menu Authorization',
@ -677,7 +678,8 @@ export default {
quota_show: 'Quota Show',
title_limit: 'Title cannot be greater than 50 characters',
filter_condition: 'Filter Condition',
filter_field_can_null: 'Filter field must choose'
filter_field_can_null: 'Filter field must choose',
preview_100_data: 'Preview 100 rows'
},
dataset: {
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
@ -732,13 +734,13 @@ export default {
error: 'Error',
completed: 'Completed',
underway: 'underway',
task_update: 'Regular update',
task_update: 'Update Setting',
update_type: 'Update Type',
all_scope: 'Full update',
add_scope: 'Incremental update',
select_data_time: 'Select date time',
execute_rate: 'Execution frequency',
execute_once: 'Only once',
execute_once: 'Execution Now',
cron_config: 'Expression setting',
no_limit: 'No limit',
set_end_time: 'Set the end time',

View File

@ -278,7 +278,7 @@ export default {
default_module: '默认模块'
},
datasource: '數據源',
char_can_not_more_50: '名稱不能超過50字符',
char_can_not_more_50: '不能超過50字符',
share_success: '分享成功'
},
documentation: {
@ -435,7 +435,8 @@ export default {
current_user: '當前用戶',
origin_passwd: '原始密碼',
new_passwd: '新密碼',
confirm_passwd: '確認密碼'
confirm_passwd: '確認密碼',
change_password: '修改密碼'
},
role: {
menu_authorization: '菜單授權',
@ -677,7 +678,8 @@ export default {
quota_show: '指標顯示',
title_limit: '標題不能大於50個字符',
filter_condition: '過濾條件',
filter_field_can_null: '過濾字段必填'
filter_field_can_null: '過濾字段必填',
preview_100_data: '預覽前100條記錄'
},
dataset: {
sheet_warn: '有多個sheet頁面默認抽取第一個',
@ -732,13 +734,13 @@ export default {
error: '錯誤',
completed: '完成',
underway: '執行中',
task_update: '定時更新',
task_update: '更新設置',
update_type: '更新方式',
all_scope: '全量更新',
add_scope: '增量更新',
select_data_time: '選擇日期時間',
execute_rate: '執行頻率',
execute_once: '只執行一次',
execute_once: '立即執行',
cron_config: '表達時設定',
no_limit: '無限制',
set_end_time: '設定結束時間',

View File

@ -278,7 +278,7 @@ export default {
default_module: '默认模块'
},
datasource: '数据源',
char_can_not_more_50: '名称不能超过50字符',
char_can_not_more_50: '不能超过50字符',
share_success: '分享成功'
},
documentation: {
@ -435,7 +435,8 @@ export default {
current_user: '当前用户',
origin_passwd: '原始密码',
new_passwd: '新密码',
confirm_passwd: '确认密码'
confirm_passwd: '确认密码',
change_password: '修改密码'
},
role: {
menu_authorization: '菜单授权',
@ -677,7 +678,8 @@ export default {
quota_show: '指标显示',
title_limit: '标题不能大于50个字符',
filter_condition: '过滤条件',
filter_field_can_null: '过滤字段必填'
filter_field_can_null: '过滤字段必填',
preview_100_data: '预览前100条记录'
},
dataset: {
sheet_warn: '有多个Sheet页默认抽取第一个',
@ -732,13 +734,13 @@ export default {
error: '错误',
completed: '完成',
underway: '执行中',
task_update: '定时更新',
task_update: '更新设置',
update_type: '更新方式',
all_scope: '全量更新',
add_scope: '增量更新',
select_data_time: '选择日期时间',
execute_rate: '执行频率',
execute_once: '只执行一次',
execute_once: '立即执行',
cron_config: '表达式设定',
no_limit: '无限制',
set_end_time: '设定结束时间',

View File

@ -47,7 +47,7 @@
<el-dropdown-item>{{ $t('commons.personal_info') }}</el-dropdown-item>
</router-link>
<router-link to="/person-pwd/index">
<el-dropdown-item>{{ $t('user.reset_password') }}</el-dropdown-item>
<el-dropdown-item>{{ $t('user.change_password') }}</el-dropdown-item>
</router-link>
<a href="/swagger-ui.html" target="_blank">
<el-dropdown-item>{{ $t('commons.help_documentation') }} </el-dropdown-item>

View File

@ -36,6 +36,14 @@ export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由
if (router.type === 1 && router.pid === 0 && router.component && router.component !== 'Layout') {
router = decorate(router)
}
if (router.isPlugin) {
const jsName = router.component
router.component = 'system/plugin/dynamic'
router.props = {
jsname: jsName,
menuid: router.id
}
}
if (router.component) {
if (router.component === 'Layout') { // Layout组件特殊处理
router.component = Layout
@ -47,6 +55,7 @@ export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由
if (router.children && router.children.length) {
router.children = filterAsyncRouter(router.children)
}
router.hasOwnProperty('id') && delete router.id
router.hasOwnProperty('type') && delete router.type
router.hasOwnProperty('pid') && delete router.pid

View File

@ -5,9 +5,9 @@
/* theme color */
$--color-primary: #0a7be0;
$--color-success: #13ce66;
$--color-warning: #ffba00;
$--color-danger: #ff4949;
$--color-success: #67C23A;
$--color-warning: #E6A23C;
$--color-danger: #F56C6C;
// $--color-info: #1E1E1E;
$--button-font-weight: 400;

View File

@ -73,8 +73,8 @@
</el-dropdown-menu>
</el-dropdown>
</span>
<span style="margin-left: 12px;" @click.stop >
<el-dropdown trigger="click" size="small" @command="clickMore">
<span style="margin-left: 12px;" @click.stop>
<el-dropdown trigger="click" size="small" @command="clickMore">
<span class="el-dropdown-link">
<el-button
icon="el-icon-more"
@ -156,8 +156,8 @@
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
</span>
<span v-if="hasDataPermission('manage',data.privileges)">
<span style="margin-left: 12px;" @click.stop >
<el-dropdown trigger="click" size="small" @command="clickMore">
<span style="margin-left: 12px;" @click.stop>
<el-dropdown trigger="click" size="small" @command="clickMore">
<span class="el-dropdown-link">
<el-button
icon="el-icon-more"
@ -204,7 +204,7 @@
<el-row style="width: 400px;">
<el-form ref="form" :model="table" label-width="80px" size="mini" class="form-item">
<el-form-item :label="$t('chart.view_name')">
<el-input v-model="table.name" size="mini" />
<el-input v-model="chartName" size="mini" />
</el-form-item>
</el-form>
</el-row>
@ -274,7 +274,8 @@ export default {
},
selectTableFlag: false,
table: {},
tables: []
tables: [],
chartName: ''
}
},
computed: {
@ -547,7 +548,7 @@ export default {
},
createChart() {
if (!this.table.name || this.table.name === '') {
if (!this.chartName || this.chartName === '') {
this.$message({
message: this.$t('chart.name_can_not_empty'),
type: 'error',
@ -555,7 +556,7 @@ export default {
})
return
}
if (this.table.name.length > 50) {
if (this.chartName.length > 50) {
this.$message({
showClose: true,
message: this.$t('commons.char_can_not_more_50'),
@ -564,8 +565,8 @@ export default {
return
}
const view = {}
view.name = this.table.name
view.title = this.table.name
view.name = this.chartName
view.title = this.chartName
view.sceneId = this.currGroup.id
view.tableId = this.table.id
view.type = 'bar'

View File

@ -98,7 +98,7 @@
<el-radio-group
v-model="view.type"
style="width: 100%"
@change="save(true)"
@change="save(true,'chart')"
>
<div style="width: 100%;display: flex;display: -webkit-flex;justify-content: space-between;flex-direction: row;flex-wrap: wrap;">
<el-radio value="table-normal" label="table-normal"><svg-icon icon-class="table-normal" class="chart-icon" /></el-radio>
@ -430,7 +430,7 @@ export default {
return true
})
},
save(getData) {
save(getData, trigger) {
const view = JSON.parse(JSON.stringify(this.view))
view.id = this.view.id
view.sceneId = this.view.sceneId
@ -471,6 +471,12 @@ export default {
view.yaxis.splice(1, view.yaxis.length)
}
}
if (view.type === 'line' && trigger === 'chart') {
view.customAttr.size.lineArea = false
}
if (view.type === 'line-stack' && trigger === 'chart') {
view.customAttr.size.lineArea = true
}
view.xaxis = JSON.stringify(view.xaxis)
view.yaxis = JSON.stringify(view.yaxis)
view.customAttr = JSON.stringify(view.customAttr)

View File

@ -51,7 +51,7 @@
</el-col>
<!--scene-->
<el-col v-if="sceneMode">
<el-col v-if="sceneMode" v-loading="dsLoading">
<el-row class="title-css">
<span class="title-text">
{{ currGroup.name }}
@ -150,7 +150,8 @@ export default {
tableForm: {
name: '',
sort: 'type asc,create_time desc,name asc'
}
},
dsLoading: false
}
},
computed: {},
@ -219,6 +220,7 @@ export default {
tableTree() {
this.tableData = []
if (this.currGroup) {
this.dsLoading = true
post('/dataset/table/list', {
sort: 'type asc,create_time desc,name asc',
sceneId: this.currGroup.id,
@ -235,6 +237,9 @@ export default {
this.$nextTick(function() {
this.unionDataChange()
})
this.dsLoading = false
}).catch(res => {
this.dsLoading = false
})
}
},

View File

@ -1,5 +1,5 @@
<template>
<el-col ref="container" style="width: 100%;height:100%">
<el-col ref="container" v-loading="dataLoading" style="width: 100%;height:100%">
<span>{{ table.name }}</span>
<ux-grid
ref="plxTable"
@ -14,10 +14,17 @@
:key="field.dataeaseName"
min-width="200px"
:field="field.dataeaseName"
:title="field.name"
:resizable="true"
/>
>
<template slot="header">
<svg-icon v-if="field.deType === 0" icon-class="field_text" class="field-icon-text" />
<svg-icon v-if="field.deType === 1" icon-class="field_time" class="field-icon-time" />
<svg-icon v-if="field.deType === 2 || field.deType === 3" icon-class="field_value" class="field-icon-value" />
<span>{{ field.name }}</span>
</template>
</ux-table-column>
</ux-grid>
<span v-if="table.name" style="font-size: 12px;">{{ $t('chart.preview_100_data') }}</span>
</el-col>
</template>
@ -36,7 +43,8 @@ export default {
return {
fields: [],
data: [],
height: 'auto'
height: 'auto',
dataLoading: false
}
},
watch: {
@ -57,8 +65,9 @@ export default {
initData() {
this.resetData()
if (this.table.id) {
this.table.row = 10
post('/dataset/table/getPreviewData/1/10', this.table).then(response => {
this.dataLoading = true
this.table.row = 100
post('/dataset/table/getPreviewData/1/100', this.table).then(response => {
this.fields = response.data.fields
this.data = response.data.data
const datas = this.data
@ -69,6 +78,9 @@ export default {
this.$error(response.data.msg, 3000)
}
this.$refs.plxTable.reloadData(datas)
this.dataLoading = false
}).catch(res => {
this.dataLoading = false
})
}
},

View File

@ -169,7 +169,7 @@ export default {
font-size: 12px;
}
.span-number{
color: #f18126;
color: #0a7be0;
}
.table-count{
color: #606266;

View File

@ -116,14 +116,6 @@
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('dataset.start_time')" prop="startTime">
<el-date-picker
v-model="taskForm.startTime"
type="datetime"
:placeholder="$t('dataset.select_data_time')"
size="mini"
/>
</el-form-item>
<el-form-item :label="$t('dataset.execute_rate')" prop="rate">
<el-select v-model="taskForm.rate" size="mini" @change="onRateChange">
<el-option
@ -136,13 +128,22 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="taskForm.rate === 'CRON'" label="">
<el-popover v-model="cronEdit">
<cron v-model="taskForm.cron" @close="cronEdit = false" />
<el-input slot="reference" v-model="taskForm.cron" size="mini" style="width: 50%" @click="cronEdit = true" />
</el-popover>
</el-form-item>
<el-form-item :label="$t('dataset.end_time')" prop="end">
<el-form-item v-if="taskForm.rate === 'CRON'" :label="$t('dataset.start_time')" prop="startTime">
<el-date-picker
v-model="taskForm.startTime"
type="datetime"
:placeholder="$t('dataset.select_data_time')"
size="mini"
/>
</el-form-item>
<el-form-item v-if="taskForm.rate === 'CRON'" :label="$t('dataset.end_time')" prop="end">
<el-select v-model="taskForm.end" size="mini">
<el-option
:label="$t('dataset.no_limit')"
@ -498,6 +499,7 @@ export default {
this.update_task = false
this.resetTaskForm()
this.listTask()
this.listTaskLog()
})
},
deleteTask(task) {
@ -514,6 +516,7 @@ export default {
})
this.resetTaskForm()
this.listTask()
this.listTaskLog()
})
}).catch(() => {
})

View File

@ -94,8 +94,10 @@ export default {
this.$refs.dsForm.validate(valid => {
if (valid) {
const method = this.formType === 'add' ? addDs : editDs
this.form.configuration = JSON.stringify(this.form.configuration)
method(this.form).then(res => {
// this.form.configuration = JSON.stringify(this.form.configuration)
const form = JSON.parse(JSON.stringify(this.form))
form.configuration = JSON.stringify(form.configuration)
method(form).then(res => {
this.$success(this.$t('commons.save_success'))
this.backToList()
})

View File

@ -0,0 +1,84 @@
<template>
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]" :header="header" :back-name="backName">
<async-component v-if="showAsync" :url="url" @execute-axios="executeAxios" @on-add-languanges="addLanguages" @on-plugin-layout="setLayoutInfo" />
<div v-else>
<h1>未知组件无法展示</h1>
</div>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import AsyncComponent from '@/components/AsyncComponent'
import i18n from '@/lang'
import { execute } from '@/api/system/dynamic'
export default {
name: 'Dynamic',
components: {
LayoutContent,
AsyncComponent
},
props: {
jsname: {
type: String,
default: null
},
menuid: {
type: Number,
default: null
}
},
data() {
return {
showAsync: false,
header: null,
backName: null,
baseUrl: '/api/pluginCommon/async/',
url: null
}
},
created() {
if (this.jsname && this.menuid) {
this.showAsync = true
console.log(this.jsname)
this.url = this.baseUrl + this.menuid
// this.url = 'http://localhost:8081/PluginDemo.js'
// this.url = 'http://localhost:8081/SystemParam.js'
} else {
this.showAsync = false
}
},
methods: {
// hasLicense
executeAxios(options) {
execute(options).then(res => {
if (options.callBack) {
options.callBack(res)
}
}).catch(e => {
if (options.callBack) {
options.callBack(e)
}
})
},
addLanguages(options) {
for (const key in i18n.messages) {
if (Object.hasOwnProperty.call(i18n.messages, key)) {
const element = options[key]
i18n.mergeLocaleMessage(key, element)
}
}
},
setLayoutInfo(param) {
const { header, backName } = param
this.header = header
this.backName = backName
}
}
}
</script>
<style scoped>
</style>

View File

@ -54,7 +54,7 @@ import ComplexTable from '@/components/business/complex-table'
import { checkPermission } from '@/utils/permission'
import { formatCondition } from '@/utils/index'
import { pluginLists } from '@/api/system/plugin'
import { pluginLists, uninstall } from '@/api/system/plugin'
import { getToken } from '@/utils/auth'
export default {
@ -131,6 +131,12 @@ export default {
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
uninstall(row.pluginId).then(res => {
this.search()
this.$success('卸载成功')
}).catch(() => {
this.$error('卸载失败')
})
}).catch(() => {
this.$info(this.$t('commons.delete_cancel'))
})

View File

@ -30,7 +30,7 @@ export default {
name: [
{ required: true, trigger: 'blur', validator: this.roleValidator }
],
code: [{ required: true, message: '请输入代码', trigger: 'blur' }]
description: [{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'blur' }]
},
roles: [],
originName: null

View File

@ -18,6 +18,7 @@
</template>
<el-table-column prop="name" :label="$t('commons.name')" />
<el-table-column :show-overflow-tooltip="true" prop="description" :label="$t('commons.description')" />
<el-table-column :show-overflow-tooltip="true" prop="createTime" :label="$t('commons.create_time')">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
@ -118,9 +119,9 @@ export default {
columns: [],
buttons: [
{
label: this.$t('commons.edit'), icon: 'el-icon-edit', type: 'primary', click: this.edit
label: this.$t('commons.edit'), icon: 'el-icon-edit', type: 'primary', click: this.edit, disabled: this.btnDisabled
}, {
label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.handleDelete
label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.handleDelete, disabled: this.btnDisabled
}
],
searchConfig: {
@ -156,7 +157,7 @@ export default {
const param = temp || {}
roleGrid(this.paginationConfig.currentPage, this.paginationConfig.pageSize, param).then(response => {
const data = response.data
this.total = data.itemCount
this.paginationConfig.total = data.itemCount
this.tableData = data.listObject
})
},
@ -251,18 +252,21 @@ export default {
this.$refs.menu.setCheckedKeys(this.menuIds)
},
handleDelete(row) {
this.$confirm(this.$t('commons.confirm_delete') + ': ' + row.name + '', this.$t('role.tips'), {
this.$confirm(this.$t('role.confirm_delete') + ': ' + row.name + '', this.$t('role.tips'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
delRole(row.roleId).then(res => {
this.$success(this.$t('commons.modify_success'))
this.$success(this.$t('commons.delete_success'))
this.search()
})
}).catch(() => {
})
},
btnDisabled(row) {
return !row.updateTime
}
}
}

View File

@ -25,6 +25,24 @@
<div>{{ scope.row.dept && scope.row.dept.deptName }}</div>
</template>
</el-table-column>
<el-table-column prop="roles" :label="$t('commons.role')">
<template slot-scope="scope">
<div v-if="scope.row.roles && scope.row.roles.length <= 2">
<div v-for="role in scope.row.roles" :key="role.roleId">{{ role.roleName }}</div>
</div>
<div v-if="scope.row.roles && scope.row.roles.length > 2">
<el-tooltip placement="top">
<div slot="content">
<div v-for="role in scope.row.roles" :key="role.roleId">{{ role.roleName }}</div>
</div>
<div>
<div v-for="(role,index) in scope.row.roles" v-if="index < 2" :key="role.roleId">{{ role.roleName }}</div>
<div>...</div>
</div>
</el-tooltip>
</div>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('commons.status')">
<template v-slot:default="scope">
<el-switch v-model="scope.row.enabled" :active-value="1" :inactive-value="0" inactive-color="#DCDFE6" @change="changeSwitch(scope.row)" />

View File

@ -1,5 +1,5 @@
<template>
<layout-content :header="$t('member.edit_password')">
<layout-content :header="$t('user.change_password')">
<el-form ref="createUserForm" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
<el-form-item :label="$t('user.origin_passwd')" prop="oldPwd">