mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-09-20 07:25:54 +08:00
Fix 3.7.1 (#776)
* fix: PH__CURRENTUSER * be: qiniu forceDirect * fix: 日期分组 * be: easy-action * Update @rbv * fix: 字段聚合删除不执行
This commit is contained in:
parent
229f543ac9
commit
0d89ba13eb
2
@rbv
2
@rbv
|
@ -1 +1 @@
|
|||
Subproject commit d6da52b4833a867f059c276b1927a8a8b551232b
|
||||
Subproject commit 90fb5173803d09abee44dfbf4547f824edd3deae
|
|
@ -503,7 +503,7 @@ public class EasyExcelGenerator extends SetUser {
|
|||
if (phName.startsWith(PH__CURRENTUSER)) {
|
||||
String useField = phName.substring(PH__CURRENTUSER.length() + 1);
|
||||
Object useValue = QueryHelper.queryFieldValue(getUser(), useField);
|
||||
return useValue == null ? null : useValue.toString();
|
||||
return useValue == null ? "" : useValue.toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -10,6 +10,7 @@ package com.rebuild.core.service.trigger;
|
|||
import cn.devezhao.persist4j.engine.ID;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.core.privileges.bizz.InternalPermission;
|
||||
import com.rebuild.core.service.SafeObservable;
|
||||
import com.rebuild.core.service.general.OperatingContext;
|
||||
import com.rebuild.core.service.general.OperatingObserver;
|
||||
|
@ -54,6 +55,13 @@ public class RobotTriggerObserver extends OperatingObserver {
|
|||
|
||||
@Override
|
||||
public void update(final SafeObservable o, Object context) {
|
||||
// fix: v3.7.1 预处理不要延迟
|
||||
if (context instanceof OperatingContext
|
||||
&& ((OperatingContext) context).getAction() == InternalPermission.DELETE_BEFORE) {
|
||||
super.update(o, context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLazyTriggers(false)) {
|
||||
List<Object> ctx = LAZY_TRIGGERS_CTX.get();
|
||||
if (ctx == null) ctx = new ArrayList<>();
|
||||
|
@ -106,7 +114,7 @@ public class RobotTriggerObserver extends OperatingObserver {
|
|||
// DataValidate 直接抛出
|
||||
if (ex instanceof DataValidateException) throw ex;
|
||||
|
||||
log.error("Preparing context of trigger failed : {}", action, ex);
|
||||
log.error("Preparing context of trigger fails : {}", action, ex);
|
||||
}
|
||||
}
|
||||
DELETE_BEFORE_HOLD.put(primary, deleteActions);
|
||||
|
|
|
@ -333,6 +333,7 @@ public class FieldAggregation extends TriggerAction {
|
|||
}
|
||||
}
|
||||
|
||||
if (targetRecordId == null) log.warn("Cannot found [targetRecordId]: {}", operatingContext);
|
||||
this.followSourceWhere = String.format("%s = '%s'", followSourceField, targetRecordId);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ public class GroupAggregation extends FieldAggregation {
|
|||
for (Map.Entry<String, String> e : groupFieldsMapping.entrySet()) {
|
||||
String sourceField = e.getKey();
|
||||
String targetField = e.getValue();
|
||||
// @see Dimension#getSqlName
|
||||
EasyField sourceFieldEasy = EasyMetaFactory.valueOf(MetadataHelper.getLastJoinField(sourceEntity, sourceField));
|
||||
EasyField targetFieldEasy = EasyMetaFactory.valueOf(targetEntity.getField(targetField));
|
||||
|
||||
if (isGroupUpdate) {
|
||||
Object beforeValue = operatingContext.getBeforeRecord() == null
|
||||
|
@ -149,62 +152,60 @@ public class GroupAggregation extends FieldAggregation {
|
|||
}
|
||||
}
|
||||
|
||||
// fix: 3.7.1
|
||||
boolean isDateField = sourceFieldEasy.getDisplayType() == DisplayType.DATE
|
||||
|| sourceFieldEasy.getDisplayType() == DisplayType.DATETIME;
|
||||
int targetFieldLength = 0;
|
||||
String dateFormat = null;
|
||||
if (isDateField) {
|
||||
targetFieldLength = StringUtils.defaultIfBlank(
|
||||
targetFieldEasy.getExtraAttr(EasyFieldConfigProps.DATE_FORMAT), targetFieldEasy.getDisplayType().getDefaultFormat()).length();
|
||||
|
||||
if (targetFieldLength == 4) dateFormat = "%Y";
|
||||
else if (targetFieldLength == 7) dateFormat = "%Y-%m";
|
||||
else dateFormat = "%Y-%m-%d";
|
||||
}
|
||||
|
||||
Object val = sourceRecord.getObjectValue(sourceField);
|
||||
if (val == null) {
|
||||
qFields.add(String.format("%s is null", targetField));
|
||||
qFieldsFollow.add(String.format("%s is null", sourceField));
|
||||
} else {
|
||||
//noinspection ConstantConditions
|
||||
EasyField sourceFieldEasy = EasyMetaFactory.valueOf(
|
||||
MetadataHelper.getLastJoinField(sourceEntity, sourceField));
|
||||
//noinspection ConstantConditions
|
||||
EasyField targetFieldEasy = EasyMetaFactory.valueOf(
|
||||
MetadataHelper.getLastJoinField(targetEntity, targetField));
|
||||
|
||||
// @see Dimension#getSqlName
|
||||
// for Refresh
|
||||
if (isDateField) {
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, dateFormat);
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, dateFormat);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// 日期分组
|
||||
if (sourceFieldEasy.getDisplayType() == DisplayType.DATE
|
||||
|| sourceFieldEasy.getDisplayType() == DisplayType.DATETIME) {
|
||||
|
||||
if (isDateField) {
|
||||
String formatKey = sourceFieldEasy.getDisplayType() == DisplayType.DATE
|
||||
? EasyFieldConfigProps.DATE_FORMAT
|
||||
: EasyFieldConfigProps.DATETIME_FORMAT;
|
||||
int sourceFieldLength = StringUtils.defaultIfBlank(
|
||||
sourceFieldEasy.getExtraAttr(formatKey), sourceFieldEasy.getDisplayType().getDefaultFormat())
|
||||
.length();
|
||||
|
||||
// 目标字段仅日期
|
||||
int targetFieldLength = StringUtils.defaultIfBlank(
|
||||
targetFieldEasy.getExtraAttr(EasyFieldConfigProps.DATE_FORMAT), targetFieldEasy.getDisplayType().getDefaultFormat())
|
||||
.length();
|
||||
sourceFieldEasy.getExtraAttr(formatKey), sourceFieldEasy.getDisplayType().getDefaultFormat()).length();
|
||||
|
||||
// 目标格式(长度)必须小于等于源格式
|
||||
Assert.isTrue(targetFieldLength <= sourceFieldLength,
|
||||
Language.L("日期字段格式不兼容") + String.format(" (%d,%d)", targetFieldLength, sourceFieldLength));
|
||||
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, dateFormat);
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, dateFormat);
|
||||
if (targetFieldLength == 4) { // 'Y'
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, "%Y");
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, "%Y");
|
||||
val = CalendarUtils.format("yyyy", (Date) val);
|
||||
} else if (targetFieldLength == 7) { // 'M'
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, "%Y-%m");
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, "%Y-%m");
|
||||
val = CalendarUtils.format("yyyy-MM", (Date) val);
|
||||
} else { // 'D' is default
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, "%Y-%m-%d");
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, "%Y-%m-%d");
|
||||
val = CalendarUtils.format("yyyy-MM-dd", (Date) val);
|
||||
}
|
||||
}
|
||||
|
||||
// 分类分组
|
||||
else if (sourceFieldEasy.getDisplayType() == DisplayType.CLASSIFICATION) {
|
||||
|
||||
int sourceFieldLevel = ClassificationManager.instance.getOpenLevel(
|
||||
MetadataHelper.getLastJoinField(sourceEntity, sourceField));
|
||||
int targetFieldLevel = ClassificationManager.instance.getOpenLevel(
|
||||
MetadataHelper.getLastJoinField(targetEntity, targetField));
|
||||
int sourceFieldLevel = ClassificationManager.instance.getOpenLevel(sourceFieldEasy.getRawMeta());
|
||||
int targetFieldLevel = ClassificationManager.instance.getOpenLevel(targetFieldEasy.getRawMeta());
|
||||
|
||||
// 目标等级必须小于等于源等级
|
||||
Assert.isTrue(targetFieldLevel <= sourceFieldLevel,
|
||||
|
|
|
@ -134,46 +134,60 @@ public class TargetWithMatchFields {
|
|||
for (Map.Entry<String, String> e : matchFieldsMapping.entrySet()) {
|
||||
String sourceField = e.getKey();
|
||||
String targetField = e.getValue();
|
||||
// @see Dimension#getSqlName
|
||||
EasyField sourceFieldEasy = EasyMetaFactory.valueOf(MetadataHelper.getLastJoinField(sourceEntity, sourceField));
|
||||
EasyField targetFieldEasy = EasyMetaFactory.valueOf(targetEntity.getField(targetField));
|
||||
|
||||
// fix: 3.7.1
|
||||
boolean isDateField = sourceFieldEasy.getDisplayType() == DisplayType.DATE
|
||||
|| sourceFieldEasy.getDisplayType() == DisplayType.DATETIME;
|
||||
int targetFieldLength = 0;
|
||||
String dateFormat = null;
|
||||
if (isDateField) {
|
||||
targetFieldLength = StringUtils.defaultIfBlank(
|
||||
targetFieldEasy.getExtraAttr(EasyFieldConfigProps.DATE_FORMAT), targetFieldEasy.getDisplayType().getDefaultFormat()).length();
|
||||
|
||||
if (targetFieldLength == 4) dateFormat = "%Y";
|
||||
else if (targetFieldLength == 7) dateFormat = "%Y-%m";
|
||||
else dateFormat = "%Y-%m-%d";
|
||||
}
|
||||
|
||||
Object val = sourceRecord.getObjectValue(sourceField);
|
||||
if (val == null) {
|
||||
qFields.add(String.format("%s is null", targetField));
|
||||
qFieldsFollow.add(String.format("%s is null", sourceField));
|
||||
} else {
|
||||
EasyField sourceFieldEasy = EasyMetaFactory.valueOf(MetadataHelper.getLastJoinField(sourceEntity, sourceField));
|
||||
EasyField targetFieldEasy = EasyMetaFactory.valueOf(MetadataHelper.getLastJoinField(targetEntity, targetField));
|
||||
|
||||
// @see Dimension#getSqlName
|
||||
// for Refresh
|
||||
if (isDateField) {
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, dateFormat);
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, dateFormat);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// 日期分组
|
||||
if (sourceFieldEasy.getDisplayType() == DisplayType.DATE
|
||||
|| sourceFieldEasy.getDisplayType() == DisplayType.DATETIME) {
|
||||
|
||||
if (isDateField) {
|
||||
String formatKey = sourceFieldEasy.getDisplayType() == DisplayType.DATE
|
||||
? EasyFieldConfigProps.DATE_FORMAT
|
||||
: EasyFieldConfigProps.DATETIME_FORMAT;
|
||||
int sourceFieldLength = StringUtils.defaultIfBlank(
|
||||
sourceFieldEasy.getExtraAttr(formatKey), sourceFieldEasy.getDisplayType().getDefaultFormat()).length();
|
||||
|
||||
// 目标字段仅使用日期
|
||||
int targetFieldLength = StringUtils.defaultIfBlank(
|
||||
targetFieldEasy.getExtraAttr(EasyFieldConfigProps.DATE_FORMAT), targetFieldEasy.getDisplayType().getDefaultFormat()).length();
|
||||
|
||||
// 目标格式(长度)必须小于等于源格式
|
||||
Assert.isTrue(targetFieldLength <= sourceFieldLength,
|
||||
Language.L("日期字段格式不兼容") + String.format(" (%d,%d)", targetFieldLength, sourceFieldLength));
|
||||
|
||||
sourceField = String.format("DATE_FORMAT(%s,'%s')", sourceField, dateFormat);
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, dateFormat);
|
||||
if (targetFieldLength == 4) { // 'Y'
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, "%Y");
|
||||
val = CalendarUtils.format("yyyy", (Date) val);
|
||||
} else if (targetFieldLength == 7) { // 'M'
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, "%Y-%m");
|
||||
val = CalendarUtils.format("yyyy-MM", (Date) val);
|
||||
} else { // 'D' is default
|
||||
targetField = String.format("DATE_FORMAT(%s,'%s')", targetField, "%Y-%m-%d");
|
||||
val = CalendarUtils.format("yyyy-MM-dd", (Date) val);
|
||||
}
|
||||
}
|
||||
|
||||
// 分类分组
|
||||
else if (sourceFieldEasy.getDisplayType() == DisplayType.CLASSIFICATION) {
|
||||
int sourceFieldLevel = ClassificationManager.instance.getOpenLevel(sourceFieldEasy.getRawMeta());
|
||||
|
|
|
@ -179,7 +179,7 @@ See LICENSE and COMMERCIAL in the project root for license information.
|
|||
font-size: 4.4rem;
|
||||
}
|
||||
|
||||
.grid-stack-item.fullscreen .chart.index > .data-item .with strong::before {
|
||||
.grid-stack-item.fullscreen .chart.index > .data-item span {
|
||||
zoom: 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -2129,6 +2129,7 @@ const EasyAction = {
|
|||
if (item.opType === 1) EasyAction.handleOp1(item)
|
||||
if (item.opType === 2) EasyAction.handleOp2(item)
|
||||
if (item.opType === 3) EasyAction.handleOp3(item)
|
||||
if (item.opType === 4) EasyAction.handleOp4(item)
|
||||
if (item.opType === 10) EasyAction.handleOp10(item)
|
||||
},
|
||||
|
||||
|
@ -2141,7 +2142,15 @@ const EasyAction = {
|
|||
const ids = _List.getSelectedIds()
|
||||
if (!ids[0]) return RbHighbar.create($L('请选择一条记录'))
|
||||
|
||||
_FrontJS.openLiteForm(ids[0], item.op2Value)
|
||||
let fields = []
|
||||
item.op2Value.forEach((item) => {
|
||||
let o = { field: item.field }
|
||||
if (item.tip2) o.tip = item.tip2
|
||||
if (item.readonly2) o.readonly = true
|
||||
if (item.required2) o.nullable = false
|
||||
fields.push(o)
|
||||
})
|
||||
_FrontJS.openLiteForm(ids[0], fields)
|
||||
},
|
||||
|
||||
handleOp3(item) {
|
||||
|
@ -2168,6 +2177,15 @@ const EasyAction = {
|
|||
})
|
||||
},
|
||||
|
||||
handleOp4(item) {
|
||||
const _List = _FrontJS.DataList
|
||||
const ids = _List.getSelectedIds()
|
||||
if (!ids[0]) return RbHighbar.create($L('请至少选择一条记录'))
|
||||
|
||||
let rr = item.op4Value.split(':')
|
||||
_List.exportReport(rr[0], ~~rr[1] === 2, null, null, true)
|
||||
},
|
||||
|
||||
handleOp10(item) {
|
||||
try {
|
||||
const FN = Function
|
||||
|
|
|
@ -633,8 +633,9 @@ var $createUploader = function (input, next, complete, error) {
|
|||
var putExtra = imageType ? { mimeType: ['image/*'] } : null
|
||||
|
||||
function _qiniuUpload(file) {
|
||||
const over200M = file.size / 1048576 >= 200
|
||||
$.get('/filex/qiniu/upload-keys?file=' + $encode(file.name) + '&noname=' + noname + useToken, function (res) {
|
||||
var o = qiniu.upload(file, res.data.key, res.data.token, putExtra, { forceDirect: true })
|
||||
var o = qiniu.upload(file, res.data.key, res.data.token, putExtra, { forceDirect: !over200M })
|
||||
o.subscribe({
|
||||
next: function (res) {
|
||||
typeof next === 'function' && next({ percent: res.total.percent, file: file })
|
||||
|
@ -646,7 +647,7 @@ var $createUploader = function (input, next, complete, error) {
|
|||
} else if (msg.contains('EXCEED FSIZELIMIT')) {
|
||||
RbHighbar.create($L('超出文件大小限制'))
|
||||
} else {
|
||||
RbHighbar.error($L('上传失败,请稍后重试' + ': ' + msg))
|
||||
RbHighbar.error($L('上传失败,请稍后重试') + ': ' + msg)
|
||||
}
|
||||
console.log('Upload error :', err)
|
||||
typeof error === 'function' && error({ error: msg, file: file })
|
||||
|
|
Loading…
Reference in a new issue