客户管理新增区域类型属性
This commit is contained in:
+4
@@ -47,6 +47,10 @@ public class BmsCustomer extends BaseEntity
|
||||
@Excel(name = "业务类型", readConverterExp = "0=直客,1=同行,2=集运")
|
||||
private String customerType;
|
||||
|
||||
/** 区域类型(字典 data_area_type) */
|
||||
@Excel(name = "区域类型", dictType = "data_area_type")
|
||||
private String areaType;
|
||||
|
||||
/** 启用状态(0正常 1停用) */
|
||||
@Excel(name = "启用状态", readConverterExp = "0=正常,1=停用")
|
||||
private String isEnable;
|
||||
|
||||
+13
-3
@@ -13,7 +13,9 @@ import java.util.function.Function;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.bms.common.core.domain.entity.SysUser;
|
||||
import com.bms.common.utils.DateUtils;
|
||||
import com.bms.common.utils.DictUtils;
|
||||
import com.bms.common.utils.SecurityUtils;
|
||||
import com.bms.common.utils.StringUtils;
|
||||
import com.bms.customer.customerinfo.domain.BmsCustomer;
|
||||
import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
|
||||
import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
|
||||
@@ -43,6 +45,13 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
|
||||
private static final ThreadLocal<SimpleDateFormat> DATE_FMT =
|
||||
ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd"));
|
||||
|
||||
/** 区域类型走字典 data_area_type;缓存未命中时保留原编码。 */
|
||||
private static String areaTypeLabel(String value)
|
||||
{
|
||||
String label = DictUtils.getDictLabel("data_area_type", value);
|
||||
return StringUtils.isEmpty(label) ? value : label;
|
||||
}
|
||||
|
||||
/** 业务类型字典 */
|
||||
private static final Map<String, String> CUSTOMER_TYPE_MAP = Map.of(
|
||||
"0", "直客", "1", "同行", "2", "集运");
|
||||
@@ -68,7 +77,7 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
|
||||
/**
|
||||
* 需要记录日志的主表字段(顺序即展示顺序)。
|
||||
* requireNonBlank 为 true 的字段对应 update SQL 的 <if test="x!=null and x!=''">,
|
||||
* 其余动态字段仅在新值非 null 时落库;业务员/结算员/客服为无条件写入。
|
||||
* 其余动态字段仅在新值非 null 时落库;业务员/结算员/客服、区域类型为无条件写入。
|
||||
*/
|
||||
private static final List<FieldDef> FIELD_DEFS = List.of(
|
||||
new FieldDef("customerCode", "客户编码", BmsCustomer::getCustomerCode, true, Function.identity()),
|
||||
@@ -76,6 +85,7 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
|
||||
new FieldDef("customerCodeDw", "对外代码", BmsCustomer::getCustomerCodeDw, false, Function.identity()),
|
||||
new FieldDef("creditCode", "统一社会信用代码", BmsCustomer::getCreditCode, false, Function.identity()),
|
||||
new FieldDef("customerType", "业务类型", BmsCustomer::getCustomerType, false, CUSTOMER_TYPE_MAP::get),
|
||||
new FieldDef("areaType", "区域类型", BmsCustomer::getAreaType, false, BmsCustomerLogServiceImpl::areaTypeLabel),
|
||||
new FieldDef("isEnable", "启用状态", BmsCustomer::getIsEnable, false, ENABLE_MAP::get),
|
||||
new FieldDef("salesUserId", "业务员", c -> userDisplay(c.getSalesUserId(), c.getSalesUser()), false, Function.identity()),
|
||||
new FieldDef("ed", "资金额度(元)", BmsCustomer::getEd, false, BmsCustomerLogServiceImpl::numText),
|
||||
@@ -198,8 +208,8 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
|
||||
{
|
||||
// 与 update SQL 的动态条件保持一致:未提交(null/空串)的字段本次不落库,不参与比对
|
||||
Object raw = def.rawGetter.apply(newCustomer);
|
||||
// 合同起止允许清空;其余动态字段未提交时不落库,也不记日志
|
||||
if (raw == null && !isContractDateField(def.field))
|
||||
// 合同起止、区域类型允许清空;其余动态字段未提交时不落库,也不记日志
|
||||
if (raw == null && !isContractDateField(def.field) && !"areaType".equals(def.field))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user