| | |
| | | package com.ycl.service.caseHandler.impl; |
| | | |
| | | import com.alibaba.druid.util.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | public Page listViolationsPage(Page page, Integer state, Integer resource) { |
| | | Integer type = 01; |
| | | Integer hours = 60; |
| | | Integer day = 24; |
| | | Page<CasePoolViolationDO> violationsPage = baseCaseMapper.listViolationsPage(page, state, type, resource); |
| | | List<CasePoolViolationVO> violationVOList = violationsPage |
| | | .getRecords() |
| | |
| | | BeanUtils.copyProperties(item, casePoolViolationVO); |
| | | if (item.getCloseTime() == null) { |
| | | Duration duration = Duration.between(item.getAlarmTime(), LocalDateTime.now()); |
| | | long continueHours = duration.toHours() - (duration.toDays() * day); |
| | | long minutes = duration.toMinutes() - (duration.toHours() * hours); |
| | | String continueTime = duration.toHours() + "时" + minutes + "分钟"; |
| | | String continueTime = duration.toDays() + "天" + continueHours + "时" + minutes + "分钟"; |
| | | casePoolViolationVO.setContinueTime(continueTime); |
| | | } else { |
| | | Duration duration = Duration.between(item.getAlarmTime(), item.getCloseTime()); |
| | | long continueHours = duration.toHours() - (duration.toDays() * day); |
| | | long minutes = duration.toMinutes() - (duration.toHours() * hours); |
| | | String continueTime = duration.toHours() + "时" + minutes + "分钟"; |
| | | String continueTime = duration.toDays() + "天" + continueHours + "时" + minutes + "分钟"; |
| | | casePoolViolationVO.setContinueTime(continueTime); |
| | | } |
| | | casePoolViolationVO.setCategory(dataDictionaryMapper.selectById(item.getCategoryId()).getName()); |
| | |
| | | BeanUtils.copyProperties(violationParam, violations); |
| | | Integer value = 1; |
| | | violations.setId(id); |
| | | setDisposeRecord(id); |
| | | setDisposeRecord(id, violationParam.getLimitTime()); |
| | | return violationsMapper.insert(violations) == value ? true : false; |
| | | } |
| | | |
| | | private void setDisposeRecord(Long id) { |
| | | private void setDisposeRecord(Long id, String limitTime) { |
| | | String stepName = StepName.DISPATCH.getName(); |
| | | QueryWrapper<WorkflowConfigStep> stepqurey = new QueryWrapper<>(); |
| | | stepqurey.eq("name", stepName); |
| | | WorkflowConfigStep workflowConfigStep = workflowConfigStepMapper.selectOne(stepqurey); |
| | | QueryWrapper<WorkflowConfigStep> stepQuery = new QueryWrapper<>(); |
| | | stepQuery.eq("name", stepName); |
| | | WorkflowConfigStep workflowConfigStep = workflowConfigStepMapper.selectOne(stepQuery); |
| | | |
| | | Integer state = 0; |
| | | DisposeRecord disposeRecord = new DisposeRecord(); |
| | |
| | | disposeRecord.setCreateUser(userDetails.getUserId()); |
| | | disposeRecord.setStartTime(LocalDateTime.now()); |
| | | disposeRecord.setStepName(stepName); |
| | | if(!StringUtils.isEmpty(limitTime)) { |
| | | disposeRecord.setLimitTime(LocalDateTime.parse(limitTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | } |
| | | disposeRecordMapper.insert(disposeRecord); |
| | | } |
| | | |
| | |
| | | public Boolean saveIllegalBuildingCase(IllegalBuildingParam illegalBuildingParam, Long id) { |
| | | IllegalBuilding illegalBuilding = new IllegalBuilding(); |
| | | BeanUtils.copyProperties(illegalBuildingParam, illegalBuilding); |
| | | setDisposeRecord(id); |
| | | setDisposeRecord(id, illegalBuildingParam.getLimitTime()); |
| | | Integer value = 1; |
| | | illegalBuilding.setBaseCaseId(id); |
| | | return illegalBuildingMapper.insert(illegalBuilding) == value ? true : false; |
| | |
| | | } |
| | | //获取调度信息 |
| | | Map mapD = new HashMap(); |
| | | mapD.put("baseCaseId",baseCase.getId()); |
| | | mapD.put("baseCaseId", baseCase.getId()); |
| | | DispatchInfo dispatchInfo = dispatchInfoMapper.selectCondMap(mapD); |
| | | baseCase.setDispatchInfo(dispatchInfo); |
| | | bcd.setBaseCase(baseCase); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void endCase(Long caseId, String result,String opinion) { |
| | | public void endCase(Long caseId, String result, String opinion) { |
| | | //获取当前登陆用户信息 |
| | | AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
| | | String endCaseName = StepName.CLOSING_REGISTER.getName(); |
| | |
| | | throw new ApiException("未查询到该流程环节"); |
| | | } |
| | | UpdateWrapper<DisposeRecord> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("base_case_id", baseCase.getId()).eq("workflow_config_step_id",workflowConfigStep.getId()); |
| | | updateWrapper.eq("base_case_id", baseCase.getId()).eq("workflow_config_step_id", workflowConfigStep.getId()); |
| | | |
| | | //修改结案记录 |
| | | DisposeRecord disposeRecord = new DisposeRecord(); |
| | | disposeRecord.setHandlerId(user.getUserId().longValue()); |
| | | disposeRecord.setHandlerId(user.getUserId()); |
| | | //结案已结束 |
| | | disposeRecord.setState(1); |
| | | disposeRecord.setEndTime(LocalDateTime.now()); |
| | | disposeRecord.setHandlerId(user.getUserId()); |
| | | disposeRecordMapper.update(disposeRecord, updateWrapper); |
| | | } |
| | | } |