From 3baf2d910b4b94c3570d04d344c3f136bb112dfb Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 2 Jul 2021 11:16:29 +0800 Subject: [PATCH] agencydetail-multic --- .../result/AgencyDetailMulticResultDTO.java | 3 +++ .../screen/impl/AgencyServiceImpl.java | 20 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java index bcd8c3adf5..b964e69c08 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -96,4 +97,6 @@ public class AgencyDetailMulticResultDTO implements Serializable { */ private List subCustomerIds; + @JsonIgnore + private String agencyCustomerId; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 5f2272ea26..eba4006bd2 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -391,6 +391,8 @@ public class AgencyServiceImpl implements AgencyService { return agencysResultDTO; } agencysResultDTO = ConvertUtils.sourceToTarget(customerAgencyDTO, AgencyDetailMulticResultDTO.class); + agencysResultDTO.setAgencyCustomerId(customerAgencyDTO.getCustomerId()); + //2、当前登录用户所属客户,的跟级组织 ScreenCustomerAgencyDTO rootAgency=screenCustomerAgencyDao.selectCustomerRootAgency(formDTO.getCustomerId()); agencysResultDTO.setRootlevel(rootAgency.getLevel()); @@ -421,21 +423,27 @@ public class AgencyServiceImpl implements AgencyService { } if(agencysResultDTO.getHaveSubCustomer()){ - if (StringUtils.isBlank(customerAgencyDTO.getPids())||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid())) { + if (formDTO.getCustomerId().equals(agencysResultDTO.getAgencyCustomerId()) + && (StringUtils.isBlank(customerAgencyDTO.getPids()) + ||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid()))) { log.info(String.format("1)当前组织agencyId=%s,为根基组织,不需要查询parentList",formDTO.getAgencyId())); agencysResultDTO.setParentList(parentList); }else{ // 5、多客户时根据area_code查询上级,自下向上,查询到当前客户的跟组织即可stop - log.info("多客户版本parentList、level要重新赋值"); + log.info("多客户版本parentList、level要重新赋值;agencysResultDTO.getParentAreaCode()="+agencysResultDTO.getParentAreaCode()); ScreenCustomerAgencyDTO parentAgency=screenCustomerAgencyDao.selectByAreaCode(agencysResultDTO.getParentAreaCode()); - agencysResultDTO.setLevel(getAgencyLevelMultiC(parentAgency)); - List temp = getParentListMultic(parentList,parentAgency,formDTO.getCustomerId(),agencysResultDTO.getRootAgencyId()); - agencysResultDTO.setParentList(temp); + if (null != parentAgency) { + agencysResultDTO.setLevel(getAgencyLevelMultiC(parentAgency)); + List temp = getParentListMultic(parentList, parentAgency, formDTO.getCustomerId(), agencysResultDTO.getRootAgencyId()); + agencysResultDTO.setParentList(temp); + } } }else{ //单客户 //6:查询当前组织的所有上级组织,按自上而下层级顺序 - if (StringUtils.isBlank(customerAgencyDTO.getPids())||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid())) { + if (formDTO.getCustomerId().equals(agencysResultDTO.getAgencyCustomerId()) + && (StringUtils.isBlank(customerAgencyDTO.getPids()) + ||NumConstant.ZERO_STR.equals(customerAgencyDTO.getPid()))) { log.info(String.format("2)当前组织agencyId=%s,为根基组织,不需要查询parentList",formDTO.getAgencyId())); agencysResultDTO.setParentList(parentList); }else{