package util;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dao.CommDAO;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class Info {
//public static String popheight = "alliframe.height=document.body.clientHeight+";
public static String popheight = "alliframe.style.height=document.body.scrollHeight+";
public static HashMap getUser(HttpServletRequest request)
{
HashMap map = (HashMap)(request.getSession().getAttribute("username")==null?request.getSession().getAttribute("user"):request.getSession().getAttribute("username"));
return map;
}
public static int getBetweenDayNumber(String dateA, String dateB) {
long dayNumber = 0;
//1小时=60分钟=3600秒=3600000
long mins = 60L * 1000L;
//long day= 24L * 60L * 60L * 1000L;计算天数之差
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
java.util.Date d1 = df.parse(dateA);
java.util.Date d2 = df.parse(dateB);
dayNumber = (d2.getTime() - d1.getTime()) / mins;
} catch (Exception e) {
e.printStackTrace();
}
return (int) dayNumber;
}
public static void main(String[] g )
{
System.out.print(Info.getBetweenDayNumber("2012-11-11 11:19", "2012-11-11 11:11"));
}
public static String getselect(String name,String tablename,String zdname)
{
String select = "<select name=\""+name+"\" id=\""+name+"\" >";
for(HashMap permap:new CommDAO().select("select * from "+tablename+" order by id desc")){
select+="<option value=\""+permap.get(zdname)+"\">"+permap.get(zdname)+"</option>";
}
select+="</select>";
return select;
}
public static String getselectsl(String name,String tablename,String zdname)
{
String select = "<select name=\""+name+"\" id=\""+name+"\" onchange='gow();'>";
select+="<option value=''>请选择</option>";
for(HashMap permap:new CommDAO().select("select * from "+tablename+" order by id desc")){
select+="<option value=\""+permap.get(zdname)+"\">"+permap.get(zdname)+"</option>";
}
select+="</select>";
return select;
}
public static String getselect(String name,String tablename,String zdname,String where)
{
String select = "<select name=\""+name+"\" id=\""+name+"\" >";
select+="<option value=\"\">不限</option>";
for(HashMap permap:new CommDAO().select("select * from "+tablename+" where "+where+" order by id desc")){
String optionstr = "";
if(zdname.split(";").length==1){
optionstr=permap.get(zdname.split("~")[0]).toString();
}else{
for(String str:zdname.split(";"))
{
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名")?"":(str.split("~")[1]+":");
optionstr+=zdnamestr+permap.get(zdstr)+" - ";
}
}
if(optionstr.indexOf(" - ")>-1)optionstr=optionstr.substring(0,optionstr.length()-3);
select+="<option value=\""+optionstr+"\">"+optionstr+"</option>";
}
select+="</select>";
return select;
}
public static String getradio(String name,String tablename,String zdname,String where)
{
String radio="";
int dxii = 0;
for(HashMap permap:new CommDAO().select("select * from "+tablename+" where "+where+" order by id desc")){
String check="";
if(dxii==0)check="checked=checked";
String optionstr = "";
for(String str:zdname.split(";"))
{
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名")?"":(str.split("~")[1]+":");
optionstr+=zdnamestr+permap.get(zdstr)+" - ";
}
if(optionstr.length()>0)optionstr=optionstr.substring(0,optionstr.length()-3);
radio+="<label><input type='radio' name='"+name+"' "+check+" value=\""+optionstr+"\">"+optionstr+"</label>\n";
dxii++;
}
return radio;
}
public static void writeExcel(String fileName,String prosstr,java.util.List<List> plist,HttpServletRequest request, HttpServletResponse response){
WritableWorkbook wwb = null;
String cols = "";
for(String str:prosstr.split("@"))
{
cols+=str.split("-")[0]+",";
}
cols = cols.substring(0,cols.length()-1);
String where = request.getAttribute("where")==null?"":request.getAttribute("where").toString();
List<List> mlist = new CommDAO().selectforlist("select "+cols+" from "+fileName+" "+where+" order by id desc");
fileName = request.getRealPath("/")+"/upfile/"+Info.generalFileName("a.xls");
String[] pros = prosstr.split("@");
try {
//首先要使用Workbook类的工厂方法创建一个可写入的工作薄(Workbook)对象
wwb = Workbook.createWorkbook(new File(fileName));
} catch (IOException e) {
e.printStackTrace();
}
if(wwb!=null){
//创建一个可写入的工作表
//Workbook的createSheet方法有两个参数,第一个是工作表的名称,第二个是工作表在工作薄中的位置
WritableSheet ws = wwb.createSheet("sheet1", 0);
ws.setColumnView(0,20);
ws.setColumnView(1,20);
ws.setColumnView(2,20);
ws.setColumnView(3,20);
ws.setColumnView(4,20);
ws.setColumnView(5,20);
try {
for(int i=0;i<pros.length;i++)
{
Label label1 = new Label(i, 0,"");
label1.setString(pros[i]);
ws.addCell(label1);
}
} catch (RowsExceededException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (WriteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//下面开始添加单元格
int i=1;
for(List t:mlist){
try {
Iterator it = t.iterator();
int jj=0;
while(it.hasNext())
{
Label label1 = new Label(jj, i,"");
String a = it.next().toString();
label1.setString(a);
ws.addCell(label1);
jj++;
}
i++;
} catch (RowsExceededException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (WriteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
try {
//从内存中写入文件中
wwb.write();
//关闭资源,释放内存
wwb.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
try {
response.sendRedirect("upload?filename="+fileName.substring(fi
没有合适的资源?快使用搜索试试~ 我知道了~
基于JavaScript MySQL实现企业供应商管理系统【优质毕业设计、课程设计项目】.zip
共255个文件
jsp:134个
jpg:24个
png:22个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 175 浏览量
2023-06-08
23:15:41
上传
评论 1
收藏 5.76MB ZIP 举报
温馨提示
优质毕业设计、课程设计项目,包括:程序源代码、数据库、配置环境说明,可完美运行。
资源推荐
资源详情
资源评论
收起资源包目录
基于JavaScript MySQL实现企业供应商管理系统【优质毕业设计、课程设计项目】.zip (255个子文件)
Info.class 23KB
CommDAO.class 16KB
MainCtrl.class 13KB
PageManager.class 6KB
Upload.class 3KB
StrUtil.class 3KB
SetChar.class 3KB
.classpath 1KB
org.eclipse.wst.jsdt.ui.superType.container 49B
common.css 118KB
commonqt.css 118KB
style.css 14KB
datepicker.css 4KB
datepicker.css 4KB
divqt.css 4KB
div.css 4KB
css.css 1KB
css.css 234B
WdatePicker.css 158B
index.css 100B
1333963445546.gif 8KB
1333963398718.gif 8KB
img.gif 2KB
img.gif 2KB
datePicker.gif 1KB
dialogclose.gif 114B
dialogclose.gif 114B
Upload.gif 111B
jxl.jar 597KB
sqljdbc.jar 570KB
sqljdbc4.jar 525KB
mysql-connector-java-5.0.4-bin.jar 484KB
zxing-1.6-core.jar 323KB
jtds-1.2.2 .jar 288KB
msbase.jar 278KB
commons-io-1.3.2.jar 86KB
mssqlserver.jar 63KB
msutil.jar 58KB
commons-fileupload-1.2.1.jar 56KB
json_simple-1.1.jar 16KB
jspsmartupload.jar 14KB
Info.java 25KB
MainCtrl.java 20KB
CommDAO.java 19KB
PageManager.java 7KB
Upload.java 4KB
StrUtil.java 3KB
SetChar.java 2KB
1317086069593.jpg 577KB
1317085922265.jpg 353KB
1317085910921.jpg 239KB
1317086056687.jpg 235KB
shangpinxinxi3.jpg 147KB
1317085936937.jpg 104KB
yhtx5.jpg 55KB
yhtx3.jpg 45KB
1333961148718.jpg 34KB
nopic5.jpg 32KB
nopic1.jpg 32KB
nopic2.jpg 32KB
nopic3.jpg 32KB
nopic4.jpg 32KB
yhtx1.jpg 25KB
shangpinxinxi1.jpg 21KB
shangpinxinxi2.jpg 13KB
shangpinxinxi5.jpg 13KB
shangpinxinxi4.jpg 11KB
yhtx4.jpg 8KB
yhtx2.jpg 5KB
1333963661093.jpg 4KB
nopic.jpg 3KB
bg.jpg 307B
echarts.min.js 727KB
jq.js 284KB
jquery.js 82KB
jquery.js 69KB
bootbox.js 38KB
common.js 36KB
calendar.js 21KB
popup.js 18KB
popups.js 16KB
WdatePicker.js 9KB
Particleground.js 7KB
prototype.lite.js 3KB
collection.js 3KB
verificationNumbers.js 2KB
function.js 1KB
ajax.js 1KB
zh-cn.js 1KB
zh-tw.js 1KB
onclock.JS 725B
en.js 644B
.jsdtscope 406B
xiaoshouxinxi_add.jsp 8KB
caigouxinxi_add.jsp 8KB
shangpinchuku_add.jsp 7KB
shangpinruku_add.jsp 7KB
yuangongxinxi_add.jsp 6KB
shangpinzhijian_add.jsp 6KB
left_guanliyuan.jsp 6KB
共 255 条
- 1
- 2
- 3
资源评论
- ly壹亿壹壹2024-05-16资源内容详尽,对我有使用价值,谢谢资源主的分享。
不脱发的程序猿
- 粉丝: 24w+
- 资源: 5791
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功