| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.bo.AdminUserDetails; |
| | | import com.ycl.bo.casePool.CasePoolIllegalBuildingDO; |
| | | import com.ycl.bo.casePool.CasePoolViolationDO; |
| | | import com.ycl.common.util.DateUtil; |
| | | import com.ycl.dto.casePool.IllegalBuildingParam; |
| | | import com.ycl.dto.casePool.ViolationParam; |
| | | import com.ycl.entity.caseHandler.*; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | InvestigationMapper investigationMapper; |
| | | @Resource |
| | | WritMapper writMapper; |
| | | @Resource |
| | | DisposeRecordMapper disposeRecordMapper; |
| | | |
| | | @Resource |
| | | WorkflowConfigStepMapper workflowConfigStepMapper; |
| | |
| | | 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) { |
| | | Duration duration = Duration.between(item.getAlarmTime(), LocalDateTime.now()); |
| | | long minutes = duration.toMinutes() - (duration.toHours() * hours); |
| | | String continueTime = duration.toHours() + "时" + minutes + "分钟"; |
| | | casePoolViolationVO.setContinueTime(continueTime); |
| | | } else { |
| | | 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()); |
| | | casePoolViolationVO.setType(dataDictionaryMapper.selectById(item.getTypeId()).getName()); |
| | | return casePoolViolationVO; |
| | | }).collect(Collectors.toList()); |
| | | List<CasePoolViolationVO> violationVOList = violationsPage |
| | | .getRecords() |
| | | .stream() |
| | | .map(item -> { |
| | | CasePoolViolationVO casePoolViolationVO = new CasePoolViolationVO(); |
| | | BeanUtils.copyProperties(item, casePoolViolationVO); |
| | | if (item.getCloseTime() == null) { |
| | | Duration duration = Duration.between(item.getAlarmTime(), LocalDateTime.now()); |
| | | long minutes = duration.toMinutes() - (duration.toHours() * hours); |
| | | String continueTime = duration.toHours() + "时" + minutes + "分钟"; |
| | | casePoolViolationVO.setContinueTime(continueTime); |
| | | } else { |
| | | 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()); |
| | | casePoolViolationVO.setType(dataDictionaryMapper.selectById(item.getTypeId()).getName()); |
| | | return casePoolViolationVO; |
| | | }).collect(Collectors.toList()); |
| | | Page<CasePoolViolationVO> casePoolViolationVOPage = new Page<>(); |
| | | BeanUtils.copyProperties(violationsPage, casePoolViolationVOPage); |
| | | casePoolViolationVOPage.setRecords(violationVOList); |
| | |
| | | QueryWrapper<BaseCase> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(BaseCase::getCode, code); |
| | | BaseCase baseCase = baseCaseMapper.selectOne(wrapper); |
| | | if (baseCase == null) { |
| | | return null; |
| | | } |
| | | bcd.setBaseCase(baseCase); |
| | | //2.查询办理经过信息 |
| | | //2.1查询处置流程配置 |
| | |
| | | } |
| | | } |
| | | //2.2查询处置流程环节配置 |
| | | List<WorkflowConfigStep> listWcs = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(ddlcId); |
| | | Map mapWcs = new HashMap(); |
| | | mapWcs.put("workflowConfigId", ddlcId); |
| | | mapWcs.put("baseCaseId", ddlcId); |
| | | List<WorkflowConfigStep> listWcs = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(mapWcs); |
| | | //处理用环节时间 |
| | | for (WorkflowConfigStep step : listWcs) { |
| | | List<DisposeRecord> records = step.getDisposeRecords(); |
| | | if (records == null) { |
| | | continue; |
| | | } |
| | | for (DisposeRecord record : records) { |
| | | record.setLinkTime( |
| | | DateUtil.getDistanceDateTime( |
| | | DateUtil.fromLocalDateTime(baseCase.getAlarmTime()), |
| | | DateUtil.fromLocalDateTime(record.getCreateTime()))); |
| | | } |
| | | step.setDisposeRecords(records); |
| | | } |
| | | //2.3设置调度流程 |
| | | handlePassVo.setWorkflowConfigSteps(listWcs); |
| | | bcd.setHandlePassVo(handlePassVo); |
| | |
| | | //4.查询问题处理信息 |
| | | ProblemProVo problemProVo = new ProblemProVo(); |
| | | //4.2查询处置流程环节配置 |
| | | List<WorkflowConfigStep> listWcsPp = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(wtcllcId); |
| | | mapWcs.put("workflowConfigId", wtcllcId); |
| | | List<WorkflowConfigStep> listWcsPp = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(mapWcs); |
| | | //4.3设置调度流程 |
| | | problemProVo.setWorkflowConfigSteps(listWcsPp); |
| | | bcd.setProblemProVo(problemProVo); |
| | | //5.查询现场情况信息 |
| | | CurrentSitVo currentSitVo = new CurrentSitVo(); |
| | | QueryWrapper<ArrivalSituation> wrapperAs = new QueryWrapper<>(); |
| | | wrapperAs.lambda().eq(ArrivalSituation::getBaseCaseId, baseCase.getId()); |
| | | //设置到达现场情况 |
| | | ArrivalSituation as = arrivalSituationMapper.selectOne(wrapperAs); |
| | | currentSitVo.setArrivalSituation(as); |
| | |
| | | } |
| | | return caseImages; |
| | | } |
| | | |
| | | @Override |
| | | public void endCase(Integer caseId, String result) { |
| | | AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
| | | Integer endCaseState = 6; |
| | | Integer state = 2; |
| | | String endCaseName = "结案"; |
| | | BaseCase baseCase = new BaseCase(); |
| | | baseCase.setState(endCaseState); |
| | | baseCase.setId(caseId); |
| | | baseCaseMapper.updateById(baseCase); |
| | | DisposeRecord disposeRecord = new DisposeRecord(); |
| | | disposeRecord.setBaseCaseId(caseId); |
| | | disposeRecord.setWorkflowConfigStepId(workflowConfigStepMapper |
| | | .selectOne(new LambdaQueryWrapper<WorkflowConfigStep>().eq(WorkflowConfigStep::getName, endCaseName)) |
| | | .getWorkflowConfigId()); |
| | | disposeRecord.setCreateUser(user.getUserId().intValue()); |
| | | disposeRecord.setResult(result); |
| | | disposeRecord.setState(state); |
| | | disposeRecord.setCreateTime(LocalDateTime.now()); |
| | | disposeRecordMapper.insert(disposeRecord); |
| | | } |
| | | } |