| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.Instant; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | ImageResourcesMapper imageResourcesMapper; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String uploadEvent(Integer caseId) { |
| | | BaseCase baseCase = this.getById(caseId); |
| | |
| | | @Override |
| | | public Page listViolationsPage(Page page, Integer state, Integer resource) { |
| | | Integer type = 01; |
| | | Integer hours = 60; |
| | | Page<CasePoolViolationDO> violationsPage = baseCaseMapper.listViolationsPage(page, state, type, resource); |
| | | List<CasePoolViolationVO> violationVOList = violationsPage.getRecords().stream().map(item -> { |
| | | CasePoolViolationVO casePoolViolationVO = new CasePoolViolationVO(); |
| | | BeanUtils.copyProperties(item, casePoolViolationVO); |
| | | if (item.getCloseTime() == null) { |
| | | long nowTime = System.currentTimeMillis(); |
| | | long alarmTime = item.getAlarmTime().toEpochSecond(ZoneOffset.ofHours(8)); |
| | | LocalDateTime continueTimes = Instant.ofEpochMilli(nowTime - alarmTime).atZone(ZoneOffset.ofHours(8)).toLocalDateTime(); |
| | | String continueTime = continueTimes.getHour() + "时" + continueTimes.getSecond() + "分钟"; |
| | | Duration duration = Duration.between(item.getAlarmTime(), LocalDateTime.now()); |
| | | long minutes = duration.toMinutes() - (duration.toHours() * hours); |
| | | String continueTime = duration.toHours() + "时" + minutes + "分钟"; |
| | | casePoolViolationVO.setContinueTime(continueTime); |
| | | } else { |
| | | long closeTime = item.getCloseTime().toEpochSecond(ZoneOffset.ofHours(8)); |
| | | long alarmTime = item.getAlarmTime().toEpochSecond(ZoneOffset.ofHours(8)); |
| | | LocalDateTime continueTimes = Instant.ofEpochMilli(closeTime - alarmTime).atZone(ZoneOffset.ofHours(8)).toLocalDateTime(); |
| | | String continueTime = continueTimes.getHour() + "时" + continueTimes.getSecond() + "分钟"; |
| | | Duration duration = Duration.between(item.getAlarmTime(), item.getCloseTime()); |
| | | long minutes = duration.toMinutes() - (duration.toHours() * hours); |
| | | String continueTime = duration.toHours() + "时" + minutes + "分钟"; |
| | | casePoolViolationVO.setContinueTime(continueTime); |
| | | } |
| | | casePoolViolationVO.setCategory(dataDictionaryMapper.selectById(item.getCategoryId()).getName()); |