Merge branch 'dev' of github.com:dataease/dataease into dev

This commit is contained in:
taojinlong 2022-04-02 14:06:58 +08:00
commit 4b42e73871
11 changed files with 154 additions and 40 deletions

View File

@ -45,4 +45,7 @@ public interface ExtChartViewMapper {
void copyCacheToView(@Param("viewIds") List<String> viewIds );
int updateToCache(@Param("viewId") String viewId );
void copyCache(@Param("sourceViewId") String sourceViewId,@Param("newViewId") String newViewId);
}

View File

@ -89,6 +89,69 @@
chart_view.id = #{id}
</insert>
<insert id="copyCache">
INSERT INTO chart_view_cache (
id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from
) SELECT
#{newViewId} as id,
`name`,
title,
scene_id,
table_id,
`type`,
render,
result_count,
result_mode,
create_by,
create_time,
update_time,
style_priority,
chart_type,
is_plugin,
x_axis,
x_axis_ext,
y_axis,
y_axis_ext,
ext_stack,
ext_bubble,
custom_attr,
custom_style,
custom_filter,
drill_fields,
senior,
SNAPSHOT,
data_from from chart_view_cache
WHERE
chart_view_cache.id = #{sourceViewId}
</insert>
<!-- <select id="searchOne" resultMap="BaseResultMapDTO">-->
<!-- select-->
<!-- id, `name`, scene_id, table_id, `type`, title, create_by, create_time, update_time,-->
@ -404,4 +467,37 @@
#{viewId}
</foreach>
</update>
<update id="updateToCache">
UPDATE chart_view_cache cv,
chart_view cve
SET cv.`name` = cve.`name`,
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from
where cve.id = cv.id and cv.id =#{viewId}
</update>
</mapper>

View File

@ -13,6 +13,7 @@ import io.dataease.controller.request.chart.ChartViewCacheRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.response.ChartDetail;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.service.chart.ChartViewCacheService;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.panel.PanelViewService;
import io.swagger.annotations.Api;
@ -34,8 +35,9 @@ import java.util.List;
public class ChartViewController {
@Resource
private ChartViewService chartViewService;
@Resource
private PanelViewService panelViewService;
private ChartViewCacheService chartViewCacheService;
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
@ApiOperation("保存")
@ -150,7 +152,7 @@ public class ChartViewController {
@ApiOperation("重置视图缓存")
@PostMapping("/resetViewCache/{id}/{panelId}")
public void resetViewCache(@PathVariable String id, @PathVariable String panelId) {
chartViewService.resetViewCache(id);
chartViewCacheService.refreshCache(id);
}
}

View File

@ -0,0 +1,28 @@
package io.dataease.service.chart;
import io.dataease.base.mapper.ChartViewCacheMapper;
import io.dataease.base.mapper.ext.ExtChartViewMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Author: wangjiahao
* Date: 2022/4/2
* Description:
*/
@Service
public class ChartViewCacheService {
@Resource
private ExtChartViewMapper extChartViewMapper;
@Transactional
public void refreshCache(String viewId){
if(extChartViewMapper.updateToCache(viewId)==0){
extChartViewMapper.copyToCache(viewId);
}
}
}

View File

@ -97,6 +97,8 @@ public class ChartViewService {
private PanelGroupExtendDataService extendDataService;
@Resource
private ExtPanelGroupExtendDataMapper extPanelGroupExtendDataMapper;
@Resource
private ChartViewCacheService chartViewCacheService;
//默认使用非公平
@ -130,7 +132,7 @@ public class ChartViewService {
chartView.setUpdateTime(timestamp);
chartViewMapper.insertSelective(chartView);
// 新建的视图也存入缓存表中
extChartViewMapper.copyToCache(chartView.getId());
chartViewCacheService.refreshCache(chartView.getId());
PanelView newPanelView = new PanelView();
newPanelView.setId(UUIDUtil.getUUIDAsString());
@ -154,27 +156,6 @@ public class ChartViewService {
});
}
// // 直接保存统一到缓存表
// public ChartViewWithBLOBs save(ChartViewRequest chartView) {
// checkName(chartView);
// long timestamp = System.currentTimeMillis();
// chartView.setUpdateTime(timestamp);
// if (ObjectUtils.isEmpty(chartView.getId())) {
// chartView.setId(UUID.randomUUID().toString());
// chartView.setCreateBy(AuthUtils.getUser().getUsername());
// chartView.setCreateTime(timestamp);
// chartView.setUpdateTime(timestamp);
// chartViewMapper.insertSelective(chartView);
// } else {
// chartViewMapper.updateByPrimaryKeySelective(chartView);
// }
// Optional.ofNullable(chartView.getId()).ifPresent(id -> {
// CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id);
// });
// return getOneWithPermission(chartView.getId());
// }
public List<ChartViewDTO> list(ChartViewRequest chartViewRequest) {
chartViewRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
return extChartViewMapper.search(chartViewRequest);
@ -268,7 +249,7 @@ public class ChartViewService {
//仪表板编辑页面 从缓存表中取数据 缓存表中没有数据则进行插入
result = extChartViewMapper.searchOneFromCache(id);
if (result == null) {
extChartViewMapper.copyToCache(id);
chartViewCacheService.refreshCache(id);
result = extChartViewMapper.searchOneFromCache(id);
}
} else {
@ -1047,8 +1028,9 @@ public class ChartViewService {
public String chartCopy(String id, String panelId) {
String newChartId = UUID.randomUUID().toString();
extChartViewMapper.chartCopy(newChartId, id, panelId);
extChartViewMapper.copyCache(id,newChartId);
extPanelGroupExtendDataMapper.copyExtendData(id,newChartId,panelId);
extChartViewMapper.copyToCache(newChartId);
chartViewCacheService.refreshCache(id);
return newChartId;
}
@ -1082,9 +1064,4 @@ public class ChartViewService {
extChartViewMapper.deleteCacheWithPanel(panelId);
}
public void resetViewCache(String viewId) {
extChartViewMapper.deleteViewCache(viewId);
extChartViewMapper.copyToCache(viewId);
}
}

View File

@ -93,7 +93,7 @@
/>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{ $t('table.cancel') }}</el-button>
<el-button type="primary" @click="sureCurTitle">{{ $t('table.confirm') }}</el-button>
<el-button :disabled="!textarea" type="primary" @click="sureCurTitle">{{ $t('table.confirm') }}</el-button>
</span>
</el-dialog>

View File

@ -438,7 +438,7 @@
:index="index"
:item="item"
:chart="chart"
:dimension-data="dimensionD"
:dimension-data="dimension"
:quota-data="quota"
@onQuotaItemChange="quotaItemChange"
@onQuotaItemRemove="quotaItemRemove"
@ -1628,6 +1628,11 @@ export default {
}
}
})
if (view.type === 'label') {
if (view.xaxis.length > 1) {
view.xaxis.splice(1, view.xaxis.length)
}
}
if (view.type.startsWith('pie') ||
view.type.startsWith('funnel') ||
view.type.startsWith('text') ||

View File

@ -30,7 +30,8 @@
"passwordPlaceholder": "Please Input Password:",
"loginbtn": "Login",
"pwdFmtError": "Password Must More Than 6 Characters",
"uOrpwdError": "Invalid Account Or Password"
"uOrpwdError": "Invalid Account Or Password",
"accFmtError": "Account Must More Than 1 Characters"
},
"home": {
"tab1": "My Favorites",

View File

@ -29,7 +29,8 @@
"password": "密码:",
"passwordPlaceholder": "请输入密码",
"loginbtn": "登录",
"pwdFmtError": "密码最短为6个字符",
"pwdFmtError": "密码最短为1个字符",
"accFmtError": "账号最短为1个字符",
"uOrpwdError": "无效账号或密码"
},
"home": {

View File

@ -31,7 +31,8 @@
"passwordPlaceholder": "請輸入密碼",
"loginbtn": "登錄",
"pwdFmtError": "密碼最短為6個字符",
"uOrpwdError": "無效賬號或密碼"
"uOrpwdError": "無效賬號或密碼",
"accFmtError": "帳號最短為1個字符"
},
"home": {
"tab1": "我的收藏",

View File

@ -67,17 +67,17 @@
async loginByPwd() {
if (this.username.length < 3) {
if (this.username.length < 1) {
uni.showToast({
icon: 'none',
title: '账号最短为 3 个字符'
title: this.$t('login.accFmtError')
});
return;
}
if (this.password.length < 6) {
if (this.password.length < 1) {
uni.showToast({
icon: 'none',
title: this.$t('login.pwdFmtError')
title: this.$t('login.passwordPlaceholder')
});
return;
}