From e6e10141af7c033eeddb649c6d2d1ed93f55bf3f Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期一, 10 十月 2022 16:09:43 +0800 Subject: [PATCH] 案件商铺编码 --- ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java | 86 +++++++++++++++++++++++++++++-------------- 1 files changed, 58 insertions(+), 28 deletions(-) diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java index 62abac5..fc5aa94 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java @@ -8,6 +8,8 @@ import com.ycl.bo.AdminUserDetails; import com.ycl.bo.casePool.CasePoolIllegalBuildingDO; import com.ycl.bo.casePool.CasePoolViolationDO; +import com.ycl.common.constant.BaseCaseStatus; +import com.ycl.common.util.DateUtil; import com.ycl.dto.casePool.IllegalBuildingParam; import com.ycl.dto.casePool.ViolationParam; import com.ycl.entity.caseHandler.*; @@ -32,7 +34,9 @@ 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; /** @@ -143,24 +147,27 @@ 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); @@ -189,7 +196,7 @@ } @Override - public Boolean saveViolationCase(ViolationParam violationParam, Integer id) { + public Boolean saveViolationCase(ViolationParam violationParam, Long id) { Violations violations = new Violations(); BeanUtils.copyProperties(violationParam, violations); violations.setId(id); @@ -198,9 +205,9 @@ } @Override - public Boolean saveIllegalBuildingCase(IllegalBuildingParam illegalBuildingParam, Integer id) { + public Boolean saveIllegalBuildingCase(IllegalBuildingParam illegalBuildingParam, Long id) { IllegalBuilding illegalBuilding = new IllegalBuilding(); - BeanUtils.copyProperties(illegalBuilding, illegalBuildingParam); + BeanUtils.copyProperties(illegalBuildingParam, illegalBuilding); illegalBuilding.setBaseCaseId(id); Integer value = 1; return illegalBuildingMapper.insert(illegalBuilding) == value ? true : false; @@ -213,6 +220,9 @@ 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鏌ヨ澶勭疆娴佺▼閰嶇疆 @@ -230,7 +240,26 @@ } } //2.2鏌ヨ澶勭疆娴佺▼鐜妭閰嶇疆 - List<WorkflowConfigStep> listWcs = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(ddlcId); + Map mapWcs = new HashMap(); + mapWcs.put("workflowConfigId", ddlcId); + mapWcs.put("baseCaseId", baseCase.getId()); + List<WorkflowConfigStep> listWcs = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(mapWcs); + //澶勭悊鐢ㄧ幆鑺傛椂闂� + for (WorkflowConfigStep step : listWcs) { + List<DisposeRecord> records = step.getDisposeRecords(); + if (records == null) { + continue; + } + for (DisposeRecord record : records) { + if (record != null&&record.getCreateTime()!=null) { + record.setLinkTime( + DateUtil.getDistanceDateTime( + DateUtil.fromLocalDateTime(baseCase.getAlarmTime()), + DateUtil.fromLocalDateTime(record.getCreateTime()))); + } + } + step.setDisposeRecords(records); + } //2.3璁剧疆璋冨害娴佺▼ handlePassVo.setWorkflowConfigSteps(listWcs); bcd.setHandlePassVo(handlePassVo); @@ -244,13 +273,15 @@ //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); @@ -289,13 +320,12 @@ } @Override - public void endCase(Integer caseId, String result) { + public void endCase(Long caseId, String result) { AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - Integer endCaseState = 6; - Integer state = 2; + Integer state = 1; String endCaseName = "缁撴"; BaseCase baseCase = new BaseCase(); - baseCase.setState(endCaseState); + baseCase.setState(BaseCaseStatus.CLOSING_REGISTER); baseCase.setId(caseId); baseCaseMapper.updateById(baseCase); DisposeRecord disposeRecord = new DisposeRecord(); @@ -303,7 +333,7 @@ disposeRecord.setWorkflowConfigStepId(workflowConfigStepMapper .selectOne(new LambdaQueryWrapper<WorkflowConfigStep>().eq(WorkflowConfigStep::getName, endCaseName)) .getWorkflowConfigId()); - disposeRecord.setCreateUser(user.getUserId().intValue()); + disposeRecord.setCreateUser(user.getUserId().longValue()); disposeRecord.setResult(result); disposeRecord.setState(state); disposeRecord.setCreateTime(LocalDateTime.now()); -- Gitblit v1.8.0