我是靠谱客的博主 开放月饼,最近开发中收集的这篇文章主要介绍ssh Action,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

package com.bluecat.cash.action;


import java.io.IOException;

import java.text.DecimalFormat;

import java.util.List;


import javax.annotation.Resource;


import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Controller;


import com.bluecat.admin.util.Tool;

import com.bluecat.biz.AssociatorBiz;

import com.bluecat.biz.DiningTableBiz;

import com.bluecat.biz.OrderDetailBiz;

import com.bluecat.biz.OrderInfoBiz;

import com.bluecat.cash.util.CashTools;

import com.bluecat.cash.util.TicketBills;

import com.bluecat.entity.Associator;

import com.bluecat.entity.DiningTable;

import com.bluecat.entity.Employee;

import com.bluecat.entity.OrderDetail;

import com.bluecat.entity.OrderInfo;

import com.google.gson.Gson;

import com.sun.org.apache.xalan.internal.xsltc.compiler.sym;

@Controller

@Scope("prototype")

public class OrderInfoAction extends BaseAction{

private OrderInfo orderInfo=new OrderInfo();

private DiningTable diningTable=new DiningTable();

private Associator associator=new Associator();

@Resource

private OrderInfoBiz orderInfoBiz;

@Resource

private DiningTableBiz diningTableBiz;

@Resource

private OrderDetailBiz orderDetailBiz;

@Resource

private AssociatorBiz associatorBiz;

/** 

* @Description:  去到结账页面

* @return    

* @author xvechen

*/ 

public String toPayMoney(){

//查找出所有的桌台号并放到请求域中

List<DiningTable> tableList=diningTableBiz.selectAllDingingTable();

this.request.setAttribute("tableList", tableList);

return "payMoney";

}

/**

* @Description:根据订单号查看所有信息

* @return String

* @author luojin

* @version : 2013-11-20下午4:10:10

*/

public String checkctOrderId(){

try {

OrderInfo order=orderInfoBiz.selectorId(orderInfo);

if(order==null){

Tool.getResponse().getWriter().print(0);

}else {

Tool.getResponse().getWriter().print(1);

}

} catch (IOException e) {

e.printStackTrace();

}


return null;

}

/**

* @Description:点击餐桌结账如果状态为4不显示结算界面

* @return String

* @author luojin

* @version : 2013-11-20下午4:51:31

*/

public String checkOrderStats(){

try {

String tabId= Tool.getRequest().getParameter("cttxt");

OrderInfo ordStats= orderInfoBiz.select1(tabId);

Tool.getResponse().getWriter().print(ordStats!=null?1:0);

} catch (IOException e) {

e.printStackTrace();

}

return null;

}

/** 

* @Description:  更具桌台好查找相对应的订单信息    

* @author xvechen;

* @chang luojin

*/ 

public String getOrderInfoByAjax(){

String tabId=request.getParameter("cttxt");

orderInfo.setOrderId(tabId);

OrderInfo orderinfo = orderInfoBiz.selectorId(orderInfo);

Tool.getRequest().setAttribute("order",orderinfo);

String money="¥";

Tool.getRequest().setAttribute("money", money);

String yuan="元";

Tool.getRequest().setAttribute("yuan", yuan);

if(orderinfo!=null){

List<OrderDetail> orderDetail=orderDetailBiz.select(orderinfo.getOrderId());

Tool.getRequest().setAttribute("detail", orderDetail);

}

List<DiningTable> tableList= this.diningTableBiz.selectAllDingingTable();

Tool.getRequest().setAttribute("tableList", tableList);

return "payMoney";


}

/** 

* @Description: 检查餐台信息    

* @author luojin;

*/ 

public String checkctEmpty(){

String tabId=request.getParameter("cttxt");

orderInfo = orderInfoBiz.checkct(tabId);

OrderInfo orderinfo = orderInfoBiz.select1(tabId);

Tool.getSession().setAttribute("ctnum", orderinfo.getDiningTable().getDinTabId());

Tool.getSession().setAttribute("servuser", orderinfo.getWaiter().getEmpName());

Tool.getSession().setAttribute("ordersession", orderinfo);

if(orderinfo!=null){

List<OrderDetail> orderDetail=orderDetailBiz.select(orderinfo.getOrderId());

Tool.getSession().setAttribute("detailsession", orderDetail);

}

List<DiningTable> tableList= this.diningTableBiz.selectAllDingingTable();

Tool.getSession().setAttribute("tableListsession", tableList);

if(orderInfo!=null){

orderInfo.setAssocCard(null);

orderInfo.setCasher(null);

orderInfo.setWaiter(null);

orderInfo.setDiningTable(null);

}

try {

response.getWriter().println(new Gson().toJson(orderInfo).toString());

} catch (IOException e) {

e.printStackTrace();

}

return "PayCounts";

}

/**

*  描述: 金额结算更新各表状态

* @author luojin

* @throws IOException 

*/

public String CountPayMoney() throws IOException{

   String tel= Tool.getRequest().getParameter("Tel");

   String insertPrice=Tool.getRequest().getParameter("insertPrice");

   String rvsPrices=Tool.getRequest().getParameter("rvsPrices");

   String ogfIntegs=Tool.getRequest().getParameter("ogfIntegs");

   String rvsPrice=Tool.getRequest().getParameter("rvsPrice");

   Employee employee=(Employee) Tool.getSession().getAttribute("employee");

   Associator associators=null;

   List<OrderDetail> orderDetail=null;

OrderInfo getorderIdall=orderInfoBiz.selectSingleOrderInfo(orderInfo);

Employee emp=new Employee();

emp.setEmpId(employee.getEmpId());

getorderIdall.setCasher(emp);

orderInfoBiz.update(getorderIdall);

if(getorderIdall!=null){

orderDetail=orderDetailBiz.select(getorderIdall.getOrderId());

}

int integrals=CashTools.PriceToAssocIntegral(orderInfo.getTotalMoney());

getorderIdall.setOrderId(orderInfo.getOrderId());

//有输入会员号的时候

if(tel!=null && !tel.trim().equals("")){

  associator.setAssocTel(tel);

  associator.setAssocIntegral(integrals);

  //还要根据会员号查出员原积分

  associators=associatorBiz.selectAssocTel(associator);

  associatorBiz.updateIntergs(associator);

  Associator asid=new Associator();

  asid.setAssocCard(associators.getAssocCard());

  getorderIdall.setAssocCard(asid);

  orderInfoBiz.update(getorderIdall);

}

getorderIdall.setOrderStatus(4);

//这里修改金额

if(insertPrice.equals("0")){

getorderIdall.setTotalMoney((float) 0);

orderInfoBiz.update(getorderIdall);

}

if(!insertPrice.equals("0")){

getorderIdall.setTotalMoney(orderInfo.getTotalMoney());

orderInfoBiz.update(getorderIdall);

}

diningTable.setDinTabId(diningTable.getDinTabId());

DiningTable dTable= diningTableBiz.selectAll(diningTable);

dTable.setDinTabStatus(0);

diningTableBiz.update(dTable);

//输出小票信息

String paths= Tool.getRequest().getServletContext().getRealPath("/");

String orgImg=paths+"Cash/images/bill.jpg";

String ysPrice=Tool.getRequest().getParameter("yingshou");

String zlinPrice=Tool.getRequest().getParameter("savePrice");

System.out.println("找零"+zlinPrice);

String zks=Tool.getRequest().getParameter("zks");

System.out.println("折扣"+zks);

System.out.println("折扣"+zks.equals(""));

TicketBills tBills=new TicketBills(orgImg,getorderIdall,associators,orderDetail,dTable,ysPrice,insertPrice,zlinPrice,zks,rvsPrices,ogfIntegs);

Tool.getResponse().getWriter().print(1);

return null;

}

public String accountFinsh() throws IOException{

Employee employee=(Employee) Tool.getSession().getAttribute("employee");

    List<Object[]> accounPrice=orderInfoBiz.accountFinsh(employee);

    System.out.println(accounPrice.size()+"dd"+accounPrice);

    if(accounPrice.size()!=1){

    float totals=0;

    String buss=null;

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

     totals=Float.valueOf((accounPrice.get(i)[0]).toString());

 buss=String.valueOf(accounPrice.get(i)[1]);

 System.out.println(buss+totals);

}

    orderInfo.setOrderId(buss);

    DecimalFormat df = new DecimalFormat("#.00");

    orderInfo.setTotalMoney(Float.valueOf(df.format(totals)));

    Tool.getRequest().setAttribute("cts",orderInfo);

    }

return "asscoutfinsh";

}

