Atitit. atiOrder Order 订单管理框架的设计
Atitit. atiOrder Order 订单管理框架的设计
1. Order 订单处理流程
if(userSvr.isNotLogin())
{
throw new RuntimeException(" not login 没登录,请先登录..#not_login");
}
User u=userSvr.getLoginUser();
Acc a=accSvr.getAcc(u.id);
BigDecimal needMoney=amoutCalcSvr.calc(order);
if(new ADecimal(needMoney ).biggerEqualThan(a.amount))
throw new RuntimeException(" amount not enough 金额不足够 ..#amount_not_enough ");
///...insert
storeSvr.insert(order);
orderlogSvr.log(order);
return accSvr.reduceAmount(u.id.toString(), needMoney.doubleValue());
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
2. code
package com.attilax.order;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import aaaCfg.IocX4casher;
import com.attilax.acc.Acc;
import com.attilax.acc.AccService;
import com.attilax.bet.AmountCalcService;
import com.attilax.db.DBX;
import com.attilax.io.filex;
import com.attilax.json.AtiJson;
import com.attilax.math.ADecimal;
import com.attilax.orm.AOrm;
import com.attilax.store.StoreService;
import com.attilax.user.User;
import com.attilax.user.UserService;
import com.google.inject.Inject;
public class OrderServiceV2 extends absService {
public static void main(String[] args) {
//final long time_intFmt = new Date().getTime() / 1000;
//System.out.println(time_intFmt);
//OrderServiceV2 os = IocX4casher.getBean(OrderServiceV2.class);
//os.insert(new HashMap() {
//{
//this.put("good_amount", 12.50);
//this.put("add_time", time_intFmt);
//this.put("confirm_time", time_intFmt);
//this.put("order_sn",filex.getUUidName());
//}
//});
//System.out.println("--f");
}
@Inject
StoreService storeSvr;
@Inject
UserService userSvr;
@Inject
AccService accSvr;
@Inject
AmountCalcService amoutCalcSvr;
@Inject
OrderLogService orderlogSvr;
public int insert(Map order) {
if(userSvr.isNotLogin())
{
throw new RuntimeException(" not login 没登录,请先登录..#not_login");
}
User u=userSvr.getLoginUser();
Acc a=accSvr.getAcc(u.id);
BigDecimal needMoney=amoutCalcSvr.calc(order);
if(new ADecimal(needMoney ).biggerEqualThan(a.amount))
throw new RuntimeException(" amount not enough 金额不足够 ..#amount_not_enough ");
///...insert
storeSvr.insert(order);
orderlogSvr.log(order);
return accSvr.reduceAmount(u.id.toString(), needMoney.doubleValue());
}
public List<Map> query(Map order) {
if(userSvr.isNotLogin())
{
throw new RuntimeException(" not login 没登录,请先登录..#not_login");
}
User u=userSvr.getLoginUser();
return null;
///...insert
//return accSvr.reduceAmount(u.id.toString(), needMoney.doubleValue());
}
public String query2json(Map order) {
return AtiJson.toJson(query(order));
///...insert
//return accSvr.reduceAmount(u.id.toString(), needMoney.doubleValue());
}
}
3. Ref
Atitit. 订单管理 收银单持久化 功能设计 基于ecshop订单结构
Atitit. atiOrder Order 订单管理框架的设计的更多相关文章
- SAP CRM系统订单模型的设计与实现
SAP成都研究院的一个部门领导让我给他的团队做一个SAP CRM One Order框架的培训,这是我准备的培训内容. 在Jerry之前的文章 基于SAP Kyma的订单编排增强介绍,我表达了自己对S ...
- Atitit.cateService分类管理新特性与设计文档说明v1
Atitit.cateService分类管理新特性与设计文档说明v1 1. V2 新特性规划1 2. 分类管理1 3. 分类增加与修改维护2 4. Js控件分类数据绑定2 1. V2 新特性规划 增加 ...
- atitit.atiOrmStoreService 框架的原理与设计 part1 概述与新特性
atitit.atiOrmStoreService 框架的原理与设计 part1 概述与新特性 1. 新特性如下 支持生成sql在无数据库连接的情况下 2. Orm设计 主要的俩个以来service ...
- Atitit. 数据库-----catalog与schema的设计区别以及在实际中使用 获取数据库所有库表 java jdbc php c#.Net
Atitit. 数据库-----catalog与schema的设计区别以及在实际中使用 获取数据库所有库表 java jdbc php c#.Net 1. -catalog与schema的设计区别1 ...
- Atitit.加密算法ati Aes的框架设计
Atitit.加密算法ati Aes的框架设计 版本进化 c:\1t\aesC47.java c:\1t\aes.java 增加了public static byte[] encrypt(byte[] ...
- Atitit.加密算法ati Aes的框架设计v2.2
Atitit.加密算法ati Aes的框架设计v2.2 版本进化1 V2.2 add def decode key api1 v1版本1 Aes的历史2 Atitit.加密算法 des aes ...
- Atitit 修改密码的功能流程设计 attilax总结
Atitit 修改密码的功能流程设计 attilax总结 1.1. 注意点1 1.2. 设计修改用户密码功能时把用户ID保存在哪里?1 1.3. Ui设计1 1.4. 功能设计源码1 1.5. Agt ...
- atitit. 日志系统的原则and设计and最佳实践(1)-----原理理论总结.
atitit. 日志系统的原则and设计and最佳实践总结. 1. 日志系统是一种不可或缺的单元测试,跟踪调试工具 1 2. 日志系统框架通常应当包括如下基本特性 1 1. 所输出的日志拥有自己的分类 ...
- atitit.基于http json api 接口设计 最佳实践 总结o7
atitit.基于http json api 接口设计 最佳实践 总结o7 1. 需求:::服务器and android 端接口通讯 2 2. 接口开发的要点 2 2.1. 普通参数 meth,p ...
随机推荐
- 13、Flask实战第13天:SQLAlchemy操作MySQL数据库
安装MySQL 在MySQL官网下载win版MySQL 双击运行 后面根据提示设置密码然后启动即可,这里我设置的密码是:123456 我们可以通过Navicat客户端工具连接上MySQL addres ...
- 记录(Record)
记录有可以被称为行(Row),可以通俗的认为它是数据表中的一行数据.以员工表为例,一个公司的员工表中的数据是这样的: 这里每一行数据就代表一个员工的资料,这样的一行数据就叫做一条记录.表是由行和列组成 ...
- python requests的安装与简单运用(转)
http://www.cnblogs.com/fightformylife/p/4134986.html http://cn.python-requests.org/zh_CN/latest/ htt ...
- struts2 action 字段问题
struts2最多只能解释两级字段,比如user.username,像user.info.age在类中属性类的三段字符不能识别,只能先用user,info 然后在user.setInfo(info);
- 【动态规划】【记忆化搜索】CODEVS 3409 搬运礼物 CodeVS原创
考虑暴力递归求解的情况: f(i)=min(a(i),f(i-1),f(i-2),...,f(1)) 由于只要参数相同,f()函数的返回值是一样的,因此导致了大量的重复计算,所以我们可以记忆下来. # ...
- 【枚举】bzoj1800 [Ahoi2009]fly 飞行棋
暴力枚举. #include<cstdio> #include<algorithm> using namespace std; ],sum[],half,ans; int qu ...
- <摘录>Linux下动态共享库加载时的搜索路径详解
对动态库的实际应用还不太熟悉的读者可能曾经遇到过类似“error while loading shared libraries”这样的错误,这是典型的因为需要的动态库不在动态链接器ld.so的搜索路径 ...
- 使用GIT进行源码管理 —— VisualStudio官方GIT教程
我之前在文章使用GIT进行源码管理 —— 在VisualStudio中使用GIT中简单的介绍了一下如何使用VS中自带的Git工具,今天发现MSDN上现在也有了非常完整的教程,感兴趣的朋友可以看一下: ...
- Linux中线程的挂起与恢复(进程暂停)
http://www.linuxidc.com/Linux/2013-09/90156.htm 今天在网上查了一下Linux中对进程的挂起与恢复的实现,相关资料少的可怜,大部分都是粘贴复制.也没有完整 ...
- Delphi 通过SQLite3, SQLiteTable3 操作数据库
var sql, sFile:string; db:TSQLiteDatabase;begin try sFile := G_AppPath + CH_IPC712Db; //if FileExist ...