Skip to content

新版配送单

数据库

新增两张表

新的配送单配置表

CREATE TABLE `tbl_distribute_config_2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '打印模版配置的名称',
  `creator` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建模版的用户的 username',
  `station_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_default` tinyint(1) NOT NULL COMMENT '一个站点只有一个默认模版',
  `content` json NOT NULL COMMENT '前端传的一个大字典,后端并不关系它的内容',
  `delete_time` datetime NOT NULL COMMENT 'delete_time 为 datetime.min 代表没有被删除',
  `modify_time` datetime NOT NULL,
  `create_time` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `station_id_and_name` (`station_id`,`name`,`delete_time`)
) ENGINE=InnoDB AUTO_INCREMENT=14207 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

新的配送单商户绑定表

CREATE TABLE `tbl_distribute_config_address_2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `config_id` int(11) NOT NULL COMMENT '打印模版配置的名称',
  `address_id` int(11) NOT NULL,
  `station_id` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL,
  `delete_time` datetime NOT NULL COMMENT 'delete_time 为 datetime.min 代表没有被删除',
  `modify_time` datetime NOT NULL,
  `create_time` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `config_id_address_id` (`config_id`,`address_id`,`station_id`,`delete_time`),
  KEY `idx_station_delete_time_address` (`station_id`,`delete_time`,`address_id`)
) ENGINE=InnoDB AUTO_INCREMENT=160511 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

station 加一个临时字段 distribute_config_old_or_new int 1老2新, 默认老


接口改动

admin

新建站点不再使用老模版,所以直接改成新模版

把 TblDistributeConfig 和 TblDistributeConfigAddress 的表名映射到新表上

/station/create

添加默认模版的逻辑,模版格式找前端要新的替换掉老的

station

由于前端技术上的原因,新老模版必然会有一段共存期 所以新加四个和模版相关的接口,逻辑和原来的模版接口一摸一样,只不过url不一样

/station/distribute_config/list 对应 /station/distribute_config/get

/station/distribute_config/delete_new 对应 /station/distribute_config/delete

/station/distribute_config/create

获取模板信息

method
    POST
request
    content dict M 模版配置内容
response
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data:

/station/distribute_config/edit_new

获取模板信息

method
    POST
request
    id int M 模版ID
    content dict O 模版配置内容
    address_ids list O 绑定商户ID列表
    is_default bool O 是否默认模版
response
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data:

/station/distribute_config/get

参数传一个id 返回一个配送模版详情

新加两个接口

/station/distribute_config/old_or_new/get

获取模板信息

method
    GET
request

response
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data: {
        config: int 新旧配置(1旧2新)
    }

/station/distribute_config/old_or_new/set

获取模板信息

method
    POST
request
    config int M 新旧配置(1旧2新)
response
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data:

TODO station/transport/get_order_by_id_new?ids=%5B%22PL3443134%22%5D 加配送单配置字段和字段

脚本

  1. 把老的模版刷到新表的脚本
  2. 统计不同group下有哪些不同的配送单模版配置,方便灰度的安排

数据库表新 Model:TblDistributeConfig2 和 TblDistributeConfigAddress2