liyanqi
2022-10-27 509b52219b44cbbf16c3b364da566ed00f8aabbe
ycl-platform/src/main/java/com/ycl/controller/caseHandler/DispatchHandleController.java
@@ -69,68 +69,7 @@
    public CommonResult searchDisposeList(@RequestParam Long caseId,
                                          @RequestParam Integer type,
                                          @RequestBody UploadDisposingResultParam uploadDisposingResultParam) {
        AdminUserDetails user = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        //当事人
        PartyInfo partyInfo = new PartyInfo();
        BeanUtils.copyProperties(uploadDisposingResultParam, partyInfo);
        partyInfo.setCreateUser(user.getUserId().intValue());
        partyInfo.setCreateTime(LocalDateTime.now());
        iPartyInfoService.save(partyInfo);
        //调查取证
        Investigation investigation = new Investigation();
        BeanUtils.copyProperties(uploadDisposingResultParam, investigation);
        investigation.setBaseCaseId(caseId);
        investigation.setCreateTime(LocalDateTime.now());
        investigation.setCreateUser(user.getUserId());
        investigation.setPartyId(partyInfo.getId());
        iInvestigationService.save(investigation);
        //到达
        ArrivalSituation arrivalSituation = new ArrivalSituation();
        BeanUtils.copyProperties(uploadDisposingResultParam, arrivalSituation);
        arrivalSituation.setBaseCaseId(caseId);
        arrivalSituation.setCreateTime(LocalDateTime.now());
        arrivalSituation.setCreateUser(user.getUserId());
        iArrivalSituationService.save(arrivalSituation);
        //文书
        Integer illegalBuildingType = 2;
        Integer violation = 1;
        String handType = "02";
        ImageResources imageResources = new ImageResources();
        imageResources.setType(handType);
        imageResources.setBelongToId(caseId);
        imageResources.setCreateTime(LocalDateTime.now());
        imageResources.setCreateUser(user.getUserId());
        if (type == violation) {
            imageResources.setUrl(StringUtils.joinWith(",", uploadDisposingResultParam.getPic(), uploadDisposingResultParam.getSituationPic()));
            iImageResourcesService.save(imageResources);
        }
        if (type==illegalBuildingType) {
            Writ writ = new Writ();
            BeanUtils.copyProperties(uploadDisposingResultParam, writ);
            writ.setBaseCaseId(caseId);
            writ.setIllegalBuildingId(caseId);
            writ.setCreateTime(LocalDateTime.now());
            writ.setCreateUser(user.getUserId());
            iWritService.save(writ);
            imageResources.setUrl(StringUtils
                    .joinWith(",", uploadDisposingResultParam.getPic()
                            , uploadDisposingResultParam.getSituationPic()
                            , uploadDisposingResultParam.getOriginalPic()
                            , uploadDisposingResultParam.getOtherPic()
                            , uploadDisposingResultParam.getRectifiedPic()
                            , uploadDisposingResultParam.getWritPic()));
            iImageResourcesService.save(imageResources);
        }
        baseCaseService.update(new LambdaUpdateWrapper<BaseCase>().eq(BaseCase::getId, caseId).set(BaseCase::getState, BaseCaseStatus.DISPOSE));
        String stepName = StepName.CHECK.getName();
        DisposeRecord disposeRecord = new DisposeRecord();
        disposeRecord.setBaseCaseId(caseId);
        disposeRecord.setState(0);
        disposeRecord.setCreateTime(LocalDateTime.now());
        disposeRecord.setCreateUser(user.getUserId());
        disposeRecord.setStepName(stepName);
        disposeRecord.setStartTime(LocalDateTime.now());
        iDisposeRecordService.addRecord(disposeRecord);
        iDisposeRecordService.saveUpload(caseId,type,uploadDisposingResultParam);
        return CommonResult.success("add success");
    }
}