package com.crm.servlet;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.crm.factory.DAOFactory;
import com.crm.vo.Employee;
import com.crm.vo.Sal_chance;
public class ChanceServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
private List<Employee> getEmployee(){
List<Employee> list = new ArrayList<Employee>();
try {
list = DAOFactory.getChanceInstance().findByName();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int action = Integer.valueOf(request.getParameter("act"));
if(action == 1){
List<Sal_chance> list = new ArrayList<Sal_chance>();
String path = "list.jsp";
try {
list = DAOFactory.getChanceInstance().findByAll();
if(list.size()!=0){
request.setAttribute("chance", list);
}else{
request.setAttribute("error", "数据库查无记录!");
}
request.getRequestDispatcher(path).forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(action == 2){
String cust_name = request.getParameter("name");
String title = request.getParameter("title");
String linkman = request.getParameter("linkname");
System.out.println(cust_name);
System.out.println(title);
System.out.println(linkman);
String sql = "WHERE chc_cust_name="+cust_name+" AND chc_title="+title+" AND chc_linkman="+linkman;
List<Sal_chance> list = new ArrayList<Sal_chance>();
String path = "list.jsp";
try {
list = DAOFactory.getChanceInstance().findByTitle(sql);
if(list.size()!=0){
request.setAttribute("chance", list);
}else{
request.setAttribute("error", "数据库查无记录!");
}
request.getRequestDispatcher(path).forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(action == 3){
String source = request.getParameter("source");
String custname = request.getParameter("custname");
int rate = Integer.valueOf(request.getParameter("rate"));
String title = request.getParameter("title");
String linkman = request.getParameter("linkman");
String tel = request.getParameter("tel");
String desc = request.getParameter("desc");
String creater = request.getParameter("creater");
long createid = Long.valueOf(request.getParameter("createid"));
String date = request.getParameter("date");
String status = "新建";
Sal_chance chance = new Sal_chance();
chance.setChc_source(source);
chance.setChc_cust_name(custname);
chance.setChc_rate(rate);
chance.setChc_title(title);
chance.setChc_linkman(linkman);
chance.setChc_tel(tel);
chance.setChc_desc(desc);
chance.setChc_create_by(creater);
chance.setChc_create_id(createid);
chance.setChc_create_date(date);
chance.setChc_status(status);
String path = "add.jsp";
try {
int flag = DAOFactory.getChanceInstance().chance_save(chance);
if(flag == 1){
List<Sal_chance> list = new ArrayList<Sal_chance>();
list = DAOFactory.getChanceInstance().findByAll();
request.setAttribute("chance", list);
path = "list.jsp";
request.getRequestDispatcher(path).forward(request, response);
}else{
request.setAttribute("error", "添加失败");
response.sendRedirect(path);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(action == 4){
long id = Long.valueOf(request.getParameter("id"));
Sal_chance chance = null;
String path = "dispatch.jsp";
try {
chance = DAOFactory.getChanceInstance().findById(id);
if(chance instanceof Sal_chance){
request.setAttribute("sal", chance);
request.setAttribute("emp", getEmployee());
}else{
request.setAttribute("error", "查找失败");
}
request.getRequestDispatcher(path).forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(action == 5){
String name = request.getParameter("name");
long id = Long.valueOf(request.getParameter("id"));
long empno = Long.valueOf(request.getParameter("empno"));
String path = "dispatch.jsp";
Employee emp = new Employee();
emp.setEmp_no(empno);
emp.setEmp_name(name);
int flag = 0;
try {
flag = DAOFactory.getChanceInstance().chance_due_update(emp, id);
if(flag == 1){
List<Sal_chance> list = new ArrayList<Sal_chance>();
list = DAOFactory.getChanceInstance().findByAll();
request.setAttribute("chance", list);
path = "list.jsp";
request.getRequestDispatcher(path).forward(request, response);
}else{
request.setAttribute("error", "指派人员失败");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(action == 6){
long id = Long.valueOf(request.getParameter("id"));
Sal_chance chance = null;
String path = "edit.jsp";
try {
chance = DAOFactory.getChanceInstance().findById(id);
if(chance instanceof Sal_chance){
request.setAttribute("sal", chance);
request.setAttribute("emp", getEmployee());
}else{
request.setAttribute("error", "查找失败");
}
request.getRequestDispatcher(path).forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(action == 7){
long id = Long.valueOf(request.getParameter("id"));
String source = request.getParameter("source");
String custname = request.getParameter("custname");
int rate = Integer.valueOf(request.getParameter("rate"));
String title = request.getParameter("title");
String linkman = request.getParameter("linkman");
String tel = request.getParameter("tel");
String desc = request.getParameter("desc");
Sal_chance chance = new Sal_chance();
chance.setChc_id(id);
chance.setChc_source(source);
chance.setChc_cust_name(custname);
chance.setChc_rate(rate);
chance.setChc_title(title);
chance.setChc_linkman(linkman);
chance.setChc_tel(tel);
chance.setChc_desc(desc);
String path = "edit.jsp";
try {
int flag = DAOFactory.getChanceInstance().chance_update(chance);
if(flag == 1){
List<Sal_chance> list = new ArrayList<Sal_chance>();
list = DAOFactory.getChanceInstance().findByAll();
request.setAttribute("chance", list);
path = "list.jsp";
request.getRequestDispatcher(path).forward(request, response);
}else{
request.setAttribute("error", "修改失败");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
客户关系管理系统jsp+servlet+javabean
共155个文件
gif:37个
html:33个
java:13个
4星 · 超过85%的资源 需积分: 9 41 下载量 37 浏览量
2010-01-16
19:03:51
上传
评论 1
收藏 678KB RAR 举报
温馨提示
客户关系管理系统采用的是mvc德三层架构在项目中用到的技术点也是很多的希望对大家有所帮助呀
资源推荐
资源详情
资源评论
收起资源包目录
客户关系管理系统jsp+servlet+javabean (155个子文件)
edit.html.bak 4KB
contr.html.bak 3KB
lost.html.bak 2KB
cons.html.bak 2KB
ser.html.bak 1KB
SalChanceDAOImpl.class 7KB
ChanceServlet.class 6KB
Sal_chance.class 3KB
DBConnection.class 2KB
LoginServlet.class 2KB
Employee.class 2KB
LoginDAOImpl.class 2KB
SysUser.class 1KB
TestDB.class 826B
SalChanceDAO.class 761B
DBAccessException.class 657B
DAOFactory.class 596B
LoginDAO.class 242B
.classpath 456B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 12KB
menu.css 2KB
Thumbs.db 44KB
Thumbs.db 23KB
Thumbs.db 20KB
Thumbs.db 15KB
welcome.gif 57KB
bt_linkman.gif 2KB
bt_feedback.gif 322B
bt_acti.gif 235B
bt_confirm.gif 235B
bt_detail.gif 233B
bt_orders.gif 216B
bt_relay.gif 216B
bt_plan.gif 153B
bt_deal.gif 147B
folderopen.gif 129B
bt_yes.gif 117B
msie_doc_mo.gif 107B
ns_doc_sel.gif 107B
msie_doc_sel.gif 107B
ns_doc_mo.gif 107B
bt_del.gif 90B
folderclosed.gif 90B
folderclosed.gif 90B
bt_edit.gif 87B
plus.gif 77B
ns_doc.gif 76B
msie_doc.gif 76B
doc.gif 76B
plusbottom.gif 76B
minus.gif 76B
plustop.gif 76B
minusbottom.gif 76B
minusonly.gif 75B
plusonly.gif 75B
minustop.gif 75B
join.gif 67B
line.gif 64B
joinbottom.gif 64B
jointop.gif 63B
blank.gif 56B
spacer.gif 43B
mywork.htm 312B
list.html 10KB
dispatch.html 10KB
arch.html 7KB
feedback.html 6KB
deal.html 6KB
dict.html 5KB
menu.html 4KB
edit.html 4KB
login.html 4KB
storage.html 3KB
add.html 3KB
product.html 3KB
linkman.html 3KB
activities.html 3KB
contr.html 2KB
orders.html 2KB
deal_detail.html 2KB
lost.html 2KB
feedback_detail.html 2KB
list.html 2KB
detail.html 2KB
orders_detail.html 2KB
cons.html 2KB
ser.html 1KB
linkman_edit.html 1KB
activities_edit.html 1KB
relay.html 1KB
confirm.html 1KB
linkman_add.html 1KB
dict_edit.html 1KB
dict_add.html 1KB
activities_add.html 1KB
footer.html 389B
mysql-connector-java-3.1.12-bin.jar 436KB
ChanceServlet.java 7KB
SalChanceDAOImpl.java 7KB
共 155 条
- 1
- 2
nisinisinisinisisisi
- 粉丝: 4
- 资源: 24
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 全卷积网络基于voc2012数据集简单pytorch实现
- pycharm的一些介绍-用于更好的学习python
- 基于C++的程序设计大赛天梯赛L2答案(天梯赛)
- 基于python实现的三次样条插值和均值插值法实现
- Python语言教程2-python批量图片大小处理-多文件夹
- Python语言教程1-python批量图片重命名,将后缀某几个不想要的字去除
- Space Combat Kit 太空战斗套件Unity游戏开发插件资源unitypackage C#
- Universal Device Preview 通用设备预览Unity游戏开发插件资源unitypackage
- Paladin Anim Set 圣骑士动画集Unity游戏动作动画插件资源unitypackage
- 计算机财务管理期末考报表部分题目及答案.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页