|
|
|
@@ -814,7 +814,7 @@ class CareReceptionController {
|
|
|
|
|
String carrier = blankToNull(f.get("carrier"));
|
|
|
|
|
String branch = blankToNull(f.get("branch"));
|
|
|
|
|
String counselor = blankToNull(f.get("counselor"));
|
|
|
|
|
String processor = blankToNull(f.get("processor"));
|
|
|
|
|
String processor = blankToNull(first(f, "processor", "processors", "centerNames"));
|
|
|
|
|
String region = blankToNull(first(f, "region", "customerSido"));
|
|
|
|
|
String giftCategory = blankToNull(first(f, "giftCategory", "giftType"));
|
|
|
|
|
String productCategory = blankToNull(first(f, "productCategory", "productType"));
|
|
|
|
@@ -832,8 +832,29 @@ class CareReceptionController {
|
|
|
|
|
String giftPlace = blankToNull(f.get("giftPlace"));
|
|
|
|
|
String branchEmployee = blankToNull(first(f, "branchEmployee"));
|
|
|
|
|
String branchName = blankToNull(f.get("branchName"));
|
|
|
|
|
String centerName = blankToNull(first(f, "centerName", "processorName"));
|
|
|
|
|
String branchGroup = blankToNull(first(f, "branchGroup", "branchGroupName", "branchGroupId"));
|
|
|
|
|
String paymentTransferSsid = blankToNull(first(f, "paymentTransferSsid", "paymentSsid"));
|
|
|
|
|
String paymentTransferNumber = blankToNull(first(f, "paymentTransferNumber", "paymentAccountNumber"));
|
|
|
|
|
String centerStatus = blankToNull(first(f, "centerStatus"));
|
|
|
|
|
String ispIdCsv = blankToNull(first(f, "ispId", "ispIds"));
|
|
|
|
|
String productNameCsv = blankToNull(first(f, "ispProductId", "productNames", "productNameExact"));
|
|
|
|
|
String sorting = blankToNull(f.get("sorting"));
|
|
|
|
|
|
|
|
|
|
Set<String> progressSet = csvSet(progress);
|
|
|
|
|
Set<String> settleSet = csvSet(settle);
|
|
|
|
|
Set<String> giftStatusSet = csvSet(giftStatus);
|
|
|
|
|
Set<String> centerStatusSet = csvSet(centerStatus);
|
|
|
|
|
Set<String> carrierSet = csvSet(carrier);
|
|
|
|
|
Set<String> branchSet = csvSet(branch);
|
|
|
|
|
Set<String> processorSet = csvSet(processor);
|
|
|
|
|
Set<String> regionSet = csvSet(region);
|
|
|
|
|
Set<String> giftCatSet = csvSet(giftCategory);
|
|
|
|
|
Set<String> productCatSet = csvSet(productCategory);
|
|
|
|
|
Set<String> ispIdSet = csvSet(ispIdCsv);
|
|
|
|
|
Set<String> productExactSet = csvSet(productNameCsv);
|
|
|
|
|
Set<String> branchGroupSet = csvSet(branchGroup);
|
|
|
|
|
|
|
|
|
|
String progressF = progress;
|
|
|
|
|
List<HomesReception> result = all.stream().filter(r -> {
|
|
|
|
|
LocalDate od = r.getOrderDate() == null ? null : r.getOrderDate().toLocalDate();
|
|
|
|
@@ -846,34 +867,95 @@ class CareReceptionController {
|
|
|
|
|
LocalDate gd = r.getGiftSended() != null ? r.getGiftSended() : r.getGiftDate();
|
|
|
|
|
if (gd == null || !gd.equals(giftSended)) return false;
|
|
|
|
|
}
|
|
|
|
|
if (progressF != null) {
|
|
|
|
|
if (!progressSet.isEmpty()) {
|
|
|
|
|
String rp = ReceptionStatuses.normalizeProgress(r.getProgressStatus());
|
|
|
|
|
boolean hit = progressSet.stream().anyMatch(fp -> {
|
|
|
|
|
String n = ReceptionStatuses.normalizeProgress(fp);
|
|
|
|
|
return n.equals(rp) || fp.equals(r.getProgressStatus());
|
|
|
|
|
});
|
|
|
|
|
if (!hit) return false;
|
|
|
|
|
} else if (progressF != null) {
|
|
|
|
|
String rp = ReceptionStatuses.normalizeProgress(r.getProgressStatus());
|
|
|
|
|
String fp = ReceptionStatuses.normalizeProgress(progressF);
|
|
|
|
|
if (!fp.equals(rp) && !progressF.equals(r.getProgressStatus())) return false;
|
|
|
|
|
}
|
|
|
|
|
if (settle != null) {
|
|
|
|
|
if (!settleSet.isEmpty()) {
|
|
|
|
|
String rs = ReceptionStatuses.normalizeCenter(r.getSettleStatus());
|
|
|
|
|
boolean hit = settleSet.stream().anyMatch(fs -> {
|
|
|
|
|
String n = ReceptionStatuses.normalizeCenter(fs);
|
|
|
|
|
return n.equals(rs) || fs.equals(r.getSettleStatus());
|
|
|
|
|
});
|
|
|
|
|
if (!hit) return false;
|
|
|
|
|
} else if (settle != null) {
|
|
|
|
|
String rs = ReceptionStatuses.normalizeCenter(r.getSettleStatus());
|
|
|
|
|
String fs = ReceptionStatuses.normalizeCenter(settle);
|
|
|
|
|
if (!fs.equals(rs) && !settle.equals(r.getSettleStatus())) return false;
|
|
|
|
|
}
|
|
|
|
|
if (giftStatus != null) {
|
|
|
|
|
if (!centerStatusSet.isEmpty()) {
|
|
|
|
|
String rs = ReceptionStatuses.normalizeCenter(r.getSettleStatus());
|
|
|
|
|
boolean hit = centerStatusSet.stream().anyMatch(fs -> {
|
|
|
|
|
String n = ReceptionStatuses.normalizeCenter(fs);
|
|
|
|
|
return n.equals(rs) || fs.equals(r.getSettleStatus());
|
|
|
|
|
});
|
|
|
|
|
if (!hit) return false;
|
|
|
|
|
}
|
|
|
|
|
if (!giftStatusSet.isEmpty()) {
|
|
|
|
|
String rg = ReceptionStatuses.normalizeGift(r.getGiftStatus());
|
|
|
|
|
boolean hit = giftStatusSet.stream().anyMatch(fg -> {
|
|
|
|
|
String n = ReceptionStatuses.normalizeGift(fg);
|
|
|
|
|
return n.equals(rg) || fg.equals(r.getGiftStatus());
|
|
|
|
|
});
|
|
|
|
|
if (!hit) return false;
|
|
|
|
|
} else if (giftStatus != null) {
|
|
|
|
|
String rg = ReceptionStatuses.normalizeGift(r.getGiftStatus());
|
|
|
|
|
String fg = ReceptionStatuses.normalizeGift(giftStatus);
|
|
|
|
|
if (!fg.equals(rg) && !giftStatus.equals(r.getGiftStatus())) return false;
|
|
|
|
|
}
|
|
|
|
|
if (carrier != null && !carrier.equals(r.getCarrier()) && !carrier.equals(r.getIspName())) return false;
|
|
|
|
|
if (!carrierSet.isEmpty()) {
|
|
|
|
|
if (!carrierSet.contains(nullToEmpty(r.getCarrier())) && !carrierSet.contains(nullToEmpty(r.getIspName()))) {
|
|
|
|
|
if (r.getIspId() == null || !carrierSet.contains(String.valueOf(r.getIspId()))) return false;
|
|
|
|
|
}
|
|
|
|
|
} else if (carrier != null && !carrier.equals(r.getCarrier()) && !carrier.equals(r.getIspName())) return false;
|
|
|
|
|
if (!ispIdSet.isEmpty()) {
|
|
|
|
|
if (r.getIspId() == null || !ispIdSet.contains(String.valueOf(r.getIspId()))) {
|
|
|
|
|
if (!ispIdSet.contains(nullToEmpty(r.getIspName())) && !ispIdSet.contains(nullToEmpty(r.getCarrier()))) return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ispName != null) {
|
|
|
|
|
String hay = (nullToEmpty(r.getIspName()) + " " + nullToEmpty(r.getCarrier())).toLowerCase();
|
|
|
|
|
if (!hay.contains(ispName.toLowerCase())) return false;
|
|
|
|
|
}
|
|
|
|
|
if (branch != null && !branch.equals(r.getBranch())) return false;
|
|
|
|
|
if (!branchSet.isEmpty()) {
|
|
|
|
|
if (!branchSet.contains(nullToEmpty(r.getBranch()))) return false;
|
|
|
|
|
} else if (branch != null && !branch.equals(r.getBranch())) return false;
|
|
|
|
|
if (branchName != null && !nullToEmpty(r.getBranch()).contains(branchName)) return false;
|
|
|
|
|
if (!branchGroupSet.isEmpty()) {
|
|
|
|
|
String bg = nullToEmpty(r.getBranchGroup());
|
|
|
|
|
boolean hit = branchGroupSet.stream().anyMatch(g -> bg.contains(g) || bg.equals(g) || String.valueOf(r.getBranchGroup()).equals(g));
|
|
|
|
|
if (!hit) return false;
|
|
|
|
|
} else if (branchGroup != null && !nullToEmpty(r.getBranchGroup()).contains(branchGroup)
|
|
|
|
|
&& !String.valueOf(r.getBranchGroup()).equals(branchGroup)) return false;
|
|
|
|
|
if (counselor != null && !counselor.equals(r.getCounselor())) return false;
|
|
|
|
|
if (branchEmployee != null && !nullToEmpty(r.getCounselor()).contains(branchEmployee)) return false;
|
|
|
|
|
if (processor != null && !processor.equals(r.getProcessor())) return false;
|
|
|
|
|
if (region != null && !region.equals(r.getRegion())) return false;
|
|
|
|
|
if (giftCategory != null && !nullToEmpty(r.getGiftCategory()).contains(giftCategory)) return false;
|
|
|
|
|
if (productCategory != null
|
|
|
|
|
if (centerName != null) {
|
|
|
|
|
String cn = blank(r.getProcessor()) ? "본사" : r.getProcessor();
|
|
|
|
|
if (!cn.contains(centerName)) return false;
|
|
|
|
|
}
|
|
|
|
|
if (!processorSet.isEmpty()) {
|
|
|
|
|
String cn = blank(r.getProcessor()) ? "본사" : nullToEmpty(r.getProcessor());
|
|
|
|
|
if (!processorSet.contains(cn) && !processorSet.contains(nullToEmpty(r.getProcessor()))) return false;
|
|
|
|
|
} else if (processor != null && !processor.equals(r.getProcessor())) return false;
|
|
|
|
|
if (!regionSet.isEmpty()) {
|
|
|
|
|
if (!regionSet.contains(nullToEmpty(r.getRegion()))) return false;
|
|
|
|
|
} else if (region != null && !region.equals(r.getRegion())) return false;
|
|
|
|
|
if (!giftCatSet.isEmpty()) {
|
|
|
|
|
boolean hit = giftCatSet.stream().anyMatch(g -> nullToEmpty(r.getGiftCategory()).contains(g));
|
|
|
|
|
if (!hit) return false;
|
|
|
|
|
} else if (giftCategory != null && !nullToEmpty(r.getGiftCategory()).contains(giftCategory)) return false;
|
|
|
|
|
if (!productCatSet.isEmpty()) {
|
|
|
|
|
if (!productCatSet.contains(nullToEmpty(r.getProductCategory()))
|
|
|
|
|
&& !productCatSet.contains(nullToEmpty(r.getProductType()))) return false;
|
|
|
|
|
} else if (productCategory != null
|
|
|
|
|
&& !productCategory.equals(r.getProductCategory())
|
|
|
|
|
&& !productCategory.equals(r.getProductType())) return false;
|
|
|
|
|
if (giftPlace != null && !giftPlace.equals(r.getGiftPlace())) return false;
|
|
|
|
@@ -888,7 +970,13 @@ class CareReceptionController {
|
|
|
|
|
if (agreementName != null && !nullToEmpty(r.getAgreementName()).contains(agreementName)) return false;
|
|
|
|
|
if (customerSsid != null && !nullToEmpty(r.getIdentifyNumber()).contains(customerSsid)) return false;
|
|
|
|
|
if (customerEmail != null && !nullToEmpty(r.getEmail()).contains(customerEmail)) return false;
|
|
|
|
|
if (productName != null && !nullToEmpty(r.getProductName()).contains(productName)) return false;
|
|
|
|
|
if (paymentTransferSsid != null && !nullToEmpty(r.getPaymentSsid()).contains(paymentTransferSsid)) return false;
|
|
|
|
|
if (paymentTransferNumber != null
|
|
|
|
|
&& !nullToEmpty(r.getPaymentAccountNumber()).contains(paymentTransferNumber)
|
|
|
|
|
&& !nullToEmpty(r.getPaymentCardNumber()).contains(paymentTransferNumber)) return false;
|
|
|
|
|
if (!productExactSet.isEmpty()) {
|
|
|
|
|
if (!productExactSet.contains(nullToEmpty(r.getProductName()))) return false;
|
|
|
|
|
} else if (productName != null && !nullToEmpty(r.getProductName()).contains(productName)) return false;
|
|
|
|
|
if (contractNumber != null && !nullToEmpty(r.getContractNumber()).contains(contractNumber)) return false;
|
|
|
|
|
if (q != null) {
|
|
|
|
|
String hay = (nullToEmpty(r.getCustomerName()) + " " + nullToEmpty(r.getPhone()) + " "
|
|
|
|
@@ -909,6 +997,14 @@ class CareReceptionController {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Set<String> csvSet(String csv) {
|
|
|
|
|
if (csv == null || csv.isBlank()) return Set.of();
|
|
|
|
|
return Arrays.stream(csv.split(","))
|
|
|
|
|
.map(String::trim)
|
|
|
|
|
.filter(s -> !s.isEmpty())
|
|
|
|
|
.collect(Collectors.toCollection(LinkedHashSet::new));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void apply(HomesReception r, Map<String, Object> d) {
|
|
|
|
|
if (d.containsKey("orderDate")) r.setOrderDate(parseDateTime(str(d.get("orderDate"))));
|
|
|
|
|
if (d.containsKey("counselor")) r.setCounselor(str(d.get("counselor")));
|
|
|
|
|