function.java
来自「采用struts+hibernet+javabean+jsp 些得shop购物网」· Java 代码 · 共 258 行
JAVA
258 行
package com.hnzt.bean;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hnzt.dao.Dao;
import com.hnzt.po.Affiche;
import com.hnzt.po.Customer;
import com.hnzt.po.Manufacturer;
import com.hnzt.po.MeUser;
import com.hnzt.po.OrdersTotalPrices;
import com.hnzt.po.Product;
public class Function {
Dao dao = new Dao();
Product p = new Product();
Manufacturer m = new Manufacturer();
public String GBK2ISO(String s) throws Exception {
return new String(s.getBytes("GBK"), "ISO8859_1");
}
public String ISO2GBK(String s) throws Exception {
return new String(s.getBytes("ISO8859_1"), "GBK");
}
public String getAffiche()
{
Dao d = new Dao();
List l = new ArrayList();
l = d.showAlldb("Affiche");
Affiche a = new Affiche();
a = (Affiche)l.get(0);
return a.getContent().toString();
}
public String getordername(String number)
{
String hql = "from Product as p where p.number = '"+ number +"'";
List l = (List)dao.Bbport(hql);
if(l.size()> 0)
{
p = (Product)l.get(0);
return p.getName();
}
return "";
}
public String getUserNumber(String user)
{
String hql = "from MeUser as m where m.user='"+ user +"'";
List l = (List)dao.Bbport(hql);
MeUser m = new MeUser();
m = (MeUser)l.get(0);
return m.getUserNumber().toString();
}
public double getorderprice(String number)
{
String hql = "from Product as p where p.number = '"+ number +"'";
List l = (List)dao.Bbport(hql);
if(l.size()> 0)
{
p = (Product)l.get(0);
return p.getPrice().doubleValue();
}
return 0.0;
}
public String getManufacturer(String number)
{
String hql = "from Manufacturer as p where p.manufacturerNumber = '"+ number +"'";
List l = (List)dao.Bbport(hql);
if(l.size()> 0)
{
m = (Manufacturer)l.get(0);
return m.getManufacturerName();
}
return "";
}
public boolean GetOrderDate()
{
SimpleDateFormat s = new SimpleDateFormat("dd");//转换日期格式
Date now = new Date();//提取当天日期。
String tim = s.format(now);//转换日期
String [] odate = {"01","11","21"};
if(tim.equals(odate[0]))
{
return true;
}else if(tim.equals(odate[1]))
{
return true;
}else if(tim.equals(odate[2]))
{
return true;
}else{
return false;
}
}
public List getOrdnum()
{
List l = new ArrayList();
String hql = "select ordernumber from Orders where stat=0 GROUP BY ordernumber";
l = dao.Bbport(hql);
return l;
}
public List getmeOrdnum()
{
List l = new ArrayList();
String hql = "select ordernumber from Orders where stat>0 and stat<5 GROUP BY ordernumber";
l = dao.Bbport(hql);
return l;
}
public List getmejiezhang()
{
List l = new ArrayList();
String hql = "select ordernumber from Orders where stat=5 GROUP BY ordernumber";
l = dao.Bbport(hql);
return l;
}
public List getPjnumber(String manuf)
{
List l = new ArrayList();
String hql = "select pronumber from Pjparticular where manufnumber='"+ manuf +"' and sign=0 GROUP by pronumber";
l = dao.Bbport(hql);
return l;
}
public List getPjnumberfa(String manuf)
{
List l = new ArrayList();
String hql = "select pronumber from Pjparticular where manufnumber='"+ manuf +"' and sign=1 GROUP by pronumber";
l = dao.Bbport(hql);
return l;
}
public List getMePjnumber()
{
List l = new ArrayList();
String hql = "select username from Pjparticular where sign=2 GROUP by username";
l = dao.Bbport(hql);
return l;
}
public List getPjinfo(String pron,String manuf)
{
List l = new ArrayList();
String hql = "select pronumber,pjbw,sum(amount) from Pjparticular where pronumber='"+ pron +"' and manufnumber='"+ manuf +"' and sign=0 GROUP by pjbw";
l = dao.Bbport(hql);
return l;
}
public List getPjinfofa(String pron,String manuf)
{
List l = new ArrayList();
String hql = "select pronumber,pjbw,sum(amount) from Pjparticular where pronumber='"+ pron +"' and manufnumber='"+ manuf +"' and sign=1 GROUP by pjbw";
l = dao.Bbport(hql);
return l;
}
public List getMePjinfo(String user)
{
List l = new ArrayList();
String hql = "select username,pronumber,pjbw,sum(amount) from Pjparticular where username='"+ user +"' and sign=2 GROUP by pronumber,pjbw";
l = dao.Bbport(hql);
return l;
}
public String getPjname(String number)
{
String hql = "select classname from Peijian where number='"+ number +"'";
return dao.Bbport(hql).get(0).toString();
}
public String getproname(String number)
{
String hql = "select pnumber from Product where number='"+ number +"'";
return dao.Bbport(hql).get(0).toString();
}
public String getboss(String user)
{
String hql = "select boss from Manufacturer where user='"+ user +"'";
return dao.Bbport(hql).get(0).toString();
}
public String getjqusername(String user)
{
String hql = "select username from MeUser where user='"+ user +"'";
return dao.Bbport(hql).get(0).toString();
}
public List getOrder(String onum)
{
List l = new ArrayList();
l = dao.showdbid("Orders", "ordernumber", onum);
return l;
}
public String getPrice_total(String onum)
{
List l = new ArrayList();
OrdersTotalPrices tpp = new OrdersTotalPrices();
l = dao.showdbid("OrdersTotalPrices", "ordernumber", onum);
if(l.size()>0)
{
tpp = (OrdersTotalPrices)l.get(0);
return tpp.getTotalPrices().toString();
}
return "";
}
public Customer getcu(String name)
{
Customer c = new Customer();
List l = new ArrayList();
l = dao.showdbid("Customer", "user", name);
if(l.size()>0)
{
c = (Customer)l.get(0);
}
return c;
}
public String zhuangtai(int val)
{
String content = null;
switch(val)
{
case 0:content="订单已发出";break;
case 1:content="订单已确认";break;
case 2:content="工厂已接单";break;
case 3:content="工厂已发货";break;
case 4:content="<font color=red>江桥已接单</font>";break;
case 5:content="江桥已发货";break;
}
return content ;
}
public static void main(String args[])
{
Object o = new Object();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?