package crm.filiale;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sys.dao.ConnectManager;
import sys.dao.bean.Company;
import sys.dao.bean.Personnel;
public class FCompany extends HttpServlet
{
private static final long serialVersionUID = 1L;
// 部门经理查询员工客户
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// 参数初始化
boolean p = false;
ConnectManager cm = ConnectManager.newInstance();
RequestDispatcher rd = null;
String dept = request.getParameter("deptid").replace(" ", "");
if (dept.equals(""))
{
request.getSession().setAttribute("dept", "");
}
else
{
request.getSession().setAttribute("dept", dept);
}
String personnelid = request.getParameter("personnelid").replace(" ", "");
if (personnelid.equals(""))
{
request.getSession().setAttribute("personnelid", "");
}
else
{
request.getSession().setAttribute("personnelid", personnelid);
}
Integer stype = Integer.valueOf(request.getParameter("stype").replace(" ", ""));
if (stype.equals(""))
{
request.getSession().setAttribute("stype", "");
}
else
{
request.getSession().setAttribute("stype", stype);
}
String content = request.getParameter("content").replace(" ", "");
if (content.equals(""))
{
request.getSession().setAttribute("content", "");
}
else
{
request.getSession().setAttribute("content", content);
}
String industry = request.getParameter("industry").replace(" ", "");
if (industry.equals(""))
{
request.getSession().setAttribute("industry", "");
}
else
{
request.getSession().setAttribute("industry", industry);
}
String state = request.getParameter("state").replace(" ", "");
if (state.equals(""))
{
request.getSession().setAttribute("state", "");
}
else
{
request.getSession().setAttribute("state", state);
}
String type = request.getParameter("type").replace(" ", "");
if (type.equals(""))
{
request.getSession().setAttribute("type", "");
}
else
{
request.getSession().setAttribute("type", stype);
}
String gotime = request.getParameter("gotime").replace(" ", "");
if (gotime.equals(""))
{
request.getSession().setAttribute("gotime", "");
}
else
{
request.getSession().setAttribute("gotime", gotime);
}
String endtime = request.getParameter("endtime").replace(" ", "");
if (endtime.equals(""))
{
request.getSession().setAttribute("endtime", "");
}
else
{
request.getSession().setAttribute("endtime", endtime);
}
List<Company> companies = null;
ResultSet rs = null;
String sql = "";
List<String> list = new ArrayList<String>();
String str = "";
String temp = "";
String sqltemp = "";
try
{
// 打开数据库
if (cm.getConnection())
{
try
{
// 开始拼装SQL
if (!"".equals(personnelid))
{
request.getSession().setAttribute("perid", personnelid);
// 这一段SQL是统计与查询通用的
str = str + " personnelid in (" + personnelid + ")";
if (!("".equals(gotime) && "".equals(endtime)))
{
temp = temp + " and indate in (select indate from company where indate >= '" + gotime + "' and indate <= '" + endtime + "')";
}
// 开始进行统计
// 统计查询结果的总条数
sql = "select count(*) from company where " + str + temp;
rs = cm.executeQuery(sql);
rs.next();
int i = rs.getInt(1);
// 查询是哪个业务员的记录
sql = "select * from personnel where" + str;
rs = cm.executeQuery(sql);
if (rs.next())
{
list.add(rs.getString("realname") + "已查询到的客户数是:" + i);
String string = "";
string = string + "A库数量:" + rs.getInt(1);
// 统计在查询结是中的B库数据
sql = "select count(*) from company where " + str + temp + "and companystate = 'B'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " B库数量:" + rs.getInt(1);
// 统计在查询结是中的A类客户数据
sql = "select count(*) from company where " + str + temp + "and type = 'A'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " A类客户数量:" + rs.getInt(1);
// 统计在查询结是中的B类客户数据
sql = "select count(*) from company where " + str + temp + "and type = 'B'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " B类客户数量:" + rs.getInt(1);
// 统计在查询结是中的C类客户数据
sql = "select count(*) from company where " + str + temp + "and type = 'C'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " C类客户数量:" + rs.getInt(1);
// 统计在查询结是中的D类客户数据
sql = "select count(*) from company where " + str + temp + "and type = 'D'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " D类客户数量:" + rs.getInt(1);
// 统计在查询结是中的E类客户数据
sql = "select count(*) from company where " + str + temp + "and type = 'E'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " E类客户数量:" + rs.getInt(1);
list.add(string);
request.setAttribute("list", list);
}
}
else
{
// 开始拼装SQL
if (!"".equals(dept))
{
request.getSession().removeAttribute("perid");
// 这一段SQL是统计与查询通用的
str = str + " personnelid in (select personnelid from personnel where outdate is null and deptid = " + dept + ")";
if (!("".equals(gotime) && "".equals(endtime)))
{
temp = temp + " and indate in (select indate from company where indate >= '" + gotime + "' and indate <= '" + endtime + "')";
}
// 开始进行统计
// 统计查询结果的总条数
sql = "select count(*) from company where " + str + temp;
rs = cm.executeQuery(sql);
rs.next();
int i = rs.getInt(1);
// 查询是哪个部门的记录
sql = "select * from dept where deptid = " + dept;
rs = cm.executeQuery(sql);
if (rs.next())
{
list.add(rs.getString("deptname") + "已查询到的客户数是:" + i);
// 统计在查询结是中的A库数据
sql = "select count(*) from company where " + str + temp + "and companystate = 'A'";
rs = cm.executeQuery(sql);
rs.next();
String string = "";
string = string + "A库数量:" + rs.getInt(1);
// 统计在查询结是中的B库数据
sql = "select count(*) from company where " + str + temp + "and companystate = 'B'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " B库数量:" + rs.getInt(1);
// 统计在查询结是中的A类客户数据
sql = "select count(*) from company where " + str + temp + "and type = 'A'";
rs = cm.executeQuery(sql);
rs.next();
string = string + " A类客户数量:" + rs.getInt(1);
// 统计在查询结是中的B类客户数据
sql = "select coun
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ERP管理系统 (312个子文件)
changedate.js.bak 24KB
FCompany.class 22KB
Company.class 17KB
Export.class 17KB
Personnel.class 14KB
Statistic.class 12KB
MCompany.class 11KB
VisitList.class 11KB
Export.class 10KB
Bill.class 10KB
SearchC.class 8KB
SearchC.class 8KB
DestineNote.class 8KB
Visit.class 8KB
Search.class 8KB
Login.class 7KB
Industry.class 7KB
Linkman.class 7KB
SelectPersonnel.class 7KB
Dept.class 7KB
CtoA.class 6KB
VisitList.class 6KB
SelectA.class 6KB
Select.class 6KB
AddCompany.class 5KB
AddSort.class 5KB
SelectC.class 5KB
District.class 5KB
DStatistic.class 5KB
SelectC.class 5KB
PersonnelInfo.class 5KB
Bills.class 5KB
DeleteCompany.class 5KB
DeleteCompany.class 5KB
CompanyList.class 5KB
LoginParameter.class 5KB
Info.class 5KB
Info.class 4KB
LoginChickUserName.class 4KB
Attorning.class 4KB
Sort.class 4KB
Keyword.class 4KB
Incepting.class 4KB
SwitchDate.class 4KB
Turn.class 4KB
Addlandv.class 4KB
Addlandv.class 4KB
Info.class 4KB
Info.class 4KB
Attorn.class 4KB
Attorn.class 4KB
Info.class 4KB
AddPersonnel.class 3KB
AddVisit.class 3KB
AddVisit.class 3KB
AtoB.class 3KB
DeleteCompany.class 3KB
Incept.class 3KB
Sorts.class 3KB
UpdatePersonnel.class 3KB
ConnectManager.class 3KB
AdInfo.class 3KB
BillType.class 3KB
AddNarrate.class 3KB
AddNarrate.class 3KB
SAim.class 3KB
DeptAjax.class 3KB
Chick.class 3KB
EditPwd.class 2KB
AddBill.class 2KB
UpdateBill.class 2KB
Destine.class 2KB
Attorn.class 2KB
AttornAll.class 2KB
Aim.class 2KB
DistrictAjax.class 2KB
Update.class 2KB
ComAjax.class 2KB
Update.class 2KB
AddLinkman.class 2KB
AddLinkman.class 2KB
OutPersonnel.class 2KB
Pass.class 2KB
DeleteCompany.class 2KB
Attorn.class 2KB
LoginChickPwd.class 2KB
IndustryAjax.class 2KB
ROutPersonnel.class 2KB
CancelAttorn.class 2KB
UserChickAjax.class 2KB
EncodingFilter.class 1KB
Clear.class 1KB
MD5.class 1KB
Exit.class 1KB
Clear.class 1008B
Position.class 885B
Replace.class 683B
.classpath 2KB
inside.css 2KB
manage.css 1KB
共 312 条
- 1
- 2
- 3
- 4
资源评论
haoran61
- 粉丝: 86
- 资源: 45
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 通过C#实现冒泡排序示例代码(含代码解释)
- 保险交叉销售预测数据集.zip
- StartAllBack-3.6.3-setup, win不同风格的开始菜单
- c语言实现希尔排序基础
- emoji表情使用趋势数据集.zip
- 抖音 douyin 视频评论 spider
- Beyond.Compare.v3.1.10
- 2016年年度培训计划及跟踪表.xls
- 2016年公司员工年度培训计划表.xls
- 《如何设计年度培训计划与预算方案》.ppt
- 公司培训规划之一--员工素养培训(PPT 63页).ppt
- 麦肯锡:进度安排培训.ppt
- 北大讲义《如何设计年度培训计划与预算方案》.ppt
- 美的校园招聘面试官培训方案(ppt 14页).ppt
- 培训与发展.ppt
- 培训管理.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功