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://blog.csdn.net/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订单结构
相关文章
- 彩虹女神跃长空,Go语言进阶之Go语言高性能Web框架Iris项目实战-完善用户管理EP04
- Unity SKFramework框架(九)、Input 输入管理模块
- 目标检测开源框架YOLOv6全面升级,更快更准的2.0版本来啦
- shiro框架04会话管理+缓存管理+Ehcache使用
- 集合框架【第三章】——queue队列
- MyBatis框架:第十章:mybatis缓存
- SpringBoot框架SpEL表达式注入漏洞复现与原理分析
- 【Android 插件化】Hook 插件化框架 ( hook 插件化原理 | 插件包管理 )
- 【愚公系列】2023年04月 Java教学课程 131-Spring框架的简介和基本使用
- 让Linux下的SPI框架带来无限可能(linuxspi框架)
- 数据库使用PHP框架管理Oracle数据库(php框架oracle)
- 时间针对Java框架的Redis键过期时间管理技术(redisjava过期)
- Angular 框架将进入 2.0 时代
- 使用MVC框架连接Oracle数据库的步骤详解(mvc连接oracle)
- 实现淘宝业务双倍效率构建Redis缓存框架(淘宝redis缓存框架)
- 前后端分离加速应用Redis框架新编谋(前后端分离redis框架)
- 插件管理框架forDelphi(一)
- CodeIgniterphpmvc框架中国网站
- PythonORM框架SQLAlchemy学习笔记之安装和简单查询实例