统一将 bms_region 替换为 region,更新相关注释和文档以反映这一变化。

This commit is contained in:
wuweihua
2026-09-29 08:57:41 +08:00
parent 0ad90f6183
commit b8e1f8cd40
23 changed files with 68 additions and 54 deletions
@@ -24,7 +24,7 @@ import com.bms.price.domain.PrcZoneRegion;
import com.bms.price.service.IPrcZoneService;
/**
* Zone management: bms_region -> zone -> postcode detail
* Zone management: region -> zone -> postcode detail
*/
@RestController
@RequestMapping("/price/zone")
@@ -33,7 +33,7 @@ public class ZoneController extends BaseController
@Autowired
private IPrcZoneService zoneService;
// ========== countries that already have zones (from bms_region) ==========
// ========== countries that already have zones (from region) ==========
@PreAuthorize("@ss.hasPermi('price:zone:list')")
@GetMapping("/country/list")
@@ -96,11 +96,11 @@ price.zone.import.noSheet=未找到可导入的分区 sheet(澳大利亚分区
price.zone.import.noData=分区 sheet 无有效邮编/分区数据
price.zone.import.success=导入成功:{0} 个国家,{1} 个分区,{2} 条邮编明细({3})
price.zone.import.unmatched=;未匹配国家已跳过:{0}
price.zone.import.regionNotFound=未在 bms_region 匹配到国家:{0}
price.zone.import.regionEmpty=bms_region 无可用国家数据,请先同步/维护国家表
price.zone.import.regionNotFound=未在 region 匹配到国家:{0}
price.zone.import.regionEmpty=region 无可用国家数据,请先同步/维护国家表
price.zone.region.notFound=国家不存在或已删除
price.zone.region.required=请选择国家(bms_region)
price.zone.countryCode.empty=国家编码不能为空,请检查 bms_region.country_code_2
price.zone.region.required=请选择国家(region)
price.zone.countryCode.empty=国家编码不能为空,请检查 region.country_code_2
# 产品导入 BmsProduct
price.product.codeDate.exists=同一产品代码与生效日期已存在,不能覆盖历史数据
price.product.effectiveDate.empty=生效日期不能为空
@@ -109,7 +109,7 @@ price.product.import.fileEmpty=上传文件不能为空
price.product.import.fileType=仅支持 xls / xlsx 文件
price.product.import.sheetNotFound=未找到「产品目录」sheet,请上传威狮B2C小包价表格格式文件
price.product.import.noData=产品目录无有效数据行
price.product.import.regionEmpty=bms_region 无可用国家数据,请先同步/维护国家表后再导入
price.product.import.regionEmpty=region 无可用国家数据,请先同步/维护国家表后再导入
price.product.import.partialFail=导入完成但存在失败项:新增 {0},跳过 {1};失败明细:{2}
price.product.import.effTooEarly=生效日期 {0} 早于当前开放版 {1},请使用更晚的生效日期导入
price.product.import.needFeeAlter=请先执行 SQL:bms-back/sql/price/product_country_fee_alter.sql(缺少运费/挂号费字段)
@@ -117,7 +117,7 @@ price.product.import.needExpireAlter=请先执行 SQL:bms-back/sql/price/produ
price.product.import.needCodeEffUnique=无法新增「同代码、不同生效日」的产品。请先执行 SQL:bms-back/sql/price/product_code_eff_unique_alter.sql(去掉 product_code 单列唯一,改为代码+生效日唯一)
price.product.import.success=导入成功:新增 {0} 个产品,跳过 {1} 个(同代码同生效日不覆盖);写入国家/重量段明细 {2} 行。
price.product.import.success.detail1=产品主数据按「产品代码+生效日期」新增,不覆盖已有记录。国家明细:新生效日晚于上次则新建版本并复制上一版,上次失效日=本次生效日;导入行匹配到则更新,未匹配则插入。
price.product.import.success.detail2=范围:产品目录 + 重量段 + 运费/挂号费 + 尺寸/尾程/时效;国家码来自 bms_region。
price.product.import.success.detail2=范围:产品目录 + 重量段 + 运费/挂号费 + 尺寸/尾程/时效;国家码来自 region。
price.product.import.noSheet=未找到产品明细sheet(需与产品名称一致):{0}
price.product.import.noCountry=产品明细sheet无有效国家/重量段数据:{0}
price.product.import.euEmpty=国家表无欧盟成员(is_eu=1),无法展开「欧盟」
@@ -5,7 +5,7 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/** Zone under bms_region: prc_zone */
/** Zone under region: prc_zone */
@Data
public class PrcZone implements Serializable
{
@@ -25,6 +25,6 @@ public class PrcZone implements Serializable
private Date updateTime;
/** list display, not a table column */
private Integer detailCount;
/** list display from bms_region */
/** list display from region */
private String countryNameCn;
}
@@ -4,7 +4,7 @@ import java.io.Serializable;
import lombok.Data;
/**
* Zone country list row: bms_region + zone aggregates (not a table)
* Zone country list row: region + zone aggregates (not a table)
*/
@Data
public class PrcZoneRegion implements Serializable
@@ -49,7 +49,7 @@ public interface IBmsProductService
* The destination country is chosen by the user, not read from the sheet.
*
* @param file uploaded xlsx/xls
* @param countryCode ISO country code (bms_region.country_code_2)
* @param countryCode ISO country code (region.country_code_2)
* @param operName operator
* @return HTML result message
*/
@@ -18,7 +18,7 @@ public interface IPrcBillingTaskService
List<PrcBillingTask> selectList(PrcBillingTask query);
/**
* Manual resync: reset to WAITING then process again.
* Manual resync: reset to WAITING then process again (including SUCCESS for correction).
* @return task after retry
*/
PrcBillingTask retryTask(Long taskId);
@@ -12,7 +12,7 @@ public interface IPrcZoneService
public List<PrcZoneRegion> selectZoneRegionList(PrcZoneRegion query);
/** Delete all zones (and details) for the given bms_region ids */
/** Delete all zones (and details) for the given region ids */
public int deleteZonesByRegionIds(Long[] regionIds);
public PrcZone selectPrcZoneById(Long zoneId);
@@ -1179,7 +1179,7 @@ public class BmsProductServiceImpl implements IBmsProductService
}
/**
* Load bms_region map: country_name_cn -> region (for country_code_2).
* Load region map: country_name_cn -> region (for country_code_2).
*/
private Map<String, BmsRegion> loadRegionByNameCn()
{
@@ -342,12 +342,8 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
{
throw new ServiceException("billing task not found");
}
String st = task.getSuccessStatus();
if (BillTaskSuccessStatus.SUCCESS.getCode().equals(st))
{
throw new ServiceException("SUCCESS task cannot retry");
}
// Reset to WAITING so UI reflects re-queue; then sync process (admin expects immediate result).
// Allow SUCCESS retry: billing result may be wrong and needs re-run.
// Reset to WAITING so processTask does not short-circuit on SUCCESS; then sync process.
PrcBillingTask reset = new PrcBillingTask();
reset.setTaskId(taskId);
reset.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
@@ -36,7 +36,7 @@ import com.bms.system.domain.BmsRegion;
import com.bms.system.mapper.BmsRegionMapper;
/**
* Zone management: bms_region -> prc_zone -> postcode detail
* Zone management: region -> prc_zone -> postcode detail
*/
@Service
public class PrcZoneServiceImpl implements IPrcZoneService
@@ -6,7 +6,7 @@ import com.bms.common.annotation.Excel;
import com.bms.common.core.domain.BaseEntity;
/**
* 国家/区域 bms_region
* 国家/区域 region
*
* @author bms
*/
@@ -6,7 +6,7 @@ import com.bms.common.annotation.Excel;
import com.bms.common.core.domain.BaseEntity;
/**
* 区域数据同步日志 bms_region_sync_log
* 区域数据同步日志 region_sync_log
*
* @author bms
*/
@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
continent, sub_region, currency_code, currency_name, currency_symbol,
phone_prefix, flag_emoji, flag_url, is_independent, is_eu,
status, del_flag, create_by, create_time, update_by, update_time, remark
from bms_region
from region
</sql>
<select id="selectRegionById" parameterType="Long" resultMap="BmsRegionResult">
@@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertRegion" parameterType="BmsRegion" useGeneratedKeys="true" keyProperty="regionId">
insert into bms_region (
insert into region (
<if test="countryNameCn != null">country_name_cn,</if>
<if test="countryNameEn != null and countryNameEn != ''">country_name_en,</if>
<if test="countryCode2 != null and countryCode2 != ''">country_code_2,</if>
@@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateRegion" parameterType="BmsRegion">
update bms_region
update region
<set>
<if test="countryNameCn != null">country_name_cn = #{countryNameCn},</if>
<if test="countryNameEn != null and countryNameEn != ''">country_name_en = #{countryNameEn},</if>
@@ -145,14 +145,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteRegionByIds" parameterType="Long">
delete from bms_region where region_id in
delete from region where region_id in
<foreach item="regionId" collection="array" open="(" separator="," close=")">
#{regionId}
</foreach>
</delete>
<insert id="upsertByCode2" parameterType="BmsRegion">
insert into bms_region (
insert into region (
country_name_cn, country_name_en, country_code_2, country_code_3,
continent, sub_region, currency_code, currency_name, currency_symbol,
phone_prefix, flag_emoji, flag_url, is_independent, is_eu,
@@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectSyncLogVo">
select log_id, sync_type, status, total_count, insert_count, update_count,
fail_count, duration_ms, error_msg, create_by, create_time, update_by, update_time
from bms_region_sync_log
from region_sync_log
</sql>
<select id="selectSyncLogById" parameterType="Long" resultMap="BmsRegionSyncLogResult">
@@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertSyncLog" parameterType="BmsRegionSyncLog" useGeneratedKeys="true" keyProperty="logId">
insert into bms_region_sync_log (
insert into region_sync_log (
<if test="syncType != null and syncType != ''">sync_type,</if>
<if test="status != null and status != ''">status,</if>
<if test="totalCount != null">total_count,</if>
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateSyncLog" parameterType="BmsRegionSyncLog">
update bms_region_sync_log
update region_sync_log
<set>
<if test="status != null and status != ''">status = #{status},</if>
<if test="totalCount != null">total_count = #{totalCount},</if>
@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteSyncLogByIds" parameterType="Long">
delete from bms_region_sync_log where log_id in
delete from region_sync_log where log_id in
<foreach item="logId" collection="array" open="(" separator="," close=")">
#{logId}
</foreach>
@@ -54,10 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND fail_code = #{failCode}
</if>
<if test="params.beginTime != null and params.beginTime != ''">
AND create_time &gt;= #{params.beginTime}
AND date_format(bill_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
AND create_time &lt;= #{params.endTime}
AND date_format(bill_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
order by task_id desc
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.country_name_cn,
(select count(1) from prc_zone_detail d where d.zone_id = z.zone_id) as detail_count
from prc_zone z
left join bms_region r on r.region_id = z.region_id
left join region r on r.region_id = z.region_id
<where>
<if test="regionId != null">
AND z.region_id = #{regionId}
@@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
count(distinct z.zone_id) as zone_count,
count(d.detail_id) as detail_count
from prc_zone z
inner join bms_region r on r.region_id = z.region_id
inner join region r on r.region_id = z.region_id
left join prc_zone_detail d on d.zone_id = z.zone_id
<where>
<if test="countryNameCn != null and countryNameCn != ''">
@@ -99,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(select count(1) from prc_zone_detail d
inner join prc_zone z on z.zone_id = d.zone_id
where z.region_id = r.region_id) as detail_count
from bms_region r
from region r
where r.region_id = #{regionId}
</select>
+7 -7
View File
@@ -344,9 +344,9 @@ CREATE TABLE `product_country` (
) ENGINE=InnoDB AUTO_INCREMENT=1609 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='产品国家服务明细-重量段+尺寸/尾程/时效(不含运费)';
-- ----------------------------
-- 表结构:`bms_region`
-- 表结构:`region`
-- ----------------------------
CREATE TABLE `bms_region` (
CREATE TABLE `region` (
`region_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '区域ID',
`country_name_cn` varchar(100) DEFAULT NULL COMMENT '中文名',
`country_name_en` varchar(100) NOT NULL COMMENT '英文名',
@@ -377,9 +377,9 @@ CREATE TABLE `bms_region` (
) ENGINE=InnoDB AUTO_INCREMENT=247 DEFAULT CHARSET=utf8mb4 COMMENT='国家/区域表';
-- ----------------------------
-- 表结构:`bms_region_sync_log`
-- 表结构:`region_sync_log`
-- ----------------------------
CREATE TABLE `bms_region_sync_log` (
CREATE TABLE `region_sync_log` (
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志ID',
`sync_type` varchar(20) NOT NULL DEFAULT 'ALL' COMMENT '同步类型(ALL全量)',
`status` varchar(20) NOT NULL DEFAULT 'PROCESSING' COMMENT '状态(PENDING/PROCESSING/SUCCESS/FAILED)',
@@ -1514,8 +1514,8 @@ CREATE TABLE `prc_weight_section_template` (
-- ----------------------------
CREATE TABLE `prc_zone` (
`zone_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'zone id',
`region_id` bigint(20) NOT NULL COMMENT 'bms_region.region_id',
`country_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ISO2 country code from bms_region',
`region_id` bigint(20) NOT NULL COMMENT 'region.region_id',
`country_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ISO2 country code from region',
`zone_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'zone code e.g. 1',
`zone_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'display name e.g. AU(1)',
`zone_sort` int(11) DEFAULT '0' COMMENT 'sort',
@@ -1526,7 +1526,7 @@ CREATE TABLE `prc_zone` (
UNIQUE KEY `uk_zone_region_code` (`region_id`,`zone_code`),
KEY `idx_zone_region_id` (`region_id`),
KEY `idx_zone_country_code` (`country_code`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone under bms_region';
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone under region';
-- ----------------------------
-- 表结构:`prc_zone_detail`
+16
View File
@@ -0,0 +1,16 @@
-- Rename region tables (drop bms_ prefix)
SET NAMES utf8mb4;
SET @t := (
SELECT TABLE_NAME FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'bms_region' LIMIT 1
);
SET @sql := IF(@t IS NULL, 'SELECT 1', 'RENAME TABLE bms_region TO region');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @t := (
SELECT TABLE_NAME FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'bms_region_sync_log' LIMIT 1
);
SET @sql := IF(@t IS NULL, 'SELECT 1', 'RENAME TABLE bms_region_sync_log TO region_sync_log');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
+2 -2
View File
@@ -1,6 +1,6 @@
import request from '@/utils/request'
// ========== countries that have zones (from bms_region) ==========
// ========== countries that have zones (from region) ==========
export function listCountry(query) {
return request({
@@ -17,7 +17,7 @@ export function getCountry(regionId) {
})
}
/** Delete all zones + postcodes for region(s); does not delete bms_region */
/** Delete all zones + postcodes for region(s); does not delete region */
export function delCountryZones(regionIds) {
return request({
url: '/price/zone/country/' + regionIds,
@@ -37,7 +37,6 @@
link
type="warning"
icon="Refresh"
:disabled="row.successStatus === 'SUCCESS'"
:loading="retryingId === row.taskId"
v-hasPermi="['monitor:billingTask:retry']"
@click="handleRetry(row)"
@@ -131,7 +130,8 @@ const searchColumns = [
{ label: '失败码', prop: 'failCode', component: 'select', options: failCodeOptions, placeholder: '请选择失败码', width: '220px', props: { clearable: true, filterable: true } },
{ label: '订单号', prop: 'orderNo', component: 'input', placeholder: '订单号', width: '180px' },
{ label: '运单号', prop: 'trackingNo', component: 'input', placeholder: '运单号', width: '180px' },
{ label: '转单号', prop: 'transferNo', component: 'input', placeholder: '转单号', width: '180px' }
{ label: '转单号', prop: 'transferNo', component: 'input', placeholder: '转单号', width: '180px' },
{ label: '计费时间', prop: 'dateRange', component: 'daterange', width: '308px' }
]
const columns = [
@@ -149,7 +149,9 @@ const columns = [
]
function queryList(params) {
return listBillingTask(params)
const p = proxy.addDateRange({ ...params }, params.dateRange)
delete p.dateRange
return listBillingTask(p)
}
function billTypeLabel(type) {
@@ -172,7 +172,7 @@ function handleZoneDelete(zoneIds) {
function handleClearZones() {
if (!selectedRegionId.value) return
proxy.$modal.confirm('是否清空国家 regionId="' + selectedRegionId.value + '" 下的全部分区与邮编?(不会删除 bms_region 国家主数据)').then(() => {
proxy.$modal.confirm('是否清空国家 regionId="' + selectedRegionId.value + '" 下的全部分区与邮编?(不会删除 region 国家主数据)').then(() => {
return delCountryZones(selectedRegionId.value)
}).then(() => {
zoneList.value = []
@@ -35,7 +35,7 @@ import { addZone, updateZone } from '@/api/price/zone'
const { proxy } = getCurrentInstance()
const props = defineProps({
/** 当前抽屉选中的国家(bms_region 行) */
/** 当前抽屉选中的国家(region 行) */
country: {
type: Object,
default: null
@@ -5,7 +5,7 @@
:closable="false"
show-icon
class="mb16"
title="国家来自 bms_region;点击「分区」在抽屉中查看/维护国家分区,抽屉内点击「分区点击」查看邮编明细。导入 Excel 时需 sheet 名以「分区」结尾且能匹配国家表。"
title="国家来自 region;点击「分区」在抽屉中查看/维护国家分区,抽屉内点击「分区点击」查看邮编明细。导入 Excel 时需 sheet 名以「分区」结尾且能匹配国家表。"
/>
<basic-table
@@ -94,7 +94,7 @@ function onZoneChanged() {
}
function handleCountryDelete(regionIds) {
proxy.$modal.confirm('是否清空国家 regionId="' + regionIds + '" 下的全部分区与邮编?(不会删除 bms_region 国家主数据)').then(() => {
proxy.$modal.confirm('是否清空国家 regionId="' + regionIds + '" 下的全部分区与邮编?(不会删除 region 国家主数据)').then(() => {
return delCountryZones(regionIds)
}).then(() => {
countryTableRef.value.refresh()