[关闭]
@Wahson 2020-09-07T09:39:03.000000Z 字数 9607 阅读 684

技术--工作周报(2020-09-06)

周报 Wanbo周报


上周回顾

  • 运营系统优化已上线
    • 客户多个抬头,跟进问题,交易数据统计
    • 增加客户抬头关联申请,公司列表【抬头关联】
    • 增加【抬头关联申请】列表页,增加审批操作
    • 调整采购商查询接口,最近成交时间,订单数,最近跟进时间,按照所有抬头汇总计算
    • 调整自动掉客户定时器,同样按照所有抬头汇总计算
    • 已申请付款的采购单,异常取消时,还原额度
    • 订单修改抬头,重新计算新单标识
    • 应开票,扣减货损
    • 增加交易员客户库容限制,增加公海客户领用限制,已开发完成

下周计划

  • 资金账户管理 陈均活 梁荣生 曹佳林 https://app.yinxiang.com/fx/b9936dfe-0da5-4895-800c-670118421cb8
    • 服务端
      • 充值接口
      • 新建提现申请接口
      • 审核提现申请接口
      • 提现申请完成接口
      • 取消提现申请接口
      • 资金账户总额,提现金额,充值金额,冻结金额
      • 付款指令重构
      • 不变量bank_journal 调整
    • 前端
      • 流水认领方式:实体单认领,提现认领,充值认领,费用分配
      • 资金账户统计页面
      • 小程序增加提现申请页面,
      • 运营系统增加提现申请列表,审核
      • 小程序个人中心,显示资金账户余额、冻结金额
      • 付款指令列表增加付款原因显示
      • 付款指令申请页面,显示供应商预付款金额
  • 部分供应商按暂定价付款,随后修改结算价问题优化
    • 资金利息按照实付计算
    • 多出金额存入预付账户用以抵扣下次货款
    • 数据明细,资金利息计算调整
  • 运营系统优化 陈均活 曹佳林
    • 创建订单计算预计金融费用 梁华生
  • 利润核算模块设计 梁华生
    • 产品经理模式
  1. use crm_db;
  2. create table company_account
  3. (
  4. id bigint not null primary key auto_increment,
  5. company_id bigint not null comment '公司id',
  6. type smallint(2) default 1 not null comment '账户类型,1:资金账户(capital);2:预付账户(prepay)',
  7. -- 可用金额 = 账户余额 - 冻结余额
  8. balance decimal(13, 2) default 0.00 not null comment '账户余额',
  9. frozen_balance decimal(13, 2) default 0.00 not null comment '账户冻结余额',
  10. created_at timestamp default current_timestamp() not null,
  11. created_by int default 0 not null,
  12. updated_at timestamp default current_timestamp() not null,
  13. updated_by int default 0 not null,
  14. remark varchar(255) null comment '备注',
  15. constraint vr_2_company foreign key (company_id) references company (id)
  16. ) engine = innoDb charset = utf8mb4 comment '公司账户';
  17. create table account_journal
  18. (
  19. id bigint auto_increment primary key,
  20. company_account_id bigint not null comment '公司账号id',
  21. company_id int(10) not null comment '公司id',
  22. bank_journal_id bigint default null comment '银行流水id',
  23. account_apply_id bigint default null comment '提现/充值申请id, 业务类型为提现或充值时有值',
  24. src_payment_id bigint default null comment '支付记录id, 业务类型为货款转预付时有值,',
  25. payment_id bigint default null comment '支付记录id, 业务类型为货款时有值,该字段值为对应订单/采购单付款记录的id',
  26. trans_type smallint(2) default 1 not null comment '交易类型,1:收入(income);2:支出(expenditure);3:冻结(freeze);4:解冻(unfreeze);',
  27. business_type smallint(2) default 10 not null comment '业务类型,10:提现(withdrawal);20:充值(recharge);30:货款(payment);40:拍卖(auction);50:货款转预付(payment_to_prepay);90:其他(other)',
  28. amount decimal(13, 2) not null comment '流水金额',
  29. last_balance decimal(13, 2) default 0.00 null comment '上一次金额',
  30. balance decimal(13, 2) not null comment '操作后的人民币余额',
  31. frozen_balance decimal(13, 2) not null comment '操作后的人民币冻结余额',
  32. frozen_related_journal_id int(10) null comment '冻结关联流水, 交易类型是解冻时有值',
  33. created_at timestamp default current_timestamp() not null,
  34. created_by int default 0 not null,
  35. updated_at timestamp default current_timestamp() not null,
  36. updated_by int default 0 not null,
  37. remark varchar(255) null comment '备注'
  38. ) engine = innoDb charset = utf8mb4 comment '公司账户变更流水';
  39. -- 流水账户总余额
  40. select sum(amount) from account_journal
  41. where 1 = 1 and trans_type in (1, 2)
  42. -- and created_at > current_date -- 当天账户变更
  43. -- group by company_account_id
  44. -- 流水冻结总额
  45. select sum(amount) from account_journal
  46. where 1 = 1 and trans_type in (3, 4)
  47. -- and created_at > current_date -- 当天账户变更
  48. -- group by company_account_id
  49. -- 资金账户总金额,冻结总金额
  50. select sum(balance), sum(frozen_balance) from company_account;
  51. -- 当日提现、充值总额
  52. select sum(if(business_type = 10, amount, 0)), sum(if(business_type = 20, amount, 0))
  53. from account_journal where created_at > current_date
  54. --
  55. create table account_application
  56. (
  57. id bigint auto_increment primary key,
  58. company_account_id bigint not null comment '账户id',
  59. company_id bigint not null comment '公司ID',
  60. company_name varchar(100) not null comment '公司名称',
  61. wx_user_id int default null comment '发起申请的微信用户id',
  62. type smallint(2) default 1 not null comment '申请类型,1:提现(withdraw);2:充值(recharge)',
  63. status smallint(2) default 1 not null comment '状态,10:待审核(to_be_audited);20:已审核(audited);30:已完成(finished);90:已取消(canceled)',
  64. amount decimal(10, 2) not null comment '金额',
  65. bank_journal_id bigint default null comment '银行流水id',
  66. # 冗余字段,来源银行流水表 bank_journal
  67. # platform_account varchar(32) null comment '平台银行账号',
  68. # platform_account_name varchar(64) not null comment '平台银行户名',
  69. # bank_account varchar(32) null comment '收付款银行账号',
  70. # bank_account_name varchar(64) not null comment '收付款银行户名',
  71. audited_at datetime null comment '审核时间',
  72. audited_by int(10) null comment '审核人',
  73. confirmed_at datetime null comment '确认时间',
  74. confirmed_by int(10) null comment '确认人',
  75. created_at timestamp default current_timestamp() not null,
  76. created_by int default 0 not null,
  77. updated_at timestamp default current_timestamp() not null,
  78. updated_by int default 0 not null,
  79. remark varchar(255) null comment '备注',
  80. constraint aa_2_company foreign key (company_id) references company (id)
  81. ) engine = innoDb charset = utf8mb4 comment '充值申请';
  82. -- 拍卖
  83. create table auction_target
  84. (
  85. id bigint auto_increment primary key,
  86. purchase_item_id bigint not null comment '采购子单id',
  87. delivery_type smallint(2) not null comment '送货方式, 10:自提(self_pick);20:供应商配送(supplier_deliver);30:万博配送(wanbo_deliver)',
  88. product_id int not null,
  89. category varchar(12) not null comment '产品分类',
  90. designation varchar(32) not null comment '产品牌号',
  91. manufacturer_id int not null comment '生产商ID',
  92. manufacturer_name varchar(32) not null comment '生产商名称',
  93. supplier_company_id int not null comment '供应商id',
  94. supplier_company_name varchar(32) not null comment '供应商名称',
  95. warehouse_id int not null comment '发货仓库id',
  96. warehouse_name varchar(32) not null comment '发货仓库名称',
  97. status smallint(1) default 1 null comment '状态(1:预提交,2:待审核,3:已审核 4:拍卖中,5:拍卖完成,6:流拍,9:审核不通过,10:取消)',
  98. starting_price decimal(13, 2) default 0.00 not null comment '起拍价',
  99. market_price decimal(13, 2) null comment '市场评估价',
  100. weight decimal(8, 3) default 0.000 not null comment '拍卖总吨数',
  101. starting_weight decimal(8, 3) not null comment '起拍吨数',
  102. price_increment decimal(10, 2) not null comment '加价幅度',
  103. weight_increment decimal(8, 3) not null comment '数量增幅(最小变量单位或每次增加吨数)',
  104. -- auction_type smallint(1) default 1 not null comment '竞拍方式,1:升价(priceRise);2:降价(priceCut )',
  105. deposit_ratio decimal(3, 3) not null comment '保证金比例',
  106. -- basic_deposit decimal(10, 2) null comment '保证金基础值',
  107. auction_start_at datetime not null comment '开始拍卖时间',
  108. expected_auction_end_at datetime not null comment '预定结束拍卖时间',
  109. actual_auction_end_at datetime null comment '实际拍卖结束时间',
  110. -- 期货交货时间?
  111. -- trade_addr varchar(50) null comment '交易地点',
  112. -- weight_left decimal(13, 3) null comment '剩余吨数',
  113. is_future smallint(1) default 0 not null comment '是否期货 0为false, 1为true',
  114. execute_start_at date null comment '送货/交付日期开始',
  115. execute_end_at date null comment '送货/交付日期结束',
  116. audited_at datetime null comment '审核时间',
  117. audited_by int(10) null comment '审核人',
  118. created_at timestamp default current_timestamp() not null,
  119. created_by int default 0 not null,
  120. updated_at timestamp default current_timestamp() not null,
  121. updated_by int default 0 not null,
  122. remark varchar(255) null comment '备注'
  123. ) engine = innoDb charset = utf8mb4 comment '拍卖标的';
  124. create table auction_bid_record
  125. (
  126. id int(10) auto_increment
  127. primary key,
  128. wx_user_id int(10) not null comment '用户id',
  129. company_id int(10) not null,
  130. auction_target_id int(10) not null comment '竞拍标的ID',
  131. price_before_bid decimal(10, 2) default 0.00 not null comment '拍前价格',
  132. bid_price decimal(10, 2) not null comment '出价',
  133. weight decimal(8, 3) not null comment '拍卖吨数',
  134. actual_weight decimal(8, 3) default 0.000 not null comment '实际中标吨数(为0则为出局)',
  135. -- account_journal_id int(10) not null comment '账户资金变动流水ID',
  136. -- margin decimal(10, 2) default 0.00 not null comment '冻结保证金',
  137. auction_at datetime not null comment '出价时间',
  138. created_at timestamp default current_timestamp() not null,
  139. created_by int default 0 not null,
  140. updated_at timestamp default current_timestamp() not null,
  141. updated_by int default 0 not null,
  142. remark varchar(255) null comment '备注',
  143. constraint bid_records_fk_target_id
  144. foreign key (auction_target_id) references auction_target (id)
  145. ) engine = innoDb charset = utf8mb4 comment '出价记录';
  146. -- auto-generated definition
  147. create table auction_target_summary
  148. (
  149. id bigint auto_increment primary key,
  150. target_id int(10) default 0 not null comment '竞拍标的ID',
  151. won_user_count int(10) default 0 not null comment '中标人数',
  152. bid_user_count int(10) default 0 not null comment '投注人数',
  153. bid_count int(10) default 0 not null comment '投注次数',
  154. weight decimal(8, 3) default 0.000 not null comment '成交吨数',
  155. amount decimal(13, 2) default 0.00 not null comment '成交金额',
  156. max_price decimal(10, 2) default 0.00 not null comment '最高价',
  157. min_price decimal(10, 2) default 0.00 not null comment '最低价',
  158. constraint target_summary_fk_target_id
  159. foreign key (target_id) references auction_target (id)
  160. ) engine = innoDb charset = utf8mb4 comment '竞拍商品摘要';
  161. -- auto-generated definition
  162. create table auction_won_record
  163. (
  164. id int(10) auto_increment
  165. primary key,
  166. company_id bigint not null comment '公司id',
  167. auction_bid_record_id bigint not null comment '出价记录',
  168. auction_target_id bigint not null comment '标的id',
  169. price decimal(10, 2) not null comment '中标价',
  170. weight decimal(8, 3) not null comment '中标数量',
  171. total_amount decimal(10, 2) not null comment '中标金额',
  172. -- order_no varchar(32) not null comment '关联销售订单号',
  173. -- status smallint(1) not null comment '状态(1:待确认,2:成功,3:违约,4:违约已处理)',
  174. created_at datetime not null,
  175. created_by int(10) null comment '创建人,只能是StaffID',
  176. updated_at timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
  177. updated_by int(10) null comment '更新人,只能是StaffID',
  178. constraint wined_record_fk_bid_record_id
  179. foreign key (auction_bid_record_id) references auction_bid_record (id),
  180. constraint wined_record_fk_target_id
  181. foreign key (auction_target_id) references auction_target (id)
  182. ) engine = innoDb charset = utf8mb4 comment '中标记录';
  183. use payment_db;
  184. create table payment_application
  185. (
  186. id bigint auto_increment
  187. primary key,
  188. status smallint(2) not null comment '指令状态,10:待确认(to_be_confirmed);20:已确认(confirmed);30:已制单(voucher_made);40:支付中(paying);50:已支付(paid);60:已撤销(revoked)',
  189. reason smallint(2) not null comment '付款原因,10:货款(to_be_confirmed);20:仓租(confirmed);30:账户提现(voucher_made);90:其他(other)',
  190. purchase_id bigint default null comment '采购单id',
  191. company_id int default null comment '公司id',
  192. company_name varchar(64) default null comment '公司名称',
  193. bank_name varchar(64) default '' not null comment '收款银行',
  194. bank_no varchar(32) not null comment '收款银行账号',
  195. platform_bank_name varchar(64) null comment '平台付款银行',
  196. platform_bank_no varchar(64) null comment '平台付款帐号',
  197. amount decimal(13, 2) default 0.00 not null comment '付款金额',
  198. file_name varchar(128) null comment '支付完成后上传水单至阿里云OSS',
  199. confirmed_at timestamp default null comment '确认时间',
  200. confirmed_by int default null comment '确认人',
  201. created_at timestamp default current_timestamp() not null,
  202. created_by int default 0 not null,
  203. updated_at timestamp default current_timestamp() not null,
  204. updated_by int default 0 not null,
  205. is_sent_attachment smallint(2) default 0 not null comment '是否已发送水单',
  206. remark varchar(255) null comment '备注',
  207. rmk varchar(255) null comment '系统备注',
  208. key idx_created_at(created_at),
  209. key idx_purchase_id(purchase_id),
  210. key idx_company_id(company_id)
  211. ) engine = innoDb comment '付款申请' charset = utf8mb4;
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注