From 910a73ed281494b1fc472138fcaad394e990e90e Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Wed, 4 Nov 2026 15:47:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?:lipstick:=20=E8=B0=83=E6=95=B4=E6=AF=9B?= =?UTF-8?q?=E5=88=A9=E5=88=86=E6=9E=90=E7=AD=9B=E9=80=89=E9=A1=B9=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bms-front/src/views/report/profit/index.vue | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bms-front/src/views/report/profit/index.vue b/bms-front/src/views/report/profit/index.vue index ab76171d..f911fdde 100644 --- a/bms-front/src/views/report/profit/index.vue +++ b/bms-front/src/views/report/profit/index.vue @@ -16,16 +16,6 @@ /> - - - - - - - - - - + + + + + + + + + + Date: Wed, 4 Nov 2026 15:56:11 +0800 Subject: [PATCH 2/5] =?UTF-8?q?:fire:=20=E7=A7=BB=E9=99=A4=E6=AF=9B?= =?UTF-8?q?=E5=88=A9=E5=88=86=E6=9E=90=E4=BB=B7=E6=A0=BC=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/vo/PrcProfitReportProductRow.java | 2 -- .../price/domain/vo/PrcProfitReportQuery.java | 2 -- .../domain/vo/PrcProfitReportSummary.java | 1 - .../mapper/price/PrcProfitReportMapper.xml | 18 +----------------- bms-front/src/views/report/profit/index.vue | 17 ++++------------- 5 files changed, 5 insertions(+), 35 deletions(-) diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportProductRow.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportProductRow.java index 2791b7b2..ff585000 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportProductRow.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportProductRow.java @@ -43,6 +43,4 @@ public class PrcProfitReportProductRow implements Serializable @Excel(name = "未计算提成订单数", width = 20) private Long commissionMissingOrderCount; */ - @Excel(name = "产品价或价格缺失订单数", width = 22) - private Long incompleteOrderCount; } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java index a7d00e2d..ab072bdf 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java @@ -35,6 +35,4 @@ public class PrcProfitReportQuery extends BaseEntity private String arBillStatus; /** 是否按产品维度分组值下钻订单明细,允许分组字段为空。 */ private Boolean productDrilldown; - /** 订单明细弹窗的筛选类型:ALL、INCOMPLETE;COMMISSION_MISSING 暂停使用。 */ - private String detailType; } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportSummary.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportSummary.java index b4428398..e1009433 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportSummary.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportSummary.java @@ -11,7 +11,6 @@ public class PrcProfitReportSummary implements Serializable private static final long serialVersionUID = 1L; private Long orderCount; - private Long incompleteOrderCount; private String currency; private BigDecimal costAmount; private BigDecimal redlineAmount; diff --git a/bms-back/bms-system/src/main/resources/mapper/price/PrcProfitReportMapper.xml b/bms-back/bms-system/src/main/resources/mapper/price/PrcProfitReportMapper.xml index 6d363433..3320fc3d 100644 --- a/bms-back/bms-system/src/main/resources/mapper/price/PrcProfitReportMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/price/PrcProfitReportMapper.xml @@ -98,12 +98,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" --> - - @@ -193,16 +191,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - and (i.product_amount is null or i.redline_amount is null or i.sales_amount is null) - - @@ -271,15 +259,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" then i.sales_amount - i.product_amount else null end) * 100 / sum(case when i.product_amount is not null and i.sales_amount is not null then i.sales_amount else null end), 4) - end as sales_gross_margin_rate, + end as sales_gross_margin_rate - sum(case when i.product_amount is null or i.redline_amount is null or i.sales_amount is null - then 1 else 0 end) as incomplete_order_count group by p.product_code, p.product_name, p.country_code, p.country_name, i.currency order by p.product_code, p.country_code, i.currency @@ -287,8 +273,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select i.currency, count(*) as order_count, - sum(case when i.product_amount is null or i.redline_amount is null or i.sales_amount is null - then 1 else 0 end) as incomplete_order_count, sum(i.product_amount) as cost_amount, sum(i.redline_amount) as redline_amount, sum(case when i.product_amount is not null and i.redline_amount is not null diff --git a/bms-front/src/views/report/profit/index.vue b/bms-front/src/views/report/profit/index.vue index f911fdde..95a8abbd 100644 --- a/bms-front/src/views/report/profit/index.vue +++ b/bms-front/src/views/report/profit/index.vue @@ -98,9 +98,6 @@ 提成金额{{ money(summary.commissionAmount) }} --> - - 价格缺失订单{{ summary.incompleteOrderCount || 0 }} - - - {{ row.incompleteOrderCount }} - {{ parseTime(row.bizDate) }} @@ -446,15 +440,12 @@ function handleDimensionChange() { Promise.all([loadSummary(), loadRows()]) } -function openOrderList(row, detailType, label) { +function openOrderList(row) { if (!validateMultiValueFilters()) return - // 提成未计算订单下钻暂停使用:detailType === 'COMMISSION_MISSING' ? row.commissionMissingOrderCount - const count = detailType === 'ALL' ? row.orderCount : row.incompleteOrderCount - if (!count) return - orderListTitle.value = `${label}订单列表` + if (!row.orderCount) return + orderListTitle.value = '订单列表' orderListContext.value = { productDrilldown: true, - detailType, productCode: row.productCode, countryCode: row.countryCode, currency: row.currency From 04be15deab77375b4f4954ab1048eeaa86ad522a Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Wed, 4 Nov 2026 16:02:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E6=AF=9B?= =?UTF-8?q?=E5=88=A9=E6=8A=A5=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bms/price/service/impl/PrcProfitReportServiceImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java index 8ab3023c..9ed6a667 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java @@ -107,10 +107,6 @@ public class PrcProfitReportServiceImpl implements IPrcProfitReportService { return; } - if ("COMMISSION_MISSING".equals(query.getDetailType())) - { - throw new ServiceException("提成功能已暂停使用"); - } query.setOrderNos(splitFilterValues(query.getOrderNo(), "订单号")); query.setCustomerCodes(splitFilterValues(query.getCustomerCode(), "客户代码")); query.setCustomerNames(splitFilterValues(query.getCustomerName(), "客户名称")); From 846a41c6df5fbb6017283570c86b87139fe1efef Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Wed, 4 Nov 2026 16:04:38 +0800 Subject: [PATCH 4/5] =?UTF-8?q?:bug:=20=E4=BF=9D=E7=95=99=E6=AF=9B?= =?UTF-8?q?=E5=88=A9=E6=8A=A5=E8=A1=A8=E6=9A=82=E5=81=9C=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/bms/price/domain/vo/PrcProfitReportQuery.java | 2 ++ .../bms/price/service/impl/PrcProfitReportServiceImpl.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java index ab072bdf..8a9b4a09 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/domain/vo/PrcProfitReportQuery.java @@ -35,4 +35,6 @@ public class PrcProfitReportQuery extends BaseEntity private String arBillStatus; /** 是否按产品维度分组值下钻订单明细,允许分组字段为空。 */ private Boolean productDrilldown; + /** 仅用于拒绝已暂停的提成未计算订单下钻请求。 */ + private String detailType; } diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java index 9ed6a667..8ab3023c 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/PrcProfitReportServiceImpl.java @@ -107,6 +107,10 @@ public class PrcProfitReportServiceImpl implements IPrcProfitReportService { return; } + if ("COMMISSION_MISSING".equals(query.getDetailType())) + { + throw new ServiceException("提成功能已暂停使用"); + } query.setOrderNos(splitFilterValues(query.getOrderNo(), "订单号")); query.setCustomerCodes(splitFilterValues(query.getCustomerCode(), "客户代码")); query.setCustomerNames(splitFilterValues(query.getCustomerName(), "客户名称")); From 942d5932aee0f5b9e1f462c4dd50d7c8015cb541 Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Wed, 4 Nov 2026 18:29:47 +0800 Subject: [PATCH 5/5] =?UTF-8?q?:sparkles:=20=E5=90=8C=E6=AD=A5=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=8C=BA=E5=9F=9F=E5=AD=97=E6=AE=B5=E5=B9=B6=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=AD=97=E5=85=B8=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customerinfo/domain/BmsCustomer.java | 6 +- .../impl/BmsCustomerLogServiceImpl.java | 14 +- .../sync/CustomerSyncService.java | 2 + .../mapper/customer/BmsCustomerMapper.xml | 12 +- .../mapper/customer/CustomerSyncMapper.xml | 3 + .../customer/OracleCustomerSyncMapper.xml | 2 +- bms-back/sql/bms_init.sql | 2 +- .../20261030_customer_area_type.sql | 11 -- .../20261104_customer_area_rename.sql | 173 ++++++++++++++++++ .../customerinfo/customeredit/index.vue | 10 +- .../customerinfo/index.vue | 20 +- 11 files changed, 211 insertions(+), 44 deletions(-) delete mode 100644 bms-back/sql/customer+supplier/20261030_customer_area_type.sql create mode 100644 bms-back/sql/customer+supplier/20261104_customer_area_rename.sql diff --git a/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/domain/BmsCustomer.java b/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/domain/BmsCustomer.java index e78df049..1d67cbb4 100644 --- a/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/domain/BmsCustomer.java +++ b/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/domain/BmsCustomer.java @@ -47,9 +47,9 @@ 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; + /** 客户区域(字典 customer_area) */ + @Excel(name = "客户区域", dictType = "customer_area") + private String customerArea; /** 启用状态(0正常 1停用) */ @Excel(name = "启用状态", readConverterExp = "0=正常,1=停用") diff --git a/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/service/impl/BmsCustomerLogServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/service/impl/BmsCustomerLogServiceImpl.java index 43bd4133..fbc69aae 100644 --- a/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/service/impl/BmsCustomerLogServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/service/impl/BmsCustomerLogServiceImpl.java @@ -45,10 +45,10 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService private static final ThreadLocal DATE_FMT = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd")); - /** 区域类型走字典 data_area_type;缓存未命中时保留原编码。 */ - private static String areaTypeLabel(String value) + /** 客户区域走字典 customer_area;缓存未命中时保留原编码。 */ + private static String customerAreaLabel(String value) { - String label = DictUtils.getDictLabel("data_area_type", value); + String label = DictUtils.getDictLabel("customer_area", value); return StringUtils.isEmpty(label) ? value : label; } @@ -77,7 +77,7 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService /** * 需要记录日志的主表字段(顺序即展示顺序)。 * requireNonBlank 为 true 的字段对应 update SQL 的 <if test="x!=null and x!=''">, - * 其余动态字段仅在新值非 null 时落库;业务员/结算员/客服、区域类型为无条件写入。 + * 其余动态字段仅在新值非 null 时落库;业务员/结算员/客服、客户区域为无条件写入。 */ private static final List FIELD_DEFS = List.of( new FieldDef("customerCode", "客户编码", BmsCustomer::getCustomerCode, true, Function.identity()), @@ -85,7 +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("customerArea", "客户区域", BmsCustomer::getCustomerArea, false, BmsCustomerLogServiceImpl::customerAreaLabel), 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), @@ -208,8 +208,8 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService { // 与 update SQL 的动态条件保持一致:未提交(null/空串)的字段本次不落库,不参与比对 Object raw = def.rawGetter.apply(newCustomer); - // 合同起止、区域类型允许清空;其余动态字段未提交时不落库,也不记日志 - if (raw == null && !isContractDateField(def.field) && !"areaType".equals(def.field)) + // 合同起止、客户区域允许清空;其余动态字段未提交时不落库,也不记日志 + if (raw == null && !isContractDateField(def.field) && !"customerArea".equals(def.field)) { continue; } diff --git a/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/sync/CustomerSyncService.java b/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/sync/CustomerSyncService.java index 9b45cb26..ccce88fd 100644 --- a/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/sync/CustomerSyncService.java +++ b/bms-back/bms-system/src/main/java/com/bms/customer/customerinfo/sync/CustomerSyncService.java @@ -60,6 +60,7 @@ public class CustomerSyncService private static final int LEN_CODE = 50; private static final int LEN_NAME = 100; private static final int LEN_CODE_DW = 50; + private static final int LEN_CUSTOMER_AREA = 32; private static final int LEN_USER = 50; private static final int LEN_REMARK = 500; /** 告警明细最多打印条数 */ @@ -178,6 +179,7 @@ public class CustomerSyncService c.setDelFlag("0"); c.setCustomerCodeDw(truncate(getStr(row, "CUSTOMER_OUTER_CODE"), LEN_CODE_DW, code, "customer_code_dw", warnings)); + c.setCustomerArea(truncate(getStr(row, "CUSTOMER_AREA"), LEN_CUSTOMER_AREA, code, "customer_area", warnings)); String sourceSalesCode = clean(getStr(row, "BELONG_SALER")); c.setSourceSalesCode(sourceSalesCode); c.setSalesUserId(resolveSalesUserId(sourceSalesCode, userIdsByLogin, diff --git a/bms-back/bms-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml b/bms-back/bms-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml index fbbf8b95..8f35acbb 100644 --- a/bms-back/bms-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/customer/BmsCustomerMapper.xml @@ -11,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select c.customer_id, c.customer_code, c.customer_name, c.customer_code_dw, c.credit_code, c.customer_type, c.area_type, + select c.customer_id, c.customer_code, c.customer_name, c.customer_code_dw, c.credit_code, c.customer_type, c.customer_area, c.is_enable, case when su.user_id is not null then cast(su.user_id as char) else null end as sales_user_id, su.nick_name as sales_user, c.ed, c.zq, c.settlement_user_id, c.settlement_user, @@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and c.credit_code = #{creditCode} and c.customer_type = #{customerType} - and c.area_type = #{areaType} + and c.customer_area = #{customerArea} and c.is_enable = #{isEnable} and c.sales_user_id = #{salesUserId} and su.nick_name = #{salesUser} @@ -317,7 +317,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" customer_code_dw, credit_code, customer_type, - area_type, + customer_area, is_enable, sales_user_id, sales_user, @@ -350,7 +350,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{customerCodeDw}, #{creditCode}, #{customerType}, - #{areaType}, + #{customerArea}, #{isEnable}, #{salesUserId}, #{salesUser}, @@ -387,7 +387,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" customer_code_dw = #{customerCodeDw}, credit_code = #{creditCode}, customer_type = #{customerType}, - area_type = #{areaType}, + customer_area = #{customerArea}, is_enable = #{isEnable}, sales_user_id = #{salesUserId}, sales_user = #{salesUser}, diff --git a/bms-back/bms-system/src/main/resources/mapper/customer/CustomerSyncMapper.xml b/bms-back/bms-system/src/main/resources/mapper/customer/CustomerSyncMapper.xml index 6bd7222d..44913610 100644 --- a/bms-back/bms-system/src/main/resources/mapper/customer/CustomerSyncMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/customer/CustomerSyncMapper.xml @@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" del_flag, create_by, sales_user_id, source_sales_code , customer_code_dw , customer_type + , customer_area , sales_user , settlement_user , service_user @@ -46,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" '0', #{createBy}, #{salesUserId}, #{sourceSalesCode} , #{customerCodeDw} , #{customerType} + , #{customerArea} , #{salesUser} , #{settlementUser} , #{serviceUser} @@ -66,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" , customer_name = #{customerName} , customer_code_dw = #{customerCodeDw} , customer_type = #{customerType} + , customer_area = #{customerArea} , sales_user_id = #{salesUserId} , source_sales_code = #{sourceSalesCode} , sales_user = #{salesUser} diff --git a/bms-back/bms-system/src/main/resources/mapper/customer/OracleCustomerSyncMapper.xml b/bms-back/bms-system/src/main/resources/mapper/customer/OracleCustomerSyncMapper.xml index 0aad5a20..ecd510ed 100644 --- a/bms-back/bms-system/src/main/resources/mapper/customer/OracleCustomerSyncMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/customer/OracleCustomerSyncMapper.xml @@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" BELONG_SALER, BELONG_SALER_NAME, SETTLEMENT_MAN, SERVICE_MAN, REMARK, WEIGHT_LIMIT, CREDIT_LIMIT, TEMP_AMOUNT, ACCOUNT_AMOUNT, EUR_AMOUNT, - CUSTOMER_TYPE, CUSTOMER_BALANCE_MODE, BL_OPEN, + CUSTOMER_TYPE, CUSTOMER_AREA, CUSTOMER_BALANCE_MODE, BL_OPEN, CREATE_DATE, GMT_CREATE FROM WEISHI_USER.TAB_CUSTOMER diff --git a/bms-back/sql/bms_init.sql b/bms-back/sql/bms_init.sql index 443bf205..02c3ee87 100644 --- a/bms-back/sql/bms_init.sql +++ b/bms-back/sql/bms_init.sql @@ -355,7 +355,7 @@ CREATE TABLE `ctr_customer` ( `customer_code_dw` varchar(50) DEFAULT '' COMMENT '对外代码', `credit_code` varchar(18) DEFAULT '' COMMENT '统一社会信用代码', `customer_type` char(1) DEFAULT '0' COMMENT '业务类型(0直客 1同行 2集运)', - `area_type` varchar(32) DEFAULT NULL COMMENT '区域类型(字典 data_area_type)', + `customer_area` varchar(32) DEFAULT NULL COMMENT '客户区域(字典 customer_area)', `is_enable` char(1) DEFAULT '0' COMMENT '启用状态(0正常 1停用)', `sales_user_id` varchar(64) DEFAULT NULL COMMENT '业务员系统用户ID(sys_user.user_id)', `source_sales_code` varchar(255) DEFAULT NULL COMMENT '客户同步源业务员工号(内部字段)', diff --git a/bms-back/sql/customer+supplier/20261030_customer_area_type.sql b/bms-back/sql/customer+supplier/20261030_customer_area_type.sql deleted file mode 100644 index 725747d8..00000000 --- a/bms-back/sql/customer+supplier/20261030_customer_area_type.sql +++ /dev/null @@ -1,11 +0,0 @@ --- ctr_customer.area_type:客户区域类型,取值来自字典 data_area_type(可重复执行) -SET @col_exists := ( - SELECT COUNT(1) FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ctr_customer' AND COLUMN_NAME = 'area_type' -); -SET @sql := IF(@col_exists = 0, - 'ALTER TABLE `ctr_customer` ADD COLUMN `area_type` varchar(32) DEFAULT NULL COMMENT ''区域类型(字典 data_area_type)'' AFTER `customer_type`', - 'SELECT 1'); -PREPARE stmt FROM @sql; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; diff --git a/bms-back/sql/customer+supplier/20261104_customer_area_rename.sql b/bms-back/sql/customer+supplier/20261104_customer_area_rename.sql new file mode 100644 index 00000000..07c1581e --- /dev/null +++ b/bms-back/sql/customer+supplier/20261104_customer_area_rename.sql @@ -0,0 +1,173 @@ +-- Unified migration: ctr_customer.area_type -> customer_area and data_area_type -> customer_area. +-- Target: MySQL 5.7.x; run the whole file against the intended database in one connection. +-- Confirm both migration_status and dictionary_migration_status report READY. +-- Conflicting columns or dictionary values are preserved and reported for manual review. + +SET @customer_table_exists := ( + SELECT COUNT(1) FROM information_schema.TABLES + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ctr_customer' +); +SET @customer_area_old_exists := ( + SELECT COUNT(1) FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ctr_customer' AND COLUMN_NAME = 'area_type' +); +SET @customer_area_new_exists := ( + SELECT COUNT(1) FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ctr_customer' AND COLUMN_NAME = 'customer_area' +); +SET @customer_area_conflict_count := 0; + +-- If both columns exist, require matching non-NULL values before merging and dropping the old column. +SET @customer_area_check_sql := IF( + @customer_area_old_exists = 1 AND @customer_area_new_exists = 1, + 'SELECT COUNT(1) INTO @customer_area_conflict_count FROM `ctr_customer` WHERE `area_type` IS NOT NULL AND `customer_area` IS NOT NULL AND BINARY `area_type` <> BINARY `customer_area`', + 'SELECT 0 INTO @customer_area_conflict_count' +); +PREPARE customer_area_stmt FROM @customer_area_check_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +-- In the no-conflict dual-column state, copy values that only exist in the old column. +SET @customer_area_merge_sql := IF( + @customer_area_old_exists = 1 AND @customer_area_new_exists = 1 AND @customer_area_conflict_count = 0, + 'UPDATE `ctr_customer` SET `customer_area` = `area_type` WHERE `customer_area` IS NULL AND `area_type` IS NOT NULL', + 'SELECT 1' +); +PREPARE customer_area_stmt FROM @customer_area_merge_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +-- Drop the legacy column only after its values have been merged without conflicts. +SET @customer_area_drop_sql := IF( + @customer_area_old_exists = 1 AND @customer_area_new_exists = 1 AND @customer_area_conflict_count = 0, + 'ALTER TABLE `ctr_customer` DROP COLUMN `area_type`', + 'SELECT 1' +); +PREPARE customer_area_stmt FROM @customer_area_drop_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +-- Rename the existing column, or create the new column when neither name exists. +SET @customer_area_rename_sql := CASE + WHEN @customer_table_exists = 1 AND @customer_area_old_exists = 1 AND @customer_area_new_exists = 0 THEN + 'ALTER TABLE `ctr_customer` CHANGE COLUMN `area_type` `customer_area` varchar(32) DEFAULT NULL COMMENT ''客户区域(字典 customer_area)'' AFTER `customer_type`' + WHEN @customer_table_exists = 1 AND @customer_area_old_exists = 0 AND @customer_area_new_exists = 0 THEN + 'ALTER TABLE `ctr_customer` ADD COLUMN `customer_area` varchar(32) DEFAULT NULL COMMENT ''客户区域(字典 customer_area)'' AFTER `customer_type`' + ELSE 'SELECT 1' +END; +PREPARE customer_area_stmt FROM @customer_area_rename_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +SET @customer_area_old_exists := ( + SELECT COUNT(1) FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ctr_customer' AND COLUMN_NAME = 'area_type' +); +SET @customer_area_new_exists := ( + SELECT COUNT(1) FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ctr_customer' AND COLUMN_NAME = 'customer_area' +); + +SELECT CASE + WHEN @customer_table_exists = 0 THEN 'ERROR: ctr_customer table does not exist in the selected database' + WHEN @customer_area_old_exists = 0 AND @customer_area_new_exists = 1 THEN 'READY' + WHEN @customer_area_conflict_count > 0 THEN 'BLOCKED: resolve conflicting values and rerun this full script' + ELSE 'ERROR: expected customer_area and no area_type; inspect the table before continuing' + END AS migration_status, + @customer_area_conflict_count AS conflicting_rows; + +SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_DEFAULT, COLUMN_COMMENT +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = 'ctr_customer' + AND COLUMN_NAME IN ('area_type', 'customer_area') +ORDER BY ORDINAL_POSITION; + +-- When migration_status is BLOCKED, inspect these rows, resolve each value manually, then rerun this file. +SET @customer_area_conflict_rows_sql := IF( + @customer_area_conflict_count > 0, + 'SELECT `customer_id`, `customer_code`, `area_type`, `customer_area` FROM `ctr_customer` WHERE `area_type` IS NOT NULL AND `customer_area` IS NOT NULL AND BINARY `area_type` <> BINARY `customer_area` ORDER BY `customer_id`', + 'SELECT ''No conflicting customer area values'' AS conflict_check' +); +PREPARE customer_area_stmt FROM @customer_area_conflict_rows_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +-- Rename the dictionary identifier and its values. If both dictionary types already exist, +-- or both dictionaries use the same value, stop and report instead of creating ambiguity. +SET @customer_area_old_dict_exists := ( + SELECT COUNT(1) FROM `sys_dict_type` WHERE `dict_type` = 'data_area_type' +); +SET @customer_area_new_dict_exists := ( + SELECT COUNT(1) FROM `sys_dict_type` WHERE `dict_type` = 'customer_area' +); +SET @customer_area_dict_value_conflicts := ( + SELECT COUNT(1) + FROM `sys_dict_data` old_data + JOIN `sys_dict_data` new_data ON old_data.`dict_value` = new_data.`dict_value` + WHERE old_data.`dict_type` = 'data_area_type' + AND new_data.`dict_type` = 'customer_area' +); + +SET @customer_area_dict_data_sql := IF( + @customer_area_old_exists = 0 AND @customer_area_new_exists = 1 + AND (@customer_area_old_dict_exists = 1 OR @customer_area_new_dict_exists = 1) + AND @customer_area_dict_value_conflicts = 0 + AND NOT (@customer_area_old_dict_exists = 1 AND @customer_area_new_dict_exists = 1), + 'UPDATE `sys_dict_data` SET `dict_type` = ''customer_area'' WHERE `dict_type` = ''data_area_type''', + 'SELECT 1' +); +PREPARE customer_area_stmt FROM @customer_area_dict_data_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +SET @customer_area_dict_type_sql := CASE + WHEN @customer_area_old_exists = 0 AND @customer_area_new_exists = 1 + AND @customer_area_old_dict_exists = 1 AND @customer_area_new_dict_exists = 0 + AND @customer_area_dict_value_conflicts = 0 THEN + 'UPDATE `sys_dict_type` SET `dict_type` = ''customer_area'', `dict_name` = ''客户区域'', `update_time` = NOW() WHERE `dict_type` = ''data_area_type''' + WHEN @customer_area_old_exists = 0 AND @customer_area_new_exists = 1 + AND @customer_area_old_dict_exists = 0 AND @customer_area_new_dict_exists = 1 + AND @customer_area_dict_value_conflicts = 0 THEN + 'UPDATE `sys_dict_type` SET `dict_name` = ''客户区域'', `update_time` = NOW() WHERE `dict_type` = ''customer_area''' + ELSE 'SELECT 1' +END; +PREPARE customer_area_stmt FROM @customer_area_dict_type_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; + +SET @customer_area_old_dict_exists := ( + SELECT COUNT(1) FROM `sys_dict_type` WHERE `dict_type` = 'data_area_type' +); +SET @customer_area_new_dict_exists := ( + SELECT COUNT(1) FROM `sys_dict_type` WHERE `dict_type` = 'customer_area' +); + +SELECT CASE + WHEN @customer_area_old_exists <> 0 OR @customer_area_new_exists <> 1 THEN 'BLOCKED: finish customer column migration first' + WHEN @customer_area_old_dict_exists = 0 AND @customer_area_new_dict_exists = 1 + AND @customer_area_dict_value_conflicts = 0 THEN 'READY' + WHEN @customer_area_old_dict_exists = 1 AND @customer_area_new_dict_exists = 1 THEN 'BLOCKED: both dictionary types exist; merge them manually' + WHEN @customer_area_dict_value_conflicts > 0 THEN 'BLOCKED: dictionary values overlap; reconcile them manually' + ELSE 'MISSING: verify the customer area dictionary in the selected database' + END AS dictionary_migration_status, + @customer_area_dict_value_conflicts AS overlapping_values; + +SELECT `dict_id`, `dict_name`, `dict_type`, `status` +FROM `sys_dict_type` +WHERE `dict_type` IN ('data_area_type', 'customer_area') +ORDER BY `dict_id`; + +SELECT `dict_code`, `dict_type`, `dict_value`, `dict_label`, `status` +FROM `sys_dict_data` +WHERE `dict_type` IN ('data_area_type', 'customer_area') +ORDER BY `dict_type`, `dict_sort`, `dict_code`; + +SET @customer_area_dict_conflict_rows_sql := IF( + @customer_area_dict_value_conflicts > 0, + 'SELECT old_data.`dict_value`, old_data.`dict_label` AS old_label, new_data.`dict_label` AS new_label FROM `sys_dict_data` old_data JOIN `sys_dict_data` new_data ON old_data.`dict_value` = new_data.`dict_value` WHERE old_data.`dict_type` = ''data_area_type'' AND new_data.`dict_type` = ''customer_area'' ORDER BY old_data.`dict_value`', + 'SELECT ''No overlapping dictionary values'' AS conflict_check' +); +PREPARE customer_area_stmt FROM @customer_area_dict_conflict_rows_sql; +EXECUTE customer_area_stmt; +DEALLOCATE PREPARE customer_area_stmt; diff --git a/bms-front/src/views/customersuppliermanagement/customerinfo/customeredit/index.vue b/bms-front/src/views/customersuppliermanagement/customerinfo/customeredit/index.vue index dc6a4167..d6b08539 100644 --- a/bms-front/src/views/customersuppliermanagement/customerinfo/customeredit/index.vue +++ b/bms-front/src/views/customersuppliermanagement/customerinfo/customeredit/index.vue @@ -63,10 +63,10 @@ - - + + - + - + - + @@ -349,7 +349,7 @@ const columnDefs = [ { key: 'customerCodeDw', label: '对外代码' }, { key: 'creditCode', label: '统一社会信用代码' }, { key: 'customerType', label: '业务类型' }, - { key: 'areaType', label: '区域类型' }, + { key: 'customerArea', label: '客户区域' }, { key: 'isEnable', label: '启用状态' }, { key: 'salesUserId', label: '业务员' }, // { key: 'ed', label: '资金额度' }, @@ -378,7 +378,7 @@ const single = ref(true) const multiple = ref(true) const total = ref(0) -const { sys_normal_disable, settlement_type, customer_type, data_area_type } = useDict("sys_normal_disable", "settlement_type", "customer_type", "data_area_type") +const { sys_normal_disable, settlement_type, customer_type, customer_area } = useDict("sys_normal_disable", "settlement_type", "customer_type", "customer_area") /** 绑定产品代码串 -> 产品名称展示(产品代码+名称;查不到的产品回显原代码) */ const { ensureProducts, getProductLabel } = useProducts() @@ -412,7 +412,7 @@ const copyColumns = computed(() => [ { key: 'customerCodeDw', label: '对外代码', get: r => r.customerCodeDw || '' }, { key: 'creditCode', label: '统一社会信用代码', get: r => r.creditCode || '' }, { key: 'customerType', label: '业务类型', get: r => proxy.selectDictLabel(customer_type.value, r.customerType) }, - { key: 'areaType', label: '区域类型', get: r => proxy.selectDictLabel(data_area_type.value, r.areaType) }, + { key: 'customerArea', label: '客户区域', get: r => proxy.selectDictLabel(customer_area.value, r.customerArea) }, { key: 'isEnable', label: '启用状态', get: r => proxy.selectDictLabel(sys_normal_disable.value, r.isEnable) }, { key: 'salesUserId', label: '业务员', get: r => r.salesUserNickName || '' }, { key: 'zq', label: '回款账期', get: r => (r.zq === null || r.zq === undefined ? '' : r.zq) }, @@ -445,7 +445,7 @@ const data = reactive({ keywords: undefined, creditCode: undefined, customerType: undefined, - areaType: undefined, + customerArea: undefined, isEnable: undefined, salesUserId: undefined, salesUser: undefined,