重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
使用后端进行数据判断。
专注于为中小企业提供成都做网站、网站制作服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业桃山免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
首先在后端平台设置银行卡账号和密码用来判断支付,支付完成后,建行会自动调用回调地址,这个地址是在建行商户平台配置的,反馈有两种,网页反馈和服务器反馈,页面反馈付款人付款完成后,点击返回商户网站按钮,触发页面反馈,服务器反馈只要支付成功,无需触发,由建行支付网关,以post 方法,发信息给反馈URL还分为网上银行和手机银行反馈,网上银行就是微信支付宝调用url支付,手机银行就是建行手机银行支付客户端,其实手机、网银,区分不是很严格,一般都设置成一样的,同一笔支付,可能会触发多渠道的同时反馈,所以,反馈机制,在响应的时候,是允许重复的,一般来说,服务器,页面,是写成两个不同的回调处理,或者,加个条件判断,同时允许post和get,写成一个,就不太好判断反馈的来源了,写成两个,再通过日志,能区分反馈的来源。
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
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{
//创建工作薄
WritableWorkbook workbook = Workbook.createWorkbook(os);
//创建新的一页
WritableSheet sheet = workbook.createSheet("First Sheet",0);
//创建要显示的内容,创建一个单元格,第一个参数为列坐标,第二个参数为行坐标,第三个参数为内容
Label xuexiao = new Label(0,0,"学校");
sheet.addCell(xuexiao);
Label zhuanye = new Label(1,0,"专业");
sheet.addCell(zhuanye);
Label jingzhengli = new Label(2,0,"专业竞争力");
sheet.addCell(jingzhengli);
Label qinghua = new Label(0,1,"清华大学");
sheet.addCell(qinghua);
Label jisuanji = new Label(1,1,"计算机专业");
sheet.addCell(jisuanji);
Label gao = new Label(2,1,"高");
sheet.addCell(gao);
Label beida = new Label(0,2,"北京大学");
sheet.addCell(beida);
Label falv = new Label(1,2,"法律专业");
sheet.addCell(falv);
Label zhong = new Label(2,2,"中");
sheet.addCell(zhong);
Label ligong = new Label(0,3,"北京理工大学");
sheet.addCell(ligong);
Label hangkong = new Label(1,3,"航空专业");
sheet.addCell(hangkong);
Label di = new Label(2,3,"低");
sheet.addCell(di);
//把创建的内容写入到输出流中,并关闭输出流
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 = "学校竞争力情况";
OutputStream os = response.getOutputStream();//取得输出流
response.reset();//清空输出流
//下面是对中文文件名的处理
response.setCharacterEncoding("UTF-8");//设置相应内容的编码格式
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
第一个不就是一对多吗? 我给你看看已订单号进行关联
订单号,订单日期,用户姓名,送货地址
1 2015/9/1 kill 北京
订单项id,订单号,商品名称,商品价格,商品数量)
123 1 泡面 10 100
223 1 纯净水 11 111
省,市,区,街道 订单号
1 1 1 1 1
2 2 2 2 1
strust2 (我没有用过不过我一般是这样做的)
直接用用后台进行校验
若用java实现,则用java创建一个定时任务,每隔段时间,更新下那表,发现超过二十分钟的,更新状态值,
如果是在数据库的话,可以创建个定时任务
package cn.test.logan.day04;
import java.util.ArrayList;
/**
* 订单类
* 包含:订单ID、订单所属用户、订单所包含的商品、订单总金额、订单应付金额
* 500-1000 ------- 8.5折
* 1000-1500 ------- 8折
* 1500-2000 ------- 7折
* 2000以上 ------- 6.5折
* 如果是会员,那么可以基于以上折扣继续折扣
* 一般会员:9.5折
* 中级会员:9折
* 高级会员:8折
* @author QIN
*
*/
public class Order {undefined
// 订单ID
public String ordId;
// 订单所属用户
public User user;
// 订单所包含的商品(多个商品,使用ArrayList)
public ArrayList pds;
// 订单总金额
public float ordAllAmt;
// 订单应付金额
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;
// 根据总金额进行折扣
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;
}
// 根据会员等级折扣
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;
}
//计算结果赋值给对象上的payAmt变量
this.payAmt = tmp;
}
}
参考资料来源:百度贴吧CSDN博主「公子京」