/**

* @Description:没有时间做销毁Session

* @return String

* @author luojin

* @version : 2013-11-29上午12:32:28

*/

    public String exit(){

    Tool.getSession().removeAttribute("ctnum");

    Tool.getSession().removeAttribute("servuser");

    Tool.getSession().removeAttribute("ordersession");

    Tool.getSession().removeAttribute("employee");

    return "exit";

    }

/** 

* 描述:  更新订单状态

* @author xvechen

* @date: 2013-11-5 下午10:22:12 

*/ 

public void updateOrderStatus(){

orderInfo=orderInfoBiz.selectSingleOrderInfo(orderInfo);

orderInfo.setOrderStatus(3);

orderInfoBiz.update(orderInfo);

}

public OrderInfo getOrderInfo() {

return orderInfo;

}

public void setOrderInfo(OrderInfo orderInfo) {

this.orderInfo = orderInfo;

}

public DiningTable getDiningTable() {

return diningTable;

}

public void setDiningTable(DiningTable diningTable) {

this.diningTable = diningTable;

}

public static void main(String[] args) {

OrderInfo o=new OrderInfo();

o.setOrderId("1");

System.out.println(new Gson().toJson(o));

}


}


转载于:https://my.oschina.net/u/1042750/blog/186719

最后

以上就是开放月饼为你收集整理的ssh Action的全部内容,希望文章能够帮你解决ssh Action所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部