YtiotXjEventProcessingServicesImpl.java 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428
  1. package cn.com.usky.iot.xjeventprocessing.service;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import java.util.HashMap;
  5. import java.util.Iterator;
  6. import java.util.List;
  7. import java.util.Map;
  8. import cn.com.usky.iot.entity.YtiotXjEventProcessing;
  9. import cn.com.usky.iot.xjeventprocessing.dao.YtiotXjEventProcessingDao;
  10. import cn.com.usky.iot.entity.YtiotXjToExamine1;
  11. import cn.com.usky.iot.xjtoexamine1.dao.YtiotXjToExamine1Dao;
  12. import cn.com.usky.iot.entity.YtiotXjSpotOperationRecord;
  13. import cn.com.usky.iot.xjspotoperationrecord.dao.YtiotXjSpotOperationRecordDao;
  14. import cn.com.usky.iot.entity.YtiotXjInspectors;
  15. import cn.com.usky.iot.xjinspectors.dao.YtiotXjInspectorsDao;
  16. import cn.com.usky.iot.entity.YtiotXjOperationRecordPhotos;
  17. import cn.com.usky.iot.xjoperationrecordphotos.dao.YtiotXjOperationRecordPhotosDao;
  18. import cn.com.usky.iot.entity.YtiotXjInspectionPoints;
  19. import cn.com.usky.iot.xjinspectionpoints.dao.YtiotXjInspectionPointsDao;
  20. //import cn.com.usky.iot.entity.YtiotVUsercompany;
  21. //import cn.com.usky.iot.entity.YtiotVUsercompanyId;
  22. //import cn.com.usky.iot.admin.dao.YtiotVUserCompanyDao;
  23. import cn.com.usky.utils.DaoResult;
  24. import net.sf.json.JSONArray;
  25. import net.sf.json.JSONObject;
  26. public class YtiotXjEventProcessingServicesImpl implements YtiotXjEventProcessingService {
  27. private YtiotXjEventProcessingDao ytiotXjEventProcessingDao;
  28. private YtiotXjToExamine1Dao ytiotXjToExamine1Dao;
  29. private YtiotXjSpotOperationRecordDao ytiotXjSpotOperationRecordDao;
  30. private YtiotXjOperationRecordPhotosDao ytiotXjOperationRecordPhotosDao;
  31. private YtiotXjInspectorsDao ytiotXjInspectorsDao;
  32. private YtiotXjInspectionPointsDao ytiotXjInspectionPointsDao;
  33. // private YtiotVUserCompanyDao ytiotVUserCompanyDao;
  34. public YtiotXjEventProcessingDao getYtiotXjEventProcessingDao() {
  35. return ytiotXjEventProcessingDao;
  36. }
  37. public void setYtiotXjEventProcessingDao(YtiotXjEventProcessingDao ytiotXjEventProcessingDao) {
  38. this.ytiotXjEventProcessingDao = ytiotXjEventProcessingDao;
  39. }
  40. public YtiotXjToExamine1Dao getYtiotXjToExamine1Dao() {
  41. return ytiotXjToExamine1Dao;
  42. }
  43. public void setYtiotXjToExamine1Dao(YtiotXjToExamine1Dao ytiotXjToExamine1Dao) {
  44. this.ytiotXjToExamine1Dao = ytiotXjToExamine1Dao;
  45. }
  46. public YtiotXjSpotOperationRecordDao getYtiotXjSpotOperationRecordDao() {
  47. return ytiotXjSpotOperationRecordDao;
  48. }
  49. public void setYtiotXjSpotOperationRecordDao(YtiotXjSpotOperationRecordDao ytiotXjSpotOperationRecordDao) {
  50. this.ytiotXjSpotOperationRecordDao = ytiotXjSpotOperationRecordDao;
  51. }
  52. public YtiotXjOperationRecordPhotosDao getYtiotXjOperationRecordPhotosDao() {
  53. return ytiotXjOperationRecordPhotosDao;
  54. }
  55. public void setYtiotXjOperationRecordPhotosDao(YtiotXjOperationRecordPhotosDao ytiotXjOperationRecordPhotosDao) {
  56. this.ytiotXjOperationRecordPhotosDao = ytiotXjOperationRecordPhotosDao;
  57. }
  58. public YtiotXjInspectorsDao getYtiotXjInspectorsDao() {
  59. return ytiotXjInspectorsDao;
  60. }
  61. public void setYtiotXjInspectorsDao(YtiotXjInspectorsDao ytiotXjInspectorsDao) {
  62. this.ytiotXjInspectorsDao = ytiotXjInspectorsDao;
  63. }
  64. public YtiotXjInspectionPointsDao getYtiotXjInspectionPointsDao() {
  65. return ytiotXjInspectionPointsDao;
  66. }
  67. public void setYtiotXjInspectionPointsDao(YtiotXjInspectionPointsDao ytiotXjInspectionPointsDao) {
  68. this.ytiotXjInspectionPointsDao = ytiotXjInspectionPointsDao;
  69. }
  70. // public YtiotVUserCompanyDao getYtiotVUserCompanyDao() {
  71. // return ytiotVUserCompanyDao;
  72. // }
  73. //
  74. // public void setYtiotVUserCompanyDao(YtiotVUserCompanyDao ytiotVUserCompanyDao) {
  75. // this.ytiotVUserCompanyDao = ytiotVUserCompanyDao;
  76. // }
  77. public boolean chk_string_param(String param) {
  78. if(param==null)
  79. return true;
  80. if(param.indexOf("=")>=0)
  81. return false;
  82. if(param.indexOf("\'")>=0)
  83. return false;
  84. if(param.indexOf("\"")>=0)
  85. return false;
  86. return true;
  87. }
  88. public String chkhw(String hqlwhere){
  89. if(hqlwhere==null)
  90. return " where ";
  91. else
  92. return hqlwhere+" and ";
  93. }
  94. public String fieldname(String field){
  95. if(field.equals("cl_type"))
  96. return "clType";
  97. if(field.equals("cl_time"))
  98. return "clTime";
  99. if(field.equals("user_name"))
  100. return "userName";
  101. if(field.equals("zn"))
  102. return "zn";
  103. if(field.equals("id"))
  104. return "id";
  105. if(field.equals("dwjl_id"))
  106. return "dwjlId";
  107. if(field.equals("sj_type"))
  108. return "sjType";
  109. if(field.equals("y_complete_time"))
  110. return "YCompleteTime";
  111. if(field.equals("p_remarks"))
  112. return "pRemarks";
  113. if(field.equals("user_name`"))
  114. return "userName`";
  115. if(field.equals("data1"))
  116. return "data1";
  117. if(field.equals("data1"))
  118. return "data1";
  119. if(field.equals("data2"))
  120. return "data2";
  121. if(field.equals("data3"))
  122. return "data3";
  123. if(field.equals("team_id"))
  124. return "teamId";
  125. if(field.equals("people_id"))
  126. return "peopleId";
  127. if(field.equals("person_liable_id"))
  128. return "personLiableId";
  129. if(field.equals("person_liable"))
  130. return "personLiable";
  131. if(field.equals("event_processing_id"))
  132. return "eventProcessingId";
  133. return null;
  134. }
  135. @Override
  136. public String updateEventProcessingzp(String queryJson) throws Exception {
  137. // TODO Auto-generated method stub
  138. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  139. String id = null;
  140. String sj_type = null;
  141. String person_liable = null;
  142. String y_complete_time = null;
  143. String zp_remarks = null;
  144. String V_LOGINNAME = null;
  145. JSONObject q_json = null;
  146. JSONArray jSONArray = new JSONArray();
  147. JSONObject json = new JSONObject();
  148. json.put("action", "updateEventProcessingzp");
  149. if(queryJson!=null) {
  150. q_json = JSONObject.fromObject(queryJson);
  151. id = q_json.has("id")?q_json.getString("id"):null;
  152. sj_type = q_json.has("sj_type")?q_json.getString("sj_type"):null;
  153. person_liable = q_json.has("person_liable")?q_json.getString("person_liable"):null;
  154. y_complete_time = q_json.has("y_complete_time")?q_json.getString("y_complete_time"):null;
  155. zp_remarks = q_json.has("zp_remarks")?q_json.getString("zp_remarks"):null;
  156. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  157. // System.out.println(q_json);
  158. json.put("query", queryJson);
  159. }
  160. if(chk_string_param(id)&&chk_string_param(sj_type)&&chk_string_param(person_liable)
  161. &&chk_string_param(y_complete_time)&&chk_string_param(zp_remarks)&&chk_string_param(V_LOGINNAME)) {
  162. if(id!=null) {
  163. List list = ytiotXjEventProcessingDao.query(" where u."+fieldname("id")+" ='"+id+"' ", null, null, null, null);
  164. if(list.size()>0) {
  165. YtiotXjEventProcessing o = (YtiotXjEventProcessing) list.get(0);
  166. if(sj_type!=null)
  167. o.setSjType(Integer.parseInt(sj_type));
  168. if(person_liable!=null)
  169. o.setPersonLiable(Integer.parseInt(person_liable));
  170. if(y_complete_time!=null)
  171. o.setYCompleteTime(formatter.parse(y_complete_time));
  172. if(zp_remarks!=null)
  173. o.setZpRemarks(zp_remarks);
  174. o.setClType(1);
  175. // System.out.println("测试000000"+o.getWxName());
  176. // System.out.println("测试000000"+o.getShTime());
  177. o.setShTime(formatter.parse("1970-01-01 08:00:00.00"));
  178. o.setClTime(formatter.parse("1970-01-01 08:00:00.00"));
  179. o.setData1("0");
  180. if(V_LOGINNAME!=null)
  181. o.setUserName(V_LOGINNAME);
  182. DaoResult ret = ytiotXjEventProcessingDao.update(o);
  183. System.out.println("测试000001"+ret.isSuccess());
  184. System.out.println("测试000002"+ret.getResult());
  185. json.put("success", ret.isSuccess());
  186. json.put("MSG", ret.getResult());
  187. }else {
  188. json.put("success", false);
  189. json.put("MSG", "需要编辑的权限记录不存在");
  190. }
  191. }else {
  192. json.put("success", false);
  193. json.put("MSG", "记录ID不能为空");
  194. }
  195. }else {
  196. json.put("success", false);
  197. json.put("MSG", "参数验证错误");
  198. }
  199. return json.toString();
  200. }
  201. @Override
  202. public String updateEventProcessingsh(String queryJson) throws Exception {
  203. // TODO Auto-generated method stub
  204. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  205. String id = null;
  206. String cl_type = null;
  207. String sh_remarks = null;
  208. String sh_time = null;
  209. String V_LOGINNAME = null;
  210. JSONObject q_json = null;
  211. JSONArray jSONArray = new JSONArray();
  212. JSONObject json = new JSONObject();
  213. json.put("action", "updateEventProcessingsh");
  214. if(queryJson!=null) {
  215. q_json = JSONObject.fromObject(queryJson);
  216. id = q_json.has("id")?q_json.getString("id"):null;
  217. cl_type = q_json.has("cl_type")?q_json.getString("cl_type"):null;
  218. sh_remarks = q_json.has("sh_remarks")?q_json.getString("sh_remarks"):null;
  219. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  220. json.put("query", queryJson);
  221. }
  222. if(chk_string_param(id)&&chk_string_param(cl_type)&&chk_string_param(sh_remarks)&&chk_string_param(V_LOGINNAME)) {
  223. if(id!=null) {
  224. List list = ytiotXjEventProcessingDao.query(" where u."+fieldname("id")+" ="+id, null, null, null, null);
  225. if(list.size()>0) {
  226. YtiotXjEventProcessing o = (YtiotXjEventProcessing) list.get(0);
  227. if(cl_type!=null)
  228. o.setClType(Integer.parseInt(cl_type));
  229. if(sh_remarks!=null)
  230. o.setShRemarks(sh_remarks);
  231. if(V_LOGINNAME!=null)
  232. o.setUserName(V_LOGINNAME);
  233. // if(sh_time!=null)
  234. o.setShTime(new Date());
  235. if(Integer.parseInt(cl_type)==3) {
  236. o.setData1("0");
  237. }
  238. DaoResult ret = ytiotXjEventProcessingDao.updatesh(o);
  239. json.put("success", ret.isSuccess());
  240. json.put("MSG", ret.getResult());
  241. }else {
  242. json.put("success", false);
  243. json.put("MSG", "需要编辑的权限记录不存在");
  244. }
  245. }else {
  246. json.put("success", false);
  247. json.put("MSG", "记录ID不能为空");
  248. }
  249. }else {
  250. json.put("success", false);
  251. json.put("MSG", "参数验证错误");
  252. }
  253. return json.toString();
  254. }
  255. @Override
  256. public String getEventProcessingList(String queryJson, String page, String start, String limit, String sort) throws Exception {
  257. // TODO Auto-generated method stub
  258. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
  259. SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  260. String id = null;
  261. String dwjl_id = null;
  262. String sj_type = null;
  263. String y_complete_time = null;
  264. String V_LOGINNAME = null;
  265. String V_PASSWORD = null;
  266. String person_liable = null;
  267. String zp_remarks = null;
  268. String user_name = null;
  269. String data1 = null;
  270. String data2 = null;
  271. String data3 = null;
  272. String cl_type = null;
  273. String cl_time = null;
  274. String wx_name = null;
  275. int xh = 0;
  276. String dwsb_remarks = null;
  277. String cl_time_k = null;
  278. String cl_time_k1 = null;
  279. String cl_time_j = null;
  280. String cl_time_j1 = null;
  281. String event_processing_id_list = null;
  282. String event_processing_id_list1 = null;
  283. String dwjl_id_list = null;
  284. String hehe = "1970-01-01 08:00:00";
  285. String hehe00 = "0000-00-00 00:00:00";
  286. String dqsj = formatter.format(new Date());
  287. String cl_sql=null;
  288. String sql=null;
  289. String cl_sql1=null;
  290. String dwjl_sql = null;
  291. String dwjl_sql1 = null;
  292. String hqlwhere = null;
  293. String hqlwhere1 = null;
  294. String clsj_sql = null;
  295. String zrr_sql = null;
  296. String zsl_hqlwhere = null;
  297. String jrrw_hqlwhere = null;
  298. String csrw_hqlwhere = null;
  299. String jrjj_hqlwhere = null;
  300. String dz_sql = null;
  301. String Page = null;
  302. String Start = null;
  303. JSONArray Sort = null;
  304. String Limit = null;
  305. String order = null;
  306. String dir = null;
  307. String order_str = null;
  308. JSONObject q_json = null;
  309. JSONArray jSONArray = new JSONArray();
  310. JSONArray jSONArray1 = new JSONArray();
  311. JSONArray jSONArray3 = new JSONArray();
  312. JSONObject json = new JSONObject();
  313. json.put("action", "getEventProcessingList");
  314. if(queryJson!=null) {
  315. q_json = JSONObject.fromObject(queryJson);
  316. id = q_json.has("id")?q_json.getString("id"):null;
  317. sj_type = q_json.has("sj_type")?q_json.getString("sj_type"):null;
  318. cl_type = q_json.has("cl_type")?q_json.getString("cl_type"):null;
  319. cl_time_k = q_json.has("cl_time_k")?q_json.getString("cl_time_k"):null;
  320. cl_time_j = q_json.has("cl_time_j")?q_json.getString("cl_time_j"):null;
  321. person_liable = q_json.has("person_liable")?q_json.getString("person_liable"):null;
  322. wx_name = q_json.has("wx_name")?q_json.getString("wx_name"):null;
  323. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  324. V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
  325. order = q_json.has("order")?q_json.getString("order"):null;
  326. dir = q_json.has("dir")?q_json.getString("dir"):null;
  327. Start = q_json.has("start")?q_json.getString("start"):(start!=null)?start:"0";
  328. Limit = q_json.has("limit")?q_json.getString("limit"):(limit!=null)?limit:null;
  329. Page = q_json.has("page")?q_json.getString("page"):(page!=null)?page:"0";
  330. json.put("query", queryJson);
  331. }
  332. // System.out.println();
  333. if(sort!=null) {
  334. Sort = JSONArray.fromObject(sort);
  335. if((Sort.isArray())&&(Sort.size()>0)) {
  336. JSONObject s_json = Sort.getJSONObject(0);
  337. order = s_json.has("property")?s_json.getString("property"):order;
  338. dir = s_json.has("direction")?s_json.getString("direction"):dir;
  339. }
  340. json.put("sort", sort);
  341. }
  342. Start = start;
  343. Limit = limit;
  344. Page = page;
  345. hqlwhere = chkhw(hqlwhere) + "u.userName='"+V_LOGINNAME+"'";
  346. if(sj_type!=null&&Integer.parseInt(sj_type)!=0)
  347. hqlwhere = chkhw(hqlwhere) + "u.sjType = "+sj_type;
  348. if(person_liable!=null&&person_liable.length()>0&&Integer.parseInt(person_liable)!=0)
  349. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("person_liable")+" = "+person_liable;
  350. if(cl_type!=null&&Integer.parseInt(cl_type)!=0)
  351. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("cl_type")+"="+cl_type;
  352. if(cl_time_k!=null) {
  353. cl_time_k1=cl_time_k+" 00:01:00";
  354. hqlwhere = chkhw(hqlwhere) + "u.clTime >='"+cl_time_k1+"'";
  355. }
  356. if(cl_time_j!=null) {
  357. cl_time_j1 = cl_time_j+" 23:59:00";
  358. hqlwhere = chkhw(hqlwhere) + "u.clTime <='"+cl_time_j1+"'";
  359. }
  360. if(wx_name!=null)
  361. hqlwhere = chkhw(hqlwhere) + "u.wxName like '%"+wx_name+"%'";
  362. if(order!=null)
  363. order_str = " order by u."+fieldname(order);
  364. else
  365. order_str = " order by u."+fieldname("id");
  366. int totalCount = ytiotXjEventProcessingDao.getCount(hqlwhere);
  367. json.put("totalCount", totalCount);
  368. if(Start!=null){
  369. if(Integer.parseInt(Start)>totalCount){
  370. Start = "0";
  371. Page = "0";
  372. }
  373. if(page==null)
  374. Page="0";
  375. }else{
  376. Start = "0";
  377. Page = "0";
  378. }
  379. json.put("page", Page);
  380. json.put("start", Start);
  381. json.put("limit", Limit);
  382. hqlwhere1 = chkhw(hqlwhere1) + "u.zn in ('4','5','6','7')";
  383. if(V_LOGINNAME!=null)
  384. hqlwhere1 = chkhw(hqlwhere1) + "u.data2='"+V_LOGINNAME+"'";
  385. sql="";
  386. List list_zrrxlk = ytiotXjInspectorsDao.query(hqlwhere1, null, null, null, null);
  387. if(list_zrrxlk.size()>0) {
  388. for(int i=0;i<list_zrrxlk.size();i++) {
  389. YtiotXjInspectors zrrxlk_o = (YtiotXjInspectors)list_zrrxlk.get(i);
  390. Map map1 = new HashMap();
  391. map1.put("zrrid", zrrxlk_o.getId());
  392. map1.put("name", zrrxlk_o.getName());
  393. JSONObject jSONObject1 = JSONObject.fromObject(map1);
  394. jSONArray1.add(jSONObject1);
  395. }
  396. json.put("RESULT1", jSONArray1);
  397. }
  398. // System.out.println("测试88888888"+hqlwhere);
  399. if(totalCount>0) {
  400. List list = ytiotXjEventProcessingDao.query(hqlwhere, order_str, dir, Start, Limit);
  401. if(list.size()>0) {
  402. for(int i=0;i<list.size();i++) {
  403. YtiotXjEventProcessing o = (YtiotXjEventProcessing)list.get(i);
  404. Map map = new HashMap();
  405. xh=i+1;
  406. map.put("xh", xh);
  407. map.put("id", o.getId());
  408. map.put("wx_name", o.getWxName());
  409. if(String.valueOf(o.getDwjlId())!=null) {
  410. dwjl_sql1 = " where u.id="+o.getDwjlId();
  411. List dwjl_list1 = ytiotXjSpotOperationRecordDao.query(dwjl_sql1, null, null, null, null);
  412. if(dwjl_list1.size()>0) {
  413. YtiotXjSpotOperationRecord dwjl_o1 = (YtiotXjSpotOperationRecord)dwjl_list1.get(0);
  414. if(String.valueOf(dwjl_o1.getSpotId())!=null) {
  415. dz_sql=" where u.id="+dwjl_o1.getSpotId();
  416. List dz_list = ytiotXjInspectionPointsDao.query(dz_sql, null, null, null, null);
  417. if( dz_list.size()>0) {
  418. YtiotXjInspectionPoints dz_o = (YtiotXjInspectionPoints)dz_list.get(0);
  419. map.put("spot_address", dz_o.getSpotAddress());
  420. }
  421. }
  422. }
  423. }
  424. // System.out.println("测试000666故障"+o.getSjType());
  425. if(o.getSjType()==1) {
  426. map.put("sj_type_name", "故障");
  427. // System.out.println("测试000666故障");
  428. }else if(o.getSjType()==2) {
  429. map.put("sj_type_name", "隐患");
  430. // System.out.println("测试000666四大");
  431. }else if(o.getSjType()==3) {
  432. map.put("sj_type_name", "其他");
  433. // System.out.println("测试000666发鬼地方");
  434. }else{
  435. // System.out.println("测试000666打算");
  436. map.put("sj_type_name", "--");
  437. }
  438. if(o.getYCompleteTime()!=null) {
  439. if(formatter1.format(o.getYCompleteTime()).equals(hehe)||formatter1.format(o.getYCompleteTime()).equals(hehe00)) {
  440. map.put("y_complete_time", "--");
  441. }else {
  442. map.put("y_complete_time", formatter1.format(o.getYCompleteTime()));
  443. }
  444. }else {
  445. map.put("y_complete_time", "--");
  446. }
  447. if(o.getClType()==2) {
  448. // map.put("cl_type_name", "< a href='javascript:void(0)' onclick=\"modifywin1(0," + o.getId() + ")\" style='color:#59c24a'>未审核</ a>");
  449. map.put("cl_type_name", "<a href='javascript:void(0)' onclick=\"examineStatus(0," + o.getId() + ")\" style='color:#59c24a'>"+"未审核"+"</a>");
  450. map.put("cl_time", "--");
  451. }else if(o.getClType()==3) {
  452. // map.put("cl_type_name", "< a href='javascript:void(0)' onclick=\"modifywin1(0," + o.getId() + ")\" style='color:#ff9254'>审核未通过</ a>");
  453. map.put("cl_type_name", "<a href='javascript:void(0)' onclick=\"examineStatus(1," + o.getId() + ")\" style='color:#ff9254'>"+"审核未通过"+"</a>");
  454. map.put("cl_time", "--");
  455. }else if(o.getClType()==4) {
  456. // map.put("cl_type_name", "< a href='javascript:void(0)' onclick=\"modifywin1(0," + o.getId() + ")\" style='color:#0082ff'>已完成</ a>");
  457. map.put("cl_type_name", "<a href='javascript:void(0)' onclick=\"examineStatus(2," + o.getId() + ")\" style='color:#0082ff'>"+"已完成 "+"</a>");
  458. map.put("cl_time", formatter1.format(o.getClTime()));
  459. }else if(o.getClType()==5) {
  460. // map.put("cl_type_name", "< a href='javascript:void(0)' onclick=\"modifywin1(0," + o.getId() + ")\" style='color:#ff9254'>超时完成 </ a>");
  461. map.put("cl_type_name", "<a href='javascript:void(0)' onclick=\"examineStatus(3," + o.getId() + ")\" style='color:#ff9254'>"+"超时完成 "+"</a>");
  462. map.put("cl_time", formatter1.format(o.getClTime()));
  463. }else if(o.getClType()==1) {
  464. map.put("cl_type_name", "<span style='color:#ff0000'>"+"未处理"+"</span>");
  465. map.put("cl_time", "--");
  466. }else if(o.getClType()==0) {
  467. map.put("cl_type_name", "<span style='color:#ff0000'>"+"未处理"+"</span>");
  468. map.put("cl_time", "--");
  469. }
  470. // System.out.println("测试000"+o.getPersonLiable());
  471. if(o.getPersonLiable()!=null) {
  472. // map.put("dqzt", "< a href='javascript:void(0)' onclick=\"modifywin1(0," + o.getId() + ")\" style='color:#0082ff'>已指派</ a>");
  473. map.put("dqzt", "<a href='javascript:void(0)' onclick=\"editMaintenancePresentation(1," + o.getId() + ")\" style='color:#0082ff'>"+"已指派"+"</a>");
  474. }else {
  475. // map.put("dqzt", "< a href='javascript:void(0)' onclick=\"modifywin1(0," + o.getId() + ")\" style='color:#ff0000'>未指派</ a>");
  476. map.put("dqzt", "<a href='javascript:void(0)' onclick=\"editMaintenancePresentation(0," + o.getId() + ")\" style='color:#ff0000'>"+"未指派"+"</a>");
  477. }
  478. if(o.getPersonLiable()!=null) {
  479. zrr_sql = " where u.id="+o.getPersonLiable();
  480. List zrr_list = ytiotXjInspectorsDao.query(zrr_sql, null, null, null, null);
  481. if(zrr_list .size()>0) {
  482. YtiotXjInspectors zrr_o = (YtiotXjInspectors)zrr_list.get(0);
  483. map.put("person_liable_name", zrr_o.getName());
  484. map.put("phone", zrr_o.getPhone());
  485. }
  486. }else {
  487. map.put("person_liable_name", "--");
  488. map.put("phone", "--");
  489. }
  490. JSONObject jSONObject = JSONObject.fromObject(map);
  491. jSONArray.add(jSONObject);
  492. }
  493. json.put("RESULT", jSONArray);
  494. }
  495. }
  496. Map map3 = new HashMap();
  497. //人员总数量
  498. if(V_LOGINNAME!=null) {
  499. zsl_hqlwhere = " where u."+fieldname("data2")+"='"+V_LOGINNAME+"' and u."+fieldname("zn")+" in (4,5,6,7)";
  500. // System.out.println(xjrysl_hqlwhere);
  501. int zrs = ytiotXjInspectorsDao.getCount(zsl_hqlwhere);
  502. // System.out.println(xjrysl);
  503. map3.put("zrs", zrs);
  504. // System.out.println("测试0"+zrs);
  505. }
  506. //今日事件
  507. if(dqsj!=null) {
  508. jrrw_hqlwhere = " where u."+fieldname("y_complete_time")+" like '%"+dqsj+"%' and u."+fieldname("user_name")+"='"+V_LOGINNAME+"'";
  509. // System.out.println(jrrw_hqlwhere);
  510. int jrsj = ytiotXjEventProcessingDao.getCount(jrrw_hqlwhere);
  511. // System.out.println("总数"+jrsj);
  512. map3.put("jrsj", jrsj);
  513. }else {
  514. map3.put("jrsj", 0);
  515. }
  516. //超时事件
  517. if(V_LOGINNAME!=null) {
  518. csrw_hqlwhere = " where u."+fieldname("user_name")+"='"+V_LOGINNAME+"' and u.clType=5";
  519. // System.out.println(jrrw_hqlwhere);
  520. int cssj = ytiotXjEventProcessingDao.getCount(csrw_hqlwhere);
  521. map3.put("cssj", cssj);
  522. }else {
  523. map3.put("cssj", 0);
  524. }
  525. //今日解决
  526. if(V_LOGINNAME!=null&&dqsj!=null) {
  527. jrjj_hqlwhere = " where u."+fieldname("user_name")+"='"+V_LOGINNAME+"' and u.clType=4 and u.shTime like '%"+dqsj+"%'";
  528. // System.out.println(jrrw_hqlwhere);
  529. int jrjj = ytiotXjEventProcessingDao.getCount(jrjj_hqlwhere);
  530. map3.put("jrjj", jrjj);
  531. }else {
  532. map3.put("jrjj", 0);
  533. }
  534. JSONObject jSONObject3 = JSONObject.fromObject(map3);
  535. jSONArray3.add(jSONObject3);
  536. json.put("RESULT2", jSONArray3);
  537. return json.toString();
  538. }
  539. @Override
  540. public String getReportDetailsList(String queryJson) throws Exception {
  541. // TODO Auto-generated method stub
  542. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  543. String id = null;
  544. String hehe = "0002-11-30 00:00:00";
  545. String V_LOGINNAME = null;
  546. String V_PASSWORD = null;
  547. String name_sql=null;
  548. String hqlwhere = null;
  549. String dwjl_sql = null;
  550. String tp_sql = null;
  551. // String Page = null;
  552. // String Start = null;
  553. // JSONArray Sort = null;
  554. // String Limit = null;
  555. String order = null;
  556. String dir = null;
  557. String order_str = null;
  558. JSONObject q_json = null;
  559. JSONArray jSONArray = new JSONArray();
  560. JSONObject json = new JSONObject();
  561. json.put("action", "getReportDetailsList");
  562. if(queryJson!=null) {
  563. q_json = JSONObject.fromObject(queryJson);
  564. id = q_json.has("id")?q_json.getString("id"):null;
  565. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  566. V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
  567. order = q_json.has("order")?q_json.getString("order"):null;
  568. dir = q_json.has("dir")?q_json.getString("dir"):null;
  569. json.put("query", queryJson);
  570. }
  571. // System.out.println();
  572. if(id!=null)
  573. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("id")+"="+id;
  574. if(order!=null)
  575. order_str = " order by u."+fieldname(order);
  576. else
  577. order_str = " order by u."+fieldname("id");
  578. int totalCount = ytiotXjEventProcessingDao.getCount(hqlwhere);
  579. json.put("totalCount", totalCount);
  580. if(totalCount>0) {
  581. List list = ytiotXjEventProcessingDao.query(hqlwhere, null, null, null, null);
  582. if(list.size()>0) {
  583. YtiotXjEventProcessing o = (YtiotXjEventProcessing)list.get(0);
  584. Map map = new HashMap();
  585. map.put("id", o.getId());
  586. if(String.valueOf(o.getDwjlId())!=null) {
  587. dwjl_sql = " where u.id="+o.getDwjlId();
  588. List dwjl_list = ytiotXjSpotOperationRecordDao.query(dwjl_sql, null, null, null, null);
  589. if(dwjl_list.size()>0) {
  590. YtiotXjSpotOperationRecord dwjl_o = (YtiotXjSpotOperationRecord)dwjl_list.get(0);
  591. if(dwjl_o.getWbrId()!=null) {
  592. name_sql=" where u.id="+dwjl_o.getWbrId();
  593. List name_list = ytiotXjInspectorsDao.query(name_sql, null, null, null, null);
  594. if(name_list.size()>0) {
  595. YtiotXjInspectors name_o = (YtiotXjInspectors)name_list.get(0);
  596. map.put("name", name_o.getName());
  597. // map.put("phone", name_o.getPhone());
  598. }
  599. }
  600. if(formatter.format(dwjl_o.getWcTime()).equals(hehe)) {
  601. map.put("sbsj", "--");
  602. }else {
  603. map.put("sbsj", formatter.format(dwjl_o.getWcTime()));
  604. }
  605. map.put("dwsb_remarks", dwjl_o.getDwsbRemarks());
  606. if(dwjl_o.getId()!=null) {
  607. tp_sql=" where u.dwczjlId="+dwjl_o.getId();
  608. List tp_list = ytiotXjOperationRecordPhotosDao.query(tp_sql, null, null, null, null);
  609. if(tp_list.size()>0) {
  610. YtiotXjOperationRecordPhotos tp_o = (YtiotXjOperationRecordPhotos)tp_list.get(0);
  611. map.put("report_photos", tp_o.getReportPhotos());
  612. }
  613. }
  614. }
  615. }
  616. JSONObject jSONObject = JSONObject.fromObject(map);
  617. jSONArray.add(jSONObject);
  618. json.put("RESULT", jSONArray);
  619. }
  620. }
  621. return json.toString();
  622. }
  623. @Override
  624. public String getAssignJlList(String queryJson) throws Exception {
  625. // TODO Auto-generated method stub
  626. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  627. String id = null;
  628. String hehe = "0000-00-00 00:00:00";
  629. String hehe00 = "1970-01-01 08:00:00";
  630. String hehe1 = "0002-11-30 00:00:00";
  631. String V_LOGINNAME = null;
  632. String V_PASSWORD = null;
  633. String name_sql=null;
  634. String name_sql2=null;
  635. String hqlwhere = null;
  636. String dwjl_sql = null;
  637. String tp_sql = null;
  638. // String Page = null;
  639. // String Start = null;
  640. // JSONArray Sort = null;
  641. // String Limit = null;
  642. String order = null;
  643. String dir = null;
  644. String order_str = null;
  645. JSONObject q_json = null;
  646. JSONArray jSONArray = new JSONArray();
  647. JSONObject json = new JSONObject();
  648. json.put("action", "getAssignJlList");
  649. if(queryJson!=null) {
  650. q_json = JSONObject.fromObject(queryJson);
  651. id = q_json.has("id")?q_json.getString("id"):null;
  652. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  653. V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
  654. order = q_json.has("order")?q_json.getString("order"):null;
  655. dir = q_json.has("dir")?q_json.getString("dir"):null;
  656. json.put("query", queryJson);
  657. }
  658. // System.out.println();
  659. if(id!=null)
  660. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("id")+"="+id;
  661. if(order!=null)
  662. order_str = " order by u."+fieldname(order);
  663. else
  664. order_str = " order by u."+fieldname("id");
  665. int totalCount = ytiotXjEventProcessingDao.getCount(hqlwhere);
  666. json.put("totalCount", totalCount);
  667. if(totalCount>0) {
  668. List list = ytiotXjEventProcessingDao.query(hqlwhere, null, null, null, null);
  669. if(list.size()>0) {
  670. YtiotXjEventProcessing o = (YtiotXjEventProcessing)list.get(0);
  671. Map map = new HashMap();
  672. map.put("id", o.getId());
  673. if(o.getSjType()==1) {
  674. map.put("sj_tytpe_name", "故障");
  675. }else if(o.getSjType()==2) {
  676. map.put("sj_tytpe_name", "隐患");
  677. }else if(o.getSjType()==3) {
  678. map.put("sj_tytpe_name", "其他");
  679. }
  680. if(o.getPersonLiable()!=null) {
  681. name_sql2=" where u.id="+o.getPersonLiable();
  682. List name_list2 = ytiotXjInspectorsDao.query(name_sql2, null, null, null, null);
  683. if(name_list2.size()>0) {
  684. YtiotXjInspectors name_o2 = (YtiotXjInspectors)name_list2.get(0);
  685. map.put("name", name_o2.getName());
  686. }
  687. }
  688. if(String.valueOf(o.getDwjlId())!=null) {
  689. dwjl_sql = " where u.id="+o.getDwjlId();
  690. List dwjl_list = ytiotXjSpotOperationRecordDao.query(dwjl_sql, null, null, null, null);
  691. if(dwjl_list.size()>0) {
  692. YtiotXjSpotOperationRecord dwjl_o = (YtiotXjSpotOperationRecord)dwjl_list.get(0);
  693. if(dwjl_o.getWbrId()!=null) {
  694. name_sql=" where u.id="+dwjl_o.getWbrId();
  695. List name_list = ytiotXjInspectorsDao.query(name_sql, null, null, null, null);
  696. if(name_list.size()>0) {
  697. YtiotXjInspectors name_o = (YtiotXjInspectors)name_list.get(0);
  698. map.put("phone", name_o.getPhone());
  699. }
  700. }
  701. if(formatter.format(dwjl_o.getWcTime()).equals(hehe1)) {
  702. map.put("sbsj", "--");
  703. }else {
  704. map.put("sbsj", formatter.format(dwjl_o.getWcTime()));
  705. }
  706. }
  707. }
  708. if(o.getYCompleteTime()!=null) {
  709. if(formatter.format(o.getYCompleteTime()).equals(hehe)||formatter.format(o.getYCompleteTime()).equals(hehe00)) {
  710. map.put("y_complete_time", "");
  711. }else {
  712. map.put("y_complete_time", formatter.format(o.getYCompleteTime()));
  713. }
  714. }else {
  715. map.put("y_complete_time", "");
  716. }
  717. // System.out.println("测试00"+formatter.format(o.getYCompleteTime()));
  718. map.put("zp_remarks", o.getZpRemarks());
  719. JSONObject jSONObject = JSONObject.fromObject(map);
  720. jSONArray.add(jSONObject);
  721. json.put("RESULT", jSONArray);
  722. }
  723. }
  724. return json.toString();
  725. }
  726. @Override
  727. public String getNotAudited(String queryJson) throws Exception {
  728. // TODO Auto-generated method stub
  729. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  730. String id = null;
  731. String hehe = "0000-00-00 00:00:00";
  732. String hehe1 = "0002-11-30 00:00:00";
  733. String V_LOGINNAME = null;
  734. String hehe00 = "1970-01-01 08:00:00";
  735. String V_PASSWORD = null;
  736. String name_sql=null;
  737. String name_sql2=null;
  738. String hqlwhere = null;
  739. String dwjl_sql = null;
  740. String tp_sql = null;
  741. String zt_sql = null;
  742. // String Page = null;
  743. // String Start = null;
  744. // JSONArray Sort = null;
  745. // String Limit = null;
  746. String order = null;
  747. String dir = null;
  748. String order_str = null;
  749. JSONObject q_json = null;
  750. JSONArray jSONArray = new JSONArray();
  751. JSONObject json = new JSONObject();
  752. json.put("action", "getNotAudited");
  753. if(queryJson!=null) {
  754. q_json = JSONObject.fromObject(queryJson);
  755. id = q_json.has("id")?q_json.getString("id"):null;
  756. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  757. V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
  758. order = q_json.has("order")?q_json.getString("order"):null;
  759. dir = q_json.has("dir")?q_json.getString("dir"):null;
  760. json.put("query", queryJson);
  761. }
  762. // System.out.println();
  763. if(id!=null)
  764. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("id")+"="+id;
  765. if(order!=null)
  766. order_str = " order by u."+fieldname(order);
  767. else
  768. order_str = " order by u."+fieldname("id");
  769. int totalCount = ytiotXjEventProcessingDao.getCount(hqlwhere);
  770. json.put("totalCount", totalCount);
  771. if(totalCount>0) {
  772. List list = ytiotXjEventProcessingDao.query(hqlwhere, null, null, null, null);
  773. if(list.size()>0) {
  774. YtiotXjEventProcessing o = (YtiotXjEventProcessing)list.get(0);
  775. Map map = new HashMap();
  776. map.put("id", o.getId());
  777. if( o.getId()!=null) {
  778. // zt_sql=" where u.eventProcessingId="+ o.getId()+" order by u.clTime desc";
  779. // List zt_list = ytiotXjToExamineDao.query(zt_sql, null, null, null, null);
  780. // if(zt_list.size()>0) {
  781. // YtiotXjToExamine zt_o = (YtiotXjToExamine)zt_list.get(0);
  782. map.put("cl_type", o.getClType());
  783. if(o.getClType()==2) {
  784. map.put("cl_type_name", "<span style='color:#59c24a'>"+"未审核"+"</span>");
  785. map.put("sh_time", "无");
  786. }else if(o.getClType()==3) {
  787. map.put("cl_type_name", "<span style='color:#ff9254'>"+"审核未通过"+"</span>");
  788. map.put("sh_time", formatter.format(o.getShTime()));
  789. }else if(o.getClType()==4) {
  790. map.put("cl_type_name", "<span style='color:#0082ff'>"+"已完成"+"</span>");
  791. map.put("sh_time", formatter.format(o.getShTime()));
  792. }else if(o.getClType()==5) {
  793. map.put("cl_type_name", "<span style='color:#ff9254'>"+"超时完成"+"</span>");
  794. map.put("sh_time", formatter.format(o.getShTime()));
  795. }else if(o.getClType()==1) {
  796. map.put("cl_type_name", "<span style='color:#ff0000'>"+"未处理"+"</span>");
  797. }
  798. map.put("picture_path", o.getPicturePath());
  799. map.put("cl_time", formatter.format(o.getClTime()));
  800. map.put("jg_remarks", o.getJgRemarks());
  801. map.put("data1", o.getData1());
  802. // if(formatter.format(o.getShTime()).equals(hehe)) {
  803. // map.put("sh_time", "无");
  804. // }else {
  805. // map.put("sh_time", formatter.format(o.getShTime()));
  806. // }
  807. if(o.getShRemarks()!=null) {
  808. map.put("sh_remarks", o.getShRemarks());
  809. }else {
  810. map.put("sh_remarks", "无");
  811. }
  812. // }
  813. }
  814. if(o.getYCompleteTime()!=null) {
  815. if(formatter.format(o.getYCompleteTime()).equals(hehe)||formatter.format(o.getYCompleteTime()).equals(hehe00)) {
  816. map.put("y_complete_time", "");
  817. }else {
  818. map.put("y_complete_time", formatter.format(o.getYCompleteTime()));
  819. }
  820. }else {
  821. map.put("y_complete_time", "");
  822. }
  823. if(o.getPersonLiable()!=null) {
  824. name_sql2=" where u.id="+o.getPersonLiable();
  825. List name_list2 = ytiotXjInspectorsDao.query(name_sql2, null, null, null, null);
  826. if(name_list2.size()>0) {
  827. YtiotXjInspectors name_o2 = (YtiotXjInspectors)name_list2.get(0);
  828. map.put("person_liable_name", name_o2.getName());
  829. }
  830. }
  831. if(String.valueOf(o.getDwjlId())!=null) {
  832. dwjl_sql = " where u.id="+o.getDwjlId();
  833. List dwjl_list = ytiotXjSpotOperationRecordDao.query(dwjl_sql, null, null, null, null);
  834. if(dwjl_list.size()>0) {
  835. YtiotXjSpotOperationRecord dwjl_o = (YtiotXjSpotOperationRecord)dwjl_list.get(0);
  836. if(dwjl_o.getWbrId()!=null) {
  837. name_sql=" where u.id="+dwjl_o.getWbrId();
  838. List name_list = ytiotXjInspectorsDao.query(name_sql, null, null, null, null);
  839. if(name_list.size()>0) {
  840. YtiotXjInspectors name_o = (YtiotXjInspectors)name_list.get(0);
  841. map.put("phone", name_o.getPhone());
  842. }
  843. }
  844. if(formatter.format(dwjl_o.getWcTime()).equals(hehe1)) {
  845. map.put("sbsj", "--");
  846. }else {
  847. map.put("sbsj", formatter.format(dwjl_o.getWcTime()));
  848. }
  849. }
  850. }
  851. JSONObject jSONObject = JSONObject.fromObject(map);
  852. jSONArray.add(jSONObject);
  853. json.put("RESULT", jSONArray);
  854. }
  855. }
  856. return json.toString();
  857. }
  858. @Override
  859. public String getFeedback(String queryJson) throws Exception {
  860. // TODO Auto-generated method stub
  861. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  862. String id = null;
  863. String event_processing_id = null;
  864. String hehe = "0000-00-00 00:00:00";
  865. String hehe1 = "0002-11-30 00:00:00";
  866. String hehe00 = "1970-01-01 08:00:00";
  867. String V_LOGINNAME = null;
  868. String V_PASSWORD = null;
  869. String name_sql=null;
  870. String name_sql2=null;
  871. String hqlwhere = null;
  872. String dwjl_sql = null;
  873. String tp_sql = null;
  874. String zt_sql = null;
  875. // String Page = null;
  876. // String Start = null;
  877. // JSONArray Sort = null;
  878. // String Limit = null;
  879. String order = null;
  880. String dir = null;
  881. String order_str = null;
  882. JSONObject q_json = null;
  883. JSONArray jSONArray = new JSONArray();
  884. JSONObject json = new JSONObject();
  885. json.put("action", "getFeedback");
  886. if(queryJson!=null) {
  887. q_json = JSONObject.fromObject(queryJson);
  888. event_processing_id = q_json.has("event_processing_id")?q_json.getString("event_processing_id"):null;
  889. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  890. V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
  891. order = q_json.has("order")?q_json.getString("order"):null;
  892. dir = q_json.has("dir")?q_json.getString("dir"):null;
  893. json.put("query", queryJson);
  894. }
  895. // System.out.println();
  896. if(event_processing_id!=null)
  897. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("event_processing_id")+"="+event_processing_id+" order by u.clTime asc";
  898. // if(order!=null)
  899. // order_str = " order by u."+fieldname(order);
  900. // else
  901. // order_str = " order by u."+fieldname("id");
  902. // System.out.println("测试666666"+hqlwhere);
  903. int totalCount = ytiotXjToExamine1Dao.getCount(hqlwhere);
  904. json.put("totalCount", totalCount);
  905. if(totalCount>0) {
  906. List list = ytiotXjToExamine1Dao.query(hqlwhere, null, null, null, null);
  907. if(list.size()>0) {
  908. for(int i=0;i<list.size();i++) {
  909. YtiotXjToExamine1 o = (YtiotXjToExamine1)list.get(i);
  910. Map map = new HashMap();
  911. map.put("id", o.getId());
  912. map.put("picture_path", o.getPicturePath());
  913. map.put("cl_time", formatter.format(o.getClTime()));
  914. map.put("jg_remarks", o.getJgRemarks());
  915. if(o.getClType()==2) {
  916. map.put("cl_type_name", "<span style='color:#59c24a'>"+"未审核"+"</span>");
  917. }else if(o.getClType()==3) {
  918. map.put("cl_type_name", "<span style='color:#ff9254'>"+"审核未通过"+"</span>");
  919. }else if(o.getClType()==4) {
  920. map.put("cl_type_name", "<span style='color:#0082ff'>"+"已完成"+"</span>");
  921. }else if(o.getClType()==5) {
  922. map.put("cl_type_name", "<span style='color:#ff9254'>"+"超时完成"+"</span>");
  923. }else if(o.getClType()==0) {
  924. map.put("cl_type_name", "无");
  925. }else if(o.getClType()==1) {
  926. map.put("cl_type_name", "<span style='color:#ff0000'>"+"未处理"+"</span>");
  927. }
  928. if(o.getPersonLiable()!=null) {
  929. name_sql2=" where u.id="+o.getPersonLiable();
  930. List name_list2 = ytiotXjInspectorsDao.query(name_sql2, null, null, null, null);
  931. if(name_list2.size()>0) {
  932. YtiotXjInspectors name_o2 = (YtiotXjInspectors)name_list2.get(0);
  933. map.put("person_liable_name", name_o2.getName());
  934. }
  935. }
  936. if(String.valueOf(o.getDwjlId())!=null) {
  937. dwjl_sql = " where u.id="+o.getDwjlId();
  938. List dwjl_list = ytiotXjSpotOperationRecordDao.query(dwjl_sql, null, null, null, null);
  939. if(dwjl_list.size()>0) {
  940. YtiotXjSpotOperationRecord dwjl_o = (YtiotXjSpotOperationRecord)dwjl_list.get(0);
  941. if(dwjl_o.getWbrId()!=null) {
  942. name_sql=" where u.id="+dwjl_o.getWbrId();
  943. List name_list = ytiotXjInspectorsDao.query(name_sql, null, null, null, null);
  944. if(name_list.size()>0) {
  945. YtiotXjInspectors name_o = (YtiotXjInspectors)name_list.get(0);
  946. map.put("phone", name_o.getPhone());
  947. }
  948. }
  949. if(formatter.format(dwjl_o.getWcTime()).equals(hehe1)) {
  950. map.put("sbsj", "--");
  951. }else {
  952. map.put("sbsj", formatter.format(dwjl_o.getWcTime()));
  953. }
  954. }
  955. }
  956. if(o.getYCompleteTime()!=null) {
  957. if(formatter.format(o.getYCompleteTime()).equals(hehe)||formatter.format(o.getYCompleteTime()).equals(hehe00)) {
  958. map.put("y_complete_time", "");
  959. }else {
  960. map.put("y_complete_time", formatter.format(o.getYCompleteTime()));
  961. }
  962. }else {
  963. map.put("y_complete_time", "");
  964. }
  965. if(o.getShTime()!=null) {
  966. if(formatter.format(o.getShTime()).equals(hehe)||formatter.format(o.getShTime()).equals(hehe00)) {
  967. map.put("sh_time", "无");
  968. }else {
  969. map.put("sh_time", formatter.format(o.getShTime()));
  970. }
  971. }else {
  972. map.put("sh_time", "无");
  973. }
  974. if(o.getShRemarks()!=null) {
  975. map.put("sh_remarks", o.getShRemarks());
  976. }else {
  977. map.put("sh_remarks", "无");
  978. }
  979. JSONObject jSONObject = JSONObject.fromObject(map);
  980. jSONArray.add(jSONObject);
  981. }
  982. json.put("RESULT", jSONArray);
  983. }
  984. }
  985. return json.toString();
  986. }
  987. // 维修责任人
  988. @Override
  989. public String getwxzrr(String queryJson) throws Exception {
  990. // TODO Auto-generated method stub
  991. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  992. String id = null;
  993. String name = null;
  994. String phone = null;
  995. String company_code = null;
  996. String V_LOGINNAME = null;
  997. String V_PASSWORD = null;
  998. String company_code_list = null;
  999. String remarks = null;
  1000. String inspect_role = null;
  1001. int xh=0;
  1002. String tdry_hqlwhere=null;
  1003. String hqlwhere = null;
  1004. String zrr_hqlwhere = null;
  1005. String order = null;
  1006. String dir = null;
  1007. String order_str = null;
  1008. JSONObject q_json = null;
  1009. JSONArray jSONArray = new JSONArray();
  1010. JSONObject json = new JSONObject();
  1011. json.put("action", "getwxzrr");
  1012. if(queryJson!=null) {
  1013. q_json = JSONObject.fromObject(queryJson);
  1014. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  1015. order = q_json.has("order")?q_json.getString("order"):null;
  1016. dir = q_json.has("dir")?q_json.getString("dir"):null;
  1017. json.put("query", queryJson);
  1018. }
  1019. // System.out.println("测试"+id);
  1020. // System.out.println();
  1021. hqlwhere = chkhw(hqlwhere) + "zn in ('4','5','6','7')";
  1022. if(V_LOGINNAME!=null)
  1023. hqlwhere = chkhw(hqlwhere) + "data2='"+V_LOGINNAME+"'";
  1024. //
  1025. // if(order!=null)
  1026. // order_str = " order by u."+fieldname(order);
  1027. // else
  1028. // order_str = " order by u."+fieldname("id");
  1029. List list = ytiotXjInspectorsDao.query(hqlwhere, order_str, null, null, null);
  1030. if(list.size()>0) {
  1031. for(int i=0;i<list.size();i++) {
  1032. YtiotXjInspectors o = (YtiotXjInspectors)list.get(i);
  1033. Map map = new HashMap();
  1034. map.put("zrrid", o.getId());
  1035. map.put("name", o.getName());
  1036. // xh=i+1;
  1037. // map.put("xh", xh);
  1038. // System.out.println("测试四"+o.getName());
  1039. JSONObject jSONObject = JSONObject.fromObject(map);
  1040. jSONArray.add(jSONObject);
  1041. }
  1042. json.put("RESULT", jSONArray);
  1043. }
  1044. return json.toString();
  1045. }
  1046. @Override
  1047. public String getEventProcessingExcelList(String queryJson) throws Exception {
  1048. // TODO Auto-generated method stub
  1049. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1050. SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
  1051. String id = null;
  1052. String dwjl_id = null;
  1053. String sj_type = null;
  1054. String y_complete_time = null;
  1055. String V_LOGINNAME = null;
  1056. String V_PASSWORD = null;
  1057. String person_liable = null;
  1058. String zp_remarks = null;
  1059. String user_name = null;
  1060. String data1 = null;
  1061. String data2 = null;
  1062. String data3 = null;
  1063. String cl_type = null;
  1064. String cl_time = null;
  1065. String wx_name = null;
  1066. String cl_time_k1 = null;
  1067. String cl_time_j1 = null;
  1068. String hehe = "1970-01-01 08:00:00";
  1069. int xh = 0;
  1070. String dwsb_remarks = null;
  1071. String cl_time_k = null;
  1072. String cl_time_j = null;
  1073. String event_processing_id_list = null;
  1074. String event_processing_id_list1 = null;
  1075. String dwjl_id_list = null;
  1076. String hehe00= "0000-00-00 00:00:00";
  1077. String dqsj = formatter.format(new Date());
  1078. String cl_sql=null;
  1079. String cl_sql1=null;
  1080. String dwjl_sql = null;
  1081. String dwjl_sql1 = null;
  1082. String hqlwhere = null;
  1083. String clsj_sql = null;
  1084. String zrr_sql = null;
  1085. String zsl_hqlwhere = null;
  1086. String jrrw_hqlwhere = null;
  1087. String csrw_hqlwhere = null;
  1088. String jrjj_hqlwhere = null;
  1089. String dz_sql = null;
  1090. String Page = null;
  1091. String Start = null;
  1092. JSONArray Sort = null;
  1093. String Limit = null;
  1094. String order = null;
  1095. String dir = null;
  1096. String order_str = null;
  1097. JSONObject q_json = null;
  1098. JSONArray jSONArray = new JSONArray();
  1099. JSONObject json = new JSONObject();
  1100. json.put("action", "getEventProcessingList");
  1101. if(queryJson!=null) {
  1102. q_json = JSONObject.fromObject(queryJson);
  1103. id = q_json.has("id")?q_json.getString("id"):null;
  1104. sj_type = q_json.has("sj_type")?q_json.getString("sj_type"):null;
  1105. cl_type = q_json.has("cl_type")?q_json.getString("cl_type"):null;
  1106. cl_time_k = q_json.has("cl_time_k")?q_json.getString("cl_time_k"):null;
  1107. cl_time_j = q_json.has("cl_time_j")?q_json.getString("cl_time_j"):null;
  1108. person_liable = q_json.has("person_liable")?q_json.getString("person_liable"):null;
  1109. wx_name = q_json.has("wx_name")?q_json.getString("wx_name"):null;
  1110. V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
  1111. V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
  1112. order = q_json.has("order")?q_json.getString("order"):null;
  1113. dir = q_json.has("dir")?q_json.getString("dir"):null;
  1114. json.put("query", queryJson);
  1115. }
  1116. // System.out.println();
  1117. hqlwhere = chkhw(hqlwhere) + "u.userName='"+V_LOGINNAME+"'";
  1118. if(sj_type!=null && sj_type.length()>0&&Integer.parseInt(sj_type)!=0)
  1119. hqlwhere = chkhw(hqlwhere) + "u.sjType = "+sj_type;
  1120. if(person_liable!=null && person_liable.length()>0&&Integer.parseInt(person_liable)!=0)
  1121. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("person_liable")+" = "+person_liable;
  1122. if(cl_type!=null && cl_type.length()>0&&Integer.parseInt(cl_type)!=0)
  1123. hqlwhere = chkhw(hqlwhere) + "u."+fieldname("cl_type")+"="+cl_type;
  1124. if(cl_time_k!=null && cl_time_k.length()>0) {
  1125. cl_time_k1=cl_time_k+" 00:01:00";
  1126. hqlwhere = chkhw(hqlwhere) + "u.clTime >='"+cl_time_k1+"'";
  1127. }
  1128. if(cl_time_j!=null && cl_time_j.length()>0) {
  1129. cl_time_j1 = cl_time_j+" 23:59:00";
  1130. hqlwhere = chkhw(hqlwhere) + "u.clTime <='"+cl_time_j1+"'";
  1131. }
  1132. if(wx_name!=null && wx_name.length()>0)
  1133. hqlwhere = chkhw(hqlwhere) + "u.wxName like '%"+wx_name+"%'";
  1134. // System.out.println(hqlwhere);
  1135. // if(order!=null)
  1136. // order_str = " order by u."+fieldname(order);
  1137. // else
  1138. // order_str = " order by u."+fieldname("id");
  1139. int totalCount = ytiotXjEventProcessingDao.getCount(hqlwhere);
  1140. json.put("totalCount", totalCount);
  1141. if(totalCount>0) {
  1142. List list = ytiotXjEventProcessingDao.query(hqlwhere, null, null, null, null);
  1143. if(list.size()>0) {
  1144. for(int i=0;i<list.size();i++) {
  1145. YtiotXjEventProcessing o = (YtiotXjEventProcessing)list.get(i);
  1146. Map map = new HashMap();
  1147. xh=i+1;
  1148. map.put("xh", xh);
  1149. // map.put("id", o.getId());
  1150. map.put("wx_name", o.getWxName());
  1151. if(String.valueOf(o.getDwjlId())!=null) {
  1152. dwjl_sql1 = " where u.id="+o.getDwjlId();
  1153. List dwjl_list1 = ytiotXjSpotOperationRecordDao.query(dwjl_sql1, null, null, null, null);
  1154. if(dwjl_list1.size()>0) {
  1155. YtiotXjSpotOperationRecord dwjl_o1 = (YtiotXjSpotOperationRecord)dwjl_list1.get(0);
  1156. // map.put("dwsb_remarks", dwjl_o1.getDwsbRemarks());
  1157. if(String.valueOf(dwjl_o1.getSpotId())!=null) {
  1158. dz_sql=" where u.id="+dwjl_o1.getSpotId();
  1159. List dz_list = ytiotXjInspectionPointsDao.query(dz_sql, null, null, null, null);
  1160. if( dz_list.size()>0) {
  1161. YtiotXjInspectionPoints dz_o = (YtiotXjInspectionPoints)dz_list.get(0);
  1162. map.put("spot_address", dz_o.getSpotAddress());
  1163. }
  1164. }
  1165. }
  1166. }
  1167. if(o.getSjType()==1) {
  1168. map.put("sj_type_name", "故障");
  1169. }else if(o.getSjType()==2) {
  1170. map.put("sj_type_name", "隐患");
  1171. }else if(o.getSjType()==3) {
  1172. map.put("sj_type_name", "其他");
  1173. }else{
  1174. map.put("sj_type_name", "--");
  1175. }
  1176. if(o.getYCompleteTime()!=null) {
  1177. if(formatter.format(o.getYCompleteTime()).equals(hehe)||formatter.format(o.getYCompleteTime()).equals(hehe00)) {
  1178. map.put("y_complete_time", "--");
  1179. }else {
  1180. map.put("y_complete_time", formatter.format(o.getYCompleteTime()));
  1181. }
  1182. }else {
  1183. map.put("y_complete_time", "--");
  1184. }
  1185. // if(formatter.format(o.getYCompleteTime()).equals(hehe)) {
  1186. // map.put("y_complete_time", "--");
  1187. // }else {
  1188. // map.put("y_complete_time", formatter.format(o.getYCompleteTime()));
  1189. // }
  1190. // if(formatter.format(o.getYCompleteTime()).equals(hehe)) {
  1191. // map.put("cl_time", "--");
  1192. // }else {
  1193. // map.put("cl_time", formatter.format(o.getClTime()));
  1194. // }
  1195. // map.put("cl_time", formatter.format(o.getClTime()));
  1196. if(o.getClType()==2) {
  1197. map.put("clzt", "未审核");
  1198. map.put("cl_time", "--");
  1199. }else if(o.getClType()==3) {
  1200. map.put("clzt", "审核未通过");
  1201. map.put("cl_time", "--");
  1202. }else if(o.getClType()==4) {
  1203. map.put("cl_time", formatter.format(o.getClTime()));
  1204. map.put("clzt", "已完成");
  1205. }else if(o.getClType()==5) {
  1206. map.put("cl_time", formatter.format(o.getClTime()));
  1207. map.put("clzt", "超时完成 ");
  1208. }else if(o.getClType()==1) {
  1209. map.put("clzt", "未处理");
  1210. map.put("cl_time", "--");
  1211. }else if(o.getClType()==0) {
  1212. map.put("clzt", "未处理");
  1213. map.put("cl_time", "--");
  1214. }
  1215. if(o.getPersonLiable()!=null) {
  1216. map.put("dqzt", "已指派");
  1217. zrr_sql = " where u.id="+o.getPersonLiable();
  1218. List zrr_list = ytiotXjInspectorsDao.query(zrr_sql, null, null, null, null);
  1219. if(zrr_list .size()>0) {
  1220. YtiotXjInspectors zrr_o = (YtiotXjInspectors)zrr_list.get(0);
  1221. map.put("person_liable_name", zrr_o.getName());
  1222. map.put("phone", zrr_o.getPhone());
  1223. }
  1224. }else {
  1225. map.put("dqzt", "未指派");
  1226. map.put("person_liable_name", "--");
  1227. map.put("phone", "--");
  1228. }
  1229. JSONObject jSONObject = JSONObject.fromObject(map);
  1230. jSONArray.add(jSONObject);
  1231. }
  1232. json.put("result", jSONArray);
  1233. }
  1234. }
  1235. return json.toString();
  1236. }
  1237. }