Skip to content

财务红冲

财务红冲

数据库表改动

order库:
新增mysql表tbl_strike_revoke_flow存储财务红冲记录

CREATE TABLE `tbl_strike_revoke_flow` (
  `id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '红冲流水id',
  `strike_flow_id` VARCHAR (32) NOT NULL DEFAULT '' COMMENT '对应的冲账流水id',
  `strike_id` int(11) NOT NULL COMMENT '到账凭证id',
  `group_id` int(11) NOT NULL COMMENT 'group_id',
  `station_id` varchar(12) NOT NULL COMMENT '站点ID',
  `order_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '订单号',
  `amount` bigint(11) NOT NULL COMMENT '红冲金额 为负',
  `status` smallint(11) NOT NULL COMMENT '状态',
  `operator_id` int(11) NOT NULL COMMENT '操作人id',
  `operator` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作人姓名',
  `remark` VARCHAR (200) NOT NULL DEFAULT '' COMMENT '摘要',
  `create_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `modify_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `pstatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '物理删除状态0-未删除 1-已删除',
  `extra1` int(11) NOT NULL DEFAULT '0',
  `extra2` int(11) NOT NULL DEFAULT '0',
  `extra3` int(11) NOT NULL DEFAULT '0',
  `extra4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `extra5` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `extra6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
  PRIMARY KEY (`id`),
  INDEX `idx_order_no`(`order_no`)
);

INSERT INTO `tbl_permission` (`name`, `name_en`, `content_type_id`, `codename`, `level2_id`)
VALUES
    ('红字冲账', 'Add Writeback', 32, 'add_writeback', 33);

ALTER TABLE tbl_order_strike_flow ADD is_write_back TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否红冲,0表示未红冲,1表示已红冲';

manage工程

finance/order/trade/flow 改动

接口描述:交易流水增加返回参数和红字冲账流水

method:get

请求:
    不变

响应:
    'data':[{
        新增
        strike_arrival_time     M   date   到账日期
        strike_arrival_method   M   str    到账渠道
        strike_arrival_id       M   str    到账账号
        flow_id                 M   str    流水号
        deal_code               M   str    到账凭证
        is_write_back           M   int    是否已经红冲
    }]

finance/order/update/revoke 新增

接口描述:变动类型为冲账的交易流水进行红冲

method:post

请求:
    flow_id     M   str   流水号
    remark      M   str   摘要

响应:
    {
        'data':[{   红冲失败时返回失败的订单列表
            id                       M   str     订单号
            customer:{               M   dict    商户信息
                address              M   str     店铺地址
                address_id           M   str     店铺ID
                address_sign_id      M   str     区域ID
                extender:{           M   dict    扩展信息
                    resname          M   str     店铺名
                }
                pick_up_st_id        M   int     自提点id
                receive_begin_time   M   str     收货开始时间
                receive_end_time     M   str     收货结束时间
                receive_way          M   int     收货方式
                receiver_name        M   str     收货人姓名
                receiver_phone       M   str     收货人电话
                supply_station_id    M   str     供应站点ID
                uid                  M   str     用户ID
            }           
            total_pay                M   float   销售总额
            pay_status               M   int     结算状态
            real_pay                 M   float   已收金额
            margin                   M   float   差额
            freeze                   M   int     订单锁定状态
            to_strike_amount         M   float   待冲账金额
        }],
        'msg': 'ok',
        'code': 0
    }

finance/strike/balance/revoke 新增

接口描述:批量红字冲账

method:post

请求:
    strike_id     M   str   到账凭证ID

响应:
    {
        'data':[{   红冲失败时返回失败的订单列表
            id                 M   str     订单号
            customer:{               M   dict    商户信息
                address              M   str     店铺地址
                address_id           M   str     店铺ID
                address_sign_id      M   str     区域ID
                extender:{           M   dict    扩展信息
                    resname          M   str     店铺名
                }
                pick_up_st_id        M   int     自提点id
                receive_begin_time   M   str     收货开始时间
                receive_end_time     M   str     收货结束时间
                receive_way          M   int     收货方式
                receiver_name        M   str     收货人姓名
                receiver_phone       M   str     收货人电话
                supply_station_id    M   str     供应站点ID
                uid                  M   str     用户ID
            }
            total_pay          M   float   销售总额
            pay_status         M   int     结算状态
            real_pay           M   float   已收金额
            margin             M   float   差额
            freeze             M   int     订单锁定状态
            to_strike_amount   M   float   待冲账金额
        }],
        'msg': 'ok',
        'code': 0
    }

finance/order/export 改动

接口描述:商户结算导出将备注改成摘要,同时增加类型为红字冲账的流水记录

method:get

请求:
    不变

响应:
    不变