This commit is contained in:
@@ -23,9 +23,9 @@
|
||||
|
||||
> <font color="warning">[修改]</font> `changeUserId` 说明: <font color="comment">变更人员id</font> 类型: <font color="warning">String</font> → <font color="info">Integer</font>
|
||||
|
||||
> <font color="info">[新增]</font> `storeId` 说明: <font color="comment">门店ID</font>
|
||||
> <font color="info">[新增]</font> `storeId` 说明: <font color="comment">门店ID</font> 类型: <font color="info">String</font>
|
||||
|
||||
> <font color="warning">[删除]</font> `oldField` 说明: <font color="comment">已废弃字段</font>
|
||||
> <font color="warning">[删除]</font> `oldField` 说明: <font color="comment">已废弃字段</font> 类型: <font color="warning">Integer</font>
|
||||
|
||||
## 【影响范围】
|
||||
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
|
||||
> <font color="warning">[重命名]</font> <font color="comment">taskId</font> → <font color="info">taskIds</font> 说明: <font color="comment">流程主键</font>
|
||||
|
||||
> <font color="warning">[删除]</font> `changeUserNickName` 说明: <font color="comment">变更人员别名</font>
|
||||
> <font color="info">[新增]</font> `applyUserList` 说明: <font color="comment">申请人员集合</font> 类型: <font color="info">List<String></font>
|
||||
|
||||
> <font color="warning">[删除]</font> `applyUser1` 说明: <font color="comment">申请人员</font> 类型: <font color="warning">Integer</font>
|
||||
```
|
||||
|
||||
| 操作 | 标签 | 类型段 |
|
||||
|------|------|--------|
|
||||
| 新增 | info `[新增]` | 无 |
|
||||
| 删除 | warning `[删除]` | 无 |
|
||||
| 修改 | warning `[修改]` | 仅类型变化时出现 |
|
||||
| 重命名 | warning `[重命名]` | 说明匹配时合并删除+新增;类型变化时附带类型行 |
|
||||
| 新增 | info `[新增]` | 始终展示,绿色 `info` |
|
||||
| 删除 | warning `[删除]` | 始终展示,橙色 `warning` |
|
||||
| 修改 | warning `[修改]` | 始终展示,旧类型 warning → 新类型 info |
|
||||
| 重命名 | warning `[重命名]` | 始终展示;仅改名时单色 info,改类型时 old → new |
|
||||
|
||||
### 重命名配对规则
|
||||
|
||||
|
||||
@@ -223,43 +223,73 @@ public class WeComNotifier {
|
||||
: colorComment(desc);
|
||||
|
||||
switch (change.getKind()) {
|
||||
case ADDED:
|
||||
return quoteLine(tagAdded() + " " + fieldName + " 说明: " + descPart);
|
||||
case REMOVED:
|
||||
return quoteLine(tagRemoved() + " " + fieldName + " 说明: " + descPart);
|
||||
case RENAMED:
|
||||
case ADDED: {
|
||||
StringBuilder line = new StringBuilder();
|
||||
line.append(tagAdded()).append(" ").append(fieldName)
|
||||
.append(" 说明: ").append(descPart);
|
||||
appendFieldType(line, change);
|
||||
return quoteLine(line.toString());
|
||||
}
|
||||
case REMOVED: {
|
||||
StringBuilder line = new StringBuilder();
|
||||
line.append(tagRemoved()).append(" ").append(fieldName)
|
||||
.append(" 说明: ").append(descPart);
|
||||
appendFieldType(line, change);
|
||||
return quoteLine(line.toString());
|
||||
}
|
||||
case RENAMED: {
|
||||
StringBuilder renameLine = new StringBuilder();
|
||||
renameLine.append(tagRenamed()).append(" ")
|
||||
.append(colorComment(safe(change.getOldFieldName()))).append(" → ")
|
||||
.append(colorInfo(safe(change.getFieldName())))
|
||||
.append(" 说明: ").append(descPart);
|
||||
String renameTypeDetail = change.getDetail();
|
||||
if (renameTypeDetail != null && !renameTypeDetail.isBlank()) {
|
||||
renameLine.append(" 类型: ").append(formatTypeChange(renameTypeDetail));
|
||||
}
|
||||
appendFieldType(renameLine, change);
|
||||
return quoteLine(renameLine.toString());
|
||||
}
|
||||
case MODIFIED:
|
||||
default:
|
||||
default: {
|
||||
StringBuilder line = new StringBuilder();
|
||||
line.append(tagModified()).append(" ").append(fieldName)
|
||||
.append(" 说明: ").append(descPart);
|
||||
String detail = change.getDetail();
|
||||
if (detail != null && !detail.isBlank()) {
|
||||
line.append(" 类型: ").append(formatTypeChange(detail));
|
||||
}
|
||||
appendFieldType(line, change);
|
||||
return quoteLine(line.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 类型变化:旧 warning → 新 info */
|
||||
/** 追加字段类型:新增/重命名(仅改名)用 info,删除用 warning,修改/重命名(改类型)用 old → new */
|
||||
private void appendFieldType(StringBuilder line, FieldChange change) {
|
||||
if (change.getKind() == FieldChange.ChangeKind.RENAMED
|
||||
|| change.getKind() == FieldChange.ChangeKind.MODIFIED) {
|
||||
String typeDetail = change.getDetail();
|
||||
if (typeDetail != null && !typeDetail.isBlank()) {
|
||||
line.append(" 类型: ").append(formatTypeChange(typeDetail));
|
||||
return;
|
||||
}
|
||||
}
|
||||
String singleType = change.getKind() == FieldChange.ChangeKind.REMOVED
|
||||
? change.getOldType()
|
||||
: change.getNewType();
|
||||
if (singleType == null || singleType.isBlank()) {
|
||||
return;
|
||||
}
|
||||
line.append(" 类型: ");
|
||||
if (change.getKind() == FieldChange.ChangeKind.REMOVED) {
|
||||
line.append(colorWarning(singleType));
|
||||
} else {
|
||||
line.append(colorInfo(singleType));
|
||||
}
|
||||
}
|
||||
|
||||
/** 类型变化:旧 warning → 新 info;泛型尖括号原样展示,不做 HTML 转义 */
|
||||
private String formatTypeChange(String detail) {
|
||||
int arrow = detail.indexOf(" → ");
|
||||
if (arrow < 0) {
|
||||
return colorWarning(safe(detail));
|
||||
return colorWarning(detail);
|
||||
}
|
||||
String oldType = detail.substring(0, arrow).trim();
|
||||
String newType = detail.substring(arrow + 3).trim();
|
||||
return colorWarning(safe(oldType)) + " → " + colorInfo(safe(newType));
|
||||
return colorWarning(oldType) + " → " + colorInfo(newType);
|
||||
}
|
||||
|
||||
private String tagAdded() {
|
||||
|
||||
Reference in New Issue
Block a user