@Wahson
2020-09-07T01:39:03.000000Z
字数 9607
阅读 1052
周报 Wanbo周报
- 运营系统优化已上线
- 客户多个抬头,跟进问题,交易数据统计
- 增加客户抬头关联申请,公司列表【抬头关联】
- 增加【抬头关联申请】列表页,增加审批操作
- 调整采购商查询接口,最近成交时间,订单数,最近跟进时间,按照所有抬头汇总计算
- 调整自动掉客户定时器,同样按照所有抬头汇总计算
- 已申请付款的采购单,异常取消时,还原额度
- 订单修改抬头,重新计算新单标识
- 应开票,扣减货损
- 增加交易员客户库容限制,增加公海客户领用限制,已开发完成
- 资金账户管理 陈均活 梁荣生 曹佳林 https://app.yinxiang.com/fx/b9936dfe-0da5-4895-800c-670118421cb8
- 服务端
- 充值接口
- 新建提现申请接口
- 审核提现申请接口
- 提现申请完成接口
- 取消提现申请接口
- 资金账户总额,提现金额,充值金额,冻结金额
- 付款指令重构
- 不变量bank_journal 调整
- 前端
- 流水认领方式:实体单认领,提现认领,充值认领,费用分配
- 资金账户统计页面
- 小程序增加提现申请页面,
- 运营系统增加提现申请列表,审核
- 小程序个人中心,显示资金账户余额、冻结金额
- 付款指令列表增加付款原因显示
- 付款指令申请页面,显示供应商预付款金额
- 部分供应商按暂定价付款,随后修改结算价问题优化
- 资金利息按照实付计算
- 多出金额存入预付账户用以抵扣下次货款
- 数据明细,资金利息计算调整
- 运营系统优化 陈均活 曹佳林
- 创建订单计算预计金融费用 梁华生
- 利润核算模块设计 梁华生
- 产品经理模式
use crm_db;create table company_account(id bigint not null primary key auto_increment,company_id bigint not null comment '公司id',type smallint(2) default 1 not null comment '账户类型,1:资金账户(capital);2:预付账户(prepay)',-- 可用金额 = 账户余额 - 冻结余额balance decimal(13, 2) default 0.00 not null comment '账户余额',frozen_balance decimal(13, 2) default 0.00 not null comment '账户冻结余额',created_at timestamp default current_timestamp() not null,created_by int default 0 not null,updated_at timestamp default current_timestamp() not null,updated_by int default 0 not null,remark varchar(255) null comment '备注',constraint vr_2_company foreign key (company_id) references company (id)) engine = innoDb charset = utf8mb4 comment '公司账户';create table account_journal(id bigint auto_increment primary key,company_account_id bigint not null comment '公司账号id',company_id int(10) not null comment '公司id',bank_journal_id bigint default null comment '银行流水id',account_apply_id bigint default null comment '提现/充值申请id, 业务类型为提现或充值时有值',src_payment_id bigint default null comment '支付记录id, 业务类型为货款转预付时有值,',payment_id bigint default null comment '支付记录id, 业务类型为货款时有值,该字段值为对应订单/采购单付款记录的id',trans_type smallint(2) default 1 not null comment '交易类型,1:收入(income);2:支出(expenditure);3:冻结(freeze);4:解冻(unfreeze);',business_type smallint(2) default 10 not null comment '业务类型,10:提现(withdrawal);20:充值(recharge);30:货款(payment);40:拍卖(auction);50:货款转预付(payment_to_prepay);90:其他(other)',amount decimal(13, 2) not null comment '流水金额',last_balance decimal(13, 2) default 0.00 null comment '上一次金额',balance decimal(13, 2) not null comment '操作后的人民币余额',frozen_balance decimal(13, 2) not null comment '操作后的人民币冻结余额',frozen_related_journal_id int(10) null comment '冻结关联流水, 交易类型是解冻时有值',created_at timestamp default current_timestamp() not null,created_by int default 0 not null,updated_at timestamp default current_timestamp() not null,updated_by int default 0 not null,remark varchar(255) null comment '备注') engine = innoDb charset = utf8mb4 comment '公司账户变更流水';-- 流水账户总余额select sum(amount) from account_journalwhere 1 = 1 and trans_type in (1, 2)-- and created_at > current_date -- 当天账户变更-- group by company_account_id-- 流水冻结总额select sum(amount) from account_journalwhere 1 = 1 and trans_type in (3, 4)-- and created_at > current_date -- 当天账户变更-- group by company_account_id-- 资金账户总金额,冻结总金额select sum(balance), sum(frozen_balance) from company_account;-- 当日提现、充值总额select sum(if(business_type = 10, amount, 0)), sum(if(business_type = 20, amount, 0))from account_journal where created_at > current_date--create table account_application(id bigint auto_increment primary key,company_account_id bigint not null comment '账户id',company_id bigint not null comment '公司ID',company_name varchar(100) not null comment '公司名称',wx_user_id int default null comment '发起申请的微信用户id',type smallint(2) default 1 not null comment '申请类型,1:提现(withdraw);2:充值(recharge)',status smallint(2) default 1 not null comment '状态,10:待审核(to_be_audited);20:已审核(audited);30:已完成(finished);90:已取消(canceled)',amount decimal(10, 2) not null comment '金额',bank_journal_id bigint default null comment '银行流水id',# 冗余字段,来源银行流水表 bank_journal# platform_account varchar(32) null comment '平台银行账号',# platform_account_name varchar(64) not null comment '平台银行户名',# bank_account varchar(32) null comment '收付款银行账号',# bank_account_name varchar(64) not null comment '收付款银行户名',audited_at datetime null comment '审核时间',audited_by int(10) null comment '审核人',confirmed_at datetime null comment '确认时间',confirmed_by int(10) null comment '确认人',created_at timestamp default current_timestamp() not null,created_by int default 0 not null,updated_at timestamp default current_timestamp() not null,updated_by int default 0 not null,remark varchar(255) null comment '备注',constraint aa_2_company foreign key (company_id) references company (id)) engine = innoDb charset = utf8mb4 comment '充值申请';-- 拍卖create table auction_target(id bigint auto_increment primary key,purchase_item_id bigint not null comment '采购子单id',delivery_type smallint(2) not null comment '送货方式, 10:自提(self_pick);20:供应商配送(supplier_deliver);30:万博配送(wanbo_deliver)',product_id int not null,category varchar(12) not null comment '产品分类',designation varchar(32) not null comment '产品牌号',manufacturer_id int not null comment '生产商ID',manufacturer_name varchar(32) not null comment '生产商名称',supplier_company_id int not null comment '供应商id',supplier_company_name varchar(32) not null comment '供应商名称',warehouse_id int not null comment '发货仓库id',warehouse_name varchar(32) not null comment '发货仓库名称',status smallint(1) default 1 null comment '状态(1:预提交,2:待审核,3:已审核 4:拍卖中,5:拍卖完成,6:流拍,9:审核不通过,10:取消)',starting_price decimal(13, 2) default 0.00 not null comment '起拍价',market_price decimal(13, 2) null comment '市场评估价',weight decimal(8, 3) default 0.000 not null comment '拍卖总吨数',starting_weight decimal(8, 3) not null comment '起拍吨数',price_increment decimal(10, 2) not null comment '加价幅度',weight_increment decimal(8, 3) not null comment '数量增幅(最小变量单位或每次增加吨数)',-- auction_type smallint(1) default 1 not null comment '竞拍方式,1:升价(priceRise);2:降价(priceCut )',deposit_ratio decimal(3, 3) not null comment '保证金比例',-- basic_deposit decimal(10, 2) null comment '保证金基础值',auction_start_at datetime not null comment '开始拍卖时间',expected_auction_end_at datetime not null comment '预定结束拍卖时间',actual_auction_end_at datetime null comment '实际拍卖结束时间',-- 期货交货时间?-- trade_addr varchar(50) null comment '交易地点',-- weight_left decimal(13, 3) null comment '剩余吨数',is_future smallint(1) default 0 not null comment '是否期货 0为false, 1为true',execute_start_at date null comment '送货/交付日期开始',execute_end_at date null comment '送货/交付日期结束',audited_at datetime null comment '审核时间',audited_by int(10) null comment '审核人',created_at timestamp default current_timestamp() not null,created_by int default 0 not null,updated_at timestamp default current_timestamp() not null,updated_by int default 0 not null,remark varchar(255) null comment '备注') engine = innoDb charset = utf8mb4 comment '拍卖标的';create table auction_bid_record(id int(10) auto_incrementprimary key,wx_user_id int(10) not null comment '用户id',company_id int(10) not null,auction_target_id int(10) not null comment '竞拍标的ID',price_before_bid decimal(10, 2) default 0.00 not null comment '拍前价格',bid_price decimal(10, 2) not null comment '出价',weight decimal(8, 3) not null comment '拍卖吨数',actual_weight decimal(8, 3) default 0.000 not null comment '实际中标吨数(为0则为出局)',-- account_journal_id int(10) not null comment '账户资金变动流水ID',-- margin decimal(10, 2) default 0.00 not null comment '冻结保证金',auction_at datetime not null comment '出价时间',created_at timestamp default current_timestamp() not null,created_by int default 0 not null,updated_at timestamp default current_timestamp() not null,updated_by int default 0 not null,remark varchar(255) null comment '备注',constraint bid_records_fk_target_idforeign key (auction_target_id) references auction_target (id)) engine = innoDb charset = utf8mb4 comment '出价记录';-- auto-generated definitioncreate table auction_target_summary(id bigint auto_increment primary key,target_id int(10) default 0 not null comment '竞拍标的ID',won_user_count int(10) default 0 not null comment '中标人数',bid_user_count int(10) default 0 not null comment '投注人数',bid_count int(10) default 0 not null comment '投注次数',weight decimal(8, 3) default 0.000 not null comment '成交吨数',amount decimal(13, 2) default 0.00 not null comment '成交金额',max_price decimal(10, 2) default 0.00 not null comment '最高价',min_price decimal(10, 2) default 0.00 not null comment '最低价',constraint target_summary_fk_target_idforeign key (target_id) references auction_target (id)) engine = innoDb charset = utf8mb4 comment '竞拍商品摘要';-- auto-generated definitioncreate table auction_won_record(id int(10) auto_incrementprimary key,company_id bigint not null comment '公司id',auction_bid_record_id bigint not null comment '出价记录',auction_target_id bigint not null comment '标的id',price decimal(10, 2) not null comment '中标价',weight decimal(8, 3) not null comment '中标数量',total_amount decimal(10, 2) not null comment '中标金额',-- order_no varchar(32) not null comment '关联销售订单号',-- status smallint(1) not null comment '状态(1:待确认,2:成功,3:违约,4:违约已处理)',created_at datetime not null,created_by int(10) null comment '创建人,只能是StaffID',updated_at timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,updated_by int(10) null comment '更新人,只能是StaffID',constraint wined_record_fk_bid_record_idforeign key (auction_bid_record_id) references auction_bid_record (id),constraint wined_record_fk_target_idforeign key (auction_target_id) references auction_target (id)) engine = innoDb charset = utf8mb4 comment '中标记录';use payment_db;create table payment_application(id bigint auto_incrementprimary key,status smallint(2) not null comment '指令状态,10:待确认(to_be_confirmed);20:已确认(confirmed);30:已制单(voucher_made);40:支付中(paying);50:已支付(paid);60:已撤销(revoked)',reason smallint(2) not null comment '付款原因,10:货款(to_be_confirmed);20:仓租(confirmed);30:账户提现(voucher_made);90:其他(other)',purchase_id bigint default null comment '采购单id',company_id int default null comment '公司id',company_name varchar(64) default null comment '公司名称',bank_name varchar(64) default '' not null comment '收款银行',bank_no varchar(32) not null comment '收款银行账号',platform_bank_name varchar(64) null comment '平台付款银行',platform_bank_no varchar(64) null comment '平台付款帐号',amount decimal(13, 2) default 0.00 not null comment '付款金额',file_name varchar(128) null comment '支付完成后上传水单至阿里云OSS',confirmed_at timestamp default null comment '确认时间',confirmed_by int default null comment '确认人',created_at timestamp default current_timestamp() not null,created_by int default 0 not null,updated_at timestamp default current_timestamp() not null,updated_by int default 0 not null,is_sent_attachment smallint(2) default 0 not null comment '是否已发送水单',remark varchar(255) null comment '备注',rmk varchar(255) null comment '系统备注',key idx_created_at(created_at),key idx_purchase_id(purchase_id),key idx_company_id(company_id)) engine = innoDb comment '付款申请' charset = utf8mb4;