|
|
|
|
@ -68,6 +68,12 @@ public class HwWebDocumentServiceImpl implements IHwWebDocumentService
|
|
|
|
|
@Override
|
|
|
|
|
public int updateHwWebDocument(HwWebDocument hwWebDocument)
|
|
|
|
|
{
|
|
|
|
|
// 特殊处理 secretKey:前端不传或传 null 时清空数据库密钥
|
|
|
|
|
// 将 null 转换为空字符串,触发 Mapper 更新条件
|
|
|
|
|
if (hwWebDocument.getSecretKey() == null) {
|
|
|
|
|
hwWebDocument.setSecretKey("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hwWebDocumentMapper.updateHwWebDocument(hwWebDocument);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -103,13 +109,18 @@ public class HwWebDocumentServiceImpl implements IHwWebDocumentService
|
|
|
|
|
}
|
|
|
|
|
String secretKey = document.getSecretKey();
|
|
|
|
|
String address = document.getDocumentAddress();
|
|
|
|
|
|
|
|
|
|
// 若数据库密钥为空,则直接返回文件地址
|
|
|
|
|
if (secretKey == null || secretKey.trim().isEmpty()) {
|
|
|
|
|
return address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 若密钥不为空,则需要验证提供的密钥是否相等
|
|
|
|
|
String trimmedProvided = providedKey == null ? null : providedKey.trim();
|
|
|
|
|
if (trimmedProvided == null || trimmedProvided.isEmpty()) {
|
|
|
|
|
throw new ServiceException("密钥错误");
|
|
|
|
|
throw new ServiceException("密钥不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (secretKey.trim().equals(trimmedProvided)) {
|
|
|
|
|
return address;
|
|
|
|
|
} else {
|
|
|
|
|
|