MoudleOperation.jsp
11.2 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<%
String operation = Util.null2String(request.getParameter("operation"));
String moudleid = Util.null2String(request.getParameter("moudleid"));
String moudlename = Util.fromScreen(request.getParameter("moudlename"),user.getLanguage());
String needconfirm = Util.null2String(request.getParameter("needconfirm"));
String moudlemaintener = Util.null2String(request.getParameter("moudlemaintener"));
String moudleviewer = Util.null2String(request.getParameter("moudleviewer"));
String moudlecreater = Util.null2String(request.getParameter("moudlecreater"));
String confirmtype = Util.null2String(request.getParameter("confirmtype"));
String moudleconfirmer = Util.null2String(request.getParameter("moudleconfirmer"));
String moudlesql = Util.fromScreen(request.getParameter("moudlesql"),user.getLanguage());
String isrootmoudle = Util.null2String(request.getParameter("isrootmoudle"));
if( needconfirm.equals("0") ) moudleconfirmer = "-1" ;
else if ( confirmtype.equals("1") ) moudleconfirmer = "0" ;
if(operation.equals("addnewmoudle") || operation.equals("addsubmoudle")){
char separator = Util.getSeparator() ;
String tableindex = "0" ;
RecordSet.executeProc("SystemMoudle_SMaxID","") ; // 查询下一个表的id
if( RecordSet.next() ) tableindex = ""+Util.getIntValue(RecordSet.getString(1),0) ;
String moudletablename = "T_SysMoudle_"+tableindex ;
if(operation.equals("addnewmoudle")) isrootmoudle = "0" ;
else isrootmoudle = moudleid ;
String para = moudlename + separator + moudletablename
+ separator + isrootmoudle + separator + needconfirm + separator + moudlemaintener + separator + moudleviewer + separator + moudlecreater + separator + moudleconfirmer ;
RecordSet.executeProc("SystemMoudle_Insert",para);
String createtable = "" ;
if(operation.equals("addnewmoudle")) {
createtable = " create table " + moudletablename +
" (inputid int IDENTITY(1,1) primary key CLUSTERED, " +
" inputsubject varchar(150) ," +
" createrid int ," +
" confirmid int ," +
" createdate char(10) ," +
" confirmdate char(10) ," +
" inputstatus char(1) default '0' ) " ;
RecordSet.executeSql(createtable);
}
else {
createtable = " create table " + moudletablename +
" (inputid int , " +
" createrid int ," +
" confirmid int ," +
" createdate char(10) ," +
" confirmdate char(10) ," +
" inputstatus char(1) default '0' ) " ;
RecordSet.executeSql(createtable);
createtable = " create index " + moudletablename + "_in on " + moudletablename + " (inputid) " ;
RecordSet.executeSql(createtable);
}
if(operation.equals("addnewmoudle")) response.sendRedirect("MoudleManager.jsp");
else response.sendRedirect("MoudleEdit.jsp?moudleid=" + moudleid);
}
else if(operation.equals("editnewmoudle") || operation.equals("editsubmoudle")){
char separator = Util.getSeparator() ;
String para = moudleid + separator + moudlename + separator + needconfirm + separator + moudlemaintener + separator + moudleviewer + separator + moudlecreater + separator + moudleconfirmer + separator + moudlesql ;
RecordSet.executeProc("SystemMoudle_Update",para);
if(operation.equals("editnewmoudle")) response.sendRedirect("MoudleManager.jsp");
else response.sendRedirect("MoudleEdit.jsp?moudleid=" + isrootmoudle);
}
else if(operation.equals("deletenewmoudle") || operation.equals("deletesubmoudle")){
char separator = Util.getSeparator() ;
String para = ""+moudleid;
RecordSet.executeProc("SystemMoudle_Delete",para);
if(operation.equals("deletenewmoudle")) response.sendRedirect("MoudleManager.jsp");
else response.sendRedirect("MoudleEdit.jsp?moudleid=" + isrootmoudle);
}
/*
else if(operation.equals("edit")){
char separator = Util.getSeparator() ;
String para = ""+moudleid + separator + moudlename + separator + moudletablename + separator + moudlebugtablename + separator + moudlefrequence + separator + moudlebudget + separator + moudleforecast + separator + startdate + separator + enddate ;
RecordSet.executeProc("T_InputReport_Update",para);
if(!moudlebudget.equals(oldmoudlebudget)) {
if(oldmoudlebudget.equals("0")) {
String createtable = " create table " + moudlebugtablename +
" (inputid int IDENTITY(1,1) primary key CLUSTERED, " +
" crmid int ," +
" reportdate char(10) ," +
" moudledspdate varchar(80) ," +
" inputdate char(10) ," +
" inputstatus char(1) default '0', " +
" reportuserid int , " +
" confirmuserid int , " +
" modtype char(1) default '0') " ;
RecordSet.executeSql(createtable);
RecordSet.executeProc("T_InputReportItem_SelectBymoudleid",""+moudleid);
while(RecordSet.next()) {
String itemfieldname = Util.null2String(RecordSet.getString("itemfieldname")) ;
String itemfieldtype = Util.null2String(RecordSet.getString("itemfieldtype")) ;
String itemfieldscale = Util.null2String(RecordSet.getString("itemfieldscale")) ;
String altertable = " alter table " + moudlebugtablename + " add " + itemfieldname ;
switch (Util.getIntValue(itemfieldtype)) {
case 1 :
altertable += " varchar("+itemfieldscale+") " ;
break ;
case 2 :
altertable += " integer " ;
break ;
case 3 :
altertable += " decimal(12,"+itemfieldscale+") " ;
break ;
case 4 :
altertable += " varchar(100) " ;
break ;
case 5 :
altertable += " decimal(12,"+itemfieldscale+") " ;
break ;
case 6 :
altertable += " text " ;
break ;
}
RecordSet.executeSql(altertable);
}
}
else {
moudlebugtablename = moudletablename + "_buget" ;
String droptable = " drop table " + moudlebugtablename ;
RecordSet.executeSql(droptable);
}
}
if(!moudleforecast.equals(oldmoudleforecast)) {
if(oldmoudleforecast.equals("0")) {
String createtable = " create table " + moudlefortablename +
" (inputid int IDENTITY(1,1) primary key CLUSTERED, " +
" crmid int ," +
" reportdate char(10) ," +
" moudledspdate varchar(80) ," +
" inputdate char(10) ," +
" inputstatus char(1) default '0', " +
" reportuserid int , " +
" confirmuserid int , " +
" modtype char(1) default '0') " ;
RecordSet.executeSql(createtable);
RecordSet.executeProc("T_InputReportItem_SelectBymoudleid",""+moudleid);
while(RecordSet.next()) {
String itemfieldname = Util.null2String(RecordSet.getString("itemfieldname")) ;
String itemfieldtype = Util.null2String(RecordSet.getString("itemfieldtype")) ;
String itemfieldscale = Util.null2String(RecordSet.getString("itemfieldscale")) ;
String altertable = " alter table " + moudlefortablename + " add " + itemfieldname ;
switch (Util.getIntValue(itemfieldtype)) {
case 1 :
altertable += " varchar("+itemfieldscale+") " ;
break ;
case 2 :
altertable += " integer " ;
break ;
case 3 :
altertable += " decimal(12,"+itemfieldscale+") " ;
break ;
case 4 :
altertable += " varchar(100) " ;
break ;
case 5 :
altertable += " decimal(12,"+itemfieldscale+") " ;
break ;
case 6 :
altertable += " text " ;
break ;
}
RecordSet.executeSql(altertable);
}
}
else {
String droptable = " drop table " + moudletablename + "_forecast" ;
RecordSet.executeSql(droptable);
}
}
response.sendRedirect("InputReport.jsp");
}
else if(operation.equals("delete")){
char separator = Util.getSeparator() ;
String para = ""+moudleid;
RecordSet.executeProc("T_InputReport_Delete",para);
String droptable = " drop table " + moudletablename ;
RecordSet.executeSql(droptable);
if(oldmoudlebudget.equals("1")) {
droptable = " drop table " + moudlebugtablename ;
RecordSet.executeSql(droptable);
}
if(oldmoudleforecast.equals("1")) {
droptable = " drop table " + moudlefortablename ;
RecordSet.executeSql(droptable);
}
response.sendRedirect("InputReport.jsp");
}
else if(operation.equals("addcrm")){
char separator = Util.getSeparator() ;
String para = ""+moudleid + separator + crmid ;
RecordSet.executeProc("T_InputReportCrm_Insert",para);
response.sendRedirect("InputReportEdit.jsp?moudleid="+moudleid);
}
else if(operation.equals("deletecrm")){
char separator = Util.getSeparator() ;
String para = ""+moudlecrmid;
RecordSet.executeProc("T_InputReportCrm_Delete",para);
response.sendRedirect("InputReportEdit.jsp?moudleid="+moudleid);
}
else if(operation.equals("close")){
RecordSet.executeSql("update T_InputReport set moudlebudgetstatus = '2' where moudleid="+moudleid);
response.sendRedirect("InputReportEdit.jsp?moudleid="+moudleid);
}
else if(operation.equals("open")){
RecordSet.executeSql("update T_InputReport set moudlebudgetstatus = '1' where moudleid="+moudleid);
response.sendRedirect("InputReportEdit.jsp?moudleid="+moudleid);
}
else if(operation.equals("editcontactright")){
RecordSet.executeSql("delete T_InputReportCrmContacter where moudlecrmid="+moudlecrmid);
String contacterids[] = request.getParameterValues("contacterid") ;
if( contacterids != null ) {
for(int i=0 ; i<contacterids.length ; i++) {
RecordSet.executeSql("insert into T_InputReportCrmContacter( moudlecrmid, contacterid ) values("+moudlecrmid +" , " + contacterids[i]+" ) ");
}
}
response.sendRedirect("InputReportEdit.jsp?moudleid="+moudleid);
} */
%>