325b08ffbc1ce34008c121f33bdc187813e8905a.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. package com.sinosoft.am.plan.dao;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import org.apache.log4j.Logger;
  5. import com.persistence.service.PersistenceFactory;
  6. import com.persistence.service.SysPersistence;
  7. import com.persistence.service.exception.PersistenceException;
  8. import com.sinosoft.am.plan.vo.ContingencyPlanHuiZongBean;
  9. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  10. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  11. public class ContingencyPlanHuiZongDao2 {
  12. private Logger log = Logger.getLogger(this.getClass());
  13. SysModel sysmodel = ModelFactory.getSysmodel();
  14. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  15. StringBuffer json = new StringBuffer();
  16. private List<ContingencyPlanHuiZongBean> numList = new ArrayList<ContingencyPlanHuiZongBean>();
  17. // List<String> nameList =new ArrayList<String>();
  18. // String series = "";
  19. /**
  20. * 获取横轴各单位名称2015-10-10
  21. * @param list
  22. * @return
  23. */
  24. /**
  25. * 根据传过来的ID进行检测,有子节点且子节点在明细表中有数据的,继续查询该节点下面的数据
  26. * @param id
  27. * @return
  28. */
  29. public String PlanNumInit(String id,String time1,String time2){
  30. /***********************2015-12-09重新整理统计方式************************************/
  31. String sql="select DEPT_ID from sys_department where (parent_id='"+id+"' or DEPT_ID='"+id+"')";
  32. try{
  33. if(checkId(id)){
  34. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  35. log.info("carNum.tempList.size===="+tempList.size());
  36. List<String>list=new ArrayList<String>();
  37. for(int i=0;i<tempList.size();i++){
  38. list.add(tempList.get(i)[0]);
  39. }
  40. getPlanNum(list, list.get(0),time1,time2);
  41. }else{
  42. List<String>list=new ArrayList<String>();
  43. list.add(id);
  44. getPlanNum(list, id,time1,time2);
  45. }
  46. }catch(Exception e){
  47. this.log.error(e.getMessage(), e);
  48. }
  49. /*****没有数据的情况下多了这个逗号导致表格出不来 2016-01-21*****************/
  50. /*if (json.lastIndexOf(",") > -1) {
  51. json.deleteCharAt(json.lastIndexOf(","));
  52. }*/
  53. ContingencyPlanHuiZongBean drillBean=new ContingencyPlanHuiZongBean();
  54. for(int i=0;i<numList.size();i++){
  55. //总体预案
  56. drillBean.setZtPlan(drillBean.getZtPlan()+numList.get(i).getZtPlan());
  57. //专项预案
  58. drillBean.setZxPlan(drillBean.getZxPlan()+numList.get(i).getZxPlan());
  59. //自然灾害
  60. drillBean.setZrzh(drillBean.getZrzh()+numList.get(i).getZrzh());
  61. //事故灾难
  62. drillBean.setSgzh(drillBean.getSgzh()+numList.get(i).getSgzh());
  63. //公共卫生
  64. drillBean.setGgws(drillBean.getGgws()+numList.get(i).getGgws());
  65. //社会安全
  66. drillBean.setShaq(drillBean.getShaq()+numList.get(i).getShaq());
  67. //现场处置
  68. drillBean.setXcczPlan(drillBean.getXcczPlan()+numList.get(i).getXcczPlan());
  69. //自然灾害
  70. drillBean.setZrzhxc(drillBean.getZrzhxc()+numList.get(i).getZrzhxc());
  71. //事故灾难
  72. drillBean.setSgzhxc(drillBean.getSgzhxc()+numList.get(i).getSgzhxc());
  73. //公共卫生
  74. drillBean.setGgwsxc(drillBean.getGgwsxc()+numList.get(i).getGgwsxc());
  75. //社会安全
  76. drillBean.setShaqxc(drillBean.getShaqxc()+numList.get(i).getShaqxc());
  77. //部门预案
  78. drillBean.setBmhj(drillBean.getBmhj()+numList.get(i).getBmhj());
  79. //安全监察部
  80. drillBean.setAqjcb(drillBean.getAqjcb()+numList.get(i).getAqjcb());
  81. //系统运行部
  82. drillBean.setXtyxb(drillBean.getXtyxb()+numList.get(i).getXtyxb());
  83. //国际部
  84. drillBean.setGjb(drillBean.getGjb()+numList.get(i).getGjb());
  85. //生产设备管理部
  86. drillBean.setScsbglb(drillBean.getScsbglb()+numList.get(i).getScsbglb());
  87. //信息部
  88. drillBean.setXxb(drillBean.getXxb()+numList.get(i).getXxb());
  89. //市场营销部
  90. drillBean.setScyxb(drillBean.getScyxb()+numList.get(i).getScyxb());
  91. //部门合计
  92. drillBean.setBmhj(drillBean.getBmhj()+numList.get(i).getBmhj());
  93. //政府预案
  94. drillBean.setZhengfu(drillBean.getZhengfu()+numList.get(i).getZhengfu());
  95. //总计
  96. drillBean.setzTotal(drillBean.getzTotal()+numList.get(i).getzTotal());
  97. }
  98. //显示表格所用
  99. json.append(" { ");
  100. json.append(" \"ztplan\":\"" + drillBean.getZtPlan() + "\",");
  101. json.append(" \"zxplan\":\"" + drillBean.getZxPlan() + "\",");
  102. json.append(" \"zrzh\":\"" + drillBean.getZrzh() + "\",");
  103. json.append(" \"sgzh\":\"" + drillBean.getSgzh() + "\",");
  104. json.append(" \"ggws\":\"" + drillBean.getGgws() + "\",");
  105. json.append(" \"shaq\":\"" + drillBean.getShaq() + "\",");
  106. json.append(" \"xcczplan\":\"" + drillBean.getXcczPlan() + "\",");
  107. json.append(" \"zrzhxc\":\"" + drillBean.getZrzhxc() + "\",");
  108. json.append(" \"sgzhxc\":\"" + drillBean.getSgzhxc() + "\",");
  109. json.append(" \"ggwsxc\":\"" + drillBean.getGgwsxc() + "\",");
  110. json.append(" \"shaqxc\":\"" + drillBean.getShaqxc() + "\",");
  111. json.append(" \"ztotal\":\"" + drillBean.getzTotal() + "\",");
  112. json.append(" \"aqjcb\":\"" + drillBean.getAqjcb() + "\",");
  113. json.append(" \"xtyxb\":\"" + drillBean.getXtyxb() + "\",");
  114. json.append(" \"gjb\":\"" + drillBean.getGjb() + "\",");
  115. json.append(" \"scsbglb\":\"" + drillBean.getScsbglb() + "\",");
  116. json.append(" \"xxb\":\"" + drillBean.getXxb() + "\",");
  117. json.append(" \"scyxb\":\"" + drillBean.getScyxb() + "\",");
  118. json.append(" \"bmhj\":\"" + drillBean.getBmhj() + "\",");
  119. json.append(" \"zhengfu\":\"" + drillBean.getZhengfu() + "\",");
  120. json.append(" \"name\":\"" +"总计" + "\",");
  121. json.append(" \"dept_id\":\"" + "11111" + "\",");
  122. json.append(" \"isParent\":false,");
  123. json.append(" \"open\":false");
  124. json.append("} ");
  125. String result="{\"rows\":["+json.toString()+"]}";
  126. log.info("result===="+result);
  127. return result;
  128. }
  129. //树形的加载
  130. public String PlanNum(String id,String deptIds,String strPushTume,String endPushTime){
  131. try{
  132. if(checkId(id)){
  133. // String sql="select UNITS from ECM_AM_YJYASERVER WHERE UNITS IN(SELECT ID FROM SYS_DEPARTMENT_0827 WHERE PARENT_ID='"+id+"')";
  134. String sql="SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID='"+id+"'";
  135. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  136. for(int i=0;i<tempList.size();i++){
  137. List<String>list=getCmpList(tempList.get(i)[0], new ArrayList<String>(),deptIds);
  138. getPlanNum(list, tempList.get(i)[0],"","");
  139. }
  140. }else{
  141. List<String>list=new ArrayList<String>();
  142. list.add(id);
  143. getNoChildPlanNum(list, id,strPushTume,endPushTime);
  144. }}catch(Exception e){
  145. this.log.error(e.getMessage(), e);
  146. }
  147. if (json.lastIndexOf(",") > -1) {
  148. json.deleteCharAt(json.lastIndexOf(","));
  149. }
  150. String result="{\"rows\":["+json.toString()+"]}";
  151. log.info("result===="+result);
  152. return result;
  153. }
  154. //获取公司ID(包括自己,以及下属子单位ID)
  155. public List<String> getCmpList(String id,List<String>list,String deptIds) {
  156. try{
  157. if(checkId(id)){//存在子节点且子节点在明细表中有记录
  158. list.add(id);
  159. String sql="select distinct(UNITS) from ECM_AM_YJYASERVER WHERE UNITS IN (SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID='"+id+"')";
  160. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  161. log.info("getCmpList.tempList.size===="+tempList.size());
  162. for(int i=0;i<tempList.size();i++){
  163. getCmpList(tempList.get(i)[0],list,deptIds);
  164. }
  165. }
  166. else{//如果不存在自己点或者子节点在明细表中无记录,则返回该ID
  167. list.add(id);
  168. }}catch(Exception e){
  169. this.log.error(e.getMessage(), e);
  170. }
  171. return list;
  172. }
  173. //判断有没有子单位
  174. public boolean checkId(String id) {
  175. try{
  176. String sql="select * from ECM_AM_YJYASERVER WHERE units IN(SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID='"+id+"')";
  177. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  178. if(tempList==null||tempList.size()==0){
  179. return false;
  180. }else{
  181. return true;
  182. }}catch(Exception e){
  183. this.log.error(e.getMessage(), e);
  184. return false;
  185. }
  186. }
  187. //获取每一行数据的统计数据
  188. public void getPlanNum(List<String>list,String id,String time1,String time2) throws PersistenceException{
  189. try{
  190. for(int i=0;i<list.size();i++){
  191. ContingencyPlanHuiZongBean cn=new ContingencyPlanHuiZongBean();
  192. //2015-10-10qsl可以跑通
  193. String sql="select UNITS,sum(case plan_type when '102' then 1 else 0 end ) 总体预案,"
  194. + "sum(case when BYSUNESS_TYPE='105' and plan_type='103' then 1 else 0 end)专项自然灾害,"
  195. + "sum(case when BYSUNESS_TYPE='106' and plan_type='103' then 1 else 0 end)专项事故灾难,"
  196. + "sum(case when BYSUNESS_TYPE='107' and plan_type='103' then 1 else 0 end)专项公共卫生事件,"
  197. + "sum(case when BYSUNESS_TYPE= '108' and plan_type='103' then 1 else 0 end)专项社会安全事件,"
  198. + "sum(case plan_type when '103' then 1 else 0 end )专项合计,"
  199. + "sum(case when BYSUNESS_TYPE='105' and plan_type='104' then 1 else 0 end)现场自然灾害,"
  200. + "sum(case when BYSUNESS_TYPE='106' and plan_type='104' then 1 else 0 end)现场事故灾难,"
  201. + "sum(case when BYSUNESS_TYPE='107' and plan_type='104' then 1 else 0 end)现场公共卫生事件,"
  202. + "sum(case when BYSUNESS_TYPE= '108' and plan_type='104' then 1 else 0 end)现场社会安全事件,"
  203. + "sum(case plan_type when '104' then 1 else 0 end )现场合计,"
  204. + "sum(case when plan_type= '105' and INS_UNITS='112' then 1 else 0 end )安全监察部,"
  205. + "sum(case when plan_type= '105' and INS_UNITS='113' then 1 else 0 end )系统运行部,"
  206. + "sum(case when plan_type='105' and INS_UNITS='114' then 1 else 0 end )国际部,"
  207. + "sum(case when plan_type='105' and INS_UNITS='115' then 1 else 0 end )设备管理部,"
  208. + "sum(case when plan_type='105' and INS_UNITS='116' then 1 else 0 end )信息部,"
  209. + "sum(case when plan_type='105' and INS_UNITS='117' then 1 else 0 end )市场营销部,"
  210. + "sum(case plan_type when '105' then 1 else 0 end )部门合计,"
  211. + "sum(case plan_type when '106' then 1 else 0 end )政府预案, "
  212. + "(sum(case plan_type when '105' then 1 else 0 end )+sum(case plan_type when '103' then 1 else 0 end )+sum(case plan_type when '104' then 1 else 0 end )+sum(case plan_type when '106' then 1 else 0 end )+sum(case plan_type when '102' then 1 else 0 end ))总合计 from ECM_AM_YJYASERVER where is_del='0' and plan_biaozhi!='0' and PLAN_STAT='1' and PLAN_STAT1='1' and units='"+list.get(i)+"'";
  213. if(time1!=null){
  214. sql+=" and ISSUE_DATE between '"+time1+"' and '"+time2+"'";
  215. }
  216. sql+=" group by units ";
  217. List<String[]> tempList = persistence.getSearchResult(99, sql.toString());
  218. if(tempList.size()>0){
  219. cn.setComp_id(tempList.get(0)[0]);//单位ID
  220. cn.setZtPlan(cn.getZtPlan()+Integer.parseInt(tempList.get(0)[1]));//总体预案
  221. cn.setZrzh(cn.getZrzh()+Integer.parseInt(tempList.get(0)[2]));//自然灾害
  222. cn.setSgzh(cn.getSgzh()+Integer.parseInt(tempList.get(0)[3]));//事故灾难
  223. cn.setGgws(cn.getGgws()+Integer.parseInt(tempList.get(0)[4]));//公共卫生
  224. cn.setShaq(cn.getShaq()+Integer.parseInt(tempList.get(0)[5]));//社会安全
  225. cn.setZxPlan(cn.getZxPlan()+Integer.parseInt(tempList.get(0)[6]));//专项合计
  226. cn.setZrzhxc(cn.getZrzhxc()+Integer.parseInt(tempList.get(0)[7]));//自然灾害
  227. cn.setSgzhxc(cn.getSgzhxc()+Integer.parseInt(tempList.get(0)[8]));//事故灾难
  228. cn.setGgwsxc(cn.getGgwsxc()+Integer.parseInt(tempList.get(0)[9]));//公共卫生
  229. cn.setShaqxc(cn.getShaqxc()+Integer.parseInt(tempList.get(0)[10]));//社会安全
  230. cn.setXcczPlan(cn.getXcczPlan()+Integer.parseInt(tempList.get(0)[11]));//现场合计
  231. /***********************************废弃************************************/
  232. cn.setAqjcb(cn.getAqjcb()+Integer.parseInt(tempList.get(0)[12]));//安全监察部
  233. cn.setXtyxb(cn.getXtyxb()+Integer.parseInt(tempList.get(0)[13]));//系统运行部
  234. cn.setGjb(cn.getGjb()+Integer.parseInt(tempList.get(0)[14]));//国际部
  235. cn.setScsbglb(cn.getScsbglb()+Integer.parseInt(tempList.get(0)[15]));//生产设备管理部
  236. cn.setXxb(cn.getXxb()+Integer.parseInt(tempList.get(0)[16]));//信息部
  237. cn.setScyxb(cn.getScyxb()+Integer.parseInt(tempList.get(0)[17]));//市场营销部
  238. /***********************************************************************/
  239. cn.setBmhj(cn.getBmhj()+Integer.parseInt(tempList.get(0)[18]));//部门合计
  240. cn.setZhengfu(cn.getZhengfu()+Integer.parseInt(tempList.get(0)[19]));//政府预案
  241. cn.setzTotal(cn.getzTotal()+Integer.parseInt(tempList.get(0)[20]));//总合计
  242. numList.add(cn);
  243. if(cn.getzTotal()>0){
  244. if(checkId(id)){
  245. json.append("{ ");
  246. json.append(" \"ztplan\":\"" + cn.getZtPlan() + "\",");
  247. json.append(" \"zxplan\":\"" + cn.getZxPlan() + "\",");
  248. json.append(" \"zrzh\":\"" + cn.getZrzh() + "\",");
  249. json.append(" \"sgzh\":\"" + cn.getSgzh() + "\",");
  250. json.append(" \"ggws\":\"" + cn.getGgws() + "\",");
  251. json.append(" \"shaq\":\"" + cn.getShaq() + "\",");
  252. json.append(" \"xcczplan\":\"" + cn.getXcczPlan() + "\",");
  253. json.append(" \"zrzhxc\":\"" + cn.getZrzhxc() + "\",");
  254. json.append(" \"sgzhxc\":\"" + cn.getSgzhxc() + "\",");
  255. json.append(" \"ggwsxc\":\"" + cn.getGgwsxc() + "\",");
  256. json.append(" \"shaqxc\":\"" + cn.getShaqxc() + "\",");
  257. json.append(" \"ztotal\":\"" + cn.getzTotal() + "\",");
  258. json.append(" \"aqjcb\":\"" + cn.getAqjcb() + "\",");
  259. json.append(" \"xtyxb\":\"" + cn.getXtyxb() + "\",");
  260. json.append(" \"gjb\":\"" + cn.getGjb() + "\",");
  261. json.append(" \"scsbglb\":\"" + cn.getScsbglb() + "\",");
  262. json.append(" \"xxb\":\"" + cn.getXxb() + "\",");
  263. json.append(" \"scyxb\":\"" + cn.getScyxb() + "\",");
  264. json.append(" \"bmhj\":\"" + cn.getBmhj() + "\",");
  265. json.append(" \"zhengfu\":\"" + cn.getZhengfu() + "\",");
  266. json.append(" \"name\":\"" + getNameById(list.get(i)) + "\",");
  267. json.append(" \"dept_id\":\"" + list.get(i) + "\",");
  268. json.append(" \"isParent\":true,");
  269. json.append(" \"open\":false");
  270. json.append("}, ");
  271. }else{
  272. json.append("{ ");
  273. json.append(" \"ztplan\":\"" + cn.getZtPlan() + "\",");
  274. json.append(" \"zxplan\":\"" + cn.getZxPlan() + "\",");
  275. json.append(" \"zrzh\":\"" + cn.getZrzh() + "\",");
  276. json.append(" \"sgzh\":\"" + cn.getSgzh() + "\",");
  277. json.append(" \"ggws\":\"" + cn.getGgws() + "\",");
  278. json.append(" \"shaq\":\"" + cn.getShaq() + "\",");
  279. json.append(" \"xcczplan\":\"" + cn.getXcczPlan() + "\",");
  280. json.append(" \"zrzhxc\":\"" + cn.getZrzhxc() + "\",");
  281. json.append(" \"sgzhxc\":\"" + cn.getSgzhxc() + "\",");
  282. json.append(" \"ggwsxc\":\"" + cn.getGgwsxc() + "\",");
  283. json.append(" \"shaqxc\":\"" + cn.getShaqxc() + "\",");
  284. json.append(" \"ztotal\":\"" + cn.getzTotal() + "\",");
  285. json.append(" \"aqjcb\":\"" + cn.getAqjcb() + "\",");
  286. json.append(" \"xtyxb\":\"" + cn.getXtyxb() + "\",");
  287. json.append(" \"gjb\":\"" + cn.getGjb() + "\",");
  288. json.append(" \"scsbglb\":\"" + cn.getScsbglb() + "\",");
  289. json.append(" \"xxb\":\"" + cn.getXxb() + "\",");
  290. json.append(" \"scyxb\":\"" + cn.getScyxb() + "\",");
  291. json.append(" \"bmhj\":\"" + cn.getBmhj() + "\",");
  292. json.append(" \"zhengfu\":\"" + cn.getZhengfu() + "\",");
  293. json.append(" \"name\":\"" + getNameById(list.get(i)) + "\",");
  294. json.append(" \"dept_id\":\"" + list.get(i) + "\",");
  295. json.append(" \"isParent\":false,");
  296. json.append(" \"open\":false");
  297. json.append("}, ");
  298. }
  299. }
  300. }
  301. }}catch(Exception e){
  302. this.log.error(e.getMessage(), e);
  303. }
  304. }
  305. //该单位没有子节点,只获取一行的统计信息
  306. public void getNoChildPlanNum(List<String>list,String id,String time1,String time2) throws PersistenceException{
  307. ContingencyPlanHuiZongBean cn=new ContingencyPlanHuiZongBean();
  308. try{
  309. for(int i=0;i<list.size();i++){
  310. String sql="select UNITS,sum(case plan_type when '102' then 1 else 0 end ) 总体预案,"
  311. + "sum(case when BYSUNESS_TYPE='105' and plan_type='103' then 1 else 0 end)专项自然灾害,"
  312. + "sum(case when BYSUNESS_TYPE='106' and plan_type='103' then 1 else 0 end)专项事故灾难,"
  313. + "sum(case when BYSUNESS_TYPE='107' and plan_type='103' then 1 else 0 end)专项公共卫生事件,"
  314. + "sum(case when BYSUNESS_TYPE= '108' and plan_type='103' then 1 else 0 end)专项社会安全事件,"
  315. + "sum(case plan_type when '103' then 1 else 0 end )专项合计,"
  316. + "sum(case when BYSUNESS_TYPE='105' and plan_type='104' then 1 else 0 end)现场自然灾害,"
  317. + "sum(case when BYSUNESS_TYPE='106' and plan_type='104' then 1 else 0 end)现场事故灾难,"
  318. + "sum(case when BYSUNESS_TYPE='107' and plan_type='104' then 1 else 0 end)现场公共卫生事件,"
  319. + "sum(case when BYSUNESS_TYPE= '108' and plan_type='104' then 1 else 0 end)现场社会安全事件,"
  320. + "sum(case plan_type when '104' then 1 else 0 end )现场合计,"
  321. + "sum(case when plan_type= '105' and INS_UNITS='112' then 1 else 0 end )安全监察部,"
  322. + "sum(case when plan_type= '105' and INS_UNITS='113' then 1 else 0 end )系统运行部,"
  323. + "sum(case when plan_type='105' and INS_UNITS='114' then 1 else 0 end )国际部,"
  324. + "sum(case when plan_type='105' and INS_UNITS='115' then 1 else 0 end )设备管理部,"
  325. + "sum(case when plan_type='105' and INS_UNITS='116' then 1 else 0 end )信息部,"
  326. + "sum(case when plan_type='105' and INS_UNITS='117' then 1 else 0 end )市场营销部,"
  327. + "sum(case plan_type when '105' then 1 else 0 end )部门合计,"
  328. + "sum(case plan_type when '106' then 1 else 0 end )政府预案, "
  329. + "(sum(case plan_type when '105' then 1 else 0 end )+sum(case plan_type when '103' then 1 else 0 end )+sum(case plan_type when '104' then 1 else 0 end )+sum(case plan_type when '106' then 1 else 0 end )+sum(case plan_type when '102' then 1 else 0 end ))总合计 from ECM_AM_YJYASERVER where is_del='0' and plan_biaozhi!='0' and PLAN_STAT1='1' and PLAN_STAT='1' and units='"+list.get(i)+"'";
  330. if(time1!=null){
  331. sql+=" and DZ_FILE between '"+time1+"' and '"+time2+"'";
  332. }
  333. log.info("getCarNum.sql===="+sql);
  334. List<String[]> numList = persistence.getSearchResult(99, sql.toString());
  335. if(numList.size()>0){
  336. cn.setComp_id(numList.get(0)[0]);//单位ID
  337. cn.setZtPlan(cn.getZtPlan()+Integer.parseInt(numList.get(0)[1]));//总体预案
  338. cn.setZxPlan(cn.getZxPlan()+Integer.parseInt(numList.get(0)[6]));//专项预案
  339. cn.setZrzh(cn.getZrzh()+Integer.parseInt(numList.get(0)[2]));//自然灾害
  340. cn.setSgzh(cn.getSgzh()+Integer.parseInt(numList.get(0)[3]));//事故灾难
  341. cn.setGgws(cn.getGgws()+Integer.parseInt(numList.get(0)[4]));//公共卫生
  342. cn.setShaq(cn.getShaq()+Integer.parseInt(numList.get(0)[5]));//社会安全
  343. cn.setXcczPlan(cn.getXcczPlan()+Integer.parseInt(numList.get(0)[11]));//现场处置
  344. cn.setZrzhxc(cn.getZrzhxc()+Integer.parseInt(numList.get(0)[7]));//自然灾害
  345. cn.setSgzhxc(cn.getSgzhxc()+Integer.parseInt(numList.get(0)[8]));//事故灾难
  346. cn.setGgwsxc(cn.getGgwsxc()+Integer.parseInt(numList.get(0)[9]));//公共卫生
  347. cn.setShaqxc(cn.getShaqxc()+Integer.parseInt(numList.get(0)[10]));//社会安全
  348. cn.setzTotal(cn.getzTotal()+Integer.parseInt(numList.get(0)[19]));//总合计
  349. cn.setAqjcb(cn.getAqjcb()+Integer.parseInt(numList.get(0)[12]));//安全监察部
  350. cn.setXtyxb(cn.getXtyxb()+Integer.parseInt(numList.get(0)[13]));//系统运行部
  351. cn.setGjb(cn.getGjb()+Integer.parseInt(numList.get(0)[14]));//国际部
  352. cn.setScsbglb(cn.getScsbglb()+Integer.parseInt(numList.get(0)[15]));//生产设备管理部
  353. cn.setXxb(cn.getXxb()+Integer.parseInt(numList.get(0)[16]));//信息部
  354. cn.setScyxb(cn.getScyxb()+Integer.parseInt(numList.get(0)[17]));//市场营销部
  355. cn.setBmhj(cn.getBmhj()+Integer.parseInt(numList.get(0)[18]));//部门合计
  356. cn.setZhengfu(cn.getZhengfu()+Integer.parseInt(numList.get(0)[19]));//政府预案
  357. // this.numList.add(cn);
  358. //nameList.add(cn.getComp_id());
  359. }
  360. }}catch(Exception e){
  361. this.log.error(e.getMessage(), e);
  362. }
  363. if(cn.getzTotal()>0){
  364. json.append("{ ");
  365. json.append(" \"ztplan\":\"" + cn.getZtPlan() + "\",");
  366. json.append(" \"zxplan\":\"" + cn.getZxPlan() + "\",");
  367. json.append(" \"zrzh\":\"" + cn.getZrzh() + "\",");
  368. json.append(" \"sgzh\":\"" + cn.getSgzh() + "\",");
  369. json.append(" \"ggws\":\"" + cn.getGgws() + "\",");
  370. json.append(" \"shaq\":\"" + cn.getShaq() + "\",");
  371. json.append(" \"xcczplan\":\"" + cn.getXcczPlan() + "\",");
  372. json.append(" \"zrzhxc\":\"" + cn.getZrzhxc() + "\",");
  373. json.append(" \"sgzhxc\":\"" + cn.getSgzhxc() + "\",");
  374. json.append(" \"ggwsxc\":\"" + cn.getGgwsxc() + "\",");
  375. json.append(" \"shaqxc\":\"" + cn.getShaqxc() + "\",");
  376. json.append(" \"ztotal\":\"" + cn.getzTotal() + "\",");
  377. json.append(" \"aqjcb\":\"" + cn.getAqjcb() + "\",");
  378. json.append(" \"xtyxb\":\"" + cn.getXtyxb() + "\",");
  379. json.append(" \"gjb\":\"" + cn.getGjb() + "\",");
  380. json.append(" \"scsbglb\":\"" + cn.getScsbglb() + "\",");
  381. json.append(" \"xxb\":\"" + cn.getXxb() + "\",");
  382. json.append(" \"scyxb\":\"" + cn.getScyxb() + "\",");
  383. json.append(" \"bmhj\":\"" + cn.getBmhj() + "\",");
  384. json.append(" \"zhengfu\":\"" + cn.getZhengfu() + "\",");
  385. json.append(" \"name\":\"" + getNameById(id) + "\",");
  386. json.append(" \"dept_id\":\"" + id + "\",");
  387. json.append(" \"isParent\":false,");
  388. json.append(" \"open\":false");
  389. json.append("}, ");
  390. numList.add(cn);
  391. }
  392. }
  393. //通过单位ID显示出该单位名称
  394. public String getNameById(String id){
  395. String sql="select DEPT_NAME from sys_department where DEPT_ID='"+id+"'";
  396. try {
  397. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  398. if(tempList==null||tempList.size()==0){
  399. return "";
  400. }else{
  401. String name=tempList.get(0)[0].replace("供电局", "").replace("广东电网有限责任公司", "广东");
  402. log.info("name===="+name);
  403. return name;
  404. }
  405. } catch (PersistenceException e) {
  406. // TODO Auto-generated catch block
  407. e.printStackTrace();
  408. return "";
  409. }
  410. }
  411. }