mg
2022-10-13 09d16543f899f54b8d96671a355a53a5740b1937
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;
    }
@@ -214,10 +235,24 @@
    public BaseCaseDetail baseCaseDetail(String code) {
        BaseCaseDetail bcd = new BaseCaseDetail();
        //1.查询案件基本信息
        QueryWrapper<BaseCase> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(BaseCase::getCode, code);
        BaseCase baseCase = baseCaseMapper.selectOne(wrapper);
        Map map = new HashMap();
        map.put("code", code);
        BaseCase baseCase = baseCaseMapper.selectCondMap(map);
        if (baseCase == null) {
            return null;
        }
        //查询案件违规信息
        if (baseCase.getCategory() == 1) {
            Map mapV = new HashMap();
            mapV.put("id", baseCase.getId());
            Violations violations = violationsMapper.selectCondMap(mapV);
            baseCase.setViolations(violations);
        } else {
            IllegalBuilding illegalBuilding = illegalBuildingMapper.selectById(baseCase.getId());
            baseCase.setIllegalBuilding(illegalBuilding);
        }
        bcd.setBaseCase(baseCase);
        //案件相关信息
        //2.查询办理经过信息
        //2.1查询处置流程配置
        HandlePassVo handlePassVo = new HandlePassVo();
@@ -234,22 +269,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();
            System.out.println(baseCase.getAlarmTime());
            System.out.println(record.getCreateTime());
            System.out.println(DateUtil.fromLocalDateTime(baseCase.getAlarmTime()));
            System.out.println(DateUtil.fromLocalDateTime(record.getCreateTime()));
            System.out.println( DateUtil.getDistanceDateTime(
                    DateUtil.fromLocalDateTime(baseCase.getAlarmTime()),
                    DateUtil.fromLocalDateTime(record.getCreateTime())));
            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);
@@ -264,13 +302,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);
@@ -309,13 +349,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();
@@ -323,7 +362,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());