|
|
@ -11,6 +11,7 @@ import com.epmet.datareport.service.evaluationindex.screen.DistributionService; |
|
|
|
import com.epmet.evaluationindex.screen.constant.ScreenConstant; |
|
|
|
import com.epmet.evaluationindex.screen.dto.form.*; |
|
|
|
import com.epmet.evaluationindex.screen.dto.result.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -27,6 +28,7 @@ import java.util.stream.Collectors; |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @date 2020/8/18 10:19 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|
|
|
public class DistributionServiceImpl implements DistributionService { |
|
|
@ -62,6 +64,7 @@ public class DistributionServiceImpl implements DistributionService { |
|
|
|
@Override |
|
|
|
public BranchCountResultDTO branchCount(BranchCountFormDTO branchCountFormDTO) { |
|
|
|
BranchCountResultDTO branchCountResultDTO = screenCustomerGridDao.selectAgencyInfo(branchCountFormDTO.getAgencyId()); |
|
|
|
log.info("本级机关信息"+branchCountResultDTO.toString()); |
|
|
|
if (null == branchCountResultDTO){ |
|
|
|
return new BranchCountResultDTO(); |
|
|
|
} |
|
|
@ -69,7 +72,9 @@ public class DistributionServiceImpl implements DistributionService { |
|
|
|
return new BranchCountResultDTO(); |
|
|
|
} |
|
|
|
List<SubBranchCountResultDTO> agencyIds = screenCustomerAgencyDao.selectSubAgencyId(branchCountFormDTO.getAgencyId()); |
|
|
|
log.info("下级机关信息:"+agencyIds.toString()); |
|
|
|
List<SubBranchCountResultDTO> subList = screenCustomerGridDao.selectBranchCount(branchCountFormDTO.getAgencyId()); |
|
|
|
log.info("党支部数"+subList.toString()); |
|
|
|
if (!CollectionUtils.isEmpty(subList)){ |
|
|
|
subList.forEach(sub -> { |
|
|
|
agencyIds.forEach(agencyId -> { |
|
|
@ -79,7 +84,9 @@ public class DistributionServiceImpl implements DistributionService { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
log.info("给党支部赋值subAgencyId"+subList.toString()); |
|
|
|
Map<String, List<SubBranchCountResultDTO>> groupBySubAgency = subList.stream().collect(Collectors.groupingBy(sub -> sub.getSubAgencyId())); |
|
|
|
log.info("subList分组"+groupBySubAgency.toString()); |
|
|
|
agencyIds.forEach(a -> { |
|
|
|
groupBySubAgency.forEach((agencyId,value) -> { |
|
|
|
if (a.getSubId().equals(agencyId)){ |
|
|
@ -87,7 +94,9 @@ public class DistributionServiceImpl implements DistributionService { |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
log.info("赋值之后的"+agencyIds.toString()); |
|
|
|
branchCountResultDTO.setPartyDistribution(CollectionUtils.isEmpty(agencyIds) ? new ArrayList<>() : agencyIds); |
|
|
|
log.info("最后结果:"+branchCountResultDTO); |
|
|
|
return branchCountResultDTO; |
|
|
|
} |
|
|
|
|
|
|
|