From 4c50d4acfdff4f454ea0f68f9a7ae61c5d599f3f Mon Sep 17 00:00:00 2001 From: wl <173@qq.com> Date: 星期四, 13 十月 2022 10:07:53 +0800 Subject: [PATCH] 添加案件时候添加调度流程 --- ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java | 79 ++++++++++++++++++++++++++++++--------- 1 files changed, 61 insertions(+), 18 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 e47ebfe..da12065 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,7 @@ 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; @@ -33,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; /** @@ -163,6 +166,7 @@ } casePoolViolationVO.setCategory(dataDictionaryMapper.selectById(item.getCategoryId()).getName()); casePoolViolationVO.setType(dataDictionaryMapper.selectById(item.getTypeId()).getName()); + casePoolViolationVO.setStreet(dataDictionaryMapper.selectById(item.getStreetId()).getName()); return casePoolViolationVO; }).collect(Collectors.toList()); Page<CasePoolViolationVO> casePoolViolationVOPage = new Page<>(); @@ -183,6 +187,7 @@ CasePoolIllegalBuildingVO casePoolIllegalBuildingVO = new CasePoolIllegalBuildingVO(); BeanUtils.copyProperties(item, casePoolIllegalBuildingVO); casePoolIllegalBuildingVO.setCategory(dataDictionaryMapper.selectById(item.getCategoryId()).getName()); + casePoolIllegalBuildingVO.setCommunity(dataDictionaryMapper.selectById(item.getCommunityId()).getName()); return casePoolIllegalBuildingVO; } ).collect(Collectors.toList()); @@ -193,20 +198,36 @@ } @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); Integer value = 1; + violations.setId(id); + setDisposeRecord(id); return violationsMapper.insert(violations) == value ? true : false; } + private void setDisposeRecord(Long id) { + String stepName = "璋冨害"; + Integer state = 0; + DisposeRecord disposeRecord = new DisposeRecord(); + disposeRecord.setBaseCaseId(id); + disposeRecord.setState(state); + disposeRecord.setCreateTime(LocalDateTime.now()); + AdminUserDetails userDetails = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + disposeRecord.setCreateUser(userDetails.getUserId()); + disposeRecord.setStartTime(LocalDateTime.now()); + disposeRecord.setStepName(stepName); + disposeRecordMapper.insert(disposeRecord); + } + @Override - public Boolean saveIllegalBuildingCase(IllegalBuildingParam illegalBuildingParam, Integer id) { + public Boolean saveIllegalBuildingCase(IllegalBuildingParam illegalBuildingParam, Long id) { IllegalBuilding illegalBuilding = new IllegalBuilding(); - BeanUtils.copyProperties(illegalBuilding, illegalBuildingParam); - illegalBuilding.setBaseCaseId(id); + BeanUtils.copyProperties(illegalBuildingParam, illegalBuilding); + setDisposeRecord(id); Integer value = 1; + illegalBuilding.setBaseCaseId(id); return illegalBuildingMapper.insert(illegalBuilding) == value ? true : false; } @@ -217,7 +238,19 @@ QueryWrapper<BaseCase> wrapper = new QueryWrapper<>(); wrapper.lambda().eq(BaseCase::getCode, code); BaseCase baseCase = baseCaseMapper.selectOne(wrapper); + if (baseCase == null) { + return null; + } + //鏌ヨ妗堜欢杩濊淇℃伅 + if (baseCase.getCategory() == 1) { + Violations violations = violationsMapper.selectById(baseCase.getId()); + baseCase.setViolations(violations); + } else { + IllegalBuilding illegalBuilding = illegalBuildingMapper.selectById(baseCase.getId()); + baseCase.setIllegalBuilding(illegalBuilding); + } bcd.setBaseCase(baseCase); + //妗堜欢鐩稿叧淇℃伅 //2.鏌ヨ鍔炵悊缁忚繃淇℃伅 //2.1鏌ヨ澶勭疆娴佺▼閰嶇疆 HandlePassVo handlePassVo = new HandlePassVo(); @@ -234,15 +267,25 @@ } } //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) { - DisposeRecord record = step.getDisposeRecord(); - record.setLinkTime( - DateUtil.getDistanceDateTime( - DateUtil.fromLocalDateTime(baseCase.getAlarmTime()), - DateUtil.fromLocalDateTime(record.getCreateTime()))); - step.setDisposeRecord(record); + 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); @@ -257,7 +300,8 @@ //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); @@ -303,13 +347,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(); @@ -317,7 +360,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