UpSound.java
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.servlet.bksh.DMC;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.service.bksh.SHExecuteService;
import com.vo.sh_Sound;
public class UpSound extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
sh_Sound sh = new sh_Sound();
SHExecuteService serve=new SHExecuteService();
boolean re=true;
sh.setDate(request.getParameter("date")+"-01");
sh.setSound_n(Double.valueOf(request.getParameter("sound_n")));
sh.setSound_n_note(request.getParameter("sound_n_note"));
sh.setSound_s(Double.valueOf(request.getParameter("sound_s")));
sh.setSound_s_note(request.getParameter("sound_s_note"));
sh.setSound_w(Double.valueOf(request.getParameter("sound_w")));
sh.setSound_w_note(request.getParameter("sound_w_note"));
sh.setSound_e(Double.valueOf(request.getParameter("sound_e")));
sh.setSound_e_note(request.getParameter("sound_e_note"));
sh.setSound_n_night(Double.valueOf(request.getParameter("sound_n_night")));
sh.setSound_n_night_note(request.getParameter("sound_n_night_note"));
sh.setSound_s_night(Double.valueOf(request.getParameter("sound_s_night")));
sh.setSound_s_night_note(request.getParameter("sound_s_night_note"));
sh.setSound_w_night(Double.valueOf(request.getParameter("sound_w_night")));
sh.setSound_w_night_note(request.getParameter("sound_w_night_note"));
sh.setSound_e_night(Double.valueOf(request.getParameter("sound_e_night")));
sh.setSound_e_night_note(request.getParameter("sound_e_night_note"));
String id = request.getParameter("id");
String date=request.getParameter("date");
// System.out.println(id);
if (id == null) {
if (serve.selectSound(date).size()==0) {
re=serve.insertSound(sh);
//System.out.println(re);
}
else{
re=true;
}
} else {
sh.setAid(Integer.valueOf(id));
re=serve.updataSound(sh);
}
if(!re){
response.getWriter().print("{success:true,msg:'数据操作成功'}");
response.getWriter().close();
}else{
response.getWriter().print("{success:true,msg:'数据操作失败,请检查时间和数据是否正确'}");
response.getWriter().close();
}
}
}