|
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+using CallCenter.Utility;
|
|
|
2
|
+using CallCenterApi.DB;
|
|
|
3
|
+using CallCenterApi.Interface.App_Start;
|
|
|
4
|
+using CallCenterApi.Interface.Controllers.Base;
|
|
|
5
|
+using CallCenterApi.Interface.Controllers.workorder;
|
|
|
6
|
+using System;
|
|
|
7
|
+using System.Collections.Generic;
|
|
|
8
|
+using System.Data;
|
|
|
9
|
+using System.Linq;
|
|
|
10
|
+using System.Transactions;
|
|
|
11
|
+using System.Web;
|
|
|
12
|
+using System.Web.Mvc;
|
|
|
13
|
+
|
|
|
14
|
+namespace CallCenterApi.Interface.Controllers
|
|
|
15
|
+{
|
|
|
16
|
+ public class APPController : BaseController
|
|
|
17
|
+ {
|
|
|
18
|
+ // GET: APP
|
|
|
19
|
+
|
|
|
20
|
+ /// <summary>
|
|
|
21
|
+ /// 登录
|
|
|
22
|
+ /// </summary>
|
|
|
23
|
+ /// <returns></returns>
|
|
|
24
|
+ public ActionResult Login(string usercode,string password)
|
|
|
25
|
+ {
|
|
|
26
|
+ DateTime ExpiredTime = DateTime.Now.AddDays(1);
|
|
|
27
|
+ bool appResult = DateTime.Now> ExpiredTime;// Convert.ToDateTime(ReadFile(HttpRuntime.AppDomainAppPath + "tools\\hykj.hy"));
|
|
|
28
|
+ if (appResult)
|
|
|
29
|
+ {
|
|
|
30
|
+ DataTable dt = new DataTable();
|
|
|
31
|
+ try
|
|
|
32
|
+ {
|
|
|
33
|
+ Dictionary<string, string> paras = new Dictionary<string, string>();
|
|
|
34
|
+ string sql = " select * from T_Sys_Users where F_OpenId=@F_OpenId and F_Password=@F_Password";
|
|
|
35
|
+ paras.Add("@F_OpenId", usercode);
|
|
|
36
|
+ paras.Add("@F_Password", password);
|
|
|
37
|
+
|
|
|
38
|
+ dt = DbHelperSQL.Query(sql, paras).Tables[0];
|
|
|
39
|
+ if (dt != null)
|
|
|
40
|
+ {
|
|
|
41
|
+ //写入登录日志
|
|
|
42
|
+ new CallCenterApi.BLL.T_Sys_LoginLogs().Add(new Model.T_Sys_LoginLogs()
|
|
|
43
|
+ {
|
|
|
44
|
+ F_LoginName = dt.Rows[0]["F_OpenId"].ToString(),
|
|
|
45
|
+ F_LoginId = Convert.ToInt32(dt.Rows[0]["F_Id"].ToString()),
|
|
|
46
|
+ F_Result = "APP市民登录成功",
|
|
|
47
|
+ F_LoginIP = Common.DTRequest.GetIP(),
|
|
|
48
|
+ F_Hostname = Common.DTRequest.GetIP(),
|
|
|
49
|
+ F_LoginDate = DateTime.Now,
|
|
|
50
|
+ F_Remark = "",
|
|
|
51
|
+ F_State = 0
|
|
|
52
|
+ });
|
|
|
53
|
+
|
|
|
54
|
+ return Success("登录成功",new {
|
|
|
55
|
+ usercode= dt.Rows[0]["F_OpenId"].ToString(),
|
|
|
56
|
+ userid= dt.Rows[0]["F_Id"].ToString()
|
|
|
57
|
+ });
|
|
|
58
|
+ }
|
|
|
59
|
+ else
|
|
|
60
|
+ {
|
|
|
61
|
+ //写入登录日志
|
|
|
62
|
+ DataTable dt1 = new CallCenterApi.BLL.T_Sys_Users().GetList("F_OpenId='" + usercode + "'").Tables[0];
|
|
|
63
|
+ if (dt1.Rows.Count > 0)
|
|
|
64
|
+ {
|
|
|
65
|
+ int rr = new CallCenterApi.BLL.T_Sys_LoginLogs().Add(new Model.T_Sys_LoginLogs()
|
|
|
66
|
+ {
|
|
|
67
|
+ F_LoginName = dt1.Rows[0]["F_OpenId"].ToString(),
|
|
|
68
|
+ F_LoginId = Convert.ToInt32(dt1.Rows[0]["F_Id"].ToString()),
|
|
|
69
|
+ F_Result = "APP市民登录失败:帐号-" + usercode,
|
|
|
70
|
+ F_LoginIP = Common.DTRequest.GetIP(),
|
|
|
71
|
+ F_Hostname = Common.DTRequest.GetIP(),
|
|
|
72
|
+ F_LoginDate = DateTime.Now,
|
|
|
73
|
+ F_Remark = "",
|
|
|
74
|
+ F_State = 0
|
|
|
75
|
+ });
|
|
|
76
|
+ }
|
|
|
77
|
+ else
|
|
|
78
|
+ {
|
|
|
79
|
+ int rr = new BLL.T_Sys_LoginLogs().Add(new Model.T_Sys_LoginLogs()
|
|
|
80
|
+ {
|
|
|
81
|
+ F_LoginName = usercode,
|
|
|
82
|
+ F_LoginId = -1,
|
|
|
83
|
+ F_Result = "APP市民登录失败:帐号-" + usercode ,
|
|
|
84
|
+ F_LoginIP = Common.DTRequest.GetIP(),
|
|
|
85
|
+ F_Hostname = Common.DTRequest.GetIP(),
|
|
|
86
|
+ F_LoginDate = DateTime.Now,
|
|
|
87
|
+ F_Remark = "",
|
|
|
88
|
+ F_State = 0
|
|
|
89
|
+ });
|
|
|
90
|
+ }
|
|
|
91
|
+
|
|
|
92
|
+ return Error("账号或密码错误,请重新登录");
|
|
|
93
|
+ }
|
|
|
94
|
+ }
|
|
|
95
|
+ catch
|
|
|
96
|
+ {
|
|
|
97
|
+ return Error("账号或密码错误,请重新登录");
|
|
|
98
|
+ }
|
|
|
99
|
+ }
|
|
|
100
|
+ else
|
|
|
101
|
+ {
|
|
|
102
|
+ return Error("授权过期,请联系系统厂家。");
|
|
|
103
|
+ }
|
|
|
104
|
+ }
|
|
|
105
|
+
|
|
|
106
|
+ /// <summary>
|
|
|
107
|
+ /// 注册用户
|
|
|
108
|
+ /// </summary>
|
|
|
109
|
+ /// <param name="input"></param>
|
|
|
110
|
+ /// <returns></returns>
|
|
|
111
|
+ [HttpPost]
|
|
|
112
|
+ public ActionResult AddUser()
|
|
|
113
|
+ {
|
|
|
114
|
+ string usercode = RequestString.GetFormString("usercode");
|
|
|
115
|
+ string password = RequestString.GetFormString("password");
|
|
|
116
|
+ string name = RequestString.GetFormString("name");
|
|
|
117
|
+ string phone = RequestString.GetFormString("phone");
|
|
|
118
|
+ int sex = RequestString.GetInt("sex", 0);
|
|
|
119
|
+ string province = RequestString.GetFormString("province");
|
|
|
120
|
+ string city = RequestString.GetFormString("city");
|
|
|
121
|
+ string county = RequestString.GetFormString("county");
|
|
|
122
|
+ string address = RequestString.GetFormString("address");
|
|
|
123
|
+
|
|
|
124
|
+ Model.T_Sys_Users dModel = new Model.T_Sys_Users();
|
|
|
125
|
+
|
|
|
126
|
+ var list = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + usercode + "' ");
|
|
|
127
|
+ if (list.Count > 0)
|
|
|
128
|
+ {
|
|
|
129
|
+ return Error("已经存在此账号");
|
|
|
130
|
+ }
|
|
|
131
|
+ else
|
|
|
132
|
+ {
|
|
|
133
|
+ dModel.F_OpenId = usercode;
|
|
|
134
|
+ dModel.F_Password = password;
|
|
|
135
|
+ dModel.F_Name = name;
|
|
|
136
|
+ dModel.F_Telphone = phone;
|
|
|
137
|
+ dModel.F_Sex = sex;
|
|
|
138
|
+ dModel.F_Type = 4;
|
|
|
139
|
+ dModel.F_Province = province;
|
|
|
140
|
+ dModel.F_City = city;
|
|
|
141
|
+ dModel.F_County = county;
|
|
|
142
|
+ dModel.F_Address = address;
|
|
|
143
|
+
|
|
|
144
|
+
|
|
|
145
|
+ dModel.F_CreateTime = DateTime.Now;
|
|
|
146
|
+
|
|
|
147
|
+ long n = new BLL.T_Sys_Users().Add(dModel);
|
|
|
148
|
+ if (n > 0)
|
|
|
149
|
+ return Success("添加成功", n);
|
|
|
150
|
+ else
|
|
|
151
|
+ return Error("添加失败");
|
|
|
152
|
+ }
|
|
|
153
|
+ }
|
|
|
154
|
+
|
|
|
155
|
+ /// <summary>
|
|
|
156
|
+ /// 编辑用户
|
|
|
157
|
+ /// </summary>
|
|
|
158
|
+ /// <param name="input"></param>
|
|
|
159
|
+ /// <returns></returns>
|
|
|
160
|
+ [APPActionFilter]
|
|
|
161
|
+ [HttpPost]
|
|
|
162
|
+ public ActionResult UpdateUser()
|
|
|
163
|
+ {
|
|
|
164
|
+ int id = RequestString.GetInt("id", 0);
|
|
|
165
|
+ string usercode = RequestString.GetFormString("usercode");
|
|
|
166
|
+ string password = RequestString.GetFormString("password");
|
|
|
167
|
+ string name = RequestString.GetFormString("name");
|
|
|
168
|
+ string phone = RequestString.GetFormString("phone");
|
|
|
169
|
+ int sex = RequestString.GetInt("sex", 0);
|
|
|
170
|
+ string province = RequestString.GetFormString("province");
|
|
|
171
|
+ string city = RequestString.GetFormString("city");
|
|
|
172
|
+ string county = RequestString.GetFormString("county");
|
|
|
173
|
+ string address = RequestString.GetFormString("address");
|
|
|
174
|
+
|
|
|
175
|
+ Model.T_Sys_Users dModel = new Model.T_Sys_Users();
|
|
|
176
|
+ if (id == 0)
|
|
|
177
|
+ {
|
|
|
178
|
+ dModel = new BLL.T_Sys_Users().GetModel(id);
|
|
|
179
|
+ if (dModel != null)
|
|
|
180
|
+ {
|
|
|
181
|
+ var list = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + usercode + "' and F_Id!='" + id + "' ");
|
|
|
182
|
+ if (list.Count > 0)
|
|
|
183
|
+ {
|
|
|
184
|
+ return Error("已经存在此账号");
|
|
|
185
|
+ }
|
|
|
186
|
+ else
|
|
|
187
|
+ {
|
|
|
188
|
+ dModel.F_OpenId = usercode;
|
|
|
189
|
+ dModel.F_Name = name;
|
|
|
190
|
+ dModel.F_Telphone = phone;
|
|
|
191
|
+ dModel.F_Sex = sex;
|
|
|
192
|
+ dModel.F_Province = province;
|
|
|
193
|
+ dModel.F_City = city;
|
|
|
194
|
+ dModel.F_County = county;
|
|
|
195
|
+ dModel.F_Address = address;
|
|
|
196
|
+
|
|
|
197
|
+ if (new BLL.T_Sys_Users().Update(dModel))
|
|
|
198
|
+ return Success("修改成功");
|
|
|
199
|
+ else
|
|
|
200
|
+ return Error("修改失败");
|
|
|
201
|
+ }
|
|
|
202
|
+ }
|
|
|
203
|
+ else
|
|
|
204
|
+ {
|
|
|
205
|
+ return Error("修改失败");
|
|
|
206
|
+ }
|
|
|
207
|
+ }
|
|
|
208
|
+ else
|
|
|
209
|
+ {
|
|
|
210
|
+ return Error("修改失败");
|
|
|
211
|
+ }
|
|
|
212
|
+ }
|
|
|
213
|
+
|
|
|
214
|
+ /// <summary>
|
|
|
215
|
+ /// 修改密码
|
|
|
216
|
+ /// </summary>
|
|
|
217
|
+ /// <returns></returns>
|
|
|
218
|
+ [APPActionFilter]
|
|
|
219
|
+ [HttpPost]
|
|
|
220
|
+ public ActionResult UpdatePassword()
|
|
|
221
|
+ {
|
|
|
222
|
+ string usercode = RequestString.GetFormString("usercode");
|
|
|
223
|
+ string old = RequestString.GetFormString("old");
|
|
|
224
|
+ string new1 = RequestString.GetFormString("new1");
|
|
|
225
|
+ string new2 = RequestString.GetFormString("new2");
|
|
|
226
|
+ if (string.IsNullOrEmpty(old) || string.IsNullOrEmpty(new1) || string.IsNullOrEmpty(new2))
|
|
|
227
|
+ {
|
|
|
228
|
+ return Error("请输入新旧密码");
|
|
|
229
|
+ }
|
|
|
230
|
+ if (new1 != new2)
|
|
|
231
|
+ {
|
|
|
232
|
+ return Error("两次输入的不一致");
|
|
|
233
|
+ }
|
|
|
234
|
+
|
|
|
235
|
+ var userinfo = new BLL.T_Sys_Users().GetModel(usercode);
|
|
|
236
|
+ if (old == userinfo.F_Password)
|
|
|
237
|
+ {
|
|
|
238
|
+ userinfo.F_Password = new1;
|
|
|
239
|
+ new BLL.T_Sys_Users().Update(userinfo);
|
|
|
240
|
+
|
|
|
241
|
+ return Success("修改成功");
|
|
|
242
|
+ }
|
|
|
243
|
+ else
|
|
|
244
|
+ {
|
|
|
245
|
+ return Error("原密码错误");
|
|
|
246
|
+ }
|
|
|
247
|
+ }
|
|
|
248
|
+
|
|
|
249
|
+ /// <summary>
|
|
|
250
|
+ /// 获取工单列表
|
|
|
251
|
+ /// </summary>
|
|
|
252
|
+ /// <returns></returns>
|
|
|
253
|
+ [APPActionFilter]
|
|
|
254
|
+ public ActionResult GetUserWorkOrderList(int isdc = 0)
|
|
|
255
|
+ {
|
|
|
256
|
+ string sql = " and F_IsDelete=0 ";
|
|
|
257
|
+
|
|
|
258
|
+ string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
|
|
|
259
|
+
|
|
|
260
|
+ var ouid = DbHelperSQL.GetSingle(" select F_ID from T_Sys_Users where F_OpenId ='" + strusercode + "'");
|
|
|
261
|
+
|
|
|
262
|
+ string sqlwhere = "select F_WorkOrderID FROM T_Bus_UserWorkOrder where F_UserId = '" + ouid.ToString() + "' ";
|
|
|
263
|
+ sql += " and F_WorkOrderID in (" + sqlwhere + ")";
|
|
|
264
|
+
|
|
|
265
|
+
|
|
|
266
|
+ DataTable dt = new DataTable();
|
|
|
267
|
+
|
|
|
268
|
+ string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
|
|
|
269
|
+ string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
|
|
|
270
|
+ string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
|
|
|
271
|
+ string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
|
|
|
272
|
+ string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
|
|
|
273
|
+ string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
|
|
|
274
|
+ string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
|
|
|
275
|
+
|
|
|
276
|
+ int source = RequestString.GetInt("source", 0);
|
|
|
277
|
+ int keyid = RequestString.GetInt("keyid", 0);
|
|
|
278
|
+ int type = RequestString.GetInt("type", 0);
|
|
|
279
|
+ int bigtype = RequestString.GetInt("bigtype", 0);
|
|
|
280
|
+ int smalltype = RequestString.GetInt("smalltype", 0);
|
|
|
281
|
+ int sourcearea = RequestString.GetInt("sourcearea", 0);
|
|
|
282
|
+
|
|
|
283
|
+ int deptid = RequestString.GetInt("deptid", 0);
|
|
|
284
|
+ int dealtype = RequestString.GetInt("dealtype", -1);
|
|
|
285
|
+ int issend = RequestString.GetInt("issend", -1);
|
|
|
286
|
+
|
|
|
287
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
288
|
+ int pageindex = 1;
|
|
|
289
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
290
|
+ int pagesize = 10;
|
|
|
291
|
+
|
|
|
292
|
+ #region sql 语句相关处理
|
|
|
293
|
+ if (strstate.Trim() != "" && strstate != "undefined")
|
|
|
294
|
+ {
|
|
|
295
|
+ sql += " and F_WorkState = '" + strstate.Trim() + "' ";
|
|
|
296
|
+ }
|
|
|
297
|
+ if (strworkid.Trim() != "" && strworkid != "undefined")
|
|
|
298
|
+ {
|
|
|
299
|
+ sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
|
|
|
300
|
+ }
|
|
|
301
|
+ if (strname.Trim() != "" && strname != "undefined")
|
|
|
302
|
+ {
|
|
|
303
|
+ sql += " and F_CusName like '%" + strname + "%' ";
|
|
|
304
|
+ }
|
|
|
305
|
+ if (strtel.Trim() != "" && strtel != "undefined")
|
|
|
306
|
+ {
|
|
|
307
|
+ sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
|
|
|
308
|
+ }
|
|
|
309
|
+ if (strkey.Trim() != "" && strkey != "undefined")
|
|
|
310
|
+ {
|
|
|
311
|
+ sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
|
|
|
312
|
+ }
|
|
|
313
|
+
|
|
|
314
|
+ if (source != 0)
|
|
|
315
|
+ {
|
|
|
316
|
+ sql += " and F_InfoSource = '" + source + "' ";
|
|
|
317
|
+ }
|
|
|
318
|
+ if (keyid != 0)
|
|
|
319
|
+ {
|
|
|
320
|
+ sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
|
|
|
321
|
+ }
|
|
|
322
|
+ if (type != 0)
|
|
|
323
|
+ {
|
|
|
324
|
+ sql += " and F_InfoType = '" + type + "' ";
|
|
|
325
|
+ }
|
|
|
326
|
+ if (bigtype != 0)
|
|
|
327
|
+ {
|
|
|
328
|
+ sql += " and F_InfoConBigType = '" + bigtype + "' ";
|
|
|
329
|
+ }
|
|
|
330
|
+ if (smalltype != 0)
|
|
|
331
|
+ {
|
|
|
332
|
+ sql += " and F_InfoConSmallType = '" + smalltype + "' ";
|
|
|
333
|
+ }
|
|
|
334
|
+
|
|
|
335
|
+ if (sourcearea != 0)
|
|
|
336
|
+ {
|
|
|
337
|
+ sql += " and F_SourceArea = '" + sourcearea + "' ";
|
|
|
338
|
+ }
|
|
|
339
|
+
|
|
|
340
|
+ if (deptid != 0)
|
|
|
341
|
+ {
|
|
|
342
|
+ string sqlwhere1 = "select F_WorkOrderID from T_Bus_AssignedInfo where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
|
|
|
343
|
+ sql += " and F_WorkOrderID in(" + sqlwhere1 + ")";
|
|
|
344
|
+ }
|
|
|
345
|
+ if (dealtype != -1)
|
|
|
346
|
+ {
|
|
|
347
|
+ sql += " and isnull(F_IsResult,0) = '" + dealtype + "' ";
|
|
|
348
|
+ }
|
|
|
349
|
+ if (issend != -1)
|
|
|
350
|
+ {
|
|
|
351
|
+ sql += " and isnull(F_IsRelease,0) = '" + issend + "' ";
|
|
|
352
|
+ }
|
|
|
353
|
+
|
|
|
354
|
+ if (strstarttime.Trim() != "" && strstarttime != "undefined")
|
|
|
355
|
+ {
|
|
|
356
|
+ sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
|
|
|
357
|
+ }
|
|
|
358
|
+ if (strendtime.Trim() != "" && strendtime != "undefined")
|
|
|
359
|
+ {
|
|
|
360
|
+ sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
|
|
|
361
|
+ }
|
|
|
362
|
+ #endregion
|
|
|
363
|
+
|
|
|
364
|
+ if (strpageindex.Trim() != "")
|
|
|
365
|
+ {
|
|
|
366
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
367
|
+ }
|
|
|
368
|
+
|
|
|
369
|
+ if (strpagesize.Trim() != "")
|
|
|
370
|
+ {
|
|
|
371
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
372
|
+ }
|
|
|
373
|
+
|
|
|
374
|
+ string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName";
|
|
|
375
|
+
|
|
|
376
|
+ if (isdc > 0)
|
|
|
377
|
+ {
|
|
|
378
|
+ var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
|
|
|
379
|
+ var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
|
|
|
380
|
+ if (msg == "")
|
|
|
381
|
+ {
|
|
|
382
|
+ return Success("导出成功");
|
|
|
383
|
+ }
|
|
|
384
|
+ else
|
|
|
385
|
+ {
|
|
|
386
|
+ return Error("导出失败");
|
|
|
387
|
+ }
|
|
|
388
|
+ }
|
|
|
389
|
+
|
|
|
390
|
+ int recordCount = 0;
|
|
|
391
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
392
|
+ "T_Bus_WorkOrder",
|
|
|
393
|
+ "F_WorkOrderId",
|
|
|
394
|
+ cols,
|
|
|
395
|
+ sql,
|
|
|
396
|
+ "ORDER BY F_CreateTime DESC",
|
|
|
397
|
+ pagesize,
|
|
|
398
|
+ pageindex,
|
|
|
399
|
+ true,
|
|
|
400
|
+ out recordCount);
|
|
|
401
|
+
|
|
|
402
|
+ var obj = new
|
|
|
403
|
+ {
|
|
|
404
|
+ state = "success",
|
|
|
405
|
+ message = "成功",
|
|
|
406
|
+ rows = dt,
|
|
|
407
|
+ total = recordCount
|
|
|
408
|
+ };
|
|
|
409
|
+ return Content(obj.ToJson());
|
|
|
410
|
+
|
|
|
411
|
+ }
|
|
|
412
|
+
|
|
|
413
|
+ /// <summary>
|
|
|
414
|
+ /// APP上传图片
|
|
|
415
|
+ /// </summary>
|
|
|
416
|
+ /// <returns></returns>
|
|
|
417
|
+ [APPActionFilter]
|
|
|
418
|
+ public ActionResult Upload64()
|
|
|
419
|
+ {
|
|
|
420
|
+ //string dataurl = HttpUtility.UrlDecode(RequestString.GetFormString("dataurl"));
|
|
|
421
|
+ string dataurl = RequestString.GetFormString("dataurl");
|
|
|
422
|
+ if (!string.IsNullOrEmpty(dataurl))
|
|
|
423
|
+ {
|
|
|
424
|
+ string path = "/Upload/APP/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
|
|
|
425
|
+
|
|
|
426
|
+ ImageUpload iu = new ImageUpload();
|
|
|
427
|
+ iu.SavePath = path;
|
|
|
428
|
+ iu.DataUrl = dataurl;
|
|
|
429
|
+ iu.SaveType = 0;
|
|
|
430
|
+ iu.Upload64();
|
|
|
431
|
+
|
|
|
432
|
+ int n = iu.Error;
|
|
|
433
|
+ if (n == 0)
|
|
|
434
|
+ {
|
|
|
435
|
+ path = path + iu.OutFileName;
|
|
|
436
|
+
|
|
|
437
|
+ Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
|
|
|
438
|
+ model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
|
|
|
439
|
+ model_T_Sys_Accessories.F_FileName = iu.OutFileName;//附件名称
|
|
|
440
|
+ model_T_Sys_Accessories.F_FileType = ".jpg";//附件类型
|
|
|
441
|
+ model_T_Sys_Accessories.F_FileUrl = path;//附件地址
|
|
|
442
|
+ model_T_Sys_Accessories.F_Size = iu.FileSize;
|
|
|
443
|
+ //model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
|
|
|
444
|
+ int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
|
|
|
445
|
+ model_T_Sys_Accessories.F_FileId = id;
|
|
|
446
|
+
|
|
|
447
|
+ return Success("成功", model_T_Sys_Accessories);
|
|
|
448
|
+ }
|
|
|
449
|
+ else
|
|
|
450
|
+ {
|
|
|
451
|
+ string msg = string.Empty;
|
|
|
452
|
+ switch (n)
|
|
|
453
|
+ {
|
|
|
454
|
+ case 1: msg = "请选择要上传的文件"; break;
|
|
|
455
|
+ case 2: msg = "上传的文件类型不支持"; break;
|
|
|
456
|
+ case 3: msg = "上传的文件过大"; break;
|
|
|
457
|
+ case 4: msg = "未知错误"; break;
|
|
|
458
|
+ }
|
|
|
459
|
+ return Error(msg);
|
|
|
460
|
+ }
|
|
|
461
|
+ }
|
|
|
462
|
+ else
|
|
|
463
|
+ {
|
|
|
464
|
+ return Error("请选择要上传的文件");
|
|
|
465
|
+ }
|
|
|
466
|
+ }
|
|
|
467
|
+
|
|
|
468
|
+ /// <summary>
|
|
|
469
|
+ /// 添加工单信息
|
|
|
470
|
+ /// </summary>
|
|
|
471
|
+ /// <returns></returns>
|
|
|
472
|
+ [APPActionFilter]
|
|
|
473
|
+ public ActionResult AddWorkOrder()
|
|
|
474
|
+ {
|
|
|
475
|
+
|
|
|
476
|
+ string usercode = RequestString.GetFormString("usercode");
|
|
|
477
|
+
|
|
|
478
|
+ var userinfo = new BLL.T_Sys_Users().GetModel(usercode);
|
|
|
479
|
+
|
|
|
480
|
+ int source = RequestString.GetInt("source", 6);
|
|
|
481
|
+
|
|
|
482
|
+ string cusname = RequestString.GetFormString("cusname");
|
|
|
483
|
+ string cussex = RequestString.GetFormString("cussex");
|
|
|
484
|
+ string cusphone = RequestString.GetFormString("cusphone");
|
|
|
485
|
+ string cusaddress = RequestString.GetFormString("cusaddress");
|
|
|
486
|
+ string email = RequestString.GetFormString("email");
|
|
|
487
|
+ string zipcode = RequestString.GetFormString("zipcode");
|
|
|
488
|
+ string conname = RequestString.GetFormString("conname");
|
|
|
489
|
+ string conphone = RequestString.GetFormString("conphone");
|
|
|
490
|
+
|
|
|
491
|
+ string title = RequestString.GetFormString("title");
|
|
|
492
|
+ string content = RequestString.GetFormString("content");
|
|
|
493
|
+ string files = RequestString.GetFormString("files");
|
|
|
494
|
+ int sourcearea = RequestString.GetInt("sourcearea", 0);
|
|
|
495
|
+ string sourceaddress = RequestString.GetFormString("sourceaddress");
|
|
|
496
|
+
|
|
|
497
|
+ int isresult = RequestString.GetInt("isresult", 0);
|
|
|
498
|
+ string result = RequestString.GetFormString("result");
|
|
|
499
|
+
|
|
|
500
|
+ string keys = RequestString.GetFormString("keys");
|
|
|
501
|
+ string splituser = RequestString.GetFormString("splituser");
|
|
|
502
|
+
|
|
|
503
|
+ int type = RequestString.GetInt("type", 0);
|
|
|
504
|
+ int bigtype = RequestString.GetInt("bigtype", 0);
|
|
|
505
|
+ int smalltype = RequestString.GetInt("smalltype", 0);
|
|
|
506
|
+
|
|
|
507
|
+ int isprotect = RequestString.GetInt("isprotect", 0);
|
|
|
508
|
+ int level = RequestString.GetInt("level", 0);
|
|
|
509
|
+
|
|
|
510
|
+ WorkOrderController woc = new WorkOrderController();
|
|
|
511
|
+ string workorderid = woc.AddWorkOrderBySource(6, cusname, cussex, cusphone, cusaddress, email, zipcode, conname,
|
|
|
512
|
+ conphone, title, content, sourcearea, sourceaddress, keys, splituser, type, bigtype, smalltype, isprotect, level);
|
|
|
513
|
+ if (!string.IsNullOrEmpty(workorderid))
|
|
|
514
|
+ {
|
|
|
515
|
+ using (TransactionScope trans = new TransactionScope())
|
|
|
516
|
+ {
|
|
|
517
|
+ #region 保存用户工单信息
|
|
|
518
|
+ Model.T_Bus_UserWorkOrder tbu = new Model.T_Bus_UserWorkOrder();
|
|
|
519
|
+ tbu.F_UserId = userinfo.F_Id;
|
|
|
520
|
+ tbu.F_WorkOrderId = workorderid;
|
|
|
521
|
+ new BLL.T_Bus_UserWorkOrder().Add(tbu);
|
|
|
522
|
+ #endregion
|
|
|
523
|
+
|
|
|
524
|
+ trans.Complete();
|
|
|
525
|
+ }
|
|
|
526
|
+ return Success("操作成功");
|
|
|
527
|
+ }
|
|
|
528
|
+ else
|
|
|
529
|
+ {
|
|
|
530
|
+ return Error("操作失败");
|
|
|
531
|
+ }
|
|
|
532
|
+ }
|
|
|
533
|
+
|
|
|
534
|
+ /// <summary>
|
|
|
535
|
+ /// 市民催单
|
|
|
536
|
+ /// </summary>
|
|
|
537
|
+ /// <returns></returns>
|
|
|
538
|
+ [APPActionFilter]
|
|
|
539
|
+ public ActionResult AdditionalWorkOrder()
|
|
|
540
|
+ {
|
|
|
541
|
+ string usercode = RequestString.GetFormString("usercode");
|
|
|
542
|
+ var userinfo = new BLL.T_Sys_Users().GetModel(usercode);
|
|
|
543
|
+
|
|
|
544
|
+ string workorderid = RequestString.GetFormString("workorderid");
|
|
|
545
|
+ string title = RequestString.GetFormString("title");
|
|
|
546
|
+ string content = RequestString.GetFormString("content");
|
|
|
547
|
+ Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
|
|
|
548
|
+ if (modelT_Bus_WorkOrder != null)
|
|
|
549
|
+ {
|
|
|
550
|
+ using (TransactionScope trans = new TransactionScope())
|
|
|
551
|
+ {
|
|
|
552
|
+
|
|
|
553
|
+ #region 插入附加记录
|
|
|
554
|
+ //批示记录
|
|
|
555
|
+ Model.T_Bus_Additional model_T_Bus_Additional = new Model.T_Bus_Additional();
|
|
|
556
|
+ model_T_Bus_Additional.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
|
|
|
557
|
+ model_T_Bus_Additional.F_Title = title;
|
|
|
558
|
+ model_T_Bus_Additional.F_Content = content;
|
|
|
559
|
+ model_T_Bus_Additional.F_CreateTime = DateTime.Now;
|
|
|
560
|
+ model_T_Bus_Additional.F_IsDelete = 0;
|
|
|
561
|
+ model_T_Bus_Additional.F_State = 1;
|
|
|
562
|
+ new BLL.T_Bus_Additional().Add(model_T_Bus_Additional);
|
|
|
563
|
+ #endregion
|
|
|
564
|
+
|
|
|
565
|
+ #region 插入操作记录
|
|
|
566
|
+ Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
|
|
|
567
|
+ oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
|
|
|
568
|
+ oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
|
|
|
569
|
+
|
|
|
570
|
+ oper.F_Message = "市民("+ userinfo.F_OpenId + ")催单,内容:" + content;
|
|
|
571
|
+ //oper.F_CreateUser = userModel.F_UserCode;
|
|
|
572
|
+ oper.F_CreateTime = DateTime.Now;
|
|
|
573
|
+ oper.F_IsDelete = 0;
|
|
|
574
|
+
|
|
|
575
|
+ new BLL.T_Bus_Operation().Add(oper);
|
|
|
576
|
+ #endregion
|
|
|
577
|
+
|
|
|
578
|
+ trans.Complete();
|
|
|
579
|
+ }
|
|
|
580
|
+ return Success("操作成功");
|
|
|
581
|
+ }
|
|
|
582
|
+ else
|
|
|
583
|
+ {
|
|
|
584
|
+ return Error("操作失败");
|
|
|
585
|
+ }
|
|
|
586
|
+ }
|
|
|
587
|
+ }
|
|
|
588
|
+}
|