package com.ichangeman.cms.company;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
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;
import share.DAO;
import share.Dispatcher;
import share.Req;
import com.ichangeman.cms.Lib;
import com.ichangeman.cms.PageList;
import com.ichangeman.cms.person.GetDateFormat;
public class ExportCompany extends Dispatcher {
private ServletConfig config;
final public void init(ServletConfig config) throws ServletException {
this.config = config;
}
final public ServletConfig getServletConfig() {
return config;
}
public void dispatcher(HttpServletRequest request,
HttpServletResponse response) {
Lib.init(request);
DAO dao = new DAO();
String action = request.getParameter("action");
if (action != null && "exportCompany".equals(action)) {
String companyId = request.getParameter("companyId");
String filePath = "\\export\\company\\"
+ GetDateFormat.getTime(new Date()) + ".xls";
File file = new File(request.getRealPath(filePath));
try {
file.createNewFile();
String url = request.getRequestURL().toString();
ArrayList list = getExportCompany(dao, request, companyId);
// 创建可写入的Excel工作薄
WritableWorkbook wwb;
wwb = Workbook.createWorkbook(file);
// 创建Excel工作表
WritableSheet ws = wwb.createSheet("公司信息列表", 0);
Label data = null;
jxl.write.Number labelN = null;
// 添加标题
String type = Req.getPara(request, "dicttypeid");
if (type == null || "".equals(type)) {
return;
}
ArrayList typeList = dao
.conList("select field,fieldname from t_reportsel where tablename = 't_company' and type='"
+ type + "' order by seq");
if (typeList == null) {
return;
}
for (int x = 0; typeList != null && x < typeList.size(); x++) {
Map map1 = (Map) typeList.get(x);
String fieldname = map1.get("fieldname").toString();
Label column1 = new Label(x, 0, fieldname);
ws.addCell(column1);
}
int column = 0;
int row = 1;
// 添加数据
for (int i = 0; list != null && i < list.size(); i++) {
Map map2 = (Map) list.get(i);
for (int j = 0; typeList != null && j < typeList.size(); j++) {
Map map3 = (Map) typeList.get(j);
String field = map3.get("field").toString();
if ("vocationid".equals(field)) {
String vocationid = dao
.conValue("select d.dataname from t_dictdata d,t_dicttype t where d.dicttypeid = t.dicttypeid and t.typecode='vocationid' and d.datacode='"
+ map2.get(field).toString() + "'");
data = new Label(column, row, vocationid);
ws.addCell(data);
column++;
} else if ("customertype".equals(field)) {
String customertype = dao
.conValue("select d.dataname from t_dictdata d,t_dicttype t where d.dicttypeid = t.dicttypeid and t.typecode='customertype' and d.datacode='"
+ map2.get(field).toString() + "'");
data = new Label(column, row, customertype);
ws.addCell(data);
column++;
} else if ("capiscale".equals(field)) {
String capiscale = dao
.conValue("select d.dataname from t_dictdata d,t_dicttype t where d.dicttypeid = t.dicttypeid and t.typecode='capiscale' and d.datacode='"
+ map2.get(field).toString() + "'");
data = new Label(column, row, capiscale);
ws.addCell(data);
column++;
} else if ("persscale".equals(field)) {
String persscale = dao
.conValue("select d.dataname from t_dictdata d,t_dicttype t where d.dicttypeid = t.dicttypeid and t.typecode='persscale' and d.datacode='"
+ map2.get(field).toString() + "'");
data = new Label(column, row, persscale);
ws.addCell(data);
column++;
} else if ("infosource".equals(field)) {
String infosource = dao
.conValue("select d.dataname from t_dictdata d,t_dicttype t where d.dicttypeid = t.dicttypeid and t.typecode='infosource' and d.datacode='"
+ map2.get(field).toString() + "'");
data = new Label(column, row, infosource);
ws.addCell(data);
column++;
} else if ("customerlevel".equals(field)) {
String customerlevel = dao
.conValue("select d.dataname from t_dictdata d,t_dicttype t where d.dicttypeid = t.dicttypeid and t.typecode='customerlevel' and d.datacode='"
+ map2.get(field).toString() + "'");
data = new Label(column, row, customerlevel);
ws.addCell(data);
column++;
} else {
data = new Label(column, row, map2.get(field)
.toString());
ws.addCell(data);
column++;
}
}
column = 0;
row++;
}
// 写入Exel工作表
wwb.write();
// 关闭Excel工作薄对象
wwb.close();
request.setAttribute("filePath", filePath);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
forward(request, response,"/person/export_personsucceed.jsp");
} else {
ArrayList list = companyquery(dao, request, response);
request.setAttribute("list", list);
// 转到显示层
forward(request, response, "/company/export_companyquery.jsp");
}
}
private ArrayList getExportCompany(DAO dao, HttpServletRequest request, String companyId) {
// 设置参数
String deforder = " order by corpid desc "; // 缺省的排序条件
String table = "t_company"; // 要查询的表名
String sfield = "*"; // 要在select 语句中查询的字段,空或*表示所有
String whereCond = " where corpid in ("+companyId+")";// 附加的查询条件
String url = "";
// 查询数据库
PageList lst = new PageList(request, url, deforder, "1000000",
"");
ArrayList list = lst.initQry(dao, table, whereCond, sfield);
return list;
}
public ArrayList companyquery(DAO dao, HttpServletRequest request,
HttpServletResponse response) {
// 查询功能
String corpname = Req.getPara(request, "corpname").trim();
String vocationid = Req.getPara(request, "vocationid");
String province = Req.getPara(request, "province");
String city = Req.getPara(request, "city");
String address = Req.getPara(request, "address").trim();
String businessscope = Req.getPara(request, "businessscope").trim();
String customertype = Req.getPara(request, "customertype");
String infosource = Req.getPara(request, "infosource");
String isbusiness = Req.getPara(request, "isbusiness");
String islatency = Req.getPara(request, "islatency");
String ispurchase = Req.getPara(request, "ispurchase");
String iscase = Req.getPara(request, "iscase");
String action = Req.getPara(request, "action");
request.setAttribute("corpname", corpname);
request.setAttribute("vocationid", vocationid);
request.setAttribute("province", province);
request.setAttribute("city", city);
request.setAttribute("address", address);
request.setAttribute("businessscope", businessscope);
request.setAttribute("customertype", customertype);
request.setAttribute("infosource", infosource);
request.setAttribute("isbusiness", isbusiness);
request.setAttribute("islatency", islatency);
request.setAttribute("ispurchase", ispurchase);
request.setAttribute("iscase", iscase);
// 设置参数
String deforder = "
没有合适的资源?快使用搜索试试~ 我知道了~
CMS.rar_cms Eclipse_cms客户单机_eclipse mysql_mysql eclipse_客户信息管理系统
共769个文件
js:191个
gif:164个
jsp:97个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 124 浏览量
2022-09-20
17:44:26
上传
评论
收藏 3.02MB RAR 举报
温馨提示
简单的客户信息管理系统,实现了项目信息管理,客户信息管理等功能 使用tomcat + Eclipse + mysql实现
资源推荐
资源详情
资源评论
收起资源包目录
CMS.rar_cms Eclipse_cms客户单机_eclipse mysql_mysql eclipse_客户信息管理系统 (769个子文件)
spellchecker.cfm 5KB
ExportCompany.class 10KB
ExportPerson.class 9KB
MD5.class 9KB
Util.class 8KB
MD5.class 8KB
PageList.class 7KB
EmailSender.class 7KB
ImportCompany.class 6KB
EmailSender.class 6KB
ImportPerson.class 6KB
Mail.class 6KB
LogStatList2.class 6KB
ProjectStageAdd.class 6KB
CompanyAdd.class 5KB
ProjectStageList.class 5KB
CompanyQuery.class 5KB
SellInfoEdit.class 5KB
saleroomEdit.class 5KB
CompanyEdit.class 5KB
DetailedInfoList.class 5KB
roleAdd.class 5KB
SellInfoList.class 5KB
saleroom.class 4KB
ProjectList.class 4KB
SenderWithSMTPVer.class 4KB
saleroomAdd.class 4KB
PersonQueryList.class 4KB
CompanyList.class 4KB
SellInfoAdd.class 4KB
roleEdit.class 4KB
PersonList.class 4KB
UserEdit.class 4KB
PersonAdd.class 4KB
DicttypeList.class 4KB
StageTotalEdit.class 4KB
StageTotalAdd.class 4KB
LogList.class 4KB
SendMailAction.class 4KB
StageTotalList.class 4KB
UserAdd.class 4KB
PersonEdit.class 4KB
DictdataList.class 4KB
ProjectEdit.class 4KB
LogAdd.class 4KB
ProjectAdd.class 4KB
DownLoad.class 4KB
role.class 4KB
ProjectStageEdit.class 4KB
LogEdit.class 4KB
LogStatList.class 4KB
UserList.class 3KB
DicttypeEdit.class 3KB
DictdataEdit.class 3KB
KeyPersonList.class 3KB
DictdataAdd.class 3KB
ProjectView.class 3KB
Index.class 3KB
DicttypeAdd.class 3KB
LogStatView.class 3KB
PickProjectStage.class 3KB
EmployeeList.class 3KB
CompanyList.class 3KB
ExpCorpSelect.class 3KB
ExpPersonSelect.class 3KB
pickSaleprojectname.class 3KB
PickProjectInfo.class 3KB
PickerProjectList.class 3KB
CompanyList.class 3KB
CompanySelect.class 3KB
CompanySelect.class 3KB
DownLoadBefore.class 2KB
EmployeeList.class 2KB
CompanyQueryList.class 2KB
roleView.class 2KB
StageTotalView.class 2KB
SaleroomDetailedView.class 2KB
saleroomView.class 2KB
ProjectStageView.class 2KB
PropertyMgr.class 2KB
SellInfoView.class 2KB
UserView.class 2KB
DictdataView.class 2KB
LogView.class 2KB
PersonView.class 2KB
DicttypeView.class 2KB
CompanyView.class 2KB
DetailedQuery.class 2KB
Lib.class 2KB
PagerFilter.class 1KB
EmailAuthenticator.class 1KB
EmailAuthenticator.class 1KB
GetDateFormat.class 968B
Mail$1.class 809B
.classpath 931B
org.eclipse.wst.common.component 474B
org.eclipse.wst.jsdt.ui.superType.container 49B
jx.css 27KB
cms.css 27KB
fck_editor.css 8KB
共 769 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
APei
- 粉丝: 63
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- HCIP-Datacom笔记 (1).pdf
- yolov5,SSD 可能使用到的一些代码
- bbbbbbbbbbbbbbbbbb
- 安卓逆向学习笔记之Frida Stalker 还原OLLVM AES.docx
- 安卓逆向学习笔记之unicorn来trace还原OLLVM Base64.docx
- 最新版本私钥助记词碰撞器大富豪使用python进行制作通过接口的方式进行验证支持多币种多链多网络一分钟万次验证高出货率
- 介绍离散性制造行业的MES系统流程
- Arduino IDE压缩包版本,2024年4月26日,最新版本
- 基于IDEA-CCNL/Randeng-Pegasus-238M-Summary-Chines微调的中文文本摘要任务源码+数据集
- 自动驾驶-状态估计和定位之直方图滤波(Histogram+Filter)定位应用和源码.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功