package com.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.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URLEncoder;
import java.net.UnknownHostException;
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 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("admin")==null?request.getSession().getAttribute("user"):request.getSession().getAttribute("admin"));
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 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 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("/vehiclemanagementsys/upload?filename="+fileName.substring(fileName.lastIndexOf("/")+1));
} catch (IOException e) {
e.printStackTrace();
}
}
public static String getcheckbox(String name,String tablename,String zdname,String where)
{
String checkbox="";
for(HashMap permap:new CommDAO().select("select * from "+tablename+" where "+where+" order by id desc")){
String optionstr = "";
for(String str:zdname.split(";"))
{
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名")?"":(str.split("
没有合适的资源?快使用搜索试试~ 我知道了~
基于ssm+mysql+jsp实现在线花店
共1277个文件
png:186个
xml:178个
class:146个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 65 浏览量
2023-01-15
20:27:35
上传
评论 2
收藏 161.33MB RAR 举报
温馨提示
一、系统介绍 1、系统主要功能: 客户:主页、用户登陆、用户注册、个人中心、我的购物车、我的订单、收藏 系统管理员:订单管理、客户管理、商品管理、类目管理、公告管理、留言管理、统计管理 2、环境配置 系统开发平台:Tomcat8.0+JDK1.8+Windows 开发语言:JavaEE 框架:SSM-Spring+SpringMVC+Mybatis 前端:JSP 数据库:MySql5.7以上 开发环境:Intelij Idea 浏览器:Chrome 详见:https://blog.csdn.net/Timi2019/article/details/128697170
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm+mysql+jsp实现在线花店 (1277个子文件)
Info.class 23KB
Info.class 23KB
OrdermsgController.class 16KB
OrdermsgController.class 16KB
CommDAO.class 16KB
CommDAO.class 16KB
ProductController.class 13KB
ProductController.class 13KB
MemberController.class 10KB
MemberController.class 10KB
ExportExcel.class 9KB
ExportExcel.class 9KB
CartController.class 7KB
CartController.class 7KB
IndexController.class 7KB
IndexController.class 7KB
NewsController.class 7KB
NewsController.class 7KB
MessageController.class 7KB
MessageController.class 7KB
UserController.class 6KB
UserController.class 6KB
FavController.class 5KB
FavController.class 5KB
StatisticsController.class 5KB
StatisticsController.class 5KB
Product.class 5KB
Product.class 5KB
InventoryController.class 4KB
InventoryController.class 4KB
StrUtil.class 4KB
StrUtil.class 4KB
Member.class 3KB
Member.class 3KB
LogisticsController.class 3KB
LogisticsController.class 3KB
PictureController.class 3KB
PictureController.class 3KB
Ordermsg.class 3KB
Ordermsg.class 3KB
CommentController.class 3KB
CommentController.class 3KB
CategoryController.class 3KB
User.class 3KB
CategoryController.class 3KB
User.class 3KB
ServicerController.class 3KB
ServicerController.class 3KB
MySQL.class 3KB
MySQL.class 3KB
Comment.class 2KB
Comment.class 2KB
Cart.class 2KB
Cart.class 2KB
AddressController.class 2KB
AddressController.class 2KB
Message.class 2KB
Message.class 2KB
Ordermsgdetails.class 2KB
Ordermsgdetails.class 2KB
MjController.class 2KB
MjController.class 2KB
Inventory.class 2KB
Inventory.class 2KB
News.class 2KB
News.class 2KB
Address.class 2KB
Address.class 2KB
AboutController.class 2KB
AboutController.class 2KB
TyypbootApplication.class 2KB
TyypbootApplication.class 2KB
PageMessage.class 1KB
PageMessage.class 1KB
Vote.class 1KB
Vote.class 1KB
Fav.class 1KB
Fav.class 1KB
JdkVersion.class 1KB
JdkVersion.class 1KB
DBManager.class 1KB
DBManager.class 1KB
Logistics.class 1KB
Logistics.class 1KB
ProductDAO.class 1KB
ProductDAO.class 1KB
Category.class 1KB
Category.class 1KB
GoWebMvcConfigurerAdapter.class 1KB
GoWebMvcConfigurerAdapter.class 1KB
Picture.class 1KB
Picture.class 1KB
About.class 1KB
About.class 1KB
OrdermsgDAO.class 1018B
OrdermsgDAO.class 1018B
BaseController.class 1004B
BaseController.class 1004B
Servicer.class 970B
Servicer.class 970B
共 1277 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
五星资源
- 粉丝: 5632
- 资源: 1561
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页