e47db706e2a6408a2164525f336427a3a5867415.svn-base 142 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644
  1. package com.cockpit.service;
  2. import java.io.File;
  3. import java.io.FileOutputStream;
  4. import java.io.IOException;
  5. import java.io.OutputStream;
  6. import java.io.UnsupportedEncodingException;
  7. import java.sql.Date;
  8. import java.text.ParseException;
  9. import java.text.SimpleDateFormat;
  10. import java.util.ArrayList;
  11. import java.util.Collections;
  12. import java.util.HashMap;
  13. import java.util.Iterator;
  14. import java.util.List;
  15. import java.util.Map;
  16. import java.util.Set;
  17. import java.util.UUID;
  18. import javax.servlet.http.HttpServletRequest;
  19. import javax.ws.rs.GET;
  20. import javax.ws.rs.POST;
  21. import javax.ws.rs.Path;
  22. import javax.ws.rs.ProduceMime;
  23. import javax.ws.rs.core.Context;
  24. import net.sf.json.JSONArray;
  25. import net.sf.json.JSONException;
  26. import net.sf.json.JSONObject;
  27. import org.slf4j.LoggerFactory;
  28. import sun.misc.BASE64Decoder;
  29. import com.cockpit.dao.CockpitToolDao;
  30. import com.cockpit.dao.EarlyWarningResonseDao;
  31. import com.cockpit.dao.EmergencyDao;
  32. import com.cockpit.dao.EmergencyResourceDao;
  33. import com.cockpit.dao.EmergencyResponseDao;
  34. import com.cockpit.dao.OtherDao;
  35. import com.cockpit.dao.Tran;
  36. import com.cockpit.dao.TyphoonDao;
  37. import com.cockpit.util.CockpitUtil;
  38. import com.cockpit.util.ConfigManager;
  39. import com.cockpit.vo.Posi;
  40. import com.cockpit.vo.Progream;
  41. import com.cockpit.vo.SaveType;
  42. import com.cockpit.vo.SimulateTyphoon;
  43. import com.cockpit.vo.SimulateTyphoonInfo;
  44. import com.cockpit.vo.Yjzyincident;
  45. import com.formaction.Utils;
  46. import com.persistence.service.PersistenceFactory;
  47. import com.persistence.service.SysPersistence;
  48. import com.persistence.service.exception.PersistenceException;
  49. import com.sinosoft.am.org.dept.indept.busi.OrgInDeptBean;
  50. import com.sinosoft.am.org.dept.indept.vo.OrgInDeptVo;
  51. import com.sinosoft.cm.common.StringUtils;
  52. import com.sinosoft.cm.vo.Result;
  53. import com.sinosoft.common.util.JsonPluginsUtil;
  54. import com.sinosoft.nwyj.integration.hessian.GpsTaskWebService;
  55. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  56. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  57. /**
  58. * 驾驶舱服务类
  59. * @author zhumingyue
  60. *
  61. */
  62. @Path("/CockpitService/")
  63. public class CockpitService{
  64. @Context
  65. private org.apache.cxf.jaxrs.ext.MessageContext mc;
  66. private CockpitToolDao ctDao = new CockpitToolDao() ;
  67. private CockpitUtil cutil = new CockpitUtil();
  68. private EarlyWarningResonseDao ewerDao = new EarlyWarningResonseDao() ;//应急预警与响应
  69. private EmergencyResourceDao erDao = new EmergencyResourceDao() ;
  70. private EmergencyDao emerDao = new EmergencyDao() ;
  71. private TyphoonDao typhDao = new TyphoonDao();
  72. private OtherDao otherDao = new OtherDao();
  73. private Tran tran = new Tran();
  74. private GpsTaskWebService gpsTaskWebService=new GpsTaskWebService();
  75. private static final org.slf4j.Logger log = LoggerFactory.getLogger(CockpitService.class);
  76. //=====================================================应急预警与响应start======================================
  77. /**
  78. * 应急预警图标信息查询显示
  79. * @param params
  80. * @return
  81. */
  82. @POST
  83. @ProduceMime("application/")
  84. @Path("/getEwMarker/")
  85. public String getEwMarker(String params){
  86. log.info(params);
  87. String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  88. String warningNameStr = Utils.getParameter("BM_EMC_WarningName", params) ;//事件类别(预警类别)
  89. String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  90. String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  91. String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  92. String skew = Utils.getParameter("skew", params) ;//偏移
  93. String flg = Utils.getParameter("FLG", params) ;
  94. String init = "new_index = '1' and " ;
  95. if(this.verifyParams(flg)){
  96. init = "" ;
  97. }
  98. if(this.verifyParams(companyStr) && this.verifyParams(levelStr) && this.verifyParams(skew)){
  99. double skewing = Double.parseDouble(skew);
  100. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, a.CURRENT_EW_LEVEL, a.IS_ALERT, POS_X, POS_Y " +
  101. // "from (select t1.FD_OBJECTID,t1.release_unit, t1.EARLY_WARNING_NAME, " +
  102. // "t1.CURRENT_EW_LEVEL, t1.IS_ALERT,t1.is_send,t1.RELEASE_RELIEVE_DATE,ROW_NUMBER() " +
  103. // "over(partition by RELEASE_UNIT order by RELEASE_RELIEVE_DATE desc) as new_index " +
  104. // "from ECM_EM_PUBLISH_ALERT_NOTICE as t1 where t1.IS_ALERT = '0' and t1.is_del='0') as a " +
  105. // "left join ECM_CM_CITYCOORDIATE as b on a.RELEASE_UNIT = b.DEPT_ID " +
  106. // "where new_index = '1' and a.IS_SEND = '5' and a.IS_ALERT = '0' and b.DISPLAY_POSITION = '1' " ;
  107. // if(this.verifyParams(warningNameStr))
  108. // sql += this.getOneSqlWhereLike("EARLY_WARNING_NAME", warningNameStr) ;
  109. //
  110. String sql = "SELECT FD_OBJECTID, ICON_NAME, EARLY_WARNING_NAME, RELEASE_UNIT, DEPT_NAME, CURRENT_LEVEL, " +
  111. "RELEASE_RELIEVE_DATE, IS_ALERT, PLAN_TYPE_ID, POS_X, POS_Y FROM GIS_MARKER WHERE IS_ALERT = '0' " ;
  112. sql += this.getOneSqlWhere("RELEASE_UNIT", companyStr) ;
  113. sql += this.getOneSqlWhere("CURRENT_LEVEL", levelStr) ;
  114. if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  115. sql += "and (RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + " 00:00:00' AND '" + endTime +
  116. " 23:59:59')" ;
  117. // return isNullData(ewerDao.getEwrMarkerInfo(sql)) ;//得到全部
  118. return isNullData(ewerDao.getEwrMarkerInfoByOnlyDept(sql, skewing));//一个单位只得到一个
  119. }
  120. return null ;
  121. }
  122. /**
  123. * 应急预警/响应图标信息查询显示
  124. * @param params
  125. * @return
  126. */
  127. @POST
  128. @ProduceMime("application/")
  129. @Path("/getEwErMarker/")
  130. public String getEwErMarker(String params){
  131. log.info(params);
  132. String userName = Utils.getParameter("USER_NAME", params);
  133. String userId = Utils.getParameter("USER_ID", params);
  134. String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  135. String wulevel = Utils.getParameter("WULEVEL", params);//预警的单位级别
  136. String rulevel = Utils.getParameter("RULEVEL", params);//预警的单位级别
  137. String searchUnit = Utils.getParameter("SEARCH_UNIT", params);//查询单位
  138. String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  139. String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  140. String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  141. String skew = Utils.getParameter("SKEW", params) ;//偏移
  142. if(this.verifyParams(userName) && this.verifyParams(userId) && this.verifyParams(companyStr) &&
  143. this.verifyParams(skew) && this.verifyParams(wulevel) && this.verifyParams(rulevel)){
  144. double skewing = Double.parseDouble(skew);
  145. String sql = "SELECT * FROM ( " +
  146. "SELECT DISTINCT T1.CURRENT_EW_LEVEL CURRENT_LEVEL, T5.NAME ICON_NAME, T4.POS_X, T4.POS_Y, " +
  147. "T4.BPOS_X, T4.BPOS_Y, T1.FD_OBJECTID , T1.RELEASE_UNIT, T3.DEPT_NAME, T3.WSDX, " +
  148. "T1.EARLY_WARNING_NAME, T1.EARLY_WARNING_ID, T1.WETHER_EW_ADJUST, T1.PREV_EW_ID, " +
  149. "T1.PREV_EW_LEVEL, T1.MEET_EMERGENCIES_PLAN, T1.RELEASE_RELIEVE_DATE, T1.SENT_TIME, " +
  150. "T1.RELIEVE_DATE, T1.WRITE_DEPT, T1.WRITER, T1.WRITER_ID, T1.WRITE_TIME, T1.IS_DEL, " +
  151. "T1.CHECK_STATUS, T1.WARNING_RESPONSE_STATUS, T1.IS_SEND, T1.IS_LAST_ID, T1.IS_ALERT, " +
  152. "T1.PREV_ER_LEVEL, T1.IS_RELIEVE, T1.DISPOSE_PERSON, T1.EVENT_ID, T1.IS_SEEN " +
  153. "FROM ECM_EM_PUBLISH_ALERT_NOTICE T1 LEFT JOIN ECM_EM_TREATED_HUMAN T2 ON " +
  154. "T1.FD_OBJECTID=T2.BUSINESS_ID LEFT JOIN SYS_DEPARTMENT_WSDX_VIEW T3 ON " +
  155. "T1.RELEASE_UNIT = T3.DEPT_ID LEFT JOIN ECM_CM_CITYCOORDIATE T4 ON T3.DEPT_ID = T4.DEPT_ID " +
  156. "LEFT JOIN ECM_CM_GISICON T5 ON (T1.PLAN_TYPE_ID = T5.PLAN_TYPE_ID AND " +
  157. "T1.IS_ALERT = T5.IS_ALERT AND T1.CURRENT_EW_LEVEL = T5.TYPE)" +
  158. "WHERE T1.IS_DEL=0 AND IS_SEND !=6 AND T1.IS_ALERT=0 AND T4.IS_DEL = '0' " +
  159. "AND T4.DISPLAY_POSITION = '0' AND (( RELEASE_UNIT IN ( SELECT DEPT_ID FROM " +
  160. "SYS_DEPARTMENT_WSDX_VIEW WHERE PARENT_ID= '"+companyStr+"' ) AND IS_SEND =5 ) OR ( '" +
  161. companyStr+"' IN ( " +
  162. "SELECT DEPT_ID FROM SYS_DEPARTMENT_WSDX_VIEW WHERE SYS_DEPARTMENT_WSDX_VIEW.PARENT_ID = " +
  163. "T1.RELEASE_UNIT ) AND IS_SEND =5 )OR ( ( EARLY_WARNING_AREA_ID LIKE '%" + companyStr + "%' " +
  164. "OR WRITE_DEPT ='"+companyStr+"' ) AND IS_SEND =5 ) OR ( WRITE_DEPT='" + companyStr +
  165. "' AND WRITER='"+userName+"' OR ( release_unit='"+companyStr+"' AND T2.PERSON_ID='" + userId +
  166. "' ) AND T2.IS_DEL=0 AND IS_SEND IN('1', '3', '4') ) OR ( RELEASE_UNIT='" + companyStr +
  167. "' AND IS_SEND =5 )) AND WSDX IN ("+wulevel+") " +
  168. "union all( " +
  169. "SELECT DISTINCT T1.CURRENT_ER_LEVEL CURRENT_LEVEL, T5.NAME ICON_NAME, T4.POS_X, T4.POS_Y, " +
  170. "T4.BPOS_X, T4.BPOS_Y, T1.FD_OBJECTID , T1.RELEASE_UNIT, T3.DEPT_NAME, T3.WSDX, " +
  171. "T1.EARLY_WARNING_NAME, T1.EARLY_WARNING_ID, T1.WETHER_EW_ADJUST, T1.PREV_EW_ID, " +
  172. "T1.PREV_EW_LEVEL, T1.MEET_EMERGENCIES_PLAN, T1.RELEASE_RELIEVE_DATE, T1.SENT_TIME, " +
  173. "T1.RELIEVE_DATE, T1.WRITE_DEPT, T1.WRITER, T1.WRITER_ID, T1.WRITE_TIME, T1.IS_DEL, " +
  174. "T1.CHECK_STATUS, T1.WARNING_RESPONSE_STATUS, T1.IS_SEND, T1.IS_LAST_ID, " +
  175. "T1.IS_ALERT, T1.PREV_ER_LEVEL, T1.IS_RELIEVE, T1.DISPOSE_PERSON, T1.EVENT_ID, T1.IS_SEEN " +
  176. "FROM ECM_EM_PUBLISH_ALERT_NOTICE T1 LEFT JOIN ECM_EM_TREATED_HUMAN T2 ON " +
  177. "T1.FD_OBJECTID=T2.BUSINESS_ID LEFT JOIN SYS_DEPARTMENT_WSDX_VIEW T3 ON " +
  178. "T1.RELEASE_UNIT = T3.DEPT_ID LEFT JOIN ECM_CM_CITYCOORDIATE T4 ON T3.DEPT_ID = T4.DEPT_ID " +
  179. "LEFT JOIN ECM_CM_GISICON T5 ON (T1.IS_ALERT = T5.IS_ALERT AND T1.CURRENT_ER_LEVEL = T5.TYPE) " +
  180. "WHERE T1.IS_DEL=0 AND IS_SEND !=6 AND T1.IS_ALERT=1 AND T4.IS_DEL = '0' AND " +
  181. "T4.DISPLAY_POSITION = '0' AND (( RELEASE_UNIT IN (SELECT DEPT_ID FROM SYS_DEPARTMENT_WSDX_VIEW " +
  182. "WHERE PARENT_ID='"+companyStr+"' ) AND IS_SEND =5 ) OR ( '"+companyStr+"' IN ( SELECT DEPT_ID FROM " +
  183. "SYS_DEPARTMENT_WSDX_VIEW WHERE SYS_DEPARTMENT_WSDX_VIEW.PARENT_ID = T1.RELEASE_UNIT ) AND IS_SEND = 5 " +
  184. ")OR ( (EARLY_WARNING_AREA_ID LIKE '%"+companyStr+"%' OR WRITE_DEPT ='"+companyStr+"') AND IS_SEND =5) " +
  185. "OR ( WRITE_DEPT='"+companyStr+"' AND WRITER='"+userName+"') OR ( release_unit ='"+companyStr+"' " +
  186. "AND T2.PERSON_ID='"+userId+"' AND T2.IS_DEL=0 AND IS_SEND IN('1', '3', '4') )OR ( " +
  187. "RELEASE_UNIT='"+companyStr+"' AND IS_SEND =5 )) AND WSDX IN ("+rulevel+") ) " +
  188. "ORDER BY WRITE_TIME DESC) WHERE 1=1 " ;
  189. if(this.verifyParams(searchUnit)){
  190. // System.out.println(searchUnit);
  191. sql += cutil.getOneSqlWhere("RELEASE_UNIT", searchUnit);
  192. }
  193. if(this.verifyParams(levelStr)){
  194. // System.out.println(levelStr);
  195. sql += cutil.getOneSqlWhere("CURRENT_LEVEL", levelStr);
  196. }
  197. if(this.verifyParams(beginTime) && this.verifyParams(endTime)){
  198. sql += "and (WRITE_TIME BETWEEN '" + beginTime + "' AND '" + endTime + "')" ;
  199. }
  200. // System.out.println(sql);
  201. return isNullData(ewerDao.getEwrBWMarkerInfo(sql, skewing));//一个单位只得到一个
  202. }
  203. return null;
  204. }
  205. /**
  206. * 查询图例
  207. * @param params
  208. * @return
  209. */
  210. @POST
  211. @ProduceMime("application/json")
  212. @Path("/getLegend")
  213. public String getLegend(String params){
  214. log.info("params");
  215. String fd_id = Utils.getParameter("fdId", params);
  216. if(this.verifyParams(fd_id)){
  217. String sql = "select NAME,CHINA from ECM_CM_GISICON where LAYEROUT = ?" ;
  218. return otherDao.getLegend(sql,fd_id);
  219. }
  220. return null ;
  221. }
  222. /**
  223. * 应急响应图标信息查询显示
  224. * @param params
  225. * @return
  226. */
  227. @POST
  228. @ProduceMime("application/json")
  229. @Path("/getErMarker")
  230. public String getErMarker(String params){
  231. log.info(params);
  232. String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  233. String warningNameStr = Utils.getParameter("BM_EMC_WarningName", params) ;//事件类别(预警类别)
  234. String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  235. String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  236. String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  237. String skew = Utils.getParameter("skew", params);//偏移
  238. String flg = Utils.getParameter("FLG", params) ;
  239. String init = "new_index = '1' and " ;
  240. if(this.verifyParams(flg)){
  241. init = "" ;
  242. }
  243. if(this.verifyParams(companyStr) && this.verifyParams(levelStr) && this.verifyParams(skew)){
  244. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, a.CURRENT_ER_LEVEL, a.IS_ALERT, POS_X, POS_Y " +
  245. // "from (select t1.fd_objectid,t1.release_unit,t1.early_warning_name,t1.current_er_level, " +
  246. // "t1.is_alert,t1.is_send,t1.RELEASE_RELIEVE_DATE,ROW_NUMBER() " +
  247. // "over(partition by RELEASE_UNIT order by RELEASE_RELIEVE_DATE desc) as new_index " +
  248. // "from ECM_EM_PUBLISH_ALERT_NOTICE as t1 where t1.IS_ALERT = '1' and t1.is_del='0') as a " +
  249. // "left join ECM_CM_CITYCOORDIATE as b on a.RELEASE_UNIT = b.DEPT_ID " +
  250. // "where new_index = 1 and a.IS_SEND = '5' and a.IS_ALERT = '1' and b.DISPLAY_POSITION = '2' " ;
  251. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, d.DEPT_NAME, a.CURRENT_ER_LEVEL, a.IS_ALERT, " +
  252. // "POS_X, POS_Y, name from (select t1.fd_objectid,t1.release_unit, t1.early_warning_name, " +
  253. // "t1.current_er_level,t1.is_alert,t1.is_send,t1.RELEASE_RELIEVE_DATE,t1.PLAN_TYPE_ID, " +
  254. // "t1.RELEASE_UNIT,ROW_NUMBER() over( partition by RELEASE_UNIT order by " +
  255. // "RELEASE_RELIEVE_DATE desc)as new_index from ECM_EM_PUBLISH_ALERT_NOTICE as t1 " +
  256. // "where t1.IS_ALERT = '1' and t1.is_del='0') as a left join ECM_CM_CITYCOORDIATE " +
  257. // "as b on a.RELEASE_UNIT = b.DEPT_ID left join ECM_CM_GISICON as c on " +
  258. // "(a.is_alert = c.is_alert and a.current_er_level = c.type) left join SYS_DEPARTMENT " +
  259. // /*"as d on a.RELEASE_UNIT = d.dept_id where new_index = 1 and a.IS_SEND = '5' " +*/
  260. // "as d on a.RELEASE_UNIT = d.dept_id where " + init + "a.IS_SEND = '5' " +
  261. // "and a.IS_ALERT = '1' and b.DISPLAY_POSITION = '2' ";
  262. //
  263. //
  264. // if(this.verifyParams(warningNameStr))
  265. // sql += this.getOneSqlWhereLike("EARLY_WARNING_NAME", warningNameStr) ;
  266. double skewing = Double.parseDouble(skew);
  267. String sql = "SELECT FD_OBJECTID, ICON_NAME, EARLY_WARNING_NAME, RELEASE_UNIT, DEPT_NAME, CURRENT_LEVEL, " +
  268. "RELEASE_RELIEVE_DATE, IS_ALERT, PLAN_TYPE_ID, POS_X, POS_Y FROM GIS_MARKER WHERE IS_ALERT = '1' " ;
  269. sql += this.getOneSqlWhere("RELEASE_UNIT", companyStr) ;
  270. sql += this.getOneSqlWhere("CURRENT_LEVEL", levelStr) ;
  271. if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  272. sql += "and (RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + " 00:00:00' AND '" + endTime +
  273. " 23:59:59')" ;
  274. sql += " ORDER BY RELEASE_RELIEVE_DATE DESC ";
  275. // return isNullData(ewerDao.getEwrMarkerInfo(sql)) ;//得到全部
  276. return isNullData(ewerDao.getEwrMarkerInfoByOnlyDept(sql, skewing));//一个单位只得到一个
  277. }
  278. return null ;
  279. }
  280. // /**
  281. // * 应急预警图标信息查询显示(网省级)
  282. // * @param params
  283. // * @return
  284. // */
  285. // @POST
  286. // @ProduceMime("application/")
  287. // @Path("/getEwMarkerByProvince/")
  288. // public String getEwMarkerByProvince(String params){
  289. //
  290. // log.info(params);
  291. // String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  292. // String warningNameStr = Utils.getParameter("BM_EMC_WarningName", params) ;//事件类别(预警类别)
  293. // String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  294. // String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  295. // String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  296. //
  297. //
  298. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, a.CURRENT_EW_LEVEL, a.IS_ALERT, POS_X, POS_Y " +
  299. // "from (select t1.FD_OBJECTID,t1.release_unit, t1.EARLY_WARNING_NAME, " +
  300. // "t1.CURRENT_EW_LEVEL, t1.IS_ALERT,t1.is_send,t1.RELEASE_RELIEVE_DATE,ROW_NUMBER() " +
  301. // "over(partition by RELEASE_UNIT order by RELEASE_RELIEVE_DATE desc) as new_index " +
  302. // "from ECM_EM_PUBLISH_ALERT_NOTICE as t1 left join SYS_DEPARTMENT as t2 " +
  303. // "on t1.release_unit = t2.dept_id where t1.IS_ALERT = '0' and t1.is_del='0' " +
  304. // "and t2.parent_id = '1' and t2.parent_id = '0' and t2.dept_code is not null and t2.dept_code != '002') as a " +
  305. // "left join ECM_CM_CITYCOORDIATE as b on a.RELEASE_UNIT = b.DEPT_ID " +
  306. // "where new_index = '1' and a.IS_SEND = '5' and a.IS_ALERT = '0' and b.DISPLAY_POSITION = '1' " ;
  307. //
  308. // if(this.verifyParams(companyStr))
  309. // sql += this.getOneSqlWhere("RELEASE_UNIT", companyStr) ;
  310. // if(this.verifyParams(warningNameStr))
  311. // sql += this.getOneSqlWhereLike("EARLY_WARNING_NAME", warningNameStr) ;
  312. // if(this.verifyParams(levelStr))
  313. // sql += this.getOneSqlWhere("CURRENT_EW_LEVEL", levelStr) ;
  314. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  315. // sql += "and RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  316. //
  317. // System.out.println("查询应急预警图标(网省级)SQL:" + sql);
  318. // return isNullData(ewerDao.getEwrMarkerInfo(sql, "CURRENT_EW_LEVEL")) ;
  319. //
  320. // }
  321. //
  322. //
  323. //
  324. //
  325. // /**
  326. // * 应急响应图标信息查询显示(网省级)
  327. // * @param params
  328. // * @return
  329. // */
  330. // @POST
  331. // @ProduceMime("application/json")
  332. // @Path("/getErMarkerByProvince")
  333. // public String getErMarkerByProvince(String params){
  334. // log.info(params);
  335. // String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  336. // String warningNameStr = Utils.getParameter("BM_EMC_WarningName", params) ;//事件类别(预警类别)
  337. // String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  338. // String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  339. // String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  340. //
  341. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, a.CURRENT_ER_LEVEL, a.IS_ALERT, POS_X, POS_Y " +
  342. // "from (select t1.fd_objectid,t1.release_unit,t1.early_warning_name,t1.current_er_level, " +
  343. // "t1.is_alert,t1.is_send,t1.RELEASE_RELIEVE_DATE,ROW_NUMBER() " +
  344. // "over(partition by RELEASE_UNIT order by RELEASE_RELIEVE_DATE desc) as new_index " +
  345. // "from ECM_EM_PUBLISH_ALERT_NOTICE as t1 left join SYS_DEPARTMENT as t2 " +
  346. // "on t1.release_unit = t2.dept_id where t1.IS_ALERT = '1' and t1.is_del='0' " +
  347. // "and (t2.parent_id = '1' or t2.parent_id = '0') and t2.dept_code is not null and t2.dept_code != '002') as a " +
  348. // "left join ECM_CM_CITYCOORDIATE as b on a.RELEASE_UNIT = b.DEPT_ID " +
  349. // "where new_index = 1 and a.IS_SEND = '5' and a.IS_ALERT = '1' and b.DISPLAY_POSITION = '2' " ;
  350. //
  351. // if(this.verifyParams(companyStr))
  352. // sql += this.getOneSqlWhere("RELEASE_UNIT", companyStr) ;
  353. // if(this.verifyParams(warningNameStr))
  354. // sql += this.getOneSqlWhereLike("EARLY_WARNING_NAME", warningNameStr) ;
  355. // if(this.verifyParams(levelStr))
  356. // sql += this.getOneSqlWhere("CURRENT_ER_LEVEL", levelStr) ;
  357. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  358. // sql += "and RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  359. //
  360. // System.out.println("查询应急响应图标(网省级)SQL:" + sql);
  361. // return isNullData(ewerDao.getEwrMarkerInfo(sql,"CURRENT_ER_LEVEL")) ;
  362. //
  363. // }
  364. //
  365. // /**
  366. // * 应急预警图标信息查询显示(地市级)
  367. // * @param params
  368. // * @return
  369. // */
  370. // @POST
  371. // @ProduceMime("application/")
  372. // @Path("/getEwMarkerByPrefecture/")
  373. // public String getEwMarkerByPrefecture(String params){
  374. //
  375. // log.info(params);
  376. // String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  377. // String warningNameStr = Utils.getParameter("BM_EMC_WarningName", params) ;//事件类别(预警类别)
  378. // String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  379. // String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  380. // String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  381. //
  382. //
  383. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, a.CURRENT_EW_LEVEL, a.IS_ALERT, POS_X, POS_Y " +
  384. // "from (select t1.FD_OBJECTID,t1.release_unit, t1.EARLY_WARNING_NAME, " +
  385. // "t1.CURRENT_EW_LEVEL, t1.IS_ALERT,t1.is_send,t1.RELEASE_RELIEVE_DATE,ROW_NUMBER() " +
  386. // "over(partition by RELEASE_UNIT order by RELEASE_RELIEVE_DATE desc) as new_index " +
  387. // "from ECM_EM_PUBLISH_ALERT_NOTICE as t1 left join SYS_DEPARTMENT as t2 " +
  388. // "on t1.release_unit = t2.dept_id where t1.IS_ALERT = '0' and t1.is_del='0' " +
  389. // " and t2.parent_id != '1' and t2.parent_id != '0') as a " +
  390. // "left join ECM_CM_CITYCOORDIATE as b on a.RELEASE_UNIT = b.DEPT_ID " +
  391. // "where new_index = '1' and a.IS_SEND = '5' and a.IS_ALERT = '0' and b.DISPLAY_POSITION = '1' " ;
  392. //
  393. // if(this.verifyParams(companyStr))
  394. // sql += this.getOneSqlWhere("RELEASE_UNIT", companyStr) ;
  395. // if(this.verifyParams(warningNameStr))
  396. // sql += this.getOneSqlWhereLike("EARLY_WARNING_NAME", warningNameStr) ;
  397. // if(this.verifyParams(levelStr))
  398. // sql += this.getOneSqlWhere("CURRENT_EW_LEVEL", levelStr) ;
  399. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  400. // sql += "and RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  401. //
  402. // System.out.println("查询应急预警图标(地市级)SQL:" + sql);
  403. // return isNullData(ewerDao.getEwrMarkerInfo(sql, "CURRENT_EW_LEVEL")) ;
  404. //
  405. // }
  406. //
  407. // /**
  408. // * 应急响应图标信息查询显示(地市级)
  409. // * @param params
  410. // * @return
  411. // */
  412. // @POST
  413. // @ProduceMime("application/json")
  414. // @Path("/getErMarkerPrefecture/")
  415. // public String getErMarkerPrefecture(String params){
  416. // log.info(params);
  417. // String companyStr = Utils.getParameter("RELEASE_UNIT", params) ;//发布单位
  418. // String warningNameStr = Utils.getParameter("BM_EMC_WarningName", params) ;//事件类别(预警类别)
  419. // String levelStr = Utils.getParameter("LEVEL",params) ;//预警级别
  420. // String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  421. // String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  422. //
  423. // String sql = "select a.FD_OBJECTID, a.EARLY_WARNING_NAME, a.CURRENT_ER_LEVEL, a.IS_ALERT, POS_X, POS_Y " +
  424. // "from (select t1.fd_objectid,t1.release_unit,t1.early_warning_name,t1.current_er_level, " +
  425. // "t1.is_alert,t1.is_send,t1.RELEASE_RELIEVE_DATE,ROW_NUMBER() " +
  426. // "over(partition by RELEASE_UNIT order by RELEASE_RELIEVE_DATE desc) as new_index " +
  427. // "from ECM_EM_PUBLISH_ALERT_NOTICE as t1 left join SYS_DEPARTMENT as t2 " +
  428. // "on t1.release_unit = t2.dept_id where t1.IS_ALERT = '1' and t1.is_del='0' " +
  429. // "and t2.parent_id != '1' and t2.parent_id != '0') as a " +
  430. // "left join ECM_CM_CITYCOORDIATE as b on a.RELEASE_UNIT = b.DEPT_ID " +
  431. // "where new_index = 1 and a.IS_SEND = '5' and a.IS_ALERT = '1' and b.DISPLAY_POSITION = '2' " ;
  432. //
  433. // if(this.verifyParams(companyStr))
  434. // sql += this.getOneSqlWhere("RELEASE_UNIT", companyStr) ;
  435. // if(this.verifyParams(warningNameStr))
  436. // sql += this.getOneSqlWhereLike("EARLY_WARNING_NAME", warningNameStr) ;
  437. // if(this.verifyParams(levelStr))
  438. // sql += this.getOneSqlWhere("CURRENT_ER_LEVEL", levelStr) ;
  439. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  440. // sql += "and RELEASE_RELIEVE_DATE BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  441. //
  442. // System.out.println("查询应急响应图标(地市级)SQL:" + sql);
  443. // return isNullData(ewerDao.getEwrMarkerInfo(sql,"CURRENT_ER_LEVEL")) ;
  444. //
  445. // }
  446. //
  447. //======================康国前=======================================//
  448. /**
  449. * 预警与响应统计
  450. * @param params
  451. * @return
  452. */
  453. @POST
  454. @ProduceMime("application/json/")
  455. @Path("/getEmergencyResponseStatistics/")
  456. public String getEmergencyResponseStatistics(String params){
  457. String result = "{}";
  458. EmergencyResponseDao erDao = new EmergencyResponseDao();
  459. try {
  460. String comp = Utils.getParameter("comp", params) ;
  461. List<Map<String, String>> list = erDao.getEmergencyResponseStatistics(comp);
  462. result=StringUtils.resultToJSON(Result.STATE_SUCCESS, list.size(), StringUtils.listToJson(StringUtils.listToJson(list)));
  463. } catch (Exception e) {
  464. log.info(e.getMessage());
  465. result=StringUtils.resultToJSON(Result.STATE_FAILURE, 0, "查询失败");
  466. }finally{
  467. log.info("getDetailInfo返回前台数据=="+result);
  468. return result;
  469. }
  470. }
  471. /**
  472. * 预警或响应详细
  473. * @param params
  474. * @return
  475. */
  476. @POST
  477. @ProduceMime("application/json/")
  478. @Path("/queryCompDitaildata/")
  479. public String queryCompDitaildata(String params){
  480. String result = "{}";
  481. EmergencyResponseDao erDao = new EmergencyResponseDao();
  482. try {
  483. String comp = Utils.getParameter("comp", params) ;
  484. String is_alert = Utils.getParameter("is_alert", params) ;
  485. String is_huizong = Utils.getParameter("is_huizong", params) ;
  486. String culum = Utils.getParameter("culum", params) ;
  487. String level = Utils.getParameter("level", params) ;
  488. if(is_huizong != null&&"true".equals(is_huizong)){
  489. comp = " ( RELEASE_UNIT = '"+comp+"' or RELEASE_UNIT in ( select dept_id from sys_department where parent_id = '"+comp+"' )) ";
  490. }else{
  491. comp = " RELEASE_UNIT = '"+comp+"' ";
  492. }
  493. List<Map<String, String>> list = erDao.queryCompDitaildata(comp,is_alert,culum,level);
  494. result=StringUtils.resultToJSON(Result.STATE_SUCCESS, list.size(), StringUtils.listToJson(StringUtils.listToJson(list)));
  495. } catch (Exception e) {
  496. log.info(e.getMessage());
  497. result=StringUtils.resultToJSON(Result.STATE_FAILURE, 0, "查询失败");
  498. }finally{
  499. log.info("getDetailInfo返回前台数据=="+result);
  500. return result;
  501. }
  502. }
  503. //=============================================================//
  504. //===================================================应急预警与响应end======================================
  505. //===================================================应急资源start===============================================
  506. /**
  507. * 仓库图标位置(经纬度)查询显示
  508. * @param params
  509. * @return
  510. */
  511. @POST
  512. @ProduceMime("application/json/")
  513. @Path("/queryMareHouse/")
  514. public String queryMareHouse(String params){
  515. log.info(params);
  516. String hb = Utils.getParameter("hb", params);
  517. String ht = Utils.getParameter("ht", params);
  518. String hl = Utils.getParameter("hl", params);
  519. String gt = Utils.getParameter("gt", params);
  520. String sql = null ;
  521. if(this.verifyParams(hb) && this.verifyParams(ht)){
  522. sql = "SELECT OBJECT_ID CODE, WAREHOUSE_NAME NAME,LATITUDE LAT,LONGITUDE LON, " +
  523. "BELONGING_DEPARTMENT DEPT_NAME, CASE WAREHOUSE_BELONGING WHEN 'A' THEN '中国南方电网' " +
  524. "WHEN 'G' THEN '供应商' WHEN 'S' THEN '现场施工单位' END HB , CASE WAREHOUSE_TYPE " +
  525. "WHEN '1' THEN '室内' WHEN '2' THEN '露天' WHEN '3' THEN '组合仓库' END HT, CASE WAREHOUSE_LEVEL " +
  526. "WHEN '1' THEN '一级混合储备仓库' WHEN '11' THEN '一级报废物资仓库' " +
  527. "WHEN '12' THEN '一级智能计量仓库' WHEN '13' THEN '一级普通计量仓库' WHEN '14' THEN '区域物流平台' " +
  528. "WHEN '2' THEN '二级混合仓库' WHEN '3' THEN '急救包' WHEN '4' THEN '待定级' END HL, " +
  529. "CASE WAREHOUSE_TYPE WHEN '1' THEN 'indoor_house' WHEN '2' THEN 'outdoors_house' WHEN '3' " +
  530. "THEN 'comb_house' END ICON, " +
  531. "STORAGE_MATERIAL_TYPE GT, AREA_COVERED AC, ARCHITEC_AREA AA, DETAILED_ADDRESS ADDR, " +
  532. "WAREHOUSE_PRINCIPAL MAN FROM NWYJ_SERVICE.MM_WAREHOUSEINFO WHERE " +
  533. "WAREHOUSE_BELONGING = '" + hb + "' AND WAREHOUSE_TYPE = '" + ht + "' " ;
  534. }else{
  535. return null;
  536. }
  537. if(this.verifyParams(hl)){ sql += this.getOneSqlWhere("WAREHOUSE_LEVEL", hl); }
  538. if(this.verifyParams(gt)){ sql += this.getOneSqlWhereLike("STORAGE_MATERIAL_TYPE", gt); }
  539. return erDao.getMareHouse(sql) ;
  540. }
  541. /**
  542. * 仓库信息查询显示(根据ID查询)
  543. * @param params
  544. * @return
  545. */
  546. @POST
  547. @ProduceMime("application/json/")
  548. @Path("/queryMareHouseById/")
  549. public String queryMareHouseById(String params){
  550. log.info(params);
  551. String fd_id = Utils.getParameter("fd_id", params);
  552. String sql = null ;
  553. if(this.verifyParams(fd_id)){
  554. sql = "SELECT * , CASE WAREHOUSE_BELONGING WHEN 'A' THEN '中国南方电网' " +
  555. "WHEN 'G' THEN '供应商' WHEN 'S' THEN '现场施工单位' END WAREHOUSE_BELONGING_SHOW, " +
  556. "CASE WAREHOUSE_TYPE WHEN '1' THEN '室内' WHEN '2' THEN '露天' WHEN '3' " +
  557. "THEN '组合仓库' END WAREHOUSE_TYPE_SHOW, CASE WAREHOUSE_LEVEL WHEN '1' " +
  558. "THEN '一级混合储备仓库' WHEN '11' THEN '一级报废物资仓库' WHEN '12' THEN " +
  559. "'一级智能计量仓库' WHEN '13' THEN '一级普通计量仓库' WHEN '14' THEN '区域物流平台' " +
  560. "WHEN '2' THEN '二级混合仓库' WHEN '3' THEN '急救包' WHEN '4' THEN '待定级' " +
  561. "END WAREHOUSE_LEVEL_SHOW FROM NWYJ_SERVICE.MM_WAREHOUSEINFO " +
  562. "WHERE OBJECT_ID = ? " ;
  563. log.info("仓库信息查询显示(根据ID查询)SQL === " + sql + "; params: " + fd_id);
  564. return erDao.getMareHouseById(sql, fd_id) ;
  565. }else{
  566. return null;
  567. }
  568. }
  569. /**
  570. * 应急资源标注部门查询
  571. * @param params
  572. * @return
  573. */
  574. @POST
  575. @ProduceMime("application/json/")
  576. @Path("/querySubDept/")
  577. public String querySubDept(String params) {
  578. log.info(params) ;
  579. String comp = Utils.getParameter("unitId", params) ;
  580. String sql = "" ;
  581. StringBuffer sb = new StringBuffer() ;
  582. sb.append("{") ;
  583. if(verifyParams(comp)){
  584. int flg = this.wsdxDept(comp) ;//得到当前部门的标识12345网省地县其它
  585. List<String> deptList = new ArrayList<String>() ;
  586. if(flg == 1){
  587. deptList.add(comp);
  588. //得到省级Sql
  589. sql = "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  590. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '0' AND IS_DEL = '0' " +
  591. "AND DEPT_ID ='" + comp + "') ORDER BY SORT" ;
  592. deptList = erDao.subDeptIDs(sql) ;
  593. sb.append(this.getErMarkerJson("prov", deptList)) ;
  594. //得到市级SQL
  595. sql = "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  596. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  597. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '0' AND IS_DEL = '0' AND DEPT_ID = '" + comp +
  598. "'))AND DEPT_NAME LIKE '%供电局%' AND DEPT_ID IS NOT NULL ORDER BY SORT " ;
  599. deptList = erDao.subDeptIDs(sql) ;
  600. //得到县级SQL
  601. sql = "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  602. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  603. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  604. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '0' AND IS_DEL = '0' AND DEPT_ID = '" + comp + "' )" +
  605. ")AND DEPT_NAME LIKE '%供电局%')AND DEPT_NAME LIKE '%供电局%' ORDER BY SORT " ;
  606. deptList.addAll(erDao.subDeptIDs(sql)) ;
  607. sb.append(this.getErMarkerJson("pref", deptList)) ;
  608. sb.deleteCharAt(sb.length()-1) ;
  609. sb.append("}") ;
  610. } else if(flg == 2){
  611. sb.append("\"prov\":[\"" + comp + "\"],") ;
  612. sql = "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '" + comp + "'" +
  613. "AND DEPT_NAME LIKE '%供电局%' ORDER BY SORT " ;
  614. deptList = erDao.subDeptIDs(sql) ;
  615. sql = "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  616. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '" + comp + "'" +
  617. "AND DEPT_NAME LIKE '%供电局%')AND DEPT_NAME LIKE '%供电局%' AND DEPT_ID IS NOT NULL ORDER BY SORT " ;
  618. deptList.addAll(erDao.subDeptIDs(sql));
  619. sb.append(this.getErMarkerJson("pref", deptList)) ;
  620. sb.deleteCharAt(sb.length()-1) ;
  621. sb.append("}") ;
  622. } else if(flg == 3){
  623. deptList.add(comp) ;
  624. sql = "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID = '" + comp + "'" +
  625. "AND DEPT_NAME LIKE '%供电局%'" ;
  626. deptList.addAll(erDao.subDeptIDs(sql));
  627. sb.append(this.getErMarkerJson("pref", deptList)) ;
  628. sb.deleteCharAt(sb.length()-1) ;
  629. sb.append("}") ;
  630. } else {
  631. sb.append("\"pref\":[\"" + comp + "\"]}") ;
  632. }
  633. }
  634. log.info("部门查询SQL:"+sql);
  635. log.info("部门查询结果:"+sb.toString());
  636. // System.out.println(sb.toString());
  637. return sb.toString() ;
  638. }
  639. /**
  640. * 应急资源标注(三个圈)查询显示
  641. * @param params
  642. * @return
  643. */
  644. @POST
  645. @ProduceMime("application/json/")
  646. @Path("/queryErMarker/")
  647. public String queryErMarker(String params) {
  648. log.info(params) ;
  649. String classid = Utils.getParameter("classid", params) ;
  650. String comp = Utils.getParameter("unitId", params) ;
  651. String startDate = Utils.getParameter("startDate", params) ;
  652. String endDate = Utils.getParameter("endDate", params) ;
  653. StringBuffer sqlNative = new StringBuffer() ;
  654. StringBuffer sqlOther = new StringBuffer() ;
  655. Map<String, String> nativeSum = new HashMap<String, String>();
  656. Map<String, String> otherSum = new HashMap<String, String>() ;
  657. Map<String, String> xy = new HashMap<String, String>() ;
  658. String type = "" ;
  659. StringBuffer res = new StringBuffer() ;
  660. sqlOther.append("select sum(EQUIPMENT_NUMBER) as sum , dept as comp_id from (" +
  661. "select EQUIPMENT_NUMBER, dept from ECM_EM_EQUIPMENT_ALLOCATION " +
  662. "where is_del = '0' and IS_RELEASE = '1'") ;
  663. //查询发电机本地可调用资源
  664. if(verifyParams(classid) && classid.equals("266") && verifyParams(comp)){
  665. sqlNative.append("select sum(num) as sum ,comp_id from EMC_AM_GENERATOR " +
  666. "where is_del = '0' and IS_USED = '1'" + this.getOneSqlWhere("comp_id", comp) +
  667. "group by comp_id" ) ;
  668. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  669. //外部调用
  670. sqlOther.append(this.getOneSqlWhere("dept", comp) +
  671. "and DEPARTURE_TIME BETWEEN '" + startDate + "' AND '" + endDate + "' " +
  672. "and EQUIPMENT_NAME like '%发电机%' " +
  673. ") as a group by dept") ;
  674. otherSum = erDao.queryNativeGene(sqlOther.toString()) ;//外地资源数map
  675. String xySql = "select DEPT_ID, POS_X, POS_Y from ECM_CM_CITYCOORDIATE where 1=1 " + this.getOneSqlWhere("DEPT_ID", comp) ;
  676. xy = erDao.queryXYM(xySql) ;//得到部门
  677. type = "GENERATOR" ;
  678. }
  679. //查询发电车本地可调用资源以及城市坐标
  680. if(verifyParams(classid) && classid.equals("265") && verifyParams(comp)){
  681. sqlNative.append("select sum(car_num) as sum ,comp_id from EMC_AM_GENERATOR_CAR " +
  682. "where is_del = '0' and IS_USED = '1'" + this.getOneSqlWhere("comp_id", comp) +
  683. "group by comp_id" ) ;
  684. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  685. //外部调用
  686. sqlOther.append(this.getOneSqlWhere("dept", comp) +
  687. "and DEPARTURE_TIME BETWEEN '" + startDate + "' AND '" + endDate +
  688. "' and EQUIPMENT_NAME like '%发电车%' ) as a group by dept") ;
  689. otherSum = erDao.queryNativeGene(sqlOther.toString()) ;//外地资源数map
  690. String xySql = "select DEPT_ID, POS_X, POS_Y from ECM_CM_CITYCOORDIATE where 1=1 " + this.getOneSqlWhere("DEPT_ID", comp) ;
  691. xy = erDao.queryXYM(xySql) ;//得到部门
  692. type = "CAR" ;
  693. }
  694. //查询应急人员调用资源以及城市坐标(按人数)
  695. if(verifyParams(classid) && classid.equals("261") && verifyParams(comp)){
  696. // select sum(TEAM_MEMBER_NUMBER) as sum ,team_comp_id from ECM_AM_EMERGENCY_TEAM
  697. // where is_del = '0' and TEAM_STAT = '3'
  698. // group by team_comp_id ;
  699. sqlNative.append("select sum(TEAM_MEMBER_NUMBER) as sum ,team_comp_id as comp_id from ECM_AM_EMERGENCY_TEAM " +
  700. "where is_del = '0' and TEAM_STAT = '3'" + this.getOneSqlWhere("team_comp_id", comp) +
  701. "group by team_comp_id" ) ;
  702. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  703. //外部调用
  704. String so = "select sum(POPULATION) as sum , UNIT as comp_id from ( "+
  705. "select POPULATION, UNIT from ECM_EM_TEAM_UNIT "+
  706. "where is_del = '0' and CURRENT_STATE = '132' "+ this.getOneSqlWhere("UNIT", comp) +
  707. "and START_TIME BETWEEN '" + startDate + "' AND '" + endDate + "' "+
  708. ") as a group by UNIT " ;
  709. otherSum = erDao.queryNativeGene(so) ;//外地资源数map
  710. String xySql = "select DEPT_ID, POS_X, POS_Y from ECM_CM_CITYCOORDIATE where 1=1 " + this.getOneSqlWhere("DEPT_ID", comp) ;
  711. xy = erDao.queryXYM(xySql) ;//得到部门
  712. type = "TEAM" ;
  713. }
  714. Set<String> keySet = nativeSum.keySet() ;
  715. res.append("[") ;
  716. for(String key : keySet){
  717. if(otherSum.get(key)==null){
  718. res.append("{" + xy.get(key) + ",\"native\":" + nativeSum.get(key) +
  719. ",\"other\":0,\"insufficiency\":0,\"unit\":\"" + key + "\",\"startDate\":\"" + startDate +
  720. "\",\"endDate\":\"" + endDate + "\",\"type\":\"" + type + "\"},") ;
  721. } else {
  722. res.append("{" + xy.get(key) + ",\"native\":" + nativeSum.get(key) +
  723. ",\"other\":" + otherSum.get(key) + ",\"insufficiency\":0,\"unit\":\"" + key +
  724. "\",\"startDate\":\"" + startDate + "\",\"endDate\":\"" + endDate +
  725. "\",\"type\":\"" + type + "\"},") ;
  726. }
  727. }
  728. res.deleteCharAt(res.length() - 1) ;
  729. res.append("]") ;
  730. return isNullData(res.toString()) ;
  731. }
  732. //用户手绘图形查询(图形类)
  733. @POST
  734. @ProduceMime("application/json/")
  735. @Path("/queryDrawByUser/")
  736. public String queryDrawByUser(String params){
  737. log.info(params) ;
  738. String inicId = Utils.getParameter("inicId", params) ;
  739. String type = Utils.getParameter("type", params) ;
  740. String userId = Utils.getParameter("userId", params) ;
  741. if(this.verifyParams(inicId) && this.verifyParams(type)){
  742. String sql = "select t1.fd_objectid fd_id, longitude,latitude,radius,describeinfo,teamid, " +
  743. "row_number() over(partition by figureid order by num) as num " +
  744. "from ECM_CM_SAVETYPE as t1 left join ECM_CM_PROGREAMSAVE as t2 " +
  745. "on t1.fd_objectid = t2.figureid where t1.is_del = '0' and t2.is_del='0' " +
  746. "and innectid = ? and drowtype = ? and t1.user_id = ? " ;
  747. String res = erDao.queryDrawByUser(sql, inicId, type, userId) ;
  748. return res.length() < 15 ? null : res ;
  749. }
  750. return null ;
  751. }
  752. //用户手绘图形查询(图标类)
  753. @POST
  754. @ProduceMime("application/json/")
  755. @Path("/queryDrawByUserMarker/")
  756. public String queryDrawByUserMarker(String params){
  757. log.info(params) ;
  758. String inicId = Utils.getParameter("inicId", params) ;
  759. String type = Utils.getParameter("type", params) ;
  760. String userId = Utils.getParameter("userId", params) ;
  761. if(this.verifyParams(inicId) && this.verifyParams(type)){
  762. String sql = "select t1.fd_objectid fd_id, longitude,latitude,radius,describeinfo,teamid,name, " +
  763. "row_number() over(partition by figureid order by num) as num " +
  764. "from ECM_CM_SAVETYPE as t1 left join ECM_CM_PROGREAMSAVE as t2 " +
  765. "on t1.fd_objectid = t2.figureid left join ECM_CM_GISICON " +
  766. "as t3 on t1.DROWTYPE = t3.TYPE where t1.is_del = '0' and t2.is_del='0' " +
  767. "and innectid = ? and drowtype = ? and t1.user_id = ? " ;
  768. return erDao.queryDrawByUserMarker(sql, inicId, type, userId) ;
  769. }
  770. return null ;
  771. }
  772. // //用户手绘图形按图层保存以图层为单位进行整体保存
  773. // @POST
  774. // @ProduceMime("application/")
  775. // @Path("/createDrawByUser/")
  776. // public String createDrawByUser(String params){
  777. // log.info(params) ;
  778. // String inicId = Utils.getParameter("inicId", params) ;
  779. // String info = Utils.getParameter("info", params) ;
  780. // System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + info);
  781. // if(this.verifyParams(inicId) && this.verifyParams(info)){
  782. // return erDao.createDrawByUser(inicId, info) ;
  783. // }
  784. //
  785. // return null ;
  786. // }
  787. // //用户导入图层信息
  788. // @POST
  789. // @ProduceMime("application/json/")
  790. // @Path("/importDrawByUser/")
  791. // public String importDrawByUser(){
  792. // String sql = "select drawinfo from ECM_CM_DRAWINFOBYUSER " ;
  793. // String aa = erDao.importDrawByUser(sql) ;
  794. // System.out.println(aa);
  795. // return aa ;
  796. // }
  797. /**
  798. * 应急资源标注(三个圈)查询显示网省级
  799. * @param params
  800. * @return
  801. *//*
  802. @POST
  803. @ProduceMime("application/json/")
  804. @Path("/queryErMarkerProvince/")
  805. public String queryErMarkerProvince(String params) {
  806. log.info(params) ;
  807. String classid = Utils.getParameter("classid", params) ;
  808. String comp = Utils.getParameter("unitId", params) ;
  809. String startDate = Utils.getParameter("startDate", params) ;
  810. String endDate = Utils.getParameter("endDate", params) ;
  811. StringBuffer sqlNative = new StringBuffer() ;
  812. StringBuffer sqlOther = new StringBuffer() ;
  813. Map<String, String> nativeSum = new HashMap<String, String>();
  814. Map<String, String> otherSum = new HashMap<String, String>() ;
  815. Map<String, String> xy = new HashMap<String, String>() ;
  816. StringBuffer res = new StringBuffer() ;
  817. System.out.println("******************classid:"+classid+";comp:"+comp+";startDate:"+startDate+";endDate:"+endDate);
  818. sqlOther.append("select sum(EQUIPMENT_NUMBER) as sum , dept as comp_id from (" +
  819. "select EQUIPMENT_NUMBER, dept from ECM_EM_EQUIPMENT_ALLOCATION as t1 " +
  820. "left join SYS_DEPARTMENT as t2 on t1.dept = t2.dept_id " +
  821. "where t1.is_del = '0' and IS_RELEASE = '1' and( t2.parent_id = '1' or t2.parent_id = '0' ) " +
  822. "and t2.dept_code is not null and t2.dept_code != '002'") ;
  823. //查询发电机本地可调用资源
  824. if(verifyParams(classid) && classid.equals("266") && verifyParams(comp)){
  825. sqlNative.append("select sum(num) as sum ,comp_id from EMC_AM_GENERATOR " +
  826. "as t1 left join SYS_DEPARTMENT as t2 on t1.comp_id = t2.dept_id" +
  827. "where t1.is_del = '0' and IS_USED = '1'" +
  828. "and( t2.parent_id = '1' or t2.parent_id = '0' ) and t2.dept_code is not null " +
  829. "and t2.dept_code != '002' " + this.getOneSqlWhere("comp_id", comp) +
  830. "group by comp_id" ) ;
  831. System.out.println("本地发电机Sql(网省级): " + sqlNative.toString()) ;
  832. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  833. //外部调用
  834. sqlOther.append(this.getOneSqlWhere("dept", comp) +
  835. "and DEPARTURE_TIME BETWEEN '" + startDate + "' AND '" + endDate + "' " +
  836. "and EQUIPMENT_NAME like '%发电机%' " +
  837. ") as a group by dept") ;
  838. System.out.println("外部调用发电机Sql: " + sqlOther.toString());
  839. otherSum = erDao.queryNativeGene(sqlOther.toString()) ;//外地资源数map
  840. }
  841. //查询发电车本地可调用资源以及城市坐标
  842. if(verifyParams(classid) && classid.equals("265") && verifyParams(comp)){
  843. sqlNative.append("select sum(car_num) as sum ,comp_id from EMC_AM_GENERATOR_CAR as t1 " +
  844. "left join SYS_DEPARTMENT as t2 on t1.comp_id = t2.dept_id " +
  845. "where t1.is_del = '0' and IS_USED = '1' and( t2.parent_id = '1' or t2.parent_id = '0' ) " +
  846. "and t2.dept_code is not null and t2.dept_code != '002' " + this.getOneSqlWhere("comp_id", comp) +
  847. "group by comp_id" ) ;
  848. System.out.println("本地发电车SQL(网省级): "+sqlNative.toString());
  849. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  850. //外部调用
  851. sqlOther.append(this.getOneSqlWhere("dept", comp) +
  852. "and DEPARTURE_TIME BETWEEN '" + startDate + "' AND '" + endDate +
  853. "' and EQUIPMENT_NAME like '%发电车%' ) as a group by dept") ;
  854. System.out.println("外部调用 发电车SQL(网省级): "+sqlOther.toString());
  855. otherSum = erDao.queryNativeGene(sqlOther.toString()) ;//外地资源数map
  856. String xySql = "select DEPT_ID, POS_X, POS_Y from ECM_CM_CITYCOORDIATE where 1=1 " + this.getOneSqlWhere("DEPT_ID", comp) ;
  857. xy = erDao.queryXYM(xySql) ;//得到部门
  858. }
  859. Set<String> keySet = nativeSum.keySet() ;
  860. res.append("[") ;
  861. for(String key : keySet){
  862. if(otherSum.get(key)==null){
  863. res.append("{" + xy.get(key) + ",\"native\":" + nativeSum.get(key) +
  864. ",\"other\":0,\"insufficiency\":0},") ;
  865. } else {
  866. res.append("{" + xy.get(key) + ",\"native\":" + nativeSum.get(key) +
  867. ",\"other\":" + otherSum.get(key) + ",\"insufficiency\":0},") ;
  868. }
  869. }
  870. res.deleteCharAt(res.length() - 1) ;
  871. res.append("]") ;
  872. System.out.println("网省级应急资源标注结果: " + res.toString());
  873. return isNullData(res.toString()) ;
  874. }
  875. *//**
  876. * 应急资源标注(三个圈)查询显示地市级
  877. * @param params
  878. * @return
  879. *//*
  880. @POST
  881. @ProduceMime("application/json/")
  882. @Path("/queryErMarkerPrefecture/")
  883. public String queryErMarkerPrefecture(String params) {
  884. log.info(params) ;
  885. String classid = Utils.getParameter("classid", params) ;
  886. String comp = Utils.getParameter("unitId", params) ;
  887. String startDate = Utils.getParameter("startDate", params) ;
  888. String endDate = Utils.getParameter("endDate", params) ;
  889. StringBuffer sqlNative = new StringBuffer() ;
  890. StringBuffer sqlOther = new StringBuffer() ;
  891. Map<String, String> nativeSum = new HashMap<String, String>();
  892. Map<String, String> otherSum = new HashMap<String, String>() ;
  893. Map<String, String> xy = new HashMap<String, String>() ;
  894. StringBuffer res = new StringBuffer() ;
  895. sqlOther.append("select sum(EQUIPMENT_NUMBER) as sum , dept as comp_id from (" +
  896. "select EQUIPMENT_NUMBER, dept from ECM_EM_EQUIPMENT_ALLOCATION as t1 " +
  897. "left join SYS_DEPARTMENT as t2 on t1.dept = t2.dept_id " +
  898. "where t1.is_del = '0' and IS_RELEASE = '1' and t2.parent_id != '1' and t2.parent_id != '0'") ;
  899. //查询发电机本地可调用资源
  900. if(verifyParams(classid) && classid.equals("266") && verifyParams(comp)){
  901. sqlNative.append("select sum(num) as sum ,comp_id from EMC_AM_GENERATOR as t1 " +
  902. "left join SYS_DEPARTMENT as t2 on t1.comp_id = t2.dept_id " +
  903. "where t1.is_del = '0' and IS_USED = '1' and t2.parent_id != '1' and t2.parent_id != '0' " +
  904. this.getOneSqlWhere("comp_id", comp) + "group by comp_id" ) ;
  905. System.out.println("本地发电机Sql: " + sqlNative.toString()) ;
  906. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  907. //外部调用
  908. sqlOther.append(this.getOneSqlWhere("dept", comp) +
  909. "and DEPARTURE_TIME BETWEEN '" + startDate + "' AND '" + endDate + "' " +
  910. "and EQUIPMENT_NAME like '%发电机%' " +
  911. ") as a group by dept") ;
  912. System.out.println("外部调用发电机Sql: " + sqlOther.toString());
  913. otherSum = erDao.queryNativeGene(sqlOther.toString()) ;//外地资源数map
  914. }
  915. //查询发电车本地可调用资源以及城市坐标
  916. if(verifyParams(classid) && classid.equals("265") && verifyParams(comp)){
  917. sqlNative.append("select sum(car_num) as sum ,comp_id from EMC_AM_GENERATOR_CAR as t1 " +
  918. "left join SYS_DEPARTMENT as t2 on t1.comp_id = t2.dept_id " +
  919. "where t1.is_del = '0' and IS_USED = '1' and t2.parent_id != '1' " +
  920. "and t2.parent_id != '0' " + this.getOneSqlWhere("comp_id", comp) + "group by comp_id" ) ;
  921. System.out.println("本地发电车SQL"+sqlNative.toString());
  922. nativeSum = erDao.queryNativeGene(sqlNative.toString()) ;//本地资源数map
  923. //外部调用
  924. sqlOther.append(this.getOneSqlWhere("dept", comp) +
  925. "and DEPARTURE_TIME BETWEEN '" + startDate + "' AND '" + endDate +
  926. "' and EQUIPMENT_NAME like '%发电车%' ) as a group by dept") ;
  927. System.out.println("外部调用 发电车SQL"+sqlOther.toString());
  928. otherSum = erDao.queryNativeGene(sqlOther.toString()) ;//外地资源数map
  929. String xySql = "select DEPT_ID, POS_X, POS_Y from ECM_CM_CITYCOORDIATE where 1=1 " + this.getOneSqlWhere("DEPT_ID", comp) ;
  930. xy = erDao.queryXYM(xySql) ;//得到部门
  931. }
  932. Set<String> keySet = nativeSum.keySet() ;
  933. res.append("[") ;
  934. for(String key : keySet){
  935. if(otherSum.get(key)==null){
  936. res.append("{" + xy.get(key) + ",\"native\":" + nativeSum.get(key) +
  937. ",\"other\":0,\"insufficiency\":0},") ;
  938. } else {
  939. res.append("{" + xy.get(key) + ",\"native\":" + nativeSum.get(key) +
  940. ",\"other\":" + otherSum.get(key) + ",\"insufficiency\":0},") ;
  941. }
  942. }
  943. res.deleteCharAt(res.length() - 1) ;
  944. res.append("]") ;
  945. System.out.println("地市级应急资源标注SQL结果: " + res.toString());
  946. return isNullData(res.toString()) ;
  947. }
  948. */
  949. /**
  950. * 添加一组应急资源自定义图形参数信息ECM_CM_SAVETYPE
  951. * @param params
  952. * @return
  953. * @throws Exception
  954. */
  955. @POST
  956. @ProduceMime("/application/")
  957. @Path("/addDrawType/")
  958. public String addDrawType(String params){
  959. log.info(params) ;
  960. String data = Utils.getParameter("DATA", params) ;
  961. try{
  962. if(verifyParams(data)){
  963. params = java.net.URLDecoder.decode(data, "utf-8") ;
  964. List<SaveType> list = new ArrayList<SaveType>() ;
  965. list = JsonPluginsUtil.jsonToBeanList(params, SaveType.class) ;
  966. String fd_ids = erDao.createDrawType(list) ;
  967. return fd_ids ;
  968. }
  969. } catch (Exception e){ e.printStackTrace(); }
  970. return null ;
  971. }
  972. /**
  973. * 添加一组用户自定义图形坐标ECM_CM_PROGREAMSAVE
  974. * @param params
  975. * @return
  976. * @throws Exception
  977. */
  978. @POST
  979. @ProduceMime("/application/json/")
  980. @Path("/addDrawXY/")
  981. public String addDrawXY(String params){
  982. log.info(params) ;
  983. String data = Utils.getParameter("DATA", params) ;
  984. try{
  985. if(verifyParams(data)){
  986. params = java.net.URLDecoder.decode(data, "utf-8");
  987. List<Progream> list = new ArrayList<Progream>() ;
  988. list = JsonPluginsUtil.jsonToBeanList(params, Progream.class);
  989. String fd_ids = erDao.createProgream(list) ;
  990. return fd_ids ;
  991. }
  992. }catch(Exception e){ e.printStackTrace(); }
  993. return null ;
  994. }
  995. /**
  996. * 应急资源图层自定义图形坐标保存(批量)
  997. * @param params
  998. * @return
  999. * @throws Exception
  1000. */
  1001. @POST
  1002. @ProduceMime("application/")
  1003. @Path("/createDraw/")
  1004. public String createDraw(String params){
  1005. log.info(params);
  1006. try{
  1007. if(verifyParams(params)){
  1008. params = java.net.URLDecoder.decode(params, "utf-8");
  1009. List<Yjzyincident> list = new ArrayList<Yjzyincident>() ;
  1010. list = JsonPluginsUtil.jsonToBeanList(params, Yjzyincident.class);
  1011. String fd_ids = erDao.createDraw(list) ;
  1012. return fd_ids ;
  1013. }
  1014. }
  1015. catch (UnsupportedEncodingException e){ e.printStackTrace(); }
  1016. catch (Exception e){ e.printStackTrace(); }
  1017. return null ;
  1018. }
  1019. /**
  1020. * 查询应急队伍所执行应急事件实时传入的坐标路径
  1021. * @param params
  1022. * @return
  1023. */
  1024. @POST
  1025. @ProduceMime("application/json")
  1026. @Path("/queryTameLine/")
  1027. public String queryTameLine(String params){
  1028. log.info(params);
  1029. String inci = Utils.getParameter("inci", params) ;
  1030. String teamid = Utils.getParameter("teamid", params) ;
  1031. String beginTime = Utils.getParameter("beginTime", params) ; //开始时间
  1032. String endTime = Utils.getParameter("endTime", params) ; //截止时间
  1033. if(verifyParams(teamid)){
  1034. // String sqlToteam = "select team_id, team_name, incidentname, longitude, latitude, team_time, row_number() over " +
  1035. // "(partition by team_id order by team_time) as num from SYS_APP_TEAMER as t1 " +
  1036. // "left join ECM_AM_EMERGENCY_TEAM as t2 on t1.team_id = t2.fd_objectid " +
  1037. // "left join ECM_CM_YJZYINCIDENT as t3 on t1.inicid = t3.fd_objectid " +
  1038. // "where t1.is_del = '0' " + this.getOneSqlWhere("team_id", teamid) ;
  1039. String sqlToteam = "select team_id, team_name, early_warning_name incidentname, t1.longitude, t1.latitude, team_time, row_number() over " +
  1040. "(partition by team_id order by team_time) as num from SYS_APP_TEAMER as t1 " +
  1041. "left join ECM_AM_EMERGENCY_TEAM as t2 on t1.team_id = t2.fd_objectid " +
  1042. "left join ECM_EM_PUBLISH_ALERT_NOTICE as t3 on t1.inicid = t3.fd_objectid " +
  1043. "where t1.is_del = '0' " + this.getOneSqlWhere("team_id", teamid) ;
  1044. if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  1045. sqlToteam += "and team_time BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  1046. return erDao.queryTameLine(sqlToteam) ;
  1047. }else if (verifyParams(inci)){
  1048. // String sqlToInci = "select team_id, team_name, incidentname, longitude, latitude, team_time, row_number() over " +
  1049. // "(partition by team_id order by team_time) as num from SYS_APP_TEAMER as t1 " +
  1050. // "left join ECM_AM_EMERGENCY_TEAM as t2 on t1.team_id = t2.fd_objectid " +
  1051. // "left join ECM_CM_YJZYINCIDENT as t3 on t1.inicid = t3.fd_objectid " +
  1052. // "where t1.is_del = '0' " + this.getOneSqlWhere("inicid", inci) ;
  1053. String sqlToInci = "select team_id, team_name, early_warning_name t1.incidentname, t1.longitude, latitude, team_time, row_number() over " +
  1054. "(partition by team_id order by team_time) as num from SYS_APP_TEAMER as t1 " +
  1055. "left join ECM_AM_EMERGENCY_TEAM as t2 on t1.team_id = t2.fd_objectid " +
  1056. "left join ECM_EM_PUBLISH_ALERT_NOTICE as t3 on t1.inicid = t3.fd_objectid " +
  1057. "where t1.is_del = '0' " + this.getOneSqlWhere("inicid", inci) ;
  1058. if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  1059. sqlToInci += "and team_time BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  1060. return erDao.queryTameLine(sqlToInci) ;
  1061. }
  1062. return null ;
  1063. }
  1064. /**
  1065. * 查询应急队伍所执行应急事件实时传入的坐标路径
  1066. * @param params
  1067. * @return
  1068. */
  1069. @POST
  1070. @ProduceMime("application/json")
  1071. @Path("/queryTameLineById/")
  1072. public String queryTameLineById(String params){
  1073. log.info(params);
  1074. String teamid = Utils.getParameter("teamid", params) ;
  1075. String beginTime = Utils.getParameter("beginTime", params) ; //开始时间
  1076. String endTime = Utils.getParameter("endTime", params) ; //截止时间
  1077. if(verifyParams(teamid)){
  1078. Map<String, Posi> smap ;
  1079. Map<String, Posi> emap ;
  1080. //1.队伍开始
  1081. String StartSql = "SELECT LOCATION_TIME, FD_ID FROM (SELECT LOCATION_TIME, BUSINISS_ID FD_ID, " +
  1082. "ROW_NUMBER() OVER(PARTITION BY BUSINISS_ID ORDER BY LOCATION_TIME DESC) " +
  1083. "AS SORT FROM SYS_APP_USER_LOCATION WHERE IS_END = 'start' ) " +
  1084. "WHERE SORT = '1' AND FD_ID IN ('" + teamid + "')" ;
  1085. smap = erDao.getStartTimeByTeam(StartSql) ;
  1086. //2.队伍结束
  1087. String endSql = "SELECT LOCATION_TIME, FD_ID FROM (SELECT LOCATION_TIME, BUSINISS_ID FD_ID, " +
  1088. "ROW_NUMBER() OVER(PARTITION BY BUSINISS_ID ORDER BY LOCATION_TIME DESC) " +
  1089. "AS SORT FROM SYS_APP_USER_LOCATION WHERE IS_END = 'end' ) " +
  1090. "WHERE SORT = '1' AND FD_ID IN ('" + teamid + "')" ;
  1091. emap = erDao.getEndTimeByTeam(endSql) ;
  1092. //3.得到队伍时间段
  1093. List<Posi> list = erDao.getTimeByTeam(smap,emap);
  1094. String sql = "(SELECT LOCATION_TIME, T1.LONGITUDE LON, T1.LATITUDE LAT, BUSINISS_ID FD_ID, " +
  1095. "ISNULL(POPULATION,'0') MENNUM, T4.FD_OBJECTID INICID, CASE MAJOR WHEN '124' " +
  1096. "THEN '输电' WHEN '125' THEN '变电' WHEN '126' THEN '配电' WHEN '127' THEN '通信' " +
  1097. "WHEN '128' THEN '网络信息' WHEN '129' THEN '试验' WHEN '130' THEN '其他' ELSE '' " +
  1098. "END MAJOR, ISNULL(STATR_PLACE,'没有查到该队伍调拨信息') STATRPLACE, ISNULL(DEST, " +
  1099. "'没有查到该队伍调拨信息') DEST, ISNULL(TASK_NAME,'没有查到该队伍调拨信息') TNAME, " +
  1100. "ISNULL(TEAM_NAME,'') NAME, ROW_NUMBER() OVER(PARTITION BY BUSINISS_ID ORDER BY " +
  1101. "LOCATION_TIME) AS SORT FROM SYS_APP_USER_LOCATION T1 LEFT JOIN ECM_AM_EMERGENCY_TEAM " +
  1102. "T2 ON T1.BUSINISS_ID = T2.FD_OBJECTID LEFT JOIN NWYJ.ECM_EM_TEAM_UNIT T3 ON " +
  1103. "T1.BUSINISS_ID = T3.TEAM_NEAM LEFT JOIN ECM_EM_TEAM_WRR T4 ON T3.DEMAND_ID = " +
  1104. "T4.FD_OBJECTID WHERE T1.IS_DEL = '0' AND T2.IS_DEL = '0' " ;
  1105. String asql = "" ;
  1106. for(Posi posi:list){
  1107. String blu = "AND BUSINISS_ID = '" + posi.getFD_ID() + "' " +
  1108. "AND LOCATION_TIME BETWEEN '" + posi.getStartDate() + "' AND '" +
  1109. posi.getEndDate() + "' )UNION ALL";
  1110. asql += sql + blu;
  1111. }
  1112. asql = asql.substring(0,asql.length()-9);
  1113. return erDao.queryTameLineById(asql) ;
  1114. }
  1115. return null ;
  1116. }
  1117. //根据图形ID逻辑删除图形(两张表)
  1118. @POST
  1119. @ProduceMime("application/")
  1120. @Path("/delDrawUserDefined/")
  1121. public String delDrawUserDefined(String params) {
  1122. log.info(params);
  1123. if(verifyParams(params)){
  1124. if( erDao.delUserDefinedToType(this.trunList(params))&&
  1125. erDao.delUserDefinedToProgreamsave(this.trunList(params)) ){
  1126. return "true" ;
  1127. }
  1128. return null ;
  1129. }
  1130. return null ;
  1131. }
  1132. //===================================================应急资源end===============================================
  1133. /* @POST
  1134. @ProduceMime("application/json/")
  1135. @Path("/queryEr/")
  1136. public String queryEr(String params){
  1137. log.info(params);
  1138. String dept_id = Utils.getParameter("deptId", params) ;
  1139. if(this.verifyParams(dept_id)){
  1140. int flg = this.userDeptLevel(dept_id) ;
  1141. }
  1142. return null ;
  1143. }*/
  1144. /*//应急队伍坐标获取 未完成
  1145. @POST
  1146. @ProduceMime("application/json/")
  1147. @Path("/queryEmTeam/")
  1148. public String queryEmTeam(String params){
  1149. String sql = "" ;
  1150. String result = "" ;
  1151. return isNullData(result) ;
  1152. }*/
  1153. /*//应急资源图层添加事件的名称校验查询返回1为存在,0为不存在
  1154. @POST
  1155. @ProduceMime("/application/")
  1156. @Path("/verifyIncidentName/")
  1157. public String verifyIncidentName(String params){
  1158. log.info(params) ;
  1159. String condition = Utils.getParameter("Condi", params) ;
  1160. if(verifyParams(condition)){
  1161. return erDao.existIncidentName(condition) ;
  1162. }
  1163. return "1" ;
  1164. }
  1165. */
  1166. /*//应急资源图层添加事件
  1167. @POST
  1168. @ProduceMime("/application/")
  1169. @Path("/addIncidentName/")
  1170. public String addIncidentName(String params){
  1171. log.info(params) ;
  1172. String condition = Utils.getParameter("Condi", params) ;
  1173. String fd_id = "" ;
  1174. if(verifyParams(condition)){
  1175. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
  1176. String date = df.format(new Date()) ;
  1177. System.out.println(date);
  1178. //1.先添加事件,并得到FD_OBJECTID
  1179. String incidentSql = "insert into ECM_CM_YJZYINCIDENT values (?,?,'0','" + date + "')" ;
  1180. fd_id = erDao.addIncident(incidentSql, condition) ;
  1181. if(fd_id.equals(null))
  1182. return null ;
  1183. }
  1184. return fd_id ;
  1185. }*/
  1186. //应急资源自定义图形查询
  1187. @POST
  1188. @ProduceMime("/application/json/")
  1189. @Path("/getDrawInfo/")
  1190. public String getDrawInfo(String params){
  1191. log.info(params) ;
  1192. String innectId = Utils.getParameter("INNECTID", params) ;
  1193. if(verifyParams(innectId)){
  1194. String getDrawsSql = "select b.fd_objectid,b.drowtype from ECM_CM_YJZYINCIDENT as a " +
  1195. "left join ECM_CM_SAVETYPE as b " +
  1196. "on b.innectid = a.fd_objectid where a.fd_objectid='" + innectId + "' and a.is_del='0'" ;
  1197. String getXYSql ;
  1198. StringBuffer sb = new StringBuffer() ;
  1199. sb.append("[") ;
  1200. Map<String,String> draws = erDao.getDrawsSql(getDrawsSql) ;
  1201. Set<String> set = draws.keySet();
  1202. for(Iterator<String> iter = set.iterator(); iter.hasNext();){
  1203. String key = (String)iter.next();
  1204. String value = (String)draws.get(key);
  1205. getXYSql = "select longitude, latitude from ECM_CM_PROGREAMSAVE " +
  1206. "where is_del = '0' AND FIGUREID ='" + key + "' order by num " ;
  1207. sb.append("{\"type\":\"" + value + "\",\"point\":" + erDao.getDrawXY(getXYSql) + "},") ;
  1208. }
  1209. sb.deleteCharAt(sb.length() - 1) ;
  1210. sb.append("]") ;
  1211. return isNullData(sb.toString()) ;
  1212. }
  1213. return null ;
  1214. }
  1215. //应急资源自定义图形坐标查询从启动转换为添加
  1216. @POST
  1217. @ProduceMime("/application/json/")
  1218. @Path("/getDrawPoints/")
  1219. public String getDrawPoints(String params){
  1220. log.info(params) ;
  1221. String ids = Utils.getParameter("ids", params) ;
  1222. if(verifyParams(ids)){
  1223. String sql = "select figureid,longitude,latitude,num,row_number()over(partition by figureid order by num) " +
  1224. "from ECM_CM_PROGREAMSAVE " +
  1225. "where is_del='0' " + getOneSqlWhere("figureid",ids) ;
  1226. StringBuffer sb = new StringBuffer() ;
  1227. Map<String,String> draws = erDao.getDrawPoints(sql) ;
  1228. Set<String> set = draws.keySet() ;
  1229. sb.append("[") ;
  1230. for(Iterator<String> iter = set.iterator(); iter.hasNext();){
  1231. String key = (String)iter.next() ;
  1232. String value = (String)draws.get(key) ;
  1233. sb.append("{\"fid\":\"" + key + "\",\"point\":" + value + "},") ;
  1234. }
  1235. sb.deleteCharAt(sb.length()-1) ;
  1236. sb.append("]") ;
  1237. return this.isNullData(sb.toString()) ;
  1238. }
  1239. return null ;
  1240. }
  1241. /**
  1242. * 查询事件类型
  1243. * @return
  1244. */
  1245. @POST
  1246. @ProduceMime("application/")
  1247. @Path("/queryIncidentType/")
  1248. public String queryIncidentType(){
  1249. String sql = "select plan_name from ECM_AM_YJYASERVER where plan_type='103' and is_del='0'" ;
  1250. return isNullData(ctDao.queryIncidentType(sql)) ;
  1251. }
  1252. //根据应急事件或应急队伍查询出其最新位置坐标,应急资源定位功能用
  1253. @POST
  1254. @ProduceMime("application/json")
  1255. @Path("/queryYJTameMarkerInfo/")
  1256. public String queryYJTameMarkerInfo(String params){
  1257. log.info(params) ;
  1258. String inci = Utils.getParameter("inci", params) ;
  1259. String teamid = Utils.getParameter("teamid", params) ;
  1260. String sort = Utils.getParameter("sort", params) ;
  1261. if(this.verifyParams(sort) && sort.equalsIgnoreCase("asc")){
  1262. sort = "ASC" ;
  1263. } else {
  1264. sort = "DESC" ;
  1265. }
  1266. if(verifyParams(teamid)){
  1267. // String sqlToteam = "select team_id, team_name, longitude, latitude, inicid, incidentname from ( " +
  1268. // "select team_id, team_name, longitude, latitude, inicid, incidentname, row_number() " +
  1269. // "over(partition by team_id order by t1.team_time " + sort + ") as sort " +
  1270. // "from SYS_APP_TEAMER as t1 left join ECM_AM_EMERGENCY_TEAM as t2 " +
  1271. // "on t1.team_id = t2.fd_objectid left join ECM_CM_YJZYINCIDENT as t3 " +
  1272. // "on t1.inicid = t3.fd_objectid " +
  1273. // "where t1.is_del = '0' " + this.getOneSqlWhere("team_id", teamid) +
  1274. // ") where sort = 1" ;
  1275. String sqlToteam = "select team_id, team_name, longitude, latitude, inicid,early_warning_name " +
  1276. "incidentname from ( select team_id, team_name, t1.longitude, t1.latitude, inicid, " +
  1277. "early_warning_name, row_number() over(partition by team_id order by t1.team_time " + sort + ") as sort " +
  1278. "from SYS_APP_TEAMER as t1 left join ECM_AM_EMERGENCY_TEAM as t2 " +
  1279. "on t1.team_id = t2.fd_objectid left join ECM_EM_PUBLISH_ALERT_NOTICE as t3 " +
  1280. "on t1.inicid = t3.fd_objectid " +
  1281. "where t1.is_del = '0' " + this.getOneSqlWhere("team_id", teamid) +
  1282. ") where sort = 1" ;
  1283. return erDao.queryYjTameMarker(sqlToteam) ;
  1284. }else if (verifyParams(inci)){
  1285. // String sqlToInci = "select team_id, team_name, longitude, latitude, inicid, incidentname from ( " +
  1286. // "select team_id, team_name, longitude, latitude, inicid, incidentname, " +
  1287. // "row_number() over(partition by team_id order by t1.team_time " + sort + ") as sort " +
  1288. // "from SYS_APP_TEAMER as t1 left join ECM_AM_EMERGENCY_TEAM as t2 " +
  1289. // "on t1.team_id = t2.fd_objectid left join ECM_CM_YJZYINCIDENT as t3 " +
  1290. // "on t1.inicid = t3.fd_objectid " +
  1291. // "where t1.is_del = '0' " + this.getOneSqlWhere("inicid", inci) +
  1292. // ") where sort = 1" ;
  1293. String sqlToInci = "select team_id, team_name, longitude, latitude, inicid, early_warning_name incidentname " +
  1294. "from ( select team_id, team_name, t1.longitude, t1.latitude, inicid, early_warning_name, " +
  1295. "row_number() over(partition by team_id order by t1.team_time " + sort + ") as sort " +
  1296. "from SYS_APP_TEAMER as t1 left join ECM_AM_EMERGENCY_TEAM as t2 " +
  1297. "on t1.team_id = t2.fd_objectid left join ECM_EM_PUBLISH_ALERT_NOTICE as t3 " +
  1298. "on t1.inicid = t3.fd_objectid " +
  1299. "where t1.is_del = '0' " + this.getOneSqlWhere("inicid", inci) +
  1300. ") where sort = 1" ;
  1301. return this.isNullData(erDao.queryYjTameMarker(sqlToInci)) ;
  1302. }
  1303. return null ;
  1304. }
  1305. @POST
  1306. @ProduceMime("application/json")
  1307. @Path("/fixedPosition/")
  1308. public String fixedPosition(String params){
  1309. log.info(params) ;
  1310. String teamid = Utils.getParameter("teamid", params) ;
  1311. String sort = Utils.getParameter("sort", params) ;
  1312. if(this.verifyParams(sort) && sort.equalsIgnoreCase("asc")){
  1313. sort = "ASC" ;
  1314. } else {
  1315. sort = "DESC" ;
  1316. }
  1317. String sql = "SELECT * FROM(SELECT T1.LONGITUDE LON, T1.LATITUDE LAT, BUSINISS_ID FD_ID, " +
  1318. "T4.FD_OBJECTID INICID, ISNULL(POPULATION,'0') MENNUM, CASE MAJOR WHEN '124' " +
  1319. "THEN '输电' WHEN '125' THEN '变电' WHEN '126' THEN '配电' WHEN '127' THEN '通信' " +
  1320. "WHEN '128' THEN '网络信息' WHEN '129' THEN '试验' WHEN '130' THEN '其他' ELSE '' " +
  1321. "END MAJOR, ISNULL(STATR_PLACE,'没有查到该队伍调拨信息') STATRPLACE, ISNULL(DEST, " +
  1322. "'没有查到该队伍调拨信息') DEST, ISNULL(TASK_NAME,'没有查到该队伍调拨信息') TNAME, " +
  1323. "ISNULL(TEAM_NAME,'') NAME, ROW_NUMBER() OVER(PARTITION BY " +
  1324. "BUSINISS_ID ORDER BY LOCATION_TIME " + sort + ") AS SORT FROM SYS_APP_USER_LOCATION T1 " +
  1325. "LEFT JOIN ECM_AM_EMERGENCY_TEAM T2 ON T1.BUSINISS_ID = T2.FD_OBJECTID LEFT JOIN " +
  1326. "NWYJ.ECM_EM_TEAM_UNIT T3 ON T1.BUSINISS_ID = T3.TEAM_NEAM LEFT JOIN ECM_EM_TEAM_WRR " +
  1327. "T4 ON T3.DEMAND_ID = T4.FD_OBJECTID WHERE T1.IS_DEL = '0' AND T2.IS_DEL = '0' " +
  1328. ") WHERE SORT = '1' " ;
  1329. if(this.verifyParams(teamid)){
  1330. sql += "AND FD_ID IN ('" + teamid + "')";
  1331. return erDao.queryTameMarker(sql) ;
  1332. }
  1333. return null;
  1334. }
  1335. //查询应急队伍所执行应急事件实时传入的坐标
  1336. @POST
  1337. @ProduceMime("application/json")
  1338. @Path("/queryTameXY/")
  1339. public String queryTameXY(String params){
  1340. log.info(params);
  1341. String inci = Utils.getParameter("inci", params) ;
  1342. if(verifyParams(inci)){
  1343. String sql = "select a.longitude, a.latitude, row_number() over " +
  1344. "(partition by team_id order by a.team_time) from SYS_APP_TEAMER as a " +
  1345. "left join ECM_AM_EMERGENCY_TEAM as b on a.team_id = b.fd_objectid " +
  1346. "where a.is_del = '0' " + this.getOneSqlWhere("inicid", inci) ;
  1347. return this.isNullData(erDao.queryTameXY(sql)) ;
  1348. }
  1349. return null ;
  1350. }
  1351. //查询城市坐标
  1352. @POST
  1353. @ProduceMime("application/json")
  1354. @Path("/queryCityXY")
  1355. public String queryCityXY(String params){
  1356. log.info(params);
  1357. String cityStr = Utils.getParameter("city", params);
  1358. StringBuffer sql = new StringBuffer() ;
  1359. sql.append("select POS_X, POS_Y from ECM_CM_CITYCOORDIATE where 1=1 ") ;
  1360. if(verifyParams(cityStr)){
  1361. sql.append(this.getOneSqlWhere("DEPT_ID", cityStr)) ;
  1362. return isNullData(erDao.queryXY(sql.toString())) ;
  1363. }
  1364. return null ;
  1365. }
  1366. /**
  1367. * 查询突发事件
  1368. * @return
  1369. */
  1370. @POST
  1371. @ProduceMime("application/json")
  1372. @Path("/queryNewEmergency")
  1373. public String queryNewEmergency(){
  1374. String sql = "select top 1 t1.FD_OBJECTID as FD_ID,EVENT_NAME,LEVEL,AREA,DEPT_NAME,WRITE_TIME from ECM_EM_EVENT_MANAGER as t1 " +
  1375. "left join SYS_DEPARTMENT as t2 on dept_id=WRITE_DEPT where t1.is_del='0' order by WRITE_TIME desc " ;
  1376. return emerDao.queryEmergency(sql) ;
  1377. }
  1378. //查询应急新闻
  1379. @POST
  1380. @ProduceMime("application/json")
  1381. @Path("/queryNews")
  1382. public String queryNews(){
  1383. String sql = "select fd_objectid,new_title,new_url,new_updatetime from emc_am_news where is_del='0' order by new_updatetime desc " ;
  1384. return emerDao.queryNews(sql) ;
  1385. }
  1386. /**
  1387. * 计算页码
  1388. * @param countPage 页码总数
  1389. * @param listNum 每页显示条数
  1390. * @return
  1391. */
  1392. /* public int computePageNum(double countPage,double listNum){
  1393. return (int)Math.ceil(countPage/listNum);
  1394. }*/
  1395. //查询应急视频总数
  1396. @POST
  1397. @ProduceMime("application/json")
  1398. @Path("/pageCountByVideo")
  1399. public String pageCountByVideo(String params){
  1400. log.info(params);
  1401. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  1402. // String sql = "select count(1) pageCount from ecm_am_we_input t1 left join sys_comm_fileimg t2 on t1.fd_objectid = t2.mainid where t1.is_del='0' and t1.type=26 and t1.PCORAPP='1' and t2.is_del='0' and filepath is not null " ;
  1403. String sql = "select count(1) pageCount from ecm_am_we_input t1 left join sys_comm_fileimg t2 on " +
  1404. "t1.fd_objectid = t2.mainid where t1.is_del='0' and t1.type=26 and t2.is_del='0' " ;
  1405. double pc = emerDao.pageCount(sql);
  1406. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  1407. }
  1408. //查询应急视频
  1409. @POST
  1410. @ProduceMime("application/json")
  1411. @Path("queryVideo")
  1412. public String queryVideo(String params){
  1413. log.info(params) ;
  1414. String begin = Utils.getParameter("begin", params) ;
  1415. String end = Utils.getParameter("end", params) ;
  1416. String condition = Utils.getParameter("condition", params) ;
  1417. if(verifyParams(condition)){
  1418. condition = "%" + condition + "%" ;
  1419. } else {
  1420. condition = "%%" ;
  1421. }
  1422. String sql = "select fd_objectid,dept_name,oper_name,oper_time,description,fileext,name,rn from( " +
  1423. "select t2.fd_objectid,dept_name,oper_name,oper_time,description,fileext,t2.SAVENAME NAME, " +
  1424. "row_number() over(order by oper_time desc) as rn " +
  1425. "from ecm_am_we_input t1 left join sys_comm_fileimg t2 on t1.fd_objectid = t2.mainid " +
  1426. "left join sys_department t3 on t1.oper_dept = t3.dept_id where t1.is_del='0' " +
  1427. "and t1.type=26 and t2.is_del='0' and (oper_name like ? or t3.dept_name like ?) " +
  1428. ") where rn between ? and ? " ;
  1429. return this.isNullData(emerDao.listVideo(sql,condition,begin, end)) ;
  1430. }
  1431. //条件查询应急视频
  1432. @POST
  1433. @ProduceMime("application/json")
  1434. @Path("searchByCondition")
  1435. public String searchByCondition(String params){
  1436. log.info(params);
  1437. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  1438. String condition = "%" + Utils.getParameter("condition", params) + "%";
  1439. double pc = -1.0 ;
  1440. String sql = "select count(1) pageCount from ecm_am_we_input t1 left join sys_comm_fileimg t2 " +
  1441. "on t1.fd_objectid = t2.mainid left join sys_department t3 on t1.oper_dept = t3.dept_id " +
  1442. "where t1.is_del='0' and t1.type=26 and t2.is_del='0' " ;
  1443. if(verifyParams(condition)){
  1444. sql += "and (oper_name like ? or " +
  1445. "t3.dept_name like ?) " ;
  1446. pc = emerDao.pageCountByCondition(sql, condition);
  1447. }else{
  1448. pc = emerDao.pageCount(sql) ;
  1449. }
  1450. if(pc > 0){
  1451. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  1452. }
  1453. return "{\"countList\":0,\"countPage\":1}";
  1454. }
  1455. //根据部门ID查询人资ID
  1456. @POST
  1457. @ProduceMime("application/")
  1458. @Path("getSaphrorgID")
  1459. public String getSaphrorgID(String params){
  1460. log.info(params);
  1461. String unitID = Utils.getParameter("unitID", params);
  1462. String resu = "" ;
  1463. if(verifyParams(unitID)){
  1464. String sql = "select saphrorgid from SYS_DEPARTMENT where saphrorgid is not null " + getOneSqlWhere("dept_id", unitID);
  1465. resu = ctDao.getSaphrorgID(sql) ;
  1466. }
  1467. return resu ;
  1468. }
  1469. //================================================页面下拉框类显示用查询/工具查询===============================================
  1470. /**
  1471. * 查询当前用户部门的等级
  1472. * @param params
  1473. * @return int 1:网级 2:省级 3:市级 4:其它
  1474. */
  1475. /*public int userDeptLevel(String deptId){
  1476. //查询出是否为网级公司
  1477. StringBuffer sb = new StringBuffer() ;
  1478. sb.append("select dept_id from SYS_DEPARTMENT where parent_id = '0' and dept_code is not null " +
  1479. "and dept_code != '002' and dept_id = '" + deptId + "'" ) ;
  1480. //如果是网级则返回true
  1481. if(erDao.isProvInteDept(sb.toString())){
  1482. return 1 ;//网级
  1483. } else {
  1484. sb.delete(0, sb.length()) ;
  1485. // sb.append("select dept_id, dept_name from SYS_DEPARTMENT where parent_id = 'BBD3C37F68094363AABC3CAD5FEE0AF8' and dept_code is not null " +
  1486. // "and dept_id = '" + deptId + "'" ) ;
  1487. sb.append("select dept_id, dept_name from SYS_DEPARTMENT where parent_id = ( " +
  1488. "select dept_id from SYS_DEPARTMENT where dept_id is not null and " +
  1489. "(parent_id='0' or parent_id is null or parent_id='' or parent_id='<NULL>')" +
  1490. ") and dept_id = '" + deptId + "'" );
  1491. //如果是省级就返回true
  1492. if(erDao.isProvInteDept(sb.toString())){
  1493. return 2 ;//省级
  1494. } else {
  1495. sb.delete(0, sb.length()) ;
  1496. sb.append("select dept_id from SYS_DEPARTMENT where parent_id in (select dept_id from SYS_DEPARTMENT " +
  1497. "where parent_id = '1' and dept_code is not null ) and dept_id = '" + deptId + "'" ) ;
  1498. if(erDao.isProvInteDept(sb.toString())){
  1499. return 3 ;//市级
  1500. } else {
  1501. return 4 ;//其它
  1502. }
  1503. }
  1504. }
  1505. }*/
  1506. //通过部门ID得到直属下级部门ID
  1507. public List<String> subDept(String deptID){
  1508. String sql = "select dept_id, dept_name from SYS_DEPARTMENT where is_del = '0' and parent_id = '" + deptID + "' " ;
  1509. return erDao.subDeptIDs(sql) ;
  1510. }
  1511. /*//查询部门是否为省级公司
  1512. public String userDeptLevelProv(String deptId){
  1513. String sql = "select dept_id, dept_name from SYS_DEPARTMENT where parent_id = '1' and dept_code is not null " +
  1514. "and dept_code != '002' where dept_id = '" + deptId + "'" ;
  1515. //如果是省级则返回true,
  1516. //如果不是省级,继续查询当前部门是否为地市级
  1517. }*/
  1518. /*//查询部门是否为省级公司
  1519. public String userDeptLevelPref(String deptId){
  1520. String sql = "select dept_id, dept_name from SYS_DEPARTMENT where parent_id = '1' and dept_code is not null " +
  1521. "and dept_code != '002' where dept_id = '" + deptId + "'" ;
  1522. //如果是省级则返回true,
  1523. //如果不是省级,继续查询当前部门是否为地市级
  1524. return null ;
  1525. }*/
  1526. /**
  1527. * 查询事件表的事件名称,复选下拉列表用
  1528. * @return
  1529. */
  1530. // @POST
  1531. // @ProduceMime("application/json")
  1532. // @Path("/queryYjIncident/")
  1533. // public String queryYjIncident(){
  1534. // String sql = "select FD_OBJECTID,INCIDENTNAME from ECM_CM_YJZYINCIDENT where IS_DEL = '0' order by startdate" ;
  1535. // System.out.println("事件表的事件名称查询,下拉复选列表: " + sql );
  1536. // return ctDao.queryYjIncident(sql) ;
  1537. // }
  1538. /**
  1539. * 查询事件表的事件名称,单选下拉列表用
  1540. * @return
  1541. */
  1542. // @POST
  1543. // @ProduceMime("application/json")
  1544. // @Path("/queryYjIncidentByRadio/")
  1545. // public String queryYjIncidentByRadio(){
  1546. // String sql = "select FD_OBJECTID fd_id,INCIDENTNAME name from ECM_CM_YJZYINCIDENT where IS_DEL = '0' order by startdate " ;
  1547. // return ctDao.queryRadioSelect(sql);
  1548. // }
  1549. /**
  1550. * 查询应急预警通知单,挂事件名
  1551. */
  1552. @POST
  1553. @ProduceMime("application/json")
  1554. @Path("/queryPublishAlertNotice")
  1555. public String queryPublishAlertNotice(String params){
  1556. log.info(params);
  1557. String unitID = Utils.getParameter("deptId", params);
  1558. if(verifyParams(unitID)){
  1559. // String sql = "SELECT FD_OBJECTID FD_ID, EARLY_WARNING_NAME NAME, RELEASE_UNIT UNIT," +
  1560. // " RELEASE_RELIEVE_DATE SENDDATE FROM " +
  1561. // "ECM_EM_PUBLISH_ALERT_NOTICE WHERE IS_DEL = '0' AND IS_SEND = '5' " +
  1562. // "ORDER BY RELEASE_RELIEVE_DATE DESC " ;
  1563. String sql = "SELECT FD_OBJECTID FD_ID, EARLY_WARNING_NAME NAME FROM " +
  1564. "ECM_EM_PUBLISH_ALERT_NOTICE WHERE IS_DEL = '0' AND IS_SEND = '5' " +
  1565. getOneSqlWhere("RELEASE_UNIT", unitID) + "ORDER BY RELEASE_RELIEVE_DATE DESC " ;
  1566. return ctDao.queryRadioSelect(sql);
  1567. }
  1568. return null;
  1569. }
  1570. /**
  1571. * 查询应急预警响应通知单,事件挂名,多选框
  1572. */
  1573. @POST
  1574. @ProduceMime("application/json")
  1575. @Path("queryNoticeByMultiMode")
  1576. public String queryNoticeByMultiMode(String params){
  1577. log.info(params);
  1578. String unitID = Utils.getParameter("deptId", params);
  1579. if(verifyParams(unitID)){
  1580. // String sql = "SELECT FD_OBJECTID FD_ID, EARLY_WARNING_NAME NAME FROM " +
  1581. // "ECM_EM_PUBLISH_ALERT_NOTICE WHERE IS_DEL = '0' AND IS_SEND = '5' " +
  1582. // getOneSqlWhere("RELEASE_UNIT", unitID) + "ORDER BY RELEASE_RELIEVE_DATE DESC " ;
  1583. String sql = "SELECT t1.FD_OBJECTID FD_ID, DEPT_NAME, EARLY_WARNING_NAME NAME FROM " +
  1584. "ECM_EM_PUBLISH_ALERT_NOTICE AS t1 LEFT JOIN SYS_DEPARTMENT AS t2 " +
  1585. "ON t1.RELEASE_UNIT = t2.dept_id WHERE t1.IS_DEL = '0' AND t2.IS_DEL = '0' " +
  1586. "AND IS_SEND = '5' " + getOneSqlWhere("RELEASE_UNIT", unitID) +
  1587. "ORDER BY RELEASE_RELIEVE_DATE DESC " ;
  1588. return ctDao.queryYjIncident(sql) ;
  1589. }
  1590. return null ;
  1591. }
  1592. /**
  1593. * 查询应急队伍调动队伍,多选框
  1594. */
  1595. @POST
  1596. @ProduceMime("application/json")
  1597. @Path("queryTeamMove")
  1598. public String queryTeamMove(String params){
  1599. log.info(params);
  1600. String sql = "SELECT * FROM(SELECT BUSINISS_ID FD_ID, ISNULL(TEAM_NAME,'') NAME, ISNULL(TASK_NAME,'') " +
  1601. "TASK, ROW_NUMBER() OVER(PARTITION BY BUSINISS_ID ORDER BY LOCATION_TIME DESC) AS SORT " +
  1602. "FROM SYS_APP_USER_LOCATION T1 LEFT JOIN ECM_AM_EMERGENCY_TEAM T2 ON " +
  1603. "T1.BUSINISS_ID = T2.FD_OBJECTID LEFT JOIN NWYJ.ECM_EM_TEAM_UNIT T3 ON " +
  1604. "T1.BUSINISS_ID = T3.TEAM_NEAM LEFT JOIN ECM_EM_TEAM_WRR T4 ON T3.DEMAND_ID = T4.FD_OBJECTID " +
  1605. "WHERE T1.IS_DEL = '0' AND T2.IS_DEL = '0' ) WHERE SORT = '1'" ;
  1606. return ctDao.queryTeamMove(sql) ;
  1607. }
  1608. /**
  1609. * 通过事件ID得到队伍下拉复选框(应急资源应急队伍查询用)
  1610. * @param params
  1611. * @return
  1612. */
  1613. @POST
  1614. @ProduceMime("application/json")
  1615. @Path("/queryTeamByInci/")
  1616. public String queryTeamByInci(String params){
  1617. log.info(params);
  1618. String teaminciId = Utils.getParameter("teaminciId", params) ;
  1619. // String sql = "select distinct(team_id),t2.team_name from SYS_APP_TEAMER as t1 " +
  1620. // "left join ECM_AM_EMERGENCY_TEAM as t2 on t1.team_id = t2.fd_objectid " +
  1621. // "where t1.is_del = '0' and t2.is_del='0' " ;
  1622. String sql = "select t2.TEAM_NEAM TEAM_ID, t3.TEAM_NAME TEAM_NAME from ECM_EM_TEAM_WRR as t1 " +
  1623. "left join ECM_EM_TEAM_UNIT as t2 on t1.FD_OBJECTID = t2.DEMAND_ID " +
  1624. "left join ECM_AM_EMERGENCY_TEAM as t3 on t2.TEAM_NEAM = t3.fd_objectid " +
  1625. "where t2.CURRENT_STATE <> '131' " +
  1626. "and (TEAM_NAME <> '<NULL>' or TEAM_NAME <> null or TEAM_NAME <> '' ) " ;
  1627. if(this.verifyParams(teaminciId)){ sql += this.getOneSqlWhere("t1.TASK_NAME_ID", teaminciId) ; }
  1628. return ctDao.queryTeamByInci(sql) ;
  1629. }
  1630. //应急资源绘制图形应急队伍用
  1631. @POST
  1632. @ProduceMime("application/json")
  1633. @Path("/queryTeam/")
  1634. public String queryTeam(String params){
  1635. log.info(params);
  1636. String dept_id = Utils.getParameter("deptId", params);
  1637. if(this.verifyParams(dept_id)){
  1638. String sql = "select fd_objectid,team_name from ECM_AM_EMERGENCY_TEAM where is_del='0'" +
  1639. this.getOneSqlWhere("TEAM_COMP_ID", dept_id) +
  1640. " and team_name is not null" ;
  1641. return ctDao.queryTeam(sql) ;
  1642. }
  1643. return null ;
  1644. }
  1645. /**
  1646. * 得到队伍详细信息
  1647. * @return
  1648. */
  1649. @POST
  1650. @ProduceMime("application/json")
  1651. @Path("/queryTeamInfo")
  1652. public String queryTeamInfo(String params){
  1653. log.info(params);
  1654. String fdId = Utils.getParameter("fdId", params);
  1655. if(this.verifyParams(fdId)){
  1656. String sql = "select TEAM_TYPE TYPE, FD_DESCRiPTION LEVEL, TEAM_LEADER LEADER, TEAM_PHONE PHONE " +
  1657. "from ECM_AM_EMERGENCY_TEAM t1 left join bm_mapvaluecanst t2 " +
  1658. "on t1.TEAM_LEVEL = t2.fd_code where t2.fd_type='BM_DYDJ' and FD_OBJECTID = '" + fdId + "'" ;
  1659. return ctDao.queryTeamInfo(sql) ;
  1660. }
  1661. return null ;
  1662. }
  1663. //得到外部资源引用系统所属模块名称下拉单选列表
  1664. @POST
  1665. @ProduceMime("application/json")
  1666. @Path("/queryArea/")
  1667. public String queryArea(){
  1668. String sql = "select area_id fd_id, area_name name from ECM_CM_MATICMAP where IS_DEL = '0' AND IS_USED = '0' ";
  1669. return ctDao.queryRadioSelect(sql);
  1670. }
  1671. /**
  1672. * 单位多选下拉树
  1673. */
  1674. /*@ProduceMime("application/json")
  1675. @POST
  1676. @Path("selectTreeDept")
  1677. public String selectTreeDept(String params){
  1678. log.info(params);
  1679. String deptId = Utils.getParameter("unitId", params);
  1680. String parentId = Utils.getParameter("parentId", params);
  1681. if(this.verifyParams(deptId) && this.verifyParams(parentId)){
  1682. int deptLevel = wsdxDept(deptId) ;
  1683. if(deptLevel==1){
  1684. return otherDao.wDept(deptId) ;
  1685. }
  1686. if(deptLevel==2){
  1687. String res = otherDao.sDept(deptId) ;
  1688. return res ;
  1689. }
  1690. if(deptLevel==3){
  1691. return otherDao.dDept(deptId) ;
  1692. }
  1693. if(deptLevel==4){
  1694. return otherDao.oDept(deptId) ;
  1695. }
  1696. if(deptLevel==5){
  1697. return otherDao.oDept(deptId) ;
  1698. }
  1699. }
  1700. return null ;
  1701. }*/
  1702. /**
  1703. * 单位多选下拉树
  1704. */
  1705. @ProduceMime("application/json")
  1706. @POST
  1707. @Path("selectTreeDept")
  1708. public String selectTreeDept(String params){
  1709. log.info(params);
  1710. String deptId = Utils.getParameter("unitId", params);
  1711. if(this.verifyParams(deptId)){
  1712. String sql = "SELECT DEPT_ID,PARENT_ID,DEPT_NAME FROM SYS_DEPARTMENT WHERE DEPT_TYPE = '1' " +
  1713. "AND DEPT_NAME NOT LIKE '%管理所%' AND IS_DEL = '0' start WITH DEPT_ID = ? " +
  1714. "CONNECT BY PRIOR DEPT_ID = PARENT_ID ";
  1715. return otherDao.getDeptGzJson(sql, deptId);
  1716. }
  1717. return null ;
  1718. }
  1719. /**
  1720. * 查询当前部门是网省地县哪级部门,返回12345分别对应网省地县其他
  1721. */
  1722. public int wsdxDept(String deptId){
  1723. String sql = "SELECT DEPT_ID, DEPT_NAME FROM SYS_DEPARTMENT " +
  1724. "WHERE IS_DEL = '0' AND PARENT_ID = '0' AND DEPT_CODE IS NOT NULL " +
  1725. "AND DEPT_ID = ? ORDER BY SORT " ;
  1726. if(otherDao.deptLevel(sql,deptId))
  1727. return 1 ;//网级公司
  1728. sql = "SELECT DEPT_ID, DEPT_NAME FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND " +
  1729. "PARENT_ID in (SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '0' AND IS_DEL = '0'" +
  1730. "AND DEPT_ID IS NOT NULL ) AND DEPT_ID = ? ORDER BY SORT " ;
  1731. if(otherDao.deptLevel(sql,deptId))
  1732. return 2 ;//省级公司
  1733. sql = "SELECT DEPT_ID, DEPT_NAME FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID in (" +
  1734. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID in " +
  1735. "(SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '0' AND IS_DEL = '0' AND DEPT_ID IS NOT NULL )" +
  1736. ")AND DEPT_NAME LIKE '%供电局%' AND DEPT_ID = ? ORDER BY SORT " ;
  1737. if(otherDao.deptLevel(sql, deptId))
  1738. return 3 ;//市级公司
  1739. sql = "SELECT DEPT_ID, DEPT_NAME FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID IN (" +
  1740. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID in (" +
  1741. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID in (" +
  1742. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE PARENT_ID = '0' AND IS_DEL = '0' AND DEPT_ID IS NOT NULL )" +
  1743. ")AND DEPT_NAME LIKE '%供电局%' )AND DEPT_NAME LIKE '%供电局%' AND DEPT_ID = ? ORDER BY SORT " ;
  1744. if(otherDao.deptLevel(sql, deptId))
  1745. return 4 ;//县级公司
  1746. return 5 ;//其他公司
  1747. }
  1748. // /**
  1749. // * 通过部门ID得到队伍树形单选下拉框(应急资源手绘图形添加应急队伍用)
  1750. // * @param params
  1751. // * @return
  1752. // */
  1753. // @POST
  1754. // @ProduceMime("application/json")
  1755. // @Path("/queryTeamByDept/")
  1756. // public String queryTeamByDept(String params){
  1757. // log.info(params);
  1758. // String deptId = Utils.getParameter("deptId", params) ;
  1759. // String sql = "" ;
  1760. // if(this.verifyParams(deptId)){
  1761. // sql += this.getOneSqlWhere("teamincidentid", deptId) ;
  1762. // }
  1763. // System.out.println("对应应急事件的应急队伍复选下拉框SQL: " + sql);
  1764. // return ctDao.queryTeamByInci(sql) ;
  1765. // }
  1766. //
  1767. //==========================================================================================
  1768. /**
  1769. * 根据部门ID得到子部门
  1770. *
  1771. * @param params
  1772. * @return 部门树的所有一级子结构json对象
  1773. */
  1774. @ProduceMime("application/")
  1775. @POST
  1776. @Path("/queryAllSubDept/")
  1777. public String queryAllSubDept(String params) {
  1778. StringBuffer sb = new StringBuffer();
  1779. boolean flag=false;
  1780. OrgInDeptBean deptBean = new OrgInDeptBean();
  1781. String deptid = Utils.getParameter("deptId", params) == null ? "" : Utils.getParameter("deptId", params);
  1782. String id = Utils.getParameter("id", params) == null ? "" : Utils.getParameter("id", params);
  1783. if(id==null||"".equals(id)){
  1784. id=deptid;
  1785. flag=true;
  1786. }
  1787. OrgInDeptVo dv;
  1788. try {
  1789. dv = deptBean.getDeptRootById(id);
  1790. if(flag){
  1791. sb.append(dv.getID() + ",");
  1792. }
  1793. if(checkId(id)){
  1794. List<String>childList=new ArrayList<String>();
  1795. childList=getChildList(id);
  1796. for(int i=0;i<childList.size();i++){
  1797. OrgInDeptVo dvo=new OrgInDeptVo();
  1798. dvo=deptBean.getDeptRootById(childList.get(i));
  1799. if(checkId(childList.get(i))){
  1800. sb.append(dvo.getID() + ",");
  1801. }else{
  1802. sb.append(dvo.getID() + ",");
  1803. }
  1804. }
  1805. }
  1806. if (sb.lastIndexOf(",") > -1) {
  1807. sb.deleteCharAt(sb.lastIndexOf(","));
  1808. }
  1809. log.info("str:" + sb);
  1810. return sb.toString();
  1811. } catch (Exception e) {
  1812. log.error("查询内部组织机构根节点错误", e);
  1813. return null;
  1814. }
  1815. }
  1816. public List<String> getChildList(String id){
  1817. SysModel sysmodel = ModelFactory.getSysmodel();
  1818. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  1819. String sql="select id from EMC_AM_ORG_DEPARTMENT_TEST where parent_id='"+id+"' and is_del='0'";
  1820. try {
  1821. ArrayList<String[]> list = persistence.getSearchResult(99, sql.toString());
  1822. if(list==null||list.size()==0){
  1823. return new ArrayList<String>();
  1824. }else{
  1825. List<String>tempList=new ArrayList<String>();
  1826. for(int i=0;i<list.size();i++){
  1827. tempList.add(list.get(i)[0]);
  1828. }
  1829. return tempList;
  1830. }
  1831. } catch (PersistenceException e) {
  1832. e.printStackTrace();
  1833. return new ArrayList<String>();
  1834. }
  1835. }
  1836. public boolean checkId(String id){
  1837. SysModel sysmodel = ModelFactory.getSysmodel();
  1838. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  1839. String sql="select * from EMC_AM_ORG_DEPARTMENT_TEST where parent_id='"+id+"' and is_del='0'";
  1840. try {
  1841. ArrayList<String[]> list = persistence.getSearchResult(99, sql.toString());
  1842. if(list==null||list.size()==0){
  1843. return false;
  1844. }else{
  1845. return true;
  1846. }
  1847. } catch (PersistenceException e) {
  1848. e.printStackTrace();
  1849. return false;
  1850. }
  1851. }
  1852. //================================================工具辅助方法=============================================================
  1853. /**
  1854. * 查询返回的结果是不是空
  1855. * @param sql 查询语句返回的json字符串
  1856. * @return 如果有数据返回原字符串,如果没有数据返回null
  1857. */
  1858. public String isNullData(String res){
  1859. if(res.length() < 5){
  1860. return null ;
  1861. }
  1862. return res ;
  1863. }
  1864. /**
  1865. * 校验参数是不是空
  1866. * @param params
  1867. * @return
  1868. */
  1869. public Boolean verifyParams(String params){
  1870. if(params != null && !"".equals(params)&& !"undefined".equalsIgnoreCase(params) && params != "null")
  1871. return true ;
  1872. return false ;
  1873. }
  1874. /**
  1875. * 得到单个sql精确查询条件
  1876. * @param colum
  1877. * @param value
  1878. * @return
  1879. */
  1880. public String getOneSqlWhere(String colum, String value){
  1881. StringBuffer sb = new StringBuffer() ;
  1882. String [] valueArr = null ;
  1883. valueArr = value.split(",") ;
  1884. sb.append("and (") ;
  1885. for(int i = 0 ; i < valueArr.length ; i++){
  1886. sb.append( colum + " = '" + valueArr[i] + "' or ") ;
  1887. }
  1888. sb.delete(sb.length()-3, sb.length()) ;
  1889. sb.append(")") ;
  1890. return sb.toString() ;
  1891. }
  1892. /**
  1893. * 得到单个sql模糊查询条件
  1894. * @param colum
  1895. * @param value
  1896. * @return
  1897. */
  1898. public String getOneSqlWhereLike(String colum, String value){
  1899. StringBuffer sb = new StringBuffer() ;
  1900. String [] valueArr = null ;
  1901. valueArr = value.split(",") ;
  1902. sb.append("and (") ;
  1903. for(int i = 0 ; i < valueArr.length ; i++){
  1904. sb.append( colum + " like '%" + valueArr[i] + "%' or ") ;
  1905. }
  1906. sb.delete(sb.length()-3, sb.length()) ;
  1907. sb.append(")") ;
  1908. return sb.toString() ;
  1909. }
  1910. /**
  1911. * 将字符串转换成List<String>数组
  1912. * @param params
  1913. * @return
  1914. */
  1915. public List<String> trunList(String params){
  1916. List<String> list = new ArrayList<String>() ;
  1917. String [] paramsArr = params.split(",") ;
  1918. Collections.addAll(list, paramsArr) ;
  1919. return list ;
  1920. }
  1921. /**
  1922. * 得到应急资源省市JSON格式字符串
  1923. * @param params
  1924. * @param list
  1925. * @return
  1926. */
  1927. public StringBuffer getErMarkerJson(String params, List<String>list){
  1928. StringBuffer sb = new StringBuffer() ;
  1929. if(list != null){
  1930. sb.append("\"" + params + "\":[") ;
  1931. for(String str : list){
  1932. sb.append("\"" + str + "\",") ;
  1933. }
  1934. sb.deleteCharAt(sb.length()-1) ;
  1935. sb.append("],") ;
  1936. return sb ;
  1937. }
  1938. return sb ;
  1939. }
  1940. /**
  1941. * 外部系统引用配置表格显示
  1942. * @param params
  1943. * @return
  1944. */
  1945. /*@POST
  1946. @ProduceMime("application/json")
  1947. @Path("/getGridExternal/")
  1948. public String getGridExternal(String params){
  1949. OperateAble persistence = new OperateImpl();
  1950. log.info(params);
  1951. RowSet rowSet = new RowSet();
  1952. String listId = Utils.getParameter("listId", params);
  1953. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils.getParameter("pager.pageNo", params);
  1954. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils.getParameter("pager.pageSize", params);
  1955. String sort = Utils.getParameter("sort", params);// 排序字段
  1956. String dir = Utils.getParameter("direction", params);// 升序还是降序
  1957. FormListImpl formList = (FormListImpl) XFormFactory.getXFormModel().getFormList(listId);
  1958. String sql = "select t3.dept_name DEPT, t1.fd_objectid FD_ID, t1.tm_name NAME, " +
  1959. "t1.tm_url URL,t2.area_name AREA, t1.tm_use USE from ecm_cm_thematic t1 left join " +
  1960. "ECM_CM_MATICMAP t2 on t1.tm_areaid=t2.area_id left join SYS_DEPARTMENT " +
  1961. "t3 on t1.sc_dept_id = t3.dept_id where t1.is_del='0' and t1.is_external='0' " ;
  1962. System.out.println("外部引用系统配置查询sql: " + sql);
  1963. try {
  1964. rowSet = persistence.queryPagingAllDatas(formList, new StringBuffer(sql), firstPageNum, limit);
  1965. } catch (PersistenceException e) {
  1966. // TODO Auto-generated catch block
  1967. e.printStackTrace();
  1968. } catch (TransformTypeException e) {
  1969. // TODO Auto-generated catch block
  1970. e.printStackTrace();
  1971. }
  1972. // 处理返回的结果,将结果适用于QuickUI
  1973. JSONObject origin = JSONObject.fromObject(rowSet);
  1974. String pageNoResult = origin.getString("total");
  1975. String rowsResult = origin.getString("rows");
  1976. String result = "{\"pager.pageNo\":" + firstPageNum + ",\"pager.totalRows\":"
  1977. + pageNoResult + ",\"rows\":" + rowsResult + "}";
  1978. log.info("qui====" + result);
  1979. return result;
  1980. } */
  1981. //===================================================线路跳闸与变电站停运暂时去掉start================================
  1982. // /**
  1983. // * 线路跳闸,根据单位、电压等级、恢复状态 (0:已恢复,1:未恢复)查询线路编码 TRIPTIME
  1984. // * @param params
  1985. // * @return
  1986. // */
  1987. // @POST
  1988. // @ProduceMime("application/")
  1989. // @Path("/queryLineTrip/")
  1990. // public String queryLineTrip(String params){
  1991. // log.info(params);
  1992. // String vcStr = Utils.getParameter("voltageClass", params);
  1993. // String companyStr = Utils.getParameter("company", params);
  1994. // String statusStr = Utils.getParameter("status", params) ;
  1995. // String beginTime = Utils.getParameter("beginTime", params) ;
  1996. // String endTime = Utils.getParameter("endTime", params) ;
  1997. //
  1998. // String sql = "select EQUIPMENTID from ECM_OMS_LINE_TRIP_OUT where 1=1 and IS_DEL = '0' " ;
  1999. //
  2000. // if(this.verifyParams(vcStr))
  2001. // sql += this.getOneSqlWhere("VOLLEVEL", vcStr) ;
  2002. // if(this.verifyParams(companyStr))
  2003. // sql += this.getOneSqlWhere("INAREAID", companyStr) ;
  2004. // if(this.verifyParams(statusStr)){
  2005. //
  2006. // if(statusStr.equals("0")){//恢复
  2007. // sql += "and ontime is not null " ;
  2008. // } else if(statusStr.equals("1")){//未恢复
  2009. // sql += "and ontime is null " ;
  2010. // }
  2011. //
  2012. // }
  2013. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  2014. // sql += "and TRIPTIME BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  2015. //
  2016. // System.out.println("线路跳闸查询:" + sql);
  2017. //
  2018. // return isNullData(lineTripDao.queryLinePsrId(sql)) ;
  2019. // }
  2020. /*//变电站停运,根据单位、电压等级、恢复状态 (0:已恢复,1:未恢复)查询变电站编码
  2021. @POST
  2022. @ProduceMime("application/")
  2023. @Path("/querySubstationOutage/")
  2024. public String querySubstationOutage(String params){
  2025. log.info(params);
  2026. String vcStr = Utils.getParameter("voltageClass", params);
  2027. String companyStr = Utils.getParameter("company", params);
  2028. String statusStr = Utils.getParameter("status", params) ;
  2029. String sql = "select SUBSTATION_CODE from ECM_OMS_SUBSTATION_OUTAGE where 1=1 " ;
  2030. // sql += getSqlLsWhere(params) ;
  2031. String result = lineTripDao.querySubstationPsrId(sql) ;
  2032. return isNullData(result.substring(0,result.length()-1)) ;
  2033. }*/
  2034. //================================================线路跳闸和变电站停运end===========================================
  2035. //================================================表格暂时去掉=============================================================
  2036. // /**
  2037. // * 线路跳闸表格显示
  2038. // * @param params
  2039. // * @return
  2040. // */
  2041. // @POST
  2042. // @ProduceMime("application/json")
  2043. // @Path("/getGridLt/")
  2044. // public String getGridLt(String params){
  2045. // OperateAble persistence = new OperateImpl();
  2046. // log.info(params);
  2047. //
  2048. // RowSet rowSet = new RowSet();
  2049. // String listId = Utils.getParameter("listId", params);
  2050. //
  2051. // String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils.getParameter("pager.pageNo", params);
  2052. // String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils.getParameter("pager.pageSize", params);
  2053. // String sort = Utils.getParameter("sort", params);// 排序字段
  2054. // String dir = Utils.getParameter("direction", params);// 升序还是降序
  2055. //
  2056. // FormListImpl formList = (FormListImpl) XFormFactory.getXFormModel().getFormList(listId);
  2057. //
  2058. //
  2059. // String vollevel = Utils.getParameter("vollevel", params) ;//电压等级
  2060. // String dept = Utils.getParameter("dept", params) ;//部门单位
  2061. // String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  2062. // String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  2063. //
  2064. // String sql = "select s.dept_name,vollevel,trip,reco from ( " +
  2065. // "with t1 as(select INAREAID, VOLLEVEL, count(vollevel) as trip " +
  2066. // "from ECM_OMS_LINE_TRIP_OUT where 1=1 " ;
  2067. // if(this.verifyParams(vollevel))
  2068. // sql += this.getOneSqlWhere("VOLLEVEL", vollevel) ;
  2069. // if(this.verifyParams(dept))
  2070. // sql += this.getOneSqlWhere("INAREAID", dept) ;
  2071. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  2072. // sql += "and TRIPTIME BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  2073. //
  2074. // sql += "group by INAREAID, VOLLEVEL,TRIPTIME)," +
  2075. // "t2 as(select INAREAID,vollevel,isnull(count(vollevel),0) as recover from ECM_OMS_LINE_TRIP_OUT " +
  2076. // "where RECLOSE = '0' " ;
  2077. // if(this.verifyParams(vollevel))
  2078. // sql += this.getOneSqlWhere("VOLLEVEL", vollevel) ;
  2079. // if(this.verifyParams(dept))
  2080. // sql += this.getOneSqlWhere("INAREAID", dept) ;
  2081. // if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  2082. // sql += "and TRIPTIME BETWEEN '" + beginTime + "' AND '" + endTime + "'" ;
  2083. //
  2084. // sql += "group by INAREAID, VOLLEVEL,TRIPTIME) " +
  2085. // "select t1.*, nvl(t2.recover, 0) as reco from t1 left join t2 " +
  2086. // "on t1.INAREAID=t2.INAREAID and t1.vollevel=t2.vollevel) " +
  2087. // "as a left join SYS_DEPARTMENT as s on a.inareaid = s.dept_id " ;
  2088. //
  2089. // System.out.println("线路跳闸表格查询sql: " + sql);
  2090. // try {
  2091. // rowSet = persistence.queryPagingAllDatas(formList, new StringBuffer(sql), firstPageNum, limit);
  2092. // } catch (PersistenceException e) {
  2093. // // TODO Auto-generated catch block
  2094. // e.printStackTrace();
  2095. // } catch (TransformTypeException e) {
  2096. // // TODO Auto-generated catch block
  2097. // e.printStackTrace();
  2098. // }
  2099. // // 处理返回的结果,将结果适用于QuickUI
  2100. // JSONObject origin = JSONObject.fromObject(rowSet);
  2101. // String pageNoResult = origin.getString("total");
  2102. // String rowsResult = origin.getString("rows");
  2103. //
  2104. // String result = "{\"pager.pageNo\":" + firstPageNum + ",\"pager.totalRows\":"
  2105. // + pageNoResult + ",\"rows\":" + rowsResult + "}";
  2106. // log.info("qui====" + result);
  2107. // return result;
  2108. // }
  2109. //=========================================负荷损失表格暂时去掉======================================
  2110. // /**
  2111. // * 负荷损失表格用(这里只针对线路跳闸的进行统计,因为没有变电站停运数据表)
  2112. // * @param params
  2113. // * @return
  2114. // */
  2115. /*@POST
  2116. @ProduceMime("application/json")
  2117. @Path("/getLoadLost/")
  2118. public String getLoadLost(String params){
  2119. OperateAble persistence = new OperateImpl();
  2120. log.info(params);
  2121. RowSet rowSet = new RowSet();
  2122. String listId = Utils.getParameter("listId", params);
  2123. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils.getParameter("pager.pageNo", params);
  2124. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils.getParameter("pager.pageSize", params);
  2125. String sort = Utils.getParameter("sort", params);// 排序字段
  2126. String dir = Utils.getParameter("direction", params);// 升序还是降序
  2127. FormListImpl formList = (FormListImpl) XFormFactory.getXFormModel().getFormList(listId);
  2128. String vollevel = Utils.getParameter("vollevel", params) ;//电压等级
  2129. String dept = Utils.getParameter("dept", params) ;//部门单位
  2130. String reclose = Utils.getParameter("RECLOSE", params) ;//恢复状态
  2131. String beginTime = Utils.getParameter("BEGINTIME", params) ; //开始时间
  2132. String endTime = Utils.getParameter("ENDTIME", params) ; //截止时间
  2133. StringBuffer sql = new StringBuffer() ;
  2134. sql.append("select sum(LOSTLOAD) as loadlost, s.dept_name from ECM_OMS_LINE_TRIP_OUT as e " +
  2135. "left join SYS_DEPARTMENT as s on e.inareaid = s.dept_id where 1=1 ") ;
  2136. if(this.verifyParams(vollevel))
  2137. sql.append(this.getOneSqlWhere("VOLLEVEL", vollevel)) ;
  2138. if(this.verifyParams(dept))
  2139. sql.append(this.getOneSqlWhere("INAREAID", dept)) ;
  2140. if(this.verifyParams(reclose))
  2141. sql.append(this.getOneSqlWhere("RECLOSE", reclose)) ;
  2142. if(this.verifyParams(beginTime) && this.verifyParams(endTime))
  2143. sql.append("and TRIPTIME BETWEEN '" + beginTime + "' AND '" + endTime + "'") ;
  2144. sql.append("group by INAREAID, s.dept_name ") ;
  2145. System.out.println("负荷损失表格sql: " + sql.toString());
  2146. try {
  2147. rowSet = persistence.queryPagingAllDatas(formList, sql, firstPageNum, limit) ;
  2148. } catch (PersistenceException e) {
  2149. // TODO Auto-generated catch block
  2150. e.printStackTrace();
  2151. } catch (TransformTypeException e) {
  2152. // TODO Auto-generated catch block
  2153. e.printStackTrace();
  2154. }z
  2155. // 处理返回的结果,将结果适用于QuickUI
  2156. JSONObject origin = JSONObject.fromObject(rowSet);
  2157. String pageNoResult = origin.getString("total");
  2158. String rowsResult = origin.getString("rows");
  2159. String result = "{\"pager.pageNo\":" + firstPageNum + ",\"pager.totalRows\":"
  2160. + pageNoResult + ",\"rows\":" + rowsResult + "}";
  2161. log.info("qui====" + result);
  2162. return result;
  2163. } */
  2164. /**
  2165. * 获得工程上下文路径
  2166. * @return json {"context":"protocol://ip:port:/project"}
  2167. */
  2168. @GET
  2169. @ProduceMime("application/json")
  2170. @Path("/getContext")
  2171. public String getContext() {
  2172. HttpServletRequest req = mc.getHttpServletRequest();
  2173. String path = req.getContextPath();
  2174. String ctx = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort()
  2175. + path;
  2176. JSONObject obj = new JSONObject();
  2177. try {
  2178. obj.put("context", ctx);
  2179. } catch (JSONException e) {
  2180. }
  2181. return obj.toString();
  2182. }
  2183. /**
  2184. * 获得95598来电数
  2185. * @return json {"context":"protocol://ip:port:/project"}
  2186. */
  2187. @POST
  2188. @ProduceMime("application/json")
  2189. @Path("/getCallNum")
  2190. public String getCallNum(String params) {
  2191. String startDate = Utils.getParameter("beginTime", params);//开始时间
  2192. String endDate = Utils.getParameter("endTime", params);//结束时间
  2193. String organizationid = Utils.getParameter("ID", params);//人资ID
  2194. String[] arr=organizationid.split(",");
  2195. List<String> organizationId=new ArrayList<String>();
  2196. for(int i=0;i<arr.length;i++){
  2197. String str=arr[i];
  2198. organizationId.add(str);
  2199. }
  2200. String result=gpsTaskWebService.call95598(startDate, endDate, organizationId);
  2201. return result;
  2202. }
  2203. /**
  2204. * 新闻页码数
  2205. * @param params
  2206. * @return
  2207. * @throws PersistenceException
  2208. */
  2209. @ProduceMime("application/json")
  2210. @POST
  2211. @Path("/getNewsByCountPage")
  2212. public String getNewsByCountPage(String params) {
  2213. log.info(params);
  2214. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  2215. String type = Utils.getParameter("newsType",params) ;//新闻类型
  2216. String sql = "select count(1) pageCount from EMC_AM_NEWS where IS_DEL='0' " +
  2217. "and (NEW_TITLE like '%应急%' or NEW_TITLE like '%保供电%' or NEW_TITLE like '%抗冰%' " +
  2218. "or NEW_TITLE like '%台风%' or NEW_TITLE like '%地震%') " ;
  2219. if(this.verifyParams(type)){
  2220. sql += "and NEW_TYPE='" + type + "' " ;
  2221. }
  2222. double pc = emerDao.pageCount(sql);
  2223. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  2224. }
  2225. /**
  2226. * 新闻
  2227. * @param params
  2228. * @return
  2229. * @throws PersistenceException
  2230. */
  2231. @ProduceMime("application/json")
  2232. @POST
  2233. @Path("/getNews")
  2234. public String getNews(String params) throws PersistenceException {
  2235. String type = Utils.getParameter("newsType",params) ;//新闻类型
  2236. String begin = Utils.getParameter("begin", params) ;
  2237. String end = Utils.getParameter("end", params) ;
  2238. if(this.verifyParams(begin) && this.verifyParams(end)){
  2239. String sql = "select FD_ID, NAME, PDATE, RN from ( select FD_OBJECTID FD_ID, " +
  2240. "NEW_TITLE NAME,NEW_UPDATETIME PDATE, ROWNUM RN from EMC_AM_NEWS " +
  2241. "where IS_DEL='0' and (NEW_TITLE like '%应急%' or NEW_TITLE like '%保供电%' " +
  2242. "or NEW_TITLE like '%抗冰%' or NEW_TITLE like '%台风%' or NEW_TITLE like '%地震%') " ;
  2243. if(this.verifyParams(type)){
  2244. sql += "and NEW_TYPE=? )where RN between ? and ?" ;
  2245. return otherDao.getGovDocDayList(sql, type, begin, end);
  2246. } else {
  2247. sql += ")where RN between ? and ?" ;
  2248. return otherDao.getGovDocDayList(sql, begin, end);
  2249. }
  2250. }
  2251. return null ;
  2252. /*String json ;
  2253. if(this.verifyParams(type)){
  2254. json = otherDao.getNewsTwo(type);
  2255. // select NEW_TITLE,FD_OBJECTID,NEW_UPDATETIME from EMC_AM_NEWS where IS_DEL='0' and NEW_TYPE='"+type+"' and (NEW_TITLE like '%应急%' or NEW_TITLE like '%保供电%' or NEW_TITLE like '%抗冰%' or NEW_TITLE like '%台风%' or NEW_TITLE like '%地震%')";
  2256. } else {
  2257. json = otherDao.getNews();
  2258. }
  2259. return json;*/
  2260. }
  2261. /**
  2262. * 政府来文来函最新日期查询
  2263. */
  2264. @ProduceMime("application/")
  2265. @POST
  2266. @Path("/getGovDocDay")
  2267. public String getGovDocDay(String params){
  2268. log.info(params);
  2269. String dept = Utils.getParameter("deptId", params);
  2270. if(this.verifyParams(dept)){
  2271. String sql = "select top 1 PRINT_DATE PDATE from EMC_AM_GOVERNMENT_DOCUMENT where is_del='0' " +
  2272. "and IS_ISSUE = '1' and PRINT_DATE is not null and UNITE = ? order by PRINT_DATE desc";
  2273. Date day = otherDao.getGovDocDay(sql, dept);
  2274. if(day==null)
  2275. return null;
  2276. return day.toString();
  2277. }
  2278. return null ;
  2279. }
  2280. /**
  2281. * 政府来文来函跟据日期查询页码数
  2282. */
  2283. @ProduceMime("application/")
  2284. @POST
  2285. @Path("/getGovDocDayByCountPage")
  2286. public String getGovDocDayByCountPage(String params){
  2287. log.info(params);
  2288. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  2289. String dept_id = Utils.getParameter("deptId", params) ;
  2290. String begin = Utils.getParameter("beginDay", params);
  2291. String end = Utils.getParameter("endDay", params) ;
  2292. if(this.verifyParams(listNum + "") && this.verifyParams(dept_id) && this.verifyParams(begin) && this.verifyParams(end)){
  2293. String sql = "select count(1) pageCount from EMC_AM_GOVERNMENT_DOCUMENT " +
  2294. "where is_del='0' and IS_ISSUE = '1' " + this.getOneSqlWhere("UNITE", dept_id) + " and PRINT_DATE is not null " +
  2295. "and (PRINT_DATE between '" + begin + "' and '" + end + "' or PRINT_DATE between '" +
  2296. begin + " 00:00:00 ' and '" + end + " 23:59:59' )" ;
  2297. double pc = emerDao.pageCount(sql);
  2298. // System.out.println("{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}");
  2299. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  2300. }
  2301. return null ;
  2302. }
  2303. /**
  2304. * 政府来文来函跟据日期查询
  2305. */
  2306. @ProduceMime("application/json")
  2307. @POST
  2308. @Path("/getGovDocDayList")
  2309. public String getGovDocDayList(String params){
  2310. log.info(params);
  2311. String deptId = Utils.getParameter("deptId", params);
  2312. String beginDay = Utils.getParameter("beginDay", params);
  2313. String endDay = Utils.getParameter("endDay", params) ;
  2314. String begin = Utils.getParameter("begin", params) ;
  2315. String end = Utils.getParameter("end", params) ;
  2316. if(this.verifyParams(deptId) && this.verifyParams(beginDay) && this.verifyParams(endDay) && this.verifyParams(begin) && this.verifyParams(end)){
  2317. String sql = "select FD_ID, NAME, PDATE, RN from (select FD_ID, NAME, PDATE, ROWNUM RN from ( " +
  2318. "select FD_OBJECTID FD_ID, DOCUMENT_NAME NAME, PRINT_DATE PDATE from " +
  2319. "EMC_AM_GOVERNMENT_DOCUMENT where is_del='0' and IS_ISSUE = '1' " + this.getOneSqlWhere("UNITE", deptId) +
  2320. "and (PRINT_DATE between ? and ? or PRINT_DATE between ? and ?) ))where RN between ? and ? ;" ;
  2321. return otherDao.getGovDocDayList(sql, beginDay, endDay, beginDay+" 00:00:00", endDay+" 23:59:59", begin, end) ;
  2322. }
  2323. return null ;
  2324. }
  2325. /**
  2326. * 应急发文/应急专报等级部门查询条件
  2327. * @param deptLevel 部门等级 0/1/2 上级/本级/下级
  2328. * @return 返回部门级别对应的条件
  2329. */
  2330. public String getWhereGovDoc(String deptLevel, String deptId, String parentId){
  2331. String where = "" ;
  2332. if(deptLevel=="0" || "0".equals(deptLevel)){
  2333. where = "LEFT JOIN (SELECT DEPT_ID, DEPT_NAME, DEPT_TYPE, PARENT_ID FROM NWYJ.SYS_DEPARTMENT " +
  2334. "WHERE DEPT_ID = '" + parentId +
  2335. "' ) u2 on u1.WDEPT = u2.DEPT_ID where u1.WDEPT in u2.DEPT_ID " ;
  2336. }else if(deptLevel=="1" || "1".equals(deptLevel)){
  2337. // where = "left join SYS_DEPARTMENT u2 on u1.WDEPT = u2.DEPT_ID where (u1.WDEPT='" + deptId + "' or (u2.PARENT_ID='" + deptId + "' ))" ;
  2338. where = "LEFT JOIN NWYJ.SYS_DEPARTMENT u2 ON u1.WDEPT = u2.DEPT_ID where (u1.WDEPT='" + deptId + "')" ;
  2339. }else if(deptLevel=="2" || "2".equals(deptLevel)){
  2340. /*where = "left join (select DEPT_ID, DEPT_NAME, DEPT_TYPE, PARENT_ID from SYS_DEPARTMENT s where " +
  2341. "s.IS_DEL='0' and s.PARENT_ID='" + deptId + "') u2 on " +
  2342. "u1.WDEPT = u2.DEPT_ID where u1.WDEPT in u2.DEPT_ID or (u1.WDEPT in u2.PARENT_ID)" ;*/
  2343. /*where = "LEFT JOIN (SELECT DEPT_ID, DEPT_NAME, DEPT_TYPE, PARENT_ID FROM NWYJ.SYS_DEPARTMENT s WHERE " +
  2344. "s.IS_DEL='0' and s.PARENT_ID='" + deptId + "') u2 ON " +
  2345. "u1.WDEPT = u2.DEPT_ID " ;*/
  2346. where = ", (SELECT DEPT_ID, DEPT_NAME, DEPT_TYPE, PARENT_ID FROM NWYJ.SYS_DEPARTMENT s WHERE " +
  2347. "s.IS_DEL='0' and s.PARENT_ID='" + deptId + "') u2 WHERE " +
  2348. "u1.WDEPT = u2.DEPT_ID " ;
  2349. }
  2350. // System.out.println("-------------------------------------");
  2351. // System.out.println("0/1/2 上级/本级/下级" + ": " + deptLevel);
  2352. // System.out.println(where);
  2353. return where ;
  2354. }
  2355. /**
  2356. * 查询应急发文总数
  2357. * @param params
  2358. * @return
  2359. */
  2360. @POST
  2361. @ProduceMime("application/json")
  2362. @Path("/pageCountByGovDoc")
  2363. public String pageCountByGovDoc(String params){
  2364. log.info(params);
  2365. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  2366. String deptId = Utils.getParameter("deptId", params);
  2367. // String parentId = Utils.getParameter("parentId", params);
  2368. String dept_level = Utils.getParameter("dept_level", params);
  2369. String beginDay = Utils.getParameter("beginDay", params);
  2370. String endDay = Utils.getParameter("endDay", params);
  2371. String parentId = "" ;
  2372. if(this.verifyParams(deptId)){
  2373. // System.out.println(deptId);
  2374. parentId = otherDao.getParentId(deptId);
  2375. }
  2376. if(this.verifyParams(parentId) && this.verifyParams(dept_level)){
  2377. String sql = "" ;
  2378. String where = this.getWhereGovDoc(dept_level, deptId, parentId) ;
  2379. if(this.verifyParams(beginDay) && this.verifyParams(endDay)){
  2380. sql = "select count(1) pageCount from ( select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG from ( " +
  2381. "(select t1.FD_OBJECTID FD_ID, t1.NAME, t1.RELEASE_DATE PDATE, t1.RELEASE_UNIT UNIT, " +
  2382. "t1.WRITE_DEPT WDEPT,1 FLG from ECM_EM_GOV_ALERT_NOTICE t1 where IS_DEL='0' and " +
  2383. "EARLY_WARNING_STATUS = '33' and RELEASE_DATE between '" + beginDay +
  2384. "' and '" + endDay + ") union all (select t2.FD_OBJECTID FD_ID, t2.NAME, " +
  2385. "t2.RELEASE_DATE PDATE, t2.RELEASE_UNIT UNIT, t2.WRITE_DEPT WDEPT, 2 FLG " +
  2386. "from ECM_EM_GOV_RESPONSE_NOTICE t2 where IS_DEL='0' and RESPONSE_STATUS = '33' " +
  2387. " and RELEASE_DATE between '" + beginDay + "' and '" + endDay +
  2388. ")) order by PDATE desc ) as u1 " + where ;
  2389. } else {
  2390. sql = "select count(1) pageCount from ( select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG from ( " +
  2391. "(select t1.FD_OBJECTID FD_ID, t1.NAME, t1.RELEASE_DATE PDATE, t1.RELEASE_UNIT UNIT, " +
  2392. "t1.WRITE_DEPT WDEPT,1 FLG from ECM_EM_GOV_ALERT_NOTICE t1 where IS_DEL='0' and " +
  2393. "EARLY_WARNING_STATUS = '33' ) union all (select t2.FD_OBJECTID FD_ID, t2.NAME, " +
  2394. "t2.RELEASE_DATE PDATE, t2.RELEASE_UNIT UNIT, t2.WRITE_DEPT WDEPT, 2 FLG " +
  2395. "from ECM_EM_GOV_RESPONSE_NOTICE t2 where IS_DEL='0' and RESPONSE_STATUS = '33' " +
  2396. ")) order by PDATE desc ) as u1 " + where ;
  2397. }
  2398. double pc = emerDao.pageCount(sql);
  2399. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  2400. }
  2401. return null ;
  2402. }
  2403. /**
  2404. * 应急发文查询
  2405. * @param params
  2406. * @return
  2407. */
  2408. @ProduceMime("application/json")
  2409. @POST
  2410. @Path("/getGovDocNotice")
  2411. public String getGovDocNotice(String params){
  2412. log.info(params);
  2413. String deptId = Utils.getParameter("deptId", params);
  2414. // String parentId = Utils.getParameter("parentId", params);
  2415. String dept_level = Utils.getParameter("dept_level", params);
  2416. String begin = Utils.getParameter("begin", params);
  2417. String end = Utils.getParameter("end", params);
  2418. String beginDay = Utils.getParameter("beginDay", params);
  2419. String endDay = Utils.getParameter("endDay", params);
  2420. String parentId = "" ;
  2421. if(this.verifyParams(deptId)){
  2422. // System.out.println(deptId);
  2423. parentId = otherDao.getParentId(deptId);
  2424. }
  2425. if(this.verifyParams(deptId) && this.verifyParams(begin) && this.verifyParams(end) && this.verifyParams(dept_level)){
  2426. String sql = "" ;
  2427. String where = this.getWhereGovDoc(dept_level, deptId, parentId);
  2428. if(this.verifyParams(beginDay) && this.verifyParams(endDay)){
  2429. sql = "select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, RN from( " +
  2430. "select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, rownum RN from ( " +
  2431. "select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG from (" +
  2432. "(select t1.FD_OBJECTID FD_ID, t1.NAME, t1.RELEASE_DATE PDATE, " +
  2433. "t1.RELEASE_UNIT UNIT, t1.WRITE_DEPT WDEPT,1 FLG from ECM_EM_GOV_ALERT_NOTICE t1 " +
  2434. "where IS_DEL='0' and EARLY_WARNING_STATUS = '33' and RELEASE_DATE between '" + beginDay +
  2435. "' and '" + endDay + "') union all (select t2.FD_OBJECTID FD_ID, " +
  2436. "t2.NAME, t2.RELEASE_DATE PDATE, t2.RELEASE_UNIT UNIT, t2.WRITE_DEPT WDEPT, 2 FLG " +
  2437. "from ECM_EM_GOV_RESPONSE_NOTICE t2 where IS_DEL='0' and RESPONSE_STATUS = '33' " +
  2438. "and RELEASE_DATE between '" + beginDay + "' and '" + endDay + "')" +
  2439. ") order by PDATE desc) as u1 " + where +
  2440. ")as t5 where RN between " + begin + " and " + end + " " ;
  2441. } else {
  2442. sql = "select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, RN from( " +
  2443. "select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, rownum RN from ( " +
  2444. "select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG from (" +
  2445. "(select t1.FD_OBJECTID FD_ID, t1.NAME, t1.RELEASE_DATE PDATE, " +
  2446. "t1.RELEASE_UNIT UNIT, t1.WRITE_DEPT WDEPT,1 FLG from ECM_EM_GOV_ALERT_NOTICE t1 " +
  2447. "where IS_DEL='0' and EARLY_WARNING_STATUS = '33' ) union all (select t2.FD_OBJECTID FD_ID, " +
  2448. "t2.NAME, t2.RELEASE_DATE PDATE, t2.RELEASE_UNIT UNIT, t2.WRITE_DEPT WDEPT, 2 FLG " +
  2449. "from ECM_EM_GOV_RESPONSE_NOTICE t2 where IS_DEL='0' and RESPONSE_STATUS = '33' )" +
  2450. ") order by PDATE desc) as u1 " + where +
  2451. ")as t5 where RN between " + begin + " and " + end + " " ;
  2452. }
  2453. // System.out.println("======================================");
  2454. // System.out.println(sql);
  2455. return otherDao.getGovDocNotice(sql) ;
  2456. }
  2457. return null;
  2458. }
  2459. /**
  2460. * 查询应急发文总数2
  2461. * @param params
  2462. * @return
  2463. */
  2464. @POST
  2465. @ProduceMime("application/json")
  2466. @Path("/pageCountByGovDoc2")
  2467. public String pageCountByGovDoc2(String params){
  2468. log.info(params);
  2469. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  2470. String deptId = Utils.getParameter("deptId", params);
  2471. String parentId = Utils.getParameter("parentId", params);
  2472. String dept_level = Utils.getParameter("dept_level", params);
  2473. String beginDay = Utils.getParameter("beginDay", params);
  2474. String endDay = Utils.getParameter("endDay", params);
  2475. if(this.verifyParams(deptId) && this.verifyParams(dept_level)){
  2476. String sql = "" ;
  2477. String where = this.getWhereGovDoc(dept_level, deptId, parentId) ;
  2478. if(this.verifyParams(beginDay) && this.verifyParams(endDay)){
  2479. sql = "select count(1) pageCount from ( select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG from ( " +
  2480. "(select t1.FD_OBJECTID FD_ID, t1.NAME, t1.RELEASE_DATE PDATE, t1.RELEASE_UNIT UNIT, " +
  2481. "t1.CORP_ID WDEPT,1 FLG from JSC_ECM_EM_GOV_ALERT_NOTICE_VIEW t1 where IS_DEL='0' and " +
  2482. "EARLY_WARNING_STATUS = '33' and RELEASE_DATE between '" + beginDay +
  2483. "' and '" + endDay + ") union all (select t2.FD_OBJECTID FD_ID, t2.NAME, " +
  2484. "t2.RELEASE_DATE PDATE, t2.RELEASE_UNIT UNIT, t2.CORP_ID WDEPT, 2 FLG " +
  2485. "from JSC_ECM_EM_GOV_RESPONSE_NOTICE_VIEW t2 where IS_DEL='0' and RESPONSE_STATUS = '33' " +
  2486. " and RELEASE_DATE between '" + beginDay + "' and '" + endDay +
  2487. ")) order by PDATE desc ) as u1 " + where ;
  2488. } else {
  2489. sql = "select count(1) pageCount from ( select FD_ID, NAME, PDATE, UNIT, WDEPT, FLG from ( " +
  2490. "(select t1.FD_OBJECTID FD_ID, t1.NAME, t1.RELEASE_DATE PDATE, t1.RELEASE_UNIT UNIT, " +
  2491. "t1.WRITE_DEPT WDEPT,1 FLG from ECM_EM_GOV_ALERT_NOTICE t1 where IS_DEL='0' and " +
  2492. "EARLY_WARNING_STATUS = '33' ) union all (select t2.FD_OBJECTID FD_ID, t2.NAME, " +
  2493. "t2.RELEASE_DATE PDATE, t2.RELEASE_UNIT UNIT, t2.WRITE_DEPT WDEPT, 2 FLG " +
  2494. "from ECM_EM_GOV_RESPONSE_NOTICE t2 where IS_DEL='0' and RESPONSE_STATUS = '33' " +
  2495. ")) order by PDATE desc ) as u1 " + where ;
  2496. }
  2497. double pc = emerDao.pageCount(sql);
  2498. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  2499. }
  2500. return null ;
  2501. }
  2502. /**
  2503. * 应急发文查询2
  2504. * @param params
  2505. * @return
  2506. */
  2507. @ProduceMime("application/json")
  2508. @POST
  2509. @Path("/getGovDocNotice2")
  2510. public String getGovDocNotice2(String params){
  2511. log.info(params);
  2512. String deptId = Utils.getParameter("deptId", params);
  2513. String parentId = Utils.getParameter("parentId", params);
  2514. String dept_level = Utils.getParameter("dept_level", params);
  2515. String begin = Utils.getParameter("begin", params);
  2516. String end = Utils.getParameter("end", params);
  2517. String beginDay = Utils.getParameter("beginDay", params);
  2518. String endDay = Utils.getParameter("endDay", params);
  2519. if(this.verifyParams(deptId) && this.verifyParams(begin) && this.verifyParams(end) && this.verifyParams(dept_level)){
  2520. String sql = "" ;
  2521. parentId = otherDao.getParentId(deptId);
  2522. String where = this.getWhereGovDoc(dept_level, deptId, parentId);
  2523. if(this.verifyParams(beginDay) && this.verifyParams(endDay)){
  2524. sql = "SELECT FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, RN FROM( " +
  2525. "SELECT FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, ROWNUM RN FROM ( " +
  2526. "SELECT FD_ID, NAME, PDATE, UNIT, WDEPT, FLG FROM (" +
  2527. "(SELECT T1.FD_OBJECTID FD_ID, T1.NAME, T1.RELEASE_DATE PDATE, " +
  2528. "T1.RELEASE_UNIT UNIT, T1.CORP_ID WDEPT,1 FLG FROM JSC_ECM_EM_GOV_ALERT_NOTICE_VIEW T1 " +
  2529. "WHERE IS_DEL='0' AND EARLY_WARNING_STATUS = '33' AND RELEASE_DATE BETWEEN '" + beginDay +
  2530. "' AND '" + endDay + "') UNION ALL (SELECT t2.FD_OBJECTID FD_ID, " +
  2531. "T2.NAME, T2.RELEASE_DATE PDATE, T2.RELEASE_UNIT UNIT, T2.CORP_ID WDEPT, 2 FLG " +
  2532. "FROM JSC_ECM_EM_GOV_RESPONSE_NOTICE_VIEW T2 WHERE IS_DEL='0' AND RESPONSE_STATUS = '33' " +
  2533. "AND RELEASE_DATE BETWEEN '" + beginDay + "' AND '" + endDay + "')" +
  2534. ") ORDER BY PDATE) AS U1 " + where +
  2535. ")AS T5 WHERE RN BETWEEN " + begin + " AND " + end + " ORDER BY PDATE DESC" ;
  2536. } else {
  2537. sql = "SELECT FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, RN FROM( " +
  2538. "SELECT FD_ID, NAME, PDATE, UNIT, WDEPT, FLG, ROWNUM RN FROM ( " +
  2539. "SELECT FD_ID, NAME, PDATE, UNIT, WDEPT, FLG FROM (" +
  2540. "(SELECT T1.FD_OBJECTID FD_ID, T1.NAME, T1.RELEASE_DATE PDATE, " +
  2541. "T1.RELEASE_UNIT UNIT, T1.CORP_ID WDEPT,1 FLG FROM JSC_ECM_EM_GOV_ALERT_NOTICE_VIEW T1 " +
  2542. "WHERE IS_DEL='0' AND EARLY_WARNING_STATUS = '33' ) UNION ALL (SELECT T2.FD_OBJECTID FD_ID, " +
  2543. "T2.NAME, T2.RELEASE_DATE PDATE, T2.RELEASE_UNIT UNIT, T2.CORP_ID WDEPT, 2 FLG " +
  2544. "FROM JSC_ECM_EM_GOV_RESPONSE_NOTICE_VIEW T2 WHERE IS_DEL='0' AND RESPONSE_STATUS = '33' )" +
  2545. ") ORDER BY PDATE desc) AS u1 " + where +
  2546. ")AS T5 WHERE RN BETWEEN " + begin + " AND " + end + " ORDER BY PDATE DESC" ;
  2547. }
  2548. return otherDao.getGovDocNotice(sql) ;
  2549. }
  2550. return null;
  2551. }
  2552. /**
  2553. * 全省停电用户复电比例
  2554. */
  2555. @ProduceMime("application/json")
  2556. @POST
  2557. @Path("/provUserRes")
  2558. public String provUserRes(String params){
  2559. log.info(params);
  2560. String dept_id = Utils.getParameter("deptId", params);
  2561. if(this.verifyParams(dept_id)){
  2562. String sql = "select b.dept_name AS COMP_NAME,to_number(case WHEN TQ_TD_COUNT='' OR TQ_TD_COUNT IS NULL THEN 0 ELSE TQ_TD_COUNT END + case WHEN YH_TD_COUNT='' OR YH_TD_COUNT IS NULL THEN 0 ELSE YH_TD_COUNT END +case WHEN TJYH_TD_COUNT='' OR TJYH_TD_COUNT IS NULL THEN 0 ELSE TJYH_TD_COUNT END +case WHEN YJYH_TD_COUNT='' OR YJYH_TD_COUNT IS NULL THEN 0 ELSE YJYH_TD_COUNT END +case WHEN EJYH_TD_COUNT='' OR EJYH_TD_COUNT IS NULL THEN 0 ELSE EJYH_TD_COUNT END -case WHEN TQ_UNRECOVERED='' OR TQ_UNRECOVERED IS NULL THEN 0 ELSE TQ_UNRECOVERED END -case WHEN YH_UNRECOVERED='' OR YH_UNRECOVERED IS NULL THEN 0 ELSE YH_UNRECOVERED END -case WHEN TJYH_UNRECOVERED='' OR TJYH_UNRECOVERED IS NULL THEN 0 ELSE TJYH_UNRECOVERED END - case WHEN YJYH_UNRECOVERED='' OR YJYH_UNRECOVERED IS NULL THEN 0 ELSE YJYH_UNRECOVERED END -case WHEN EJYH_UNRECOVERED='' OR EJYH_UNRECOVERED IS NULL THEN 0 ELSE EJYH_UNRECOVERED END ) AS RECOVERED "
  2563. + " FROM REPORT_GDSUNSHI_KEHUTD,sys_department b where report_id in( "
  2564. + "select fd_objectid from report_records b where appear_time in( "
  2565. + "select max(appear_time) from report_records where report_type='5' and comp_id ='"+dept_id+"') and comp_id='"+dept_id+"' and report_type='5') and comp_id=b.dept_id";
  2566. return otherDao.provUserRes(sql);
  2567. }
  2568. return null ;
  2569. }
  2570. /**
  2571. * 应急值班查询昨天今天明天的值班列表
  2572. */
  2573. @ProduceMime("application/json")
  2574. @POST
  2575. @Path("/getDutyThreeDays")
  2576. public String getDutyThreeDays(String params){
  2577. log.info(params);
  2578. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
  2579. .getParameter("pager.pageNo", params);
  2580. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
  2581. .getParameter("pager.pageSize", params);
  2582. String dept_id = Utils.getParameter("deptId", params);
  2583. String begin = Utils.getParameter("begin", params);
  2584. String end = Utils.getParameter("end", params);
  2585. String date= Utils.getParameter("date", params);
  2586. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  2587. java.util.Date endDate=null;
  2588. java.util.Date beginDate=null;
  2589. String result="";
  2590. try {
  2591. endDate=sdf.parse(date);
  2592. endDate.setDate(endDate.getDate()+1);
  2593. end=sdf.format(endDate);
  2594. beginDate=sdf.parse(date);
  2595. beginDate.setDate(beginDate.getDate()-2);
  2596. begin=sdf.format(beginDate);
  2597. } catch (ParseException e) {
  2598. log.error(e.getMessage());
  2599. }
  2600. List<Map<String ,String>> list= null;
  2601. if(this.verifyParams(dept_id) && this.verifyParams(begin) && this.verifyParams(end)){
  2602. /*String sql = "select t1.FD_OBJECTID, t1.LEADER_NAME, t1.LEADER_TEL,t1.TELEPHONE,t2.DEPT_NAME,t2.DEPT_NAMES,t2.OPER_DEPT , t1.START_TIME , t1.END_TIME " +
  2603. "from ECM_EM_DUTY_DETAIL t1 left join ECM_EM_DUTY_VIEW t2 " +
  2604. "on t1.DUTY_ID = t2.FD_OBJECTID where t1.IS_DEL ='0' AND t2.DUTY_TYPE ='1' " +
  2605. "and t2.RELEASE='1' AND t2.DEPT_NAMES='" + dept_id +
  2606. "' and t1.START_TIME between '" + begin + " 23:59:59' and '" + end + " 00:00:00' order by t1.START_TIME desc " ;*/
  2607. String sql = "select count(1) TOTAL"
  2608. + " from ECM_EM_DUTY_ALERT_INFO d1 left join ECM_EM_DUTY d2"
  2609. + " on d1.DUTY_ID =d2.fd_objectid"
  2610. + " left join SYS_DEPARTMENT d3 "
  2611. + " on d2.DEPT_NAMES=d3.dept_id "
  2612. //+ " left join BM_MAPVALUECANST d4 "
  2613. //+ " on d4.FD_TYPE='BM_DUTYWAYSTATE' AND d4.FD_CODE=d1.DUTY_WAY "
  2614. + " where d1.DAY_TIME between '" + begin + " 23:59:59' and '" + end + " 00:00:00' "
  2615. + " and d3.CORP_ID in('"+dept_id+"') and d2.is_del='0' and d2.RELEASE='1'"
  2616. + " ORDER BY d1.DUTY_NAME";
  2617. String sql1 = "select d1.DUTY_NAME leader_name,d1.DUTY_NAME_TEL leader_tel,"
  2618. + "d1.DATE_TIME,d3.dept_id,substr(d1.DAY_TIME,0,10) DUTY_DATE, "
  2619. + "d3.DEPT_NAME DEPT_NAME ,d3.CORP_NAME CORP_NAME "
  2620. + " from ECM_EM_DUTY_ALERT_INFO d1 left join ECM_EM_DUTY d2"
  2621. + " on d1.DUTY_ID =d2.fd_objectid"
  2622. + " left join SYS_DEPARTMENT d3 "
  2623. + " on d2.DEPT_NAMES=d3.dept_id "
  2624. //+ " left join BM_MAPVALUECANST d4 "
  2625. //+ " on d4.FD_TYPE='BM_DUTYWAYSTATE' AND d4.FD_CODE=d1.DUTY_WAY "
  2626. + " where d1.DAY_TIME between '" + begin + " 23:59:59' and '" + end + " 00:00:00' "
  2627. + " and d3.CORP_ID in('"+dept_id+"') and d2.is_del='0' and d2.RELEASE='1'"
  2628. + " ORDER BY d1.DUTY_NAME limit "+(Integer.valueOf(firstPageNum)-1)*Integer.valueOf(limit)+","+Integer.valueOf(limit);
  2629. list = otherDao.getDutyThreeDays(sql);
  2630. String total=list.get(0).get("TOTAL");
  2631. list = otherDao.getDutyThreeDays(sql1);
  2632. log.info(JSONArray.fromObject(list).toString());
  2633. result = "{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"
  2634. + total + ",\"rows\":" + JsonPluginsUtil.listToJson(list)+ "}";
  2635. return result;
  2636. //return "{\"rows\":"+JSONArray.fromObject(list).toString()+"}";
  2637. }
  2638. return null ;
  2639. }
  2640. /**
  2641. * 应急专报简报页码查询
  2642. */
  2643. @ProduceMime("application/json")
  2644. @POST
  2645. @Path("getBrieFingByCountPage")
  2646. public String getBrieFingByCountPage(String params){
  2647. log.info(params);
  2648. int listNum = Integer.parseInt(Utils.getParameter("listNum", params));
  2649. String dept_id = Utils.getParameter("deptId", params);
  2650. // String parentId = Utils.getParameter("parentId", params);
  2651. String dept_level = Utils.getParameter("dept_level", params);
  2652. String flg = Utils.getParameter("flg", params) ;
  2653. String parentId = "" ;
  2654. if(this.verifyParams(dept_id)){
  2655. // System.out.println(dept_id);
  2656. parentId = otherDao.getParentId(dept_id);
  2657. }
  2658. if(this.verifyParams(parentId) && this.verifyParams(flg) && this.verifyParams(dept_level)){
  2659. String where = this.getWhereGovDoc(dept_level, dept_id, parentId);
  2660. // String sql = "select count(1) pageCount from ECM_EM_ALERT_REPORT_INPUT where IS_DEL = '0' " +
  2661. // "and IS_RELEASE = '1' and REPORT_TYPE = '" + flg + this.getOneSqlWhere("INPUT_UNIT", dept_id);
  2662. String sql = "select count(1) pageCount from (select FD_ID, NAME, PDATE, WDEPT from ( " +
  2663. "select FD_OBJECTID FD_ID, REPORT_NAME NAME, INPUT_DATE PDATE, INPUT_UNIT WDEPT from " +
  2664. "ECM_EM_ALERT_REPORT_INPUT where IS_DEL = '0' and IS_RELEASE = '1' and REPORT_TYPE = '" +
  2665. flg + "' ) as u1 " + where +
  2666. " order by WDEPT DESC ) as t3" ;
  2667. double pc = emerDao.pageCount(sql);
  2668. return "{\"countList\":" + pc + ",\"countPage\":"+(int)Math.ceil(pc/listNum) + "}";
  2669. }
  2670. return null ;
  2671. }
  2672. /**
  2673. * 应急专报简报
  2674. */
  2675. @ProduceMime("application/json")
  2676. @POST
  2677. @Path("getBriefing")
  2678. public String getBriefing(String params){
  2679. log.info(params);
  2680. String dept_id = Utils.getParameter("deptId", params);
  2681. // String parentId = Utils.getParameter("parentId", params);
  2682. String dept_level = Utils.getParameter("dept_level", params);
  2683. String flg = Utils.getParameter("flg", params);
  2684. String begin = Utils.getParameter("begin", params);
  2685. String end = Utils.getParameter("end", params);
  2686. String parentId = "" ;
  2687. if(this.verifyParams(dept_id)){
  2688. // System.out.println(dept_id);
  2689. parentId = otherDao.getParentId(dept_id);
  2690. }
  2691. if(this.verifyParams(dept_id) && this.verifyParams(parentId) && this.verifyParams(flg) && this.verifyParams(begin) && this.verifyParams(end) && this.verifyParams(dept_level)){
  2692. String where = this.getWhereGovDoc(dept_level, dept_id, parentId) ;
  2693. // String sql = "select FD_ID, NAME, PDATE, RN from ( " +
  2694. // "select FD_ID, NAME, PDATE, ROWNUM RN from ( " +
  2695. // "select FD_OBJECTID FD_ID, REPORT_NAME NAME, INPUT_DATE PDATE from " +
  2696. // "ECM_EM_ALERT_REPORT_INPUT where IS_DEL = '0' and IS_RELEASE = '1' " +
  2697. // "and REPORT_TYPE = ? " + this.getOneSqlWhere("INPUT_UNIT", dept_id) +
  2698. // "order by INPUT_DATE DESC ))where ROWNUM between " + begin + " and " + end ;
  2699. // System.out.println(where);
  2700. // System.out.println(parentId);
  2701. // System.out.println(dept_level);
  2702. String sql = "SELECT FD_ID, NAME, PDATE, RN FROM (SELECT FD_ID, NAME, PDATE, ROWNUM RN FROM ( " +
  2703. "SELECT FD_ID, NAME, PDATE, WDEPT FROM (SELECT FD_OBJECTID FD_ID, REPORT_NAME NAME, " +
  2704. "INPUT_DATE PDATE, INPUT_UNIT WDEPT FROM ECM_EM_ALERT_REPORT_INPUT WHERE " +
  2705. "IS_DEL = '0' AND IS_RELEASE = '1' AND REPORT_TYPE = ? ) AS u1 " + where +
  2706. "ORDER BY PDATE DESC )) as t3 WHERE RN BETWEEN " + begin + " AND " + end ;
  2707. // System.out.println(dept_level+"\t"+dept_id+"\t"+parentId);
  2708. // System.out.println("======================================================");
  2709. // System.out.println(sql);
  2710. // System.out.println(flg);
  2711. return otherDao.getGovDocDayList(sql, flg);
  2712. }
  2713. return null ;
  2714. }
  2715. /**
  2716. * 应急装备查看,队伍(总计数,网省级显示)
  2717. */
  2718. @ProduceMime("application/json")
  2719. @POST
  2720. @Path("/searchErByTeam")
  2721. public String searchErByTeam(String params){
  2722. log.info(params);
  2723. String deptId = Utils.getParameter("deptId", params);
  2724. String st = Utils.getParameter("searchType", params);
  2725. /*String sql = "select FD_OBJECTID FD_ID, TEAM_NAME NAME, TEAM_MEMBER_NUMBER NUM, LONGITUDE, LATITUDE " +
  2726. "from ECM_AM_EMERGENCY_TEAM where IS_DEL='0'" ;*/
  2727. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2728. String sql = "SELECT * FROM TEAM_SCATTER_PROV_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?";
  2729. if(st.equals("1") || st == "1"){
  2730. sql = "SELECT * FROM TEAM_SCATTER_PROV_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2731. }
  2732. log.info("GIS应急资源:应急队伍总数查询:"+sql);
  2733. return erDao.searchErDistByTeam(sql,deptId);
  2734. /*String sql = "select distinct t2.UNIT FD_ID, t3.DEPT_NAME NAME, t2.NUM, CFID, LONGITUDE, LATITUDE from " +
  2735. "ECM_AM_EMERGENCY_TEAM t1 left join (select SUM(TEAM_MEMBER_NUMBER) NUM,COUNT" +
  2736. "(FD_OBJECTID) CFID, TEAM_COMP_ID UNIT from ECM_AM_EMERGENCY_TEAM " +
  2737. "where IS_DEL='0' group by TEAM_COMP_ID) t2 on t1.TEAM_COMP_ID = t2.UNIT " +
  2738. "left join SYS_DEPARTMENT t3 on t2.UNIT = t3.DEPT_ID " +
  2739. "where (t1.LONGITUDE<>NULL OR t1.LONGITUDE IS NOT NULL OR t1.LONGITUDE<>'<NULL>') " +
  2740. "and t1.IS_DEL='0' and t1.LATITUDE<>'' " + this.getOneSqlWhere("t1.TEAM_COMP_ID", deptId);*/
  2741. }
  2742. return null ;
  2743. }
  2744. /**
  2745. * 应急装备查看,发电车和发电机
  2746. */
  2747. @ProduceMime("application/json")
  2748. @POST
  2749. @Path("/searchErByEqui")
  2750. public String searchErByEqui(String params){
  2751. log.info(params);
  2752. String deptId = Utils.getParameter("deptId", params);
  2753. String st = Utils.getParameter("searchType", params);
  2754. // String sql = "select FD_OBJECTID FD_ID, CAR_NAME NAME, CAR_NUM NUM, JINGDU LONGITUDE, WEIDU LATITUDE " +
  2755. // "from EMC_AM_GENERATOR_CAR where IS_DEL='0'" ;
  2756. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2757. /*String sql = "select a.FD_ID, a.NAME, a.NUM CN, b.NUM JN, a.LONGITUDE, a.LATITUDE from ( " +
  2758. "select distinct t2.UNIT FD_ID, t3.DEPT_NAME NAME, t2.NUM, JINGDU LONGITUDE, WEIDU LATITUDE " +
  2759. "from EMC_AM_GENERATOR_CAR t1 left join (select sum(CAR_NUM) NUM, COMP_ID UNIT " +
  2760. "from EMC_AM_GENERATOR_CAR where IS_DEL='0' group by COMP_ID) t2 " +
  2761. "on t1.COMP_ID = t2.UNIT left join SYS_DEPARTMENT t3 on t2.UNIT = t3.DEPT_ID ) as a join ( " +
  2762. "select distinct t2.UNIT FD_ID, t3.DEPT_NAME NAME, t2.NUM, LONGITUDE, LATITUDE " +
  2763. "from EMC_AM_GENERATOR t1 left join (select sum(NUM) NUM, COMP_ID UNIT " +
  2764. "from EMC_AM_GENERATOR where IS_DEL='0' group by COMP_ID) t2 " +
  2765. "on t1.COMP_ID = t2.UNIT left join SYS_DEPARTMENT t3 on t2.UNIT = t3.DEPT_ID " +
  2766. ") as b on a.FD_ID = b.FD_ID AND (a.LONGITUDE<>NULL OR a.LONGITUDE IS NOT NULL OR a.LONGITUDE<>'<NULL>') " +
  2767. "and a.LATITUDE<>'' where 1=1 " + this.getOneSqlWhere("a.FD_ID", deptId);*/
  2768. String sql = "SELECT * FROM EQUI_SCATTER_PROV_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?";
  2769. if(st.equals("1") || st == "1"){
  2770. sql = "SELECT * FROM EQUI_SCATTER_PROV_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2771. }
  2772. return erDao.searchErDistByEquip(sql,deptId);
  2773. }
  2774. return null ;
  2775. }
  2776. /**
  2777. * 应急装备查看,发电车
  2778. */
  2779. @ProduceMime("application/json")
  2780. @POST
  2781. @Path("/searchErByCar")
  2782. public String searchErByCar(String params){
  2783. log.info(params);
  2784. String deptId = Utils.getParameter("deptId", params);
  2785. String st = Utils.getParameter("searchType", params);
  2786. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2787. String sql = "SELECT * FROM EQUI_CAR_SCATTER_PROV_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?";
  2788. if(st.equals("1") || st == "1"){
  2789. sql = "SELECT * FROM EQUI_CAR_SCATTER_PROV_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2790. }
  2791. return erDao.searchErByCar(sql, deptId, "发电车");
  2792. }
  2793. return null ;
  2794. }
  2795. /**
  2796. * 应急装备查看,发电机
  2797. */
  2798. @ProduceMime("application/json")
  2799. @POST
  2800. @Path("/searchErByGen")
  2801. public String searchErByGen(String params){
  2802. log.info(params);
  2803. String deptId = Utils.getParameter("deptId", params);
  2804. String st = Utils.getParameter("searchType", params);
  2805. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2806. String sql = "SELECT * FROM EQUI_GEN_SCATTER_PROV_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?";
  2807. if(st.equals("1") || st == "1"){
  2808. sql = "SELECT * FROM EQUI_GEN_SCATTER_PROV_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2809. }
  2810. log.info("发电机SQL:"+sql);
  2811. return erDao.searchErByCar(sql, deptId, "发电机");
  2812. }
  2813. return null ;
  2814. }
  2815. //
  2816. /**
  2817. * 临时场所查看
  2818. */
  2819. @ProduceMime("application/json")
  2820. @POST
  2821. @Path("/searchErByTempSpace")
  2822. public String searchErByTempSpace(String params){
  2823. log.info(params);
  2824. String place_type = Utils.getParameter("place_type", params);
  2825. String sql = "SELECT T1.FD_OBJECTID FD_ID, LONGITUDE, LATITUDE, SETTLEMENTS_NAME, PLACE, CONTACT_PERSON, " +
  2826. "CONTACT_PERSON_TEL TELEPHONE, T2.NAME ICONNAME FROM ECM_EM_TEMPORARY_SETTLEMENTS T1 LEFT JOIN ECM_CM_GISICON T2 ON " +
  2827. "(T1.PLACE_TYPES = T2.TYPE AND T2.LAYEROUT = 'place') WHERE T1.IS_DEL = '0' AND " +
  2828. "T2.IS_DEL = '0' AND (LONGITUDE<>NULL OR LONGITUDE IS NOT NULL OR LONGITUDE<>'<NULL>') " +
  2829. "AND (LATITUDE<>NULL OR LATITUDE IS NOT NULL OR LATITUDE<>'<NULL>') " ;
  2830. if(this.verifyParams(place_type)){
  2831. sql += this.getOneSqlWhere("PLACE_TYPES", place_type);
  2832. }
  2833. return erDao.searchErPlace(sql);
  2834. }
  2835. /**
  2836. * 应急队伍分布查询,地市级显示
  2837. */
  2838. @ProduceMime("application/json")
  2839. @POST
  2840. @Path("/searchErByTeamPrev")
  2841. public String searchErByTeamPrev(String params){
  2842. log.info(params);
  2843. String deptId = Utils.getParameter("deptId", params);
  2844. String st = Utils.getParameter("searchType", params);
  2845. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2846. String sql = "SELECT * FROM NWYJ.TEAM_SCATTER_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?" ;
  2847. if(st.equals("1") || st == "1"){
  2848. sql = "SELECT * FROM NWYJ.TEAM_SCATTER_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2849. }
  2850. log.info("GIS队伍分布查询:"+sql+"; param:"+deptId);
  2851. System.out.println(sql+"======="+deptId);
  2852. return erDao.getTeamScatter(sql, deptId);
  2853. }
  2854. return null ;
  2855. }
  2856. /**
  2857. * 应急装备(发电机)分布查询,地市级显示
  2858. */
  2859. @ProduceMime("application/json")
  2860. @POST
  2861. @Path("/searchErByEquiPrev")
  2862. public String searchErByEquiPrev(String params){
  2863. log.info(params);
  2864. String deptId = Utils.getParameter("deptId", params);
  2865. String st = Utils.getParameter("searchType", params);
  2866. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2867. String sql = "SELECT * FROM DYNAMO_SCATTER_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?" ;
  2868. if(st.equals("1") || st == "1"){
  2869. sql = "SELECT * FROM DYNAMO_SCATTER_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2870. }
  2871. return erDao.getEquiScatter(sql, deptId, "发电机","edui_prev");
  2872. }
  2873. return null ;
  2874. }
  2875. /**
  2876. * 应急装备(发电车)分布查询,地市级显示
  2877. */
  2878. @ProduceMime("application/json")
  2879. @POST
  2880. @Path("/searchErByEquiCarPrev")
  2881. public String searchErByEquiCarPrev(String params){
  2882. log.info(params);
  2883. String deptId = Utils.getParameter("deptId", params);
  2884. String st = Utils.getParameter("searchType", params);
  2885. if(this.verifyParams(deptId) && this.verifyParams(st)){
  2886. String sql = "SELECT * FROM CAR_SCATTER_GIS_VIEW WHERE DEPT_ID = ? OR PARENT_ID = ?" ;
  2887. if(st.equals("1") || st == "1"){
  2888. sql = "SELECT * FROM CAR_SCATTER_GIS_VIEW WHERE ?=? " + this.getOneSqlWhere("DEPT_ID", deptId) ;
  2889. }
  2890. return erDao.getEquiScatter(sql, deptId, "发电车","car_prev");
  2891. }
  2892. return null ;
  2893. }
  2894. /* @ProduceMime("application/json")
  2895. @POST
  2896. @Path("/searchErByCar")
  2897. public String searchErByCar(String params){
  2898. log.info(params);
  2899. String deptId = Utils.getParameter("deptId", params);
  2900. // String sql = "select FD_OBJECTID FD_ID, CAR_NAME NAME, CAR_NUM NUM, JINGDU LONGITUDE, WEIDU LATITUDE " +
  2901. // "from EMC_AM_GENERATOR_CAR where IS_DEL='0'" ;
  2902. if(this.verifyParams(deptId)){
  2903. String sql = "select distinct t2.UNIT FD_ID, t3.DEPT_NAME NAME, t2.NUM, JINGDU LONGITUDE, WEIDU LATITUDE " +
  2904. "from EMC_AM_GENERATOR_CAR t1 left join (select sum(CAR_NUM) NUM, COMP_ID UNIT " +
  2905. "from EMC_AM_GENERATOR_CAR where IS_DEL='0' group by COMP_ID) t2 " +
  2906. "on t1.COMP_ID = t2.UNIT left join SYS_DEPARTMENT t3 on t2.UNIT = t3.DEPT_ID " +
  2907. "where 1=1 " + this.getOneSqlWhere("t1.COMP_ID", deptId);
  2908. return erDao.searchErDist(sql, "265");
  2909. }
  2910. return null ;
  2911. }*/
  2912. /**
  2913. * 应急装备查看
  2914. */
  2915. /*@ProduceMime("application/json")
  2916. @POST
  2917. @Path("/searchErByGen")
  2918. public String searchErByGen(String params){
  2919. log.info(params);
  2920. String deptId = Utils.getParameter("deptId", params);
  2921. // String sql = "select FD_OBJECTID FD_ID, NAME, NUM, LONGITUDE, LATITUDE from EMC_AM_GENERATOR where IS_DEL='0'" ;
  2922. if(this.verifyParams(deptId)){
  2923. String sql = "select distinct t2.UNIT FD_ID, t3.DEPT_NAME NAME, t2.NUM, LONGITUDE, LATITUDE " +
  2924. "from EMC_AM_GENERATOR t1 left join (select sum(NUM) NUM, COMP_ID UNIT " +
  2925. "from EMC_AM_GENERATOR where IS_DEL='0' group by COMP_ID) t2 " +
  2926. "on t1.COMP_ID = t2.UNIT left join SYS_DEPARTMENT t3 on t2.UNIT = t3.DEPT_ID " +
  2927. "where 1=1 " + this.getOneSqlWhere("t1.COMP_ID", deptId);
  2928. return erDao.searchErDist(sql, "266");
  2929. }
  2930. return null ;
  2931. }*/
  2932. /**
  2933. * 查询网公司发布的应急预警通知单
  2934. */
  2935. @ProduceMime("application/json")
  2936. @POST
  2937. @Path("getCompanyHeadquartersEwer")
  2938. public String getCompanyHeadquartersEwer(){
  2939. String sql = "SELECT FD_OBJECTID, EARLY_WARNING_NAME NAME,decode(CURRENT_EW_LEVEL,null,CURRENT_ER_LEVEL, " +
  2940. "CURRENT_EW_LEVEL)ELEVEL FROM ECM_EM_PUBLISH_ALERT_NOTICE t1 " +
  2941. "WHERE IS_DEL = '0' AND IS_SEND = '5' AND RELEASE_UNIT = (" +
  2942. "SELECT DEPT_ID FROM SYS_DEPARTMENT WHERE IS_DEL = '0' AND PARENT_ID = '0') " ;
  2943. return ewerDao.getCompanyHeadquartersEwer(sql);
  2944. }
  2945. /**
  2946. * 变电站视频树形结构
  2947. * @param params
  2948. * @return
  2949. */
  2950. @ProduceMime("application/json")
  2951. @POST
  2952. @Path("getSync")
  2953. public String getSync(String params){
  2954. log.info(params);
  2955. // String parentID = Utils.getParameter("id", params) == null ? "0" : Utils.getParameter("id", params);
  2956. String parentID = Utils.getParameter("id", params) ;
  2957. String deptId = Utils.getParameter("deptId", params);
  2958. String sql ;
  2959. if(this.verifyParams(parentID)){
  2960. sql = "select FD_OBJECTID FD_ID,EM_ID ID, EM_NAME NAME, PARENT_ID PID, CAMERA, EM_NUM, SUBLEVEL " +
  2961. "from ECM_CM_SYNCVIDEOTREE where parent_id = '" + parentID + "' and IS_DEL = '0' and " +
  2962. "(EM_NAME is not null OR EM_NAME<>'<NULL>') order by EM_NUM " ;
  2963. }else{
  2964. if(this.verifyParams(deptId)){
  2965. if(deptId=="1" || "1".equals(deptId)){
  2966. sql = "select FD_OBJECTID FD_ID,EM_ID ID, EM_NAME NAME, PARENT_ID PID, CAMERA, EM_NUM, SUBLEVEL " +
  2967. "from ECM_CM_SYNCVIDEOTREE where IS_DEL = '0' and " +
  2968. "(EM_NAME is not null OR EM_NAME<>'<NULL>') order by EM_NUM " ;
  2969. }else{
  2970. sql = "select FD_OBJECTID FD_ID,EM_ID ID, EM_NAME NAME, PARENT_ID PID, CAMERA, EM_NUM, SUBLEVEL " +
  2971. "from ECM_CM_SYNCVIDEOTREE where DEPT_ID = '" + deptId + "' and IS_DEL = '0' and " +
  2972. "(EM_NAME is not null OR EM_NAME<>'<NULL>') order by EM_NUM " ;
  2973. }
  2974. }else{
  2975. return null ;
  2976. }
  2977. }
  2978. // System.out.println("===============================================================================================");
  2979. // System.out.println(sql);
  2980. return otherDao.SyncTree(sql);
  2981. }
  2982. @ProduceMime("application/json")
  2983. @POST
  2984. @Path("getSyncConfig")
  2985. public String getSyncConfig(){
  2986. ConfigManager cm = ConfigManager.getInstance();
  2987. StringBuffer sb = new StringBuffer();
  2988. sb.append("{\"ip\":\"" + cm.getProper("emergency.ip") + "\",\"port\":\"" + cm.getProper("emergency.port") +
  2989. "\",\"name\":\"" + cm.getProper("emergency.userName") + "\",\"pwd\":\"" + cm.getProper("emergency.pwd") +
  2990. "\",\"mode\":\"" + cm.getProper("emergency.mode") + "\"}");
  2991. return sb.toString();
  2992. }
  2993. // @ProduceMime("application/json")
  2994. // @POST
  2995. // @Path("/getDeptInfo")
  2996. // public String getDeptInfo(String params){
  2997. // log.info(params);
  2998. // String deptId = Utils.getParameter("deptId", params);
  2999. // InDepartmentService depts = new InDepartmentService();
  3000. // if(this.verifyParams(deptId)){
  3001. // String result = depts.getDepartmentInfo(deptId);
  3002. // return result ;
  3003. // }
  3004. // return null ;
  3005. // }
  3006. /**
  3007. * 地图保存图片功能用
  3008. * @param params
  3009. * @return
  3010. */
  3011. @ProduceMime("application/json")
  3012. @POST
  3013. @Path("getImg")
  3014. public String getImg(String params) {
  3015. log.info(params);
  3016. String imgCode = Utils.getParameter("imgCode", params) ;
  3017. BASE64Decoder decoder = new BASE64Decoder();
  3018. String separator = System.getProperty("file.separator");
  3019. String rootPath = System.getProperty("user.dir");
  3020. rootPath = rootPath.substring(0,rootPath.length()-3);
  3021. String tempPath = rootPath + "webapps" + separator + "nwyj" + separator + "upload" + separator +
  3022. "NwyjTemp" + separator + "CockpitImg" ;
  3023. String uidFile = UUID.randomUUID().toString() ;
  3024. String fileName = separator + uidFile ;
  3025. String imgName = separator + "map.png" ;
  3026. String filePath = tempPath + separator + fileName ;
  3027. String imgPath = filePath + separator + imgName ;
  3028. File folder = new File(filePath);
  3029. if(!(folder.exists() && folder.isDirectory())){
  3030. folder.mkdirs();
  3031. }
  3032. try {
  3033. byte[] bytes = decoder.decodeBuffer(imgCode);
  3034. for (int i = 0; i < bytes.length; ++i) {
  3035. if (bytes[i] < 0) {// 调整异常数据
  3036. bytes[i] += 256;
  3037. }
  3038. }
  3039. OutputStream out = new FileOutputStream(imgPath);
  3040. out.write(bytes);
  3041. out.flush();
  3042. out.close();
  3043. } catch (IOException e) { e.printStackTrace(); }
  3044. return "{\"path\":\"" + uidFile + "\"}" ;
  3045. }
  3046. /**
  3047. * 将地图临时文件
  3048. * @param params
  3049. * @return
  3050. */
  3051. @ProduceMime("application/json")
  3052. @POST
  3053. @Path("delTempImg")
  3054. public String delTempImg(String params) {
  3055. log.info(params);
  3056. String imgFile = Utils.getParameter("imgFile", params) ;
  3057. String separator = System.getProperty("file.separator");
  3058. String rootPath = System.getProperty("user.dir");
  3059. rootPath = rootPath.substring(0,rootPath.length()-3);
  3060. String tempPath = rootPath + "webapps" + separator + "nwyj" + separator + "upload" + separator +
  3061. "NwyjTemp" + separator + "CockpitImg" ;
  3062. String fileName = separator + imgFile ;
  3063. String filePath = tempPath + fileName ;
  3064. String imgName = separator + "map.png" ;
  3065. String imgPath = filePath + imgName ;
  3066. File folder = new File(filePath);
  3067. File imgFolder = new File(imgPath);
  3068. if(!(folder.exists() && folder.isDirectory())){
  3069. return null ;
  3070. } else {
  3071. if(imgFolder.exists()){
  3072. imgFolder.delete();
  3073. }
  3074. Boolean flg = folder.delete();
  3075. return "{\"res\":\"" + flg + "\"}" ;
  3076. }
  3077. }
  3078. /**
  3079. * 保存台风模拟路径信息
  3080. * @return
  3081. */
  3082. @ProduceMime("application/json")
  3083. @POST
  3084. @Path("addSimulateTyphoonPath")
  3085. public String addSimulateTyphoonPath(String params){
  3086. log.info(params);
  3087. String simu = Utils.getParameter("SIMU", params);
  3088. String info = Utils.getParameter("INFO", params);
  3089. SimulateTyphoon st = JsonPluginsUtil.jsonToBean(simu,SimulateTyphoon.class);
  3090. List<SimulateTyphoonInfo> list = new ArrayList<SimulateTyphoonInfo>() ;
  3091. list = JsonPluginsUtil.jsonToBeanList(info, SimulateTyphoonInfo.class);
  3092. tran.addSimulateTyphoonPath(list, st);
  3093. return null ;
  3094. }
  3095. @ProduceMime("application/json")
  3096. @POST
  3097. @Path("getHistoryTyphoonPath")
  3098. public String getHistoryTyphoonPath(String params){
  3099. log.info(params);
  3100. String sid = Utils.getParameter("sid", params);
  3101. if(this.verifyParams(sid)){
  3102. String sql = "SELECT FD_OBJECTID FD_ID, LONGITUDE, LATITUDE, SEVEN_RADIUS, TEN_RADIUS, TWELVE_RADIUS, " +
  3103. "MAX_STRENGTH, MAX_SPEED, MOVEMENT_SPEED, CENTRAL_PRESSURE, ORIENTATION, CREATE_TIME " +
  3104. "FROM ECM_CM_SIMULATETYPHOONPATHINFO WHERE SIMULATEPATH_ID = ? ORDER BY ORDER_NUM " ;
  3105. /*String sql = "SELECT FD_OBJECTID FD_ID, LONGITUDE, LATITUDE, SEVEN_RADIUS, TEN_RADIUS, TWELVE_RADIUS, " +
  3106. "MAX_STRENGTH, MAX_SPEED, MOVEMENT_SPEED, CENTRAL_PRESSURE, ORIENTATION, CREATE_TIME " +
  3107. "FROM ECM_CM_SIMULATETYPHOONPATHINFO WHERE SIMULATEPATH_ID = '" + sid + "' ORDER BY ORDER_NUM " ;*/
  3108. return typhDao.getHistoryPath(sql, sid);
  3109. }
  3110. return null;
  3111. }
  3112. /*public static String readText(String filename){
  3113. String content = "" ;
  3114. try{
  3115. File file = new File(filename);
  3116. if(file.exists()){
  3117. FileReader fr = new FileReader(file);
  3118. BufferedReader br = new BufferedReader(fr);
  3119. String str = "" ;
  3120. String newline = "" ;
  3121. while((str = br.readLine())!= null){
  3122. content += newline + str ;
  3123. newline = "\n";
  3124. }
  3125. br.close();
  3126. fr.close();
  3127. }
  3128. } catch(IOException e) { e.printStackTrace(); }
  3129. return content ;
  3130. }*/
  3131. }