Code Structure
Annotation Summary
- no @ExceptionHandler
- ResponseBody : AOP 前后加work
- what is the difference between @Component, @Repository and @Service annotations in Spring ?
- @Component is more generic and others are pointed to specific things, refer to website
process
UrlRedirectFilter
we use Servlet filter to redirect the url.
Servlet filter refer to website
When a HTTP request arrives at your web application which the filter intercepts, the filter can inspect the request URI, the request parameters and the request headers, and based on that decide if it wants to block or forward the request to the target servlet, JSP etc.
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { String myParam = request.getParameter("myParam"); if(!"blockTheRequest".equals(myParam)){ filterChain.doFilter(request, response); } }
- Notice how the
doFilter()
method checks a request parameter,myParam
, to see if it equals the string "blockTheRequest". If not, the request is forwarded to the target of the request, by calling thefilterChain.doFilter()
method. If this method is not called, the request is not forwarded, but just blocked.
Search for database
what is the difference between myBatis over Hibernate? refer to website
The reason is that you're trying to do one of two things typically:
- Create/Update/Delete some complex domain entities
- Run analytic fetch queries (i.e. summation/aggregation queries)
Hibernate works well for case 1 allowing you to just make a POJO and persist/update it. It also does this quickly, unless your domain is quite large.
myBatis is great for fetch queries (case 2) where you just want an answer.
Hibernate basics
- Mapping and Configuration files: the heart of hibernate application
Hibernate dev process
- add Hibernate configuration
annotate Java Class
- Entity Class : java class that is mapped to a database table
- Step1: Map class to database table
@Entity @Table(name="student") public class Student { ... }
Step2: Map fields to database columns
@Id // primary key @Column(name="id") private int id; @Column(name="first_name") private String firstName; ...
Develop Java Code to perform database application
eg. class FcountlimitDAO
recharge procedure (V1AccountQuery)
- 我们这边显示一个地址(电子钱包,一开始就存在fuser中),然后用户需要在别的exchange (eg. coinbase) 去输入,这样就完成了充值的过程
- 查询虚拟币充值地址 (/api/v1/account_recharge_coin)
- rechargeCoin() // just show the address -> check the fvirtualaddressDAO
- 查询虚拟币充值地址 (/api/v1/account_recharge_coin)
withdraw procedure (V1Account)
- 把比如说coinbase中的地址,输入withdraw 中,然后就可以了
- 用了multithread 功能,可能会同时查看。。。
- 查询虚拟币提现地址 (/api/v1/account_withdraw_coin)
- withdrawCoin() // virtualCapitaloperationService 显示近10条提现记录
- 更新虚拟币提现地址 (/api/v1/account_modify_coin_Withdraw)
- modifyCoinWithdraw() //
wallet class ()
每个用户有一个Fvirtualwallet -> 对应多个virtualAddress(每个address 是一个币) ->
constantMap class, tradeMappings() method ??
Market class (V1MarketQuery)
- 查询币币交易对 marketTradeMappings
- 查询市场价格图 marketPriceChart
- 查询市场K图周期 marketKlinePeriod
- 查询市场K图 marketKline
ApiBase.java
abstract class ApiExecuteContrl
- contains run(), abstract validate(), abstract process(),
- note that how to use ApiExecuteContrl
- new ApiExecuteContrl(){@Override process() throws Exception {...}, ...}.run();
class DataObject -> used to construct return data
- private Map<String, Object> data, put(), getData()
calculateOutDept
api -> redis -> gms(消息队列) -> list / map ->
fvirtualcointype (class)
- contains some fields like 是否可以交易,是否可以提现,是否可以充值,shortname,最新成交价格,合约地址,。。。
FrontVirtualCoinService.java
fuser (class + DAO)
- 包含跟用户相关的所有信息
fuser account (class + DAO)
api/io/uniex/service/front/FrontVirtualCoinService.java
FrontVirtualCoinService.java
- FvirtualcointypeDAO
- 对应entity POJO class Fvirtualcointype
- Fvirtualcointype 包含虚拟货币类型和各种属性,比如说该币是否可以交易,是否可以提现,是否可以充值,shortname,最新成交价格,合约地址,。。。
- method:findByFname() / findAll() / startCoinType()
- FwithdrawfeesDAO
- 对应entity POJO class Fwithdrawfees
- don't know how to use it ????
- FvirtualaddressWithdrawDAO (what is relationship among withdrawfees, virtualaddressWithdraw, virtualaddress?????)
- 对应entity POJO class FvirtualaddressWithdraw
- FvirtualaddressWithdraw 包含 user, address, virtualcointype, createTime
- method:
findFvirtualaddressWithdraw() (never used)
- FvirtualaddressDAO
- 对应entity POJO class Fvirtualaddress
- Fvirtualaddress 包含user,timestamp,virtual coin type...
- method: findFvirtualaddress() / findFvirtualaddress() ?????? 为什么要有第二个函数
- FvirtualwalletDAO
- 对应entity POJO class Fvirtualwallet
- Fvirtualwallet 包含 user,total, frozen, virtualcointype, fack_id(用于撮合), ....
- method: find(fuid, status, cointype(类型,是法币还是虚拟币)) / findVirtualWallet(fuid, fcoinId(primary key))
- FvirtualcaptualoperationDAO
- 对应entity POJO class Fvirtualcaptualoperation (每次的交易信息)
- Fvirtualcaptualoperation 包含 user, virtualcointype, createTime, fees, gasPrice, gasLimit,
- method: findByFstatus() / findFvirtualcaptualoperationCount()
FrontUserService.java
- FuserDAO
- 对应entity Fuser class
- 包含跟user相关的各种信息, like 登录信息, 认证信息,virtualaddress,walletaddress
- getUserGroup() / findByMap() / getUser() / findByDate()
- EmailvalidateDAO
- 对应entity POJO class Emailvalidate
- Emailvalidate 包含 mail. user, uuid, validateStatus, key1, ....
- method: findByUuid() 最常见String -> Emailvalidate / findByUidUuid() / canSendFindPwdMsg() 发找密码邮
- Enum: ValidateMailStatusEnum (未验证,已验证,失败)
- FvalidateemailDAO
- 对应entity POJO class Fvalidateemail
- Fvalidateemail 包含 fid, fuser, ftitle, fcreateTime, email, ...
- method: findByFstatus()
- FvirtualcointypeDAO (reviewed)
- FvirtualwalletDAO (reviewed)
- FbankinfoDAO
- 对应entity POJO class Fbankinfo
- Fbankinfo 包含 user, name(银行名称), bankNumber, bankType, status(正常,禁用)
- method: findByFname() / findByFstatus() / findUserBankInfo()
- FscoreDAO ???????????????????? to be reviewed
- 对应entity POJO class Fscore
- Fscore 包含 fscore,
- FbankinfoWithdrawDAO (what is the difference between bankinfoWithdraw and bankinfor?????)
- 对应entity POJO class FbankinfoWithdraw
- FbankinfoWithdraw
- FapiDAO
- 对应entity POJO class Fapi
- Fapi 包含 partner, secret, label, user, ...
- method: 没有额外的method,用baseDAO
- FusersettingDAO
- 对应entity POJO class Fusersetting
- Fusersetting 包含 user, flottery, ticket, sendDate...
- method: updateCleanScore()
- FintrolinfoDAO ???????????
- what is it?
- FmessageDAO
- 发送人,接受人,主题。。。
- FtransportlogDAO
- user, address, createtime, fees, ...
FrontValidateService.java
- EmailvalidateDAO (reviewed)
- FvalidateemailDAO
- FuserDAO