Skip to content

Commit

Permalink
Merge pull request #536 from shanmengm/master
Browse files Browse the repository at this point in the history
Merge dev-0.3
  • Loading branch information
RichardShan committed Oct 26, 2018
2 parents 8a3ca5b + 836fb54 commit a20ff5d
Show file tree
Hide file tree
Showing 98 changed files with 7,096 additions and 9,999 deletions.
2 changes: 1 addition & 1 deletion assembly/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


<assembly>
<id>dist-beta.2</id>
<id>dist-beta.3</id>
<formats>
<format>zip</format>
</formats>
Expand Down
2 changes: 1 addition & 1 deletion bin/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if [ -z "$Lib_dir" ]; then
exit
fi

Server=`ps -ef | grep java | grep davinci-server_3.01-0.3.0-SNAPSHOT | grep -v grep | awk '{print $2}'`
Server=`ps -ef | grep java | grep edp.DavinciServerApplication | grep -v grep | awk '{print $2}'`
if [[ $Server -gt 0 ]]; then
echo "[Davinci Server] is already started"
exit
Expand Down
2 changes: 1 addition & 1 deletion bin/stop-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# >>


Server=`ps -ef | grep java | grep davinci-server_3.01-0.3.0-SNAPSHOT | grep -v grep | awk '{print $2}'`
Server=`ps -ef | grep java | grep edp.DavinciServerApplication | grep -v grep | awk '{print $2}'`
if [[ $Server -gt 0 ]]; then
kill -9 $Server
else
Expand Down
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion davinci-ui/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><link rel="manifest" href="manifest.json"><meta name="mobile-web-app-capable" content="yes"><title>Davinci</title><style>.general-loading{width:100%;height:100%;position:absolute;top:0;left:0}.general-loading .dot-container{width:90px;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0);display:table}.general-loading .dot-container .dot{width:30px;height:30px;display:table-cell;position:relative}.general-loading .dot-container .dot:after{width:26px;height:26px;background-color:#1b98e0;border-radius:50%;position:absolute;top:2px;left:2px;content:''}.general-loading .dot-container .dot:nth-child(1){animation:loading-1 1s linear infinite}.general-loading .dot-container .dot:nth-child(2){transform:scale(.5,.5);animation:loading-2 1s linear infinite}.general-loading .dot-container .dot:nth-child(3){transform:scale(0,0);animation:loading-3 1s linear infinite}@keyframes loading-1{0%{transform:scale(1,1)}50%{transform:scale(0,0)}100%{transform:scale(1,1)}}@keyframes loading-2{0%{transform:scale(.5,.5)}25%{transform:scale(1,1)}50%{transform:scale(.5,.5)}75%{transform:scale(0,0)}100%{transform:scale(.5,.5)}}@keyframes loading-3{0%{transform:scale(0,0)}50%{transform:scale(1,1)}100%{transform:scale(0,0)}}</style></head><body><noscript>如果你看到这条信息,说明<strong> 你的浏览器禁用了 JavaScript </strong>, 请 <strong>取消禁用</strong> 恢复应用程序正常工作。</noscript><div id="app"><div class="general-loading"><div class="dot-container"><div class="dot"></div><div class="dot"></div><div class="dot"></div></div></div></div><script type="text/javascript" src="/app.469ae82133661622c661.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><link rel="manifest" href="manifest.json"><meta name="mobile-web-app-capable" content="yes"><title>Davinci</title><style>.general-loading{width:100%;height:100%;position:absolute;top:0;left:0}.general-loading .dot-container{width:90px;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0);display:table}.general-loading .dot-container .dot{width:30px;height:30px;display:table-cell;position:relative}.general-loading .dot-container .dot:after{width:26px;height:26px;background-color:#1b98e0;border-radius:50%;position:absolute;top:2px;left:2px;content:''}.general-loading .dot-container .dot:nth-child(1){animation:loading-1 1s linear infinite}.general-loading .dot-container .dot:nth-child(2){transform:scale(.5,.5);animation:loading-2 1s linear infinite}.general-loading .dot-container .dot:nth-child(3){transform:scale(0,0);animation:loading-3 1s linear infinite}@keyframes loading-1{0%{transform:scale(1,1)}50%{transform:scale(0,0)}100%{transform:scale(1,1)}}@keyframes loading-2{0%{transform:scale(.5,.5)}25%{transform:scale(1,1)}50%{transform:scale(.5,.5)}75%{transform:scale(0,0)}100%{transform:scale(.5,.5)}}@keyframes loading-3{0%{transform:scale(0,0)}50%{transform:scale(1,1)}100%{transform:scale(0,0)}}</style></head><body><noscript>如果你看到这条信息,说明<strong> 你的浏览器禁用了 JavaScript </strong>, 请 <strong>取消禁用</strong> 恢复应用程序正常工作。</noscript><div id="app"><div class="general-loading"><div class="dot-container"><div class="dot"></div><div class="dot"></div><div class="dot"></div></div></div></div><script type="text/javascript" src="/app.20ae992439d1ac0ae822.js"></script></body></html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion davinci-ui/share.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><link rel="manifest" href="manifest.json"><meta name="mobile-web-app-capable" content="yes"><title>Davinci</title><style>.general-loading{width:100%;height:100%;position:absolute;top:0;left:0}.general-loading .dot-container{width:90px;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0);display:table}.general-loading .dot-container .dot{width:30px;height:30px;display:table-cell;position:relative}.general-loading .dot-container .dot:after{width:26px;height:26px;background-color:#1b98e0;border-radius:50%;position:absolute;top:2px;left:2px;content:''}.general-loading .dot-container .dot:nth-child(1){animation:loading-1 1s linear infinite}.general-loading .dot-container .dot:nth-child(2){transform:scale(.5,.5);animation:loading-2 1s linear infinite}.general-loading .dot-container .dot:nth-child(3){transform:scale(0,0);animation:loading-3 1s linear infinite}@keyframes loading-1{0%{transform:scale(1,1)}50%{transform:scale(0,0)}100%{transform:scale(1,1)}}@keyframes loading-2{0%{transform:scale(.5,.5)}25%{transform:scale(1,1)}50%{transform:scale(.5,.5)}75%{transform:scale(0,0)}100%{transform:scale(.5,.5)}}@keyframes loading-3{0%{transform:scale(0,0)}50%{transform:scale(1,1)}100%{transform:scale(0,0)}}</style></head><body><noscript>如果你看到这条信息,说明<strong> 你的浏览器禁用了 JavaScript </strong>, 请 <strong>取消禁用</strong> 恢复应用程序正常工作。</noscript><div id="app"><div class="general-loading"><div class="dot-container"><div class="dot"></div><div class="dot"></div><div class="dot"></div></div></div></div><script type="text/javascript" src="/share.d06c3c2cc7f19c0f0c62.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><link rel="manifest" href="manifest.json"><meta name="mobile-web-app-capable" content="yes"><title>Davinci</title><style>.general-loading{width:100%;height:100%;position:absolute;top:0;left:0}.general-loading .dot-container{width:90px;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0);display:table}.general-loading .dot-container .dot{width:30px;height:30px;display:table-cell;position:relative}.general-loading .dot-container .dot:after{width:26px;height:26px;background-color:#1b98e0;border-radius:50%;position:absolute;top:2px;left:2px;content:''}.general-loading .dot-container .dot:nth-child(1){animation:loading-1 1s linear infinite}.general-loading .dot-container .dot:nth-child(2){transform:scale(.5,.5);animation:loading-2 1s linear infinite}.general-loading .dot-container .dot:nth-child(3){transform:scale(0,0);animation:loading-3 1s linear infinite}@keyframes loading-1{0%{transform:scale(1,1)}50%{transform:scale(0,0)}100%{transform:scale(1,1)}}@keyframes loading-2{0%{transform:scale(.5,.5)}25%{transform:scale(1,1)}50%{transform:scale(.5,.5)}75%{transform:scale(0,0)}100%{transform:scale(.5,.5)}}@keyframes loading-3{0%{transform:scale(0,0)}50%{transform:scale(1,1)}100%{transform:scale(0,0)}}</style></head><body><noscript>如果你看到这条信息,说明<strong> 你的浏览器禁用了 JavaScript </strong>, 请 <strong>取消禁用</strong> 恢复应用程序正常工作。</noscript><div id="app"><div class="general-loading"><div class="dot-container"><div class="dot"></div><div class="dot"></div><div class="dot"></div></div></div></div><script type="text/javascript" src="/share.1393f3b71b7660b578fe.js"></script></body></html>
4 changes: 2 additions & 2 deletions server/src/main/java/edp/core/common/job/ScheduleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

/**
* 通用schedule调度接口,业务层必须实现
* 命名格式为{jobType}ScheduleService
* 如: emailScheduleService
* 命名格式为{jobType}ScheduleService
* 如: emailScheduleService
*/
public interface ScheduleService {

Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/edp/core/enums/SqlTypeEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public enum SqlTypeEnum {
INT("INT", "INT(12)"),
INTEGER("INTEGER", "INTEGER(12)"),
BIGINT("BIGINT", "BIGINT(20)"),
DECIMAL("DECIMAL", "DECIMAL(17,3)"),
NUMERIC("NUMERIC", "NUMERIC(17,3)"),
DECIMAL("DECIMAL", "DECIMAL(17,6)"),
NUMERIC("NUMERIC", "NUMERIC(17,6)"),
REAL("REAL", "REAL"),
FLOAT("FLOAT", "FLOAT"),
DOUBLE("DOUBLE", "DOUBLE"),
Expand Down
57 changes: 45 additions & 12 deletions server/src/main/java/edp/core/utils/MailUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public void sendSimpleEmail(String to, String subject, String content) throws Se
* @param content 内容
* @throws ServerException
*/
public void sendHtmlEmail(String from, String nickName, String subject, String[] to, String[] cc, String[] bcc, String content) throws ServerException {
public void sendHtmlEmail(String from, String nickName, String subject, String[] to, String[] cc, String[] bcc,
String content, List<File> files) throws ServerException {

if (StringUtils.isEmpty(from)) {
log.info("email address(from) cannot be empty");
Expand Down Expand Up @@ -153,6 +154,7 @@ public void sendHtmlEmail(String from, String nickName, String subject, String[]
log.info("start send email to {}", to);

try {

MimeMessage message = javaMailSender.createMimeMessage();
MimeMessageHelper messageHelper = new MimeMessageHelper(message, true);

Expand All @@ -165,8 +167,26 @@ public void sendHtmlEmail(String from, String nickName, String subject, String[]
if (null != bcc && bcc.length > 0) {
messageHelper.setBcc(bcc);
}

if (StringUtils.isEmpty(content)) {
content = "<html></html>";
}
messageHelper.setText(content, true);

if (null != files && files.size() > 0) {
if (files.size() == 1) {
File file = files.get(0);
String attName = "attachment" + file.getName().substring(file.getName().lastIndexOf("."));
messageHelper.addAttachment(attName, file);
} else {
for (int i = 0; i < files.size(); i++) {
File file = files.get(i);
String attName = "attachment-" + (i + 1) + file.getName().substring(file.getName().lastIndexOf("."));
messageHelper.addAttachment(attName, file);
}
}
}

javaMailSender.send(message);
log.info("Send mail success, in {} million seconds", System.currentTimeMillis() - startTimestamp);
} catch (MessagingException e) {
Expand All @@ -188,22 +208,35 @@ public void sendHtmlEmail(String from, String nickName, String subject, String[]
* @param content
* @throws ServerException
*/
public void sendHtmlEmail(String subject, String to, String content) throws ServerException {
sendHtmlEmail(sendEmailfrom, nickName, subject, new String[]{to}, null, null, content);
public void sendHtmlEmail(String subject, String to, String content, List<File> files) throws ServerException {
sendHtmlEmail(sendEmailfrom, nickName, subject, new String[]{to}, null, null, content, files);
}

/**
* 发送 Html 邮件
* 使用默认配置发送地址
*
* @param subject
* @param to
* @param content
* @throws ServerException
*/
public void sendHtmlEmail(String subject, String to, String[] cc, String[] bcc, String content, List<File> files) throws ServerException {
sendHtmlEmail(sendEmailfrom, nickName, subject, new String[]{to}, cc, bcc, content, files);
}

/**
* 发送模板邮件
*
* @param from 发件地址
* @param nickName 昵称
* @param subject 主题
* @param to 收件地址
* @param cc 抄送
* @param bcc 加密抄送
* @param template 模板地址
* @param content 模板内容
* @param files 附件
* @param from 发件地址
* @param nickName 昵称
* @param subject 主题
* @param to 收件地址
* @param cc 抄送
* @param bcc 加密抄送
* @param template 模板地址
* @param content 模板内容
* @param files 附件
* @throws ServerException
*/
public void sendTemplateEmail(String from, String nickName, String subject, String[] to, String[] cc, String[] bcc,
Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/edp/core/utils/SqlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ public static String formatSqlType(String type) throws ServerException {
Matcher matcher = pattern.matcher(type);
if (!matcher.find()) {
return SqlTypeEnum.getType(type);
} else {
return type;
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public String getContentUrl(Long userId, String contentType, Long contengId) {
}

sb.append(getHost())
.append("/share.html#/share/")
.append(contentType.equalsIgnoreCase("widget") || contentType.equalsIgnoreCase("portal") ? "dashboard" : contentType)
.append("?shareInfo=")
.append(shareToken)
.append("&type=" + type);
.append("/share.html#/share/")
.append(contentType.equalsIgnoreCase("widget") || contentType.equalsIgnoreCase("portal") ? "dashboard" : contentType)
.append("?shareInfo=")
.append(shareToken)
.append("&type=" + type);

return sb.toString();
}
Expand Down
13 changes: 10 additions & 3 deletions server/src/main/java/edp/davinci/core/enums/SqlColumnEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ public static Object formatValue(String type, String value) throws ServerExcepti
type = type.toUpperCase();
for (SqlColumnEnum sqlTypeEnum : values()) {
if (sqlTypeEnum.type.equals(type)) {
Object object = s2dbValue(type, value);
Object object = null;
try {
object = s2dbValue(type, value);
} catch (Exception e) {
throw new ServerException(e.toString() + ":[" + type + ":" + value + "]");
}
return object;
}
}
Expand All @@ -89,7 +94,7 @@ public static String toJavaType(String type) throws ServerException {
return null;
}

private static Object s2dbValue(String type, String value) {
private static Object s2dbValue(String type, String value) throws Exception {
Object result = value.trim();
if (StringUtils.isEmpty(value)) {
return null;
Expand All @@ -113,7 +118,9 @@ private static Object s2dbValue(String type, String value) {
case "NUMERIC":
if ("".equals(value.trim())) {
result = new BigDecimal("0.0").stripTrailingZeros();
} else result = new BigDecimal(value.trim()).stripTrailingZeros();
} else {
result = new BigDecimal(value.trim()).stripTrailingZeros();
}
break;

case "FLOAT":
Expand Down
64 changes: 41 additions & 23 deletions server/src/main/java/edp/davinci/dao/WidgetMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

package edp.davinci.dao;

import edp.davinci.dto.shareDto.ShareWidget;
import edp.davinci.dto.widgetDto.WidgetWithProjectAndView;
import edp.davinci.model.Widget;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Set;
Expand All @@ -40,6 +40,9 @@ public interface WidgetMapper {
@Select({"select * from widget where id = #{id}"})
Widget getById(@Param("id") Long id);

@Select({"select w.*,v.model from widget w LEFT JOIN `view` v on v.id = w.view_id where w.id = #{id}"})
ShareWidget getShareWidgetById(@Param("id") Long id);


int insertBatch(@Param("list") List<Widget> list);

Expand Down Expand Up @@ -68,6 +71,15 @@ public interface WidgetMapper {
})
Set<Widget> getByDisplayId(@Param("displayId") Long displayId);

@Select({
"SELECT w.*, v.model FROM widget w ",
"LEFT JOIN mem_display_slide_widget m on w.id = m.widget_id",
"LEFT JOIN display_slide s on m.display_slide_id = s.id",
"LEFT JOIN `view` v on v.id = w.view_id",
"WHERE s.display_id = #{displayId}",
})
Set<ShareWidget> getShareWidgetsByDisplayId(@Param("displayId") Long displayId);

@Select({"select id from widget where project_id = #{projectId} and name = #{name}"})
Long getByNameWithProjectId(@Param("name") String name, @Param("projectId") Long projectId);

Expand All @@ -76,34 +88,40 @@ public interface WidgetMapper {


@Select({
"SELECT ",
" w.*,",
" p.id 'project.id',",
" p.`name` 'project.name',",
" p.description 'project.description',",
" p.pic 'project.pic',",
" p.org_id 'project.orgId',",
" p.user_id 'project.userId',",
" p.visibility 'p.visibility',",
" v.id 'view.id',",
" v.`name` 'view.name',",
" v.description 'view.description',",
" v.project_id 'view.projectId',",
" v.source_id 'view.sourceId',",
" v.`sql` 'view.sql',",
" v.model 'view.model',",
" v.config 'view.config'",
"FROM",
" widget w ",
" LEFT JOIN project p on w.project_id = p.id",
" LEFT JOIN `view` v on w.view_id = v.id",
"WHERE w.id = #{id}",
"SELECT ",
" w.*,",
" p.id 'project.id',",
" p.`name` 'project.name',",
" p.description 'project.description',",
" p.pic 'project.pic',",
" p.org_id 'project.orgId',",
" p.user_id 'project.userId',",
" p.visibility 'p.visibility',",
" v.id 'view.id',",
" v.`name` 'view.name',",
" v.description 'view.description',",
" v.project_id 'view.projectId',",
" v.source_id 'view.sourceId',",
" v.`sql` 'view.sql',",
" v.model 'view.model',",
" v.config 'view.config'",
"FROM",
" widget w ",
" LEFT JOIN project p on w.project_id = p.id",
" LEFT JOIN `view` v on w.view_id = v.id",
"WHERE w.id = #{id}",
})
WidgetWithProjectAndView getWidgetWithProjectAndViewById(@Param("id") Long id);

@Select({"SELECT w.* FROM mem_dashboard_widget m LEFT JOIN widget w on w.id = m.widget_Id WHERE m.dashboard_id = #{dashboardId}"})
Set<Widget> getByDashboard(@Param("dashboardId") Long dashboardId);

@Select({"SELECT w.*, v.model FROM mem_dashboard_widget m ",
"LEFT JOIN widget w on w.id = m.widget_Id ",
"LEFT JOIN `view` v on v.id = w.view_id",
"WHERE m.dashboard_id = #{dashboardId}"})
Set<ShareWidget> getShareWidgetsByDashboard(@Param("dashboardId") Long dashboardId);

@Delete({"delete from widget where project_id = #{projectId}"})
int deleteByProject(@Param("projectId") Long projectId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package edp.davinci.dto.shareDto;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

@Data
Expand All @@ -28,4 +30,9 @@ public class ShareWidget {
private Long type;
private String config;
private String dataToken;
private String model;

@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@JSONField(serialize = false)
private Long viewId;
}
Loading

0 comments on commit a20ff5d

Please sign in to comment.