forked from gzzfw/backEnd/gz-dyh

xusd
2024-09-08 f1fd3d984043951702d64b8e1a1a4412ef3a76fb
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
@@ -4,15 +4,11 @@
import cn.huge.base.common.utils.DateUtils;
import cn.huge.base.common.utils.IdUtils;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.module.cases.domain.dto.CaseInfoDTO;
import cn.huge.module.cases.domain.dto.*;
import cn.huge.module.cases.domain.dto.CaseInfoWeChatDTO;
import cn.huge.module.cases.domain.dto.CasePersonWechatDTO;
import cn.huge.module.cases.domain.dto.RegisterSaveDTO;
import cn.huge.module.cases.domain.po.CaseAgent;
import cn.huge.module.cases.domain.po.CaseInfoUnfold;
import cn.huge.module.cases.domain.po.CasePerson;
import cn.huge.module.client.api.SysClient;
import cn.huge.module.client.api.impl.CustClientImpl;
import cn.huge.module.client.api.impl.SysClientImpl;
import cn.huge.module.client.api.impl.UtilsClientImpl;
@@ -26,10 +22,8 @@
import cn.huge.module.draft.service.CasedraftInfoService;
import cn.huge.module.mediate.dto.WechatBindCaseDTO;
import cn.huge.module.sys.dto.FileIdTypeInfoBaseDTO;
import cn.huge.module.sys.dto.FileTypeInfoBaseDTO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -551,7 +545,10 @@
            caseInfo.setInputWay(CaseBaseConsts.INPUT_WAY_1);
            caseInfo.setCreateTime(nowDate);
            caseInfo.setUpdateTime(nowDate);
            caseInfo.setVisitTime(nowDate);
            caseInfo.setDeleteStatus(BaseConsts.DELETE_STATUS_0);
            caseInfo.setProcess(1);
            caseInfo.setProcessName("来访登记");
            //todo case_ref生成、case_title生成
            caseInfoUnfold.setId(utilsClient.getNewTimeId());
@@ -703,12 +700,12 @@
    }
    /**
     * 按条件分页查询
     * 按条件分页查询-小程序查询
     * @param page 分页对象
     * @param terms 条件
     * @return Page
     */
    public Page<CaseInfoWeChatDTO> pageQueryWechat(String userId,PageRequest page, Map<String, Object> terms){
    public Page<CaseInfoWeChatDTO> pageQueryWechat(String userId, PageRequest page, Map<String, Object> terms){
        List<CaseInfoWeChatDTO> list = new ArrayList<>();
        String personType = terms.get("personType")+"";
        if(ObjectUtils.isEmpty(personType)){
@@ -734,13 +731,13 @@
            for(CaseInfo caseInfo: content){
                CaseInfoWeChatDTO caseInfoWeChatDTO = new CaseInfoWeChatDTO();
                BeanUtils.copyProperties(caseInfo, caseInfoWeChatDTO);
                if(ObjectUtils.isNotEmpty(caseInfo.getProcess()) && caseInfo.getProcess().equals(1) || caseInfo.getProcess().equals(2)){
                if(ObjectUtils.isNotEmpty(caseInfo) && caseInfo.getProcess().equals(1) || caseInfo.getProcess().equals(2)){
                    caseInfoWeChatDTO.setProcessStatus(1);
                    caseInfoWeChatDTO.setProcessStatusName("待受理");
                }else if(ObjectUtils.isNotEmpty(caseInfo.getProcess()) && caseInfo.getProcess().equals(3) || caseInfo.getProcess().equals(4)){
                }else if(ObjectUtils.isNotEmpty(caseInfo) && caseInfo.getProcess().equals(3) || caseInfo.getProcess().equals(4)){
                    caseInfoWeChatDTO.setProcessStatus(2);
                    caseInfoWeChatDTO.setProcessStatusName("办理中");
                }else if(ObjectUtils.isNotEmpty(caseInfo.getProcess()) && caseInfo.getProcess().equals(5) || caseInfo.getProcess().equals(6)){
                }else if(ObjectUtils.isNotEmpty(caseInfo) && caseInfo.getProcess().equals(5) || caseInfo.getProcess().equals(6)){
                    caseInfoWeChatDTO.setProcessStatus(3);
                    caseInfoWeChatDTO.setProcessStatusName("已结案");
                }else{
@@ -770,4 +767,38 @@
        }
        return new PageImpl<CaseInfoWeChatDTO>(list, page, total);
    }
    /**
     * 按条件分页查询-综合查询
     * @param page 分页对象
     * @param terms 条件
     * @return Page
     */
    public Page<CasePageDTO> pageQueryAll(PageRequest page, Map<String, Object> terms){
        long total = mapper.countTermsAll(terms);
        List<CasePageDTO> content = mapper.pageTermsAll(page, terms);
        if(ObjectUtils.isNotEmpty(content)){
            for (CasePageDTO casePageDTO : content) {
                QueryWrapper<CasePerson> personWrapper1 = new QueryWrapper<>();
                personWrapper1.eq("case_id", casePageDTO.getId());
                List<CasePerson> casePersonList1 = personService.list(personWrapper1);
                //申请人集合
                List<CasePersonWeDTO> plaintiffList = new ArrayList<>();
                //被申请人集合
                List<CasePersonWeDTO> defendantList = new ArrayList<>();
                for (CasePerson casePerson : casePersonList1) {
                    CasePersonWeDTO casePersonWechatDTO = new CasePersonWeDTO();
                    BeanUtils.copyProperties(casePerson, casePersonWechatDTO);
                    if(CaseBaseConstsEnum.PERSON_TYPE_1.getIndex().equals(casePerson.getPerType())){
                        plaintiffList.add(casePersonWechatDTO);
                    }else if(CaseBaseConstsEnum.PERSON_TYPE_2.getIndex().equals(casePerson.getPerType())){
                        defendantList.add(casePersonWechatDTO);
                    }
                }
                casePageDTO.setDefendantList(defendantList);
                casePageDTO.setPlaintiffList(plaintiffList);
            }
        }
        return new PageImpl<CasePageDTO>(content, page, total);
    }
}