客商主数据查询BUG修改
This commit is contained in:
+71
@@ -0,0 +1,71 @@
|
||||
package com.mhd.common.core.domain.thirdparty;
|
||||
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* MDM 客商应用侧过滤(MDM 查询条件 DESC24 在对方接口侧未严格生效,需本地过滤)
|
||||
*/
|
||||
public final class MdmMerchantSyncFilter {
|
||||
|
||||
private static final String MDM_FLAG_YES = "1";
|
||||
|
||||
private MdmMerchantSyncFilter() {
|
||||
}
|
||||
|
||||
public enum SkipReason {
|
||||
EMPTY_CODE,
|
||||
NOT_CUSTOMER,
|
||||
ORG_MISMATCH,
|
||||
DISABLED,
|
||||
MISSING_NAME
|
||||
}
|
||||
|
||||
public static boolean belongsToOrg(String recordDesc24, String orgNcCode) {
|
||||
if (StringUtils.isEmpty(orgNcCode)) {
|
||||
return true;
|
||||
}
|
||||
return orgNcCode.equals(trim(recordDesc24));
|
||||
}
|
||||
|
||||
public static boolean isCustomer(MdmMerchantRecordDTO record) {
|
||||
return record != null && MDM_FLAG_YES.equals(trim(record.getDesc3()));
|
||||
}
|
||||
|
||||
public static boolean isDisabled(MdmMerchantRecordDTO record) {
|
||||
if (record == null || StringUtils.isEmpty(record.getDesc30())) {
|
||||
return false;
|
||||
}
|
||||
String status = record.getDesc30().trim();
|
||||
return "否".equals(status) || "停用".equals(status) || "0".equals(status) || "3".equals(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否应同步到委托方列表
|
||||
*/
|
||||
public static boolean shouldSync(MdmMerchantRecordDTO record, String orgNcCode) {
|
||||
return resolveSkipReason(record, orgNcCode) == null;
|
||||
}
|
||||
|
||||
public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode) {
|
||||
if (record == null || StringUtils.isEmpty(record.getCode())) {
|
||||
return SkipReason.EMPTY_CODE;
|
||||
}
|
||||
if (!isCustomer(record)) {
|
||||
return SkipReason.NOT_CUSTOMER;
|
||||
}
|
||||
if (!belongsToOrg(record.getDesc24(), orgNcCode)) {
|
||||
return SkipReason.ORG_MISMATCH;
|
||||
}
|
||||
if (StringUtils.isEmpty(trim(record.getDesc1()))) {
|
||||
return SkipReason.MISSING_NAME;
|
||||
}
|
||||
if (isDisabled(record)) {
|
||||
return SkipReason.DISABLED;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String trim(String value) {
|
||||
return value == null ? "" : value.trim();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user