zoukankan      html  css  js  c++  java
  • Atitit. atiOrder   Order 订单管理框架的设计

    Atitit. atiOrder   Order 订单管理框架的设计

     

    1Order 订单处理流程1

    2code2

    3Ref7

     

    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订单结构

     

  • 相关阅读:
    javascript关闭弹出窗体时刷新父窗体和居中显示弹出窗
    iOS 开发人员不可缺少的75个工具
    JavaWeb学习笔记:Servlet
    Oracle SQL 查询优化.Part4
    高速集成支付宝支付步骤及注意事项(原创)
    算法题-注水问题
    《C专家编程》数组和指针并不同--多维数组
    jQuery源代码 框架分析
    Python中strip方法的妙用
    友盟社会化分享
  • 原文地址:https://www.cnblogs.com/attilax/p/5223391.html
Copyright © 2011-2022 走看看