فهرست منبع

跟进调整统计逻辑

ximinghao 1 ماه پیش
والد
کامیت
1f309f9461

+ 2 - 1
src/main/java/com/skyversation/xjcy/Timer.java

@@ -223,7 +223,8 @@ public class Timer {
     private void checkEnterpriseHealthV2() {
         List<Enterprise> enterpriseList = dMSService.query(authService.getTokenOfServiceAccount(), DMSQuery.ENTERPRISE,Enterprise.class,LocalDate.now());
         List<LeaseDetail> leaseDetailList = dMSService.query(authService.getTokenOfServiceAccount(), DMSQuery.LAST_LEASE_DETAIL,LeaseDetail.class,LocalDate.now());
-        EnterpriseHealthComputerV2 computer = new EnterpriseHealthComputerV2(enterpriseList,leaseDetailList);
+        List<IndustrialPark> industrialParkList = dMSService.query(authService.getTokenOfServiceAccount(), DMSQuery.INDUSTRIAL_PARK,IndustrialPark.class,LocalDate.now());
+        EnterpriseHealthComputerV2 computer = new EnterpriseHealthComputerV2(enterpriseList,leaseDetailList,industrialParkList);
         computer.compute();
         List<JSONObject> updateJSON = computer.getUpdateJSON();
         dMSService.updateToDms(updateJSON,authService.getTokenOfServiceAccount(), DMSColumn.ENTERPRISE);

+ 2 - 0
src/main/java/com/skyversation/xjcy/bean/Enterprise.java

@@ -49,6 +49,8 @@ public class Enterprise implements FromJSON ,DateInterval {
     private String cOperationalRisks;
     @JSONField(deserializeUsing = LocalDateFromTimestampDeserializer.class)
     private LocalDate cQyfxZlgqsj;
+    private String cQyfxZlgqCode;
+    private String cQyfxZlgqCyy;
     @Override
     public LocalDate getStartDate() {
         return Optional.ofNullable(cCertificateDate).orElse(LocalDate.MIN);

+ 3 - 1
src/main/java/com/skyversation/xjcy/bean/IndustrialPark.java

@@ -1,6 +1,5 @@
 package com.skyversation.xjcy.bean;
 
-import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.annotation.JSONField;
 import com.skyversation.xjcy.config.LocalDateFromTimestampDeserializer;
 import lombok.Data;
@@ -21,6 +20,9 @@ public class IndustrialPark implements FromJSON , DateInterval{
     private BigDecimal cFloorArea;
     private BigDecimal cBuildingArea;
     private BigDecimal cVacantArea;
+    private String parentCyyCode;
+    private String parentLdCode;
+    private String parentLcCode;
 
     @Override
     public LocalDate getStartDate() {

+ 44 - 8
src/main/java/com/skyversation/xjcy/computer/EnterpriseHealthComputerV2.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONException;
 import com.alibaba.fastjson.JSONObject;
 import com.skyversation.xjcy.bean.Enterprise;
 import com.skyversation.xjcy.bean.EnterpriseHealth;
+import com.skyversation.xjcy.bean.IndustrialPark;
 import com.skyversation.xjcy.bean.LeaseDetail;
 import com.skyversation.xjcy.enums.EnterpriseLevel;
 import lombok.Getter;
@@ -17,6 +18,7 @@ import java.util.stream.Collectors;
 public class EnterpriseHealthComputerV2 {
     private final List<Enterprise> enterprises;
     private final List<LeaseDetail> leases;
+    private final List<IndustrialPark> parks;
 
     @Getter
     private static final class Result {
@@ -24,12 +26,17 @@ public class EnterpriseHealthComputerV2 {
         private final List<LeaseDetail> leases;
         public Set<HealthItem> healthItems;
         private final LocalDate nearestLeaseExpiryDate;
+        private final String nearestLeaseExpiryCode;
+        private final String nearestLeaseExpiryCyyName;
 
-        private Result(Enterprise enterprise, List<LeaseDetail> leases, LocalDate nearestLeaseExpiryDate) {
+        private Result(Enterprise enterprise, List<LeaseDetail> leases, LocalDate nearestLeaseExpiryDate,String nearestLeaseExpiryCode, String nearestLeaseExpiryCyyName) {
             this.enterprise = enterprise;
             this.leases = leases;
             this.nearestLeaseExpiryDate = nearestLeaseExpiryDate;
+            this.nearestLeaseExpiryCode = nearestLeaseExpiryCode;
+            this.nearestLeaseExpiryCyyName = nearestLeaseExpiryCyyName;
         }
+
     }
 
     @Getter
@@ -80,9 +87,10 @@ public class EnterpriseHealthComputerV2 {
     @Getter
     private final List<Result> results = new ArrayList<>();
 
-    public EnterpriseHealthComputerV2(List<Enterprise> enterprises, List<LeaseDetail> leases) {
+    public EnterpriseHealthComputerV2(List<Enterprise> enterprises, List<LeaseDetail> leases, List<IndustrialPark> parks) {
         this.enterprises = enterprises;
         this.leases = leases;
+        this.parks = parks;
     }
 
     public void compute() {
@@ -107,8 +115,10 @@ public class EnterpriseHealthComputerV2 {
                     : null;
             LocalDate sourceLeaseExpiryDate = result.enterprise.getCQyfxZlgqsj();
             boolean leaseExpiryChanged = !Objects.equals(expectedLeaseExpiryDate, sourceLeaseExpiryDate);
+            boolean leaseExpiryCodeChanged = !Objects.equals(result.nearestLeaseExpiryCode, result.enterprise.getCQyfxZlgqCode());
+            boolean leaseExpiryCyyNameChanged = !Objects.equals(result.nearestLeaseExpiryCyyName, result.enterprise.getCQyfxZlgqCyy());
 
-            if (healthChanged || leaseExpiryChanged) {
+            if (healthChanged || leaseExpiryChanged|| leaseExpiryCodeChanged || leaseExpiryCyyNameChanged) {
                 JSONObject jsonObject = new JSONObject();
                 jsonObject.put("id", result.enterprise.getId());
 
@@ -120,6 +130,14 @@ public class EnterpriseHealthComputerV2 {
                     jsonObject.put("c_qyfx_zlgqsj", expectedLeaseExpiryDate);
                 }
 
+                if (leaseExpiryCodeChanged) {
+                    jsonObject.put("c_qyfx_zlgq_code", result.nearestLeaseExpiryCode);
+                }
+
+                if (leaseExpiryCyyNameChanged) {
+                    jsonObject.put("c_qyfx_zlgq_cyy", result.nearestLeaseExpiryCyyName);
+                }
+
                 updateJSON.add(jsonObject);
             }
         }
@@ -138,19 +156,37 @@ public class EnterpriseHealthComputerV2 {
 
     private void readData() {
         Map<String, List<LeaseDetail>> leaseMap = leases.stream().collect(Collectors.groupingBy(LeaseDetail::getCEnterpriseCode));
+        Map<String,IndustrialPark> parkMap = parks.stream().collect(Collectors.toMap(
+                IndustrialPark::getCParkCode,
+                park -> park,
+                (park1, park2) -> park1
+        ));
         for (Enterprise enterprise : enterprises) {
             List<LeaseDetail> enterpriseLeases = leaseMap.get(enterprise.getCUnifiedSocialCreditCode());
 
-            LocalDate nearestLeaseExpiryDate = null;
+            LeaseDetail nearestLease = null;
             if (enterpriseLeases != null && !enterpriseLeases.isEmpty()) {
-                nearestLeaseExpiryDate = enterpriseLeases.stream()
+                nearestLease = enterpriseLeases.stream()
                         .filter(lease -> lease.getCEndDate() != null)
-                        .map(LeaseDetail::getCEndDate)
-                        .min(Comparator.naturalOrder())
+                        .min(Comparator.comparing(LeaseDetail::getCEndDate))
                         .orElse(null);
             }
+            LocalDate nearestLeaseExpiryDate=null;
+            String nearestLeaseExpiryCode=null;
+            String nearestLeaseExpiryCyyName = null;
+            if (nearestLease != null){
+                nearestLeaseExpiryDate =  nearestLease.getCEndDate();
+                nearestLeaseExpiryCode = nearestLease.getCRoomCode();
+                IndustrialPark roomPark = parkMap.get(nearestLease.getCRoomCode());
+                if (roomPark != null){
+                    IndustrialPark park = parkMap.get(roomPark.getParentCyyCode());
+                    if (park != null){
+                        nearestLeaseExpiryCyyName = park.getCResourceName();
+                    }
+                }
+            }
 
-            Result result = new Result(enterprise, enterpriseLeases, nearestLeaseExpiryDate);
+            Result result = new Result(enterprise, enterpriseLeases, nearestLeaseExpiryDate,nearestLeaseExpiryCode, nearestLeaseExpiryCyyName);
             results.add(result);
         }
     }

+ 78 - 49
src/main/java/com/skyversation/xjcy/service/DataCountService.java

@@ -18,6 +18,7 @@ import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
@@ -48,9 +49,11 @@ public class DataCountService {
     MultiValueMap<String, IndustrialPark> buildMap = new LinkedMultiValueMap<>();
     List<IndustrialPark> allPark = new ArrayList<>();
 
-    private Map<String,String> nationalIndustryToMerged = new HashMap<>();
-    private Map<String,String> nationalIndustryMap = new HashMap<>();
-    private Map<String,String> regTypeMap = new HashMap<>();
+    private Map<String, String> nationalIndustryToMerged = new HashMap<>();
+    private Map<String, String> nationalIndustryMap = new HashMap<>();
+    private Map<String, String> regTypeMap = new HashMap<>();
+
+    private static final DateTimeFormatter YEAR_MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
 
     @PostConstruct
     public void init() {
@@ -58,8 +61,9 @@ public class DataCountService {
         initRegType();
         initNationalIndustry();
     }
-    private void initNationalIndustryToMerged () {
-        Map<String,String> map = new HashMap<>();
+
+    private void initNationalIndustryToMerged() {
+        Map<String, String> map = new HashMap<>();
         map.put("F", "批发和零售业");
         map.put("I", "信息传输、软件和信息技术服务业");
         map.put("L", "租赁和商务服务业");
@@ -69,8 +73,8 @@ public class DataCountService {
         nationalIndustryToMerged = map;
     }
 
-    private void initRegType(){
-        Map<String,String> map = new HashMap<>();
+    private void initRegType() {
+        Map<String, String> map = new HashMap<>();
         map.put("1", "注册实体型");
         map.put("2", "注册非实体型");
         map.put("3", "实体非注册型");
@@ -80,7 +84,7 @@ public class DataCountService {
 
 
     private void initNationalIndustry() {
-        Map<String,String> map = new HashMap<>();
+        Map<String, String> map = new HashMap<>();
         map.put("A", "农、林、牧、渔业");
         map.put("B", "采矿业");
         map.put("C", "制造业");
@@ -106,7 +110,7 @@ public class DataCountService {
 
     //简单限制统计频率
     @Value("${app.count-cache-length}")
-    private long INTERVAL_MILLIS ;
+    private long INTERVAL_MILLIS;
 
     private final AtomicLong lastStartTime = new AtomicLong(0);
 
@@ -118,7 +122,7 @@ public class DataCountService {
         long now = System.currentTimeMillis();
         long last = lastStartTime.get();
 
-        if (now - last < INTERVAL_MILLIS&&cacheBuildData!=null&&cacheParkData!=null||cacheTownData!=null) {
+        if (now - last < INTERVAL_MILLIS && cacheBuildData != null && cacheParkData != null || cacheTownData != null) {
             return;
         }
 
@@ -197,7 +201,7 @@ public class DataCountService {
                 .collect(Collectors.toMap(
                         LeaseDetail::getCRoomCode,
                         p -> p,
-                        (existing, replacement) ->{
+                        (existing, replacement) -> {
                             LocalDate existingEnd = existing.getCEndDate();
                             LocalDate replacementEnd = replacement.getCEndDate();
 
@@ -209,7 +213,7 @@ public class DataCountService {
                 ))
                 .values());
 
-        Map<String,BigDecimal> p18EnterpriseEconomicMap = mergeP118EnterpriseEconomicMap(needP18EnterpriseEconomic);
+        Map<String, BigDecimal> p18EnterpriseEconomicMap = mergeP118EnterpriseEconomicMap(needP18EnterpriseEconomic);
 
         //楼宇/企业/企业经济数据遍历,全镇级/产业园级/楼栋级一并处理
 
@@ -217,13 +221,13 @@ public class DataCountService {
         countEnterprise(allEnterprise, enterpriseEconomicMap, now);
 
         //遍历计算产业园相关
-        countIndustrialPark(allIndustrialPark,p18EnterpriseEconomicMap);
+        countIndustrialPark(allIndustrialPark, p18EnterpriseEconomicMap);
 
         //企呼我应
         countOrder(allOrder);
 
         //租赁信息相关统计
-        countLease(lastLeaseDetail,now);
+        countLease(lastLeaseDetail, now);
 
         countRoomStatusByLease(lastLeaseDetail, now);
 
@@ -237,6 +241,7 @@ public class DataCountService {
 
     /**
      * 合并18项经济指标数据为营收数据,按企业合并
+     *
      * @param needP18EnterpriseEconomic 18项经济指标数据
      * @return 企业编码->营收数据
      */
@@ -257,7 +262,7 @@ public class DataCountService {
     /**
      * 获取营收数据
      */
-    private BigDecimal getRevenue(P18EnterpriseEconomic p18){
+    private BigDecimal getRevenue(P18EnterpriseEconomic p18) {
         return mergeAll(
                 p18.getCGsjyyysZf(),
                 p18.getCGsrxyys(),
@@ -270,26 +275,42 @@ public class DataCountService {
     }
 
     private void countHistoryData(List<Enterprise> allEnterprise, List<IndustrialPark> allIndustrialPark, List<LeaseDetail> lastYearLease, LocalDate now) {
-        //历史企业总数统计
-        //历史数据,所以不论企业现状如何
-        Map<String, List<Enterprise>> enterpriseMap = TimeUtil.split(allEnterprise, now);
-        Map<String, Integer> enterpriseByMonth = enterpriseMap.entrySet()
-                .stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
-
-        //历史异地企业统计
-        //同上
-        Map<String, List<Enterprise>> enterpriseInTownMap = TimeUtil.split(allEnterprise
-                .stream()
-                .filter(e -> Objects.equals(e.getCSsxqCode(), "#YIDIQIYE"))
-                .collect(Collectors.toList()), now);
-        Map<String, Integer> enterpriseInTownByMonth = enterpriseInTownMap.entrySet()
-                .stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
+
+        Map<String, List<LeaseDetail>> leaseStartMap = TimeUtil.split(lastYearLease, now, LeaseDetail::getCStartDate, LeaseDetail::getCStartDate);
+
+        Map<String, List<Enterprise>> leaseStartEnterpriseMap = leaseStartMap.entrySet().stream()
+                .collect(Collectors.toMap(
+                        Map.Entry::getKey,
+                        e -> e.getValue().stream()
+                                .map(LeaseDetail::getCEnterpriseCode)
+                                .distinct()
+                                .map(code -> allEnterprise.stream()
+                                        .filter(enterprise -> Objects.equals(enterprise.getCUnifiedSocialCreditCode(), code))
+                                        .findFirst()
+                                        .orElse(null))
+                                .filter(Objects::nonNull)
+                                .collect(Collectors.toList())
+                ));
+        Map<String, Integer> enterpriseByMonth = leaseStartEnterpriseMap.entrySet().stream()
+                .collect(Collectors.toMap(
+                        Map.Entry::getKey,
+                        e -> e.getValue().size()
+                ));
+        Map<String, Long> enterpriseInTownByMonth = leaseStartEnterpriseMap.entrySet().stream()
+                .collect(Collectors.toMap(
+                        Map.Entry::getKey,
+                        e -> e.getValue().stream()
+                                .filter(enterprise ->
+                                        Objects.equals(enterprise.getRegType(), "1") || Objects.equals(enterprise.getRegType(), "2")
+                                )
+                                .count()
+                ));
 
         //历史房间总数统计
         Map<String, List<IndustrialPark>> industrialParkMap = TimeUtil.split(allIndustrialPark
-                .stream()
-                .filter(e -> Objects.equals(e.getCResourceType(), "1"))
-                .collect(Collectors.toList()),
+                        .stream()
+                        .filter(e -> Objects.equals(e.getCResourceType(), "1"))
+                        .collect(Collectors.toList()),
                 now);
         Map<String, Integer> roomByMonth = industrialParkMap.entrySet().stream().collect(
                 Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size())
@@ -496,18 +517,18 @@ public class DataCountService {
             JSONArray topRevenue = new JSONArray();
             List<String> sortedEnterprise = gsEnterprise
                     .stream()
-                    .sorted(Comparator.comparing(p18EnterpriseEconomicMap::get,Comparator.nullsFirst(BigDecimal::compareTo)).reversed())
+                    .sorted(Comparator.comparing(p18EnterpriseEconomicMap::get, Comparator.nullsFirst(BigDecimal::compareTo)).reversed())
                     .limit(10).collect(Collectors.toList());
             for (String enterPriseCode : sortedEnterprise) {
                 JSONObject outPut = new JSONObject();
                 Enterprise enterPrice = aliveEnterpriseMap.get(enterPriseCode);
-                BigDecimal product =nullToZero( p18EnterpriseEconomicMap.get(enterPriseCode));
+                BigDecimal product = nullToZero(p18EnterpriseEconomicMap.get(enterPriseCode));
                 outPut.put("enterPriceCode", enterPriseCode);
                 outPut.put("enterPriceName", enterPrice.getCEnterpriseName());
-                if (product.compareTo(BigDecimal.ZERO)==0){
-                    outPut.put("enterPriceRevenue","暂无");
-                }else {
-                    outPut.put("enterPriceRevenue",product);
+                if (product.compareTo(BigDecimal.ZERO) == 0) {
+                    outPut.put("enterPriceRevenue", "暂无");
+                } else {
+                    outPut.put("enterPriceRevenue", product);
                 }
                 topRevenue.add(outPut);
             }
@@ -530,7 +551,14 @@ public class DataCountService {
                         ));
                 enterPriceLevelCountByPark.put(level, sortedDesc);
             }
-            tempCacheTownData.put("enterpriseLevelCountByPark", enterPriceLevelCountByPark);
+            tempCacheTownData.put("enterpriseLevelCountByPark", enterPriceLevelCountByPark
+                    .entrySet().stream()
+                    .collect(Collectors.toMap(
+                                    e -> e.getKey().getDisplayLevel(),
+                                    Map.Entry::getValue,
+                                    (e1, e2) -> e1
+                            )
+                    ));
         }
 
 
@@ -577,9 +605,9 @@ public class DataCountService {
             }
         }
 
-        BigDecimal totalFloorArea = allPark.stream().map(IndustrialPark::getCFloorArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
-        BigDecimal totalBuildArea = allPark.stream().map(IndustrialPark::getCBuildingArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
-        BigDecimal totalVacantArea = allPark.stream().map(IndustrialPark::getCVacantArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add);
+        BigDecimal totalFloorArea = allPark.stream().map(IndustrialPark::getCFloorArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal totalBuildArea = allPark.stream().map(IndustrialPark::getCBuildingArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal totalVacantArea = allPark.stream().map(IndustrialPark::getCVacantArea).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 
         tempCacheTownData.put("parkCount", parkCount);
         tempCacheTownData.put("parkType", parkTypeCount);
@@ -598,7 +626,7 @@ public class DataCountService {
         Map<String, Integer> regTypeCount = new HashMap<>();
 
         for (Enterprise enterPrise : allEnterprise) {
-            boolean isInTown =Arrays.asList("1","3","4").contains(Optional.ofNullable(enterPrise.getRegType()).orElse("1"));
+            boolean isInTown = Arrays.asList("1", "3", "4").contains(Optional.ofNullable(enterPrise.getRegType()).orElse("1"));
             boolean isGsqy = "2".equals(Optional.ofNullable(enterPrise.getIsGsqy()).orElse("1"));
             boolean isAlive = true;
 
@@ -613,7 +641,7 @@ public class DataCountService {
 
                 String nationalIndustryCode = enterPrise.getCNationalIndustryCode();
                 String mergedNationalIndustry = null;
-                if (nationalIndustryCode!=null&& !nationalIndustryCode.isEmpty()) {
+                if (nationalIndustryCode != null && !nationalIndustryCode.isEmpty()) {
                     String prefix = nationalIndustryCode.substring(0, 1);
                     String industry = nationalIndustryMap.get(prefix);
                     if (industryCount.containsKey(industry)) {
@@ -623,7 +651,7 @@ public class DataCountService {
                     }
                     mergedNationalIndustry = nationalIndustryToMerged.get(prefix);
                 }
-                if (mergedNationalIndustry==null)mergedNationalIndustry = "其他";
+                if (mergedNationalIndustry == null) mergedNationalIndustry = "其他";
                 if (nationalIndustryCount.containsKey(mergedNationalIndustry)) {
                     nationalIndustryCount.put(mergedNationalIndustry, nationalIndustryCount.get(mergedNationalIndustry) + 1);
                 } else {
@@ -631,7 +659,7 @@ public class DataCountService {
                 }
                 String regType = enterPrise.getRegType();
                 String regTypeChinese = null;
-                if (regType!=null&& !regType.isEmpty()){
+                if (regType != null && !regType.isEmpty()) {
                     regTypeChinese = regTypeMap.get(regType);
                 }
                 if (regTypeChinese == null) regTypeChinese = "其他";
@@ -706,7 +734,7 @@ public class DataCountService {
         tempCacheTownData.put("orderCount", orderCount);
     }
 
-    private void countLease(List<LeaseDetail> allLease,LocalDate now) {
+    private void countLease(List<LeaseDetail> allLease, LocalDate now) {
         List<LeaseDetail> timeoutIn1Month = new ArrayList<>();
         List<LeaseDetail> timeoutIn3Month = new ArrayList<>();
 
@@ -832,10 +860,11 @@ public class DataCountService {
         return cacheBuildData.get(buildCode);
     }
 
-    private static BigDecimal nullToZero(BigDecimal value){
+    private static BigDecimal nullToZero(BigDecimal value) {
         return value == null ? BigDecimal.ZERO : value;
     }
-    private static BigDecimal mergeAll(BigDecimal...  values){
+
+    private static BigDecimal mergeAll(BigDecimal... values) {
         return Arrays.stream(values)
                 .map(DataCountService::nullToZero)
                 .reduce(BigDecimal::add)

+ 7 - 2
src/main/java/com/skyversation/xjcy/util/TimeUtil.java

@@ -6,6 +6,7 @@ import java.time.LocalDate;
 import java.time.YearMonth;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.function.Function;
 
 public class TimeUtil {
     private static final DateTimeFormatter MM_FMT = DateTimeFormatter.ofPattern("yyyy-MM");
@@ -20,6 +21,9 @@ public class TimeUtil {
     }
 
     public static <T extends DateInterval> Map<String, List<T>> split(List<T> src, LocalDate now) {
+        return split(src, now, DateInterval::getStartDate, DateInterval::getEndDate);
+    }
+    public static <T> Map<String, List<T>> split(List<T> src, LocalDate now, Function<T, LocalDate> getStart, Function<T, LocalDate> getEnd) {
         YearMonth firstMonth = YearMonth.from(now.minusMonths(12));
         YearMonth lastMonth  = YearMonth.from(now.minusMonths(1));
 
@@ -32,8 +36,8 @@ public class TimeUtil {
         // 2. 分桶
         for (T item : src) {
             if (item == null) continue;
-            LocalDate s = item.getStartDate();
-            LocalDate e = item.getEndDate();
+            LocalDate s = getStart.apply(item);
+            LocalDate e = getEnd.apply(item);
             if (s == null || e == null) continue;
 
             for (Map.Entry<String, List<T>> entry : map.entrySet()) {
@@ -47,4 +51,5 @@ public class TimeUtil {
         }
         return map;
     }
+
 }