java代碼編寫訂單狀態(tài),java代碼編寫訂單狀態(tài)不正確

Java建行支付判斷訂單狀態(tài)

使用后端進(jìn)行數(shù)據(jù)判斷。

專注于為中小企業(yè)提供成都做網(wǎng)站、網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)桃山免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

首先在后端平臺設(shè)置銀行卡賬號和密碼用來判斷支付,支付完成后,建行會自動調(diào)用回調(diào)地址,這個地址是在建行商戶平臺配置的,反饋有兩種,網(wǎng)頁反饋和服務(wù)器反饋,頁面反饋付款人付款完成后,點擊返回商戶網(wǎng)站按鈕,觸發(fā)頁面反饋,服務(wù)器反饋只要支付成功,無需觸發(fā),由建行支付網(wǎng)關(guān),以post 方法,發(fā)信息給反饋URL還分為網(wǎng)上銀行和手機(jī)銀行反饋,網(wǎng)上銀行就是微信支付寶調(diào)用url支付,手機(jī)銀行就是建行手機(jī)銀行支付客戶端,其實手機(jī)、網(wǎng)銀,區(qū)分不是很嚴(yán)格,一般都設(shè)置成一樣的,同一筆支付,可能會觸發(fā)多渠道的同時反饋,所以,反饋機(jī)制,在響應(yīng)的時候,是允許重復(fù)的,一般來說,服務(wù)器,頁面,是寫成兩個不同的回調(diào)處理,或者,加個條件判斷,同時允許post和get,寫成一個,就不太好判斷反饋的來源了,寫成兩個,再通過日志,能區(qū)分反饋的來源。

java題:編寫類似淘寶一個簡單的處理訂單發(fā)貨和進(jìn)貨的程序,要求實現(xiàn)簡單的進(jìn)貨和發(fā)貨以及統(tǒng)計貨物量的功能

import java.util.ArrayList;

public class Du {

public static void main(String[] args) throws Exception {

Seller seller = new Seller("My Store");

seller.addGoods("T-shirt", 200);

seller.addGoods("Pill", 100);

seller.addGoods("T-shirt", 100);

seller.addGoods("T-shirt", 50);

seller.addGoods("Pill", 50);

seller.addGoods("Hat", 100);

seller.printGoods();

Seller sell2 = new Seller("The Other Store");

sell2.addGoods("T-shirt", 200);

sell2.addGoods("Hat", 100);

sell2.sellGoods("T-shirt", 50);

sell2.addGoods("Hat", 100);

sell2.printGoods();

}

}

class Seller {

private String sellerName;

private int TotalTypeOfGoods;

private ArrayListString goodsNameList = new ArrayListString();

private ArrayListInteger goodsQuantityList = new ArrayListInteger();

public Seller(String sellerName) {

this.sellerName = sellerName;

}

public void addGoods(String goodName, int goodNum) {

int index = goodsNameList.indexOf(goodName);

if (index == -1) {

goodsNameList.add(goodName);

goodsQuantityList.add(new Integer(goodNum));

} else {

goodsQuantityList.set(index, goodsQuantityList.get(index)

.intValue()

+ goodNum);

}

TotalTypeOfGoods = goodsNameList.size();

}

public void sellGoods(String goodName, int goodNum) throws Exception {

if (TotalTypeOfGoods == 0) {

throw new Exception("No goods provided by the shop. Closed!");

}

int index = goodsNameList.indexOf(goodName);

if (index != -1) {

int qty = goodsQuantityList.get(index);

if (goodNum qty) {

throw new Exception("Insufficient goods in the shop. Sorry!");

}

goodsQuantityList.set(index, qty - goodNum);

}else{

throw new Exception("Our shop doesn't sell " + goodName);

}

}

public void printGoods() {

System.out.print("Seller :" + this.sellerName + "\t");

System.out.println("Totoal Types of Goods is :" + this.TotalTypeOfGoods);

for(int i = 0; i goodsNameList.size(); i++){

System.out.print("Goods Name: " + goodsNameList.get(i));

System.out.println("Remains: " + goodsQuantityList.get(i));

}

System.out.println();

}

}

-----------------testing

Seller :My Store Totoal Types of Goods is :3

Goods Name: T-shirtRemains: 350

Goods Name: PillRemains: 150

Goods Name: HatRemains: 100

Seller :The Other Store Totoal Types of Goods is :2

Goods Name: T-shirtRemains: 150

Goods Name: HatRemains: 200

用Java創(chuàng)建一個訂單類記錄訂單號,第一筆訂單的時間,訂購產(chǎn)品的ID,客

package beans.excel;

import java.io.IOException;

import java.io.OutputStream;

import jxl.Workbook;

import jxl.write.Label;

import jxl.write.WritableSheet;

import jxl.write.WritableWorkbook;

import jxl.write.WriteException;

