✨ 异常处置跟进支持上传附件
跟进记录新增 attachments_json 列,存 [{name, url}] 形式的 JSON 数组。
跟进说明与附件至少填其一即可:只传附件时,follow_content 列为 NOT NULL,
故写入固定文案「已上传跟进附件」,列表按该文案展示。
建表脚本补 COLLATE:原先只写 CHARSET,落到 MySQL 8 服务器默认排序规则,
与库中实际的 utf8mb4_0900_ai_ci 不一致。
This commit is contained in:
+12
-5
@@ -267,23 +267,30 @@ public class ExceptionDisposalServiceImpl
|
||||
if (request == null || request.getId() == null) {
|
||||
throw new ServiceException("请选择需要跟进的异常");
|
||||
}
|
||||
if (Func.isBlank(request.getFollowContent())) {
|
||||
throw new ServiceException("请填写跟进说明");
|
||||
boolean hasAttachments = Func.isNotBlank(request.getAttachmentsJson());
|
||||
if (Func.isBlank(request.getFollowContent()) && !hasAttachments) {
|
||||
throw new ServiceException("请填写跟进说明或上传附件");
|
||||
}
|
||||
if (request.getFollowContent().length() > 500) {
|
||||
if (Func.isNotBlank(request.getFollowContent()) && request.getFollowContent().length() > 500) {
|
||||
throw new ServiceException("跟进说明不能超过500字");
|
||||
}
|
||||
ExceptionDisposal disposal = getExisting(request.getId());
|
||||
if (STATUS_COMPLETED.equals(disposal.getDisposalStatus())) {
|
||||
throw new ServiceException("已完成的异常不允许继续跟进");
|
||||
}
|
||||
// 上传了附件但没写说明时,跟进说明留空,列表按附件回退展示
|
||||
String followContent = Func.isBlank(request.getFollowContent())
|
||||
? null
|
||||
: request.getFollowContent();
|
||||
disposal.setDisposalStatus(STATUS_PROCESSING);
|
||||
disposal.setLatestFollowContent(request.getFollowContent());
|
||||
disposal.setLatestFollowContent(Func.isBlank(followContent) ? "已上传跟进附件" : followContent);
|
||||
updateById(disposal);
|
||||
|
||||
ExceptionDisposalFollowRecord record = new ExceptionDisposalFollowRecord();
|
||||
record.setDisposalId(disposal.getId());
|
||||
record.setFollowContent(request.getFollowContent());
|
||||
// follow_content 列为 NOT NULL
|
||||
record.setFollowContent(Func.isBlank(followContent) ? "已上传跟进附件" : followContent);
|
||||
record.setAttachmentsJson(hasAttachments ? request.getAttachmentsJson() : null);
|
||||
record.setFollowUser(AuthUtil.getUserId());
|
||||
record.setFollowUserName(UserCache.getUserRealName(AuthUtil.getUserId()));
|
||||
record.setFollowTime(LocalDateTime.now());
|
||||
|
||||
Reference in New Issue
Block a user