-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
_posts/actions/2020-09-09-a024.quiz.string-manipulation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
category: actions | ||
author: shi.rongjiu | ||
title: 内测024:供应商应付账单 | ||
excerpt: '在实际java项目中,字符串和集合类的处理,代码占比约在30%-50%。不但是业务的关键,也是性能的关键。处理不当时,会严重影响代码的可读性,在性能上会产生大量临时对象,频繁gc。' | ||
|
||
tags: [Quiz, Scenario, String, Collection] | ||
teaser: post/actions/a024/00.jpg | ||
teaserinfo: "Zombies are coming,植物大战僵尸,是个老少皆宜的亲子游戏,其音乐也异常经典" | ||
|
||
toc: true | ||
comments: true | ||
share: true | ||
layout: article | ||
typora-root-url: ../../../moilioncircle.github.com | ||
typora-copy-images-to: ../../../moilioncircle.github.com/images/post/actions/a024/ | ||
--- | ||
|
||
# 内测024:供应商应付账单 | ||
|
||
#Quiz #Scenario #String #Collection | ||
|
||
在实际java项目中,字符串(CharSequence)和集合类(Collection<E>)的处理,代码占比约在30%-50%。不但是业务的关键,也是性能的关键,也是一个攻城狮的基本能力。处理不当时,会严重影响代码的可读性,会在产生大量临时对象,引发频繁gc。 | ||
|
||
@史荣久 / 2020-09-09 / CC-BY-SA-3.0 | ||
|
||
## 1.需求描述 | ||
|
||
在实际的业务中,有如下TSV格式的供应商的应付账单 | ||
|
||
| 订单号 | 账号 | 账单日 | 操作费 | 附加费 | | ||
| ---------- | ------------ | ---------- | ------ | ------ | | ||
| T200908001 | tryit@qq.com | 2020-09-09 | 3.14 | 6.18 | | ||
| T200909002 | doit@qq.com | 2029-09-10 | 2.71 | 2.99 | | ||
|
||
* TSV格式,是指以tab(`\t`)分隔数据文件 | ||
* 订单号,订单的唯一标识,格式yyMMdd### | ||
* 账号,付款账户,一个邮件账号 | ||
* 账单日,订单的账单产生日 | ||
* XX费(操作费,附加费)会有很多 | ||
|
||
在进行账单导入的时候,业务上存在以下规则和需要。 | ||
|
||
* 不同XX费,会时隔多日产生,分批出现在多个TSV中 | ||
* 会有重复的XX费,以`账单日`新旧判定,新值覆盖旧值 | ||
* 导入TSV时,任意记录失败则全部失败 | ||
* 失败时,需要尽量详细的定位记录位置以提示修正 | ||
* 成功时,需要给账号的email发送汇总邮件 | ||
|
||
## 2.基本要求 | ||
|
||
新建一个spring或springboot工程,数据库使用mysql,java8环境。 | ||
|
||
* 建立数据表,以支持业务功能 | ||
* 按业务要求,写一个TSV导入Service | ||
* 核心代码必须可执行 | ||
* 成功时发邮件或模拟发送汇总信息 | ||
* 未实现部分以文档或伪代码说明思路和技术点 | ||
* 时间不限,期间可联网 | ||
|
||
汇总信息格式不限,能表述清楚即可,需要包括, | ||
|
||
* 本次导入的按账户分组的订单总数,费用项及该项的总金额 | ||
* 覆盖`XX费`时,按账户分组,以记录顺序的订单号,费用项和新旧值 | ||
|
||
汇总信息举例, | ||
|
||
``` | ||
导入文件:test.tsv, 操作日期:2020-09-09 | ||
-- 摘要 | ||
tryit@qq.com : 订单数=1,总费用=9.32,操作费=3.14, 附加费=6.18 | ||
doit@qq.com : 订单数=1,总费用=5.70,操作费=2.71, 附加费=2.99 | ||
-- 覆盖 | ||
tryit@qq.com : | ||
- T200808001: 操作费=1.72/3.14, 附加费=4.16/6.18 | ||
``` | ||
|
||
## 3.加分功能 | ||
|
||
根据个人能力和实际情况,完成以下任意内容(包括但不限于) | ||
|
||
* 随机生成一个有50+记录的TSV文件(test.tsv) | ||
* 此题目陷阱较多,本句话就是陷阱 | ||
* 必要的数据验证,异常处理,代码质量等 | ||
|
||
-- | ||
|
||
※ 我们的征途是星辰大海 ※ | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.