forked from gzzfw/backEnd/gz-dyh

zhouxiantao
2024-09-27 b0a34952a61975657bd3a2386fe38047c4e03723
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
@@ -2,6 +2,8 @@
import cn.huge.base.common.exception.ServiceException;
import cn.huge.base.common.utils.*;
import cn.huge.module.cases.domain.bo.CaseAgentBO;
import cn.huge.module.cases.domain.bo.CasePersonBO;
import cn.huge.module.cases.domain.dto.*;
import cn.huge.module.cases.domain.dto.CaseAreaDTO;
@@ -678,6 +680,9 @@
        // 临时加上一级纠纷类型
        caseInfo.setCaseTypeFirst("24_01-2");
        caseInfo.setCaseTypeFirstName("劳动社保");
        //小程序是否查看
        caseInfo.setPartyShow(1);
        this.saveOrUpdate(caseInfo);
        caseInfoUnfoldService.saveOrUpdate(caseInfoUnfold);
@@ -732,9 +737,12 @@
        int peopleNum = 0;
        // 保存申请人
        List<CasePerson> personList = registerSaveDTO.getPersonList();
        Map<String,String> personIdMap = new HashMap<>();
        if (CollectionUtils.isNotEmpty(personList)) {
            for (CasePerson casePerson : personList) {
                casePerson.setId(utilsClient.getNewTimeCaseId());
                String newTimeCaseId = utilsClient.getNewTimeCaseId();
                personIdMap.put(casePerson.getAgentCode(), newTimeCaseId);
                casePerson.setId(newTimeCaseId);
                casePerson.setCaseId(registerSaveDTO.getId());
                casePerson.setPartyUserId(loginUser.getId());
                casePerson.setCustId(registerSaveDTO.getCustId());
@@ -765,6 +773,7 @@
            if (CollectionUtils.isNotEmpty(agentList)) {
                for (CaseAgent caseAgent : agentList) {
                    caseAgent.setId(utilsClient.getNewTimeCaseId());
                    caseAgent.setPersonId(personIdMap.get(caseAgent.getAgentCode()));
                    caseAgent.setPartyUserId(loginUser.getId());
                    caseAgent.setCaseId(registerSaveDTO.getId());
                    caseAgent.setAgentTypeName(CaseBaseConstsEnum.getDes(caseAgent.getAgentType()));
@@ -800,11 +809,22 @@
        QueryWrapper<CasePerson> casePersonQueryWrapper = new QueryWrapper<>();
        casePersonQueryWrapper.eq("case_id", registerSaveDTO.getId());
        List<CasePerson> personList = personService.list(casePersonQueryWrapper);
        Map<String,String> personNameMap = new HashMap<>();
        if(ObjectUtils.isNotEmpty(personList)){
            for (CasePerson casePerson : personList) {
                personNameMap.put(casePerson.getId(),casePerson.getTrueName());
            }
        }
        registerSaveDTO.setPersonList(personList);
        QueryWrapper<CaseAgent> caseAgentQueryWrapper = new QueryWrapper<>();
        caseAgentQueryWrapper.eq("case_id", registerSaveDTO.getId());
        List<CaseAgent> agentList = agentService.list(caseAgentQueryWrapper);
        if(ObjectUtils.isNotEmpty(agentList)){
            for (CaseAgent caseAgent : agentList) {
                caseAgent.setAgentPersonName(personNameMap.get(caseAgent.getPersonId()));
            }
        }
        registerSaveDTO.setAgentList(agentList);
        return registerSaveDTO;
@@ -841,6 +861,7 @@
        }
        List<String> ids = casePersonList.stream().map(CasePerson::getCaseId).collect(Collectors.toList());
        terms.put("ids", ids);
        terms.put("partyShow",1);
        long total = mapper.countTerms(terms);
        List<CaseInfo> content = mapper.pageTerms(page, terms);
        if (ObjectUtils.isNotEmpty(content)) {
@@ -1046,20 +1067,33 @@
        }
        twoSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_2.getDes());
        Integer sourceTotalNum = dellNull(oneSource.getCaseNum()) + dellNull(oneSource.getCaseNum());
        terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_3.getIndex());
        CaseStatisticsSourceDTO threeSource = mapper.statisticsSource(terms);
        if(ObjectUtils.isEmpty(threeSource)){
            threeSource = new CaseStatisticsSourceDTO();
        }
        terms.put("canal", CaseBaseConstsEnum.CASE_CANAL_4.getIndex());
        CaseStatisticsSourceDTO fourSource = mapper.statisticsSource(terms);
        if(ObjectUtils.isEmpty(fourSource)){
            fourSource = new CaseStatisticsSourceDTO();
        }
        Integer sourceTotalNum = dellNull(oneSource.getCaseNum()) + dellNull(twoSource.getCaseNum()) + dellNull(threeSource.getCaseNum()) + dellNull(fourSource.getCaseNum());
        oneSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(oneSource.getCaseNum() * 100, sourceTotalNum, 1));
        oneSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(oneSource.getResolveNum() * 100, oneSource.getCaseNum(), 1));
        twoSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(twoSource.getCaseNum() * 100, sourceTotalNum, 1));
        twoSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(twoSource.getResolveNum() * 100, twoSource.getCaseNum(), 1));
        CaseStatisticsSourceDTO threeSource = new CaseStatisticsSourceDTO();
        threeSource.setCanalName("自行排查");
        threeSource.setResolveRate("0");
        threeSource.setCaseRate("0");
        CaseStatisticsSourceDTO fourSource = new CaseStatisticsSourceDTO();
        fourSource.setCanalName("协同推送");
        fourSource.setResolveRate("0");
        fourSource.setCaseRate("0");
        threeSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes());
        threeSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(threeSource.getCaseNum() * 100, sourceTotalNum, 1));
        threeSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(threeSource.getResolveNum() * 100, threeSource.getCaseNum(), 1));
        fourSource.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes());
        fourSource.setCaseRate(BigDecimalUtil.integerDivideDelZero(fourSource.getCaseNum() * 100, sourceTotalNum, 1));
        fourSource.setResolveRate(BigDecimalUtil.integerDivideDelZero(fourSource.getResolveNum() * 100, fourSource.getCaseNum(), 1));
        caseStatisticsBaseDTO.setOneSource(oneSource);
        caseStatisticsBaseDTO.setTwoSource(twoSource);
        caseStatisticsBaseDTO.setThreeSource(threeSource);