基于javaweb+mysql的jsp+servlet家政服务管理系统(java+jsp+javascript+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的JSP+Servlet家政服务管理系统(java+jsp+javascript+mysql)
项目介绍
雇主用户角色包含以下功能: 首页,注册账号,雇主登录,查询家政阿姨,查看供求信息,查看家政公司,阿姨预约,查看我的预约,发布需求信息等功能。
管理员角色包含以下功能: 登录,添加新闻,家政合同管理,家政阿姨管理,审核供应信息,企业用户管理,雇主管理等功能。
家政阿姨角色包含以下功能: 登陆页面,发布供应信息,管理我的预约等功能。
家政公司角色包含以下功能: 登录,发布家政名片等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;
技术栈
HTML+CSS+JavaScript+jsp+mysql
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/login.jsp 登录
* 日期类Date、Calendar
*/
/**
* @time Jun 14, 2012
* @version V 1.0
*
* 实现的接口如下:
* 1---根据开始时间和间隔天数计算结束时间 Date calculateEndDate(Date sDate, int days)
* 2---根据开始时间、结束时间、间隔类型(年、月、日)计算间隔时间 int calInterval(Date sDate, Date eDate, String type)
* 3---输出日历实例(当前时间)的各个字段值 void printFields(Calendar cNow)
* 4---判定某个年份是否是闰年 boolean isLeapYear(int year)
* 5---比较两个日期的大小 int compareDate(Date sDate, Date eDate)
*/
public class calDate {
/**
* 根据起始日期和间隔时间计算结束日期
*
* @param sDate开始时间
*
* @param days间隔时间
*
* @return 结束时间
* */
public static Date calculateEndDate(Date sDate, int days)
{
//将开始时间赋给日历实例
Calendar sCalendar = Calendar.getInstance();
sCalendar.setTime(sDate);
//计算结束时间
sCalendar.add(Calendar.DATE, days);
//返回Date类型结束时间
return sCalendar.getTime();
}
/**
* 计算两个日期的时间间隔
*
try{
db.executeQuery("set names gbk");
ResultSet rs = db.executeQuery(sql_result);
logger.info("执行SQL: "+sql_result);
if(rs==null){
logger.info("没有查询到相关信息的阿姨");
}else{
while(rs.next()){
UserInfoForm bmInfo = new UserInfoForm();
userId = rs.getInt("id");
surname = rs.getString("surname");
birthdate = rs.getString("birthdate");
hometown = rs.getString("hometown");
uptime = rs.getString("uptime");
logger.info("查询结果:用户编号"+userId);
logger.info("查询结果:用户姓名"+surname);
// logger.info("查询结果:用户年龄"+birthdate);
// logger.info("查询结果:用户籍贯"+hometown);
// logger.info("查询结果:用户更新时间"+uptime);
bmInfo.setId(userId);
bmInfo.setSurname(surname);
bmInfo.setBirthDate(calAge(birthdate));
bmInfo.setHometown(hometown);
bmInfo.setUptime(uptime);
list.add(bmInfo);
}
JSONArray bm = JSONArray.fromObject(list);
out.print(bm);
out.flush();
out.close();
// System.out.println(list.size());
}
} catch (SQLException e) {
// TODO Auto-generated catch block
logger.info(e.getMessage());
e.printStackTrace();
}
JSONArray newsDetail = JSONArray.fromObject(list);
out.print(newsDetail);
out.flush();
out.close();
db.close();
return "newsDetail";
}
}
public class BookBm extends MySuperAction{
/**
* serialVersionUID
*/
private static final long serialVersionUID = -3005168808853396441L;
private ConnDB db = new ConnDB();
private Connection conn = ConnDB.getConnection();
private static Logger logger = Logger.getLogger(BookBm.class);
//预约实体
private BookBmForm bookBm;
/**
* @return the bookBm
*/
public BookBmForm getBookBm() {
return bookBm;
}
/**
* @param bookBm the bookBm to set
*/
logger.info("查询供求详细,执行SQL:"+sql_queryInfo);
if(rs_queryInfo.next()) {
GQInfoForm gqInfo = new GQInfoForm();
gqInfo.setWorkTime(rs_queryInfo.getInt("worktime"));
gqInfo.setWorkType(rs_queryInfo.getInt("workType"));
gqInfo.setIsAccomm(rs_queryInfo.getInt("accomm"));
gqInfo.setHeadLine(rs_queryInfo.getString("headline"));
gqInfo.setContent(rs_queryInfo.getString("content"));
gqInfo.setPostTime(rs_queryInfo.getString("posttime"));
gqInfo.setPay(rs_queryInfo.getString("pay"));
gqInfo.setPhone(rs_queryInfo.getString("phone"));
gqInfo.setType(rs_queryInfo.getString("type"));
list.add(gqInfo);
}
} catch (SQLException e) {
e.printStackTrace();
logger.info(e.getMessage());
}
JSONArray gqDetail = JSONArray.fromObject(list);
out.print(gqDetail);
out.flush();
out.close();
db.close();
return "gqDetail";
}
/*
* 功能:显示前台具体新闻信息
*/
public String showNewsDetail() throws IOException {
newsID = request.getParameter("newsID");
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
List<NewsForm> list = new LinkedList<NewsForm>();
String sql_queryNews = "select id, title, content, issuedate, type from tb_news where id="+newsID;
try {
ResultSet rs_queryNews = db.executeQuery(sql_queryNews);
logger.info("查询新闻详细,执行SQL:"+sql_queryNews);
if(rs_queryNews.next()) {
NewsForm news = new NewsForm();
news.setId(rs_queryNews.getInt("id"));
news.setTitle(rs_queryNews.getString("title"));
news.setContent(rs_queryNews.getString("content"));
news.setIssuedate(rs_queryNews.getString("issuedate"));
news.setType(rs_queryNews.getString("type"));
list.add(news);
}
public String getAdminPass() {
return adminPass;
}
public void setAdminPass(String adminPass) {
this.adminPass = adminPass;
}
public String getAdminID() {
return adminID;
}
public void setAdminID(String adminID) {
this.adminID = adminID;
}
//控制台info
private static Logger logger = Logger.getLogger(ManageAction.class);
//数据库访问对象
ConnDB mydb=new ConnDB();
Connection conn = ConnDB.getConnection();
ResultSet rs = null;
PreparedStatement ps =null;
//登录实体
private LoginForm user;
/**
* @return the user
*/
public LoginForm getUser() {
return user;
}
/**
* @param user the user to set
*/
public void setUser(LoginForm user) {
this.user = user;
}
//新闻实体
private String newsTitle;
private String newsContent;
private String newsType;
mailInfo.setFromAddress(emailUser);
mailInfo.setToAddress(toAddress);
mailInfo.setSubject("取回密码");
mailInfo.setContent(content);
SimpleMailSender sms = new SimpleMailSender();
boolean flag = sms.sendTextMail(mailInfo);
if (flag) {
addActionMessage("邮件发送成功,请注意查收!");
return SUCCESS;
} else {
addActionMessage("您当前网络不稳定发送失败,请检查网络连接后重试!");
return INPUT;
}
}
return INPUT;
}
/**
* 功能 验证用户的输入
*/
public boolean validateGetPass() {
if (userType == null || userType.equals("")) {
addFieldError("userType", "请选择注册的用户类型");
return false;
} else if (userName == null || userName.equals("")) {
addFieldError("userName", "请输入注册的用户名!");
return false;
} else if (toAddress == null || toAddress.equals("")) {
addFieldError("toAddress", "请输入注册的用户邮箱");
return false;
} else {
return true;
}
}
}
public class BookBmForm {
g.fillRect(0, 0, width, height);
//设置边框颜色
g.setColor(Color.LIGHT_GRAY);
//设置字体样式
g.setFont(new Font("Arial",Font.BOLD,height-2));
//绘制边框
g.drawRect(0, 0, width - 1, height - 1);
//会制噪点
Random rand = new Random();
//设置噪点颜色
g.setColor(Color.LIGHT_GRAY);
for (int i = 0;i < 30;i++) {
int x = rand.nextInt(width);
int y = rand.nextInt(height);
//绘制1 * 1大小的矩形
g.drawRect(x, y, 1, 1);
}
//绘制验证码
g.setFont(font);
for(int i=0; i<this.text.length(); i++){
g.setColor(colors[rdm.nextInt(colors.length)]);
g.drawString(this.text.substring(i, i+1), 8 + i * 8, 15);
}
g.dispose();
return image;
}
/**
* 根据图片创建字节数组
* @param image 用于创建字节数组的图片
*/
private void generatorImageBytes(BufferedImage image){
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try{
javax.imageio.ImageIO.write(image, "jpg", bos);
this.bytes = bos.toByteArray();
}catch(Exception ex){
}finally{
try{
int length = 0;
FileInputStream fis = null;
fis = new FileInputStream(avatar);
//获取用户输入的个人简介,如果为空则使用默认信息
String profile = userInfo.getProfile();
profile = (profile==null||profile.equals("")) ? "这个人很懒,什么也没留下!" : profile;
//获取用户上传信息的时间
String uptime = userInfo.getUptime();
try {
//查询当前用户Id
String user = null;
user = (String)session.get("username");
int userId = 0 ;
String sql = "select id from tb_employee where name = "+"'"+user+"'";
rs = mydb.executeQuery(sql);
if(rs.next()) {
userId = rs.getInt("id");
}
//执行数据更新操作
String sql_employee = "update tb_employee set surname =?,hometown=?,sex=?,birthdate=?,phone=?,marriage=?,education=?,address=?,profile=?,uptime=?,avatar=? where id =?";
String sql_cert = "update tb_cert set cert_jiankang=?,cert_yuesao=?,cert_hushi=?,cert_yingyangshi=?,cert_zaojiao=?,cert_jiashi=?,cert_chushi=? where user_id=?";
String sql_skills = "update tb_skills set skill_computer=?,skill_ironing=?,skill_handwork=?,skill_waiyu=?,skill_driving=?,skill_nutriology=? where user_id=?";
String sql_lang = "update tb_lang set lang_local=?,lang_normal=?,lang_sichuan=?,lang_dongbei=?,lang_guangdong=?,lang_kejia=?,lang_minnan=? where user_id=?";
String sql_flavor = "update tb_flavor set flavor_local=?,flavor_xican=?,flavor_chuancai=?,flavor_yuecai=?,flavor_lucai=?,flavor_sucai=?,flavor_zhecai=?,flavor_xiangcai=?,flavor_mincai=?,flavor_huicai=? where user_id=?";
PreparedStatement ps =conn.prepareStatement(sql_employee);
PreparedStatement ps1 = conn.prepareStatement(sql_cert);
PreparedStatement ps2 = conn.prepareStatement(sql_skills);
PreparedStatement ps3 = conn.prepareStatement(sql_lang);
PreparedStatement ps4 = conn.prepareStatement(sql_flavor);
//更新用户证书表
ps1.setInt(1,result_cert[0]);
ps1.setInt(2,result_cert[1]);
ps1.setInt(3,result_cert[2]);
ps1.setInt(4,result_cert[3]);
ps1.setInt(5,result_cert[4]);
ps1.setInt(6,result_cert[5]);
ps1.setInt(7,result_cert[6]);
ps1.setInt(8,userId);
ps1.executeUpdate();
ps1.close();
logger.info("执行SQL:"+sql_cert);
g.setFont(new Font("Arial",Font.BOLD,height-2));
//绘制边框
g.drawRect(0, 0, width - 1, height - 1);
//绘制噪点
Random rand = new Random();
//设置噪点颜色
g.setColor(Color.LIGHT_GRAY);
for(int i = 0;i < codeLength * 6;i++) {
int x = rand.nextInt(width);
int y = rand.nextInt(height);
//绘制1*1大小的矩形
g.drawRect(x, y, 1, 1);
}
//绘制验证码
int codeY = height - 10;
//设置字体颜色和样式
g.setColor(new Color(19,148,246));
g.setFont(new Font("Georgia", Font.BOLD, fSize));
for(int i = 0;i < codeLength;i++) {
g.drawString(String.valueOf(securityCode.charAt(i)),i * 16 + 5, codeY);
}
//关闭资源
g.dispose();
return image;
}
/**
* 返回验证码图片的流格式
* @paramsecurityCode 验证码
* @return ByteArrayInputStream 图片流
*/
public static ByteArrayInputStream getImageAsInputStream(String securityCode) {
BufferedImage image = createImage(securityCode);
return convertImageToStream(image);
}
/**
* 将BufferedImage转换成ByteArrayInputStream
* @param image 图片
* @return ByteArrayInputStream 流
*/
public static ByteArrayInputStream convertImageToStream(BufferedImage image){
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ImageIO.write(image, "png", os);
ByteArrayInputStream input = new ByteArrayInputStream(os.toByteArray());
return input;
} catch (IOException e) {
}
ps3.executeUpdate();
ps3.close();
logger.info("执行SQL:"+sql_lang);
//更新用户口味表
ps4.setInt(1, result_flavor[0]);
ps4.setInt(2, result_flavor[1]);
ps4.setInt(3, result_flavor[2]);
ps4.setInt(4, result_flavor[3]);
ps4.setInt(5, result_flavor[4]);
ps4.setInt(6, result_flavor[5]);
ps4.setInt(7, result_flavor[6]);
ps4.setInt(8, result_flavor[7]);
ps4.setInt(9, result_flavor[8]);
ps4.setInt(10, result_flavor[9]);
ps4.setInt(11, userId);
ps4.executeUpdate();
ps4.close();
logger.info("执行SQL:"+sql_flavor);
//更新用户姓名
ps.setString(1, surname);
//更新用户籍贯
ps.setString(2, hometown);
//更新用户性别
ps.setInt(3, sex);
//更新用户出生年月
ps.setString(4, birthdate);
//更新用户联系方式
ps.setString(5, phone);
//更新用户婚姻状况
ps.setInt(6, marriage);
//更新用户学历
ps.setInt(7, education);
//更新用户居住地址
ps.setString(8, address);
//更新用户个人简介
ps.setString(9, profile);
//更新更新时间
ps.setString(10, uptime);
//更新用户头像
ps.setBinaryStream(11, fis,length);
ps.setBinaryStream(11, fis, fis.available());
//当前用户Id为查询对象
ps.setInt(12, userId);
ps.executeUpdate();
ps.close();
logger.info("执行SQL:"+sql_employee);
fis.close();
rs.close();
conn.close();
addActionMessage("信息更新成功!");
logger.info("用户"+user+"更新信息成功!");
return SUCCESS;
} catch (SQLException e) {
PreparedStatement ps =null;
//登录实体
private LoginForm user;
/**
* @return the user
*/
public LoginForm getUser() {
return user;
}
/**
* @param user the user to set
*/
public void setUser(LoginForm user) {
this.user = user;
}
//新闻实体
private String newsTitle;
private String newsContent;
private String newsType;
private String newsIssuedate;
public String getNewsTitle() {
return newsTitle;
}
public void setNewsTitle(String newsTitle) {
this.newsTitle = newsTitle;
}
public String getNewsContent() {
return newsContent;
}
public void setNewsContent(String newsContent) {
this.newsContent = newsContent;
}
public String getNewsType() {
return newsType;
}
Graphics g = image.getGraphics();
//设置背景色
g.setColor(Color.WHITE);
//填充背景
g.fillRect(0, 0, width, height);
//设置边框颜色
g.setColor(Color.LIGHT_GRAY);
//设置字体样式
g.setFont(new Font("Arial",Font.BOLD,height-2));
//绘制边框
g.drawRect(0, 0, width - 1, height - 1);
//会制噪点
Random rand = new Random();
//设置噪点颜色
g.setColor(Color.LIGHT_GRAY);
for (int i = 0;i < 30;i++) {
int x = rand.nextInt(width);
int y = rand.nextInt(height);
//绘制1 * 1大小的矩形
g.drawRect(x, y, 1, 1);
}
//绘制验证码
g.setFont(font);
for(int i=0; i<this.text.length(); i++){
g.setColor(colors[rdm.nextInt(colors.length)]);
g.drawString(this.text.substring(i, i+1), 8 + i * 8, 15);
}
g.dispose();
return image;
}
/**
* 根据图片创建字节数组
* @param image 用于创建字节数组的图片
*/
private void generatorImageBytes(BufferedImage image){
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try{
javax.imageio.ImageIO.write(image, "jpg", bos);
this.bytes = bos.toByteArray();
}catch(Exception ex){
}finally{
try{
bos.close();
/**
* @param birthDate
*/
public void setBirthDate(String birthDate) {
this.birthDate = birthDate;
}
/**
* @return phone
*/
public String getPhone() {
return phone;
}
/**
* @param phone
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* @return marriage
*/
public int getMarriage() {
return marriage;
}
/**
* @param marriage
*/
public void setMarriage(int marriage) {
this.marriage = marriage;
}
/**
* @return education
*/
public int getEducation() {
return education;
}
/**
* @param education
*/
public void setEducation(int education) {
this.education = education;
}
/**
* @return address
*/
public String getAddress() {
return address;
}
/**
* @param address
*/
}
</style>
<script>
CKEDITOR.on( 'instanceReady', function( evt ) {
var editor = evt.editor;
editor.setData( 'This editor has it\'s tabIndex set to <strong>' + editor.tabIndex + '</strong>' );
// Apply focus class name.
editor.on( 'focus', function() {
editor.container.addClass( 'cke_focused' );
});
editor.on( 'blur', function() {
editor.container.removeClass( 'cke_focused' );
});
// Put startup focus on the first editor in tab order.
if ( editor.tabIndex == 1 )
editor.focus();
});
</script>
</head>
<body>
<h1 class="samples">
<a href="index.html">CKEditor Samples</a> » TAB Key-Based Navigation
</h1>
<div class="description">
<p>
This sample shows how tab key navigation among editor instances is
affected by the <code>tabIndex</code> attribute from
the original page element. Use TAB key to move between the editors.
</p>
</div>
<p>
<textarea class="ckeditor" cols="80" id="editor4" rows="10" tabindex="1"></textarea>
</p>
<div class="ckeditor" contenteditable="true" id="editor1" tabindex="4"></div>
<p>
<textarea class="ckeditor" cols="80" id="editor2" rows="10" tabindex="2"></textarea>
</p>
<p>
<textarea class="ckeditor" cols="80" id="editor3" rows="10" tabindex="3"></textarea>
</p>
<div id="footer">
<hr>
}
/**
* @return the svRecommend
*/
public int getSvRecommend() {
return svRecommend;
}
/**
* @param svRecommend the svRecommend to set
*/
public void setSvRecommend(int svRecommend) {
this.svRecommend = svRecommend;
}
/**
* @return the svContent
*/
public String getSvContent() {
return svContent;
}
/**
* @param svContent the svContent to set
*/
public void setSvContent(String svContent) {
this.svContent = svContent;
}
/**
* @return the svPoint
*/
public int getSvPoint() {
return svPoint;
}
/**
* @param svPoint the svPoint to set
*/
public void setSvPoint(int svPoint) {
this.svPoint = svPoint;
}
/**
* @return the svDate
*/
public String getSvDate() {
return svDate;
}
/**
* @param svDate the svDate to set
*/
public void setSvDate(String svDate) {
this.svDate = svDate;
}
/**
if(rs_contract.next()) {
String bmSigDate = rs_contract.getString("bmSigDate");
if(bmSigDate==null||bmSigDate.equals("")) {
MessageForm message = new MessageForm();
message.setMessageForm("您已成功完成预约流程,请尽快到【服务协议】中确认信息并签署服务协议!");
list.add(message);
}
String endDate = rs_contract.getString("endDate");
Date sDate = dt.parse(dt.format(new Date()));
Date eDate = dt.parse(endDate);
int interval = calDate.calInterval(sDate,eDate,"D");
MessageForm message = new MessageForm();
message.setMessageForm("您的合同还有"+interval+"天到期,请您注意!");
list.add(message);
//更新过期信息标识
if(interval<=0) {
String sqlBook = "update tb_book set isOutdated = '1' where bmID="+bmID;
mydb.executeUpdate(sqlBook);
logger.info("预约表过期,执行SQL:"+sqlBook);
String sqlContract = "update tb_contract set isOutdated = '1' where bmID="+bmID;
mydb.executeUpdate(sqlContract);
logger.info("合同表过期,执行SQL:"+sqlContract);
String sqlAssess = "update tb_assess set isOutdated = '1' where bmID="+bmID;
mydb.executeUpdate(sqlAssess);
logger.info("评价表过期,执行SQL:"+sqlAssess);
String sqlEmployee = "update tb_employee set status = '0' where id ="+bmID;
mydb.executeUpdate(sqlEmployee);
logger.info("更新阿姨状态'在岗',执行SQL:"+sqlEmployee);
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.info(e.getMessage());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.info(e.getMessage());
}
}
//雇主消息提醒
if(type!=null&&type.equals("employer")){
BookBm bookBm = new BookBm();
int gzID = bookBm.queryID(user, "tb_employer");
try {
String sql_contract = "select gzSigDate, endDate from tb_contract where isOutdated = '0' and gzID="+gzID;
logger.info("查询新闻信息,执行SQL:"+sql_queryNews);
while (rs_queryNews.next()) {
NewsForm news = new NewsForm();
news.setId(rs_queryNews.getInt("id"));
news.setTitle(rs_queryNews.getString("title"));
news.setContent(rs_queryNews.getString("content"));
news.setIssuedate(rs_queryNews.getString("issuedate"));
news.setType(rs_queryNews.getString("type"));
list.add(news);
}
} catch (SQLException e) {
e.printStackTrace();
logger.info(e.getMessage());
}
JSONArray news = JSONArray.fromObject(list);
out.print(news);
out.flush();
out.close();
db.close();
return "news";
}
/*
* 显示前台供求信息
*/
public String showGQInfo() throws IOException {
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
List<GQInfoForm> list = new LinkedList<GQInfoForm>();
String sql_queryInfo = "select user_id, worktime, accomm, workType, headline, content, posttime, pay, phone, type from tb_info where isLock='1' order by posttime desc";
try {
ResultSet rs_queryInfo = db.executeQuery(sql_queryInfo);
logger.info("查询供求信息,执行SQL:"+sql_queryInfo);
while (rs_queryInfo.next()) {
GQInfoForm gqInfo = new GQInfoForm();
gqInfo.setUserId(rs_queryInfo.getInt("user_id"));
gqInfo.setWorkTime(rs_queryInfo.getInt("worktime"));
gqInfo.setWorkType(rs_queryInfo.getInt("workType"));
gqInfo.setIsAccomm(rs_queryInfo.getInt("accomm"));
gqInfo.setHeadLine(rs_queryInfo.getString("headline"));
gqInfo.setContent(rs_queryInfo.getString("content"));
gqInfo.setPostTime(rs_queryInfo.getString("posttime"));
gqInfo.setPay(rs_queryInfo.getString("pay"));
gqInfo.setPhone(rs_queryInfo.getString("phone"));
gqInfo.setType(rs_queryInfo.getString("type"));
list.add(gqInfo);
}
} catch(SQLException e) {
e.printStackTrace();
logger.info(e.getMessage());
}
JSONArray gqInfo = JSONArray.fromObject(list);
// surname = rs.getString("surname");
// birthdate = rs.getString("birthdate");
// hometown = rs.getString("hometown");
// uptime = rs.getString("uptime");
//
// bmInfo.setId(userId);
// bmInfo.setSurname(surname);
// bmInfo.setBirthDate(birthdate);
// bmInfo.setHometown(hometown);
// bmInfo.setUptime(uptime);
// bmList.add(bmInfo);
// System.out.println(bmInfo.getSurname());
// }
// JSONArray all = JSONArray.fromObject(bmList);
// out.print("hello");
// out.flush();
// } catch(SQLException e){
// logger.info(e.getMessage());
// e.printStackTrace();
// } finally {
// db.close();
// out.close();
// }
out.write("hello");
out.flush();
return "ready";
}
/*
* 显示保姆的详细信息
*/
@SuppressWarnings({ })
public String detail() throws IOException {
List<UserInfoForm> list1 = new LinkedList<UserInfoForm>();
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter ot1 = response.getWriter();
String bmId = request.getParameter("id");
logger.info("获取保姆ID:"+bmId);
//根据ID查询保姆基本信息
String sql_employee = "select status, id, surname, hometown, sex, birthdate, phone, marriage, education, address, profile, uptime from tb_employee where id="+bmId;
ResultSet rs_employee = db.executeQuery(sql_employee);
logger.info("执行SQL:"+sql_employee);
//根据ID查询证书
String sql_cert = "select * from tb_cert where user_id="+bmId;
ResultSet rs_cert = db.executeQuery(sql_cert);