c7f811a4fb83907388686a1f72cc5ff5454c263a.svn-base 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  1. package com.sinosoft.em.baobiao.rcbb.service;
  2. import java.io.File;
  3. import java.io.UnsupportedEncodingException;
  4. import java.sql.Connection;
  5. import java.sql.PreparedStatement;
  6. import java.sql.ResultSet;
  7. import java.sql.SQLException;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. import java.util.UUID;
  11. import javax.servlet.http.HttpServletRequest;
  12. import javax.servlet.http.HttpServletResponse;
  13. import javax.ws.rs.POST;
  14. import javax.ws.rs.Path;
  15. import javax.ws.rs.ProduceMime;
  16. import javax.ws.rs.core.Context;
  17. import net.sf.json.JSONArray;
  18. import org.apache.log4j.Logger;
  19. import org.springframework.web.context.request.RequestContextHolder;
  20. import org.springframework.web.context.request.ServletRequestAttributes;
  21. import com.formaction.Parameter;
  22. import com.formaction.Utils;
  23. import com.formaction.vo.Msg;
  24. import com.persistence.DbConnection;
  25. import com.persistence.service.PersistenceFactory;
  26. import com.persistence.service.SysPersistence;
  27. import com.persistence.service.assitant.generator.IdentityGenerator;
  28. import com.persistence.service.exception.PersistenceException;
  29. import com.sinosoft.common.upLoad.service.UploadManageImpl;
  30. import com.sinosoft.common.upLoad.util.SmartUpload;
  31. import com.sinosoft.common.util.FilePathUtil;
  32. import com.sinosoft.em.alert.report.reportInputPlan.vo.KeyValue;
  33. import com.sinosoft.em.baobiao.rcbb.dao.RcBaoBiaoDao;
  34. import com.sinosoft.em.baobiao.rcbb.dao.RcBaoBiaoExcel;
  35. import com.sinosoft.em.baobiao.rcbb.dao.RcBbDao;
  36. import com.sinosoft.em.baobiao.xianlutingyun.dao.ReportPlanMonitor;
  37. import com.sinosoft.em.baobiao.xianlutingyun.dao.WaitDoDao;
  38. import com.sinosoft.em.baobiao.xianlutingyun.dao.XianluTingyunExcel;
  39. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  40. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  41. @Path("/RcBbService/")
  42. public class RcBbService{
  43. @Context
  44. private org.apache.cxf.jaxrs.ext.MessageContext mc;
  45. private final Logger log = Logger.getLogger(getClass());
  46. @POST
  47. @ProduceMime("text/html")
  48. @Path("/importXianlutingyun")
  49. public String importXianlutingyun(@Context HttpServletRequest request,
  50. @Context HttpServletResponse response) throws Exception{//新增保存
  51. Msg m=new Msg();
  52. UploadManageImpl upload2 = new UploadManageImpl();
  53. String path = upload2.uploadFilePath(request, response);
  54. String result="";
  55. log.info("saveFile.path===="+path);
  56. if("success".equals(path.split(";")[1])){
  57. //将数据返回到界面
  58. path=path.split(";")[2];
  59. String report_type=request.getParameter("report_type");
  60. XianluTingyunExcel xte=new XianluTingyunExcel();
  61. result=xte.readExcelByName("",path,report_type,"","");
  62. }else{
  63. //返回失败信息
  64. result="";
  65. }
  66. return result;
  67. }
  68. /**
  69. * 将界面传输过来的数据保存到数据库
  70. * @param params
  71. * @return
  72. * @throws ClassNotFoundException
  73. */
  74. //@ProduceMime("application/json")
  75. //@POST
  76. //@Path("/importSave")
  77. // public Msg importSave(String params){
  78. //
  79. // Msg m=new Msg();
  80. // XianluTingyunExcel xte=new XianluTingyunExcel();
  81. // try {
  82. // m=xte.xianluToDb(params);
  83. // } catch (ClassNotFoundException e) {
  84. //
  85. // e.printStackTrace();
  86. // }
  87. // return m;
  88. // }
  89. @ProduceMime("application/json")
  90. @POST
  91. @Path("/getRowName")
  92. public String getRowName(String params){//初始化获取子单位
  93. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  94. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  95. RcBbDao bbd=new RcBbDao();
  96. String result=bbd.getRowName(comp_id,report_type);
  97. return result;
  98. }
  99. @ProduceMime("application/json")
  100. @POST
  101. @Path("/getBaoBiaoData")
  102. public String getBaoBiaoData(String params){//初始化获取子单位
  103. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  104. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  105. String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
  106. String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
  107. RcBbDao bbd=new RcBbDao();
  108. String result=bbd.getBaoBiaoData(comp_id,report_type,year,season);
  109. return result;
  110. }
  111. @ProduceMime("application/json")
  112. @POST
  113. @Path("/query")
  114. public String query(String params){//查看功能
  115. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  116. String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  117. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  118. RcBbDao bbd=new RcBbDao();
  119. String result=bbd.query(report_id,report_type);
  120. return result;
  121. }
  122. @ProduceMime("application/json")
  123. @POST
  124. @Path("/create")
  125. public Msg create(String params) throws ClassNotFoundException{//保存数据
  126. Msg m=new Msg();
  127. String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
  128. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  129. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  130. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);//预警编号
  131. String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  132. String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
  133. String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
  134. String type=Utils.getParameter("type", params)==null?"":Utils.getParameter("type", params);
  135. RcBaoBiaoExcel xte=new RcBaoBiaoExcel();
  136. //List<Map<String, String>> list = JsonPluginsUtil.jsonToMapList(json);
  137. String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(99);
  138. //保存数据
  139. try {
  140. // String report_id=createMsgId(getMsgId());
  141. m=xte.xianluToDb(fd_id,json,report_id,report_type);
  142. } catch (ClassNotFoundException e) {
  143. e.printStackTrace();
  144. }
  145. RcBbDao bbd=new RcBbDao();
  146. //保存状态(保存||上报)
  147. try {
  148. m=bbd.save(fd_id,user_id,report_id,report_type,comp_id,year,season,type);
  149. } catch (ClassNotFoundException e) {
  150. e.printStackTrace();
  151. }
  152. //将上报的数据写入上级保存的报表中
  153. if(!("save".equals(type)||("C984DC9C294A486096C25FAA78C99AED".equals(comp_id)))){
  154. int result = 0;//0上级公司未保存相关数据 1写入数据成功 2写入数据失败
  155. try {
  156. result=bbd.updateProvinceData(json,report_type,comp_id,year,season,null,"send");
  157. } catch (Exception e) {
  158. e.printStackTrace();
  159. }
  160. log.info(result);
  161. }
  162. return m;
  163. }
  164. /* public String createMsgId(List<String> list) throws ClassNotFoundException{
  165. long l=(long) ((Math.random()+1)*1000000000);
  166. String msgId=l+"";
  167. if(list.contains(msgId)){
  168. return createMsgId(list);
  169. }
  170. else{
  171. // log.info("msgid==="+msgId);
  172. return msgId;
  173. }
  174. }*/
  175. /* public List<String> getMsgId() throws ClassNotFoundException {
  176. String sql = "SELECT FD_OBJECTID FROM REPORT_RECORDS";
  177. Connection conn = null;
  178. Statement stat = null;
  179. ResultSet rs = null;
  180. DbConnection db = new DbConnection();
  181. try {
  182. conn = db.getConnection();
  183. stat = conn.createStatement();
  184. rs = stat.executeQuery(sql);
  185. List<String> list = new ArrayList();
  186. while (rs.next()) {
  187. list.add(rs.getString("FD_OBJECTID"));
  188. }
  189. return list;
  190. } catch (SQLException e) {
  191. // this.log.error(e.getMessage(), e);
  192. throw new ClassNotFoundException("DAO Layou: 获得数据库消息ID集合"
  193. + sql, e);
  194. } finally {
  195. db.close(rs);
  196. db.close(stat);
  197. db.close(conn);
  198. }
  199. }*/
  200. /**
  201. * 获取可编辑动态表头
  202. * @param params
  203. * @return
  204. */
  205. @ProduceMime("application/json")
  206. @POST
  207. @Path("/getEditColumns")
  208. public String getEditColumns(String params){
  209. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  210. String type=Utils.getParameter("type", params)==null?"":Utils.getParameter("type", params);
  211. String comp=Utils.getParameter("compId", params)==null?"":Utils.getParameter("compId", params);
  212. log.info("report_type="+report_type);
  213. // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  214. RcBbDao bbd=new RcBbDao();
  215. String result=bbd.getEditColumnsName(report_type,type,comp);
  216. return result;
  217. }
  218. /**
  219. * 获取不可编辑动态表头
  220. * @param params
  221. * @return
  222. */
  223. @ProduceMime("application/json")
  224. @POST
  225. @Path("/getNoEditColumns")
  226. public String getNoEditColumns(String params){
  227. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  228. log.info("report_type="+report_type);
  229. // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  230. RcBbDao bbd=new RcBbDao();
  231. String result=bbd.getNoEditColumnsName(report_type);
  232. return result;
  233. }
  234. /**
  235. * 获取汇总动态表头
  236. * @param params
  237. * @return
  238. */
  239. @ProduceMime("application/json")
  240. @POST
  241. @Path("/getHuizongColumns")
  242. public String getHuizongColumns(String params){
  243. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  244. log.info("report_type="+report_type);
  245. // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  246. RcBbDao bbd=new RcBbDao();
  247. String result=bbd.getHuizongColumnsName(report_type);
  248. log.info("resut="+result);
  249. return result;
  250. }
  251. /**
  252. * 上报功能
  253. * @param params--fd_id
  254. * @return
  255. */
  256. @ProduceMime("application/json")
  257. @POST
  258. @Path("/appear")
  259. public Msg appear(String params){
  260. Msg m=new Msg();
  261. ReportPlanMonitor rpm=new ReportPlanMonitor();
  262. rpm.getList();
  263. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  264. RcBbDao bbd=new RcBbDao();
  265. try {
  266. m=bbd.appear(fd_id);
  267. } catch (ClassNotFoundException e) {
  268. e.printStackTrace();
  269. }
  270. return m;
  271. }
  272. /**
  273. * 上报撤回功能
  274. * @param params--fd_id
  275. * @return
  276. */
  277. @ProduceMime("application/json")
  278. @POST
  279. @Path("/appearRollBack")
  280. public Msg appearRollBack(String params){
  281. Msg m=new Msg();
  282. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  283. RcBbDao bbd=new RcBbDao();
  284. try {
  285. m=bbd.appearRollBack(fd_id);
  286. } catch (ClassNotFoundException e) {
  287. e.printStackTrace();
  288. }
  289. return m;
  290. }
  291. /**
  292. * 查看汇总信息
  293. * @param params--报表类型和公司id
  294. * @return
  295. */
  296. @ProduceMime("application/json")
  297. @POST
  298. @Path("/huizong")
  299. public String huizong(String params){
  300. String REPORT_TYPE=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  301. String COMP_ID=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  302. String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
  303. String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
  304. log.info("REPORT_TYPE="+REPORT_TYPE);
  305. // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  306. RcBbDao bbd=new RcBbDao();
  307. String result=bbd.huizong(COMP_ID, REPORT_TYPE,year,season);
  308. return result;
  309. }
  310. /**
  311. * 修改操作
  312. * @param params
  313. * @return
  314. */
  315. @ProduceMime("application/json")
  316. @POST
  317. @Path("/update")
  318. public Msg update(String params){
  319. Msg m=new Msg();
  320. String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
  321. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  322. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  323. String stat=Utils.getParameter("stat", params)==null?"":Utils.getParameter("stat", params);
  324. String compId=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  325. log.info("REPORT_TYPE.update="+report_type);
  326. // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  327. RcBbDao bbd=new RcBbDao();
  328. try {
  329. m=bbd.updateTab(json, report_type);
  330. } catch (ClassNotFoundException e) {
  331. e.printStackTrace();
  332. }
  333. try {
  334. m=bbd.updateRecord(fd_id,stat,compId);
  335. } catch (ClassNotFoundException e) {
  336. e.printStackTrace();
  337. }
  338. return m;
  339. }
  340. /**
  341. * 修改操作
  342. * @param params
  343. * @return
  344. */
  345. @ProduceMime("application/json")
  346. @POST
  347. @Path("/delete")
  348. public Msg delete(String params){
  349. log.info(params+"==========params");
  350. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  351. Msg m=new Msg();
  352. RcBbDao bbd=new RcBbDao();
  353. try {
  354. m=bbd.delete(fd_id);
  355. } catch (ClassNotFoundException e) {
  356. e.printStackTrace();
  357. }
  358. return m;
  359. }
  360. /**
  361. * 点击表格中有子节点的节点+,调用地址
  362. * @return
  363. * @throws PersistenceException
  364. */
  365. @ProduceMime("application/json")
  366. @POST
  367. @Path("/huizongInfoList")
  368. public String huizongInfoList() throws PersistenceException {
  369. HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
  370. String compId = request.getParameter("compId");
  371. String year = request.getParameter("year");
  372. String season = request.getParameter("season");
  373. String report_type = request.getParameter("report_type");
  374. RcBbDao dao=new RcBbDao();
  375. String json=dao.huizong(compId, report_type,year,season);
  376. return json;
  377. }
  378. /**
  379. * 获取上一次填报记录
  380. * @return
  381. */
  382. @ProduceMime("application/json")
  383. @POST
  384. @Path("/getLastReport")
  385. public String getLastReport(String params){
  386. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  387. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  388. String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  389. String result="";
  390. RcBbDao bbd=new RcBbDao();
  391. if(comp_id==""){
  392. result=bbd.getLastReport(report_type, user_id);
  393. log.info(result+"=======getLastReport");
  394. }else{
  395. result=bbd.getChildHuiZong(comp_id, report_type);
  396. log.info(result+"=======getLastReport.comp_id");
  397. }
  398. return result;
  399. }
  400. //删除报表记录
  401. @ProduceMime("application/json")
  402. @POST
  403. @Path("/deleteReport")
  404. public Msg deleteReport(String params){
  405. log.info(params+"==========params");
  406. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  407. Msg m=new Msg();
  408. RcBbDao bbd=new RcBbDao();
  409. try {
  410. m=bbd.deleteReport(fd_id);
  411. } catch (ClassNotFoundException e) {
  412. e.printStackTrace();
  413. }
  414. return m;
  415. }
  416. /**
  417. * 获取备用字段下拉框
  418. * @return
  419. */
  420. @ProduceMime("application/json")
  421. @POST
  422. @Path("/getItems")
  423. public String getItems(String params){
  424. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  425. // String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  426. String result="";
  427. RcBbDao bbd=new RcBbDao();
  428. result=bbd.getItems(report_type);
  429. return result;
  430. }
  431. /**
  432. * 将备用字段增加为可用字段
  433. * @return
  434. */
  435. @ProduceMime("application/json")
  436. @POST
  437. @Path("/addDictionary")
  438. public Msg addDictionary(String params){
  439. Msg m=new Msg();
  440. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  441. String table_column=Utils.getParameter("table_column", params)==null?"":Utils.getParameter("table_column", params);
  442. String column_name=Utils.getParameter("column_name", params)==null?"":Utils.getParameter("column_name", params);
  443. String is_count=Utils.getParameter("is_count", params)==null?"":Utils.getParameter("is_count", params);
  444. String table_head=Utils.getParameter("table_head", params)==null?"":Utils.getParameter("table_head", params);
  445. RcBbDao bbd=new RcBbDao();
  446. try {
  447. m=bbd.addDictionary(report_type, table_column, column_name, is_count, table_head);
  448. } catch (ClassNotFoundException e) {
  449. m.setSucsess(new Boolean(false).toString());
  450. m.setInfo(Parameter.DELETE_FAILURE);
  451. e.printStackTrace();
  452. }
  453. return m;
  454. }
  455. // public Msg deleteDictionary(String params){
  456. // Msg m=new Msg();
  457. // String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  458. // RcBbDao bbd=new RcBbDao();
  459. // try {
  460. // m=bbd.deleteDictionary(fd_id);
  461. // } catch (ClassNotFoundException e) {
  462. // m.setSucsess(new Boolean(false).toString());
  463. // m.setInfo(Parameter.DELETE_FAILURE);
  464. // e.printStackTrace();
  465. // }
  466. // return m;
  467. // }
  468. /**
  469. * 报送
  470. */
  471. @ProduceMime("application/json")
  472. @POST
  473. @Path("/send")
  474. public String send(String params){
  475. Msg m=new Msg();
  476. String result="";
  477. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  478. String userId=Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
  479. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  480. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  481. // String fd_id=request.getParameter("fd_id");
  482. // String userId=request.getParameter("userId");
  483. // String report_type=request.getParameter("report_type");
  484. // String comp_id=request.getParameter("comp_id");
  485. RcBbDao bbd=new RcBbDao();
  486. try {
  487. // bbd.getChildHuiZong(comp_id, report_type);
  488. result=bbd.send( fd_id, userId, report_type, comp_id);
  489. } catch (ClassNotFoundException e) {
  490. e.printStackTrace();
  491. }
  492. //将上报的数据写入上级保存的报表中
  493. if(!("C984DC9C294A486096C25FAA78C99AED".equals(comp_id))){
  494. int num = 0;
  495. try {
  496. num = bbd.updateProvinceData1(fd_id,report_type,comp_id);
  497. } catch (Exception e) {
  498. e.printStackTrace();
  499. }
  500. log.info(num);
  501. }
  502. return result;
  503. }
  504. /**
  505. * 撤回报送
  506. */
  507. @ProduceMime("application/json")
  508. @POST
  509. @Path("/sendRollBack")
  510. public Msg sendRollBack(String params){
  511. Msg m=new Msg();
  512. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  513. RcBbDao bbd=new RcBbDao();
  514. try {
  515. m=bbd.sendRollBack(fd_id);
  516. } catch (ClassNotFoundException e) {
  517. e.printStackTrace();
  518. }
  519. //将上报的数据从上级保存的报表中删除
  520. int num = 0;
  521. try {
  522. num = bbd.recall(fd_id);
  523. } catch (Exception e) {
  524. e.printStackTrace();
  525. }
  526. log.info(num);
  527. return m;
  528. }
  529. //将上报的数据从上级保存的报表中删除
  530. @ProduceMime("application/json")
  531. @POST
  532. @Path("/sendRollBack1")
  533. public Msg sendRollBack1(String params){
  534. Msg m=new Msg();
  535. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  536. RcBbDao bbd=new RcBbDao();
  537. int num = 0;
  538. try {
  539. num = bbd.recall(fd_id);
  540. } catch (Exception e) {
  541. e.printStackTrace();
  542. }
  543. log.info(num);
  544. if(num==1){
  545. m.setInfo("success");
  546. }
  547. return m;
  548. }
  549. /**
  550. * 获取预警响应编号
  551. *
  552. */
  553. @POST
  554. @ProduceMime("application/json")
  555. @Path("/getReportWarnningNumber/")
  556. public String getReportInputPlanAlert(String params){
  557. String unit = Utils.getParameter("unitId", params);
  558. //String is_alert = Utils.getParameter("is_alert", params);
  559. String comp_id = Utils.getParameter("comp_id", params);
  560. String role_id = Utils.getParameter("role_id", params);
  561. String sql="select x.EARLY_WARNING_ID key,x.EARLY_WARNING_NAME value from ECM_EM_PUBLISH_ALERT_NOTICE x where IS_DEL=0 and IS_SEND =5 and x.EARLY_WARNING_ID not in (select a.warning_number from report_schedule a, sys_user_role_rel b where a.comp_id='"+comp_id+"' and a.is_del ='0' and b.role_id='"+role_id+"' and a.user_id = b.user_id) and EARLY_WARNING_AREA_ID='"+comp_id+"'" ;
  562. log.info(sql+"=======sql");
  563. SysModel sysmodel = ModelFactory.getSysmodel();
  564. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  565. ArrayList<String[]> list = null;
  566. ArrayList<KeyValue> kvList = null;
  567. try {
  568. list = persistence.getSearchResult(827, sql);
  569. if(list != null){
  570. kvList = new ArrayList<KeyValue>();
  571. for(int i =0;i < list.size();i++){
  572. kvList.add(new KeyValue(list.get(i)[0],list.get(i)[0]));
  573. }
  574. }
  575. } catch (PersistenceException e) {
  576. e.printStackTrace();
  577. }
  578. return JSONArray.fromObject(kvList).toString();
  579. }
  580. //获取填报计划的响应编号
  581. @POST
  582. @ProduceMime("application/json")
  583. @Path("getReportNumber")
  584. public String getReportNumber(String params){
  585. //String comp_id = Utils.getParameter("comp_id", params);
  586. //String report_type = Utils.getParameter("report_type", params);
  587. String dept_id = Utils.getParameter("dept_id", params);
  588. String sql = "select WARNING_NUMBER from report_schedule where comp_id = '"+dept_id+"' and send_stat<>'2' and WARNING_NUMBER IS NOT NULL";
  589. log.info(sql+"getReportNumber.sql");
  590. SysModel sysmodel = ModelFactory.getSysmodel();
  591. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  592. List<String[]> list = null;
  593. List<KeyValue> list1 = null;
  594. try {
  595. list = persistence.getSearchResult(99, sql);
  596. if(list!=null){
  597. list1 = new ArrayList<KeyValue>();
  598. for(int i=0;i<list.size();i++){
  599. list1.add(new KeyValue(list.get(i)[0],list.get(i)[0]));
  600. }
  601. }
  602. } catch (PersistenceException e) {
  603. e.printStackTrace();
  604. }
  605. return JSONArray.fromObject(list1).toString();
  606. }
  607. //删除报表记录
  608. @ProduceMime("application/json")
  609. @POST
  610. @Path("/deletePlan")
  611. public Msg deletePlan(String params){
  612. log.info(params+"==========params");
  613. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  614. Msg m=new Msg();
  615. RcBbDao bbd=new RcBbDao();
  616. try {
  617. m=bbd.deleteReportPlan(fd_id);
  618. } catch (ClassNotFoundException e) {
  619. e.printStackTrace();
  620. }
  621. return m;
  622. }
  623. //报送报表记录
  624. @ProduceMime("application/json")
  625. @POST
  626. @Path("/SendPlan")
  627. public String SendPoretPlan(String params){
  628. log.info(params+"==========params");
  629. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  630. String result="";
  631. RcBbDao bbd=new RcBbDao();
  632. try {
  633. result=bbd.SendReportPlan(fd_id);
  634. } catch (ClassNotFoundException e) {
  635. e.printStackTrace();
  636. }
  637. return result;
  638. }
  639. @ProduceMime("application/json")
  640. @POST
  641. @Path("/DeletePoretPlan")
  642. public Msg DeletePoretPlan(String params){
  643. log.info(params+"==========params");
  644. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  645. Msg m=new Msg();
  646. RcBbDao bbd=new RcBbDao();
  647. try {
  648. m=bbd.DeleteReportPlan(fd_id);
  649. } catch (ClassNotFoundException e) {
  650. e.printStackTrace();
  651. }
  652. return m;
  653. }
  654. /**
  655. * 获取下级填报记录汇总
  656. * @return
  657. */
  658. @ProduceMime("application/json")
  659. @POST
  660. @Path("/getChildHzReport")
  661. public String getChildHzReport(String params){
  662. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  663. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  664. String result="";
  665. RcBbDao bbd=new RcBbDao();
  666. result=bbd.getChildHuiZong(comp_id, report_type);
  667. return result;
  668. }
  669. /**
  670. * 获取下级填报记录汇总
  671. * @return
  672. */
  673. @ProduceMime("application/json")
  674. @POST
  675. @Path("/getChildComp")
  676. public String getChildComp(String params){
  677. String role_id=Utils.getParameter("role_id", params)==null?"":Utils.getParameter("role_id", params);
  678. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  679. String result="";
  680. RcBbDao bbd=new RcBbDao();
  681. result=bbd.getChildComp(role_id, comp_id);
  682. return result;
  683. }
  684. /**
  685. * 获取线路停运明细数据
  686. * @return
  687. */
  688. @ProduceMime("application/json")
  689. @POST
  690. @Path("/getRouteDetails")
  691. public String getRouteDetails(String params){
  692. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  693. String route_level=Utils.getParameter("route_level", params)==null?"":Utils.getParameter("route_level", params);
  694. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
  695. .getParameter("pager.pageNo", params);
  696. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
  697. .getParameter("pager.pageSize", params);
  698. String result="";
  699. RcBbDao bbd=new RcBbDao();
  700. result=bbd.getRouteDetails(fd_id, route_level,Integer.parseInt(firstPageNum),Integer.parseInt(limit));
  701. return result;
  702. }
  703. @POST
  704. @ProduceMime("application/json")
  705. @Path("/saveRouteDetial/")
  706. public Msg saveRouteDetial(String params){
  707. Msg msg = new Msg();
  708. String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
  709. String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  710. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  711. String route_level=Utils.getParameter("route_level", params)==null?"":Utils.getParameter("route_level", params);
  712. RcBbDao bbd=new RcBbDao();
  713. try {
  714. msg=bbd.saveRouteDetail(json, report_id,route_level,comp_id);
  715. } catch (ClassNotFoundException e) {
  716. e.printStackTrace();
  717. }
  718. return msg;
  719. }
  720. @POST
  721. @ProduceMime("application/json")
  722. @Path("/getAlertMsg/")
  723. public String getAlertMsg(String params){
  724. String result="";
  725. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  726. RcBbDao bbd=new RcBbDao();
  727. result=bbd.getAlertMsg(comp_id);
  728. return result;
  729. }
  730. @POST
  731. @ProduceMime("application/json")
  732. @Path("/getDBmsg/")
  733. public String getDBmsg(String params){
  734. String result="";
  735. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  736. String role_id=Utils.getParameter("role_id", params)==null?"":Utils.getParameter("role_id", params);
  737. String company_id=Utils.getParameter("company_id", params)==null?"":Utils.getParameter("company_id", params);
  738. WaitDoDao wd=new WaitDoDao();
  739. //result=wd.getMsg(user_id, role_id, company_id);
  740. return result;
  741. }
  742. @POST
  743. @ProduceMime("application/json")
  744. @Path("/getDBNum/")
  745. public String getDBNum(String params){
  746. String result="";
  747. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  748. String role_id=Utils.getParameter("role_id", params)==null?"":Utils.getParameter("role_id", params);
  749. String company_id=Utils.getParameter("company_id", params)==null?"":Utils.getParameter("company_id", params);
  750. log.info(user_id+"==========getDBNum.userid");
  751. WaitDoDao wd=new WaitDoDao();
  752. result=wd.getDBNum( user_id, role_id, company_id);
  753. return result;
  754. }
  755. @POST
  756. @ProduceMime("text/html")
  757. @Path("/getHadDo/")
  758. public String getHadDo(String params){
  759. String result="";
  760. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  761. log.info(user_id+"==========getDBNum.userid");
  762. WaitDoDao wd=new WaitDoDao();
  763. result=wd.getHadDo(user_id);
  764. return result;
  765. }
  766. @POST
  767. @ProduceMime("application/json")
  768. @Path("/getAlertList/")
  769. public String getAlertList(String params){
  770. String result="";
  771. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  772. String dept_id=Utils.getParameter("dept_id", params)==null?"":Utils.getParameter("dept_id", params);
  773. WaitDoDao wd=new WaitDoDao();
  774. result=wd.getAlertMsg(dept_id, user_id);
  775. return result;
  776. }
  777. @POST
  778. @ProduceMime("application/json")
  779. @Path("/updateAlert/")
  780. public Msg updateAlert(String params){
  781. Msg m=new Msg();
  782. String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
  783. String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  784. WaitDoDao wd=new WaitDoDao();
  785. m=wd.updateAlertStat(fd_id, user_id);
  786. return m;
  787. }
  788. @POST
  789. @ProduceMime("application/json")
  790. @Path("/saveAndSend/")
  791. public String saveAndSend(String params){
  792. String result="";
  793. String json = Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
  794. String userId = Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
  795. String compId = Utils.getParameter("compId", params)==null?"":Utils.getParameter("compId", params);
  796. RcBbDao bbd = new RcBbDao();
  797. try {
  798. result = bbd.saveAndSend(compId, userId, json);
  799. } catch (ClassNotFoundException e) {
  800. e.printStackTrace();
  801. }
  802. return result;
  803. }
  804. @POST
  805. @ProduceMime("application/json")
  806. @Path("/updateAndSend/")
  807. public String updateAndSend(String params){
  808. String result="";
  809. String json = Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
  810. String fdId = Utils.getParameter("fdId", params)==null?"":Utils.getParameter("fdId", params);
  811. RcBbDao dao = new RcBbDao();
  812. try {
  813. result = dao.updateAndSend(fdId, json);
  814. } catch (ClassNotFoundException e) {
  815. e.printStackTrace();
  816. }
  817. return result;
  818. }
  819. /**
  820. * GEL
  821. */
  822. @POST
  823. @ProduceMime("application/json")
  824. @Path("/getReportScheduleProjectName/")
  825. public String getReportScheduleProjectName(String params){
  826. try {
  827. params = java.net.URLDecoder.decode(params, "UTF-8");
  828. } catch (UnsupportedEncodingException e1) {
  829. e1.printStackTrace();
  830. }
  831. String WarningNum = Utils.getParameter("WARNING_NUMBER", params) == null ? "" : Utils.getParameter("WARNING_NUMBER", params);
  832. String sql="SELECT FD_OBJECTID,PROJECT_NAME,SEND_STAT FROM REPORT_SCHEDULE WHERE WARNING_NUMBER = '"+WarningNum+"'";
  833. StringBuffer sb = new StringBuffer();
  834. DbConnection dbConn = new DbConnection();
  835. Connection conn = null;
  836. PreparedStatement pstm = null;
  837. ResultSet rs = null ;
  838. try {
  839. conn = dbConn.getConnection();
  840. pstm = conn.prepareStatement(sql);
  841. rs = pstm.executeQuery();
  842. sb.append("[") ;
  843. while(rs.next()){
  844. //sb.append("{\"NAME\":\"" + rs.getString("PROJECT_NAME") + "\",\"SEND_STAT\":\"" + rs.getString("SEND_STAT") + "\"},") ;
  845. sb.append("{\"FD_OBJECTID\":\"" + rs.getString("FD_OBJECTID") + "\",\"NAME\":\"" + rs.getString("PROJECT_NAME") + "\",\"SEND_STAT\":\"" + rs.getString("SEND_STAT") + "\"},") ;
  846. }
  847. sb.deleteCharAt(sb.length()-1) ;
  848. sb.append("]") ;
  849. return sb.length() > 1 ? sb.toString() : null ;
  850. } catch (SQLException e) {
  851. e.printStackTrace();
  852. } catch (ClassNotFoundException e) {
  853. e.printStackTrace();
  854. }try {
  855. if(rs!= null){
  856. rs.close();
  857. }
  858. if(pstm!= null){
  859. pstm.close();
  860. }
  861. if(conn!= null){
  862. conn.close();
  863. }
  864. } catch (SQLException e) {
  865. e.printStackTrace();
  866. }
  867. return null;
  868. }
  869. /**
  870. * GEL
  871. */
  872. @POST
  873. @ProduceMime("application/json")
  874. @Path("/getReportPlanMSG/")
  875. public String getReportPlanMSG(String params){
  876. try {
  877. params = java.net.URLDecoder.decode(params, "UTF-8");
  878. } catch (UnsupportedEncodingException e1) {
  879. e1.printStackTrace();
  880. }
  881. String EarlyWarningId = Utils.getParameter("EARLY_WARNING_ID", params) == null ? "" : Utils.getParameter("EARLY_WARNING_ID", params);
  882. String sql="SELECT FD_OBJECTID,PROGRAMME_NAME,IS_RELEASE FROM ECM_EM_ALERT_REPORT_PLAN WHERE EARLY_WARNING_ID = '"+EarlyWarningId+"'";
  883. StringBuffer sb = new StringBuffer();
  884. DbConnection dbConn = new DbConnection();
  885. Connection conn = null;
  886. PreparedStatement pstm = null;
  887. ResultSet rs = null ;
  888. try {
  889. conn = dbConn.getConnection();
  890. pstm = conn.prepareStatement(sql);
  891. rs = pstm.executeQuery();
  892. sb.append("[") ;
  893. while(rs.next()){
  894. //sb.append("{\"PROGRAMME_NAME\":\"" + rs.getString("PROGRAMME_NAME") + "\",\"IS_RELEASE\":\"" + rs.getString("IS_RELEASE") + "\"},") ;
  895. sb.append("{\"FD_OBJECTID\":\"" + rs.getString("FD_OBJECTID") + "\",\"PROGRAMME_NAME\":\"" + rs.getString("PROGRAMME_NAME") + "\",\"IS_RELEASE\":\"" + rs.getString("IS_RELEASE") + "\"},") ;
  896. }
  897. sb.deleteCharAt(sb.length()-1) ;
  898. sb.append("]") ;
  899. return sb.length() > 1 ? sb.toString() : null ;
  900. } catch (SQLException e) {
  901. e.printStackTrace();
  902. } catch (ClassNotFoundException e) {
  903. e.printStackTrace();
  904. }try {
  905. if(rs!= null){
  906. rs.close();
  907. }
  908. if(pstm!= null){
  909. pstm.close();
  910. }
  911. if(conn!= null){
  912. conn.close();
  913. }
  914. } catch (SQLException e) {
  915. e.printStackTrace();
  916. }
  917. return null;
  918. }
  919. //GEL
  920. @POST
  921. @ProduceMime("application/json")
  922. @Path("/updateReportScheduleSendStat/")
  923. public String updateReportScheduleSendStat(String params){
  924. try {
  925. params = java.net.URLDecoder.decode(params, "UTF-8");
  926. } catch (UnsupportedEncodingException e1) {
  927. e1.printStackTrace();
  928. }
  929. String fd_objectId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
  930. String sql="UPDATE REPORT_SCHEDULE set SEND_STAT='1' where FD_OBJECTID=" + fd_objectId;
  931. StringBuffer sb = new StringBuffer();
  932. DbConnection dbConn = new DbConnection();
  933. Connection conn = null;
  934. PreparedStatement pstm = null;
  935. // ResultSet rs = null ;
  936. try {
  937. conn = dbConn.getConnection();
  938. pstm = conn.prepareStatement(sql);
  939. return pstm.executeUpdate() > 0 ? "true":"false";
  940. } catch (SQLException e) {
  941. e.printStackTrace();
  942. } catch (ClassNotFoundException e) {
  943. e.printStackTrace();
  944. }try {
  945. // if(rs!= null){
  946. // rs.close();
  947. // }
  948. if(pstm!= null){
  949. pstm.close();
  950. }
  951. if(conn!= null){
  952. conn.close();
  953. }
  954. } catch (SQLException e) {
  955. e.printStackTrace();
  956. }
  957. return null;
  958. }
  959. //GEL
  960. @POST
  961. @ProduceMime("application/json")
  962. @Path("/updateAlertReportPlanIsRelease/")
  963. public String updateAlertReportPlanIsRelease(String params){
  964. try {
  965. params = java.net.URLDecoder.decode(params, "UTF-8");
  966. } catch (UnsupportedEncodingException e1) {
  967. e1.printStackTrace();
  968. }
  969. String fd_objectId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
  970. String sql="UPDATE ECM_EM_ALERT_REPORT_PLAN SET IS_RELEASE = '1' WHERE FD_OBJECTID = " + fd_objectId;
  971. StringBuffer sb = new StringBuffer();
  972. DbConnection dbConn = new DbConnection();
  973. Connection conn = null;
  974. PreparedStatement pstm = null;
  975. // ResultSet rs = null ;
  976. try {
  977. conn = dbConn.getConnection();
  978. pstm = conn.prepareStatement(sql);
  979. return pstm.executeUpdate() > 0 ? "true":"false";
  980. } catch (SQLException e) {
  981. e.printStackTrace();
  982. } catch (ClassNotFoundException e) {
  983. e.printStackTrace();
  984. }try {
  985. // if(rs!= null){
  986. // rs.close();
  987. // }
  988. if(pstm!= null){
  989. pstm.close();
  990. }
  991. if(conn!= null){
  992. conn.close();
  993. }
  994. } catch (SQLException e) {
  995. e.printStackTrace();
  996. }
  997. return null;
  998. }
  999. @POST
  1000. @ProduceMime("application/json")
  1001. @Path("/getWriteTabList/")
  1002. public String getWriteTabList(String params){
  1003. String result="";
  1004. String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  1005. String year = Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
  1006. String season = Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
  1007. RcBbDao rb=new RcBbDao();
  1008. result=rb.getWriteTabList(comp_id,season,year);
  1009. return result;
  1010. }
  1011. @POST
  1012. @ProduceMime("application/json")
  1013. @Path("/getRequireTabList/")
  1014. public String getRequireTabList(String params){
  1015. String result="";
  1016. String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  1017. RcBbDao rb=new RcBbDao();
  1018. result=rb.getRequireTabList(comp_id);
  1019. return result;
  1020. }
  1021. @POST
  1022. @ProduceMime("application/json")
  1023. @Path("/getHighChart/")
  1024. public String getHighChart(String params){
  1025. String result="";
  1026. String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  1027. RcBbDao rb=new RcBbDao();
  1028. result=rb.getHighChart( "机构", "11", "438", "2016", "1");
  1029. return result;
  1030. }
  1031. @POST
  1032. @ProduceMime("application/json")
  1033. @Path("/getHuiZongData/")
  1034. public String getHuiZongData(String params){
  1035. String compId=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
  1036. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  1037. String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
  1038. String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
  1039. return new RcBbDao().getHuiZongData(year, season, compId, report_type);
  1040. }
  1041. @POST
  1042. @ProduceMime("application/text")
  1043. @Path("/getSeasionByHz")
  1044. public String getSeasionByHz(String params){
  1045. return new RcBaoBiaoDao().getSeasionByHz();
  1046. }
  1047. @POST
  1048. @ProduceMime("application/json")
  1049. @Path("/getReportTemplete")
  1050. public String getReportTemplete(String params){
  1051. return new RcBaoBiaoDao().getReportTemplete();
  1052. }
  1053. //对有历史记录的报表的保存方法
  1054. @ProduceMime("application/json")
  1055. @POST
  1056. @Path("/create2")
  1057. public Msg create2(String params) throws ClassNotFoundException{//保存数据
  1058. Msg m=new Msg();
  1059. String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
  1060. String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  1061. String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);//预警编号
  1062. String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
  1063. String type=Utils.getParameter("type", params)==null?"":Utils.getParameter("type", params);
  1064. String fd_id = Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  1065. RcBaoBiaoExcel xte=new RcBaoBiaoExcel();
  1066. try {
  1067. // //首先将原来得记录删除
  1068. new RcBaoBiaoDao().deleteHistoryRecords(fd_id, report_type);
  1069. //然后将新纪录插入
  1070. m=xte.xianluToDb(fd_id,json,report_id,report_type);
  1071. } catch (ClassNotFoundException e) {
  1072. e.printStackTrace();
  1073. }
  1074. RcBbDao bbd=new RcBbDao();
  1075. //再判断是改操作是提交还是保存
  1076. try {
  1077. m=bbd.updateRecord(fd_id,type,comp_id);
  1078. } catch (ClassNotFoundException e) {
  1079. e.printStackTrace();
  1080. }
  1081. return m;
  1082. }
  1083. @POST
  1084. @ProduceMime("application/json")
  1085. @Path("/importFileData")
  1086. public Msg importFileData(@Context HttpServletRequest request,@Context HttpServletResponse response){
  1087. Msg msg = new Msg();
  1088. String fileExt = request.getParameter("fileExt");
  1089. String year = request.getParameter("year");
  1090. String season = request.getParameter("season");
  1091. String report_type = request.getParameter("report_type");
  1092. String report_name = request.getParameter("report_name");
  1093. try {
  1094. report_name = java.net.URLDecoder.decode(java.net.URLDecoder.decode(report_name, "utf-8"), "utf-8");
  1095. } catch (UnsupportedEncodingException e1) {
  1096. // TODO Auto-generated catch block
  1097. e1.printStackTrace();
  1098. }
  1099. String filePath = "";
  1100. SmartUpload upload = new SmartUpload();
  1101. upload.initialize(request, response, request.getSession().getServletContext());
  1102. try {
  1103. String uploadPath = FilePathUtil.getUploadPath();
  1104. log.info("路径===:"+uploadPath);
  1105. int currentTotalSize = request.getContentLength();
  1106. log.info("当前上传的附件总大小为-----" + currentTotalSize);
  1107. if (currentTotalSize < 40 * 1024 * 1024) {
  1108. upload.service(request, response);
  1109. upload.setMaxFileSize(100 * 1024 * 1024);
  1110. upload.setTotalMaxFileSize(400 * 1024 * 1024);
  1111. upload.upload();
  1112. com.sinosoft.common.upLoad.util.File file = upload.getFiles().getFile(0);
  1113. String saveName = UUID.randomUUID().toString();
  1114. filePath = uploadPath+File.separator+saveName+"."+fileExt;
  1115. file.saveAs(filePath);
  1116. }
  1117. } catch (Exception e) {
  1118. // TODO Auto-generated catch block
  1119. e.printStackTrace();
  1120. }
  1121. if("".equals(filePath)){
  1122. msg.setSucsess("false");
  1123. msg.setInfo("文件上传失败!");
  1124. }else{
  1125. try {
  1126. msg = new RcBaoBiaoDao().readExcel(year,season,report_type,report_name,filePath,fileExt);
  1127. } catch (Exception e) {
  1128. // TODO Auto-generated catch block
  1129. e.printStackTrace();
  1130. }
  1131. }
  1132. return msg;
  1133. }
  1134. /*@POST
  1135. @ProduceMime("application/json")
  1136. @Path("/createExcelTemplete")
  1137. public Msg createExcelTemplete(String params){
  1138. String comp = Utils.getParameter("comp", params)==null?"":Utils.getParameter("comp", params);
  1139. String report_type = Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
  1140. Msg msg = new RcBaoBiaoDao().createExcelTemplete(comp,report_type);
  1141. return msg;
  1142. }*/
  1143. }