Dmc_update.java
7.3 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
package com.servlet.bksh.DMC;
import java.io.IOException;
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.dao.bksh.SHDataBase;
import com.service.bksh.SHExecuteService;
import com.vo.SHDataManage;
/**
* Servlet implementation class Dmc_selectdate
*/
public class Dmc_update extends HttpServlet {
private static final long serialVersionUID = 1L;
static SHDataBase sh = new SHDataBase();
/**
* @see HttpServlet#HttpServlet()
*/
public Dmc_update() {
super();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String a_idfromForm=request.getParameter("a_id");
String date = request.getParameter("a_datetime");
String cxwsjh_incod_eq=request.getParameter("cxwsjh_incod_eq");
String a_incod_note=request.getParameter("a_incod_note");
String cxwsjh_innh4n_eq=request.getParameter("cxwsjh_innh4n_eq");
String a_innh4n_note=request.getParameter("a_innh4n_note");
String cxwsjh_inph_eq=request.getParameter("cxwsjh_inph_eq");
String a_inph_note=request.getParameter("a_inph_note");
String cxwsjh_outcod_eq=request.getParameter("cxwsjh_outcod_eq");
String a_outcod_note=request.getParameter("a_outcod_note");
String cxwsjh_outnh4n_eq=request.getParameter("cxwsjh_outnh4n_eq");
String a_outnh4n_note=request.getParameter("a_outnh4n_note");
String cxwsjh_outph_eq=request.getParameter("cxwsjh_outph_eq");
String a_outph_note=request.getParameter("a_outph_note");
String cxwsjh_outzd_eq=request.getParameter("cxwsjh_outzd_eq");
String a_outzd_note=request.getParameter("a_outzd_note");
String cxwsjh_outzl_eq=request.getParameter("cxwsjh_outzl_eq");
String a_outzl_note=request.getParameter("a_outzl_note");
String cxwsjh_intp_eq=request.getParameter("cxwsjh_intp_eq");
String a_intp_note=request.getParameter("a_intp_note");
int a_id = Integer.parseInt(a_idfromForm);
List<String> recod= sh.Select_reason(date,"出水口","COD");
List<String> reph= sh.Select_reason(date,"出水口","PH值");
List<String> renh4n= sh.Select_reason(date,"出水口","氨氮");
List<String> reincod= sh.Select_reason(date,"进水口","COD");
List<String> reinph= sh.Select_reason(date,"进水口","PH值");
List<String> reinnh4n= sh.Select_reason(date,"进水口","氨氮");
List<String> rezd= sh.Select_reason(date,"出水口","总氮");
List<String> rezl= sh.Select_reason(date,"出水口","总磷");
List<String> retp= sh.Select_reason(date,"进水口","总磷");
int cod = recod.size();
int ph = reph.size();
int nh4n = renh4n.size();
int incod = reincod.size();
int inph = reinph.size();
int innh4n = reinnh4n.size();
int zd = recod.size();
int zl = recod.size();
int in_tp = recod.size();
if(cxwsjh_outcod_eq.equals("--")){
if(cod==0)
sh.insert_reason(date,"COD","出水口",a_outcod_note,a_id);
else
sh.update_reason( "COD",a_outcod_note,a_id,"出水口");
}
else if(!cxwsjh_outcod_eq.equals("--")){
sh.delete_reason(a_id,"出水口", "COD");
}
if(cxwsjh_outph_eq.equals("--")){
if(ph==0)
sh.insert_reason(date,"PH值","出水口",a_outph_note,a_id);
else
sh.update_reason( "PH值",a_outph_note,a_id,"出水口");
}
else if(!cxwsjh_outph_eq.equals("--")){
sh.delete_reason(a_id, "出水口","PH值");
}
if(cxwsjh_outnh4n_eq.equals("--")){
if(nh4n==0)
sh.insert_reason(date,"氨氮","出水口",a_outnh4n_note,a_id);
else
sh.update_reason( "氨氮",a_outnh4n_note,a_id,"出水口");
}
else if(!cxwsjh_outnh4n_eq.equals("--")){
sh.delete_reason(a_id,"出水口", "氨氮");
}
if(cxwsjh_incod_eq.equals("--")){
if(incod==0)
sh.insert_reason(date,"COD","进水口",a_incod_note,a_id);
else
sh.update_reason( "COD",a_incod_note,a_id,"进水口");
}
else if(!cxwsjh_incod_eq.equals("--")){
sh.delete_reason(a_id,"进水口", "COD");
}
if(cxwsjh_inph_eq.equals("--")){
if(inph==0)
sh.insert_reason(date,"PH值","进水口",a_inph_note,a_id);
else
sh.update_reason( "PH值",a_inph_note,a_id,"进水口");
}
else if(!cxwsjh_inph_eq.equals("--")){
sh.delete_reason(a_id,"进水口", "PH值");
}
if(cxwsjh_intp_eq.equals("--")){
if(in_tp==0)
sh.insert_reason(date,"总磷","进水口",a_intp_note,a_id);
else
sh.update_reason( "总磷",a_intp_note,a_id,"进水口");
}
else if(!cxwsjh_inph_eq.equals("--")){
sh.delete_reason(a_id,"进水口", "总磷");
}
if(cxwsjh_innh4n_eq.equals("--")){
if(innh4n==0)
sh.insert_reason(date,"氨氮","进水口",a_innh4n_note,a_id);
else
sh.update_reason( "氨氮",a_innh4n_note,a_id,"进水口");
}
else if(!cxwsjh_innh4n_eq.equals("--")){
sh.delete_reason(a_id,"进水口", "氨氮");
}
if(cxwsjh_outzd_eq.equals("--")){
if(zd==0)
sh.insert_reason(date,"总氮","出水口",a_outzd_note,a_id);
else
sh.update_reason( "总氮",a_outzd_note,a_id,"出水口");
}
else if(!cxwsjh_outzd_eq.equals("--")){
sh.delete_reason(a_id,"出水口", "总氮");
}
if(cxwsjh_outzl_eq.equals("--")){
if(zl==0)
sh.insert_reason(date,"总氮","出水口",a_outzl_note,a_id);
else
sh.update_reason( "总氮",a_outzl_note,a_id,"出水口");
}
else if(!cxwsjh_outzl_eq.equals("--")){
sh.delete_reason(a_id,"出水口", "总氮");
}
SHDataManage datavo=new SHDataManage();
datavo.setA_id(a_id);
datavo.setCxwsjh_incod_eq(cxwsjh_incod_eq);
datavo.setA_incod_note(a_incod_note);
datavo.setCxwsjh_innh4n_eq(cxwsjh_innh4n_eq);
datavo.setA_innh4n_note(a_innh4n_note);
datavo.setCxwsjh_inph_eq(cxwsjh_inph_eq);
datavo.setA_inph_note(a_inph_note);
datavo.setCxwsjh_outcod_eq(cxwsjh_outcod_eq);
datavo.setA_outcod_note(a_outcod_note);
datavo.setCxwsjh_outnh4n_eq(cxwsjh_outnh4n_eq);
datavo.setA_outnh4n_note(a_outnh4n_note);
datavo.setCxwsjh_outph_eq(cxwsjh_outph_eq);
datavo.setA_outph_note(a_outph_note);
datavo.setCxwsjh_outzd_eq(cxwsjh_outzd_eq);
datavo.setA_outzd_note(a_outzd_note);
datavo.setCxwsjh_outzl_eq(cxwsjh_outzl_eq);
datavo.setA_outzl_note(a_outzl_note);
datavo.setCxwsjh_intp_eq(cxwsjh_intp_eq);
datavo.setA_intp_note(a_intp_note);
SHExecuteService update=new SHExecuteService();
update.getDataManageUpdate(datavo);
response.getWriter().print("{success:true,msg:'◇修改成功◇'}");
response.getWriter().close();
}
}