public class SimpleExcelWrite {

public void createExcel(OutputStream os) throws WriteException,IOException{

//創(chuàng)建工作薄

WritableWorkbook workbook = Workbook.createWorkbook(os);

//創(chuàng)建新的一頁

WritableSheet sheet = workbook.createSheet("First Sheet",0);

//創(chuàng)建要顯示的內(nèi)容,創(chuàng)建一個單元格,第一個參數(shù)為列坐標(biāo),第二個參數(shù)為行坐標(biāo),第三個參數(shù)為內(nèi)容

Label xuexiao = new Label(0,0,"學(xué)校");

sheet.addCell(xuexiao);

Label zhuanye = new Label(1,0,"專業(yè)");

sheet.addCell(zhuanye);

Label jingzhengli = new Label(2,0,"專業(yè)競爭力");

sheet.addCell(jingzhengli);

Label qinghua = new Label(0,1,"清華大學(xué)");

sheet.addCell(qinghua);

Label jisuanji = new Label(1,1,"計算機(jī)專業(yè)");

sheet.addCell(jisuanji);

Label gao = new Label(2,1,"高");

sheet.addCell(gao);

Label beida = new Label(0,2,"北京大學(xué)");

sheet.addCell(beida);

Label falv = new Label(1,2,"法律專業(yè)");

sheet.addCell(falv);

Label zhong = new Label(2,2,"中");

sheet.addCell(zhong);

Label ligong = new Label(0,3,"北京理工大學(xué)");

sheet.addCell(ligong);

Label hangkong = new Label(1,3,"航空專業(yè)");

sheet.addCell(hangkong);

Label di = new Label(2,3,"低");

sheet.addCell(di);

//把創(chuàng)建的內(nèi)容寫入到輸出流中,并關(guān)閉輸出流

workbook.write();

workbook.close();

os.close();

}

}

SimpleExcelWrite.jsp

%@ page language="java" import="java.util.*" pageEncoding="gb2312"%

%@ page import="java.io.*" %

%@ page import="beans.excel.*" %

%

String fname = "學(xué)校競爭力情況";

OutputStream os = response.getOutputStream();//取得輸出流

response.reset();//清空輸出流

//下面是對中文文件名的處理

response.setCharacterEncoding("UTF-8");//設(shè)置相應(yīng)內(nèi)容的編碼格式

fname = java.net.URLEncoder.encode(fname,"UTF-8");

response.setHeader("Content-Disposition","attachment;filename="+new String(fname.getBytes("UTF-8"),"GBK")+".xls");

response.setContentType("application/msexcel");//定義輸出類型

SimpleExcelWrite sw = new SimpleExcelWrite();

sw.createExcel(os);

%

html

head

title/title

/head

body

/body

/html

javaee編程題,訂單(訂單號,訂單日期,用戶姓名,送貨地址) 送貨地址為地址類型

第一個不就是一對多嗎? 我給你看看已訂單號進(jìn)行關(guān)聯(lián)

訂單號,訂單日期,用戶姓名,送貨地址

1 2015/9/1 kill 北京

訂單項id,訂單號,商品名稱,商品價格,商品數(shù)量)

123 1 泡面 10 100

223 1 純凈水 11 111

省,市,區(qū),街道 訂單號

1 1 1 1 1

2 2 2 2 1

strust2 (我沒有用過不過我一般是這樣做的)

直接用用后臺進(jìn)行校驗

java語言:數(shù)據(jù)庫中有每個訂單的創(chuàng)建時間,如果訂單的創(chuàng)建時間超過20分鐘,就讓訂單的狀態(tài)自動改變。

若用java實現(xiàn),則用java創(chuàng)建一個定時任務(wù),每隔段時間,更新下那表,發(fā)現(xiàn)超過二十分鐘的,更新狀態(tài)值,

如果是在數(shù)據(jù)庫的話,可以創(chuàng)建個定時任務(wù)

java 如何實現(xiàn)一個用戶 一個訂單

package cn.test.logan.day04;

import java.util.ArrayList;

/**

* 訂單類

* 包含:訂單ID、訂單所屬用戶、訂單所包含的商品、訂單總金額、訂單應(yīng)付金額

* 500-1000 ------- 8.5折

* 1000-1500 ------- 8折

* 1500-2000 ------- 7折

* 2000以上 ------- 6.5折

* 如果是會員,那么可以基于以上折扣繼續(xù)折扣

* 一般會員:9.5折

* 中級會員:9折

* 高級會員:8折

* @author QIN

*

*/

public class Order {undefined

// 訂單ID

public String ordId;

// 訂單所屬用戶

public User user;

// 訂單所包含的商品(多個商品,使用ArrayList)

public ArrayList pds;

// 訂單總金額

public float ordAllAmt;

// 訂單應(yīng)付金額

public float payAmt;

// 計算總金額的方法

public void setAllAmt() {undefined

float sum = 0;

for(int i=0;i

sum +=this.pds.get(i).price * this.pds.get(i).number;

}

this.ordAllAmt = sum;

}

// 計算實付金額

public void setPayAmt() {undefined

float tmp = this.ordAllAmt;

// 根據(jù)總金額進(jìn)行折扣

if(this.ordAllAmt = 500 this.ordAllAmt

tmp = this.ordAllAmt * 0.85f;

}

if(this.ordAllAmt = 1000 this.ordAllAmt

tmp = this.ordAllAmt * 0.8f;

}

if(this.ordAllAmt = 1500 this.ordAllAmt

tmp = this.ordAllAmt * 0.7f;

}

if(this.ordAllAmt = 2000) {undefined

tmp = this.ordAllAmt * 0.65f;

}

// 根據(jù)會員等級折扣

if(user.CustLevel.equals("一般會員")) {undefined

tmp = tmp * 0.95f;

}

if(user.CustLevel.equals("中級會員")) {undefined

tmp = tmp * 0.9f;

}

if(user.CustLevel.equals("高級會員")) {undefined

tmp = tmp * 0.8f;

}

//計算結(jié)果賦值給對象上的payAmt變量

this.payAmt = tmp;

}

}

參考資料來源:百度貼吧CSDN博主「公子京」

新聞標(biāo)題:java代碼編寫訂單狀態(tài),java代碼編寫訂單狀態(tài)不正確
本文地址:http://www.muchs.cn/article44/hssgee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號品牌網(wǎng)站建設(shè)網(wǎng)站營銷、網(wǎng)站改版網(wǎng)站制作、網(wǎng)站導(dǎo)航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)