Merge branch 'dev' into pr@dev@feat_chrome_screenshot
This commit is contained in:
commit
0adea9c6d8
@ -13,7 +13,7 @@ DataEase 是开源的数据可视化分析工具,帮助用户快速分析数
|
||||
### DataEase 的功能:
|
||||
|
||||
- 图表展示:支持 PC 端、移动端及大屏;
|
||||
- 图表制作:支持丰富的图表类型(基于 Apache ECharts 实现)、支持拖拉拽方式快速制作仪表板;
|
||||
- 图表制作:支持丰富的图表类型(Apache ECharts / AntV)、支持拖拉拽方式快速制作仪表板;
|
||||
- 数据引擎:支持直连模式、本地模式(基于 Apache Doris / Kettle 实现);
|
||||
- 数据连接:支持关系型数据库、Excel 等文件、Hadoop 等大数据平台、NoSQL 等各种数据源。
|
||||
|
||||
@ -35,6 +35,8 @@ DataEase 是开源的数据可视化分析工具,帮助用户快速分析数
|
||||
- MariaDB
|
||||
- Apache Doris
|
||||
- ClickHouse
|
||||
- MongoDB
|
||||
- Amazon Redshift
|
||||
|
||||
> 更多数据源支持持续增加中...
|
||||
|
||||
@ -73,7 +75,7 @@ curl -sSL https://github.com/dataease/dataease/releases/latest/download/quick_st
|
||||
## 技术栈
|
||||
|
||||
- 后端:[Spring Boot](https://spring.io/projects/spring-boot)
|
||||
- 前端:[Vue.js](https://vuejs.org/)、[Element](https://element.eleme.cn/)
|
||||
- 前端:[Vue.js](https://vuejs.org/)、[Element](https://element.eleme.cn/)、[Apache ECharts](https://github.com/apache/echarts)、[AntV](https://antv.vision/zh)
|
||||
- 中间件:[MySQL](https://www.mysql.com/)
|
||||
- 数据处理:[Kettle](https://github.com/pentaho/pentaho-kettle)、[Apache Doris](https://github.com/apache/incubator-doris/)
|
||||
- 基础设施:[Docker](https://www.docker.com/)
|
||||
|
||||
@ -30,8 +30,7 @@ public interface AuthApi {
|
||||
CurrentUserDto userInfo();
|
||||
|
||||
|
||||
/*@GetMapping("/isLogin")
|
||||
Boolean isLogin();*/
|
||||
|
||||
|
||||
|
||||
@ApiOperation("登出")
|
||||
|
||||
@ -11,7 +11,6 @@ public class CurrentRoleDto implements Serializable {
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
// private String code;
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
}
|
||||
|
||||
@ -94,14 +94,7 @@ public class F2CRealm extends AuthorizingRealm {
|
||||
if (username == null) {
|
||||
throw new AuthenticationException("token invalid");
|
||||
}
|
||||
// 使用缓存
|
||||
/*SysUserEntity user = authUserService.getUserById(userId);
|
||||
if (user == null) {
|
||||
throw new AuthenticationException("User didn't existed!");
|
||||
}
|
||||
if (user.getEnabled()==0) {
|
||||
throw new AuthenticationException("User is valid!");
|
||||
}*/
|
||||
|
||||
SysUserEntity user = userWithId(userId);
|
||||
String pass = null;
|
||||
try {
|
||||
@ -112,13 +105,7 @@ public class F2CRealm extends AuthorizingRealm {
|
||||
if (! JWTUtils.verify(token, tokenInfo, pass)) {
|
||||
throw new AuthenticationException("Username or password error");
|
||||
}
|
||||
/*// 使用缓存
|
||||
List<CurrentRoleDto> currentRoleDtos = authUserService.roleInfos(user.getUserId());
|
||||
// 使用缓存
|
||||
List<String> permissions = authUserService.permissions(user.getUserId());
|
||||
CurrentUserDto currentUserDto = BeanUtils.copyBean(new CurrentUserDto(), user);
|
||||
currentUserDto.setRoles(currentRoleDtos);
|
||||
currentUserDto.setPermissions(permissions);*/
|
||||
|
||||
CurrentUserDto currentUserDto = queryCacheUserDto(user);
|
||||
return new SimpleAuthenticationInfo(currentUserDto, token, "f2cReam");
|
||||
}
|
||||
|
||||
@ -13,8 +13,6 @@ public class TokenInfo implements Serializable {
|
||||
|
||||
private Long userId;
|
||||
|
||||
/* private String idToken; */
|
||||
|
||||
public String format(){
|
||||
return username + "," +userId;
|
||||
}
|
||||
|
||||
@ -39,7 +39,6 @@ public class F2CLinkFilter extends AnonymousFilter {
|
||||
panelLink.setPwd("dataease");
|
||||
pwd = panelLink.getPwd();
|
||||
}else {
|
||||
/* pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, panelLink.getPwd()); */
|
||||
pwd = panelLink.getPwd();
|
||||
}
|
||||
return JWTUtils.verifyLink(link_token, id, pwd);
|
||||
|
||||
@ -53,11 +53,9 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
|
||||
|
||||
|
||||
if (ApiKeyHandler.isApiKeyCall(httpServletRequest)) {
|
||||
// Long userId = ApiKeyHandler.getUser(httpServletRequest);
|
||||
|
||||
ASKToken askToken = ApiKeyHandler.buildToken(httpServletRequest);
|
||||
|
||||
// UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(userId.toString(), ApiKeyHandler.random);
|
||||
getSubject(request, response).login(askToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -71,7 +71,6 @@ public class AuthServer implements AuthApi {
|
||||
LdapAddRequest ldapAddRequest = new LdapAddRequest();
|
||||
ldapAddRequest.setUsers(new ArrayList<XpackLdapUserEntity>(){{add(ldapUserEntity);}});
|
||||
ldapAddRequest.setEnabled(1L);
|
||||
// ldapAddRequest.setDeptId(1L);
|
||||
ldapAddRequest.setRoleIds(new ArrayList<Long>(){{add(2L);}});
|
||||
sysUserService.validateExistUser(ldapUserEntity.getUsername(), ldapUserEntity.getNickname(), ldapUserEntity.getEmail());
|
||||
sysUserService.saveLdapUsers(ldapAddRequest);
|
||||
@ -191,13 +190,7 @@ public class AuthServer implements AuthApi {
|
||||
@Override
|
||||
public String getPublicKey() {
|
||||
return RsaProperties.publicKey;
|
||||
}
|
||||
|
||||
|
||||
/*@Override
|
||||
public Boolean isLogin() {
|
||||
return null;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ public class DynamicMenuServer implements DynamicMenuApi {
|
||||
|
||||
@Override
|
||||
public List<DynamicMenuDto> menus() {
|
||||
//ServletUtils.getToken()
|
||||
return dynamicMenuService.load(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,10 @@ package io.dataease.auth.service.impl;
|
||||
|
||||
import io.dataease.auth.service.ExtAuthService;
|
||||
import io.dataease.base.domain.SysAuth;
|
||||
import io.dataease.base.mapper.SysAuthMapper;
|
||||
import io.dataease.base.mapper.ext.ExtAuthMapper;
|
||||
import io.dataease.commons.model.AuthURD;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -21,8 +19,7 @@ public class ExtAuthServiceImpl implements ExtAuthService {
|
||||
@Resource
|
||||
private ExtAuthMapper extAuthMapper;
|
||||
|
||||
@Resource
|
||||
private SysAuthMapper sysAuthMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Set<Long> userIdsByRD(AuthURD request) {
|
||||
@ -42,9 +39,7 @@ public class ExtAuthServiceImpl implements ExtAuthService {
|
||||
@Override
|
||||
public AuthURD resourceTarget(String resourceId) {
|
||||
AuthURD authURD = new AuthURD();
|
||||
/*SysAuthExample example = new SysAuthExample();
|
||||
example.createCriteria().andAuthSourceEqualTo(resourceId);
|
||||
List<SysAuth> sysAuths = sysAuthMapper.selectByExample(example);*/
|
||||
|
||||
List<SysAuth> sysAuths = extAuthMapper.queryByResource(resourceId);
|
||||
|
||||
Map<String, List<SysAuth>> authMap = sysAuths.stream().collect(Collectors.groupingBy(SysAuth::getAuthTargetType));
|
||||
|
||||
@ -41,6 +41,8 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/link/**", ANON);
|
||||
filterChainDefinitionMap.put("/index.html", ANON);
|
||||
filterChainDefinitionMap.put("/link.html", ANON);
|
||||
filterChainDefinitionMap.put("/xggznb/**", ANON);
|
||||
|
||||
|
||||
//获取主题信息
|
||||
filterChainDefinitionMap.put("/plugin/theme/themes", ANON);
|
||||
@ -52,15 +54,11 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/dataset/field/fieldValues/**", ANON);
|
||||
filterChainDefinitionMap.put("/linkJump/queryPanelJumpInfo/**", ANON);
|
||||
|
||||
//未读消息数量
|
||||
// filterChainDefinitionMap.put("/api/sys_msg/unReadCount/**", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/**/*.json", ANON);
|
||||
filterChainDefinitionMap.put("/system/ui/**", ANON);
|
||||
filterChainDefinitionMap.put("/**/*.js", ANON);
|
||||
filterChainDefinitionMap.put("/**/*.css", ANON);
|
||||
filterChainDefinitionMap.put("/**/*.map", ANON);
|
||||
// filterChainDefinitionMap.put("/axios.map", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
||||
filterChainDefinitionMap.put("/api/auth/isPluginLoaded", ANON);
|
||||
|
||||
@ -39,9 +39,6 @@ public class JWTUtils {
|
||||
Verification verification = JWT.require(algorithm)
|
||||
.withClaim("username", tokenInfo.getUsername())
|
||||
.withClaim("userId", tokenInfo.getUserId());
|
||||
/* if (StringUtils.isNotBlank(tokenInfo.getIdToken())) {
|
||||
verification.withClaim("idToken", tokenInfo.getIdToken());
|
||||
} */
|
||||
JWTVerifier verifier = verification.build();
|
||||
verifier.verify(token);
|
||||
return true;
|
||||
@ -55,22 +52,14 @@ public class JWTUtils {
|
||||
DecodedJWT jwt = JWT.decode(token);
|
||||
String username = jwt.getClaim("username").asString();
|
||||
Long userId = jwt.getClaim("userId").asLong();
|
||||
// String idToken = jwt.getClaim("idToken").asString();
|
||||
if (StringUtils.isEmpty(username) || ObjectUtils.isEmpty(userId) ){
|
||||
DataEaseException.throwException("token格式错误!");
|
||||
}
|
||||
TokenInfoBuilder tokenInfoBuilder = TokenInfo.builder().username(username).userId(userId);
|
||||
/* if (StringUtils.isNotBlank(idToken)) {
|
||||
tokenInfoBuilder.idToken(idToken);
|
||||
} */
|
||||
TokenInfo tokenInfo = tokenInfoBuilder.build();
|
||||
return tokenInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean needRefresh(String token){
|
||||
Date exp = JWTUtils.getExp(token);
|
||||
return new Date().getTime() >= exp.getTime();
|
||||
@ -120,9 +109,6 @@ public class JWTUtils {
|
||||
Builder builder = JWT.create()
|
||||
.withClaim("username", tokenInfo.getUsername())
|
||||
.withClaim("userId", tokenInfo.getUserId());
|
||||
/* if (StringUtils.isNotBlank(tokenInfo.getIdToken())) {
|
||||
builder.withClaim("idToken", tokenInfo.getIdToken());
|
||||
} */
|
||||
return builder.withExpiresAt(date).sign(algorithm);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -26,7 +26,6 @@ public class RsaUtil {
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
// byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||
// 下面该用分段加密
|
||||
byte[] result = null;
|
||||
byte[] b = Base64.decodeBase64(text);
|
||||
@ -50,7 +49,6 @@ public class RsaUtil {
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
/*byte[] result = cipher.doFinal(text.getBytes());*/
|
||||
// 下面该用分段加密
|
||||
byte[] result = null;
|
||||
byte[] b = text.getBytes("utf-8");
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PanelLinkMapping implements Serializable {
|
||||
private Long id;
|
||||
|
||||
private String resourceId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,330 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PanelLinkMappingExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public PanelLinkMappingExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Long value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Long value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Long value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Long value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNull() {
|
||||
addCriterion("resource_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNotNull() {
|
||||
addCriterion("resource_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdEqualTo(String value) {
|
||||
addCriterion("resource_id =", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotEqualTo(String value) {
|
||||
addCriterion("resource_id <>", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThan(String value) {
|
||||
addCriterion("resource_id >", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id >=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThan(String value) {
|
||||
addCriterion("resource_id <", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id <=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLike(String value) {
|
||||
addCriterion("resource_id like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotLike(String value) {
|
||||
addCriterion("resource_id not like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIn(List<String> values) {
|
||||
addCriterion("resource_id in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotIn(List<String> values) {
|
||||
addCriterion("resource_id not in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,20 +1,15 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("消息渠道")
|
||||
public class SysMsgChannel implements Serializable {
|
||||
|
||||
@ApiModelProperty("消息渠道ID")
|
||||
private Long msgChannelId;
|
||||
|
||||
@ApiModelProperty("消息渠道名称")
|
||||
private String channelName;
|
||||
|
||||
private String serviceName;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -233,6 +233,76 @@ public class SysMsgChannelExample {
|
||||
addCriterion("channel_name not between", value1, value2, "channelName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameIsNull() {
|
||||
addCriterion("service_name is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameIsNotNull() {
|
||||
addCriterion("service_name is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameEqualTo(String value) {
|
||||
addCriterion("service_name =", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameNotEqualTo(String value) {
|
||||
addCriterion("service_name <>", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameGreaterThan(String value) {
|
||||
addCriterion("service_name >", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("service_name >=", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameLessThan(String value) {
|
||||
addCriterion("service_name <", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("service_name <=", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameLike(String value) {
|
||||
addCriterion("service_name like", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameNotLike(String value) {
|
||||
addCriterion("service_name not like", value, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameIn(List<String> values) {
|
||||
addCriterion("service_name in", values, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameNotIn(List<String> values) {
|
||||
addCriterion("service_name not in", values, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameBetween(String value1, String value2) {
|
||||
addCriterion("service_name between", value1, value2, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andServiceNameNotBetween(String value1, String value2) {
|
||||
addCriterion("service_name not between", value1, value2, "serviceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package io.dataease.base.mapper;
|
||||
|
||||
import io.dataease.base.domain.PanelLinkMapping;
|
||||
import io.dataease.base.domain.PanelLinkMappingExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface PanelLinkMappingMapper {
|
||||
long countByExample(PanelLinkMappingExample example);
|
||||
|
||||
int deleteByExample(PanelLinkMappingExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(PanelLinkMapping record);
|
||||
|
||||
int insertSelective(PanelLinkMapping record);
|
||||
|
||||
List<PanelLinkMapping> selectByExample(PanelLinkMappingExample example);
|
||||
|
||||
PanelLinkMapping selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PanelLinkMapping record, @Param("example") PanelLinkMappingExample example);
|
||||
|
||||
int updateByExample(@Param("record") PanelLinkMapping record, @Param("example") PanelLinkMappingExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(PanelLinkMapping record);
|
||||
|
||||
int updateByPrimaryKey(PanelLinkMapping record);
|
||||
}
|
||||
@ -0,0 +1,164 @@
|
||||
<?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.PanelLinkMappingMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelLinkMapping">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, resource_id
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.PanelLinkMappingExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from panel_link_mapping
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from panel_link_mapping
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from panel_link_mapping
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.PanelLinkMappingExample">
|
||||
delete from panel_link_mapping
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.PanelLinkMapping">
|
||||
insert into panel_link_mapping (id, resource_id)
|
||||
values (#{id,jdbcType=BIGINT}, #{resourceId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelLinkMapping">
|
||||
insert into panel_link_mapping
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
resource_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
#{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.PanelLinkMappingExample" resultType="java.lang.Long">
|
||||
select count(*) from panel_link_mapping
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update panel_link_mapping
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.resourceId != null">
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update panel_link_mapping
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.PanelLinkMapping">
|
||||
update panel_link_mapping
|
||||
<set>
|
||||
<if test="resourceId != null">
|
||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelLinkMapping">
|
||||
update panel_link_mapping
|
||||
set resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -4,6 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsgChannel">
|
||||
<id column="msg_channel_id" jdbcType="BIGINT" property="msgChannelId" />
|
||||
<result column="channel_name" jdbcType="VARCHAR" property="channelName" />
|
||||
<result column="service_name" jdbcType="VARCHAR" property="serviceName" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -64,7 +65,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
msg_channel_id, channel_name
|
||||
msg_channel_id, channel_name, service_name
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgChannelExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -97,8 +98,10 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.SysMsgChannel">
|
||||
insert into sys_msg_channel (msg_channel_id, channel_name)
|
||||
values (#{msgChannelId,jdbcType=BIGINT}, #{channelName,jdbcType=VARCHAR})
|
||||
insert into sys_msg_channel (msg_channel_id, channel_name, service_name
|
||||
)
|
||||
values (#{msgChannelId,jdbcType=BIGINT}, #{channelName,jdbcType=VARCHAR}, #{serviceName,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsgChannel">
|
||||
insert into sys_msg_channel
|
||||
@ -109,6 +112,9 @@
|
||||
<if test="channelName != null">
|
||||
channel_name,
|
||||
</if>
|
||||
<if test="serviceName != null">
|
||||
service_name,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="msgChannelId != null">
|
||||
@ -117,6 +123,9 @@
|
||||
<if test="channelName != null">
|
||||
#{channelName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="serviceName != null">
|
||||
#{serviceName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.SysMsgChannelExample" resultType="java.lang.Long">
|
||||
@ -134,6 +143,9 @@
|
||||
<if test="record.channelName != null">
|
||||
channel_name = #{record.channelName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.serviceName != null">
|
||||
service_name = #{record.serviceName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -142,7 +154,8 @@
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update sys_msg_channel
|
||||
set msg_channel_id = #{record.msgChannelId,jdbcType=BIGINT},
|
||||
channel_name = #{record.channelName,jdbcType=VARCHAR}
|
||||
channel_name = #{record.channelName,jdbcType=VARCHAR},
|
||||
service_name = #{record.serviceName,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -153,12 +166,16 @@
|
||||
<if test="channelName != null">
|
||||
channel_name = #{channelName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="serviceName != null">
|
||||
service_name = #{serviceName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where msg_channel_id = #{msgChannelId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsgChannel">
|
||||
update sys_msg_channel
|
||||
set channel_name = #{channelName,jdbcType=VARCHAR}
|
||||
set channel_name = #{channelName,jdbcType=VARCHAR},
|
||||
service_name = #{serviceName,jdbcType=VARCHAR}
|
||||
where msg_channel_id = #{msgChannelId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -14,5 +14,4 @@ public interface ExtAuthMapper {
|
||||
List<Long> queryUserIdWithDeptIds(@Param("deptIds") List<Long> deptIds);
|
||||
|
||||
List<SysAuth> queryByResource(@Param("resourceId") String resourceId);
|
||||
// Set<Long> queryUserIdWithRD(@Param("roleIds") List<Long> roleIds, @Param("deptIds") List<Long> deptIds);
|
||||
}
|
||||
|
||||
@ -20,4 +20,6 @@ public interface ExtChartViewMapper {
|
||||
List<String> allViewIds(@Param("tableId") String tableId);
|
||||
|
||||
String searchAdviceSceneId(@Param("userId") String userId,@Param("panelId") String panelId);
|
||||
|
||||
int checkSameDataSet(@Param("viewIdSource") String viewIdSource,@Param("viewIdTarget") String viewIdTarget);
|
||||
}
|
||||
|
||||
@ -150,4 +150,8 @@
|
||||
chart_group.create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="checkSameDataSet" resultType="int">
|
||||
select count(DISTINCT table_id) from chart_view where id = #{viewIdSource} or id = #{viewIdTarget}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -2,6 +2,8 @@ package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.controller.request.panel.PanelShareRemoveRequest;
|
||||
import io.dataease.dto.panel.PanelShareOutDTO;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -10,14 +12,20 @@ import java.util.Map;
|
||||
|
||||
public interface ExtPanelShareMapper {
|
||||
|
||||
int batchInsert(@Param("shares") List<PanelShare> shares);
|
||||
int batchInsert(@Param("shares") List<PanelShare> shares, @Param("userName") String userName);
|
||||
|
||||
int batchDelete(@Param("shareIds") List<Long> shareIds);
|
||||
|
||||
List<PanelSharePo> query(Map<String, Object> param);
|
||||
|
||||
List<PanelSharePo> queryOut(String userName);
|
||||
|
||||
List<PanelShare> queryWithResource(GridExample example);
|
||||
|
||||
List<PanelShareOutDTO> queryTargets(String panelId);
|
||||
|
||||
void removeShares(@Param("request") PanelShareRemoveRequest request);
|
||||
|
||||
List<Long> queryUserIdWithRoleIds(Map<String, List<Long>> param);
|
||||
|
||||
List<Long> queryUserIdWithDeptIds(Map<String, List<Long>> param);
|
||||
|
||||
@ -8,11 +8,20 @@
|
||||
<result column="creator" property="creator" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="targetMap" type="io.dataease.dto.panel.PanelShareOutDTO">
|
||||
<result column="panel_id" property="panelId" />
|
||||
<result column="share_id" property="shareId" />
|
||||
<result column="type" property="type" />
|
||||
<result column="target_Id" property="targetId" />
|
||||
<result column="target_Name" property="targetName" />
|
||||
<result column="create_time" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="batchInsert" parameterType="io.dataease.base.domain.PanelShare">
|
||||
INSERT INTO panel_share (panel_group_id,target_id,create_time,type)
|
||||
INSERT INTO panel_share (panel_group_id,target_id,granter,create_time,type)
|
||||
VALUES
|
||||
<foreach collection="shares" item="share" separator=",">
|
||||
(#{share.panelGroupId}, #{share.targetId}, #{share.createTime}, #{share.type})
|
||||
(#{share.panelGroupId}, #{share.targetId}, #{userName}, #{share.createTime}, #{share.type})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@ -25,7 +34,7 @@
|
||||
</delete>
|
||||
|
||||
<select id="query" resultMap="treeNodeMap">
|
||||
select distinct s.panel_group_id as id, g.create_by as creator, g.name
|
||||
select distinct s.panel_group_id as id, IFNULL(s.granter,g.create_by) as creator, g.name
|
||||
from panel_share s
|
||||
left join panel_group g on g.id = s.panel_group_id
|
||||
where
|
||||
@ -42,6 +51,15 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryOut" resultMap="treeNodeMap">
|
||||
select distinct s.panel_group_id as id, g.name
|
||||
from panel_share s
|
||||
left join panel_group g on g.id = s.panel_group_id
|
||||
where ( s.granter is not null and s.granter = #{userName} ) or ( s.granter is null and g.create_by = #{userName} )
|
||||
order by s.create_time desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryWithResource" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="io.dataease.base.mapper.PanelShareMapper.BaseResultMap">
|
||||
select * from panel_share
|
||||
<if test="_parameter != null">
|
||||
@ -52,6 +70,26 @@
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryTargets" resultMap="targetMap">
|
||||
select
|
||||
s.share_id,
|
||||
s.panel_group_id as panel_id,
|
||||
s.type,
|
||||
s.target_id,
|
||||
s.create_time,
|
||||
(
|
||||
CASE s.type
|
||||
WHEN 0 THEN (select nick_name from sys_user where user_id = s.target_id)
|
||||
WHEN 1 THEN (select name from sys_role where role_id = s.target_id)
|
||||
WHEN 2 THEN (select name from sys_dept where dept_id = s.target_id)
|
||||
END
|
||||
) as target_name
|
||||
from panel_share s
|
||||
where s.panel_group_id = #{panelId}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryUserIdWithRoleIds" resultType="java.lang.Long" >
|
||||
@ -73,6 +111,14 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="removeShares" parameterType="io.dataease.controller.request.panel.PanelShareRemoveRequest">
|
||||
delete from panel_share
|
||||
where panel_group_id = #{request.panelId}
|
||||
<if test="request.shareId != null">
|
||||
and share_id = #{request.shareId}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -14,15 +14,10 @@ public class LicStatusCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
|
||||
// BeanDefinitionRegistry registry = conditionContext.getRegistry();
|
||||
|
||||
// DefaultLicenseService defaultLicenseService = conditionContext.getBeanFactory().getBean(DefaultLicenseService.class);
|
||||
|
||||
DefaultLicenseService defaultLicenseService = CommonBeanFactory.getBean(DefaultLicenseService.class);
|
||||
|
||||
/*if (null == defaultLicenseService) {
|
||||
registry.registerBeanDefinition();
|
||||
}*/
|
||||
|
||||
if (ObjectUtils.isNotEmpty(defaultLicenseService)) {
|
||||
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
|
||||
return F2CLicenseResponse.Status.valid == f2CLicenseResponse.getStatus();
|
||||
|
||||
@ -3,6 +3,7 @@ package io.dataease.commons.constants;
|
||||
public enum DatasourceTypes {
|
||||
excel("excel", "excel", "", "", "", "", ""),
|
||||
mysql("mysql", "mysql", "com.mysql.jdbc.Driver", "`", "`", "'", "'"),
|
||||
hive("hive", "hive", "org.apache.hive.jdbc.HiveDriver", "`", "`", "'", "'"),
|
||||
mariadb("mariadb", "mariadb", "com.mysql.jdbc.Driver", "`", "`", "'", "'"),
|
||||
ds_doris("ds_doris", "ds_doris", "com.mysql.jdbc.Driver", "`", "`", "'", "'"),
|
||||
pg("pg", "pg", "org.postgresql.Driver", "\"", "\"", "\"", "\""),
|
||||
|
||||
@ -23,7 +23,6 @@ public class DefaultLicenseService {
|
||||
private static final String LICENSE_ID = "fit2cloud_license";
|
||||
private static final String validatorUtil = "/usr/bin/validator";
|
||||
private static final String product = "DataEase";
|
||||
/*private static final String[] NO_PLU_LIMIT_MODULES = new String[]{"dashboard", "gateway"};*/
|
||||
|
||||
public F2CLicenseResponse validateLicense(String product, String licenseKey){
|
||||
List<String> command = new ArrayList<String>();
|
||||
@ -46,11 +45,8 @@ public class DefaultLicenseService {
|
||||
return f2CLicenseResponse;
|
||||
}catch (Exception e){
|
||||
LogUtil.error(e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// return F2CLicenseResponse.invalid(e.getMessage());
|
||||
return F2CLicenseResponse.noRecord();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -153,16 +153,7 @@ public class CodingUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/*public static String getSignature(String accessKey, String secretKey) throws Exception {
|
||||
return aesEncrypt(accessKey + "|" + UUID.randomUUID().toString() + "|" + System.currentTimeMillis(), secretKey, accessKey);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
String accessKey = "gnPFmtAsdLhUEWPA";
|
||||
String secretKey = "TfK5FGUle0KRfJJJ";
|
||||
String signature = getSignature(accessKey, secretKey);
|
||||
System.out.println(signature);
|
||||
}*/
|
||||
|
||||
public static String secretKey() {
|
||||
try {
|
||||
|
||||
@ -95,23 +95,6 @@ public class DateUtils {
|
||||
}
|
||||
|
||||
|
||||
/* public static void main(String[] args) throws Exception {
|
||||
// System.out.println("start:");
|
||||
Date paramTime = getTime(getTimeString(new Long("1607672440731")));
|
||||
|
||||
Map<String, Date> weekDate = getWeedFirstTimeAndLastTime(paramTime);
|
||||
|
||||
for (Map.Entry<String, Date> entry :
|
||||
weekDate.entrySet()) {
|
||||
// System.out.println(entry.getKey() + ":" + getTimeString(entry.getValue())+":"+entry.getValue().getTime());
|
||||
}
|
||||
|
||||
long countTimeLong = new Long("1607672440731");
|
||||
|
||||
// System.out.println(getTimeString(--countTimeLong));
|
||||
|
||||
} */
|
||||
|
||||
|
||||
/**
|
||||
* 获取当天的起始时间Date
|
||||
|
||||
@ -46,14 +46,8 @@ public class DeFileUtils {
|
||||
String path = filePath + fileName;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
if (!dest.getParentFile().mkdirs()) {
|
||||
// System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
|
||||
// 文件写入
|
||||
// file.transferTo(dest);
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(dest);
|
||||
fileOutputStream.write(file.getBytes());
|
||||
fileOutputStream.flush();
|
||||
|
||||
@ -8,8 +8,6 @@ import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public class LogUtil {
|
||||
//日志工具类
|
||||
// public static final Log Logger = LogFactory.getLog(LogUtil.class);
|
||||
|
||||
private static final String DEBUG = "DEBUG";
|
||||
private static final String INFO = "INFO";
|
||||
|
||||
@ -124,12 +124,6 @@ public class XssAndSqlHttpServletRequestWrapper extends HttpServletRequestWrappe
|
||||
case '<':
|
||||
sb.append("<");// 转义小于号
|
||||
break;
|
||||
// case '\'':
|
||||
// sb.append("'");// 转义单引号
|
||||
// break;
|
||||
// case '\"':
|
||||
// sb.append(""");// 转义双引号
|
||||
// break;
|
||||
case '&':
|
||||
sb.append("&");// 转义&
|
||||
break;
|
||||
@ -261,7 +255,6 @@ public class XssAndSqlHttpServletRequestWrapper extends HttpServletRequestWrappe
|
||||
"<[\r\n| | ]*script[\r\n| | ]*>(.*?)</[\r\n| | ]*script[\r\n| | ]*>", Pattern.CASE_INSENSITIVE);
|
||||
flag = scriptPattern.matcher(value).find();
|
||||
if (flag) {
|
||||
// threadLocal.set("包含XSS攻击脚本,请检查参数!");
|
||||
return flag;
|
||||
}
|
||||
// Avoid anything in a
|
||||
|
||||
@ -62,13 +62,6 @@ public class Knife4jConfiguration implements BeanPostProcessor{
|
||||
return defaultApi("系统管理", "io.dataease.controller.sys");
|
||||
}
|
||||
|
||||
/*@Bean(value = "pluginsApi")
|
||||
@Conditional(LicStatusCondition.class)
|
||||
public Docket pluginsApi() {
|
||||
return defaultApi("插件管理", "io.dataease.plugins.server");
|
||||
}*/
|
||||
|
||||
|
||||
private ApiInfo apiInfo(){
|
||||
return new ApiInfoBuilder()
|
||||
.title("DataEase")
|
||||
|
||||
@ -2,11 +2,15 @@ package io.dataease.controller;
|
||||
|
||||
import io.dataease.commons.license.DefaultLicenseService;
|
||||
import io.dataease.commons.license.F2CLicenseResponse;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.service.panel.PanelLinkService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Controller
|
||||
@RequestMapping
|
||||
@ -15,6 +19,9 @@ public class IndexController {
|
||||
@Resource
|
||||
private DefaultLicenseService defaultLicenseService;
|
||||
|
||||
@Resource
|
||||
private PanelLinkService panelLinkService;
|
||||
|
||||
@GetMapping(value = "/")
|
||||
public String index() {
|
||||
return "index.html";
|
||||
@ -42,11 +49,18 @@ public class IndexController {
|
||||
case valid:
|
||||
return "doc.html";
|
||||
default:
|
||||
// DataEaseException.throwException("Invalid License.");
|
||||
/* return "nolic.html"; */
|
||||
return "doc.html";
|
||||
return "nolic.html";
|
||||
}
|
||||
// return "index.html";
|
||||
}
|
||||
|
||||
@GetMapping("/xggznb/{index}")
|
||||
public String xggznb(@PathVariable(value = "index", required = true) Long index) {
|
||||
String url = panelLinkService.getUrlByIndex(index);
|
||||
HttpServletResponse response = ServletUtils.response();
|
||||
String param = url.substring(url.indexOf("?") + 1);
|
||||
Cookie cookie = new Cookie("link", param);
|
||||
response.addCookie(cookie);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package io.dataease.controller.chart;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.request.chart.ChartCalRequest;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.chart.ChartViewRequest;
|
||||
import io.dataease.controller.response.ChartDetail;
|
||||
@ -100,4 +101,16 @@ public class ChartViewController {
|
||||
public List<ChartViewDTO> search(@RequestBody ChartViewRequest chartViewRequest) {
|
||||
return chartViewService.search(chartViewRequest);
|
||||
}
|
||||
|
||||
@ApiOperation("计算结果")
|
||||
@PostMapping("/calcData")
|
||||
public ChartViewDTO calcData(@RequestBody ChartCalRequest request) throws Exception {
|
||||
return chartViewService.calcData(request.getView(), request.getRequestList(), false);
|
||||
}
|
||||
|
||||
@ApiOperation("验证视图是否使用相同数据集")
|
||||
@GetMapping("/checkSameDataSet/{viewIdSource}/{viewIdTarget}")
|
||||
public String checkSameDataSet(@PathVariable String viewIdSource,@PathVariable String viewIdTarget) throws Exception {
|
||||
return chartViewService.checkSameDataSet(viewIdSource,viewIdTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,6 @@ public class DatasourceController {
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<DatasourceDTO>> getDatasourceList(@RequestBody BaseGridRequest request, @PathVariable int goPage, @PathVariable int pageSize) throws Exception {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
// return PageUtils.setPageInfo(page, datasourceService.getDatasourceList(request));
|
||||
return PageUtils.setPageInfo(page, datasourceService.gridQuery(request));
|
||||
}
|
||||
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
/*
|
||||
package io.dataease.controller.handler;
|
||||
|
||||
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
import org.apache.shiro.ShiroException;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
@RestControllerAdvice
|
||||
public class RestControllerExceptionHandler {
|
||||
*/
|
||||
/*=========== Shiro 异常拦截==============*//*
|
||||
|
||||
@ExceptionHandler(ShiroException.class)
|
||||
public ResultHolder exceptionHandler(HttpServletRequest request, HttpServletResponse response, Exception exception) {
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
return ResultHolder.error(exception.getMessage());
|
||||
}
|
||||
|
||||
*/
|
||||
/*=========== Shiro 异常拦截==============*//*
|
||||
|
||||
@ExceptionHandler(UnauthorizedException.class)
|
||||
public ResultHolder unauthorizedExceptionHandler(HttpServletRequest request, HttpServletResponse response, Exception exception) {
|
||||
response.setStatus(HttpStatus.FORBIDDEN.value());
|
||||
return ResultHolder.error(exception.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@ExceptionHandler(SQLException.class)
|
||||
public ResultHolder sqlExceptionHandler(HttpServletRequest request, HttpServletResponse response, DEException e) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ResultHolder.error("SQL error happened, please check logs.");
|
||||
}
|
||||
|
||||
@ExceptionHandler(DEException.class)
|
||||
public ResultHolder msExceptionHandler(HttpServletRequest request, HttpServletResponse response, DEException e) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ResultHolder.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -4,10 +4,7 @@ package io.dataease.controller.panel.api;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.panel.link.EnablePwdRequest;
|
||||
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||
import io.dataease.controller.request.panel.link.OverTimeRequest;
|
||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||
import io.dataease.controller.request.panel.link.*;
|
||||
import io.dataease.dto.panel.link.GenerateDto;
|
||||
import io.dataease.dto.panel.link.ValidateDto;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -44,7 +41,7 @@ public interface LinkApi {
|
||||
|
||||
@ApiOperation("验证访问")
|
||||
@PostMapping("/validate")
|
||||
ValidateDto validate(Map<String, String> param) throws Exception;
|
||||
ValidateDto validate(LinkValidateRequest request) throws Exception;
|
||||
|
||||
@ApiOperation("验证密码")
|
||||
@PostMapping("/validatePwd")
|
||||
@ -60,5 +57,5 @@ public interface LinkApi {
|
||||
|
||||
@ApiOperation("压缩链接")
|
||||
@PostMapping("/shortUrl")
|
||||
ResultHolder shortUrl(@RequestBody Map<String,String> param);
|
||||
String shortUrl(@RequestBody Map<String,String> param);
|
||||
}
|
||||
|
||||
@ -3,14 +3,17 @@ package io.dataease.controller.panel.api;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.controller.request.panel.PanelShareFineDto;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.request.panel.PanelShareRemoveRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelShareOutDTO;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -22,22 +25,36 @@ import java.util.List;
|
||||
@RequestMapping("/api/share")
|
||||
public interface ShareApi {
|
||||
|
||||
@ApiIgnore
|
||||
@PostMapping("/")
|
||||
void share(PanelShareRequest request);
|
||||
|
||||
@ApiOperation("查询分享")
|
||||
|
||||
@ApiOperation("查询分享给我")
|
||||
@PostMapping("/treeList")
|
||||
List<PanelShareDto> treeList(BaseGridRequest request);
|
||||
|
||||
@ApiOperation("查询我分享的")
|
||||
@PostMapping("/shareOut")
|
||||
List<PanelSharePo> shareOut();
|
||||
|
||||
|
||||
|
||||
@ApiOperation("根据资源查询分享")
|
||||
@PostMapping("/queryWithResourceId")
|
||||
List<PanelShare> queryWithResourceId(BaseGridRequest request);
|
||||
|
||||
@ApiOperation("查询分享目标")
|
||||
@PostMapping("/queryTargets/{panelId}")
|
||||
@ApiImplicitParam(paramType = "path", value = "仪表板ID", name = "panelId", required = true, dataType = "String")
|
||||
List<PanelShareOutDTO> queryTargets(@PathVariable("panelId") String panelId);
|
||||
|
||||
|
||||
@ApiOperation("创建分享")
|
||||
@PostMapping("/fineSave")
|
||||
void fineSave(PanelShareFineDto panelShareFineDto);
|
||||
|
||||
|
||||
|
||||
@ApiOperation("删除分享")
|
||||
@PostMapping("/removeShares")
|
||||
void removeShares(PanelShareRemoveRequest request);
|
||||
|
||||
}
|
||||
|
||||
@ -5,10 +5,7 @@ import io.dataease.base.domain.PanelLink;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
import io.dataease.controller.panel.api.LinkApi;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.panel.link.EnablePwdRequest;
|
||||
import io.dataease.controller.request.panel.link.LinkRequest;
|
||||
import io.dataease.controller.request.panel.link.OverTimeRequest;
|
||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||
import io.dataease.controller.request.panel.link.*;
|
||||
import io.dataease.dto.panel.link.GenerateDto;
|
||||
import io.dataease.dto.panel.link.ValidateDto;
|
||||
import io.dataease.service.chart.ChartViewService;
|
||||
@ -64,15 +61,12 @@ public class LinkServer implements LinkApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidateDto validate(@RequestBody Map<String, String> param) throws Exception{
|
||||
String link = param.get("link");
|
||||
public ValidateDto validate(@RequestBody LinkValidateRequest request) throws Exception{
|
||||
String link = request.getLink();
|
||||
String json = panelLinkService.decryptParam(link);
|
||||
/* Gson gson = new Gson();
|
||||
|
||||
ValidateRequest request = gson.fromJson(json, ValidateRequest.class); */
|
||||
ValidateDto dto = new ValidateDto();
|
||||
String resourceId = json;
|
||||
/* String resourceId = request.getResourceId(); */
|
||||
PanelLink one = panelLinkService.findOne(resourceId);
|
||||
dto.setResourceId(resourceId);
|
||||
if (ObjectUtils.isEmpty(one)){
|
||||
@ -101,9 +95,11 @@ public class LinkServer implements LinkApi {
|
||||
return chartViewService.getData(viewId, requestList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResultHolder shortUrl(Map<String,String> param) {
|
||||
String url = param.get("url");
|
||||
return panelLinkService.getShortUrl(url);
|
||||
public String shortUrl(Map<String,String> param) {
|
||||
String resourceId = param.get("resourceId");
|
||||
return panelLinkService.getShortUrl(resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,14 @@ package io.dataease.controller.panel.server;
|
||||
import io.dataease.base.domain.PanelShare;
|
||||
import io.dataease.controller.panel.api.ShareApi;
|
||||
import io.dataease.controller.request.panel.PanelShareFineDto;
|
||||
import io.dataease.controller.request.panel.PanelShareRemoveRequest;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelShareOutDTO;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import io.dataease.service.panel.ShareService;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -18,26 +22,37 @@ public class ShareServer implements ShareApi {
|
||||
|
||||
@Resource
|
||||
private ShareService shareService;
|
||||
@Override
|
||||
public void share(@RequestBody PanelShareRequest request) {
|
||||
shareService.save(request);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PanelShareDto> treeList(@RequestBody BaseGridRequest request) {
|
||||
return shareService.queryTree(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PanelSharePo> shareOut() {
|
||||
return shareService.queryShareOut();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PanelShare> queryWithResourceId(@RequestBody BaseGridRequest request) {
|
||||
return shareService.queryWithResource(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PanelShareOutDTO> queryTargets(@PathVariable("panelId") String panelId) {
|
||||
return shareService.queryTargets(panelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fineSave(@RequestBody PanelShareFineDto panelShareFineDto) {
|
||||
shareService.fineSave(panelShareFineDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeShares(@RequestBody PanelShareRemoveRequest request) {
|
||||
shareService.removeShares(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@ public class ViewServer implements ViewApi {
|
||||
if(CollectionUtils.isNotEmpty(groups)&&CollectionUtils.isNotEmpty(views)){
|
||||
groups.addAll(views);
|
||||
}
|
||||
// List<PanelViewDto> panelViewDtos = panelViewService.buildTree(groups, views);
|
||||
return TreeUtils.mergeTree(groups);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package io.dataease.controller.request.chart;
|
||||
|
||||
import io.dataease.base.domain.ChartViewWithBLOBs;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/11/10 11:27 上午
|
||||
*/
|
||||
@Data
|
||||
public class ChartCalRequest {
|
||||
@ApiModelProperty("视图")
|
||||
private ChartViewWithBLOBs view;
|
||||
@ApiModelProperty("额外请求参数")
|
||||
private ChartExtRequest requestList;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package io.dataease.controller.request.panel;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("取消分享参数")
|
||||
public class PanelShareRemoveRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty("仪表板ID")
|
||||
private String panelId;
|
||||
|
||||
@ApiModelProperty("分享ID")
|
||||
private String shareId;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package io.dataease.controller.request.panel.link;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class LinkValidateRequest implements Serializable {
|
||||
|
||||
private String link;
|
||||
}
|
||||
@ -62,7 +62,6 @@ public class MsgController {
|
||||
if(null == AuthUtils.getUser() || (userId = AuthUtils.getUser().getUserId()) == null) {
|
||||
throw new RuntimeException("缺少用户ID");
|
||||
}
|
||||
// Long userId = request.get("userId");
|
||||
return sysMsgService.queryCount(userId);
|
||||
}
|
||||
|
||||
|
||||
@ -4,14 +4,10 @@ import io.dataease.base.domain.SysDept;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
/*import io.dataease.controller.sys.request.DeptCreateRequest;
|
||||
import io.dataease.controller.sys.request.DeptDeleteRequest;
|
||||
import io.dataease.controller.sys.request.DeptStatusRequest;*/
|
||||
import io.dataease.controller.sys.response.DeptNodeResponse;
|
||||
import io.dataease.controller.sys.response.DeptTreeNode;
|
||||
import io.dataease.service.sys.DeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
/*import io.swagger.annotations.ApiOperation;*/
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -56,34 +52,7 @@ public class SysDeptController extends ResultHolder {
|
||||
return nodeResponses;
|
||||
}
|
||||
|
||||
/*@ApiOperation("查询部门")
|
||||
@PostMapping("/root")
|
||||
public ResultHolder rootData(){
|
||||
List<SysDept> root = deptService.nodesByPid(null);
|
||||
return success(root);
|
||||
}*/
|
||||
|
||||
/*@ApiOperation("新增部门")
|
||||
@PostMapping("/create")
|
||||
public void create(@RequestBody DeptCreateRequest dept){
|
||||
deptService.add(dept);
|
||||
}
|
||||
|
||||
@ApiOperation("删除部门")
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestBody List<DeptDeleteRequest> requests){
|
||||
deptService.batchDelete(requests);
|
||||
}
|
||||
@ApiOperation("更新部门")
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody DeptCreateRequest dept){
|
||||
deptService.update(dept);
|
||||
}
|
||||
@ApiOperation("更新状态")
|
||||
@PostMapping("/updateStatus")
|
||||
public void updateStatus(@RequestBody DeptStatusRequest request){
|
||||
deptService.updateStatus(request);
|
||||
}*/
|
||||
|
||||
@PostMapping("/nodesByDeptId/{deptId}")
|
||||
public List<DeptTreeNode> nodesByDeptId(@PathVariable("deptId") Long deptId){
|
||||
|
||||
@ -1,78 +0,0 @@
|
||||
package io.dataease.controller.sys;
|
||||
|
||||
|
||||
/*import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.base.domain.SysRole;
|
||||
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.RoleMenusRequest;*/
|
||||
import io.dataease.controller.sys.response.RoleUserItem;
|
||||
import io.dataease.service.sys.SysRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
/*import io.swagger.annotations.ApiOperation;*/
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
/*@ApiIgnore
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统:角色管理")
|
||||
@RequestMapping("/api/role")
|
||||
public class SysRoleController {*/
|
||||
/*
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
|
||||
@ApiOperation("新增角色")
|
||||
@PostMapping("/create")
|
||||
public void create(@RequestBody SysRole role){
|
||||
sysRoleService.add(role);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除角色")
|
||||
@PostMapping("/delete/{roleId}")
|
||||
public void delete(@PathVariable("roleId") Long roleId){
|
||||
sysRoleService.delete(roleId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("更新角色")
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody SysRole role){
|
||||
sysRoleService.update(role);
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@PostMapping("/roleGrid/{goPage}/{pageSize}")
|
||||
public Pager<List<SysRole>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
Pager<List<SysRole>> listPager = PageUtils.setPageInfo(page, sysRoleService.query(request));
|
||||
return listPager;
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色对应的菜单ID")
|
||||
@PostMapping("/menuIds/{roleId}")
|
||||
public List<Long> menuIdsByRoleId(@PathVariable("roleId") Long roleId){
|
||||
return sysRoleService.menuIds(roleId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/saveRolesMenus")
|
||||
public void saveRolesMenus(@RequestBody RoleMenusRequest request){
|
||||
sysRoleService.batchSaveRolesMenus(request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/all")
|
||||
public List<RoleUserItem> all(){
|
||||
return sysRoleService.allRoles();
|
||||
}
|
||||
*/
|
||||
/*}*/
|
||||
@ -54,10 +54,7 @@ public class SysUserController {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, sysUserService.query(request));
|
||||
}
|
||||
/*public Pager<List<SysUserGridResponse>> userGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody UserGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, sysUserService.query(request));
|
||||
}*/
|
||||
|
||||
|
||||
@ApiOperation("创建用户")
|
||||
@PostMapping("/create")
|
||||
@ -146,11 +143,7 @@ public class SysUserController {
|
||||
}
|
||||
|
||||
|
||||
/* @ApiOperation("同步用户")
|
||||
@PostMapping("/sync")
|
||||
public void importLdap(@RequestBody LdapAddRequest request) {
|
||||
sysUserService.saveLdapUsers(request);
|
||||
} */
|
||||
|
||||
|
||||
@ApiOperation("已同步用户")
|
||||
@PostMapping("/existLdapUsers")
|
||||
|
||||
@ -6,8 +6,8 @@ import io.dataease.controller.sys.response.BasicInfo;
|
||||
import io.dataease.controller.sys.response.MailInfo;
|
||||
import io.dataease.dto.SystemParameterDTO;
|
||||
import io.dataease.service.FileService;
|
||||
import io.dataease.service.system.EmailService;
|
||||
import io.dataease.service.system.SystemParameterService;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -16,12 +16,12 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiIgnore
|
||||
@RestController
|
||||
@RequestMapping(value = "/system")
|
||||
@ -32,10 +32,13 @@ public class SystemParameterController {
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
@Resource
|
||||
private EmailService emailService;
|
||||
|
||||
|
||||
@GetMapping("/mail/info")
|
||||
public MailInfo mailInfo() {
|
||||
return systemParameterService.mailInfo(ParamConstants.Classify.MAIL.getValue());
|
||||
return emailService.mailInfo();
|
||||
}
|
||||
|
||||
@GetMapping("/basic/info")
|
||||
@ -51,7 +54,7 @@ public class SystemParameterController {
|
||||
|
||||
@PostMapping("/edit/email")
|
||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||
systemParameterService.editMail(systemParameter);
|
||||
emailService.editMail(systemParameter);
|
||||
}
|
||||
|
||||
@PostMapping("/edit/basic")
|
||||
@ -61,7 +64,7 @@ public class SystemParameterController {
|
||||
|
||||
@PostMapping("/testConnection")
|
||||
public void testConnection(@RequestBody HashMap<String, String> hashMap) {
|
||||
systemParameterService.testConnection(hashMap);
|
||||
emailService.testConnection(hashMap);
|
||||
}
|
||||
|
||||
@GetMapping("/version")
|
||||
|
||||
@ -15,34 +15,4 @@ import java.util.List;
|
||||
public class SysAuthDTO extends SysAuth {
|
||||
|
||||
private List<SysAuthDetail> sysAuthDetails;
|
||||
|
||||
// private List<BaseAuthDetail> baseAuthDetails;
|
||||
//
|
||||
// private String authDetails;
|
||||
//
|
||||
// @Override
|
||||
// public void setAuthDetails(String authDetails) {
|
||||
// this.authDetails = authDetails;
|
||||
// if(StringUtils.isNotEmpty(authDetails)){
|
||||
// try{
|
||||
// baseAuthDetails = JSON.parseArray(authDetails,BaseAuthDetail.class);
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// //ignored
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public List<BaseAuthDetail> getBaseAuthDetails() {
|
||||
// return baseAuthDetails;
|
||||
// }
|
||||
//
|
||||
// public void setBaseAuthDetails(List<BaseAuthDetail> baseAuthDetails) {
|
||||
// this.baseAuthDetails = baseAuthDetails;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getAuthDetails() {
|
||||
// return authDetails;
|
||||
// }
|
||||
}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package io.dataease.dto.datasource;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class HiveConfiguration extends JdbcConfiguration {
|
||||
|
||||
private String driver = "org.apache.hive.jdbc.HiveDriver";
|
||||
private String extraParams = "";
|
||||
|
||||
public String getJdbc() {
|
||||
if(StringUtils.isEmpty(extraParams.trim())){
|
||||
return "jdbc:hive2://HOSTNAME:PORT/DATABASE"
|
||||
.replace("HOSTNAME", getHost().trim())
|
||||
.replace("PORT", getPort().toString().trim())
|
||||
.replace("DATABASE", getDataBase().trim());
|
||||
}else {
|
||||
return "jdbc:hive2://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
|
||||
.replace("HOSTNAME", getHost().trim())
|
||||
.replace("PORT", getPort().toString().trim())
|
||||
.replace("DATABASE", getDataBase().trim())
|
||||
.replace("EXTRA_PARAMS", getExtraParams().trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package io.dataease.dto.panel;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel("仪表板分享目标")
|
||||
@Data
|
||||
public class PanelShareOutDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty("仪表板ID")
|
||||
private String panelId;
|
||||
|
||||
@ApiModelProperty("分享ID")
|
||||
private Long shareId;
|
||||
|
||||
@ApiModelProperty("分享类型{0:用户,1:角色,2:组织}")
|
||||
private int type;
|
||||
|
||||
@ApiModelProperty("目标ID")
|
||||
private String targetId;
|
||||
|
||||
@ApiModelProperty("目标名称")
|
||||
private String targetName;
|
||||
|
||||
@ApiModelProperty("分享时间")
|
||||
private Long createTime;
|
||||
}
|
||||
@ -75,9 +75,7 @@ public class ScheduleManager {
|
||||
triggerBuilder.withIdentity(triggerKey);
|
||||
|
||||
Date nTimeByCron = getNTimeByCron(cron, startTime);
|
||||
// if (startTime.before(new Date())) {
|
||||
triggerBuilder.startAt(nTimeByCron);
|
||||
// }
|
||||
|
||||
if (endTime != null) {
|
||||
if (endTime.before(nTimeByCron)) {
|
||||
@ -160,9 +158,7 @@ public class ScheduleManager {
|
||||
triggerBuilder.withIdentity(triggerKey);// 触发器名,触发器组
|
||||
|
||||
Date nTimeByCron = getNTimeByCron(cron, startTime);
|
||||
// if (startTime.before(new Date())) {
|
||||
triggerBuilder.startAt(nTimeByCron);
|
||||
// }
|
||||
|
||||
if (endTime != null) {
|
||||
if (endTime.before(nTimeByCron)) {
|
||||
@ -179,14 +175,6 @@ public class ScheduleManager {
|
||||
trigger = (CronTrigger) triggerBuilder.build();// 创建Trigger对象
|
||||
|
||||
scheduler.rescheduleJob(triggerKey, trigger);// 修改一个任务的触发时间
|
||||
/** 方式一 :调用 rescheduleJob 结束 */
|
||||
|
||||
/** 方式二:先删除,然后在创建一个新的Job */
|
||||
// JobDetail jobDetail = sched.getJobDetail(JobKey.jobKey(jobName, jobGroupName));
|
||||
// Class<? extends Job> jobClass = jobDetail.getJobClass();
|
||||
// removeJob(jobName, jobGroupName, triggerName, triggerGroupName);
|
||||
// addJob(jobName, jobGroupName, triggerName, triggerGroupName, jobClass, cron);
|
||||
/** 方式二 :先删除,然后在创建一个新的Job */
|
||||
} catch (Exception e) {
|
||||
DataEaseException.throwException(e);
|
||||
}
|
||||
@ -227,15 +215,6 @@ public class ScheduleManager {
|
||||
trigger = (SimpleTrigger) triggerBuilder.build();// 创建Trigger对象
|
||||
|
||||
scheduler.rescheduleJob(triggerKey, trigger);// 修改一个任务的触发时间
|
||||
|
||||
/** 方式一 :调用 rescheduleJob 结束 */
|
||||
|
||||
/** 方式二:先删除,然后在创建一个新的Job */
|
||||
// JobDetail jobDetail = sched.getJobDetail(JobKey.jobKey(jobName, jobGroupName));
|
||||
// Class<? extends Job> jobClass = jobDetail.getJobClass();
|
||||
// removeJob(jobName, jobGroupName, triggerName, triggerGroupName);
|
||||
// addJob(jobName, jobGroupName, triggerName, triggerGroupName, jobClass, cron);
|
||||
/** 方式二 :先删除,然后在创建一个新的Job */
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -21,20 +21,14 @@ public class LicCacheEventListener extends CacheEventListenerFactory implements
|
||||
|
||||
@Override
|
||||
public void notifyElementRemoved(Ehcache ehcache, Element element) throws CacheException {
|
||||
/*System.out.println("notifyElementRemoved");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyElementPut(Ehcache ehcache, Element element) throws CacheException {
|
||||
|
||||
/*long expirationTime = element.getExpirationTime();
|
||||
System.out.println(expirationTime);
|
||||
System.out.println("notifyElementPut");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyElementUpdated(Ehcache ehcache, Element element) throws CacheException {
|
||||
/*System.out.println("notifyElementUpdated");*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,12 +45,10 @@ public class LicCacheEventListener extends CacheEventListenerFactory implements
|
||||
|
||||
@Override
|
||||
public void notifyElementEvicted(Ehcache ehcache, Element element) {
|
||||
/*System.out.println("notifyElementEvicted");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyRemoveAll(Ehcache ehcache) {
|
||||
/*System.out.println("notifyRemoveAll");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -28,7 +28,6 @@ public class MapServer implements MapApi {
|
||||
@Override
|
||||
public String asyncGeometry() {
|
||||
try {
|
||||
// List<AreaEntity> areaEntities = MapUtils.readAreaEntity();
|
||||
List<AreaEntity> areaEntities = mapService.areaEntities();
|
||||
MapUtils.recursionWriteFull(areaEntities);
|
||||
}catch (Exception e) {
|
||||
|
||||
@ -34,15 +34,10 @@ public class MapUtils {
|
||||
|
||||
|
||||
public static String formatCode(String code) {
|
||||
// return code.substring(3);
|
||||
return code;
|
||||
}
|
||||
|
||||
/*public static List<Map<String, Object>> readCodeList( ) {
|
||||
ExcelReader reader = ExcelUtil.getReader(path);
|
||||
List<Map<String, Object>> maps = reader.readAll();
|
||||
return maps;
|
||||
}*/
|
||||
|
||||
public static List<Map<String, Object>> readCodeList( ) {
|
||||
AreaMappingExample example = new AreaMappingExample();
|
||||
List<AreaMapping> areaMappings = areaMappingMapper.selectByExample(example);
|
||||
@ -61,7 +56,6 @@ public class MapUtils {
|
||||
|
||||
public static List<AreaEntity> readAreaEntity() {
|
||||
List<Map<String, Object>> maps = readCodeList();
|
||||
// AreaEntity root = new AreaEntity;
|
||||
|
||||
Map<String, AreaEntity> provinceMap = new ConcurrentHashMap<>();
|
||||
Map<String, AreaEntity> cityMap = new ConcurrentHashMap<>();
|
||||
@ -70,7 +64,6 @@ public class MapUtils {
|
||||
AreaEntity china = root();
|
||||
|
||||
maps.stream().forEach(map -> {
|
||||
// maps.stream().forEach(map -> {
|
||||
String province_code = map.get(Constants.PROVINCE_CODE).toString();
|
||||
String city_code = map.get(Constants.CITY_CODE).toString();
|
||||
String county_code = map.get(Constants.COUNTY_CODE).toString();
|
||||
@ -114,7 +107,6 @@ public class MapUtils {
|
||||
}
|
||||
}
|
||||
});
|
||||
// List<AreaEntity> treeNodes = provinceMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
|
||||
List<AreaEntity> result = new ArrayList<>();
|
||||
result.add(china);
|
||||
return result;
|
||||
@ -131,10 +123,6 @@ public class MapUtils {
|
||||
if (StrUtil.equals("1", mapResponse.getStatus()) && StrUtil.equalsAnyIgnoreCase("ok", mapResponse.getInfo()) && StrUtil.equalsAnyIgnoreCase("10000", mapResponse.getInfocode())) {
|
||||
List<District> districts = mapResponse.getDistricts();
|
||||
if (CollectionUtil.isNotEmpty(districts)) {
|
||||
|
||||
/*District district = districts.get(0);
|
||||
MapResultDto mapResultDto = buildGeometry(district, areaEntity);
|
||||
writeFeatureFile(mapResultDto, areaEntity.getCode());*/
|
||||
List<Feature> kidFeatures = districts.stream().map(district -> buildFeature(district, areaEntity)).collect(Collectors.toList());
|
||||
MapResultDto mapResultDto = buildGeometry(kidFeatures);
|
||||
writeFeatureFile(mapResultDto, areaEntity.getCode());
|
||||
@ -234,15 +222,7 @@ public class MapUtils {
|
||||
|
||||
|
||||
|
||||
/*public static MapResultDto buildGeometry(District district, AreaEntity areaEntity) {
|
||||
Feature feature = buildFeature(district, areaEntity);
|
||||
MapResultDto mapResultDto = new MapResultDto();
|
||||
mapResultDto.setType("FeatureCollection");
|
||||
List<Feature> features = new ArrayList<>();
|
||||
features.add(feature);
|
||||
mapResultDto.setFeatures(features);
|
||||
return mapResultDto;
|
||||
}*/
|
||||
|
||||
|
||||
public static MapResultDto buildGeometry(List<Feature> features) {
|
||||
MapResultDto mapResultDto = new MapResultDto();
|
||||
|
||||
@ -47,7 +47,6 @@ public class PluginRunner implements ApplicationRunner {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
//e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -76,7 +76,6 @@ public class ControllerLoader {
|
||||
try {
|
||||
registerController(name);
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
});
|
||||
|
||||
@ -104,9 +104,6 @@ public class ModuleClassLoader extends URLClassLoader {
|
||||
byte[] classBytes = baos.toByteArray();
|
||||
classBytesMap.put(className,classBytes);
|
||||
}
|
||||
/*if (name.endsWith(".xml")) {
|
||||
loadMapperXml(name);
|
||||
}*/
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -36,7 +36,6 @@ public class XOidcServer {
|
||||
Map<String, String> authParam = new HashMap<>();
|
||||
authParam.put("response_type", "code");
|
||||
authParam.put("state", "state");
|
||||
// authParam.put("redirect_uri", "http://localhost:9528");
|
||||
|
||||
|
||||
oidcSettings.forEach(param -> {
|
||||
|
||||
@ -24,7 +24,6 @@ public class XUserKeysServer {
|
||||
|
||||
@PostMapping("validate")
|
||||
public String validate(ServletRequest request) {
|
||||
// return ApiKeyHandler.getUser(WebUtils.toHttp(request));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -47,15 +46,5 @@ public class XUserKeysServer {
|
||||
ukeyXpackService.switchStatus(id);
|
||||
}
|
||||
|
||||
/*@GetMapping("active/{id}")
|
||||
public void activeUserKey(@PathVariable Long id) {
|
||||
UkeyXpackService ukeyXpackService = SpringContextUtil.getBean(UkeyXpackService.class);
|
||||
ukeyXpackService.activeUserKey(id);
|
||||
}
|
||||
|
||||
@GetMapping("disable/{id}")
|
||||
public void disabledUserKey(@PathVariable Long id) {
|
||||
UkeyXpackService ukeyXpackService = SpringContextUtil.getBean(UkeyXpackService.class);
|
||||
ukeyXpackService.disableUserKey(id);
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -53,6 +53,8 @@ public class ProviderFactory implements ApplicationContextAware {
|
||||
return context.getBean("mongoQuery", QueryProvider.class);
|
||||
case redshift:
|
||||
return context.getBean("redshiftQuery", QueryProvider.class);
|
||||
case hive:
|
||||
return context.getBean("hiveQuery", QueryProvider.class);
|
||||
default:
|
||||
return context.getBean("mysqlQuery", QueryProvider.class);
|
||||
}
|
||||
|
||||
@ -14,10 +14,6 @@ public abstract class DatasourceProvider {
|
||||
|
||||
abstract public List<String> getTables(DatasourceRequest datasourceRequest) throws Exception;
|
||||
|
||||
// public List<TableFiled> getTableFileds(DatasourceRequest datasourceRequest) throws Exception {
|
||||
// return new ArrayList<>();
|
||||
// };
|
||||
|
||||
public void checkStatus(DatasourceRequest datasourceRequest) throws Exception {
|
||||
getData(datasourceRequest);
|
||||
}
|
||||
|
||||
@ -194,10 +194,10 @@ public class EsProvider extends DatasourceProvider {
|
||||
}
|
||||
|
||||
for (String[] row : esReponse.getRows()) {
|
||||
if(row.length == 3 && row[1].equalsIgnoreCase("TABLE") && row[2].equalsIgnoreCase("INDEX")){
|
||||
if(row.length == 3 && row[1].contains("TABLE") && row[2].equalsIgnoreCase("INDEX")){
|
||||
tables.add(row[0]);
|
||||
}
|
||||
if(row.length == 2 && row[1].equalsIgnoreCase("BASE TABLE")){
|
||||
if(row.length == 2 && row[1].contains("TABLE")){
|
||||
tables.add(row[0]);
|
||||
}
|
||||
}
|
||||
@ -209,17 +209,7 @@ public class EsProvider extends DatasourceProvider {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<TableFiled> getTableFileds(DatasourceRequest datasourceRequest) throws Exception {
|
||||
// List<TableFiled> tableFileds = new ArrayList<>();
|
||||
// try {
|
||||
// String response = exexQuery(datasourceRequest, "desc " + datasourceRequest.getTable(), "?format=json");
|
||||
// tableFileds = fetchResultField(response);
|
||||
// } catch (Exception e) {
|
||||
// DataEaseException.throwException(e);
|
||||
// }
|
||||
// return tableFileds;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void checkStatus(DatasourceRequest datasourceRequest) throws Exception {
|
||||
|
||||
@ -170,6 +170,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
String f = metaData.getColumnName(j + 1);
|
||||
String l = StringUtils.isNotEmpty(metaData.getColumnLabel(j + 1)) ? metaData.getColumnLabel(j + 1) : f;
|
||||
String t = metaData.getColumnTypeName(j + 1);
|
||||
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.hive.name())){
|
||||
l = l.split("\\.")[1];
|
||||
}
|
||||
TableFiled field = new TableFiled();
|
||||
field.setFieldName(l);
|
||||
field.setRemarks(l);
|
||||
@ -342,14 +345,25 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
password = redshiftConfigration.getPassword();
|
||||
driver = redshiftConfigration.getDriver();
|
||||
jdbcurl = redshiftConfigration.getJdbc();
|
||||
break;
|
||||
case hive:
|
||||
HiveConfiguration hiveConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), HiveConfiguration.class);
|
||||
username = hiveConfiguration.getUsername();
|
||||
password = hiveConfiguration.getPassword();
|
||||
driver = hiveConfiguration.getDriver();
|
||||
jdbcurl = hiveConfiguration.getJdbc();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Driver driverClass = (Driver) extendedJdbcClassLoader.loadClass(driver).newInstance();
|
||||
props.setProperty("user", username);
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
props.setProperty("password", password);
|
||||
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
props.setProperty("user", username);
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
props.setProperty("password", password);
|
||||
}
|
||||
}
|
||||
|
||||
Connection conn = driverClass.connect(jdbcurl, props);
|
||||
@ -362,7 +376,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
druidDataSource.setInitialSize(jdbcConfiguration.getInitialPoolSize());// 初始连接数
|
||||
druidDataSource.setMinIdle(jdbcConfiguration.getMinPoolSize()); // 最小连接数
|
||||
druidDataSource.setMaxActive(jdbcConfiguration.getMaxPoolSize()); // 最大连接数
|
||||
if(datasourceRequest.getDatasource().getType().equals(DatasourceTypes.mongo.name())){
|
||||
if(datasourceRequest.getDatasource().getType().equals(DatasourceTypes.mongo.name()) || datasourceRequest.getDatasource().getType().equals(DatasourceTypes.hive.name())){
|
||||
WallFilter wallFilter = new WallFilter();
|
||||
wallFilter.setDbType(DatasourceTypes.mysql.name());
|
||||
druidDataSource.setProxyFilters(Arrays.asList(new Filter[]{wallFilter}));
|
||||
@ -424,6 +438,13 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
dataSource.setDriverClassName(redshiftConfigration.getDriver());
|
||||
dataSource.setUrl(redshiftConfigration.getJdbc());
|
||||
jdbcConfiguration = redshiftConfigration;
|
||||
break;
|
||||
case hive:
|
||||
HiveConfiguration hiveConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), HiveConfiguration.class);
|
||||
dataSource.setPassword(hiveConfiguration.getPassword());
|
||||
dataSource.setDriverClassName(hiveConfiguration.getDriver());
|
||||
dataSource.setUrl(hiveConfiguration.getJdbc());
|
||||
jdbcConfiguration = hiveConfiguration;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -442,7 +463,8 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
case mariadb:
|
||||
case de_doris:
|
||||
case ds_doris:
|
||||
return "show tables;";
|
||||
case hive:
|
||||
return "show tables";
|
||||
case sqlServer:
|
||||
SqlServerConfiguration sqlServerConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfiguration.class);
|
||||
if(StringUtils.isEmpty(sqlServerConfiguration.getSchema())){
|
||||
|
||||
@ -222,8 +222,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -328,8 +327,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -414,8 +412,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -525,8 +522,7 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -806,10 +802,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -1028,10 +1022,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originField);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -200,8 +200,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -306,8 +305,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -391,8 +389,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -502,8 +499,7 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -787,10 +783,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -962,10 +956,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
whereName = originField;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -1019,10 +1011,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -221,8 +221,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -346,8 +345,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -457,8 +455,7 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -734,10 +731,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -923,10 +918,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originField);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package io.dataease.provider.query.hive;
|
||||
|
||||
import io.dataease.provider.query.SQLConstants;
|
||||
|
||||
import static io.dataease.commons.constants.DatasourceTypes.mysql;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/7/8 7:22 下午
|
||||
*/
|
||||
public class HiveConstants extends SQLConstants {
|
||||
public static final String KEYWORD_TABLE = mysql.getKeywordPrefix() + "%s" + mysql.getKeywordSuffix();
|
||||
|
||||
public static final String KEYWORD_FIX = "%s." + mysql.getKeywordPrefix() + "%s" + mysql.getKeywordSuffix();
|
||||
|
||||
public static final String UNIX_TIMESTAMP = "unix_timestamp(%s)";
|
||||
|
||||
public static final String DATE_FORMAT = "DATE_FORMAT(%s,'%s')";
|
||||
|
||||
public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')";
|
||||
|
||||
public static final String STR_TO_DATE = "STR_TO_DATE(%s,'%s')";
|
||||
|
||||
public static final String CAST = "CAST(%s AS %s)";
|
||||
|
||||
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
public static final String DEFAULT_INT_FORMAT = "DECIMAL(20,0)";
|
||||
|
||||
public static final String DEFAULT_FLOAT_FORMAT = "DECIMAL(20,2)";
|
||||
|
||||
public static final String WHERE_VALUE_NULL = "(NULL,'')";
|
||||
|
||||
public static final String WHERE_VALUE_VALUE = "'%s'";
|
||||
|
||||
public static final String AGG_COUNT = "COUNT(*)";
|
||||
|
||||
public static final String AGG_FIELD = "%s(%s)";
|
||||
|
||||
public static final String WHERE_BETWEEN = "'%s' AND '%s'";
|
||||
|
||||
public static final String BRACKETS = "(%s)";
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -166,8 +166,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -272,8 +270,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -358,8 +354,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -469,8 +463,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -735,26 +727,10 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
} else {
|
||||
originName = String.format(MongoConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
}
|
||||
// if (field.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
// if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
|
||||
// whereName = String.format(MongoConstants.STR_TO_DATE, originName, MongoConstants.DEFAULT_DATE_FORMAT);
|
||||
// }
|
||||
// if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == DeTypeConstants.DE_FLOAT || field.getDeExtractType() == 4) {
|
||||
// String cast = String.format(MongoConstants.CAST, originName, MongoConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
// whereName = String.format(MongoConstants.FROM_UNIXTIME, cast, MongoConstants.DEFAULT_DATE_FORMAT);
|
||||
// }
|
||||
// if (field.getDeExtractType() == DeTypeConstants.DE_TIME) {
|
||||
// whereName = originName;
|
||||
// }
|
||||
// } else {
|
||||
// whereName = originName;
|
||||
// }
|
||||
whereName = originName;
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MongoConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -800,20 +776,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
originName = String.format(MongoConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
}
|
||||
|
||||
// if (field.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
// if (field.getDeExtractType() == DeTypeConstants.DE_STRING || field.getDeExtractType() == 5) {
|
||||
// whereName = String.format(MongoConstants.STR_TO_DATE, originName, MongoConstants.DEFAULT_DATE_FORMAT);
|
||||
// }
|
||||
// if (field.getDeExtractType() == DeTypeConstants.DE_INT || field.getDeExtractType() == DeTypeConstants.DE_FLOAT || field.getDeExtractType() == 4) {
|
||||
// String cast = String.format(MongoConstants.CAST, originName, MongoConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
// whereName = String.format(MongoConstants.FROM_UNIXTIME, cast, MongoConstants.DEFAULT_DATE_FORMAT);
|
||||
// }
|
||||
// if (field.getDeExtractType() == DeTypeConstants.DE_TIME) {
|
||||
// whereName = originName;
|
||||
// }
|
||||
// } else {
|
||||
// whereName = originName;
|
||||
// }
|
||||
whereName = originName;
|
||||
|
||||
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
|
||||
@ -882,28 +844,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
private SQLObj getXFields(ChartViewFieldDTO x, String originField, String fieldAlias) {
|
||||
String fieldName = "";
|
||||
if (x.getDeExtractType() == DeTypeConstants.DE_TIME) {
|
||||
// if (x.getDeType() == DeTypeConstants.DE_INT || x.getDeType() == DeTypeConstants.DE_FLOAT) {
|
||||
// fieldName = String.format(MongoConstants.UNIX_TIMESTAMP, originField) + "*1000";
|
||||
// } else if (x.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
// String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
// fieldName = String.format(MongoConstants.DATE_FORMAT, originField, format);
|
||||
// } else {
|
||||
// fieldName = originField;
|
||||
// }
|
||||
fieldName = originField;
|
||||
} else {
|
||||
// if (x.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
// String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
// if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
|
||||
// fieldName = String.format(MongoConstants.DATE_FORMAT, originField, format);
|
||||
// } else {
|
||||
// String cast = String.format(MongoConstants.CAST, originField, MongoConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
// String from_unixtime = String.format(MongoConstants.FROM_UNIXTIME, cast, MongoConstants.DEFAULT_DATE_FORMAT);
|
||||
// fieldName = String.format(MongoConstants.DATE_FORMAT, from_unixtime, format);
|
||||
// }
|
||||
// } else {
|
||||
// fieldName = originField;
|
||||
// }
|
||||
fieldName = originField;
|
||||
}
|
||||
return SQLObj.builder()
|
||||
@ -919,14 +861,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
} else {
|
||||
// if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
|
||||
// String cast = String.format(MongoConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? MongoConstants.DEFAULT_INT_FORMAT : MongoConstants.DEFAULT_FLOAT_FORMAT);
|
||||
// String agg = String.format(MongoConstants.AGG_FIELD, y.getSummary(), cast);
|
||||
// fieldName = String.format(MongoConstants.CAST, agg, MongoConstants.DEFAULT_FLOAT_FORMAT);
|
||||
// } else {
|
||||
// String cast = String.format(MongoConstants.CAST, originField, y.getDeType() == DeTypeConstants.DE_INT ? MongoConstants.DEFAULT_INT_FORMAT : MongoConstants.DEFAULT_FLOAT_FORMAT);
|
||||
// fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), cast);
|
||||
// }
|
||||
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
return SQLObj.builder()
|
||||
@ -943,10 +877,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MongoConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originField);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -189,8 +189,6 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -295,8 +293,6 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -381,8 +377,6 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -492,8 +486,6 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -773,10 +765,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -946,10 +936,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
whereName = originField;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originField);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -1002,10 +990,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originField);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -237,8 +237,6 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -344,8 +342,6 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -430,8 +426,6 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -542,8 +536,6 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(OracleConstants.ALIAS_FIX, String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i));
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -828,10 +820,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -1020,10 +1010,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
whereName = originField;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -1076,10 +1064,8 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -82,7 +82,6 @@ public class PgQueryProvider extends QueryProvider {
|
||||
case "float8":
|
||||
case "money":
|
||||
return DeTypeConstants.DE_FLOAT;// 浮点
|
||||
// case "bool":
|
||||
case "TINYINT":
|
||||
return DeTypeConstants.DE_BOOL;// 布尔
|
||||
case "bytea":
|
||||
@ -212,8 +211,6 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -319,8 +316,6 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -406,8 +401,6 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -518,8 +511,6 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -803,10 +794,8 @@ public class PgQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -991,10 +980,8 @@ public class PgQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -91,7 +91,6 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
case "float8":
|
||||
case "money":
|
||||
return DeTypeConstants.DE_FLOAT;// 浮点
|
||||
// case "bool":
|
||||
case "TINYINT":
|
||||
return DeTypeConstants.DE_BOOL;// 布尔
|
||||
case "bytea":
|
||||
@ -221,8 +220,6 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -347,8 +344,6 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -459,8 +454,6 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
|
||||
@ -8,9 +8,9 @@ import io.dataease.base.domain.Datasource;
|
||||
import io.dataease.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.commons.constants.DeTypeConstants;
|
||||
import io.dataease.controller.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.dto.datasource.JdbcConfiguration;
|
||||
import io.dataease.dto.chart.ChartCustomFilterDTO;
|
||||
import io.dataease.dto.chart.ChartViewFieldDTO;
|
||||
import io.dataease.dto.datasource.JdbcConfiguration;
|
||||
import io.dataease.dto.sqlObj.SQLObj;
|
||||
import io.dataease.provider.query.QueryProvider;
|
||||
import io.dataease.provider.query.SQLConstants;
|
||||
@ -98,7 +98,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(fields)) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
DatasetTableField f = fields.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(f.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(f.getExtField()) && f.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
String fieldName = "";
|
||||
// 处理横轴字段
|
||||
@ -185,12 +193,18 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(x.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -207,7 +221,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(yAxis)) {
|
||||
for (int i = 0; i < yAxis.size(); i++) {
|
||||
ChartViewFieldDTO y = yAxis.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(y.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
|
||||
// 处理纵轴字段
|
||||
yFields.add(getYFields(y, originField, fieldAlias));
|
||||
@ -276,12 +298,18 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xAxis)) {
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
ChartViewFieldDTO x = xAxis.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(x.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -355,12 +383,18 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(xList)) {
|
||||
for (int i = 0; i < xList.size(); i++) {
|
||||
ChartViewFieldDTO x = xList.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(x.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(x.getExtField()) && x.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -377,7 +411,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(yAxis)) {
|
||||
for (int i = 0; i < yAxis.size(); i++) {
|
||||
ChartViewFieldDTO y = yAxis.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(y.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
|
||||
// 处理纵轴字段
|
||||
yFields.add(getYFields(y, originField, fieldAlias));
|
||||
@ -482,8 +524,6 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
|
||||
// 处理横轴字段
|
||||
xFields.add(getXFields(x, originField, fieldAlias));
|
||||
// 处理横轴过滤
|
||||
// xWheres.addAll(getXWheres(x, originField, fieldAlias));
|
||||
// 处理横轴排序
|
||||
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
|
||||
xOrders.add(SQLObj.builder()
|
||||
@ -590,7 +630,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
if (CollectionUtils.isNotEmpty(yAxis)) {
|
||||
for (int i = 0; i < yAxis.size(); i++) {
|
||||
ChartViewFieldDTO y = yAxis.get(i);
|
||||
String originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
String originField;
|
||||
if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originField = calcFieldRegex(y.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(y.getExtField()) && y.getExtField() == 1) {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
} else {
|
||||
originField = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
|
||||
}
|
||||
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
|
||||
// 处理纵轴字段
|
||||
yFields.add(getYFields(y, originField, fieldAlias));
|
||||
@ -736,8 +784,15 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String whereName = "";
|
||||
String whereTerm = transMysqlFilterTerm(request.getTerm());
|
||||
String whereValue = "";
|
||||
String originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
|
||||
String originName;
|
||||
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originName = calcFieldRegex(field.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
|
||||
originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
} else {
|
||||
originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
}
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(SqlServerSQLConstants.STRING_TO_DATE, originName);
|
||||
@ -753,10 +808,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
whereName = originName;
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
@ -791,7 +844,16 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String whereName = "";
|
||||
String whereTerm = transMysqlFilterTerm(request.getOperator());
|
||||
String whereValue = "";
|
||||
String originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
|
||||
String originName;
|
||||
if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 2) {
|
||||
// 解析origin name中有关联的字段生成sql表达式
|
||||
originName = calcFieldRegex(field.getOriginName(), tableObj);
|
||||
} else if (ObjectUtils.isNotEmpty(field.getExtField()) && field.getExtField() == 1) {
|
||||
originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
} else {
|
||||
originName = String.format(SqlServerSQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
|
||||
}
|
||||
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
@ -948,10 +1010,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
String whereValue = "";
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
|
||||
// whereValue = MySQLConstants.WHERE_VALUE_NULL;
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
|
||||
// whereTerm = String.format(whereTerm, originName);
|
||||
whereValue = "";
|
||||
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "empty")) {
|
||||
whereValue = "''";
|
||||
|
||||
@ -43,9 +43,7 @@ public class FileService {
|
||||
example2.createCriteria().andFileIdIn(ids);
|
||||
fileContentMapper.deleteByExample(example2);
|
||||
|
||||
/* LoadTestFileExample example3 = new LoadTestFileExample();
|
||||
example3.createCriteria().andFileIdIn(ids);
|
||||
loadTestFileMapper.deleteByExample(example3);*/
|
||||
|
||||
}
|
||||
|
||||
public void deleteFileRelatedByIds(List<String> ids) {
|
||||
|
||||
@ -78,6 +78,11 @@ public class ChartViewService {
|
||||
Optional.ofNullable(chartView.getId()).ifPresent(id -> {
|
||||
CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
|
||||
});
|
||||
try {
|
||||
calcData(chartView, new ChartExtRequest(), true);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return getOneWithPermission(chartView.getId());
|
||||
}
|
||||
|
||||
@ -179,6 +184,10 @@ public class ChartViewService {
|
||||
|
||||
public ChartViewDTO getData(String id, ChartExtRequest requestList) throws Exception {
|
||||
ChartViewWithBLOBs view = chartViewMapper.selectByPrimaryKey(id);
|
||||
return calcData(view, requestList, true);
|
||||
}
|
||||
|
||||
public ChartViewDTO calcData(ChartViewWithBLOBs view, ChartExtRequest requestList, boolean cache) throws Exception {
|
||||
if (ObjectUtils.isEmpty(view)) {
|
||||
throw new RuntimeException(Translator.get("i18n_chart_delete"));
|
||||
}
|
||||
@ -371,17 +380,6 @@ public class ChartViewService {
|
||||
}
|
||||
}
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
/**
|
||||
* 直连不实用缓存
|
||||
String key = "provider_sql_"+datasourceRequest.getDatasource().getId() + "_" + datasourceRequest.getTable() + "_" +datasourceRequest.getQuery();
|
||||
Object cache;
|
||||
if ((cache = CacheUtils.get(JdbcConstants.JDBC_PROVIDER_KEY, key)) == null) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
CacheUtils.put(JdbcConstants.JDBC_PROVIDER_KEY,key ,data, null, null);
|
||||
}else {
|
||||
data = (List<String[]>) cache;
|
||||
}
|
||||
*/
|
||||
} else if (table.getMode() == 1) {// 抽取
|
||||
// 连接doris,构建doris数据源查询
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
@ -401,30 +399,14 @@ public class ChartViewService {
|
||||
} else {
|
||||
datasourceRequest.setQuery(qp.getSQL(tableName, xAxis, yAxis, customFilter, extFilterList, ds, view));
|
||||
}
|
||||
/*// 定时抽取使用缓存
|
||||
Object cache;
|
||||
// 仪表板有参数不实用缓存
|
||||
if (CollectionUtils.isNotEmpty(requestList.getFilter())) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
}
|
||||
// 仪表板无参数 且 未缓存过该视图 则查询后缓存
|
||||
else if ((cache = CacheUtils.get(JdbcConstants.VIEW_CACHE_KEY, id)) == null) {
|
||||
lock.lock();
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
CacheUtils.put(JdbcConstants.VIEW_CACHE_KEY, id, data, null, null);
|
||||
}
|
||||
// 仪表板有缓存 使用缓存
|
||||
else {
|
||||
data = (List<String[]>) cache;
|
||||
}*/
|
||||
// 仪表板有参数不实用缓存
|
||||
if (CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
if (!cache || CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getLinkageFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getDrill())) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
} else {
|
||||
try {
|
||||
data = cacheViewData(datasourceProvider, datasourceRequest, id);
|
||||
data = cacheViewData(datasourceProvider, datasourceRequest, view.getId());
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
} finally {
|
||||
@ -435,10 +417,6 @@ public class ChartViewService {
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 返回数据量判定
|
||||
// if (StringUtils.equalsIgnoreCase("custom", view.getResultMode()) && data.size() > view.getResultCount()) {
|
||||
// data = data.subList(0, view.getResultCount());
|
||||
// }
|
||||
|
||||
Map<String, Object> map = new TreeMap<>();
|
||||
// 图表组件可再扩展
|
||||
@ -1294,11 +1272,7 @@ public class ChartViewService {
|
||||
chartQuotaDTO.setId(yAxis.get(j).getId());
|
||||
quotaList.add(chartQuotaDTO);
|
||||
scatterChartDataDTO.setQuotaList(quotaList);
|
||||
// try {
|
||||
// axisChartDataDTO.setValue(new BigDecimal(StringUtils.isEmpty(d[i]) ? "0" : d[i]));
|
||||
// } catch (Exception e) {
|
||||
// axisChartDataDTO.setValue(new BigDecimal(0));
|
||||
// }
|
||||
|
||||
if (CollectionUtils.isNotEmpty(extBubble) && extBubble.size() > 0) {
|
||||
try {
|
||||
scatterChartDataDTO.setValue(new Object[]{
|
||||
@ -1323,41 +1297,6 @@ public class ChartViewService {
|
||||
}
|
||||
}
|
||||
|
||||
/*for (String[] d : data) {
|
||||
StringBuilder a = new StringBuilder();
|
||||
for (int i = 0; i < xAxis.size(); i++) {
|
||||
if (i == xAxis.size() - 1) {
|
||||
a.append(d[i]);
|
||||
} else {
|
||||
a.append(d[i]).append("\n");
|
||||
}
|
||||
}
|
||||
x.add(a.toString());
|
||||
for (int i = xAxis.size(); i < xAxis.size() + yAxis.size(); i++) {
|
||||
int j = i - xAxis.size();
|
||||
if (CollectionUtils.isNotEmpty(extBubble) && extBubble.size() > 0) {
|
||||
try {
|
||||
series.get(j).getData().add(new Object[]{
|
||||
a.toString(),
|
||||
new BigDecimal(StringUtils.isEmpty(d[i]) ? "0" : d[i]),
|
||||
new BigDecimal(StringUtils.isEmpty(d[xAxis.size() + yAxis.size()]) ? "0" : d[xAxis.size() + yAxis.size()])
|
||||
});
|
||||
} catch (Exception e) {
|
||||
series.get(j).getData().add(new Object[]{a.toString(), new BigDecimal(0), new BigDecimal(0)});
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
series.get(j).getData().add(new Object[]{
|
||||
a.toString(),
|
||||
new BigDecimal(StringUtils.isEmpty(d[i]) ? "0" : d[i])
|
||||
});
|
||||
} catch (Exception e) {
|
||||
series.get(j).getData().add(new Object[]{a.toString(), new BigDecimal(0)});
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
map.put("x", x);
|
||||
map.put("series", series);
|
||||
return map;
|
||||
@ -1395,9 +1334,6 @@ public class ChartViewService {
|
||||
}
|
||||
|
||||
private void checkName(ChartViewWithBLOBs chartView) {
|
||||
// if (StringUtils.isEmpty(chartView.getId())) {
|
||||
// return;
|
||||
// }
|
||||
ChartViewExample chartViewExample = new ChartViewExample();
|
||||
ChartViewExample.Criteria criteria = chartViewExample.createCriteria();
|
||||
if (StringUtils.isNotEmpty(chartView.getId())) {
|
||||
@ -1446,4 +1382,12 @@ public class ChartViewService {
|
||||
public String searchAdviceSceneId(String panelId) {
|
||||
return extChartViewMapper.searchAdviceSceneId(AuthUtils.getUser().getUserId().toString(), panelId);
|
||||
}
|
||||
|
||||
public String checkSameDataSet(String viewIdSource,String viewIdTarget) {
|
||||
if(extChartViewMapper.checkSameDataSet(viewIdSource,viewIdTarget)==1){
|
||||
return "YES";
|
||||
}else{
|
||||
return "NO";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ public class DataSetTableService {
|
||||
if (datasetTable.getEditType() == 0) {
|
||||
List<String> newFields = sheet.getFields().stream().map(TableFiled::getRemarks).collect(Collectors.toList());
|
||||
if (!oldFields.equals(newFields)) {
|
||||
DataEaseException.throwException(Translator.get("i18n_excel_colume_change"));
|
||||
DataEaseException.throwException(Translator.get("i18n_excel_colume_inconsistent"));
|
||||
}
|
||||
oldFields = newFields;
|
||||
}
|
||||
@ -243,8 +243,6 @@ public class DataSetTableService {
|
||||
// 更新数据和字段
|
||||
if (update == 1) {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql") || StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
// 删除所有字段,重新抽象
|
||||
// dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
|
||||
saveTableField(datasetTable);
|
||||
}
|
||||
}
|
||||
@ -735,7 +733,6 @@ public class DataSetTableService {
|
||||
String sql;
|
||||
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
// JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
Datasource ds;
|
||||
if (dataSetTableRequest.getMode() == 0) {
|
||||
ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||
@ -746,7 +743,6 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
sql = getCustomSQLDoris(dataTableInfoDTO, list);
|
||||
}
|
||||
// String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
// 使用输入的sql先预执行一次,并拿到所有字段
|
||||
datasourceRequest.setQuery(sql);
|
||||
|
||||
@ -306,8 +306,5 @@ public class DataSetTableTaskService {
|
||||
if(!datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())){
|
||||
scheduleService.fireNow(datasetTableTask);
|
||||
}
|
||||
// if(datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())){
|
||||
// scheduleService.addSchedule(datasetTableTask);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,6 @@ public class ExtractDataService {
|
||||
extractData(datasetTable, "all_scope");
|
||||
replaceTable(DorisTableUtils.dorisName(datasetTableId));
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
// sendWebMsg(datasetTable, null, true);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
|
||||
if(ops.equalsIgnoreCase("替换")){
|
||||
dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
|
||||
@ -199,7 +198,6 @@ public class ExtractDataService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
saveErrorLog(datasetTableId, null, e);
|
||||
// sendWebMsg(datasetTable, null, false);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
|
||||
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
|
||||
} finally {
|
||||
@ -218,11 +216,9 @@ public class ExtractDataService {
|
||||
Long execTime = System.currentTimeMillis();
|
||||
extractData(datasetTable, "incremental_add");
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
// sendWebMsg(datasetTable, null, true);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed, execTime);
|
||||
} catch (Exception e) {
|
||||
saveErrorLog(datasetTableId, null, e);
|
||||
// sendWebMsg(datasetTable, null, false);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
|
||||
} finally {
|
||||
deleteFile("incremental_add", datasetTableId);
|
||||
@ -413,7 +409,7 @@ public class ExtractDataService {
|
||||
if (ObjectUtils.isNotEmpty(datasetTableTask) && ObjectUtils.isNotEmpty(datasetTableTask.getName())) {
|
||||
content += " 任务名称【" + datasetTableTask.getName() + "】";
|
||||
}
|
||||
DeMsgutil.sendMsg(userId, typeId, 1L, content, gson.toJson(param));
|
||||
DeMsgutil.sendMsg(userId, typeId, content, gson.toJson(param));
|
||||
});
|
||||
}
|
||||
|
||||
@ -691,20 +687,6 @@ public class ExtractDataService {
|
||||
startEntry.setLocation(100, 100);
|
||||
jobMeta.addJobEntry(startEntry);
|
||||
|
||||
//trans
|
||||
// JobEntryTrans transrans = new JobEntryTrans();
|
||||
// transrans.clearResultFiles = true;
|
||||
// transrans.clearResultRows = true;
|
||||
// transrans.followingAbortRemotely = true;
|
||||
// transrans.setTransname(transName);
|
||||
// transrans.setName("Transformation");
|
||||
// JobEntryCopy transEntry = new JobEntryCopy(transrans);
|
||||
// transEntry.setDrawn(true);
|
||||
// transEntry.setLocation(300, 100);
|
||||
// jobMeta.addJobEntry(transEntry);
|
||||
|
||||
// jobMeta.addJobHop(new JobHopMeta(startEntry, transEntry));
|
||||
|
||||
//exec shell
|
||||
JobEntryShell shell = new JobEntryShell();
|
||||
shell.setScript(script);
|
||||
@ -807,7 +789,6 @@ public class ExtractDataService {
|
||||
case ck:
|
||||
CHConfiguration chConfiguration = new Gson().fromJson(datasource.getConfiguration(), CHConfiguration.class);
|
||||
dataMeta = new DatabaseMeta("db", "ORACLE", "Native", chConfiguration.getHost().trim(), chConfiguration.getDataBase().trim(), chConfiguration.getPort().toString(), chConfiguration.getUsername(), chConfiguration.getPassword());
|
||||
// dataMeta.addExtraOption("MYSQL", "characterEncoding", "UTF-8");
|
||||
dataMeta.setDatabaseType("Clickhouse");
|
||||
transMeta.addDatabase(dataMeta);
|
||||
selectSQL = getSelectSQL(extractType, datasetTable, datasource, datasetTableFields, selectSQL);
|
||||
@ -1010,7 +991,6 @@ public class ExtractDataService {
|
||||
}
|
||||
|
||||
private StepMeta udjc(List<DatasetTableField> datasetTableFields, DatasourceTypes datasourceType) {
|
||||
// String needToChangeColumnType = "";
|
||||
String handleBinaryTypeCode = "";
|
||||
String excelCompletion = "";
|
||||
|
||||
@ -1129,17 +1109,6 @@ public class ExtractDataService {
|
||||
" get(Fields.Out, filed).getValueMeta().setType(2);\n" +
|
||||
" \t}";
|
||||
|
||||
|
||||
// private final static String alterColumnTypeCode = " if(\"FILED\".equalsIgnoreCase(filed)){\n" +
|
||||
// "\t if(tmp != null && tmp.equalsIgnoreCase(\"Y\")){\n" +
|
||||
// " get(Fields.Out, filed).setValue(r, 1);\n" +
|
||||
// " get(Fields.Out, filed).getValueMeta().setType(2);\n" +
|
||||
// " }else{\n" +
|
||||
// " get(Fields.Out, filed).setValue(r, 0);\n" +
|
||||
// " get(Fields.Out, filed).getValueMeta().setType(2);\n" +
|
||||
// " }\n" +
|
||||
// " }\n" ;
|
||||
|
||||
private final static String handleExcelIntColumn = " \t\tif(tmp != null && tmp.endsWith(\".0\")){\n" +
|
||||
" try {\n" +
|
||||
" Long.valueOf(tmp.substring(0, tmp.length()-2));\n" +
|
||||
|
||||
@ -264,7 +264,6 @@ public class DatasourceService {
|
||||
public void updateDatasourceStatus(){
|
||||
List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample());
|
||||
datasources.forEach(datasource -> {
|
||||
// checkAndUpdateDatasourceStatus(datasource);
|
||||
checkAndUpdateDatasourceStatus(datasource, true);
|
||||
});
|
||||
}
|
||||
@ -316,7 +315,7 @@ public class DatasourceService {
|
||||
|
||||
String content = "数据源【" + datasource.getName() + "】无效";
|
||||
|
||||
DeMsgutil.sendMsg(userId, typeId, 1L, content, gson.toJson(param));
|
||||
DeMsgutil.sendMsg(userId, typeId, content, gson.toJson(param));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,15 +18,9 @@ public class DeMsgutil {
|
||||
|
||||
|
||||
|
||||
public static void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) {
|
||||
// SysMsg sysMsg = new SysMsg();
|
||||
// sysMsg.setUserId(userId);
|
||||
// sysMsg.setTypeId(typeId);
|
||||
// sysMsg.setContent(content);
|
||||
// sysMsg.setStatus(false);
|
||||
// sysMsg.setCreateTime(System.currentTimeMillis());
|
||||
// sysMsg.setParam(param);
|
||||
sysMsgService.sendMsg(userId, typeId, channelId, content, param);
|
||||
public static void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
|
||||
sysMsgService.sendMsg(userId, typeId, content, param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
package io.dataease.service.message;
|
||||
|
||||
|
||||
import io.dataease.controller.sys.response.SubscribeNode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class MsgAop {
|
||||
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 对sendMsg 切面拦截
|
||||
* @param point
|
||||
*/
|
||||
@Around("(execution(* io.dataease.service.message.SysMsgService.sendMsg(..)))")
|
||||
public Object cutPoint(ProceedingJoinPoint point) {
|
||||
|
||||
Object[] args = point.getArgs();
|
||||
Object arg0 = args[0];
|
||||
Object arg1 = args[1];
|
||||
Object arg2 = args[2];
|
||||
|
||||
if (ObjectUtils.isEmpty(arg0) || ObjectUtils.isEmpty(arg1) || ObjectUtils.isEmpty(arg2)) {
|
||||
return null;
|
||||
}
|
||||
Long userId = (Long) arg0;
|
||||
Long typeId = (Long) arg1;
|
||||
Long channelId = (Long) arg2;
|
||||
|
||||
List<SubscribeNode> subscribes = sysMsgService.subscribes(userId);
|
||||
|
||||
try {
|
||||
// 如果已经订阅了这种类型的消息 直接发送 否则直接返回
|
||||
if (CollectionUtils.isNotEmpty(subscribes) && subscribes.stream().anyMatch(item -> item.match(typeId, channelId)))
|
||||
return point.proceed(args);
|
||||
return null;
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ import io.dataease.controller.sys.request.MsgSettingRequest;
|
||||
import io.dataease.controller.sys.response.MsgGridDto;
|
||||
import io.dataease.controller.sys.response.SettingTreeNode;
|
||||
import io.dataease.controller.sys.response.SubscribeNode;
|
||||
import io.dataease.service.message.service.SendService;
|
||||
import io.dataease.service.system.SystemParameterService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -55,33 +56,6 @@ public class SysMsgService {
|
||||
@Autowired
|
||||
private SystemParameterService systemParameterService;
|
||||
|
||||
/* public List<SysMsg> query(Long userId, MsgRequest msgRequest) {
|
||||
String orderClause = " create_time desc";
|
||||
SysMsgExample example = new SysMsgExample();
|
||||
SysMsgExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andUserIdEqualTo(userId);
|
||||
|
||||
List<String> orders = msgRequest.getOrders();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(orders)) {
|
||||
orderClause = String.join(", ", orders);
|
||||
}
|
||||
|
||||
if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
|
||||
criteria.andTypeIdEqualTo(msgRequest.getType());
|
||||
}
|
||||
|
||||
if (ObjectUtils.isNotEmpty(msgRequest.getStatus())) {
|
||||
criteria.andStatusEqualTo(msgRequest.getStatus());
|
||||
}
|
||||
|
||||
criteria.andCreateTimeGreaterThanOrEqualTo(overTime());
|
||||
|
||||
example.setOrderByClause(orderClause);
|
||||
List<SysMsg> sysMsgs = sysMsgMapper.selectByExample(example);
|
||||
return sysMsgs;
|
||||
}
|
||||
*/
|
||||
public List<MsgGridDto> queryGrid(Long userId, MsgRequest msgRequest, List<Long> typeIds, Long startTime) {
|
||||
String orderClause = " create_time desc";
|
||||
SysMsgExample example = new SysMsgExample();
|
||||
@ -94,14 +68,6 @@ public class SysMsgService {
|
||||
orderClause = String.join(", ", orders);
|
||||
}
|
||||
|
||||
/*if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
|
||||
SysMsgTypeExample sysMsgTypeExample = new SysMsgTypeExample();
|
||||
sysMsgTypeExample.createCriteria().andPidEqualTo(msgRequest.getType());
|
||||
|
||||
List<SysMsgType> sysMsgTypes = sysMsgTypeMapper.selectByExample(sysMsgTypeExample);
|
||||
List<Long> typeIds = sysMsgTypes.stream().map(SysMsgType::getMsgTypeId).collect(Collectors.toList());
|
||||
criteria.andTypeIdIn(typeIds);
|
||||
}*/
|
||||
if (CollectionUtils.isNotEmpty(typeIds)){
|
||||
criteria.andTypeIdIn(typeIds);
|
||||
}
|
||||
@ -111,7 +77,6 @@ public class SysMsgService {
|
||||
}
|
||||
|
||||
criteria.andCreateTimeGreaterThanOrEqualTo(startTime);
|
||||
/* criteria.andCreateTimeGreaterThanOrEqualTo(overTime()); */
|
||||
|
||||
example.setOrderByClause(orderClause);
|
||||
List<MsgGridDto> msgGridDtos = extSysMsgMapper.queryGrid(example);
|
||||
@ -211,12 +176,10 @@ public class SysMsgService {
|
||||
sysMsgSetting1.setTypeId(2L);
|
||||
sysMsgSetting1.setChannelId(1L);
|
||||
sysMsgSetting1.setEnable(true);
|
||||
// sysMsgSetting1.setUserId(userId);
|
||||
SysMsgSetting sysMsgSetting2 = new SysMsgSetting();
|
||||
sysMsgSetting2.setTypeId(6L);
|
||||
sysMsgSetting2.setChannelId(1L);
|
||||
sysMsgSetting2.setEnable(true);
|
||||
//sysMsgSetting2.setUserId(userId);
|
||||
List<SysMsgSetting> lists = new ArrayList<>();
|
||||
lists.add(sysMsgSetting1);
|
||||
lists.add(sysMsgSetting2);
|
||||
@ -233,7 +196,6 @@ public class SysMsgService {
|
||||
public void updateSetting(MsgSettingRequest request, Long userId) {
|
||||
Long typeId = request.getTypeId();
|
||||
Long channelId = request.getChannelId();
|
||||
// Long userId = AuthUtils.getUser().getUserId();
|
||||
SysMsgSettingExample example = new SysMsgSettingExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId).andTypeIdEqualTo(typeId).andChannelIdEqualTo(channelId);
|
||||
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
|
||||
@ -280,15 +242,22 @@ public class SysMsgService {
|
||||
extSysMsgMapper.batchInsert(settings);
|
||||
}
|
||||
|
||||
public void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) {
|
||||
SysMsg sysMsg = new SysMsg();
|
||||
sysMsg.setUserId(userId);
|
||||
sysMsg.setTypeId(typeId);
|
||||
sysMsg.setContent(content);
|
||||
sysMsg.setStatus(false);
|
||||
sysMsg.setCreateTime(System.currentTimeMillis());
|
||||
sysMsg.setParam(param);
|
||||
save(sysMsg);
|
||||
public void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
List<SubscribeNode> subscribes = subscribes(userId);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(subscribes)) {
|
||||
subscribes.stream().filter(item -> item.getTypeId() == typeId).forEach(sub -> {
|
||||
SendService sendService = serviceByChannel(sub.getChannelId());
|
||||
sendService.sendMsg(userId, typeId, content, param);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SendService serviceByChannel(Long channelId){
|
||||
String beanName = sysMsgChannelMapper.selectByPrimaryKey(channelId).getServiceName();
|
||||
return (SendService)CommonBeanFactory.getBean(beanName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,13 +268,11 @@ public class SysMsgService {
|
||||
@Cacheable(value = SysMsgConstants.SYS_MSG_USER_SUBSCRIBE, key = "#userId")
|
||||
public List<SubscribeNode> subscribes(Long userId) {
|
||||
SysMsgSettingExample example = new SysMsgSettingExample();
|
||||
/*example.createCriteria().andUserIdEqualTo(userId).andEnableEqualTo(true);*/
|
||||
example.createCriteria().andUserIdEqualTo(userId);
|
||||
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
|
||||
// 添加默认订阅
|
||||
sysMsgSettings = addDefault(sysMsgSettings);
|
||||
sysMsgSettings = sysMsgSettings.stream().filter(SysMsgSetting::getEnable).collect(Collectors.toList());
|
||||
// sysMsgSettings.addAll(defaultSettings());
|
||||
List<SubscribeNode> resultLists = sysMsgSettings.stream().map(item -> {
|
||||
SubscribeNode subscribeNode = new SubscribeNode();
|
||||
subscribeNode.setTypeId(item.getTypeId());
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package io.dataease.service.message.service;
|
||||
|
||||
public interface SendService {
|
||||
|
||||
|
||||
void sendMsg(Long userId, Long typeId, String content, String param);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package io.dataease.service.message.service.strategy;
|
||||
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.service.message.service.SendService;
|
||||
import io.dataease.service.system.EmailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service("sendEmail")
|
||||
public class SendEmail implements SendService {
|
||||
|
||||
@Autowired
|
||||
private EmailService emailService;
|
||||
|
||||
@Autowired
|
||||
private AuthUserService authUserService;
|
||||
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
String email = authUserService.getUserById(userId).getEmail();
|
||||
|
||||
emailService.send(email, content, content);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package io.dataease.service.message.service.strategy;
|
||||
|
||||
import io.dataease.base.domain.SysMsg;
|
||||
import io.dataease.base.mapper.SysMsgMapper;
|
||||
import io.dataease.service.message.service.SendService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service("sendStation")
|
||||
public class SendStation implements SendService {
|
||||
|
||||
@Resource
|
||||
private SysMsgMapper sysMsgMapper;
|
||||
|
||||
@Override
|
||||
public void sendMsg(Long userId, Long typeId, String content, String param) {
|
||||
|
||||
SysMsg sysMsg = new SysMsg();
|
||||
sysMsg.setUserId(userId);
|
||||
sysMsg.setTypeId(typeId);
|
||||
sysMsg.setContent(content);
|
||||
sysMsg.setStatus(false);
|
||||
sysMsg.setCreateTime(System.currentTimeMillis());
|
||||
sysMsg.setParam(param);
|
||||
|
||||
sysMsgMapper.insert(sysMsg);
|
||||
|
||||
}
|
||||
}
|
||||
@ -84,10 +84,6 @@ public class PanelLinkJumpService {
|
||||
|
||||
public PanelLinkJumpDTO queryWithView(String panelId, String viewId) {
|
||||
PanelLinkJumpDTO resultInfo = extPanelLinkJumpMapper.queryWithViewId(panelId, viewId);
|
||||
// 获取链接类型为仪表板的关联视图fieldId-PanelLinkJumpInfo Map 映射关系
|
||||
// Map<String, PanelLinkJumpInfoDTO> mapJumpInfoArray = resultInfo.getLinkJumpInfoArray().stream().filter(jumpInfo -> StringUtils.isNotEmpty(jumpInfo.getFieldId()))
|
||||
// .collect(Collectors.toMap(PanelLinkJumpInfoDTO::getFieldId, PanelViewLinkageDTO->PanelViewLinkageDTO));
|
||||
// resultInfo.setMapJumpInfoArray(mapJumpInfoArray);
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,11 @@ import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.auth.util.RsaUtil;
|
||||
import io.dataease.base.domain.PanelGroupWithBLOBs;
|
||||
import io.dataease.base.domain.PanelLink;
|
||||
import io.dataease.base.domain.PanelLinkMapping;
|
||||
import io.dataease.base.domain.PanelLinkMappingExample;
|
||||
import io.dataease.base.mapper.PanelGroupMapper;
|
||||
import io.dataease.base.mapper.PanelLinkMapper;
|
||||
import io.dataease.base.mapper.PanelLinkMappingMapper;
|
||||
import io.dataease.base.mapper.ext.ExtPanelLinkMapper;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
@ -17,29 +20,28 @@ import io.dataease.controller.request.panel.link.LinkRequest;
|
||||
import io.dataease.controller.request.panel.link.OverTimeRequest;
|
||||
import io.dataease.controller.request.panel.link.PasswordRequest;
|
||||
import io.dataease.dto.panel.link.GenerateDto;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class PanelLinkService {
|
||||
|
||||
private static final String baseUrl = "/link.html?link=";
|
||||
private static final String BASEURL = "/link.html?link=";
|
||||
|
||||
@Value("${dataease.public-link-salt:DataEaseLinkSalt}")
|
||||
private String salt;
|
||||
|
||||
@Value("${dataease.short-url-site:https://dh6.ink/}")
|
||||
private String shortUrlSite;
|
||||
|
||||
@Value("${dataease.short-url-api:api/url/add}")
|
||||
private String shortUrlApi;
|
||||
private static final String SHORT_URL_PREFIX = "/xggznb/";
|
||||
|
||||
@Resource
|
||||
private PanelLinkMapper mapper;
|
||||
@ -50,6 +52,9 @@ public class PanelLinkService {
|
||||
@Resource
|
||||
private ExtPanelLinkMapper extPanelLinkMapper;
|
||||
|
||||
@Resource
|
||||
private PanelLinkMappingMapper panelLinkMappingMapper;
|
||||
|
||||
public void changeValid(LinkRequest request){
|
||||
PanelLink po = new PanelLink();
|
||||
po.setResourceId(request.getResourceId());
|
||||
@ -72,10 +77,7 @@ public class PanelLinkService {
|
||||
}
|
||||
|
||||
public void overTime(OverTimeRequest request) {
|
||||
/* PanelLink po = new PanelLink();
|
||||
po.setResourceId(request.getResourceId());
|
||||
po.setOverTime(request.getOverTime());
|
||||
mapper.updateByPrimaryKeySelective(po); */
|
||||
|
||||
extPanelLinkMapper.updateOverTime(request);
|
||||
}
|
||||
|
||||
@ -84,6 +86,7 @@ public class PanelLinkService {
|
||||
return panelLink;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public GenerateDto currentGenerate(String resourceId) {
|
||||
PanelLink one = findOne(resourceId);
|
||||
if (ObjectUtils.isEmpty(one)) {
|
||||
@ -94,6 +97,16 @@ public class PanelLinkService {
|
||||
one.setEnablePwd(false);
|
||||
mapper.insert(one);
|
||||
}
|
||||
|
||||
|
||||
PanelLinkMappingExample example = new PanelLinkMappingExample();
|
||||
example.createCriteria().andResourceIdEqualTo(resourceId);
|
||||
List<PanelLinkMapping> mappings = panelLinkMappingMapper.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(mappings)) {
|
||||
PanelLinkMapping mapping = new PanelLinkMapping();
|
||||
mapping.setResourceId(resourceId);
|
||||
panelLinkMappingMapper.insert(mapping);
|
||||
}
|
||||
return convertDto(one);
|
||||
}
|
||||
|
||||
@ -116,19 +129,9 @@ public class PanelLinkService {
|
||||
}
|
||||
|
||||
private String buildLinkParam(String resourceId){
|
||||
/* Map<String,Object> map = new HashMap<>();
|
||||
map.put("resourceId", resourceId);
|
||||
map.put("time", System.currentTimeMillis());
|
||||
map.put("salt", salt);
|
||||
Gson gson = new Gson();
|
||||
String encrypt = encrypt(gson.toJson(map)); */
|
||||
|
||||
String encrypt = encrypt(resourceId);
|
||||
/* String s = null;
|
||||
try {
|
||||
s = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, encrypt);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} */
|
||||
|
||||
return encrypt;
|
||||
}
|
||||
private GenerateDto convertDto(PanelLink linl){
|
||||
@ -136,7 +139,7 @@ public class PanelLinkService {
|
||||
result.setValid(linl.getValid());
|
||||
result.setEnablePwd(linl.getEnablePwd());
|
||||
result.setPwd(linl.getPwd());
|
||||
result.setUri(baseUrl+buildLinkParam(linl.getResourceId()));
|
||||
result.setUri(BASEURL+buildLinkParam(linl.getResourceId()));
|
||||
result.setOverTime(linl.getOverTime());
|
||||
return result;
|
||||
}
|
||||
@ -156,7 +159,6 @@ public class PanelLinkService {
|
||||
}
|
||||
if (StringUtils.isEmpty(panelLink.getPwd())) return false;
|
||||
boolean verify = JWTUtils.verifyLink(token, panelLink.getResourceId(), panelLink.getPwd());
|
||||
/* boolean verify = JWTUtils.verifyLink(token, panelLink.getResourceId(), decryptParam(panelLink.getPwd())); */
|
||||
return verify;
|
||||
}
|
||||
|
||||
@ -170,11 +172,9 @@ public class PanelLinkService {
|
||||
|
||||
public boolean validatePwd(PasswordRequest request) throws Exception {
|
||||
String password = request.getPassword();
|
||||
/* String password = decryptParam(request.getPassword()); */
|
||||
String resourceId = request.getResourceId();
|
||||
PanelLink one = findOne(resourceId);
|
||||
String pwd = one.getPwd();
|
||||
/* String pwd = decryptParam(one.getPwd()); */
|
||||
boolean pass = StringUtils.equals(pwd, password);
|
||||
if (pass){
|
||||
String token = JWTUtils.signLink(resourceId, password);
|
||||
@ -190,23 +190,18 @@ public class PanelLinkService {
|
||||
}
|
||||
|
||||
|
||||
public ResultHolder getShortUrl(String url) {
|
||||
Gson gson = new Gson();
|
||||
Map param = new HashMap<>();
|
||||
param.put("diy", false);
|
||||
param.put("link", url);
|
||||
param.put("sort", "");
|
||||
String post = HttpUtil.post(shortUrlSite + shortUrlApi, param);
|
||||
try{
|
||||
Map map = gson.fromJson(post, Map.class);
|
||||
Map data = (Map) map.get("data");
|
||||
String sort = shortUrlSite + data.get("sort").toString();
|
||||
ResultHolder success = ResultHolder.success(sort);
|
||||
return success;
|
||||
}catch (Exception e) {
|
||||
ResultHolder error = ResultHolder.error(e.getMessage());
|
||||
return error;
|
||||
}
|
||||
public String getShortUrl(String resourceId) {
|
||||
PanelLinkMappingExample example = new PanelLinkMappingExample();
|
||||
example.createCriteria().andResourceIdEqualTo(resourceId);
|
||||
List<PanelLinkMapping> mappings = panelLinkMappingMapper.selectByExample(example);
|
||||
PanelLinkMapping mapping = mappings.get(0);
|
||||
return SHORT_URL_PREFIX + mapping.getId();
|
||||
}
|
||||
|
||||
public String getUrlByIndex(Long index) {
|
||||
PanelLinkMapping mapping = panelLinkMappingMapper.selectByPrimaryKey(index);
|
||||
String resourceId = mapping.getResourceId();
|
||||
PanelLink one = findOne(resourceId);
|
||||
return convertDto(one).getUri();
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,9 +15,11 @@ import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.controller.request.panel.PanelShareFineDto;
|
||||
import io.dataease.controller.request.panel.PanelShareRemoveRequest;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelShareOutDTO;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import io.dataease.service.message.DeMsgutil;
|
||||
import lombok.Data;
|
||||
@ -74,9 +76,6 @@ public class ShareService {
|
||||
PanelShareExample example = new PanelShareExample();
|
||||
example.createCriteria().andPanelGroupIdEqualTo(panelGroupId);
|
||||
List<PanelShare> panelShares = mapper.selectByExample(example);
|
||||
/*if (CollectionUtils.isEmpty(panelShares)) {
|
||||
return;
|
||||
}*/
|
||||
Map<Integer, List<TempShareNode>> typeSharedMap = panelShares.stream().map(this::convertNode).collect(Collectors.groupingBy(TempShareNode::getType));
|
||||
|
||||
for (Map.Entry<Integer, List<Long>> entry : authURDMap.entrySet()) {
|
||||
@ -115,7 +114,7 @@ public class ShareService {
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(addShares)){
|
||||
extPanelShareMapper.batchInsert(addShares);
|
||||
extPanelShareMapper.batchInsert(addShares, AuthUtils.getUser().getUsername());
|
||||
}
|
||||
|
||||
// 以上是业务代码
|
||||
@ -134,13 +133,13 @@ public class ShareService {
|
||||
msgParam.add(panelGroupId);
|
||||
addUserIdSet.forEach(userId -> {
|
||||
if (!redUserIdSet.contains(userId) && user.getUserId() != userId){
|
||||
DeMsgutil.sendMsg(userId, 2L, 1L,user.getNickName()+" 分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
|
||||
DeMsgutil.sendMsg(userId, 2L,user.getNickName()+" 分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
|
||||
}
|
||||
});
|
||||
|
||||
redUserIdSet.forEach(userId -> {
|
||||
if (!addUserIdSet.contains(userId) && user.getUserId() != userId){
|
||||
DeMsgutil.sendMsg(userId, 3L, 1L,user.getNickName()+" 取消分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
|
||||
DeMsgutil.sendMsg(userId, 3L, user.getNickName()+" 取消分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
|
||||
}
|
||||
});
|
||||
|
||||
@ -167,11 +166,6 @@ public class ShareService {
|
||||
private Map<String, Object> filterData(List<Long> newTargets, List<TempShareNode> shareNodes) {
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
/*if (null == newTargets) {
|
||||
result.put("add", new ArrayList<>());
|
||||
result.put("red", new ArrayList<>());
|
||||
return result;
|
||||
}*/
|
||||
List<Long> newUserIds = new ArrayList<>();
|
||||
for (int i = 0; i < newTargets.size(); i++) {
|
||||
Long newTargetId = newTargets.get(i);
|
||||
@ -241,7 +235,7 @@ public class ShareService {
|
||||
})
|
||||
).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(shares)){
|
||||
extPanelShareMapper.batchInsert(shares);
|
||||
extPanelShareMapper.batchInsert(shares, AuthUtils.getUser().getUsername());
|
||||
}
|
||||
|
||||
// 下面是发送提醒消息逻辑
|
||||
@ -262,8 +256,7 @@ public class ShareService {
|
||||
String msg = StringUtils.joinWith(",", panelGroups.stream().map(PanelGroup::getName).collect(Collectors.toList()));
|
||||
Gson gson = new Gson();
|
||||
userIdSet.forEach(userId -> {
|
||||
// DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 分享了仪表板【"+msg+"】给您,请查收!");
|
||||
DeMsgutil.sendMsg(userId, 2L,1L, user.getNickName()+" 分享了仪表板【"+msg+"】给您,请查收!", gson.toJson(panelIds));
|
||||
DeMsgutil.sendMsg(userId, 2L, user.getNickName()+" 分享了仪表板【"+msg+"】给您,请查收!", gson.toJson(panelIds));
|
||||
});
|
||||
|
||||
}
|
||||
@ -287,6 +280,15 @@ public class ShareService {
|
||||
mapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public List<PanelSharePo> shareOut() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<PanelSharePo> queryShareOut() {
|
||||
String username = AuthUtils.getUser().getUsername();
|
||||
List<PanelSharePo> panelSharePos = extPanelShareMapper.queryOut(username);
|
||||
return panelSharePos;
|
||||
}
|
||||
|
||||
public List<PanelShareDto> queryTree(BaseGridRequest request){
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
@ -301,20 +303,7 @@ public class ShareService {
|
||||
|
||||
List<PanelSharePo> datas = extPanelShareMapper.query(param);
|
||||
|
||||
/*List<Long> targetIds = new ArrayList<>();
|
||||
targetIds.add(userId);
|
||||
targetIds.add(deptId);
|
||||
targetIds.addAll(roleIds);
|
||||
|
||||
ConditionEntity condition = new ConditionEntity();
|
||||
condition.setField("s.target_id");
|
||||
condition.setOperator("in");
|
||||
condition.setValue(targetIds);
|
||||
|
||||
request.setConditions(new ArrayList<ConditionEntity>(){{add(condition);}});
|
||||
|
||||
GridExample example = request.convertExample();
|
||||
List<PanelSharePo> datas = extPanelShareMapper.query(example);*/
|
||||
List<PanelShareDto> dtoLists = datas.stream().map(po -> BeanUtils.copyBean(new PanelShareDto(), po)).collect(Collectors.toList());
|
||||
return convertTree(dtoLists);
|
||||
}
|
||||
@ -336,5 +325,13 @@ public class ShareService {
|
||||
return extPanelShareMapper.queryWithResource(example);
|
||||
}
|
||||
|
||||
public List<PanelShareOutDTO> queryTargets(String panelId) {
|
||||
return extPanelShareMapper.queryTargets(panelId);
|
||||
}
|
||||
|
||||
|
||||
public void removeShares(PanelShareRemoveRequest removeRequest) {
|
||||
extPanelShareMapper.removeShares(removeRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -40,9 +40,7 @@ public class StoreService {
|
||||
panelStoreMapper.deleteByExample(panelStoreExample);
|
||||
}
|
||||
|
||||
/*public void remove(Long storeId) {
|
||||
panelStoreMapper.deleteByPrimaryKey(storeId);
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* 按照当前用户ID查询收藏仪表板
|
||||
|
||||
@ -79,8 +79,6 @@ public class DeptService {
|
||||
|
||||
@Transactional
|
||||
public int batchDelete(List<DeptDeleteRequest> requests){
|
||||
/* Integer index = ids.stream().map(sysDeptMapper::deleteByPrimaryKey).reduce(Integer::sum).orElse(-1);
|
||||
return index;*/
|
||||
List<Long> ids = requests.stream().map(request -> {
|
||||
Long pid = request.getPid();
|
||||
if (pid != DEPT_ROOT_PID){
|
||||
@ -127,7 +125,6 @@ public class DeptService {
|
||||
|
||||
|
||||
public List<SysDept> nodesTreeByCondition(BaseGridRequest request){
|
||||
//DeptService proxy = proxy();
|
||||
List<SimpleTreeNode> allNodes = allNodes();
|
||||
List<SimpleTreeNode> targetNodes = nodeByCondition(request);
|
||||
if(CollectionUtils.isEmpty(targetNodes)){
|
||||
|
||||
@ -105,9 +105,6 @@ public class PluginService {
|
||||
DeFileUtils.deleteFile(folder);
|
||||
}
|
||||
|
||||
//mybatisLoader.loadMybatis(myPlugin);
|
||||
//5.写表到my_plugin
|
||||
// myPlugin.setPluginId(0L);
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -118,15 +115,7 @@ public class PluginService {
|
||||
|
||||
|
||||
|
||||
/*private String makeTargetDir(MyPlugin myPlugin) {
|
||||
String name = myPlugin.getName();
|
||||
String dir = pluginDir + name + "/" + myPlugin.getVersion() + "/";
|
||||
File fileDir = new File(dir);
|
||||
if (!fileDir.exists()) {
|
||||
fileDir.mkdirs();
|
||||
}
|
||||
return dir;
|
||||
}*/
|
||||
|
||||
private String makeTargetDir(MyPlugin myPlugin) {
|
||||
String store = myPlugin.getStore();
|
||||
String dir = pluginDir + store + "/";
|
||||
|
||||
@ -1,86 +1,32 @@
|
||||
package io.dataease.service.sys;
|
||||
|
||||
|
||||
/*import io.dataease.base.domain.SysRole;
|
||||
import io.dataease.base.domain.SysUsersRolesExample;
|
||||
import io.dataease.base.mapper.SysRoleMapper;
|
||||
import io.dataease.base.mapper.SysUsersRolesMapper;*/
|
||||
import io.dataease.base.domain.SysRole;
|
||||
import io.dataease.base.mapper.ext.ExtSysRoleMapper;
|
||||
/*import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.request.RoleMenusRequest;*/
|
||||
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.response.RoleUserItem;
|
||||
import org.springframework.stereotype.Service;
|
||||
/*import org.springframework.transaction.annotation.Transactional;*/
|
||||
|
||||
import javax.annotation.Resource;
|
||||
/*import java.util.HashMap;*/
|
||||
import java.util.List;
|
||||
/*import java.util.Map;
|
||||
import java.util.stream.Collectors;*/
|
||||
|
||||
|
||||
@Service
|
||||
public class SysRoleService {
|
||||
|
||||
/*@Resource
|
||||
private SysRoleMapper mapper;*/
|
||||
|
||||
|
||||
@Resource
|
||||
private ExtSysRoleMapper extSysRoleMapper;
|
||||
|
||||
/*@Resource
|
||||
private SysUsersRolesMapper sysUsersRolesMapper;*/
|
||||
|
||||
|
||||
|
||||
/*public int add(SysRole role){
|
||||
Long now = System.currentTimeMillis();
|
||||
role.setCreateTime(now);
|
||||
role.setUpdateTime(now);
|
||||
return mapper.insert(role);
|
||||
}
|
||||
|
||||
|
||||
public int update(SysRole role){
|
||||
Long now = System.currentTimeMillis();
|
||||
role.setUpdateTime(now);
|
||||
return mapper.updateByPrimaryKey(role);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int delete(Long roleId){
|
||||
SysUsersRolesExample example = new SysUsersRolesExample();
|
||||
example.createCriteria().andRoleIdEqualTo(roleId);
|
||||
sysUsersRolesMapper.deleteByExample(example);//删除用户角色关联关系
|
||||
extSysRoleMapper.deleteRoleMenu(roleId);//删除菜单角色关联关系
|
||||
return mapper.deleteByPrimaryKey(roleId);
|
||||
}
|
||||
|
||||
*/
|
||||
public List<SysRole> query(BaseGridRequest request){
|
||||
List<SysRole> result = extSysRoleMapper.query(request.convertExample());
|
||||
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
|
||||
public List<Long> menuIds(Long roleId){
|
||||
return extSysRoleMapper.menuIds(roleId);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public int batchSaveRolesMenus(RoleMenusRequest request){
|
||||
extSysRoleMapper.deleteRoleMenu(request.getRoleId());
|
||||
List<Map<String, Long>> maps = request.getMenuIds().stream().map(menuId -> {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("roleId", request.getRoleId());
|
||||
map.put("menuId", menuId);
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
return extSysRoleMapper.batchInsertRoleMenu(maps);
|
||||
}*/
|
||||
|
||||
public List<RoleUserItem> allRoles(){
|
||||
return extSysRoleMapper.queryAll();
|
||||
|
||||
@ -41,7 +41,6 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class SysUserService {
|
||||
|
||||
//private final static String DEFAULT_PWD = "DataEase123..";
|
||||
|
||||
@Value("${dataease.init_password:DataEase123..}")
|
||||
private String DEFAULT_PWD;
|
||||
@ -57,25 +56,11 @@ public class SysUserService {
|
||||
|
||||
|
||||
public List<SysUserGridResponse> query(BaseGridRequest request) {
|
||||
/* List<SysUser> sysUsers = sysUserMapper.selectByExample(new SysUserExample());
|
||||
List<SysUserGridResponse> lists = sysUsers.stream().map(ele -> {
|
||||
SysUserGridResponse response = new SysUserGridResponse();
|
||||
BeanUtils.copyBean(response, ele);
|
||||
return response;
|
||||
}).collect(Collectors.toList());*/
|
||||
|
||||
GridExample gridExample = request.convertExample();
|
||||
List<SysUserGridResponse> lists = extSysUserMapper.query(gridExample);
|
||||
lists.forEach(item -> {
|
||||
/*for (SysUserGridResponse response : query) {
|
||||
if (item.getUserId().equals(response.getUserId())) {
|
||||
item.setId(response.getId());
|
||||
List<SysUserRole> roles = response.getRoles();
|
||||
item.setRoles(roles);
|
||||
List<Long> roleIds = roles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
item.setRoleIds(roleIds);
|
||||
item.setDept(response.getDept());
|
||||
}
|
||||
}*/
|
||||
|
||||
List<SysUserRole> roles = item.getRoles();
|
||||
List<Long> roleIds = roles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
item.setRoleIds(roleIds);
|
||||
|
||||
@ -0,0 +1,197 @@
|
||||
package io.dataease.service.system;
|
||||
|
||||
import io.dataease.base.domain.SystemParameter;
|
||||
import io.dataease.base.domain.SystemParameterExample;
|
||||
import io.dataease.base.mapper.SystemParameterMapper;
|
||||
import io.dataease.commons.constants.ParamConstants;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.EncryptUtils;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.controller.sys.response.MailInfo;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
@Service
|
||||
public class EmailService {
|
||||
|
||||
private static final String SSL_CLASS_KEY = "mail.smtp.socketFactory.class";
|
||||
|
||||
private static final String SSL_CLASS_VAL = "javax.net.ssl.SSLSocketFactory";
|
||||
|
||||
private static final String TLS_PROP_KEY = "mail.smtp.starttls.enable";
|
||||
|
||||
private static final String SMTP_TIMEOUT_KEY = "mail.smtp.timeout";
|
||||
|
||||
private static final String SMTP_TIMEOUT_VAL = "30000";
|
||||
|
||||
private static final String SMTP_CONNECTIONTIMEOUT_KEY = "mail.smtp.connectiontimeout";
|
||||
|
||||
private static final String SMTP_CONNECTIONTIMEOUT_VAL = "5000";
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private SystemParameterMapper systemParameterMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param to 收件人
|
||||
* @param title 标题
|
||||
* @param content 内容
|
||||
*/
|
||||
public void send(String to, String title, String content) {
|
||||
if (StringUtils.isBlank(to)) return ;
|
||||
MailInfo mailInfo = proxy().mailInfo();
|
||||
JavaMailSenderImpl driver = driver(mailInfo);
|
||||
|
||||
MimeMessage mimeMessage = driver.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
try {
|
||||
helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setFrom(driver.getUsername());
|
||||
helper.setSubject(title );
|
||||
helper.setText(content, true);
|
||||
helper.setTo(to);
|
||||
driver.send(mimeMessage);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
DEException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
public JavaMailSenderImpl driver(MailInfo mailInfo) {
|
||||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
||||
javaMailSender.setDefaultEncoding("UTF-8");
|
||||
javaMailSender.setHost(mailInfo.getHost());
|
||||
javaMailSender.setPort(Integer.valueOf(mailInfo.getPort()));
|
||||
javaMailSender.setUsername(mailInfo.getAccount());
|
||||
javaMailSender.setPassword(mailInfo.getPassword());
|
||||
Properties props = new Properties();
|
||||
if (BooleanUtils.toBoolean(mailInfo.getSsl())) {
|
||||
props.put(SSL_CLASS_KEY, SSL_CLASS_VAL);
|
||||
}
|
||||
if (BooleanUtils.toBoolean(mailInfo.getTls())) {
|
||||
props.put(TLS_PROP_KEY, "true");
|
||||
}
|
||||
props.put(SMTP_TIMEOUT_KEY, SMTP_TIMEOUT_VAL);
|
||||
props.put(SMTP_CONNECTIONTIMEOUT_KEY, SMTP_CONNECTIONTIMEOUT_VAL);
|
||||
javaMailSender.setJavaMailProperties(props);
|
||||
return javaMailSender;
|
||||
}
|
||||
|
||||
private EmailService proxy() {
|
||||
return CommonBeanFactory.getBean(EmailService.class);
|
||||
}
|
||||
|
||||
|
||||
public MailInfo mailInfo() {
|
||||
String type = ParamConstants.Classify.MAIL.getValue();
|
||||
List<SystemParameter> paramList = getParamList(type);
|
||||
MailInfo mailInfo = new MailInfo();
|
||||
if (!CollectionUtils.isEmpty(paramList)) {
|
||||
for (SystemParameter param : paramList) {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.SERVER.getValue())) {
|
||||
mailInfo.setHost(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.PORT.getValue())) {
|
||||
mailInfo.setPort(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.ACCOUNT.getValue())) {
|
||||
mailInfo.setAccount(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.PASSWORD.getValue())) {
|
||||
String password = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
mailInfo.setPassword(password);
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.SSL.getValue())) {
|
||||
mailInfo.setSsl(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.TLS.getValue())) {
|
||||
mailInfo.setTls(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.RECIPIENTS.getValue())) {
|
||||
mailInfo.setRecipient(param.getParamValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return mailInfo;
|
||||
}
|
||||
|
||||
|
||||
public List<SystemParameter> getParamList(String type) {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
example.createCriteria().andParamKeyLike(type + "%");
|
||||
return systemParameterMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
|
||||
public void editMail(List<SystemParameter> parameters) {
|
||||
parameters.forEach(parameter -> {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getValue())) {
|
||||
if (!StringUtils.isBlank(parameter.getParamValue())) {
|
||||
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
|
||||
parameter.setParamValue(string);
|
||||
}
|
||||
}
|
||||
example.createCriteria().andParamKeyEqualTo(parameter.getParamKey());
|
||||
if (systemParameterMapper.countByExample(example) > 0) {
|
||||
systemParameterMapper.updateByPrimaryKey(parameter);
|
||||
} else {
|
||||
systemParameterMapper.insert(parameter);
|
||||
}
|
||||
example.clear();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void testConnection(HashMap<String, String> hashMap) {
|
||||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
||||
javaMailSender.setDefaultEncoding("UTF-8");
|
||||
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.SERVER.getValue()));
|
||||
javaMailSender.setPort(Integer.valueOf(hashMap.get(ParamConstants.MAIL.PORT.getValue())));
|
||||
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getValue()));
|
||||
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getValue()));
|
||||
Properties props = new Properties();
|
||||
String recipients = hashMap.get(ParamConstants.MAIL.RECIPIENTS.getValue());
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getValue()))) {
|
||||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
}
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.TLS.getValue()))) {
|
||||
props.put("mail.smtp.starttls.enable", "true");
|
||||
}
|
||||
props.put("mail.smtp.timeout", "30000");
|
||||
props.put("mail.smtp.connectiontimeout", "5000");
|
||||
javaMailSender.setJavaMailProperties(props);
|
||||
try {
|
||||
javaMailSender.testConnection();
|
||||
} catch (MessagingException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
DEException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
if(!StringUtils.isBlank(recipients)){
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
try {
|
||||
helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setFrom(javaMailSender.getUsername());
|
||||
helper.setSubject("DataEase测试邮件 " );
|
||||
helper.setText("这是一封测试邮件,邮件发送成功", true);
|
||||
helper.setTo(recipients);
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
DEException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -9,24 +9,16 @@ import io.dataease.commons.constants.ParamConstants;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.EncryptUtils;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.controller.sys.response.BasicInfo;
|
||||
import io.dataease.controller.sys.response.MailInfo;
|
||||
import io.dataease.dto.SystemParameterDTO;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.service.FileService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
@ -43,7 +35,6 @@ public class SystemParameterService {
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
|
||||
public String searchEmail() {
|
||||
return extSystemParameterMapper.email();
|
||||
}
|
||||
@ -54,11 +45,9 @@ public class SystemParameterService {
|
||||
if (!CollectionUtils.isEmpty(paramList)) {
|
||||
for (SystemParameter param : paramList) {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.FRONT_TIME_OUT.getValue())) {
|
||||
/* result.setFrontTimeOut(StringUtils.isBlank(param.getParamValue()) ? 0 : Integer.parseInt(param.getParamValue())); */
|
||||
result.setFrontTimeOut(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.MSG_TIME_OUT.getValue())) {
|
||||
/* result.setMsgTimeOut(StringUtils.isBlank(param.getParamValue()) ? 0 : Integer.parseInt(param.getParamValue())); */
|
||||
result.setMsgTimeOut(param.getParamValue());
|
||||
}
|
||||
}
|
||||
@ -66,34 +55,6 @@ public class SystemParameterService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public MailInfo mailInfo(String type) {
|
||||
List<SystemParameter> paramList = this.getParamList(type);
|
||||
MailInfo mailInfo = new MailInfo();
|
||||
if (!CollectionUtils.isEmpty(paramList)) {
|
||||
for (SystemParameter param : paramList) {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.SERVER.getValue())) {
|
||||
mailInfo.setHost(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.PORT.getValue())) {
|
||||
mailInfo.setPort(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.ACCOUNT.getValue())) {
|
||||
mailInfo.setAccount(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.PASSWORD.getValue())) {
|
||||
String password = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
mailInfo.setPassword(password);
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.SSL.getValue())) {
|
||||
mailInfo.setSsl(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.TLS.getValue())) {
|
||||
mailInfo.setTls(param.getParamValue());
|
||||
} else if (StringUtils.equals(param.getParamKey(), ParamConstants.MAIL.RECIPIENTS.getValue())) {
|
||||
mailInfo.setRecipient(param.getParamValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return mailInfo;
|
||||
}
|
||||
|
||||
|
||||
public String getSystemLanguage() {
|
||||
String result = StringUtils.EMPTY;
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
@ -108,31 +69,6 @@ public class SystemParameterService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void editMail(List<SystemParameter> parameters) {
|
||||
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
|
||||
boolean empty = paramList.size() <= 0;
|
||||
|
||||
parameters.forEach(parameter -> {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getValue())) {
|
||||
if (!StringUtils.isBlank(parameter.getParamValue())) {
|
||||
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
|
||||
parameter.setParamValue(string);
|
||||
}
|
||||
}
|
||||
example.createCriteria().andParamKeyEqualTo(parameter.getParamKey());
|
||||
if (systemParameterMapper.countByExample(example) > 0) {
|
||||
systemParameterMapper.updateByPrimaryKey(parameter);
|
||||
} else {
|
||||
systemParameterMapper.insert(parameter);
|
||||
}
|
||||
example.clear();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void editBasic(List<SystemParameter> parameters) {
|
||||
parameters.forEach(parameter -> {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
@ -154,55 +90,10 @@ public class SystemParameterService {
|
||||
return systemParameterMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public void testConnection(HashMap<String, String> hashMap) {
|
||||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
||||
javaMailSender.setDefaultEncoding("UTF-8");
|
||||
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.SERVER.getValue()));
|
||||
javaMailSender.setPort(Integer.valueOf(hashMap.get(ParamConstants.MAIL.PORT.getValue())));
|
||||
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getValue()));
|
||||
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getValue()));
|
||||
Properties props = new Properties();
|
||||
String recipients = hashMap.get(ParamConstants.MAIL.RECIPIENTS.getValue());
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getValue()))) {
|
||||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
}
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.TLS.getValue()))) {
|
||||
props.put("mail.smtp.starttls.enable", "true");
|
||||
}
|
||||
props.put("mail.smtp.timeout", "30000");
|
||||
props.put("mail.smtp.connectiontimeout", "5000");
|
||||
javaMailSender.setJavaMailProperties(props);
|
||||
try {
|
||||
javaMailSender.testConnection();
|
||||
} catch (MessagingException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
DEException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
if(!StringUtils.isBlank(recipients)){
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
try {
|
||||
helper = new MimeMessageHelper(mimeMessage, true);
|
||||
helper.setFrom(javaMailSender.getUsername());
|
||||
helper.setSubject("DataEase测试邮件 " );
|
||||
helper.setText("这是一封测试邮件,邮件发送成功", true);
|
||||
helper.setTo(recipients);
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (MessagingException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
DEException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return System.getenv("MS_VERSION");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void saveLdap(List<SystemParameter> parameters) {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
parameters.forEach(param -> {
|
||||
@ -228,7 +119,6 @@ public class SystemParameterService {
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
|
||||
public List<SystemParameterDTO> getSystemParameterInfo(String paramConstantsType) {
|
||||
List<SystemParameter> paramList = this.getParamList(paramConstantsType);
|
||||
List<SystemParameterDTO> dtoList = new ArrayList<>();
|
||||
@ -247,8 +137,6 @@ public class SystemParameterService {
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void saveUIInfo(Map<String,List<SystemParameterDTO>> request, List<MultipartFile> bodyFiles) throws IOException {
|
||||
List<SystemParameterDTO> parameters = request.get("systemParams");
|
||||
if (null != bodyFiles)
|
||||
@ -293,9 +181,5 @@ public class SystemParameterService {
|
||||
|
||||
}
|
||||
|
||||
/* public static void main(String[] args) {
|
||||
String info="[{\"paramKey\":\"base.url\",\"paramValue\":null,\"type\":\"text\",\"sort\":1,\"file\":null,\"fileName\":null},{\"paramKey\":\"base.title\",\"paramValue\":\"DataEase Title\",\"type\":\"text\",\"sort\":3,\"file\":null,\"fileName\":null},{\"paramKey\":\"base.logo\",\"paramValue\":\"DataEase\",\"type\":\"text\",\"sort\":4,\"file\":null,\"fileName\":\"favicon.icon.png\"}]";
|
||||
List<SystemParameterDTO> temp = JSON.parseArray(info,SystemParameterDTO.class);
|
||||
// System.out.println("===>");
|
||||
} */
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user