feat(): 修改核实状态赋值逻辑,更换导出时间字段
parent
5f3d891cef
commit
ae65b5c41e
|
|
@ -119,12 +119,35 @@ public class SafetyEnvironmentalInspectionUpdateExe {
|
||||||
|
|
||||||
// 删除检查核实人数据 及对应待办信息
|
// 删除检查核实人数据 及对应待办信息
|
||||||
List<SafetyEnvironmentalInspectionUserDO> deleteUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(),2);
|
List<SafetyEnvironmentalInspectionUserDO> deleteUserList = safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(),2);
|
||||||
|
// 保存旧核实记录的状态,用于重建后恢复
|
||||||
|
Map<Long, Integer> oldVerifyStatusMap = deleteUserList.stream()
|
||||||
|
.filter(u -> u.getUserId() != null)
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
SafetyEnvironmentalInspectionUserDO::getUserId,
|
||||||
|
u -> u.getStatus() != null ? u.getStatus() : 0,
|
||||||
|
(existing, replacement) -> existing));
|
||||||
for (SafetyEnvironmentalInspectionUserDO deleteUser : deleteUserList){
|
for (SafetyEnvironmentalInspectionUserDO deleteUser : deleteUserList){
|
||||||
messageNoticeExe.sendMessageDeleteEvent(deleteUser.getId());
|
messageNoticeExe.sendMessageDeleteEvent(deleteUser.getId());
|
||||||
}
|
}
|
||||||
safetyEnvironmentalInspectionUserRepository.deleteByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(), 2);
|
safetyEnvironmentalInspectionUserRepository.deleteByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(), 2);
|
||||||
// 新增检查核实人数据
|
// 新增检查核实人数据
|
||||||
safetyEnvironmentalInspectionUserRepository.batchInsert(BeanUtil.copyToList(insUserList, SafetyEnvironmentalInspectionUserDO.class));
|
safetyEnvironmentalInspectionUserRepository.batchInsert(BeanUtil.copyToList(insUserList, SafetyEnvironmentalInspectionUserDO.class));
|
||||||
|
// 恢复之前已核实的用户状态
|
||||||
|
if (!oldVerifyStatusMap.isEmpty()) {
|
||||||
|
List<SafetyEnvironmentalInspectionUserDO> newUserList =
|
||||||
|
safetyEnvironmentalInspectionUserRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId(), 2);
|
||||||
|
for (SafetyEnvironmentalInspectionUserDO newUser : newUserList) {
|
||||||
|
Integer oldStatus = oldVerifyStatusMap.get(newUser.getUserId());
|
||||||
|
if (oldStatus != null && oldStatus > 0) {
|
||||||
|
SafetyEnvironmentalInspectionUserDO updateDO = new SafetyEnvironmentalInspectionUserDO();
|
||||||
|
updateDO.setInspectionId(safetyEnvironmentalInspectionE.getInspectionId());
|
||||||
|
updateDO.setUserId(newUser.getUserId());
|
||||||
|
updateDO.setType(2);
|
||||||
|
updateDO.setStatus(oldStatus);
|
||||||
|
safetyEnvironmentalInspectionUserRepository.editUserInfo(updateDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 删除检查内容
|
// 删除检查内容
|
||||||
List<SafetyEnvironmentalInspectionContentDO> deleteContentList = safetyEnvironmentalInspectionContentRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId());
|
List<SafetyEnvironmentalInspectionContentDO> deleteContentList = safetyEnvironmentalInspectionContentRepository.listAllByInspectionId(safetyEnvironmentalInspectionE.getInspectionId());
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -192,6 +193,20 @@ public class SafetyEnvironmentalInspectionQueryExe {
|
||||||
inspection.setStatusName(InspectionStatusEnum.getNameByStatus(inspection.getStatus()));
|
inspection.setStatusName(InspectionStatusEnum.getNameByStatus(inspection.getStatus()));
|
||||||
});
|
});
|
||||||
List<SafetyEnvironmentalInspectionExportEntity> safetyEnvironmentalInspectionExportEntities = safetyEnvironmentalInspectionCoConvertor.converDOsToExcelEntitys(safetyEnvironmentalInspectionDOs);
|
List<SafetyEnvironmentalInspectionExportEntity> safetyEnvironmentalInspectionExportEntities = safetyEnvironmentalInspectionCoConvertor.converDOsToExcelEntitys(safetyEnvironmentalInspectionDOs);
|
||||||
|
// 填充检查时间(timeStart - timeEnd)
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
for (int i = 0; i < safetyEnvironmentalInspectionExportEntities.size(); i++) {
|
||||||
|
SafetyEnvironmentalInspectionDO inspectionDO = safetyEnvironmentalInspectionDOs.get(i);
|
||||||
|
String timeStart = inspectionDO.getTimeStart() != null ? inspectionDO.getTimeStart().format(dtf) : "";
|
||||||
|
String timeEnd = inspectionDO.getTimeEnd() != null ? inspectionDO.getTimeEnd().format(dtf) : "";
|
||||||
|
if (!timeStart.isEmpty() && !timeEnd.isEmpty()) {
|
||||||
|
safetyEnvironmentalInspectionExportEntities.get(i).setCheckTime(timeStart + "-" + timeEnd);
|
||||||
|
} else if (!timeStart.isEmpty()) {
|
||||||
|
safetyEnvironmentalInspectionExportEntities.get(i).setCheckTime(timeStart);
|
||||||
|
} else if (!timeEnd.isEmpty()) {
|
||||||
|
safetyEnvironmentalInspectionExportEntities.get(i).setCheckTime(timeEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ExcelUtils.exportExcel(httpServletResponse, SafetyEnvironmentalInspectionExportEntity.class, "安全环保检查信息", safetyEnvironmentalInspectionExportEntities);
|
ExcelUtils.exportExcel(httpServletResponse, SafetyEnvironmentalInspectionExportEntity.class, "安全环保检查信息", safetyEnvironmentalInspectionExportEntities);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue