YHBAction.java 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221
  1. package com.ccgj.platform.admin;
  2. import com.base.common.enums.Enums;
  3. import com.base.common.spring.TransactionManager;
  4. import com.ccgj.database.beans.LMB;
  5. import com.ccgj.database.beans.YHB;
  6. import com.ccgj.database.beans.ZQB;
  7. import com.ccgj.database.business.YHBService;
  8. import com.ccgj.database.business.ZQBService;
  9. import com.ccgj.database.factory.DatabaseFactory;
  10. import com.ccgj.database.interfaces.YHBIF;
  11. import com.ccgj.database.interfaces.ZQBIF;
  12. import com.ccgj.database.manager.LMBManager;
  13. import com.ccgj.database.manager.YHBManager;
  14. import com.ccgj.database.manager.ZQBManager;
  15. import com.ccgj.database.tool.MD5;
  16. import com.ccgj.database.tool.Website;
  17. import com.ccgj.database.tool.writeFile;
  18. import com.ccgj.platform.common.CommonAction;
  19. import com.ccgj.platform.util.*;
  20. import com.opensymphony.xwork2.ActionContext;
  21. import java.util.ArrayList;
  22. import java.util.Date;
  23. import java.util.List;
  24. import java.util.Map;
  25. import java.util.StringTokenizer;
  26. import javax.servlet.http.HttpServletRequest;
  27. public class YHBAction
  28. extends CommonAction
  29. {
  30. private Long id;
  31. private String yhmc;
  32. private String yhzh;
  33. private String yhmm;
  34. private String passd;
  35. private int yhzt;
  36. private int yhsx;
  37. private String sjid;
  38. private String zdmc;
  39. private String zdbs;
  40. private int zdpx;
  41. private String zdmb;
  42. private String yhqx;
  43. private String yhsm;
  44. private String tjsj;
  45. private String tjyh;
  46. private String bgsj;
  47. private int dlcs;
  48. private String by1;
  49. private String by2;
  50. private String by3;
  51. private String oldPass;
  52. private String newPwd;
  53. private String newPwds;
  54. private Object[] datas;
  55. private String data;
  56. private String type;
  57. private YHB yhb;
  58. private List<LMB> lmbList;
  59. private String zqbId;
  60. private String searchZhmc;
  61. private List<ZQB> zqbList;
  62. public Long getId()
  63. {
  64. return this.id;
  65. }
  66. public void setId(Long id)
  67. {
  68. this.id = id;
  69. }
  70. public String getYhmc()
  71. {
  72. return this.yhmc;
  73. }
  74. public void setYhmc(String yhmc)
  75. {
  76. this.yhmc = yhmc;
  77. }
  78. public String getYhzh()
  79. {
  80. return this.yhzh;
  81. }
  82. public void setYhzh(String yhzh)
  83. {
  84. this.yhzh = yhzh;
  85. }
  86. public String getYhmm()
  87. {
  88. return this.yhmm;
  89. }
  90. public void setYhmm(String yhmm)
  91. {
  92. this.yhmm = yhmm;
  93. }
  94. public String getPassd()
  95. {
  96. return this.passd;
  97. }
  98. public void setPassd(String passd)
  99. {
  100. this.passd = passd;
  101. }
  102. public int getYhzt()
  103. {
  104. return this.yhzt;
  105. }
  106. public void setYhzt(int yhzt)
  107. {
  108. this.yhzt = yhzt;
  109. }
  110. public int getYhsx()
  111. {
  112. return this.yhsx;
  113. }
  114. public void setYhsx(int yhsx)
  115. {
  116. this.yhsx = yhsx;
  117. }
  118. public String getSjid()
  119. {
  120. return this.sjid;
  121. }
  122. public void setSjid(String sjid)
  123. {
  124. this.sjid = sjid;
  125. }
  126. public String getZdmc()
  127. {
  128. return this.zdmc;
  129. }
  130. public void setZdmc(String zdmc)
  131. {
  132. this.zdmc = zdmc;
  133. }
  134. public String getZdbs()
  135. {
  136. return this.zdbs;
  137. }
  138. public void setZdbs(String zdbs)
  139. {
  140. this.zdbs = zdbs;
  141. }
  142. public int getZdpx()
  143. {
  144. return this.zdpx;
  145. }
  146. public void setZdpx(int zdpx)
  147. {
  148. this.zdpx = zdpx;
  149. }
  150. public String getZdmb()
  151. {
  152. return this.zdmb;
  153. }
  154. public void setZdmb(String zdmb)
  155. {
  156. this.zdmb = zdmb;
  157. }
  158. public String getYhqx()
  159. {
  160. return this.yhqx;
  161. }
  162. public void setYhqx(String yhqx)
  163. {
  164. this.yhqx = yhqx;
  165. }
  166. public String getYhsm()
  167. {
  168. return this.yhsm;
  169. }
  170. public void setYhsm(String yhsm)
  171. {
  172. this.yhsm = yhsm;
  173. }
  174. public String getTjsj()
  175. {
  176. return this.tjsj;
  177. }
  178. public void setTjsj(String tjsj)
  179. {
  180. this.tjsj = tjsj;
  181. }
  182. public String getTjyh()
  183. {
  184. return this.tjyh;
  185. }
  186. public void setTjyh(String tjyh)
  187. {
  188. this.tjyh = tjyh;
  189. }
  190. public String getBgsj()
  191. {
  192. return this.bgsj;
  193. }
  194. public void setBgsj(String bgsj)
  195. {
  196. this.bgsj = bgsj;
  197. }
  198. public int getDlcs()
  199. {
  200. return this.dlcs;
  201. }
  202. public void setDlcs(int dlcs)
  203. {
  204. this.dlcs = dlcs;
  205. }
  206. public String getBy1()
  207. {
  208. return this.by1;
  209. }
  210. public void setBy1(String by1)
  211. {
  212. this.by1 = by1;
  213. }
  214. public String getBy2()
  215. {
  216. return this.by2;
  217. }
  218. public void setBy2(String by2)
  219. {
  220. this.by2 = by2;
  221. }
  222. public String getBy3()
  223. {
  224. return this.by3;
  225. }
  226. public void setBy3(String by3)
  227. {
  228. this.by3 = by3;
  229. }
  230. public YHB getYhb()
  231. {
  232. return this.yhb;
  233. }
  234. public void setYhb(YHB yhb)
  235. {
  236. this.yhb = yhb;
  237. }
  238. public String getOldPass()
  239. {
  240. return this.oldPass;
  241. }
  242. public void setOldPass(String oldPass)
  243. {
  244. this.oldPass = oldPass;
  245. }
  246. public String getNewPwd()
  247. {
  248. return this.newPwd;
  249. }
  250. public void setNewPwd(String newPwd)
  251. {
  252. this.newPwd = newPwd;
  253. }
  254. public String getNewPwds()
  255. {
  256. return this.newPwds;
  257. }
  258. public void setNewPwds(String newPwds)
  259. {
  260. this.newPwds = newPwds;
  261. }
  262. public Object[] getDatas()
  263. {
  264. return this.datas;
  265. }
  266. public void setDatas(Object[] datas)
  267. {
  268. this.datas = datas;
  269. }
  270. public String getData()
  271. {
  272. return this.data;
  273. }
  274. public void setData(String data)
  275. {
  276. this.data = data;
  277. }
  278. public String getSearchZhmc()
  279. {
  280. return this.searchZhmc;
  281. }
  282. public void setSearchZhmc(String searchZhmc)
  283. {
  284. this.searchZhmc = searchZhmc;
  285. }
  286. public String getType()
  287. {
  288. return this.type;
  289. }
  290. public void setType(String type)
  291. {
  292. this.type = type;
  293. }
  294. public List<LMB> getLmbList()
  295. {
  296. return this.lmbList;
  297. }
  298. public void setLmbList(List<LMB> lmbList)
  299. {
  300. this.lmbList = lmbList;
  301. }
  302. public List<ZQB> getZqbList()
  303. {
  304. return this.zqbList;
  305. }
  306. public void setZqbList(List<ZQB> zqbList)
  307. {
  308. this.zqbList = zqbList;
  309. }
  310. public String getZqbId()
  311. {
  312. return this.zqbId;
  313. }
  314. public void setZqbId(String zqbId)
  315. {
  316. this.zqbId = zqbId;
  317. }
  318. public String init()
  319. {
  320. try
  321. {
  322. if ((this.yhsx > 0) && (this.yhsx == 1)) {
  323. yhbById();
  324. } else if ((this.yhsx > 0) && (this.yhsx == 2)) {
  325. yhbById();
  326. } else if ((this.yhsx > 0) && (this.yhsx == 3)) {
  327. yhbById();
  328. }
  329. }
  330. catch (Exception e)
  331. {
  332. logger.debug(e);
  333. e.printStackTrace();
  334. }
  335. return "init";
  336. }
  337. public String yhbById()
  338. {
  339. try
  340. {
  341. if (this.id != null)
  342. {
  343. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  344. YHB yhb = yhbIF.getYHBService().searchYHBByID(this.id);
  345. setYhb(yhb);
  346. }
  347. }
  348. catch (Exception e)
  349. {
  350. e.printStackTrace();
  351. }
  352. return "data";
  353. }
  354. public String edit()
  355. {
  356. try
  357. {
  358. Date date = new Date();
  359. if (this.id != null)
  360. {
  361. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  362. YHB yhbBean = yhbIF.getYHBService().searchYHBByID(this.id);
  363. if (yhbBean != null) {
  364. if ((this.newPwd != null) && (this.newPwds != null) && (this.newPwd.equals(this.newPwds)))
  365. {
  366. if ((this.oldPass != null) && (this.oldPass.length() > 0)) {
  367. String decodePwd = StringCode.decrypt(yhbBean.getYhmm());
  368. if (decodePwd.equals(this.oldPass))
  369. {
  370. /**确认旧密码正确后,判断新密码强度**/
  371. if(CheckStrength.checkPasswordStrength(newPwd)< 6){
  372. setJsondata(JsonResult.ajax(Boolean.valueOf(true), "4"));
  373. return "data";
  374. }
  375. yhbBean.setYhmm(StringCode.encrypt(this.newPwd));
  376. yhbBean.setTjsj(DateFormat.shortDate(date));
  377. yhbIF.getYHBService().updateYHB(yhbBean);
  378. setJsondata(JsonResult.ajax(Boolean.valueOf(true), "3"));
  379. }
  380. else
  381. {
  382. setJsondata(JsonResult.ajax(Boolean.valueOf(true), "2"));
  383. return "data";
  384. }
  385. }
  386. }
  387. else
  388. {
  389. setJsondata(JsonResult.ajax(Boolean.valueOf(true), "1"));
  390. return "data";
  391. }
  392. }
  393. }
  394. }
  395. catch (Exception e)
  396. {
  397. e.printStackTrace();
  398. }
  399. return "data";
  400. }
  401. public String adminList()
  402. {
  403. try
  404. {
  405. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  406. YHB yhbBean = yhbIF.createYHB();
  407. yhbBean.setYhsx(2);
  408. yhbBean.setYhzt(4);
  409. if ((this.searchZhmc != null) && (this.searchZhmc.length() > 0)) {
  410. yhbBean.setYhzh(this.searchZhmc);
  411. }
  412. List lists = new ArrayList();
  413. List listCount = yhbIF.getYHBService().getYhbManager().searchListYhbByBean(yhbBean);
  414. List<YHB> listData = yhbIF.getYHBService().getYhbManager().searchListYhbByBean(yhbBean);
  415. for (int i = 0; i < listData.size(); i++)
  416. {
  417. YHB yhb = (YHB)listData.get(i);
  418. lists.add(yhb);
  419. }
  420. setJsondata(JsonResult.listByLigerUI(lists, Integer.valueOf(listCount.isEmpty() ? 0 : listCount.size())).toString());
  421. }
  422. catch (Exception e)
  423. {
  424. e.printStackTrace();
  425. setJsondata(JsonResult.submit(Boolean.valueOf(false), Enums.getInstance().getDescByName("CommonMessage", "SYSTEM_ERROR")));
  426. }
  427. return "list";
  428. }
  429. public String manageAdminList()
  430. {
  431. YHB yhbBeans = (YHB)ActionContext.getContext().getSession().get("zfmb_user");
  432. try
  433. {
  434. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  435. YHB yhbBean = yhbIF.createYHB();
  436. yhbBean.setYhsx(3);
  437. yhbBean.setYhzt(4);
  438. yhbBean.setZdbsid(yhbBeans.getZdbsid());
  439. if ((this.searchZhmc != null) && (this.searchZhmc.length() > 0)) {
  440. yhbBean.setYhzh(this.searchZhmc);
  441. }
  442. List lists = new ArrayList();
  443. List listCount = yhbIF.getYHBService().getYhbManager().searchListYhbByBean(yhbBean);
  444. List<YHB> listData = yhbIF.getYHBService().getYhbManager().searchListYhbByBean(yhbBean);
  445. for (int i = 0; i < listData.size(); i++)
  446. {
  447. YHB yhb = (YHB)listData.get(i);
  448. lists.add(yhb);
  449. }
  450. setJsondata(JsonResult.listByLigerUI(lists, Integer.valueOf(listCount.isEmpty() ? 0 : listCount.size())).toString());
  451. }
  452. catch (Exception e)
  453. {
  454. e.printStackTrace();
  455. setJsondata(JsonResult.submit(Boolean.valueOf(false), Enums.getInstance().getDescByName("CommonMessage", "SYSTEM_ERROR")));
  456. }
  457. return "list";
  458. }
  459. public String adminDel()
  460. {
  461. String returnType = null;
  462. try
  463. {
  464. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  465. if ((this.data != null) && (this.data.length() > 0))
  466. {
  467. YHB bean = yhbIF.searchYHBByID(Long.valueOf(Long.parseLong(this.data)));
  468. // 假删除改为真删除
  469. // bean.setYhzt(4);
  470. // yhbIF.getYHBService().updateYHB(bean);
  471. yhbIF.getYHBService().deleteYHB(bean);
  472. }
  473. else
  474. {
  475. StringTokenizer st = new StringTokenizer(SystemUtil.getStringByObject(this.datas), ",");
  476. while (st.hasMoreTokens())
  477. {
  478. yhbIF.getYHBService().getTransactionManager().begin();
  479. String id = st.nextToken();
  480. YHB bean = yhbIF.searchYHBByID(Long.valueOf(Long.parseLong(id)));
  481. // 假删除改为真删除
  482. // bean.setYhzt(4);
  483. // yhbIF.getYHBService().updateYHB(bean);
  484. yhbIF.getYHBService().deleteYHB(bean);
  485. yhbIF.getYHBService().getTransactionManager().commit();
  486. }
  487. }
  488. }
  489. catch (Exception e)
  490. {
  491. logger.debug(e);
  492. e.printStackTrace();
  493. setJsondata(JsonResult.submit(Boolean.valueOf(false), Enums.getInstance().getDescByName("CommonMessage", "SYSTEM_ERROR")));
  494. }
  495. if ((this.type != null) && (this.type.length() > 0))
  496. {
  497. if (this.type.equals("wzgl")) {
  498. returnType = manageAdminList();
  499. }
  500. }
  501. else {
  502. returnType = adminList();
  503. }
  504. return returnType;
  505. }
  506. public String saveXTGLY()
  507. {
  508. YHB yhbBeans = (YHB)ActionContext.getContext().getSession().get("zfmb_user");
  509. String returnType = null;
  510. try
  511. {
  512. Date data = new Date();
  513. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  514. ZQBIF zqbIF = DatabaseFactory.getZQBIF();
  515. yhbIF.getYHBService().getTransactionManager().begin();
  516. YHB bean = yhbIF.createYHB();
  517. bean.setYhmc(this.yhmc);
  518. bean.setYhzh(this.yhzh);
  519. bean.setYhzt(this.yhzt);
  520. bean.setYhmm(StringCode.encrypt("123456"));
  521. if ((this.type != null) && (this.type.length() > 0))
  522. {
  523. if (this.type.equals("wzgl")) {
  524. bean.setYhsx(3);
  525. }
  526. bean.setZdbsid(yhbBeans.getZdbsid());
  527. bean.setZdbs(yhbBeans.getZdbs());
  528. }
  529. else
  530. {
  531. ZQB zqbBean = zqbIF.createZQB();
  532. zqbBean.setId(Long.valueOf(Long.parseLong(this.zqbId)));
  533. List<ZQB> zqbList = zqbIF.getZQBService().getZqbManager().searchListZqbByBean(zqbBean);
  534. bean.setYhsx(2);
  535. bean.setZdbsid(((ZQB)zqbList.get(0)).getId().toString());
  536. bean.setZdbs(((ZQB)zqbList.get(0)).getZqbs());
  537. }
  538. bean.setSjid("1");
  539. bean.setYhsm(this.yhsm);
  540. bean.setTjsj(DateFormat.shortDate(data));
  541. yhbIF.getYHBService().saveYHB(bean);
  542. yhbIF.getYHBService().getTransactionManager().commit();
  543. }
  544. catch (Exception e)
  545. {
  546. e.printStackTrace();
  547. }
  548. if ((this.type != null) && (this.type.length() > 0))
  549. {
  550. if (this.type.equals("wzgl")) {
  551. returnType = manageAdminList();
  552. }
  553. }
  554. else {
  555. returnType = adminList();
  556. }
  557. return returnType;
  558. }
  559. public String getXtglyById()
  560. {
  561. String returnType = null;
  562. try
  563. {
  564. if (this.id != null)
  565. {
  566. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  567. ZQBIF zqbIF = DatabaseFactory.getZQBIF();
  568. List<ZQB> listDatas = new ArrayList();
  569. YHB searchbean = yhbIF.getYHBService().searchYHBByID(this.id);
  570. if (searchbean != null)
  571. {
  572. String mm = searchbean.getYhmm();
  573. String pwd = StringCode.decrypt(mm);
  574. searchbean.setYhmm(pwd);
  575. setYhb(searchbean);
  576. getRequest().setAttribute("yhb", searchbean);
  577. ZQB zqbBean = zqbIF.createZQB();
  578. zqbBean.setFlag("1");
  579. List<ZQB> listData = zqbIF.getZQBService().getZqbManager().searchListZqbByBean(zqbBean);
  580. for (ZQB list : listData) {
  581. listDatas.add(list);
  582. }
  583. setZqbList(listData);
  584. getRequest().setAttribute("zdbsid", searchbean.getZdbsid());
  585. }
  586. }
  587. }
  588. catch (Exception e)
  589. {
  590. e.printStackTrace();
  591. }
  592. if ((this.type != null) && (this.type.length() > 0))
  593. {
  594. if (this.type.equals("wzgl")) {
  595. returnType = "manageAdminEdit";
  596. } else {
  597. returnType = "yhbManageCompetenceEdit";
  598. }
  599. }
  600. else {
  601. returnType = "yhbManageEdit";
  602. }
  603. return returnType;
  604. }
  605. public String editXTGLY()
  606. {
  607. Date data = new Date();
  608. YHB yhbBeans = (YHB)ActionContext.getContext().getSession().get("zfmb_user");
  609. String returnType = null;
  610. try
  611. {
  612. if (this.id != null)
  613. {
  614. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  615. ZQBIF tZqbIF = DatabaseFactory.getZQBIF();
  616. YHB searchbean = yhbIF.getYHBService().searchYHBByID(this.id);
  617. if (searchbean != null)
  618. {
  619. searchbean.setYhmc(this.yhmc);
  620. searchbean.setYhzh(this.yhzh);
  621. searchbean.setYhmm(StringCode.encrypt(this.yhmm));
  622. searchbean.setYhzt(this.yhzt);
  623. searchbean.setYhsm(this.yhsm);
  624. searchbean.setTjsj(DateFormat.shortDate(data));
  625. if (this.zqbId != null)
  626. {
  627. ZQB bean = tZqbIF.createZQB();
  628. bean.setId(Long.valueOf(Long.parseLong(this.zqbId)));
  629. List<ZQB> zqbList = tZqbIF.getZQBService().getZqbManager().searchListZqbByBean(bean);
  630. searchbean.setZdbsid(((ZQB)zqbList.get(0)).getId().toString());
  631. searchbean.setZdbs(((ZQB)zqbList.get(0)).getZqbs());
  632. }
  633. else
  634. {
  635. searchbean.setZdbsid(yhbBeans.getZdbsid());
  636. searchbean.setZdbs(yhbBeans.getZdbs());
  637. }
  638. yhbIF.getYHBService().updateYHB(searchbean);
  639. }
  640. }
  641. }
  642. catch (Exception e)
  643. {
  644. e.printStackTrace();
  645. }
  646. if ((this.type != null) && (this.type.length() > 0))
  647. {
  648. if (this.type.equals("wzgl")) {
  649. returnType = manageAdminList();
  650. }
  651. }
  652. else {
  653. returnType = adminList();
  654. }
  655. return returnType;
  656. }
  657. public String editYHBbyCompetence()
  658. {
  659. String returnType = null;
  660. try
  661. {
  662. YHBIF yhbIF = DatabaseFactory.getYHBIF();
  663. YHB searchbean = yhbIF.getYHBService().searchYHBByID(this.id);
  664. String[] right = getRequest().getParameterValues("right");
  665. String rights = ",";
  666. if (right != null) {
  667. for (int i = 0; i < right.length; i++) {
  668. rights = rights + right[i] + ",";
  669. }
  670. }
  671. if (searchbean != null)
  672. {
  673. searchbean.setYhzt(this.yhzt);
  674. searchbean.setYhqx(rights);
  675. yhbIF.getYHBService().updateYHB(searchbean);
  676. }
  677. }
  678. catch (Exception e)
  679. {
  680. e.printStackTrace();
  681. }
  682. if ((this.type != null) && (this.type.length() > 0))
  683. {
  684. if (this.type.equals("wzgl")) {
  685. returnType = manageAdminList();
  686. }
  687. }
  688. else {
  689. returnType = adminList();
  690. }
  691. return returnType;
  692. }
  693. public String zqbList()
  694. {
  695. try
  696. {
  697. List<ZQB> listDatas = new ArrayList();
  698. ZQBIF tZqbIF = DatabaseFactory.getZQBIF();
  699. ZQB searchbean = tZqbIF.createZQB();
  700. searchbean.setFlag("1");
  701. List<ZQB> listData = tZqbIF.getZQBService().getZqbManager().searchListZqbByBean(searchbean);
  702. for (ZQB list : listData) {
  703. listDatas.add(list);
  704. }
  705. setZqbList(listDatas);
  706. }
  707. catch (Exception e)
  708. {
  709. logger.debug(e);
  710. e.printStackTrace();
  711. setJsondata(JsonResult.submit(Boolean.valueOf(false), Enums.getInstance().getDescByName("CommonMessage", "SYSTEM_ERROR")));
  712. }
  713. return "zqbList";
  714. }
  715. private YHBManager yhbdao = new YHBManager();
  716. private LMBManager lmdao = new LMBManager();
  717. private YHB dqyhb = null;
  718. private static writeFile log = new writeFile();
  719. public List getLmbOFyhQx(YHB yhb, String lmid)
  720. {
  721. if ((lmid == null) || ("".equals(lmid)) || ("0".equals(lmid))) {
  722. return null;
  723. }
  724. List<LMB> qxlist = null;
  725. List<LMB> slmblist = this.lmdao.getSecondLMB(yhb.getZdbs(), lmid);
  726. if (slmblist != null)
  727. {
  728. qxlist = new ArrayList();
  729. for (LMB slmb : slmblist) {
  730. if ("1".equals(slmb.getLmlx()))
  731. {
  732. List<LMB> sqxlist = getLmbOFyhQx(yhb, slmb.getId().toString());
  733. if ((sqxlist != null) || (sqxlist.size() > 0)) {
  734. for (LMB sslmb : sqxlist) {
  735. qxlist.add(sslmb);
  736. }
  737. }
  738. }
  739. else if (checkYhbOfyhqx(yhb, slmb.getId().toString()) > 0)
  740. {
  741. qxlist.add(slmb);
  742. }
  743. }
  744. }
  745. return qxlist;
  746. }
  747. public YHB getZdOfZdbs(String zdbs)
  748. {
  749. YHB yhb = getManagerByZdbs(zdbs);
  750. if (yhb != null)
  751. {
  752. yhb.setId(Long.valueOf(0L));
  753. yhb.setYhmc("");
  754. yhb.setYhmm("");
  755. yhb.setSjid("");
  756. yhb.setYhqx("");
  757. yhb.setYhsm("");
  758. yhb.setTjyh("");
  759. }
  760. else
  761. {
  762. yhb = new YHB();
  763. }
  764. return yhb;
  765. }
  766. public YHB getManagerByZdbs(String zdbs)
  767. {
  768. return this.yhbdao.getMangerByzdbs(zdbs);
  769. }
  770. public int setYhbOfYhzt(String yhid, int yhzt)
  771. {
  772. int recode = 1;
  773. try
  774. {
  775. recode = this.yhbdao.modifyYhbOfYhzt(yhid, yhzt);
  776. }
  777. catch (Exception e)
  778. {
  779. writeFile.println(3, e);
  780. recode = 0;
  781. }
  782. return recode;
  783. }
  784. public int setYhbOfYhqx(String yhid, String yhqx)
  785. {
  786. int recode = 1;
  787. try
  788. {
  789. recode = this.yhbdao.setYhbOfYhqx(yhid, yhqx);
  790. }
  791. catch (Exception e)
  792. {
  793. writeFile.println(3, e);
  794. recode = 0;
  795. }
  796. return recode;
  797. }
  798. public int checkYhbOfyhqx(YHB yhb, String lmid)
  799. {
  800. int recode = 1;
  801. try
  802. {
  803. if (yhb.getYhqx().indexOf("news" + lmid + "_") > 0) {
  804. return recode;
  805. }
  806. }
  807. catch (Exception e)
  808. {
  809. writeFile.println(3, e);
  810. recode = -1;
  811. }
  812. return 0;
  813. }
  814. public int checkYhbOfyhqx(YHB yhb, String lmid, int qxlx)
  815. {
  816. int recode = 1;
  817. try
  818. {
  819. switch (qxlx)
  820. {
  821. case 1:
  822. if (yhb.getYhqx().indexOf("news" + lmid + "_view,") > 0) {
  823. return 1;
  824. }
  825. case 2:
  826. if (yhb.getYhqx().indexOf("news" + lmid + "_check,") > 0) {
  827. return 2;
  828. }
  829. case 3:
  830. if (yhb.getYhqx().indexOf("news" + lmid + "_add,") > 0) {
  831. return 3;
  832. }
  833. case 4:
  834. if (yhb.getYhqx().indexOf("news" + lmid + "_edit,") > 0) {
  835. return 4;
  836. }
  837. case 5:
  838. if (yhb.getYhqx().indexOf("news" + lmid + "_del,") > 0) {
  839. return 5;
  840. }
  841. case 6:
  842. if (yhb.getYhqx().indexOf("news" + lmid + "_comm,") > 0) {
  843. return 6;
  844. }
  845. break;
  846. }
  847. return 0;
  848. }
  849. catch (Exception e)
  850. {
  851. writeFile.println(3, e);
  852. recode = 0;
  853. }
  854. return recode;
  855. }
  856. public int DropYhb(String yhid)
  857. {
  858. int recode = 1;
  859. YHB yhb = this.yhbdao.getYhbByYhid(yhid);
  860. if (yhb.getYhsx() == 3)
  861. {
  862. recode = this.yhbdao.removeyhb(yhid);
  863. if (recode < 0) {
  864. return -14;
  865. }
  866. }
  867. return recode;
  868. }
  869. public int ModifyYhbOfUser(String zdbs, YHB yhb)
  870. {
  871. try
  872. {
  873. int recode = 0;
  874. recode = checkYhzhUnique(yhb.getId().toString(), yhb.getYhzh());
  875. if (recode < 1) {
  876. return recode;
  877. }
  878. yhb.setZdbs(zdbs);
  879. yhb.setYhsx(3);
  880. recode = this.yhbdao.modifyYhbofManager(yhb);
  881. if (recode < 1) {
  882. return -13;
  883. }
  884. }
  885. catch (Exception e)
  886. {
  887. e.printStackTrace();
  888. }
  889. return 1;
  890. }
  891. public int ModifyYhbOfManager(YHB yhb)
  892. {
  893. int recode = 0;
  894. recode = checkYhzhUnique(yhb.getId().toString(), yhb.getYhzh());
  895. if (recode < 1) {
  896. return recode;
  897. }
  898. recode = checkZdbsUnique(yhb.getId().toString(), yhb.getZdbs());
  899. if (recode < 1) {
  900. return recode;
  901. }
  902. yhb.setYhsx(2);
  903. recode = this.yhbdao.modifyYhbofManager(yhb);
  904. if (recode < 1) {
  905. return -13;
  906. }
  907. return 1;
  908. }
  909. public int ModifyYhbOfYhmm(String yyhmm, String xyhmm, YHB yhb)
  910. {
  911. int recode = 0;
  912. MD5 md5 = new MD5();
  913. if (!yhb.getYhmm().equals(md5.getMD5ofStr(yyhmm))) {
  914. return -16;
  915. }
  916. yhb.setYhmm(md5.getMD5ofStr(xyhmm));
  917. recode = this.yhbdao.modifyYhbOfYhmm(yhb);
  918. if (recode < 1) {
  919. return -17;
  920. }
  921. return 1;
  922. }
  923. public int ResetYhbOfYhmm(String yhid)
  924. {
  925. try
  926. {
  927. int recode = 0;
  928. MD5 md5 = new MD5();
  929. YHB yhb = new YHB();
  930. yhb.setId(Long.valueOf(Long.parseLong(yhid)));
  931. yhb.setYhmm(md5.getMD5ofStr(Website.getDefault_passd()));
  932. recode = this.yhbdao.modifyYhbOfYhmm(yhb);
  933. if (recode < 1) {
  934. return -17;
  935. }
  936. }
  937. catch (Exception e)
  938. {
  939. e.printStackTrace();
  940. }
  941. return 1;
  942. }
  943. public int AddYhbOfUser(String zdbs, YHB yhb)
  944. {
  945. int recode = 0;
  946. recode = checkYhzhUnique(yhb.getId().toString(), yhb.getYhzh());
  947. if (recode < 1) {
  948. return recode;
  949. }
  950. yhb.setZdbs(zdbs);
  951. yhb.setYhsx(3);
  952. MD5 md5 = new MD5();
  953. yhb.setYhmm(md5.getMD5ofStr(yhb.getYhmm()));
  954. recode = this.yhbdao.addYhb(yhb);
  955. if (recode < 1) {
  956. return -13;
  957. }
  958. return 1;
  959. }
  960. public int AddYhbOfManager(YHB yhb)
  961. {
  962. int recode = 0;
  963. recode = checkYhzhUnique(yhb.getId().toString(), yhb.getYhzh());
  964. if (recode < 1) {
  965. return recode;
  966. }
  967. recode = checkZdbsUnique(yhb.getId().toString(), yhb.getZdbs());
  968. if (recode < 1) {
  969. return recode;
  970. }
  971. yhb.setYhsx(2);
  972. MD5 md5 = new MD5();
  973. yhb.setYhmm(md5.getMD5ofStr(yhb.getYhmm()));
  974. recode = this.yhbdao.addYhb(yhb);
  975. if (recode < 1) {
  976. return -13;
  977. }
  978. return 1;
  979. }
  980. public int checkYhzhUnique(String yhid, String yhzh)
  981. {
  982. YHB yhb = this.yhbdao.getYhbByYhzh(yhzh);
  983. if ((yhb != null) && (!yhb.getId().toString().equals(yhid))) {
  984. return -11;
  985. }
  986. return 1;
  987. }
  988. public int checkZdbsUnique(String yhid, String zdbs)
  989. {
  990. List<YHB> yhlist = this.yhbdao.getAllManager();
  991. for (YHB yhb : yhlist) {
  992. if ((yhb.getZdbs().equalsIgnoreCase(zdbs)) && (!yhb.getId().equals(yhid))) {
  993. return -12;
  994. }
  995. }
  996. return 1;
  997. }
  998. public YHB getWSYhbByYhid(String yhid)
  999. {
  1000. YHB yhb = this.yhbdao.getYhbByYhid(yhid);
  1001. if ((yhb != null) && (yhb.getYhsx() == 2)) {
  1002. return yhb;
  1003. }
  1004. return null;
  1005. }
  1006. public YHB getYhbByYhid(String yhid)
  1007. {
  1008. YHB yhb = this.yhbdao.getYhbByYhid(yhid);
  1009. if ((yhb != null) && (yhb.getYhsx() == 3)) {
  1010. return yhb;
  1011. }
  1012. return null;
  1013. }
  1014. public List getAllManager()
  1015. {
  1016. return this.yhbdao.getAllManager();
  1017. }
  1018. public List getAllUserByzdbs(String zdbs)
  1019. {
  1020. return this.yhbdao.getAllUserByzdbs(zdbs);
  1021. }
  1022. public int getLoginYh(String username, String userpassword)
  1023. {
  1024. int recode = 1;
  1025. if ((getString(username).length() == 0) || (getString(userpassword).length() == 0)) {
  1026. return 0;
  1027. }
  1028. YHB dlyhb = new YHB();
  1029. dlyhb = this.yhbdao.getYhbByYhzh(username);
  1030. if ((dlyhb == null) || (dlyhb.getId().toString().length() == 0)) {
  1031. return -1;
  1032. }
  1033. MD5 md5 = new MD5();
  1034. if (!dlyhb.getYhmm().equals(md5.getMD5ofStr(userpassword))) {
  1035. return -2;
  1036. }
  1037. if (dlyhb.getYhzt() > 2) {
  1038. return -3;
  1039. }
  1040. this.dqyhb = dlyhb;
  1041. return recode;
  1042. }
  1043. public YHB getCurrentYhb()
  1044. {
  1045. return this.dqyhb;
  1046. }
  1047. public String getMessage(int msgnum)
  1048. {
  1049. switch (msgnum)
  1050. {
  1051. case 0:
  1052. return "输入信息错误,请重新输入!";
  1053. case -1:
  1054. return "此帐号不存在,请重新输入!";
  1055. case -2:
  1056. return "用户名或密码错误,请重新输入!";
  1057. case -3:
  1058. return "此帐号已经被锁定!";
  1059. case -11:
  1060. return "此帐号已经存在,请重新输入!";
  1061. case -12:
  1062. return "此站点标识已经存在,请重新输入!";
  1063. case -13:
  1064. return "添加站点管理员账号失败!";
  1065. case -14:
  1066. return "删除用户失败!";
  1067. case -15:
  1068. return "删除站点失败!";
  1069. case -16:
  1070. return "原密码错误!";
  1071. case -17:
  1072. return "修改用户密码失败!";
  1073. }
  1074. return "用户名或密码错误!";
  1075. }
  1076. private String getString(String str)
  1077. {
  1078. if ((str != null) && (str.length() > 0)) {
  1079. return str.trim();
  1080. }
  1081. return "";
  1082. }
  1083. }