package com.sinosoft.am.customer.dao; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.persistence.service.PersistenceFactory; import com.persistence.service.SysPersistence; import com.persistence.service.exception.PersistenceException; import com.sinosoft.am.customer.vo.customerModel; import com.sysmodel.datamodel.xmlmodel.ModelFactory; import com.sysmodel.datamodel.xmlmodel.able.SysModel; public class customerModelDao2 { private Logger log = Logger.getLogger(this.getClass()); SysModel sysmodel = ModelFactory.getSysmodel(); SysPersistence persistence = PersistenceFactory.getInstance(sysmodel); StringBuffer json = new StringBuffer(); private List numList = new ArrayList(); /** * 获取横轴各单位名称2015-10-12 * @param list * @return */ /** * 根据传过来的ID进行检测,有子节点且子节点在明细表中有数据的,继续查询该节点下面的数据 * @param id * @return * @throws PersistenceException */ public String getCustomerInfoNumInit(String id,String firstPageNum,String limit,String convalue,String customername) throws PersistenceException{ try{ log.info("ID==="+id+",第一页===="+firstPageNum+",个数======"+limit); log.info(convalue); if(convalue.equals(" undefined")){ convalue = ""; } List list1 = new ArrayList(); ListtempList=getCmpList(new ArrayList(),firstPageNum,limit,id,convalue,customername); for(int i=0;i -1) { json.deleteCharAt(json.lastIndexOf(",")); } String condition = " where IMPORT_LEVEL='5' "; if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){ condition += ""; }else if(id.equals("1E5D688F639E48EBA0AEC8B057F2C06D")){ condition += "and DESCRIPTION ='035200' "; }else if(id.equals("2BF184BAA0CB4F6D821048FDE4612999")){ condition += "and DESCRIPTION ='030800' "; }else if(id.equals("304866F304E14890BDB073FEE15399EB")){ condition += "and DESCRIPTION ='035100' "; }else if(id.equals("38AA15A4AB314A708EE98733A9857023")){ condition += "and DESCRIPTION ='030700' "; }else if(id.equals("39419D104634467CA1A641E4CC1D8A21")){ condition += "and DESCRIPTION ='031200' "; }else if(id.equals("52548B9F88DB4BE98EDAED2A5F70371B")){ condition += "and DESCRIPTION ='031600' "; }else if(id.equals("52CBA051D490487DA2D1F258EB8F595D")){ condition += "and DESCRIPTION ='031800' "; }else if(id.equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){ condition += "and DESCRIPTION ='035300' "; }else if(id.equals("6D61CEB772AC4EA7B5CD805183C14806")){ condition += "and DESCRIPTION ='030600' "; }else if(id.equals("785F409051A84412A75E8E44FE3F5C6E")){ condition += "and DESCRIPTION ='031300' "; }else if(id.equals("A0FF45B5DD504A718F514172BA54C44B")){ condition += "and DESCRIPTION ='030200' "; }else if(id.equals("A975127FE24B4937945545301503B59E")){ condition += "and DESCRIPTION ='032000' "; }else if(id.equals("BC82691B2E194E80AA3F4D16D7CF08A9")){ condition += "and DESCRIPTION ='031500' "; }else if(id.equals("C697FA6F2FC645EBA181F4278F4BE733")){ condition += "and DESCRIPTION ='030900' "; }else if(id.equals("D01A4DE3FB504EF095F6AF9B541042FE")){ condition += "and DESCRIPTION ='030500' "; }else if(id.equals("D4CD8F9F43DD40B593FC85C74403AC65")){ condition += "and DESCRIPTION ='030400' "; }else if(id.equals("EE6E74BCE5D34A928E32E71226BF31ED")){ condition += "and DESCRIPTION ='031900' "; }else if(id.equals("F0ADFEDC8D3C413F865148A3E0C138B9")){ condition += "and DESCRIPTION ='031700' "; }else if(id.equals("FCACDE74635E41ECB91162ED5186BA60")){ condition += "and DESCRIPTION ='031400' "; }else{ 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+"')"; } if(!customername.equals("")){ // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){ // condition += " where name like '%"+customername+"%'"; // }else{ condition += " and name like '%"+customername+"%'"; // } } if(!convalue.equals("")){ // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")&&customername.equals("")){ // condition += " where "+convalue; // }else{ condition += " and "+convalue; // } condition = condition.substring(0,condition.lastIndexOf("and")); } String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" "+condition+" order by DESCRIPTION;"; log.info("sql======"+sql); ListtempList= persistence.getSearchResult(99, sql.toString()); log.info("getCmpList.tempList.size===="+tempList.size()); int totalPage = tempList.size(); String result="{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":["+json.toString()+"]}"; log.info("result===="+result); return result; } public String getCustomerInfoNumInit2(String id,String firstPageNum,String limit,String convalue,String customername) throws PersistenceException{ try{ log.info(convalue); List list1 = new ArrayList(); ListtempList=getCmpList2(new ArrayList(),firstPageNum,limit,id,convalue,customername); for(int i=0;i -1) { json.deleteCharAt(json.lastIndexOf(",")); } String[] con = convalue.split("and"); String cond = con[con.length-2]; String[] con1 = cond.split("="); String cond1 = con1[1]; log.info(cond1.replace(" ", "")); // String condition = " where OWNER_STATION IN (SELECT DISTINCT base_org_id FROM SYS_DEPARTMENT START WITH "+cond+" CONNECT BY PRIOR DEPT_ID=PARENT_ID)"; String condition = " where IMPORT_LEVEL='5' "; if(cond1.replace(" ", "").equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){ 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)) "; } else if(cond1.replace(" ", "").equals("1E5D688F639E48EBA0AEC8B057F2C06D")){ condition += "and DESCRIPTION ='035200' "; }else if(cond1.replace(" ", "").equals("2BF184BAA0CB4F6D821048FDE4612999")){ condition += "and DESCRIPTION ='030800' "; }else if(cond1.replace(" ", "").equals("304866F304E14890BDB073FEE15399EB")){ condition += "and DESCRIPTION ='035100' "; }else if(cond1.replace(" ", "").equals("38AA15A4AB314A708EE98733A9857023")){ condition += "and DESCRIPTION ='030700' "; }else if(cond1.replace(" ", "").equals("39419D104634467CA1A641E4CC1D8A21")){ condition += "and DESCRIPTION ='031200' "; }else if(cond1.replace(" ", "").equals("52548B9F88DB4BE98EDAED2A5F70371B")){ condition += "and DESCRIPTION ='031600' "; }else if(cond1.replace(" ", "").equals("52CBA051D490487DA2D1F258EB8F595D")){ condition += "and DESCRIPTION ='031800' "; }else if(cond1.replace(" ", "").equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){ condition += "and DESCRIPTION ='035300' "; }else if(cond1.replace(" ", "").equals("6D61CEB772AC4EA7B5CD805183C14806")){ condition += "and DESCRIPTION ='030600' "; }else if(cond1.replace(" ", "").equals("785F409051A84412A75E8E44FE3F5C6E")){ condition += "and DESCRIPTION ='031300' "; }else if(cond1.replace(" ", "").equals("A0FF45B5DD504A718F514172BA54C44B")){ condition += "and DESCRIPTION ='030200' "; }else if(cond1.replace(" ", "").equals("A975127FE24B4937945545301503B59E")){ condition += "and DESCRIPTION ='032000' "; }else if(cond1.replace(" ", "").equals("BC82691B2E194E80AA3F4D16D7CF08A9")){ condition += "and DESCRIPTION ='031500' "; }else if(cond1.replace(" ", "").equals("C697FA6F2FC645EBA181F4278F4BE733")){ condition += "and DESCRIPTION ='030900' "; }else if(cond1.replace(" ", "").equals("D01A4DE3FB504EF095F6AF9B541042FE")){ condition += "and DESCRIPTION ='030500' "; }else if(cond1.replace(" ", "").equals("D4CD8F9F43DD40B593FC85C74403AC65")){ condition += "and DESCRIPTION ='030400' "; }else if(cond1.replace(" ", "").equals("EE6E74BCE5D34A928E32E71226BF31ED")){ condition += "and DESCRIPTION ='031900' "; }else if(cond1.replace(" ", "").equals("F0ADFEDC8D3C413F865148A3E0C138B9")){ condition += "and DESCRIPTION ='031700' "; }else if(cond1.replace(" ", "").equals("FCACDE74635E41ECB91162ED5186BA60")){ condition += "and DESCRIPTION ='031400' "; } else{ condition += " and OWNER_STATION IN (select base_org_id from sys_department where dept_path like'%"+cond1.replace(" ", "")+"%') "; } if(con.length-3>=0){ convalue = convalue.substring(0,convalue.lastIndexOf("and")); convalue = convalue.substring(0,convalue.lastIndexOf("and")); condition += " and"+convalue; } String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" "+condition+" order by DESCRIPTION;"; log.info("sql===*********************************************************************************************************************************=="+sql); ListtempList= persistence.getSearchResult(99, sql.toString()); log.info("getCmpList.tempList.size===="+tempList.size()); int totalPage = tempList.size(); String result="{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":["+json.toString()+"]}"; log.info("result===="+result); return result; } //获取客户ID(所有客户的) public List getCmpList(Listlist,String pagenum,String limit,String id,String convalue,String customername) { try{ // String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" order by DESCRIPTION;"; // ListtempList= persistence.getSearchResult(99, sql.toString()); // log.info("getCmpList.tempList.size===="+tempList.size()); // int totalPage = tempList.size()/Integer.parseInt(limit); int start = 0; int end = 0; if((Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)>=0){ start=(Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)+1; end = Integer.parseInt(pagenum)*Integer.parseInt(limit); } String condition = " where IMPORT_LEVEL='5' "; if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){ condition += ""; }else if(id.equals("1E5D688F639E48EBA0AEC8B057F2C06D")){ condition += "and DESCRIPTION ='035200' "; }else if(id.equals("2BF184BAA0CB4F6D821048FDE4612999")){ condition += "and DESCRIPTION ='030800' "; }else if(id.equals("304866F304E14890BDB073FEE15399EB")){ condition += "and DESCRIPTION ='035100' "; }else if(id.equals("38AA15A4AB314A708EE98733A9857023")){ condition += "and DESCRIPTION ='030700' "; }else if(id.equals("39419D104634467CA1A641E4CC1D8A21")){ condition += "and DESCRIPTION ='031200' "; }else if(id.equals("52548B9F88DB4BE98EDAED2A5F70371B")){ condition += "and DESCRIPTION ='031600' "; }else if(id.equals("52CBA051D490487DA2D1F258EB8F595D")){ condition += "and DESCRIPTION ='031800' "; }else if(id.equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){ condition += "and DESCRIPTION ='035300' "; }else if(id.equals("6D61CEB772AC4EA7B5CD805183C14806")){ condition += "and DESCRIPTION ='030600' "; }else if(id.equals("785F409051A84412A75E8E44FE3F5C6E")){ condition += "and DESCRIPTION ='031300' "; }else if(id.equals("A0FF45B5DD504A718F514172BA54C44B")){ condition += "and DESCRIPTION ='030200' "; }else if(id.equals("A975127FE24B4937945545301503B59E")){ condition += "and DESCRIPTION ='032000' "; }else if(id.equals("BC82691B2E194E80AA3F4D16D7CF08A9")){ condition += "and DESCRIPTION ='031500' "; }else if(id.equals("C697FA6F2FC645EBA181F4278F4BE733")){ condition += "and DESCRIPTION ='030900' "; }else if(id.equals("D01A4DE3FB504EF095F6AF9B541042FE")){ condition += "and DESCRIPTION ='030500' "; }else if(id.equals("D4CD8F9F43DD40B593FC85C74403AC65")){ condition += "and DESCRIPTION ='030400' "; }else if(id.equals("EE6E74BCE5D34A928E32E71226BF31ED")){ condition += "and DESCRIPTION ='031900' "; }else if(id.equals("F0ADFEDC8D3C413F865148A3E0C138B9")){ condition += "and DESCRIPTION ='031700' "; }else if(id.equals("FCACDE74635E41ECB91162ED5186BA60")){ condition += "and DESCRIPTION ='031400' "; }else{ 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+"')"; } if(!customername.equals("")){ // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){ // condition += " where name like '%"+customername+"%'"; // }else{ condition += " and name like '%"+customername+"%'"; // } } if(!convalue.equals("")){ // if(id.equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")&&customername.equals("")){ // condition += " where "+convalue; // }else{ condition += " and "+convalue; // } condition = condition.substring(0,condition.lastIndexOf("and")); } 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+"' "; //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+"' "; ListtempList2= persistence.getSearchResult(99, sql2.toString()); for(int i=0;i getCmpList2(Listlist,String pagenum,String limit,String id,String convalue,String customername) { try{ // String sql="select distinct(MRID),DESCRIPTION from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" order by DESCRIPTION;"; // ListtempList= persistence.getSearchResult(99, sql.toString()); // log.info("getCmpList.tempList.size===="+tempList.size()); // int totalPage = tempList.size()/Integer.parseInt(limit); int start = 0; int end = 0; if((Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)>=0){ start=(Integer.parseInt(pagenum)-1)*Integer.parseInt(limit)+1; end = Integer.parseInt(pagenum)*Integer.parseInt(limit); } // String cond = convalue; // cond = cond.substring(0,cond.lastIndexOf(" and ")); String[] con = convalue.split("and"); String cond = con[con.length-2]; String[] con1 = cond.split("="); String cond1 = con1[1]; log.info(cond1); // String condition = " where OWNER_STATION IN (SELECT DISTINCT base_org_id FROM SYS_DEPARTMENT START WITH "+cond+" CONNECT BY PRIOR DEPT_ID=PARENT_ID)"; String condition = " where IMPORT_LEVEL='5' "; if(cond1.replace(" ", "").equals("8F6F2D6B24494CB6B1F1E0931E7AF87D")){ 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)) "; } else if(cond1.replace(" ", "").equals("1E5D688F639E48EBA0AEC8B057F2C06D")){ condition += "and DESCRIPTION ='035200' "; }else if(cond1.replace(" ", "").equals("2BF184BAA0CB4F6D821048FDE4612999")){ condition += "and DESCRIPTION ='030800' "; }else if(cond1.replace(" ", "").equals("304866F304E14890BDB073FEE15399EB")){ condition += "and DESCRIPTION ='035100' "; }else if(cond1.replace(" ", "").equals("38AA15A4AB314A708EE98733A9857023")){ condition += "and DESCRIPTION ='030700' "; }else if(cond1.replace(" ", "").equals("39419D104634467CA1A641E4CC1D8A21")){ condition += "and DESCRIPTION ='031200' "; }else if(cond1.replace(" ", "").equals("52548B9F88DB4BE98EDAED2A5F70371B")){ condition += "and DESCRIPTION ='031600' "; }else if(cond1.replace(" ", "").equals("52CBA051D490487DA2D1F258EB8F595D")){ condition += "and DESCRIPTION ='031800' "; }else if(cond1.replace(" ", "").equals("5A7BA8BD9D3D4C6E8A75B75F7C85FFA5")){ condition += "and DESCRIPTION ='035300' "; }else if(cond1.replace(" ", "").equals("6D61CEB772AC4EA7B5CD805183C14806")){ condition += "and DESCRIPTION ='030600' "; }else if(cond1.replace(" ", "").equals("785F409051A84412A75E8E44FE3F5C6E")){ condition += "and DESCRIPTION ='031300' "; }else if(cond1.replace(" ", "").equals("A0FF45B5DD504A718F514172BA54C44B")){ condition += "and DESCRIPTION ='030200' "; }else if(cond1.replace(" ", "").equals("A975127FE24B4937945545301503B59E")){ condition += "and DESCRIPTION ='032000' "; }else if(cond1.replace(" ", "").equals("BC82691B2E194E80AA3F4D16D7CF08A9")){ condition += "and DESCRIPTION ='031500' "; }else if(cond1.replace(" ", "").equals("C697FA6F2FC645EBA181F4278F4BE733")){ condition += "and DESCRIPTION ='030900' "; }else if(cond1.replace(" ", "").equals("D01A4DE3FB504EF095F6AF9B541042FE")){ condition += "and DESCRIPTION ='030500' "; }else if(cond1.replace(" ", "").equals("D4CD8F9F43DD40B593FC85C74403AC65")){ condition += "and DESCRIPTION ='030400' "; }else if(cond1.replace(" ", "").equals("EE6E74BCE5D34A928E32E71226BF31ED")){ condition += "and DESCRIPTION ='031900' "; }else if(cond1.replace(" ", "").equals("F0ADFEDC8D3C413F865148A3E0C138B9")){ condition += "and DESCRIPTION ='031700' "; }else if(cond1.replace(" ", "").equals("FCACDE74635E41ECB91162ED5186BA60")){ condition += "and DESCRIPTION ='031400' "; } else{ condition += " and OWNER_STATION IN (select base_org_id from sys_department where dept_path like'%"+cond1.replace(" ", "")+"%') "; } if(con.length-3>=0){ convalue = convalue.substring(0,convalue.lastIndexOf("and")); convalue = convalue.substring(0,convalue.lastIndexOf("and")); condition += " and"+convalue; } 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+"' "; //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+"' "; ListtempList2= persistence.getSearchResult(99, sql2.toString()); for(int i=0;ilist,String id) throws PersistenceException{ try{ for(int i=0;i numList1 = persistence.getSearchResult(99, sql.toString()); String sql2 = "select POWERSUPPLY_LINE,SUPERIOR_SUBSTATION from \"NWYJ_SERVICE\".\"MDM_POWERSUPPLY\" where ORGANISATION_MRID='"+list.get(i)+"' "; List numList2 = persistence.getSearchResult(99, sql2.toString()); if(numList1.size()>0){ cn.setFD_OBJECTID(numList1.get(0)[0]); cn.setCUSTOMER_NAME(numList1.get(0)[1]); cn.setCUSTOMER_KIND(getMapvaluecanstShow(numList1.get(0)[2],"BM_NWYJ_SERVICE_KIND")); cn.setOWNER_STATION(getCompIdShow(numList1.get(0)[3])); cn.setIMPORT_LEVEL(getImportLevel(numList1.get(0)[4])); //cn.setIMPORT_LEVEL(getMapvaluecanstShow(numList1.get(0)[4],"BM_NWYJ_SERVICE_IMPORT_LEVEL")); 这里转换了重要客户等级正式部署时放开这里,关闭上面那行代码 cn.setVOLTAGE_CODE(getMapvaluecanstShow(numList1.get(0)[5],"BM_NWYJ_SERVICE_VOLTAGE")); cn.setAGREEMENT_CAPACITY(numList1.get(0)[6]); if("".equals(numList1.get(0)[7])||"null".equals(numList1.get(0)[7])||numList1.get(0)[7]==null){ cn.setSECUIRITY_LOAD(""); }else{ cn.setSECUIRITY_LOAD(numList1.get(0)[7]); } if("0".equals(numList1.get(0)[8])){ cn.setIS_MEET_OF_SUPPLY("否"); }else if("1".equals(numList1.get(0)[8])){ cn.setIS_MEET_OF_SUPPLY("是"); }else{ cn.setIS_MEET_OF_SUPPLY(""); } if("".equals(numList1.get(0)[9])||"null".equals(numList1.get(0)[9])||numList1.get(0)[9]==null){ cn.setOWNED_SOURCE_CAPACITY(""); }else{ cn.setOWNED_SOURCE_CAPACITY(numList1.get(0)[9]); } if("0".equals(numList1.get(0)[10])){ cn.setIS_MEET_OF_SELF_PROVIDE("否"); }else if("1".equals(numList1.get(0)[10])){ cn.setIS_MEET_OF_SELF_PROVIDE("是"); }else{ cn.setIS_MEET_OF_SELF_PROVIDE(""); } if("030600".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("佛山"); }else if("032000".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("中山"); }else if("031800".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("清远"); }else if("030400".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("珠海"); }else if("031700".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("阳江"); }else if("030700".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("江门"); }else if("030500".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("汕头"); }else if("031900".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("东莞"); }else if("031200".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("肇庆"); }else if("035100".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("潮州"); }else if("035200".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("揭阳"); }else if("031400".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("梅州"); }else if("031600".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("河源"); }else if("035300".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("云浮"); }else if("030200".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("韶关"); }else if("031500".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("汕尾"); }else if("030900".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("茂名"); }else if("030800".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("湛江"); }else if("031300".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("惠州"); } if(numList2.size()>0){ cn.setGDXL1(numList2.get(0)[0]); cn.setSJBDZ1(numList2.get(0)[1]); } if(numList2.size()>1){ cn.setGDXL2(numList2.get(1)[0]); cn.setSJBDZ2(numList2.get(1)[1]); } if(numList2.size()>2){ cn.setGDXL3(numList2.get(2)[0]); cn.setSJBDZ3(numList2.get(2)[1]); } if(numList2.size()>3){ cn.setGDXL4(numList2.get(3)[0]); cn.setSJBDZ4(numList2.get(3)[1]); } if(numList2.size()>4){ cn.setGDXL5(numList2.get(4)[0]); cn.setSJBDZ5(numList2.get(4)[1]); } if(numList2.size()>5){ cn.setGDXL6(numList2.get(5)[0]); cn.setSJBDZ6(numList2.get(5)[1]); } numList.add(cn); json.append("{ "); json.append(" \"FD_OBJECTID\":\"" + cn.getFD_OBJECTID() + "\","); json.append(" \"CUSTOMER_NAME\":\"" + cn.getCUSTOMER_NAME() + "\","); json.append(" \"CUSTOMER_KIND\":\"" + cn.getCUSTOMER_KIND() + "\","); json.append(" \"OWNER_STATION\":\"" + cn.getOWNER_STATION() + "\","); json.append(" \"IMPORT_LEVEL\":\"" + cn.getIMPORT_LEVEL() + "\","); json.append(" \"VOLTAGE_CODE\":\"" + cn.getVOLTAGE_CODE() + "\","); json.append(" \"AGREEMENT_CAPACITY\":\"" + cn.getAGREEMENT_CAPACITY() + "\","); json.append(" \"SECUIRITY_LOAD\":\"" + cn.getSECUIRITY_LOAD() + "\","); json.append(" \"IS_MEET_OF_SUPPLY\":\"" + cn.getIS_MEET_OF_SUPPLY() + "\","); json.append(" \"OWNED_SOURCE_CAPACITY\":\"" + cn.getOWNED_SOURCE_CAPACITY() + "\","); json.append(" \"DESCRIPTION\":\"" + cn.getDESCRIPTION() + "\","); if(numList2.size()>1 && numList2.size()<3){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\""); }else if(numList2.size()>2 && numList2.size()<4){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\""); }else if(numList2.size()>3 && numList2.size()<5){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\","); json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\","); json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\""); }else if(numList2.size()>4 && numList2.size()<6){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\","); json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\","); json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\","); json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\","); json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\""); }else if(numList2.size()>5){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\","); json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\","); json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\","); json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\","); json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\","); json.append(" \"GDXL6\":\"" + cn.getGDXL6() + "\","); json.append(" \"SJBDZ6\":\"" + cn.getSJBDZ6() + "\""); }else if(numList2.size()>0){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\""); }else{ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\""); } json.append("}, "); } } }catch(Exception e){ this.log.error(e.getMessage(), e); } } //转换重要客户等级,临时用一下 public String getImportLevel(String value){ /*** * 现在库表里的规则是:1、2、3、4的等级,将来正式的数据等级规则为: * * **/ if(!"".equals(value)&&value!=null){ if("1".equals(value)){ value="特级重要用户"; }else if("2".equals(value)){ value="一级重要用户"; }else if("3".equals(value)){ value="二级重要用户"; } } return value; } //获取客户供电单位名称(所有客户的) public String getCompIdShow(String id) { String list = ""; try{ String sql ="select * from SYS_DEPARTMENT where base_org_id ='"+id+"' "; // String sql2 ="select dept_name from SYS_DEPARTMENT where base_org_id ='"+id+"' "; String sql2 ="select DEPT_PATH_NAME from SYS_DEPARTMENT where base_org_id ='"+id+"' "; ListtempList= persistence.getSearchResult(99, sql.toString()); ListtempList2= persistence.getSearchResult(99, sql2.toString()); log.info(tempList2.size()); if(tempList==null||tempList.size()==0){ return ""; }else{ list = tempList2.get(0)[0].toString(); return list; } }catch(Exception e){ this.log.error(e.getMessage(), e); return ""; } } //常量表电压 public String getMapvaluecanstShow(String id,String type) { String list = ""; try{ String sql ="select * from BM_MAPVALUECANST where FD_CODE ='"+id+"' and FD_TYPE ='"+type+"' "; String sql2 ="select FD_DESCRIPTION from BM_MAPVALUECANST where FD_CODE ='"+id+"' and FD_TYPE ='"+type+"' "; ListtempList= persistence.getSearchResult(99, sql.toString()); ListtempList2= persistence.getSearchResult(99, sql2.toString()); log.info(tempList2.size()); if(tempList==null||tempList.size()==0){ return ""; }else{ list = tempList2.get(0)[0].toString(); return list; } }catch(Exception e){ this.log.error(e.getMessage(), e); return ""; } } public String getCustomerId(String id){ try { customerModel cn = new customerModel(); String sql = "select " + "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" + " from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" where MRID='"+id+"' order by DESCRIPTION "; List numList1 = persistence.getSearchResult(99, sql.toString()); String sql2 = "select POWERSUPPLY_LINE,SUPERIOR_SUBSTATION from \"NWYJ_SERVICE\".\"MDM_POWERSUPPLY\" where ORGANISATION_MRID='"+id+"' "; List numList2 = persistence.getSearchResult(99, sql2.toString()); cn.setFD_OBJECTID(numList1.get(0)[0]); cn.setCUSTOMER_NAME(numList1.get(0)[1]); cn.setCUSTOMER_KIND(getMapvaluecanstShow(numList1.get(0)[2],"BM_NWYJ_SERVICE_KIND")); cn.setOWNER_STATION(getCompIdShow(numList1.get(0)[3])); cn.setIMPORT_LEVEL(getImportLevel(numList1.get(0)[4])); //cn.setIMPORT_LEVEL(getMapvaluecanstShow(numList1.get(0)[4],"BM_NWYJ_SERVICE_IMPORT_LEVEL")); 这里转换了重要客户等级正式部署时放开这里,关闭上面那行代码 cn.setVOLTAGE_CODE(getMapvaluecanstShow(numList1.get(0)[5],"BM_NWYJ_SERVICE_VOLTAGE")); cn.setAGREEMENT_CAPACITY(numList1.get(0)[6]); if("".equals(numList1.get(0)[7])||"null".equals(numList1.get(0)[7])||numList1.get(0)[7]==null){ cn.setSECUIRITY_LOAD(""); }else{ cn.setSECUIRITY_LOAD(numList1.get(0)[7]); } if("0".equals(numList1.get(0)[8])){ cn.setIS_MEET_OF_SUPPLY("否"); }else if("1".equals(numList1.get(0)[8])){ cn.setIS_MEET_OF_SUPPLY("是"); }else{ cn.setIS_MEET_OF_SUPPLY(""); } if("".equals(numList1.get(0)[9])||"null".equals(numList1.get(0)[9])||numList1.get(0)[9]==null){ cn.setOWNED_SOURCE_CAPACITY(""); }else{ cn.setOWNED_SOURCE_CAPACITY(numList1.get(0)[9]); } if("0".equals(numList1.get(0)[10])){ cn.setIS_MEET_OF_SELF_PROVIDE("否"); }else if("1".equals(numList1.get(0)[10])){ cn.setIS_MEET_OF_SELF_PROVIDE("是"); }else{ cn.setIS_MEET_OF_SELF_PROVIDE(""); } if("030600".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("佛山"); }else if("032000".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("中山"); }else if("031800".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("清远"); }else if("030400".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("珠海"); }else if("031700".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("阳江"); }else if("030700".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("江门"); }else if("030500".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("汕头"); }else if("031900".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("东莞"); }else if("031200".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("肇庆"); }else if("035100".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("潮州"); }else if("035200".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("揭阳"); }else if("031400".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("梅州"); }else if("031600".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("河源"); }else if("035300".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("云浮"); }else if("030200".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("韶关"); }else if("031500".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("汕尾"); }else if("030900".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("茂名"); }else if("030800".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("湛江"); }else if("031300".equals(numList1.get(0)[11])){ cn.setDESCRIPTION("惠州"); } if(numList2.size()>0){ cn.setGDXL1(numList2.get(0)[0]); cn.setSJBDZ1(numList2.get(0)[1]); } if(numList2.size()>1){ cn.setGDXL2(numList2.get(1)[0]); cn.setSJBDZ2(numList2.get(1)[1]); } if(numList2.size()>2){ cn.setGDXL3(numList2.get(2)[0]); cn.setSJBDZ3(numList2.get(2)[1]); } if(numList2.size()>3){ cn.setGDXL4(numList2.get(3)[0]); cn.setSJBDZ4(numList2.get(3)[1]); } if(numList2.size()>4){ cn.setGDXL5(numList2.get(4)[0]); cn.setSJBDZ5(numList2.get(4)[1]); } if(numList2.size()>5){ cn.setGDXL6(numList2.get(5)[0]); cn.setSJBDZ6(numList2.get(5)[1]); } numList.add(cn); json.append("{ "); json.append(" \"FD_OBJECTID\":\"" + cn.getFD_OBJECTID() + "\","); json.append(" \"CUSTOMER_NAME\":\"" + cn.getCUSTOMER_NAME() + "\","); json.append(" \"CUSTOMER_KIND\":\"" + cn.getCUSTOMER_KIND() + "\","); json.append(" \"OWNER_STATION\":\"" + cn.getOWNER_STATION() + "\","); json.append(" \"IMPORT_LEVEL\":\"" + cn.getIMPORT_LEVEL() + "\","); json.append(" \"VOLTAGE_CODE\":\"" + cn.getVOLTAGE_CODE() + "\","); json.append(" \"AGREEMENT_CAPACITY\":\"" + cn.getAGREEMENT_CAPACITY() + "\","); json.append(" \"SECUIRITY_LOAD\":\"" + cn.getSECUIRITY_LOAD() + "\","); json.append(" \"IS_MEET_OF_SUPPLY\":\"" + cn.getIS_MEET_OF_SUPPLY() + "\","); json.append(" \"OWNED_SOURCE_CAPACITY\":\"" + cn.getOWNED_SOURCE_CAPACITY() + "\","); json.append(" \"DESCRIPTION\":\"" + cn.getDESCRIPTION() + "\","); if(numList2.size()>1 && numList2.size()<3){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\""); }else if(numList2.size()>2 && numList2.size()<4){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\""); }else if(numList2.size()>3 && numList2.size()<5){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\","); json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\","); json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\""); }else if(numList2.size()>4 && numList2.size()<6){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\","); json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\","); json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\","); json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\","); json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\""); }else if(numList2.size()>5){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\","); json.append(" \"GDXL2\":\"" + cn.getGDXL2() + "\","); json.append(" \"SJBDZ2\":\"" + cn.getSJBDZ2() + "\","); json.append(" \"GDXL3\":\"" + cn.getGDXL3() + "\","); json.append(" \"SJBDZ3\":\"" + cn.getSJBDZ3() + "\","); json.append(" \"GDXL4\":\"" + cn.getGDXL4() + "\","); json.append(" \"SJBDZ4\":\"" + cn.getSJBDZ4() + "\","); json.append(" \"GDXL5\":\"" + cn.getGDXL5() + "\","); json.append(" \"SJBDZ5\":\"" + cn.getSJBDZ5() + "\","); json.append(" \"GDXL6\":\"" + cn.getGDXL6() + "\","); json.append(" \"SJBDZ6\":\"" + cn.getSJBDZ6() + "\""); }else if(numList2.size()>0){ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\","); json.append(" \"GDXL1\":\"" + cn.getGDXL1() + "\","); json.append(" \"SJBDZ1\":\"" + cn.getSJBDZ1() + "\""); }else{ json.append(" \"IS_MEET_OF_SELF_PROVIDE\":\"" + cn.getIS_MEET_OF_SELF_PROVIDE() + "\""); } json.append("} "); } catch (PersistenceException e) { // TODO Auto-generated catch block e.printStackTrace(); } String result=json.toString(); log.info("result===="+result); return result; } /** * 导出用dao * @return * @throws PersistenceException */ public String getCustomerInfoDao() throws PersistenceException{ try { List list1 = new ArrayList(); String sql ="select MRID from (select a.MRID,rownum rn from (select MRID from \"NWYJ_SERVICE\".\"MDM_CUSTOMER\" ) a) "; ListtempList= persistence.getSearchResult(99, sql.toString()); for(int i=0;i -1) { json.deleteCharAt(json.lastIndexOf(",")); } String result="["+json.toString()+"]"; log.info("result===="+result); return result; } }