|
|
@@ -7,11 +7,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zksy.base.warning.domain.*;
|
|
|
import com.zksy.base.warning.mapper.*;
|
|
|
import com.zksy.base.warning.service.EarlyWarningService;
|
|
|
-import com.zksy.common.config.ZksyConfig;
|
|
|
import com.zksy.common.core.domain.entity.SysDictData;
|
|
|
import com.zksy.common.utils.DictUtils;
|
|
|
-import com.zksy.common.utils.file.FileUploadUtils;
|
|
|
-import com.zksy.common.utils.file.FileUtils;
|
|
|
import com.zksy.service.MinioFileStorageService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -53,8 +50,8 @@ public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper, Ear
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<Map<String, Object>> getTodoList(Page<?> page, String userId, String todoType, String warningName) {
|
|
|
- return earlyWarningMapper.selectTodoList(page, userId, todoType, warningName);
|
|
|
+ public IPage<Map<String, Object>> getTodoList(Page<?> page, String userName, String todoType, String warningName) {
|
|
|
+ return earlyWarningMapper.selectTodoList(page, userName, todoType, warningName);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -95,7 +92,7 @@ public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper, Ear
|
|
|
}
|
|
|
|
|
|
private Map<String, Object> generateElectronicArchive(Map<String, Object> warningInfo) {
|
|
|
- String warningId = (String) warningInfo.get("warningId");
|
|
|
+ String warningId = (String) warningInfo.get("warning_id");
|
|
|
|
|
|
// 先查询是否已存在归档记录
|
|
|
LambdaQueryWrapper<WarningArchive> wrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -116,20 +113,20 @@ public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper, Ear
|
|
|
// 如果不存在,创建新归档
|
|
|
WarningArchive archive = new WarningArchive();
|
|
|
archive.setWarningId(warningId);
|
|
|
- archive.setArchiveNo("EA_" + warningInfo.get("warningNo"));
|
|
|
- archive.setWarningNo((String) warningInfo.get("warningNo"));
|
|
|
- archive.setWarningName((String) warningInfo.get("warningName"));
|
|
|
- archive.setWarningType((String) warningInfo.get("warningType"));
|
|
|
- archive.setWarningLevel((String) warningInfo.get("warningLevel"));
|
|
|
+ archive.setArchiveNo("EA_" + warningInfo.get("warning_no"));
|
|
|
+ archive.setWarningNo((String) warningInfo.get("warning_no"));
|
|
|
+ archive.setWarningName((String) warningInfo.get("warning_name"));
|
|
|
+ archive.setWarningType((String) warningInfo.get("warning_type"));
|
|
|
+ archive.setWarningLevel((String) warningInfo.get("warning_level"));
|
|
|
archive.setLocation((String) warningInfo.get("location"));
|
|
|
archive.setLongitude(warningInfo.get("longitude") != null ? ((Number) warningInfo.get("longitude")).doubleValue() : null);
|
|
|
archive.setLatitude(warningInfo.get("latitude") != null ? ((Number) warningInfo.get("latitude")).doubleValue() : null);
|
|
|
- archive.setOwnershipUnit((String) warningInfo.get("ownershipUnit"));
|
|
|
+ archive.setOwnershipUnit((String) warningInfo.get("ownership_unit"));
|
|
|
archive.setPublisher((String) warningInfo.get("publisher"));
|
|
|
- archive.setPublishTime(warningInfo.get("publishTime") instanceof LocalDateTime ? (LocalDateTime) warningInfo.get("publishTime") : null);
|
|
|
+ archive.setPublishTime(warningInfo.get("publish_time") instanceof LocalDateTime ? (LocalDateTime) warningInfo.get("publishTime") : null);
|
|
|
archive.setHandler((String) warningInfo.get("handler"));
|
|
|
- archive.setWarningContent((String) warningInfo.get("warningContent"));
|
|
|
- archive.setArchiveContent((String) warningInfo.get("warningContent"));
|
|
|
+ archive.setWarningContent((String) warningInfo.get("warning_content"));
|
|
|
+ archive.setArchiveContent((String) warningInfo.get("warning_content"));
|
|
|
archive.setArchiveStatus("已归档");
|
|
|
archive.setCreateTime(LocalDateTime.now());
|
|
|
|
|
|
@@ -179,7 +176,8 @@ public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper, Ear
|
|
|
attachment.setWarningId(warningId);
|
|
|
attachment.setAttachmentName(fileName);
|
|
|
attachment.setAttachmentUrl(path);
|
|
|
- attachment.setAttachmentType(file.getContentType());
|
|
|
+ // 部分 MIME(如 vnd.openxmlformats-officedocument.*)长度超过 64,写入前按 DB 列宽截断兜底
|
|
|
+ attachment.setAttachmentType(truncateAttachmentType(file.getContentType()));
|
|
|
attachment.setAttachmentSize(file.getSize());
|
|
|
attachment.setCreateTime(LocalDateTime.now());
|
|
|
warningAttachmentMapper.insert(attachment);
|
|
|
@@ -321,12 +319,16 @@ public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper, Ear
|
|
|
EarlyWarning warning = getById(warningId);
|
|
|
if (warning == null) return false;
|
|
|
|
|
|
- warning.setStatus("PENDING");
|
|
|
+ warning.setStatus("DRAFT");
|
|
|
warning.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
|
boolean result = updateById(warning);
|
|
|
if (result) {
|
|
|
addDisposalRecord(warningId, "RETURN", null, null, warning.getHandler(), disposalContent);
|
|
|
+ // 退回后删除待办记录,因为直接回到草稿状态
|
|
|
+ LambdaQueryWrapper<WarningTodo> todoWrapper = new LambdaQueryWrapper<>();
|
|
|
+ todoWrapper.eq(WarningTodo::getWarningId, warningId);
|
|
|
+ warningTodoMapper.delete(todoWrapper);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -762,12 +764,27 @@ public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper, Ear
|
|
|
result.put("handlerCount", handlers.size());
|
|
|
|
|
|
if (!disposals.isEmpty()) {
|
|
|
- result.put("firstDisposalTime", disposals.get(0).getCreateTime() != null ?
|
|
|
+ result.put("firstDisposalTime", disposals.get(0).getCreateTime() != null ?
|
|
|
disposals.get(0).getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null);
|
|
|
- result.put("lastDisposalTime", disposals.get(disposals.size() - 1).getCreateTime() != null ?
|
|
|
+ result.put("lastDisposalTime", disposals.get(disposals.size() - 1).getCreateTime() != null ?
|
|
|
disposals.get(disposals.size() - 1).getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 截断附件类型到 DB 列宽(varchar(64))以内,避免 Data too long 异常
|
|
|
+ */
|
|
|
+ private static final int ATTACHMENT_TYPE_MAX_LEN = 64;
|
|
|
+
|
|
|
+ private String truncateAttachmentType(String contentType) {
|
|
|
+ if (contentType == null || contentType.isEmpty()) {
|
|
|
+ return contentType;
|
|
|
+ }
|
|
|
+ if (contentType.length() <= ATTACHMENT_TYPE_MAX_LEN) {
|
|
|
+ return contentType;
|
|
|
+ }
|
|
|
+ return contentType.substring(0, ATTACHMENT_TYPE_MAX_LEN);
|
|
|
+ }
|
|
|
}
|