feat(portal): 调整密钥字段的JSON序列化行为并优化安全显示逻辑

- 将密钥字段的注解从 @JsonIgnore 更改为 @JsonProperty(access = WRITE_ONLY)
- 在列表查询中统一隐藏密钥字段
- 在详情密钥字段,并查询中也隐藏保留原有文件地址隐藏逻辑
- 添加调试日志打印密钥值用于排查问题
- 注释掉不再使用的 Excel 导出密钥配置
master
zangch@mesnac.com 1 month ago
parent 135e901ff4
commit a54a6225e9

@ -47,6 +47,8 @@ public class HwWebDocumentController extends BaseController
startPage();
List<HwWebDocument> list = hwWebDocumentService.selectHwWebDocumentList(hwWebDocument);
for (HwWebDocument doc : list) {
// 隐藏密钥,若设置了密钥则隐藏文件地址
doc.setSecretKey(null);
if (doc.getHasSecret()) {
doc.setDocumentAddress(null);
}
@ -75,8 +77,12 @@ public class HwWebDocumentController extends BaseController
public AjaxResult getInfo(@PathVariable("documentId") String documentId)
{
HwWebDocument doc = hwWebDocumentService.selectHwWebDocumentByDocumentId(documentId);
if (doc != null && doc.getHasSecret()) {
doc.setDocumentAddress(null);
if (doc != null) {
// 隐藏密钥,若设置了密钥则隐藏文件地址
doc.setSecretKey(null);
if (doc.getHasSecret()) {
doc.setDocumentAddress(null);
}
}
return success(doc);
}
@ -100,6 +106,7 @@ public class HwWebDocumentController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody HwWebDocument hwWebDocument)
{
System.out.println(hwWebDocument.getSecretKey());
return toAjax(hwWebDocumentService.updateHwWebDocument(hwWebDocument));
}

@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Hw hw_web_document
@ -32,8 +32,8 @@ public class HwWebDocument extends BaseEntity
private String webCode;
/** 密钥 */
@Excel(name = "密钥")
@JsonIgnore
// @Excel(name = "密钥")
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private String secretKey;
/** json */

Loading…
Cancel
Save