12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265 |
- package com.sinosoft.em.baobiao.rcbb.service;
- import java.io.File;
- import java.io.UnsupportedEncodingException;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.UUID;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.ws.rs.POST;
- import javax.ws.rs.Path;
- import javax.ws.rs.ProduceMime;
- import javax.ws.rs.core.Context;
- import net.sf.json.JSONArray;
- import org.apache.log4j.Logger;
- import org.springframework.web.context.request.RequestContextHolder;
- import org.springframework.web.context.request.ServletRequestAttributes;
- import com.formaction.Parameter;
- import com.formaction.Utils;
- import com.formaction.vo.Msg;
- import com.persistence.DbConnection;
- import com.persistence.service.PersistenceFactory;
- import com.persistence.service.SysPersistence;
- import com.persistence.service.assitant.generator.IdentityGenerator;
- import com.persistence.service.exception.PersistenceException;
- import com.sinosoft.common.upLoad.service.UploadManageImpl;
- import com.sinosoft.common.upLoad.util.SmartUpload;
- import com.sinosoft.common.util.FilePathUtil;
- import com.sinosoft.em.alert.report.reportInputPlan.vo.KeyValue;
- import com.sinosoft.em.baobiao.rcbb.dao.RcBaoBiaoDao;
- import com.sinosoft.em.baobiao.rcbb.dao.RcBaoBiaoExcel;
- import com.sinosoft.em.baobiao.rcbb.dao.RcBbDao;
- import com.sinosoft.em.baobiao.xianlutingyun.dao.ReportPlanMonitor;
- import com.sinosoft.em.baobiao.xianlutingyun.dao.WaitDoDao;
- import com.sinosoft.em.baobiao.xianlutingyun.dao.XianluTingyunExcel;
- import com.sysmodel.datamodel.xmlmodel.ModelFactory;
- import com.sysmodel.datamodel.xmlmodel.able.SysModel;
- @Path("/RcBbService/")
- public class RcBbService{
- @Context
- private org.apache.cxf.jaxrs.ext.MessageContext mc;
-
- private final Logger log = Logger.getLogger(getClass());
- @POST
- @ProduceMime("text/html")
- @Path("/importXianlutingyun")
- public String importXianlutingyun(@Context HttpServletRequest request,
- @Context HttpServletResponse response) throws Exception{//新增保存
- Msg m=new Msg();
- UploadManageImpl upload2 = new UploadManageImpl();
- String path = upload2.uploadFilePath(request, response);
- String result="";
- log.info("saveFile.path===="+path);
- if("success".equals(path.split(";")[1])){
- //将数据返回到界面
- path=path.split(";")[2];
- String report_type=request.getParameter("report_type");
- XianluTingyunExcel xte=new XianluTingyunExcel();
- result=xte.readExcelByName("",path,report_type,"","");
- }else{
- //返回失败信息
- result="";
- }
- return result;
-
- }
- /**
- * 将界面传输过来的数据保存到数据库
- * @param params
- * @return
- * @throws ClassNotFoundException
- */
- //@ProduceMime("application/json")
- //@POST
- //@Path("/importSave")
- // public Msg importSave(String params){
- //
- // Msg m=new Msg();
- // XianluTingyunExcel xte=new XianluTingyunExcel();
- // try {
- // m=xte.xianluToDb(params);
- // } catch (ClassNotFoundException e) {
- //
- // e.printStackTrace();
- // }
- // return m;
- // }
- @ProduceMime("application/json")
- @POST
- @Path("/getRowName")
- public String getRowName(String params){//初始化获取子单位
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.getRowName(comp_id,report_type);
- return result;
- }
- @ProduceMime("application/json")
- @POST
- @Path("/getBaoBiaoData")
- public String getBaoBiaoData(String params){//初始化获取子单位
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
- String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.getBaoBiaoData(comp_id,report_type,year,season);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/query")
- public String query(String params){//查看功能
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.query(report_id,report_type);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/create")
- public Msg create(String params) throws ClassNotFoundException{//保存数据
- Msg m=new Msg();
- String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);//预警编号
- String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
- String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
- String type=Utils.getParameter("type", params)==null?"":Utils.getParameter("type", params);
- RcBaoBiaoExcel xte=new RcBaoBiaoExcel();
- //List<Map<String, String>> list = JsonPluginsUtil.jsonToMapList(json);
- String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(99);
- //保存数据
- try {
- // String report_id=createMsgId(getMsgId());
- m=xte.xianluToDb(fd_id,json,report_id,report_type);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- RcBbDao bbd=new RcBbDao();
- //保存状态(保存||上报)
- try {
- m=bbd.save(fd_id,user_id,report_id,report_type,comp_id,year,season,type);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
-
- //将上报的数据写入上级保存的报表中
- if(!("save".equals(type)||("C984DC9C294A486096C25FAA78C99AED".equals(comp_id)))){
- int result = 0;//0上级公司未保存相关数据 1写入数据成功 2写入数据失败
- try {
- result=bbd.updateProvinceData(json,report_type,comp_id,year,season,null,"send");
- } catch (Exception e) {
- e.printStackTrace();
- }
- log.info(result);
- }
-
-
- return m;
- }
-
- /* public String createMsgId(List<String> list) throws ClassNotFoundException{
- long l=(long) ((Math.random()+1)*1000000000);
- String msgId=l+"";
- if(list.contains(msgId)){
- return createMsgId(list);
- }
- else{
- // log.info("msgid==="+msgId);
- return msgId;
- }
- }*/
-
- /* public List<String> getMsgId() throws ClassNotFoundException {
- String sql = "SELECT FD_OBJECTID FROM REPORT_RECORDS";
- Connection conn = null;
- Statement stat = null;
- ResultSet rs = null;
- DbConnection db = new DbConnection();
- try {
- conn = db.getConnection();
- stat = conn.createStatement();
- rs = stat.executeQuery(sql);
- List<String> list = new ArrayList();
- while (rs.next()) {
- list.add(rs.getString("FD_OBJECTID"));
- }
- return list;
- } catch (SQLException e) {
- // this.log.error(e.getMessage(), e);
- throw new ClassNotFoundException("DAO Layou: 获得数据库消息ID集合"
- + sql, e);
- } finally {
- db.close(rs);
- db.close(stat);
- db.close(conn);
- }
- }*/
-
- /**
- * 获取可编辑动态表头
- * @param params
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getEditColumns")
- public String getEditColumns(String params){
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String type=Utils.getParameter("type", params)==null?"":Utils.getParameter("type", params);
- String comp=Utils.getParameter("compId", params)==null?"":Utils.getParameter("compId", params);
- log.info("report_type="+report_type);
- // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.getEditColumnsName(report_type,type,comp);
- return result;
- }
-
-
- /**
- * 获取不可编辑动态表头
- * @param params
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getNoEditColumns")
- public String getNoEditColumns(String params){
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- log.info("report_type="+report_type);
- // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.getNoEditColumnsName(report_type);
- return result;
- }
-
- /**
- * 获取汇总动态表头
- * @param params
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getHuizongColumns")
- public String getHuizongColumns(String params){
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- log.info("report_type="+report_type);
- // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.getHuizongColumnsName(report_type);
- log.info("resut="+result);
- return result;
- }
-
-
- /**
- * 上报功能
- * @param params--fd_id
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/appear")
- public Msg appear(String params){
- Msg m=new Msg();
- ReportPlanMonitor rpm=new ReportPlanMonitor();
- rpm.getList();
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.appear(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
-
-
- /**
- * 上报撤回功能
- * @param params--fd_id
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/appearRollBack")
- public Msg appearRollBack(String params){
- Msg m=new Msg();
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.appearRollBack(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 查看汇总信息
- * @param params--报表类型和公司id
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/huizong")
- public String huizong(String params){
- String REPORT_TYPE=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String COMP_ID=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
- String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
- log.info("REPORT_TYPE="+REPORT_TYPE);
- // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- RcBbDao bbd=new RcBbDao();
- String result=bbd.huizong(COMP_ID, REPORT_TYPE,year,season);
- return result;
- }
-
- /**
- * 修改操作
- * @param params
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/update")
- public Msg update(String params){
- Msg m=new Msg();
- String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String stat=Utils.getParameter("stat", params)==null?"":Utils.getParameter("stat", params);
- String compId=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- log.info("REPORT_TYPE.update="+report_type);
- // String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.updateTab(json, report_type);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- try {
- m=bbd.updateRecord(fd_id,stat,compId);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 修改操作
- * @param params
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/delete")
- public Msg delete(String params){
- log.info(params+"==========params");
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- Msg m=new Msg();
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.delete(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 点击表格中有子节点的节点+,调用地址
- * @return
- * @throws PersistenceException
- */
- @ProduceMime("application/json")
- @POST
- @Path("/huizongInfoList")
- public String huizongInfoList() throws PersistenceException {
- HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
- String compId = request.getParameter("compId");
- String year = request.getParameter("year");
- String season = request.getParameter("season");
- String report_type = request.getParameter("report_type");
- RcBbDao dao=new RcBbDao();
- String json=dao.huizong(compId, report_type,year,season);
- return json;
- }
-
- /**
- * 获取上一次填报记录
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getLastReport")
- public String getLastReport(String params){
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String result="";
- RcBbDao bbd=new RcBbDao();
- if(comp_id==""){
-
- result=bbd.getLastReport(report_type, user_id);
- log.info(result+"=======getLastReport");
- }else{
-
- result=bbd.getChildHuiZong(comp_id, report_type);
- log.info(result+"=======getLastReport.comp_id");
- }
-
- return result;
- }
- //删除报表记录
- @ProduceMime("application/json")
- @POST
- @Path("/deleteReport")
- public Msg deleteReport(String params){
- log.info(params+"==========params");
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- Msg m=new Msg();
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.deleteReport(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
- /**
- * 获取备用字段下拉框
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getItems")
- public String getItems(String params){
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- // String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String result="";
- RcBbDao bbd=new RcBbDao();
- result=bbd.getItems(report_type);
- return result;
- }
-
-
- /**
- * 将备用字段增加为可用字段
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/addDictionary")
- public Msg addDictionary(String params){
- Msg m=new Msg();
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String table_column=Utils.getParameter("table_column", params)==null?"":Utils.getParameter("table_column", params);
- String column_name=Utils.getParameter("column_name", params)==null?"":Utils.getParameter("column_name", params);
- String is_count=Utils.getParameter("is_count", params)==null?"":Utils.getParameter("is_count", params);
- String table_head=Utils.getParameter("table_head", params)==null?"":Utils.getParameter("table_head", params);
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.addDictionary(report_type, table_column, column_name, is_count, table_head);
- } catch (ClassNotFoundException e) {
-
- m.setSucsess(new Boolean(false).toString());
- m.setInfo(Parameter.DELETE_FAILURE);
- e.printStackTrace();
- }
- return m;
- }
-
- // public Msg deleteDictionary(String params){
- // Msg m=new Msg();
- // String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- // RcBbDao bbd=new RcBbDao();
- // try {
- // m=bbd.deleteDictionary(fd_id);
- // } catch (ClassNotFoundException e) {
- // m.setSucsess(new Boolean(false).toString());
- // m.setInfo(Parameter.DELETE_FAILURE);
- // e.printStackTrace();
- // }
- // return m;
- // }
- /**
- * 报送
- */
- @ProduceMime("application/json")
- @POST
- @Path("/send")
- public String send(String params){
- Msg m=new Msg();
- String result="";
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- String userId=Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- // String fd_id=request.getParameter("fd_id");
- // String userId=request.getParameter("userId");
- // String report_type=request.getParameter("report_type");
- // String comp_id=request.getParameter("comp_id");
- RcBbDao bbd=new RcBbDao();
- try {
- // bbd.getChildHuiZong(comp_id, report_type);
- result=bbd.send( fd_id, userId, report_type, comp_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
-
- //将上报的数据写入上级保存的报表中
- if(!("C984DC9C294A486096C25FAA78C99AED".equals(comp_id))){
- int num = 0;
- try {
- num = bbd.updateProvinceData1(fd_id,report_type,comp_id);
- } catch (Exception e) {
- e.printStackTrace();
- }
- log.info(num);
- }
- return result;
- }
- /**
- * 撤回报送
- */
- @ProduceMime("application/json")
- @POST
- @Path("/sendRollBack")
- public Msg sendRollBack(String params){
- Msg m=new Msg();
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.sendRollBack(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
-
- //将上报的数据从上级保存的报表中删除
- int num = 0;
- try {
- num = bbd.recall(fd_id);
- } catch (Exception e) {
- e.printStackTrace();
- }
- log.info(num);
-
- return m;
- }
-
- //将上报的数据从上级保存的报表中删除
- @ProduceMime("application/json")
- @POST
- @Path("/sendRollBack1")
- public Msg sendRollBack1(String params){
- Msg m=new Msg();
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- RcBbDao bbd=new RcBbDao();
- int num = 0;
- try {
- num = bbd.recall(fd_id);
- } catch (Exception e) {
- e.printStackTrace();
- }
- log.info(num);
- if(num==1){
- m.setInfo("success");
- }
- return m;
- }
-
-
- /**
- * 获取预警响应编号
- *
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getReportWarnningNumber/")
- public String getReportInputPlanAlert(String params){
- String unit = Utils.getParameter("unitId", params);
- //String is_alert = Utils.getParameter("is_alert", params);
- String comp_id = Utils.getParameter("comp_id", params);
- String role_id = Utils.getParameter("role_id", params);
- 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+"'" ;
- log.info(sql+"=======sql");
- SysModel sysmodel = ModelFactory.getSysmodel();
- SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- ArrayList<String[]> list = null;
- ArrayList<KeyValue> kvList = null;
- try {
- list = persistence.getSearchResult(827, sql);
- if(list != null){
- kvList = new ArrayList<KeyValue>();
- for(int i =0;i < list.size();i++){
- kvList.add(new KeyValue(list.get(i)[0],list.get(i)[0]));
- }
- }
- } catch (PersistenceException e) {
- e.printStackTrace();
- }
- return JSONArray.fromObject(kvList).toString();
- }
- //获取填报计划的响应编号
- @POST
- @ProduceMime("application/json")
- @Path("getReportNumber")
- public String getReportNumber(String params){
- //String comp_id = Utils.getParameter("comp_id", params);
- //String report_type = Utils.getParameter("report_type", params);
- String dept_id = Utils.getParameter("dept_id", params);
- String sql = "select WARNING_NUMBER from report_schedule where comp_id = '"+dept_id+"' and send_stat<>'2' and WARNING_NUMBER IS NOT NULL";
- log.info(sql+"getReportNumber.sql");
- SysModel sysmodel = ModelFactory.getSysmodel();
- SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- List<String[]> list = null;
- List<KeyValue> list1 = null;
-
- try {
- list = persistence.getSearchResult(99, sql);
- if(list!=null){
- list1 = new ArrayList<KeyValue>();
- for(int i=0;i<list.size();i++){
- list1.add(new KeyValue(list.get(i)[0],list.get(i)[0]));
- }
- }
- } catch (PersistenceException e) {
-
- e.printStackTrace();
- }
- return JSONArray.fromObject(list1).toString();
- }
-
- //删除报表记录
- @ProduceMime("application/json")
- @POST
- @Path("/deletePlan")
- public Msg deletePlan(String params){
- log.info(params+"==========params");
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- Msg m=new Msg();
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.deleteReportPlan(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
- //报送报表记录
- @ProduceMime("application/json")
- @POST
- @Path("/SendPlan")
- public String SendPoretPlan(String params){
- log.info(params+"==========params");
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- String result="";
- RcBbDao bbd=new RcBbDao();
- try {
- result=bbd.SendReportPlan(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return result;
- }
-
-
- @ProduceMime("application/json")
- @POST
- @Path("/DeletePoretPlan")
- public Msg DeletePoretPlan(String params){
- log.info(params+"==========params");
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- Msg m=new Msg();
- RcBbDao bbd=new RcBbDao();
- try {
- m=bbd.DeleteReportPlan(fd_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 获取下级填报记录汇总
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getChildHzReport")
- public String getChildHzReport(String params){
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String result="";
- RcBbDao bbd=new RcBbDao();
- result=bbd.getChildHuiZong(comp_id, report_type);
- return result;
- }
-
- /**
- * 获取下级填报记录汇总
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getChildComp")
- public String getChildComp(String params){
- String role_id=Utils.getParameter("role_id", params)==null?"":Utils.getParameter("role_id", params);
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String result="";
- RcBbDao bbd=new RcBbDao();
- result=bbd.getChildComp(role_id, comp_id);
- return result;
- }
-
- /**
- * 获取线路停运明细数据
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/getRouteDetails")
- public String getRouteDetails(String params){
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- String route_level=Utils.getParameter("route_level", params)==null?"":Utils.getParameter("route_level", params);
- String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
- .getParameter("pager.pageNo", params);
- String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
- .getParameter("pager.pageSize", params);
- String result="";
- RcBbDao bbd=new RcBbDao();
- result=bbd.getRouteDetails(fd_id, route_level,Integer.parseInt(firstPageNum),Integer.parseInt(limit));
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/saveRouteDetial/")
- public Msg saveRouteDetial(String params){
- Msg msg = new Msg();
- String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
- String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String route_level=Utils.getParameter("route_level", params)==null?"":Utils.getParameter("route_level", params);
- RcBbDao bbd=new RcBbDao();
- try {
- msg=bbd.saveRouteDetail(json, report_id,route_level,comp_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return msg;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getAlertMsg/")
- public String getAlertMsg(String params){
- String result="";
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- RcBbDao bbd=new RcBbDao();
- result=bbd.getAlertMsg(comp_id);
- return result;
- }
-
-
- @POST
- @ProduceMime("application/json")
- @Path("/getDBmsg/")
- public String getDBmsg(String params){
- String result="";
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String role_id=Utils.getParameter("role_id", params)==null?"":Utils.getParameter("role_id", params);
- String company_id=Utils.getParameter("company_id", params)==null?"":Utils.getParameter("company_id", params);
- WaitDoDao wd=new WaitDoDao();
- //result=wd.getMsg(user_id, role_id, company_id);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getDBNum/")
- public String getDBNum(String params){
- String result="";
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String role_id=Utils.getParameter("role_id", params)==null?"":Utils.getParameter("role_id", params);
- String company_id=Utils.getParameter("company_id", params)==null?"":Utils.getParameter("company_id", params);
- log.info(user_id+"==========getDBNum.userid");
- WaitDoDao wd=new WaitDoDao();
- result=wd.getDBNum( user_id, role_id, company_id);
- return result;
- }
-
- @POST
- @ProduceMime("text/html")
- @Path("/getHadDo/")
- public String getHadDo(String params){
- String result="";
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- log.info(user_id+"==========getDBNum.userid");
- WaitDoDao wd=new WaitDoDao();
- result=wd.getHadDo(user_id);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getAlertList/")
- public String getAlertList(String params){
- String result="";
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String dept_id=Utils.getParameter("dept_id", params)==null?"":Utils.getParameter("dept_id", params);
- WaitDoDao wd=new WaitDoDao();
- result=wd.getAlertMsg(dept_id, user_id);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/updateAlert/")
- public Msg updateAlert(String params){
- Msg m=new Msg();
- String user_id=Utils.getParameter("user_id", params)==null?"":Utils.getParameter("user_id", params);
- String fd_id=Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- WaitDoDao wd=new WaitDoDao();
- m=wd.updateAlertStat(fd_id, user_id);
- return m;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/saveAndSend/")
- public String saveAndSend(String params){
- String result="";
- String json = Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
- String userId = Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
- String compId = Utils.getParameter("compId", params)==null?"":Utils.getParameter("compId", params);
- RcBbDao bbd = new RcBbDao();
- try {
- result = bbd.saveAndSend(compId, userId, json);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/updateAndSend/")
- public String updateAndSend(String params){
- String result="";
- String json = Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
- String fdId = Utils.getParameter("fdId", params)==null?"":Utils.getParameter("fdId", params);
- RcBbDao dao = new RcBbDao();
- try {
- result = dao.updateAndSend(fdId, json);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return result;
- }
- /**
- * GEL
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getReportScheduleProjectName/")
- public String getReportScheduleProjectName(String params){
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e1) {
-
- e1.printStackTrace();
- }
- String WarningNum = Utils.getParameter("WARNING_NUMBER", params) == null ? "" : Utils.getParameter("WARNING_NUMBER", params);
-
- String sql="SELECT FD_OBJECTID,PROJECT_NAME,SEND_STAT FROM REPORT_SCHEDULE WHERE WARNING_NUMBER = '"+WarningNum+"'";
-
- StringBuffer sb = new StringBuffer();
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- ResultSet rs = null ;
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- rs = pstm.executeQuery();
- sb.append("[") ;
- while(rs.next()){
- //sb.append("{\"NAME\":\"" + rs.getString("PROJECT_NAME") + "\",\"SEND_STAT\":\"" + rs.getString("SEND_STAT") + "\"},") ;
- sb.append("{\"FD_OBJECTID\":\"" + rs.getString("FD_OBJECTID") + "\",\"NAME\":\"" + rs.getString("PROJECT_NAME") + "\",\"SEND_STAT\":\"" + rs.getString("SEND_STAT") + "\"},") ;
- }
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]") ;
- return sb.length() > 1 ? sb.toString() : null ;
-
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }try {
- if(rs!= null){
- rs.close();
- }
- if(pstm!= null){
- pstm.close();
- }
- if(conn!= null){
- conn.close();
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * GEL
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getReportPlanMSG/")
- public String getReportPlanMSG(String params){
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e1) {
-
- e1.printStackTrace();
- }
- String EarlyWarningId = Utils.getParameter("EARLY_WARNING_ID", params) == null ? "" : Utils.getParameter("EARLY_WARNING_ID", params);
-
- String sql="SELECT FD_OBJECTID,PROGRAMME_NAME,IS_RELEASE FROM ECM_EM_ALERT_REPORT_PLAN WHERE EARLY_WARNING_ID = '"+EarlyWarningId+"'";
-
- StringBuffer sb = new StringBuffer();
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- ResultSet rs = null ;
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- rs = pstm.executeQuery();
- sb.append("[") ;
- while(rs.next()){
- //sb.append("{\"PROGRAMME_NAME\":\"" + rs.getString("PROGRAMME_NAME") + "\",\"IS_RELEASE\":\"" + rs.getString("IS_RELEASE") + "\"},") ;
- sb.append("{\"FD_OBJECTID\":\"" + rs.getString("FD_OBJECTID") + "\",\"PROGRAMME_NAME\":\"" + rs.getString("PROGRAMME_NAME") + "\",\"IS_RELEASE\":\"" + rs.getString("IS_RELEASE") + "\"},") ;
- }
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]") ;
- return sb.length() > 1 ? sb.toString() : null ;
-
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }try {
- if(rs!= null){
- rs.close();
- }
- if(pstm!= null){
- pstm.close();
- }
- if(conn!= null){
- conn.close();
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return null;
- }
- //GEL
- @POST
- @ProduceMime("application/json")
- @Path("/updateReportScheduleSendStat/")
- public String updateReportScheduleSendStat(String params){
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e1) {
-
- e1.printStackTrace();
- }
- String fd_objectId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
-
- String sql="UPDATE REPORT_SCHEDULE set SEND_STAT='1' where FD_OBJECTID=" + fd_objectId;
-
- StringBuffer sb = new StringBuffer();
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- // ResultSet rs = null ;
- try {
-
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
-
- return pstm.executeUpdate() > 0 ? "true":"false";
-
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }try {
- // if(rs!= null){
- // rs.close();
- // }
- if(pstm!= null){
- pstm.close();
- }
- if(conn!= null){
- conn.close();
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- //GEL
- @POST
- @ProduceMime("application/json")
- @Path("/updateAlertReportPlanIsRelease/")
- public String updateAlertReportPlanIsRelease(String params){
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e1) {
-
- e1.printStackTrace();
- }
- String fd_objectId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
-
- String sql="UPDATE ECM_EM_ALERT_REPORT_PLAN SET IS_RELEASE = '1' WHERE FD_OBJECTID = " + fd_objectId;
-
- StringBuffer sb = new StringBuffer();
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- // ResultSet rs = null ;
- try {
-
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
-
- return pstm.executeUpdate() > 0 ? "true":"false";
-
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }try {
- // if(rs!= null){
- // rs.close();
- // }
- if(pstm!= null){
- pstm.close();
- }
- if(conn!= null){
- conn.close();
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getWriteTabList/")
- public String getWriteTabList(String params){
- String result="";
- String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String year = Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
- String season = Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
- RcBbDao rb=new RcBbDao();
- result=rb.getWriteTabList(comp_id,season,year);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getRequireTabList/")
- public String getRequireTabList(String params){
- String result="";
- String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- RcBbDao rb=new RcBbDao();
- result=rb.getRequireTabList(comp_id);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getHighChart/")
- public String getHighChart(String params){
- String result="";
- String comp_id = Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- RcBbDao rb=new RcBbDao();
- result=rb.getHighChart( "机构", "11", "438", "2016", "1");
- return result;
- }
-
-
- @POST
- @ProduceMime("application/json")
- @Path("/getHuiZongData/")
- public String getHuiZongData(String params){
- String compId=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String year=Utils.getParameter("year", params)==null?"":Utils.getParameter("year", params);
- String season=Utils.getParameter("season", params)==null?"":Utils.getParameter("season", params);
- return new RcBbDao().getHuiZongData(year, season, compId, report_type);
- }
-
- @POST
- @ProduceMime("application/text")
- @Path("/getSeasionByHz")
- public String getSeasionByHz(String params){
- return new RcBaoBiaoDao().getSeasionByHz();
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getReportTemplete")
- public String getReportTemplete(String params){
- return new RcBaoBiaoDao().getReportTemplete();
- }
-
-
- //对有历史记录的报表的保存方法
- @ProduceMime("application/json")
- @POST
- @Path("/create2")
- public Msg create2(String params) throws ClassNotFoundException{//保存数据
- Msg m=new Msg();
- String json=Utils.getParameter("json", params)==null?"":Utils.getParameter("json", params);
- String report_type=Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- String comp_id=Utils.getParameter("comp_id", params)==null?"":Utils.getParameter("comp_id", params);//预警编号
- String report_id=Utils.getParameter("report_id", params)==null?"":Utils.getParameter("report_id", params);
- String type=Utils.getParameter("type", params)==null?"":Utils.getParameter("type", params);
- String fd_id = Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
- RcBaoBiaoExcel xte=new RcBaoBiaoExcel();
- try {
- // //首先将原来得记录删除
- new RcBaoBiaoDao().deleteHistoryRecords(fd_id, report_type);
- //然后将新纪录插入
- m=xte.xianluToDb(fd_id,json,report_id,report_type);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- RcBbDao bbd=new RcBbDao();
- //再判断是改操作是提交还是保存
- try {
- m=bbd.updateRecord(fd_id,type,comp_id);
- } catch (ClassNotFoundException e) {
-
- e.printStackTrace();
- }
- return m;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/importFileData")
- public Msg importFileData(@Context HttpServletRequest request,@Context HttpServletResponse response){
- Msg msg = new Msg();
- String fileExt = request.getParameter("fileExt");
- String year = request.getParameter("year");
- String season = request.getParameter("season");
- String report_type = request.getParameter("report_type");
- String report_name = request.getParameter("report_name");
- try {
- report_name = java.net.URLDecoder.decode(java.net.URLDecoder.decode(report_name, "utf-8"), "utf-8");
- } catch (UnsupportedEncodingException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- String filePath = "";
- SmartUpload upload = new SmartUpload();
- upload.initialize(request, response, request.getSession().getServletContext());
- try {
- String uploadPath = FilePathUtil.getUploadPath();
- log.info("路径===:"+uploadPath);
- int currentTotalSize = request.getContentLength();
- log.info("当前上传的附件总大小为-----" + currentTotalSize);
- if (currentTotalSize < 40 * 1024 * 1024) {
- upload.service(request, response);
- upload.setMaxFileSize(100 * 1024 * 1024);
- upload.setTotalMaxFileSize(400 * 1024 * 1024);
- upload.upload();
- com.sinosoft.common.upLoad.util.File file = upload.getFiles().getFile(0);
- String saveName = UUID.randomUUID().toString();
- filePath = uploadPath+File.separator+saveName+"."+fileExt;
- file.saveAs(filePath);
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- if("".equals(filePath)){
- msg.setSucsess("false");
- msg.setInfo("文件上传失败!");
- }else{
- try {
- msg = new RcBaoBiaoDao().readExcel(year,season,report_type,report_name,filePath,fileExt);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return msg;
- }
-
-
- /*@POST
- @ProduceMime("application/json")
- @Path("/createExcelTemplete")
- public Msg createExcelTemplete(String params){
- String comp = Utils.getParameter("comp", params)==null?"":Utils.getParameter("comp", params);
- String report_type = Utils.getParameter("report_type", params)==null?"":Utils.getParameter("report_type", params);
- Msg msg = new RcBaoBiaoDao().createExcelTemplete(comp,report_type);
- return msg;
- }*/
-
- }
|