53e6ab89555920e01e20e6369ffe328242dbbd0f.svn-base 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. package com.sinosoft.am.customer.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.customer.vo.customerModel;
  9. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  10. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  11. public class customerModelDao {
  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<customerModel> numList = new ArrayList<customerModel>();
  17. /**
  18. * 获取横轴各单位名称2015-10-12
  19. * @param list
  20. * @return
  21. */
  22. /**
  23. * 根据传过来的ID进行检测,有子节点且子节点在明细表中有数据的,继续查询该节点下面的数据
  24. * @param id
  25. * @return
  26. * @throws PersistenceException
  27. */
  28. public String getCustomerInfoNumInit(String id,String firstPageNum,String limit,String convalue,String customername) throws PersistenceException{
  29. try{
  30. log.info("ID==="+id+",第一页===="+firstPageNum+",个数======"+limit);
  31. log.info(convalue);
  32. if(convalue.equals(" undefined")){
  33. convalue = "";
  34. }
  35. List<String> list1 = new ArrayList<String>();
  36. List<String>tempList=getCmpList(new ArrayList<String>(),firstPageNum,limit,id,convalue,customername);
  37. for(int i=0;i<tempList.size();i++){
  38. list1.add(tempList.get(i));
  39. }
  40. getPlanNum(list1, id);
  41. }catch(Exception e){
  42. this.log.error(e.getMessage(), e);
  43. }
  44. if (json.lastIndexOf(",") > -1) {
  45. json.deleteCharAt(json.lastIndexOf(","));
  46. }
  47. String condition = " where IMPORT_LEVEL!='5' ";
  48. if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){
  49. condition += "";
  50. }else if(id.equals("1E5D688F639E48EBA0AEC8B057F2C06D")){
  51. condition += "and DESCRIPTION ='035200' ";
  52. }else if(id.equals("2BF184BAA0CB4F6D821048FDE4612999")){
  53. condition += "and DESCRIPTION ='030800' ";
  54. }else if(id.equals("304866F304E14890BDB073FEE15399EB")){
  55. condition += "and DESCRIPTION ='035100' ";
  56. }else if(id.equals("38AA15A4AB314A708EE98733A9857023")){
  57. condition += "and DESCRIPTION ='030700' ";
  58. }else if(id.equals("39419D104634467CA1A641E4CC1D8A21")){
  59. condition += "and DESCRIPTION ='031200' ";
  60. }else if(id.equals("52548B9F88DB4BE98EDAED2A5F70371B")){
  61. condition += "and DESCRIPTION ='031600' ";
  62. }else if(id.equals("52CBA051D490487DA2D1F258EB8F595D")){
  63. condition += "and DESCRIPTION ='031800' ";
  64. }else if(id.equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){
  65. condition += "and DESCRIPTION ='035300' ";
  66. }else if(id.equals("6D61CEB772AC4EA7B5CD805183C14806")){
  67. condition += "and DESCRIPTION ='030600' ";
  68. }else if(id.equals("785F409051A84412A75E8E44FE3F5C6E")){
  69. condition += "and DESCRIPTION ='031300' ";
  70. }else if(id.equals("A0FF45B5DD504A718F514172BA54C44B")){
  71. condition += "and DESCRIPTION ='030200' ";
  72. }else if(id.equals("A975127FE24B4937945545301503B59E")){
  73. condition += "and DESCRIPTION ='032000' ";
  74. }else if(id.equals("BC82691B2E194E80AA3F4D16D7CF08A9")){
  75. condition += "and DESCRIPTION ='031500' ";
  76. }else if(id.equals("C697FA6F2FC645EBA181F4278F4BE733")){
  77. condition += "and DESCRIPTION ='030900' ";
  78. }else if(id.equals("D01A4DE3FB504EF095F6AF9B541042FE")){
  79. condition += "and DESCRIPTION ='030500' ";
  80. }else if(id.equals("D4CD8F9F43DD40B593FC85C74403AC65")){
  81. condition += "and DESCRIPTION ='030400' ";
  82. }else if(id.equals("EE6E74BCE5D34A928E32E71226BF31ED")){
  83. condition += "and DESCRIPTION ='031900' ";
  84. }else if(id.equals("F0ADFEDC8D3C413F865148A3E0C138B9")){
  85. condition += "and DESCRIPTION ='031700' ";
  86. }else if(id.equals("FCACDE74635E41ECB91162ED5186BA60")){
  87. condition += "and DESCRIPTION ='031400' ";
  88. }else{
  89. condition += "and (OWNER_STATION in(select distinct base_org_id from sys_department START WITH DEPT_ID='"+id+"' CONNECT BY PRIOR DEPT_ID=PARENT_ID ) or OWNER_STATION='"+id+"')";
  90. }
  91. if(!customername.equals("")){
  92. // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){
  93. // condition += " where name like '%"+customername+"%'";
  94. // }else{
  95. condition += " and name like '%"+customername+"%'";
  96. // }
  97. }
  98. if(!convalue.equals("")){
  99. // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")&&customername.equals("")){
  100. // condition += " where "+convalue;
  101. // }else{
  102. condition += " and "+convalue;
  103. // }
  104. condition = condition.substring(0,condition.lastIndexOf("and"));
  105. }
  106. String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" "+condition+" order by DESCRIPTION;";
  107. log.info("sql======"+sql);
  108. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  109. log.info("getCmpList.tempList.size===="+tempList.size());
  110. int totalPage = tempList.size();
  111. String result="{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":["+json.toString()+"]}";
  112. log.info("result===="+result);
  113. return result;
  114. }
  115. public String getCustomerInfoNumInit2(String id,String firstPageNum,String limit,String convalue,String customername) throws PersistenceException{
  116. try{
  117. log.info(convalue);
  118. List<String> list1 = new ArrayList<String>();
  119. List<String>tempList=getCmpList2(new ArrayList<String>(),firstPageNum,limit,id,convalue,customername);
  120. for(int i=0;i<tempList.size();i++){
  121. list1.add(tempList.get(i));
  122. }
  123. getPlanNum(list1, id);
  124. }catch(Exception e){
  125. this.log.error(e.getMessage(), e);
  126. }
  127. if (json.lastIndexOf(",") > -1) {
  128. json.deleteCharAt(json.lastIndexOf(","));
  129. }
  130. String[] con = convalue.split("and");
  131. String cond = con[con.length-2];
  132. String[] con1 = cond.split("=");
  133. String cond1 = con1[1];
  134. log.info(cond1.replace(" ", ""));
  135. // String condition = " where OWNER_STATION IN (SELECT DISTINCT base_org_id FROM SYS_DEPARTMENT START WITH "+cond+" CONNECT BY PRIOR DEPT_ID=PARENT_ID)";
  136. String condition = " where IMPORT_LEVEL!='5' ";
  137. if(cond1.replace(" ", "").equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){
  138. condition += " and (OWNER_STATION IN (select base_org_id from sys_department where dept_path like'%"+cond1.replace(" ", "")+"%') or owner_station not in (select a.owner_station from nwyj_service.mdm_customer a,sys_department b where a.owner_station=b.base_org_id)) ";
  139. }
  140. else if(cond1.replace(" ", "").equals("1E5D688F639E48EBA0AEC8B057F2C06D")){
  141. condition += "and DESCRIPTION ='035200' ";
  142. }else if(cond1.replace(" ", "").equals("2BF184BAA0CB4F6D821048FDE4612999")){
  143. condition += "and DESCRIPTION ='030800' ";
  144. }else if(cond1.replace(" ", "").equals("304866F304E14890BDB073FEE15399EB")){
  145. condition += "and DESCRIPTION ='035100' ";
  146. }else if(cond1.replace(" ", "").equals("38AA15A4AB314A708EE98733A9857023")){
  147. condition += "and DESCRIPTION ='030700' ";
  148. }else if(cond1.replace(" ", "").equals("39419D104634467CA1A641E4CC1D8A21")){
  149. condition += "and DESCRIPTION ='031200' ";
  150. }else if(cond1.replace(" ", "").equals("52548B9F88DB4BE98EDAED2A5F70371B")){
  151. condition += "and DESCRIPTION ='031600' ";
  152. }else if(cond1.replace(" ", "").equals("52CBA051D490487DA2D1F258EB8F595D")){
  153. condition += "and DESCRIPTION ='031800' ";
  154. }else if(cond1.replace(" ", "").equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){
  155. condition += "and DESCRIPTION ='035300' ";
  156. }else if(cond1.replace(" ", "").equals("6D61CEB772AC4EA7B5CD805183C14806")){
  157. condition += "and DESCRIPTION ='030600' ";
  158. }else if(cond1.replace(" ", "").equals("785F409051A84412A75E8E44FE3F5C6E")){
  159. condition += "and DESCRIPTION ='031300' ";
  160. }else if(cond1.replace(" ", "").equals("A0FF45B5DD504A718F514172BA54C44B")){
  161. condition += "and DESCRIPTION ='030200' ";
  162. }else if(cond1.replace(" ", "").equals("A975127FE24B4937945545301503B59E")){
  163. condition += "and DESCRIPTION ='032000' ";
  164. }else if(cond1.replace(" ", "").equals("BC82691B2E194E80AA3F4D16D7CF08A9")){
  165. condition += "and DESCRIPTION ='031500' ";
  166. }else if(cond1.replace(" ", "").equals("C697FA6F2FC645EBA181F4278F4BE733")){
  167. condition += "and DESCRIPTION ='030900' ";
  168. }else if(cond1.replace(" ", "").equals("D01A4DE3FB504EF095F6AF9B541042FE")){
  169. condition += "and DESCRIPTION ='030500' ";
  170. }else if(cond1.replace(" ", "").equals("D4CD8F9F43DD40B593FC85C74403AC65")){
  171. condition += "and DESCRIPTION ='030400' ";
  172. }else if(cond1.replace(" ", "").equals("EE6E74BCE5D34A928E32E71226BF31ED")){
  173. condition += "and DESCRIPTION ='031900' ";
  174. }else if(cond1.replace(" ", "").equals("F0ADFEDC8D3C413F865148A3E0C138B9")){
  175. condition += "and DESCRIPTION ='031700' ";
  176. }else if(cond1.replace(" ", "").equals("FCACDE74635E41ECB91162ED5186BA60")){
  177. condition += "and DESCRIPTION ='031400' ";
  178. }
  179. else{
  180. condition += " and OWNER_STATION IN (select base_org_id from sys_department where dept_path like'%"+cond1.replace(" ", "")+"%') ";
  181. }
  182. if(con.length-3>=0){
  183. convalue = convalue.substring(0,convalue.lastIndexOf("and"));
  184. convalue = convalue.substring(0,convalue.lastIndexOf("and"));
  185. condition += " and"+convalue;
  186. }
  187. String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" "+condition+" order by DESCRIPTION;";
  188. log.info("sql===*********************************************************************************************************************************=="+sql);
  189. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  190. log.info("getCmpList.tempList.size===="+tempList.size());
  191. int totalPage = tempList.size();
  192. String result="{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":["+json.toString()+"]}";
  193. log.info("result===="+result);
  194. return result;
  195. }
  196. //获取客户ID(所有客户的)
  197. public List<String> getCmpList(List<String>list,String pagenum,String limit,String id,String convalue,String customername) {
  198. try{
  199. // String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" order by DESCRIPTION;";
  200. // List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  201. // log.info("getCmpList.tempList.size===="+tempList.size());
  202. // int totalPage = tempList.size()/Integer.parseInt(limit);
  203. int start = 0; int end = 0;
  204. if((Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)>=0){
  205. start=(Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)+1;
  206. end = Integer.parseInt(pagenum)*Integer.parseInt(limit);
  207. }
  208. String condition = " where IMPORT_LEVEL!='5' ";
  209. if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){
  210. condition += "";
  211. }else if(id.equals("1E5D688F639E48EBA0AEC8B057F2C06D")){
  212. condition += "and DESCRIPTION ='035200' ";
  213. }else if(id.equals("2BF184BAA0CB4F6D821048FDE4612999")){
  214. condition += "and DESCRIPTION ='030800' ";
  215. }else if(id.equals("304866F304E14890BDB073FEE15399EB")){
  216. condition += "and DESCRIPTION ='035100' ";
  217. }else if(id.equals("38AA15A4AB314A708EE98733A9857023")){
  218. condition += "and DESCRIPTION ='030700' ";
  219. }else if(id.equals("39419D104634467CA1A641E4CC1D8A21")){
  220. condition += "and DESCRIPTION ='031200' ";
  221. }else if(id.equals("52548B9F88DB4BE98EDAED2A5F70371B")){
  222. condition += "and DESCRIPTION ='031600' ";
  223. }else if(id.equals("52CBA051D490487DA2D1F258EB8F595D")){
  224. condition += "and DESCRIPTION ='031800' ";
  225. }else if(id.equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){
  226. condition += "and DESCRIPTION ='035300' ";
  227. }else if(id.equals("6D61CEB772AC4EA7B5CD805183C14806")){
  228. condition += "and DESCRIPTION ='030600' ";
  229. }else if(id.equals("785F409051A84412A75E8E44FE3F5C6E")){
  230. condition += "and DESCRIPTION ='031300' ";
  231. }else if(id.equals("A0FF45B5DD504A718F514172BA54C44B")){
  232. condition += "and DESCRIPTION ='030200' ";
  233. }else if(id.equals("A975127FE24B4937945545301503B59E")){
  234. condition += "and DESCRIPTION ='032000' ";
  235. }else if(id.equals("BC82691B2E194E80AA3F4D16D7CF08A9")){
  236. condition += "and DESCRIPTION ='031500' ";
  237. }else if(id.equals("C697FA6F2FC645EBA181F4278F4BE733")){
  238. condition += "and DESCRIPTION ='030900' ";
  239. }else if(id.equals("D01A4DE3FB504EF095F6AF9B541042FE")){
  240. condition += "and DESCRIPTION ='030500' ";
  241. }else if(id.equals("D4CD8F9F43DD40B593FC85C74403AC65")){
  242. condition += "and DESCRIPTION ='030400' ";
  243. }else if(id.equals("EE6E74BCE5D34A928E32E71226BF31ED")){
  244. condition += "and DESCRIPTION ='031900' ";
  245. }else if(id.equals("F0ADFEDC8D3C413F865148A3E0C138B9")){
  246. condition += "and DESCRIPTION ='031700' ";
  247. }else if(id.equals("FCACDE74635E41ECB91162ED5186BA60")){
  248. condition += "and DESCRIPTION ='031400' ";
  249. }else{
  250. condition += "and (OWNER_STATION in(select distinct base_org_id from sys_department START WITH DEPT_ID='"+id+"' CONNECT BY PRIOR DEPT_ID=PARENT_ID ) or OWNER_STATION='"+id+"')";
  251. }
  252. if(!customername.equals("")){
  253. // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){
  254. // condition += " where name like '%"+customername+"%'";
  255. // }else{
  256. condition += " and name like '%"+customername+"%'";
  257. // }
  258. }
  259. if(!convalue.equals("")){
  260. // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")&&customername.equals("")){
  261. // condition += " where "+convalue;
  262. // }else{
  263. condition += " and "+convalue;
  264. // }
  265. condition = condition.substring(0,condition.lastIndexOf("and"));
  266. }
  267. String sql2 ="select MRID from (select a.MRID,rownum rn from (select MRID,DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" "+condition+" order by DESCRIPTION) a) where rn>= '"+start+"' and rn <= '"+end+"' ";
  268. //String sql2 ="select MRID from (select a.MRID,rownum rn from (select MRID,DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" order by DESCRIPTION) a) where rn>= '"+start+"' and rn <= '"+end+"' ";
  269. List<String[]>tempList2= persistence.getSearchResult(99, sql2.toString());
  270. for(int i=0;i<tempList2.size();i++){
  271. list.add(tempList2.get(i)[0]);
  272. }
  273. }catch(Exception e){
  274. this.log.error(e.getMessage(), e);
  275. }
  276. return list;
  277. }
  278. public List<String> getCmpList2(List<String>list,String pagenum,String limit,String id,String convalue,String customername) {
  279. try{
  280. // String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" order by DESCRIPTION;";
  281. // List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  282. // log.info("getCmpList.tempList.size===="+tempList.size());
  283. // int totalPage = tempList.size()/Integer.parseInt(limit);
  284. int start = 0; int end = 0;
  285. if((Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)>=0){
  286. start=(Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)+1;
  287. end = Integer.parseInt(pagenum)*Integer.parseInt(limit);
  288. }
  289. // String cond = convalue;
  290. // cond = cond.substring(0,cond.lastIndexOf(" and "));
  291. String[] con = convalue.split("and");
  292. String cond = con[con.length-2];
  293. String[] con1 = cond.split("=");
  294. String cond1 = con1[1];
  295. log.info(cond1);
  296. // String condition = " where OWNER_STATION IN (SELECT DISTINCT base_org_id FROM SYS_DEPARTMENT START WITH "+cond+" CONNECT BY PRIOR DEPT_ID=PARENT_ID)";
  297. String condition = " where IMPORT_LEVEL!='5' ";
  298. if(cond1.replace(" ", "").equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){
  299. condition += " and (OWNER_STATION IN (select base_org_id from sys_department where dept_path like'%"+cond1.replace(" ", "")+"%') or owner_station not in (select a.owner_station from nwyj_service.mdm_customer a,sys_department b where a.owner_station=b.base_org_id)) ";
  300. }
  301. else if(cond1.replace(" ", "").equals("1E5D688F639E48EBA0AEC8B057F2C06D")){
  302. condition += "and DESCRIPTION ='035200' ";
  303. }else if(cond1.replace(" ", "").equals("2BF184BAA0CB4F6D821048FDE4612999")){
  304. condition += "and DESCRIPTION ='030800' ";
  305. }else if(cond1.replace(" ", "").equals("304866F304E14890BDB073FEE15399EB")){
  306. condition += "and DESCRIPTION ='035100' ";
  307. }else if(cond1.replace(" ", "").equals("38AA15A4AB314A708EE98733A9857023")){
  308. condition += "and DESCRIPTION ='030700' ";
  309. }else if(cond1.replace(" ", "").equals("39419D104634467CA1A641E4CC1D8A21")){
  310. condition += "and DESCRIPTION ='031200' ";
  311. }else if(cond1.replace(" ", "").equals("52548B9F88DB4BE98EDAED2A5F70371B")){
  312. condition += "and DESCRIPTION ='031600' ";
  313. }else if(cond1.replace(" ", "").equals("52CBA051D490487DA2D1F258EB8F595D")){
  314. condition += "and DESCRIPTION ='031800' ";
  315. }else if(cond1.replace(" ", "").equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){
  316. condition += "and DESCRIPTION ='035300' ";
  317. }else if(cond1.replace(" ", "").equals("6D61CEB772AC4EA7B5CD805183C14806")){
  318. condition += "and DESCRIPTION ='030600' ";
  319. }else if(cond1.replace(" ", "").equals("785F409051A84412A75E8E44FE3F5C6E")){
  320. condition += "and DESCRIPTION ='031300' ";
  321. }else if(cond1.replace(" ", "").equals("A0FF45B5DD504A718F514172BA54C44B")){
  322. condition += "and DESCRIPTION ='030200' ";
  323. }else if(cond1.replace(" ", "").equals("A975127FE24B4937945545301503B59E")){
  324. condition += "and DESCRIPTION ='032000' ";
  325. }else if(cond1.replace(" ", "").equals("BC82691B2E194E80AA3F4D16D7CF08A9")){
  326. condition += "and DESCRIPTION ='031500' ";
  327. }else if(cond1.replace(" ", "").equals("C697FA6F2FC645EBA181F4278F4BE733")){
  328. condition += "and DESCRIPTION ='030900' ";
  329. }else if(cond1.replace(" ", "").equals("D01A4DE3FB504EF095F6AF9B541042FE")){
  330. condition += "and DESCRIPTION ='030500' ";
  331. }else if(cond1.replace(" ", "").equals("D4CD8F9F43DD40B593FC85C74403AC65")){
  332. condition += "and DESCRIPTION ='030400' ";
  333. }else if(cond1.replace(" ", "").equals("EE6E74BCE5D34A928E32E71226BF31ED")){
  334. condition += "and DESCRIPTION ='031900' ";
  335. }else if(cond1.replace(" ", "").equals("F0ADFEDC8D3C413F865148A3E0C138B9")){
  336. condition += "and DESCRIPTION ='031700' ";
  337. }else if(cond1.replace(" ", "").equals("FCACDE74635E41ECB91162ED5186BA60")){
  338. condition += "and DESCRIPTION ='031400' ";
  339. }
  340. else{
  341. condition += " and OWNER_STATION IN (select base_org_id from sys_department where dept_path like'%"+cond1.replace(" ", "")+"%') ";
  342. }
  343. if(con.length-3>=0){
  344. convalue = convalue.substring(0,convalue.lastIndexOf("and"));
  345. convalue = convalue.substring(0,convalue.lastIndexOf("and"));
  346. condition += " and"+convalue;
  347. }
  348. String sql2 ="select MRID from (select a.MRID,rownum rn from (select MRID,DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" "+condition+" order by DESCRIPTION) a) where rn>= '"+start+"' and rn <= '"+end+"' ";
  349. //String sql2 ="select MRID from (select a.MRID,rownum rn from (select MRID,DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" order by DESCRIPTION) a) where rn>= '"+start+"' and rn <= '"+end+"' ";
  350. List<String[]>tempList2= persistence.getSearchResult(99, sql2.toString());
  351. for(int i=0;i<tempList2.size();i++){
  352. list.add(tempList2.get(i)[0]);
  353. }
  354. }catch(Exception e){
  355. this.log.error(e.getMessage(), e);
  356. }
  357. return list;
  358. }
  359. //获取每一行数据的统计数据
  360. public void getPlanNum(List<String>list,String id) throws PersistenceException{
  361. try{
  362. for(int i=0;i<list.size();i++){
  363. customerModel cn = new customerModel();
  364. String sql = "select "
  365. + "MRID,NAME,KIND,OWNER_STATION,IMPORT_LEVEL,VOLTAGE_CODE,AGREEMENT_CAPACITY,SECUIRITY_LOAD,IS_MEET_OF_SUPPLY,OWNED_SOURCE_CAPACITY,IS_MEET_OF_SELF_PROVIDE,DESCRIPTION"
  366. + " from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" where MRID='"+list.get(i)+"' order by DESCRIPTION ";
  367. List<String[]> numList1 = persistence.getSearchResult(99, sql.toString());
  368. String sql2 = "select POWERSUPPLY_LINE,SUPERIOR_SUBSTATION from \"NWYJ_SERVICE\".\"MDM_POWERSUPPLY\" where ORGANISATION_MRID='"+list.get(i)+"' ";
  369. List<String[]> numList2 = persistence.getSearchResult(99, sql2.toString());
  370. if(numList1.size()>0){
  371. cn.setFD_OBJECTID(numList1.get(0)[0]);
  372. cn.setCUSTOMER_NAME(numList1.get(0)[1].trim());
  373. cn.setCUSTOMER_KIND(getMapvaluecanstShow(numList1.get(0)[2],"BM_NWYJ_SERVICE_KIND"));
  374. cn.setOWNER_STATION(getCompIdShow(numList1.get(0)[3]));
  375. cn.setIMPORT_LEVEL(getImportLevel(numList1.get(0)[4]));
  376. //cn.setIMPORT_LEVEL(getMapvaluecanstShow(numList1.get(0)[4],"BM_NWYJ_SERVICE_IMPORT_LEVEL")); 这里转换了重要客户等级正式部署时放开这里,关闭上面那行代码
  377. cn.setVOLTAGE_CODE(getMapvaluecanstShow(numList1.get(0)[5],"BM_NWYJ_SERVICE_VOLTAGE"));
  378. cn.setAGREEMENT_CAPACITY(numList1.get(0)[6]);
  379. if("".equals(numList1.get(0)[7])||"null".equals(numList1.get(0)[7])||numList1.get(0)[7]==null){
  380. cn.setSECUIRITY_LOAD("");
  381. }else{
  382. cn.setSECUIRITY_LOAD(numList1.get(0)[7]);
  383. }
  384. if("0".equals(numList1.get(0)[8])){
  385. cn.setIS_MEET_OF_SUPPLY("否");
  386. }else if("1".equals(numList1.get(0)[8])){
  387. cn.setIS_MEET_OF_SUPPLY("是");
  388. }else{
  389. cn.setIS_MEET_OF_SUPPLY("");
  390. }
  391. if("".equals(numList1.get(0)[9])||"null".equals(numList1.get(0)[9])||numList1.get(0)[9]==null){
  392. cn.setOWNED_SOURCE_CAPACITY("");
  393. }else{
  394. cn.setOWNED_SOURCE_CAPACITY(numList1.get(0)[9]);
  395. }
  396. if("0".equals(numList1.get(0)[10])){
  397. cn.setIS_MEET_OF_SELF_PROVIDE("否");
  398. }else if("1".equals(numList1.get(0)[10])){
  399. cn.setIS_MEET_OF_SELF_PROVIDE("是");
  400. }else{
  401. cn.setIS_MEET_OF_SELF_PROVIDE("");
  402. }
  403. if("030600".equals(numList1.get(0)[11])){
  404. cn.setDESCRIPTION("佛山");
  405. }else if("032000".equals(numList1.get(0)[11])){
  406. cn.setDESCRIPTION("中山");
  407. }else if("031800".equals(numList1.get(0)[11])){
  408. cn.setDESCRIPTION("清远");
  409. }else if("030400".equals(numList1.get(0)[11])){
  410. cn.setDESCRIPTION("珠海");
  411. }else if("031700".equals(numList1.get(0)[11])){
  412. cn.setDESCRIPTION("阳江");
  413. }else if("030700".equals(numList1.get(0)[11])){
  414. cn.setDESCRIPTION("江门");
  415. }else if("030500".equals(numList1.get(0)[11])){
  416. cn.setDESCRIPTION("汕头");
  417. }else if("031900".equals(numList1.get(0)[11])){
  418. cn.setDESCRIPTION("东莞");
  419. }else if("031200".equals(numList1.get(0)[11])){
  420. cn.setDESCRIPTION("肇庆");
  421. }else if("035100".equals(numList1.get(0)[11])){
  422. cn.setDESCRIPTION("潮州");
  423. }else if("035200".equals(numList1.get(0)[11])){
  424. cn.setDESCRIPTION("揭阳");
  425. }else if("031400".equals(numList1.get(0)[11])){
  426. cn.setDESCRIPTION("梅州");
  427. }else if("031600".equals(numList1.get(0)[11])){
  428. cn.setDESCRIPTION("河源");
  429. }else if("035300".equals(numList1.get(0)[11])){
  430. cn.setDESCRIPTION("云浮");
  431. }else if("030200".equals(numList1.get(0)[11])){
  432. cn.setDESCRIPTION("韶关");
  433. }else if("031500".equals(numList1.get(0)[11])){
  434. cn.setDESCRIPTION("汕尾");
  435. }else if("030900".equals(numList1.get(0)[11])){
  436. cn.setDESCRIPTION("茂名");
  437. }else if("030800".equals(numList1.get(0)[11])){
  438. cn.setDESCRIPTION("湛江");
  439. }else if("031300".equals(numList1.get(0)[11])){
  440. cn.setDESCRIPTION("惠州");
  441. }
  442. if(numList2.size()>0){
  443. cn.setGDXL1(numList2.get(0)[0]);
  444. cn.setSJBDZ1(numList2.get(0)[1]);
  445. }
  446. if(numList2.size()>1){
  447. cn.setGDXL2(numList2.get(1)[0]);
  448. cn.setSJBDZ2(numList2.get(1)[1]);
  449. }
  450. if(numList2.size()>2){
  451. cn.setGDXL3(numList2.get(2)[0]);
  452. cn.setSJBDZ3(numList2.get(2)[1]);
  453. }
  454. if(numList2.size()>3){
  455. cn.setGDXL4(numList2.get(3)[0]);
  456. cn.setSJBDZ4(numList2.get(3)[1]);
  457. }
  458. if(numList2.size()>4){
  459. cn.setGDXL5(numList2.get(4)[0]);
  460. cn.setSJBDZ5(numList2.get(4)[1]);
  461. }
  462. if(numList2.size()>5){
  463. cn.setGDXL6(numList2.get(5)[0]);
  464. cn.setSJBDZ6(numList2.get(5)[1]);
  465. }
  466. numList.add(cn);
  467. json.append("{ ");
  468. json.append(" \"FD_OBJECTID\":\"" + cn.getFD_OBJECTID() + "\",");
  469. json.append(" \"CUSTOMER_NAME\":\"" + cn.getCUSTOMER_NAME() + "\",");
  470. json.append(" \"CUSTOMER_KIND\":\"" + cn.getCUSTOMER_KIND() + "\",");
  471. json.append(" \"OWNER_STATION\":\"" + cn.getOWNER_STATION() + "\",");
  472. json.append(" \"IMPORT_LEVEL\":\"" + cn.getIMPORT_LEVEL() + "\",");
  473. json.append(" \"VOLTAGE_CODE\":\"" + cn.getVOLTAGE_CODE() + "\",");
  474. json.append(" \"AGREEMENT_CAPACITY\":\"" + cn.getAGREEMENT_CAPACITY() + "\",");
  475. json.append(" \"SECUIRITY_LOAD\":\"" + cn.getSECUIRITY_LOAD() + "\",");
  476. json.append(" \"IS_MEET_OF_SUPPLY\":\"" + cn.getIS_MEET_OF_SUPPLY() + "\",");
  477. json.append(" \"OWNED_SOURCE_CAPACITY\":\"" + cn.getOWNED_SOURCE_CAPACITY() + "\",");
  478. json.append(" \"DESCRIPTION\":\"" + cn.getDESCRIPTION() + "\",");
  479. if(numList2.size()>1 && numList2.size()<3){
  480. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  481. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  482. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  483. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  484. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\"");
  485. }else if(numList2.size()>2 && numList2.size()<4){
  486. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  487. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  488. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  489. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  490. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  491. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  492. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\"");
  493. }else if(numList2.size()>3 && numList2.size()<5){
  494. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  495. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  496. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  497. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  498. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  499. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  500. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\",");
  501. json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\",");
  502. json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\"");
  503. }else if(numList2.size()>4 && numList2.size()<6){
  504. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  505. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  506. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  507. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  508. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  509. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  510. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\",");
  511. json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\",");
  512. json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\",");
  513. json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\",");
  514. json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\"");
  515. }else if(numList2.size()>5){
  516. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  517. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  518. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  519. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  520. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  521. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  522. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\",");
  523. json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\",");
  524. json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\",");
  525. json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\",");
  526. json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\",");
  527. json.append(" \"GDXL6\":\"" + cn.getGDXL6() + "\",");
  528. json.append(" \"SJBDZ6\":\"" + cn.getSJBDZ6() + "\"");
  529. }else if(numList2.size()>0){
  530. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  531. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  532. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\"");
  533. }else{
  534. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\"");
  535. }
  536. json.append("}, ");
  537. }
  538. }
  539. }catch(Exception e){
  540. this.log.error(e.getMessage(), e);
  541. }
  542. }
  543. //转换重要客户等级,临时用一下
  544. public String getImportLevel(String value){
  545. /***
  546. * 现在库表里的规则是:1、2、3、4的等级,将来正式的数据等级规则为:
  547. *
  548. * **/
  549. if(!"".equals(value)&&value!=null){
  550. if("1".equals(value)){
  551. value="特级重要用户";
  552. }else if("2".equals(value)){
  553. value="一级重要用户";
  554. }else if("3".equals(value)){
  555. value="二级重要用户";
  556. }
  557. }
  558. return value;
  559. }
  560. //获取客户供电单位名称(所有客户的)
  561. public String getCompIdShow(String id) {
  562. String list = "";
  563. try{
  564. String sql ="select * from SYS_DEPARTMENT where base_org_id ='"+id+"' ";
  565. // String sql2 ="select dept_name from SYS_DEPARTMENT where base_org_id ='"+id+"' ";
  566. String sql2 ="select DEPT_PATH_NAME from SYS_DEPARTMENT where base_org_id ='"+id+"' ";
  567. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  568. List<String[]>tempList2= persistence.getSearchResult(99, sql2.toString());
  569. log.info(tempList2.size());
  570. if(tempList==null||tempList.size()==0){
  571. return "";
  572. }else{
  573. list = tempList2.get(0)[0].toString();
  574. return list;
  575. }
  576. }catch(Exception e){
  577. this.log.error(e.getMessage(), e);
  578. return "";
  579. }
  580. }
  581. //常量表电压
  582. public String getMapvaluecanstShow(String id,String type) {
  583. String list = "";
  584. try{
  585. String sql ="select * from BM_MAPVALUECANST where FD_CODE ='"+id+"' and FD_TYPE ='"+type+"' ";
  586. String sql2 ="select FD_DESCRIPTION from BM_MAPVALUECANST where FD_CODE ='"+id+"' and FD_TYPE ='"+type+"' ";
  587. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  588. List<String[]>tempList2= persistence.getSearchResult(99, sql2.toString());
  589. log.info(tempList2.size());
  590. if(tempList==null||tempList.size()==0){
  591. return "";
  592. }else{
  593. list = tempList2.get(0)[0].toString();
  594. return list;
  595. }
  596. }catch(Exception e){
  597. this.log.error(e.getMessage(), e);
  598. return "";
  599. }
  600. }
  601. public String getCustomerId(String id){
  602. try {
  603. customerModel cn = new customerModel();
  604. String sql = "select "
  605. + "MRID,NAME,KIND,OWNER_STATION,IMPORT_LEVEL,VOLTAGE_CODE,AGREEMENT_CAPACITY,SECUIRITY_LOAD,IS_MEET_OF_SUPPLY,OWNED_SOURCE_CAPACITY,IS_MEET_OF_SELF_PROVIDE,DESCRIPTION"
  606. + " from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" where MRID='"+id+"' order by DESCRIPTION ";
  607. List<String[]> numList1 = persistence.getSearchResult(99, sql.toString());
  608. String sql2 = "select POWERSUPPLY_LINE,SUPERIOR_SUBSTATION from \"NWYJ_SERVICE\".\"MDM_POWERSUPPLY\" where ORGANISATION_MRID='"+id+"' ";
  609. List<String[]> numList2 = persistence.getSearchResult(99, sql2.toString());
  610. cn.setFD_OBJECTID(numList1.get(0)[0]);
  611. cn.setCUSTOMER_NAME(numList1.get(0)[1].trim());
  612. cn.setCUSTOMER_KIND(getMapvaluecanstShow(numList1.get(0)[2],"BM_NWYJ_SERVICE_KIND"));
  613. cn.setOWNER_STATION(getCompIdShow(numList1.get(0)[3]));
  614. cn.setIMPORT_LEVEL(getImportLevel(numList1.get(0)[4]));
  615. //cn.setIMPORT_LEVEL(getMapvaluecanstShow(numList1.get(0)[4],"BM_NWYJ_SERVICE_IMPORT_LEVEL")); 这里转换了重要客户等级正式部署时放开这里,关闭上面那行代码
  616. cn.setVOLTAGE_CODE(getMapvaluecanstShow(numList1.get(0)[5],"BM_NWYJ_SERVICE_VOLTAGE"));
  617. cn.setAGREEMENT_CAPACITY(numList1.get(0)[6]);
  618. if("".equals(numList1.get(0)[7])||"null".equals(numList1.get(0)[7])||numList1.get(0)[7]==null){
  619. cn.setSECUIRITY_LOAD("");
  620. }else{
  621. cn.setSECUIRITY_LOAD(numList1.get(0)[7]);
  622. }
  623. if("0".equals(numList1.get(0)[8])){
  624. cn.setIS_MEET_OF_SUPPLY("否");
  625. }else if("1".equals(numList1.get(0)[8])){
  626. cn.setIS_MEET_OF_SUPPLY("是");
  627. }else{
  628. cn.setIS_MEET_OF_SUPPLY("");
  629. }
  630. if("".equals(numList1.get(0)[9])||"null".equals(numList1.get(0)[9])||numList1.get(0)[9]==null){
  631. cn.setOWNED_SOURCE_CAPACITY("");
  632. }else{
  633. cn.setOWNED_SOURCE_CAPACITY(numList1.get(0)[9]);
  634. }
  635. if("0".equals(numList1.get(0)[10])){
  636. cn.setIS_MEET_OF_SELF_PROVIDE("否");
  637. }else if("1".equals(numList1.get(0)[10])){
  638. cn.setIS_MEET_OF_SELF_PROVIDE("是");
  639. }else{
  640. cn.setIS_MEET_OF_SELF_PROVIDE("");
  641. }
  642. if("030600".equals(numList1.get(0)[11])){
  643. cn.setDESCRIPTION("佛山");
  644. }else if("032000".equals(numList1.get(0)[11])){
  645. cn.setDESCRIPTION("中山");
  646. }else if("031800".equals(numList1.get(0)[11])){
  647. cn.setDESCRIPTION("清远");
  648. }else if("030400".equals(numList1.get(0)[11])){
  649. cn.setDESCRIPTION("珠海");
  650. }else if("031700".equals(numList1.get(0)[11])){
  651. cn.setDESCRIPTION("阳江");
  652. }else if("030700".equals(numList1.get(0)[11])){
  653. cn.setDESCRIPTION("江门");
  654. }else if("030500".equals(numList1.get(0)[11])){
  655. cn.setDESCRIPTION("汕头");
  656. }else if("031900".equals(numList1.get(0)[11])){
  657. cn.setDESCRIPTION("东莞");
  658. }else if("031200".equals(numList1.get(0)[11])){
  659. cn.setDESCRIPTION("肇庆");
  660. }else if("035100".equals(numList1.get(0)[11])){
  661. cn.setDESCRIPTION("潮州");
  662. }else if("035200".equals(numList1.get(0)[11])){
  663. cn.setDESCRIPTION("揭阳");
  664. }else if("031400".equals(numList1.get(0)[11])){
  665. cn.setDESCRIPTION("梅州");
  666. }else if("031600".equals(numList1.get(0)[11])){
  667. cn.setDESCRIPTION("河源");
  668. }else if("035300".equals(numList1.get(0)[11])){
  669. cn.setDESCRIPTION("云浮");
  670. }else if("030200".equals(numList1.get(0)[11])){
  671. cn.setDESCRIPTION("韶关");
  672. }else if("031500".equals(numList1.get(0)[11])){
  673. cn.setDESCRIPTION("汕尾");
  674. }else if("030900".equals(numList1.get(0)[11])){
  675. cn.setDESCRIPTION("茂名");
  676. }else if("030800".equals(numList1.get(0)[11])){
  677. cn.setDESCRIPTION("湛江");
  678. }else if("031300".equals(numList1.get(0)[11])){
  679. cn.setDESCRIPTION("惠州");
  680. }
  681. if(numList2.size()>0){
  682. cn.setGDXL1(numList2.get(0)[0]);
  683. cn.setSJBDZ1(numList2.get(0)[1]);
  684. }
  685. if(numList2.size()>1){
  686. cn.setGDXL2(numList2.get(1)[0]);
  687. cn.setSJBDZ2(numList2.get(1)[1]);
  688. }
  689. if(numList2.size()>2){
  690. cn.setGDXL3(numList2.get(2)[0]);
  691. cn.setSJBDZ3(numList2.get(2)[1]);
  692. }
  693. if(numList2.size()>3){
  694. cn.setGDXL4(numList2.get(3)[0]);
  695. cn.setSJBDZ4(numList2.get(3)[1]);
  696. }
  697. if(numList2.size()>4){
  698. cn.setGDXL5(numList2.get(4)[0]);
  699. cn.setSJBDZ5(numList2.get(4)[1]);
  700. }
  701. if(numList2.size()>5){
  702. cn.setGDXL6(numList2.get(5)[0]);
  703. cn.setSJBDZ6(numList2.get(5)[1]);
  704. }
  705. numList.add(cn);
  706. json.append("{ ");
  707. json.append(" \"FD_OBJECTID\":\"" + cn.getFD_OBJECTID() + "\",");
  708. json.append(" \"CUSTOMER_NAME\":\"" + cn.getCUSTOMER_NAME() + "\",");
  709. json.append(" \"CUSTOMER_KIND\":\"" + cn.getCUSTOMER_KIND() + "\",");
  710. json.append(" \"OWNER_STATION\":\"" + cn.getOWNER_STATION() + "\",");
  711. json.append(" \"IMPORT_LEVEL\":\"" + cn.getIMPORT_LEVEL() + "\",");
  712. json.append(" \"VOLTAGE_CODE\":\"" + cn.getVOLTAGE_CODE() + "\",");
  713. json.append(" \"AGREEMENT_CAPACITY\":\"" + cn.getAGREEMENT_CAPACITY() + "\",");
  714. json.append(" \"SECUIRITY_LOAD\":\"" + cn.getSECUIRITY_LOAD() + "\",");
  715. json.append(" \"IS_MEET_OF_SUPPLY\":\"" + cn.getIS_MEET_OF_SUPPLY() + "\",");
  716. json.append(" \"OWNED_SOURCE_CAPACITY\":\"" + cn.getOWNED_SOURCE_CAPACITY() + "\",");
  717. json.append(" \"DESCRIPTION\":\"" + cn.getDESCRIPTION() + "\",");
  718. if(numList2.size()>1 && numList2.size()<3){
  719. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  720. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  721. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  722. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  723. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\"");
  724. }else if(numList2.size()>2 && numList2.size()<4){
  725. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  726. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  727. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  728. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  729. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  730. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  731. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\"");
  732. }else if(numList2.size()>3 && numList2.size()<5){
  733. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  734. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  735. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  736. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  737. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  738. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  739. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\",");
  740. json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\",");
  741. json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\"");
  742. }else if(numList2.size()>4 && numList2.size()<6){
  743. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  744. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  745. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  746. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  747. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  748. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  749. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\",");
  750. json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\",");
  751. json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\",");
  752. json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\",");
  753. json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\"");
  754. }else if(numList2.size()>5){
  755. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  756. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  757. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\",");
  758. json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\",");
  759. json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\",");
  760. json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\",");
  761. json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\",");
  762. json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\",");
  763. json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\",");
  764. json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\",");
  765. json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\",");
  766. json.append(" \"GDXL6\":\"" + cn.getGDXL6() + "\",");
  767. json.append(" \"SJBDZ6\":\"" + cn.getSJBDZ6() + "\"");
  768. }else if(numList2.size()>0){
  769. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\",");
  770. json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\",");
  771. json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\"");
  772. }else{
  773. json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\"");
  774. }
  775. json.append("} ");
  776. } catch (PersistenceException e) {
  777. // TODO Auto-generated catch block
  778. e.printStackTrace();
  779. }
  780. String result=json.toString();
  781. log.info("result===="+result);
  782. return result;
  783. }
  784. /**
  785. * 导出用dao
  786. * @return
  787. * @throws PersistenceException
  788. */
  789. public String getCustomerInfoDao(String id) throws PersistenceException{
  790. try {
  791. List<String> list1 = new ArrayList<String>();
  792. String sql ="";
  793. if(id!=null && !"".equals(id)){
  794. sql ="select MRID from (select a.MRID,rownum rn from (select MRID from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" where MRID in ("+id+") ) a) ";
  795. }else{
  796. sql ="select MRID from (select a.MRID,rownum rn from (select MRID from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" ) a) ";
  797. }
  798. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  799. for(int i=0;i<tempList.size();i++){
  800. list1.add(tempList.get(i)[0]);
  801. }
  802. getPlanNum(list1,null);
  803. }catch (Exception e){
  804. this.log.error(e.getMessage(), e);
  805. }
  806. if (json.lastIndexOf(",") > -1) {
  807. json.deleteCharAt(json.lastIndexOf(","));
  808. }
  809. String result="["+json.toString()+"]";
  810. log.info("result===="+result);
  811. return result;
  812. }
  813. }