Atitit. atiOrder   Order 訂單管理框架的設計

来源:http://www.cnblogs.com/attilax/archive/2016/02/27/5223391.html
-Advertisement-
Play Games

Atitit. atiOrder Order 訂單管理框架的設計 1. Order 訂單處理流程1 2. code2 3. Ref7 1. Order 訂單處理流程 if(userSvr.isNotLogin()) { throw new RuntimeException(" not login 沒


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:[email protected]

轉載請註明來源: 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訂單結構

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...