123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- package com.sinosoft.em.baobiao.xianlutingyun.service;
- import java.io.UnsupportedEncodingException;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- import javax.ws.rs.POST;
- import javax.ws.rs.Path;
- import javax.ws.rs.ProduceMime;
- import org.apache.log4j.Logger;
- import com.formaction.Utils;
- import com.formaction.vo.Msg;
- import com.persistence.DbConnection;
- import com.sinosoft.em.baobiao.xianlutingyun.dao.ReportPlanDao;
- @Path("/getPlanRequireService/")
- public class GetPlanRequireServiceImpl implements GetPlanRequireService {
- private final Logger log = Logger.getLogger(getClass());
-
- @POST
- @ProduceMime("application/json")
- @Path("/getPlanRequire/")
- public String getPlanRequire(String params) {
-
- String warning_number = Utils.getParameter("warning_number", params) ==null ? "":Utils.getParameter("warning_number", params);
- log.info("warning_number========="+warning_number);
- String comp = Utils.getParameter("comp", params)==null ?"":Utils.getParameter("comp", params);
- //log.info(warning_number+"=========="+comp);
- Connection conn = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- DbConnection db = new DbConnection();
- //String sql = "select start_time,end_time,dept_name,fill_in_schedule, round_time,temporary_time from report_schedule where warning_number = ? and dept_id =?";
- String sql = "select start_time,end_time,report_dept,fill_in_schedule, round_time,temporary_time from report_schedule where fd_objectid ='"+warning_number+"'";
- log.info(sql+"=============sql");
- List<String> list = new ArrayList<String>();
- StringBuffer sb = new StringBuffer();
- try {
- conn = db.getConnection();
- ps = conn.prepareStatement(sql);
- //ps.setString(1, warning_number);
- //ps.setString(2, comp);
- //log.info(sql+"===========getPlanRequire.sql");
- rs = ps.executeQuery();
- while(rs.next()){
- sb.append("{");
- sb.append("\"START_TIME\""+":"+"\""+rs.getString("START_TIME")+"\""+",");
- sb.append("\"END_TIME\""+":"+"\""+rs.getString("END_TIME")+"\""+",");
- sb.append("\"DEPT_NAME\""+":"+"\""+rs.getString("REPORT_DEPT")+"\""+",");
- sb.append("\"FILL_IN_SCHEDULE\""+":"+"\""+rs.getString("FILL_IN_SCHEDULE")+"\""+",");
- sb.append("\"ROUND_TIME\""+":"+"\""+rs.getString("ROUND_TIME")+"\""+",");
- sb.append("\"TEMPORARY_TIME\""+":"+"\""+rs.getString("TEMPORARY_TIME")+"\"");
- sb.append("},");
-
- }
- if(sb.lastIndexOf(",")>-1){
- sb.deleteCharAt(sb.lastIndexOf(","));
- list.add(sb.toString());
- }
- } catch (ClassNotFoundException e) {
-
- log.error(e.getMessage());
- } catch (SQLException e) {
-
- log.error(e.getMessage());
- }finally{
- db.close(rs);
- db.close(ps);
- db.close(conn);
- }
- String result = "{\"rows\":"+list+"}";
- log.info(result+"========getPlanRequire");
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/createPlanByAlert/")
- public Msg createPlanByAlert(String params){
- String WARNING_NUMBER = Utils.getParameter("WARNING_NUMBER", params) ==null ? "":Utils.getParameter("WARNING_NUMBER", params);
- /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String nowDate=sdf.format(new Date());
- String START_TIME = nowDate;*/
- try {
- String params1 = java.net.URLDecoder.decode(params, "UTF-8");
- log.info(params1);
- } catch (UnsupportedEncodingException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- String START_TIME= Utils.getParameter("START_TIME", params) ==null ? "":Utils.getParameter("START_TIME", params);
-
- String FILL_IN_SCHEDULE = Utils.getParameter("FILL_IN_SCHEDULE", params) ==null ? "":Utils.getParameter("FILL_IN_SCHEDULE", params);
- String REPORT_DEPT = Utils.getParameter("REPORT_DEPT", params) ==null ? "":Utils.getParameter("REPORT_DEPT", params);
- String DEPT_ID = Utils.getParameter("DEPT_ID", params) ==null ? "":Utils.getParameter("DEPT_ID", params);
- String ROUND_TIME = Utils.getParameter("ROUND_TIME", params) ==null ? "":Utils.getParameter("ROUND_TIME", params);
- String TEMPORARY_TIME = Utils.getParameter("TEMPORARY_TIME", params) ==null ? "":Utils.getParameter("TEMPORARY_TIME", params);
- 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 deptName = Utils.getParameter("deptName", params) ==null ? "":Utils.getParameter("deptName", params);
- String real_name = Utils.getParameter("real_name", params) ==null ? "":Utils.getParameter("real_name", params);
- String alertName = Utils.getParameter("alertName", params) ==null ? "":Utils.getParameter("alertName", params);
- String areaId = Utils.getParameter("areaId", params) ==null ? "":Utils.getParameter("areaId", params);
- String areaName = Utils.getParameter("areaName", params) ==null ? "":Utils.getParameter("areaName", params);
- String isAlert = Utils.getParameter("isAlert", params) ==null ? "":Utils.getParameter("isAlert", params);
- String alertLevel = Utils.getParameter("alertLevel", params) ==null ? "":Utils.getParameter("alertLevel", params);
- String eventType = Utils.getParameter("eventType", params) ==null ? "":Utils.getParameter("eventType", params);
- String eventId = Utils.getParameter("eventId", params) ==null ? "":Utils.getParameter("eventId", params);
- Msg m=new Msg();
- ReportPlanDao rpd=new ReportPlanDao();
- try {
- m=rpd.createPlanByAlert(WARNING_NUMBER, START_TIME,FILL_IN_SCHEDULE,REPORT_DEPT,DEPT_ID,ROUND_TIME,TEMPORARY_TIME,USER_ID,ROLE_ID,deptName,real_name,alertName,areaId,areaName,isAlert,alertLevel,eventType,eventId);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return m;
- }
- /**
- * 生成报告填报要求
- * @param params
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/createBGPlanByAlert/")
- public Msg createBGPlanByAlert(String params){
- String WARNING_NUMBER = Utils.getParameter("WARNING_NUMBER", params) ==null ? "":Utils.getParameter("WARNING_NUMBER", params);
- String START_TIME = Utils.getParameter("START_TIME", params) ==null ? "":Utils.getParameter("START_TIME", params);
- String FILL_IN_SCHEDULE = Utils.getParameter("FILL_IN_SCHEDULE", params) ==null ? "":Utils.getParameter("FILL_IN_SCHEDULE", params);
- String REPORT_DEPT = Utils.getParameter("REPORT_DEPT", params) ==null ? "":Utils.getParameter("REPORT_DEPT", params);
- String DEPT_ID = Utils.getParameter("DEPT_ID", params) ==null ? "":Utils.getParameter("DEPT_ID", params);
- String ROUND_TIME = Utils.getParameter("ROUND_TIME", params) ==null ? "":Utils.getParameter("ROUND_TIME", params);
- String TEMPORARY_TIME = Utils.getParameter("TEMPORARY_TIME", params) ==null ? "":Utils.getParameter("TEMPORARY_TIME", params);
- 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 deptName = Utils.getParameter("deptName", params) ==null ? "":Utils.getParameter("deptName", params);
- String real_name = Utils.getParameter("real_name", params) ==null ? "":Utils.getParameter("real_name", params);
- String alertName = Utils.getParameter("alertName", params) ==null ? "":Utils.getParameter("alertName", params);
- String areaId = Utils.getParameter("areaId", params) ==null ? "":Utils.getParameter("areaId", params);
- String areaName = Utils.getParameter("areaName", params) ==null ? "":Utils.getParameter("areaName", params);
- String isAlert = Utils.getParameter("isAlert", params) ==null ? "":Utils.getParameter("isAlert", params);
- String alertLevel = Utils.getParameter("alertLevel", params) ==null ? "":Utils.getParameter("alertLevel", params);
- Msg m=new Msg();
- ReportPlanDao rpd=new ReportPlanDao();
- try {
- m=rpd.createBGPlanByAlert(WARNING_NUMBER, START_TIME,FILL_IN_SCHEDULE,REPORT_DEPT,DEPT_ID,ROUND_TIME,TEMPORARY_TIME,USER_ID,ROLE_ID,deptName,real_name,alertName,areaId,areaName,isAlert,alertLevel);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 生成临时性时间填报要求
- * @param params
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/createTemporaryPlanByAlert/")
- public Msg createTemporaryPlanByAlert(String params){
- String WARNING_NUMBER = Utils.getParameter("WARNING_NUMBER", params) ==null ? "":Utils.getParameter("WARNING_NUMBER", params);
- String START_TIME = Utils.getParameter("START_TIME", params) ==null ? "":Utils.getParameter("START_TIME", params);
- String FILL_IN_SCHEDULE = Utils.getParameter("FILL_IN_SCHEDULE", params) ==null ? "":Utils.getParameter("FILL_IN_SCHEDULE", params);
- String REPORT_DEPT = Utils.getParameter("REPORT_DEPT", params) ==null ? "":Utils.getParameter("REPORT_DEPT", params);
- String DEPT_ID = Utils.getParameter("DEPT_ID", params) ==null ? "":Utils.getParameter("DEPT_ID", params);
- String ROUND_TIME = Utils.getParameter("ROUND_TIME", params) ==null ? "":Utils.getParameter("ROUND_TIME", params);
- String TEMPORARY_TIME = Utils.getParameter("TEMPORARY_TIME", params) ==null ? "":Utils.getParameter("TEMPORARY_TIME", params);
- 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 deptName = Utils.getParameter("deptName", params) ==null ? "":Utils.getParameter("deptName", params);
- String real_name = Utils.getParameter("real_name", params) ==null ? "":Utils.getParameter("real_name", params);
- String alertName = Utils.getParameter("alertName", params) ==null ? "":Utils.getParameter("alertName", params);
- String areaId = Utils.getParameter("areaId", params) ==null ? "":Utils.getParameter("areaId", params);
- String areaName = Utils.getParameter("areaName", params) ==null ? "":Utils.getParameter("areaName", params);
- String isAlert = Utils.getParameter("isAlert", params) ==null ? "":Utils.getParameter("isAlert", params);
- String alertLevel = Utils.getParameter("alertLevel", params) ==null ? "":Utils.getParameter("alertLevel", params);
-
- Msg m=new Msg();
- ReportPlanDao rpd=new ReportPlanDao();
- try {
- m=rpd.createTemporaryPlanByAlert(WARNING_NUMBER, START_TIME,FILL_IN_SCHEDULE,REPORT_DEPT,DEPT_ID,ROUND_TIME,TEMPORARY_TIME,USER_ID,ROLE_ID,deptName,real_name,alertName,areaId,areaName,isAlert,alertLevel);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 发布报表填报计划
- * @param params
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/updatePlan/")
- public Msg updatePlan(String params){
- Msg m=new Msg();
- String OLD_WARN = Utils.getParameter("OLD_WARN", params) ==null ? "":Utils.getParameter("OLD_WARN", params);
- String NEW_WARN = Utils.getParameter("NEW_WARN", params) ==null ? "":Utils.getParameter("NEW_WARN", params);
- String COMP_ID = Utils.getParameter("COMP_ID", params) ==null ? "":Utils.getParameter("COMP_ID", params);
- String IS_ALERT = Utils.getParameter("isAlert", params) ==null ? "":Utils.getParameter("isAlert", params);
- String circleTime = Utils.getParameter("circleTime", params) ==null ? "":Utils.getParameter("circleTime", params);
- String temporaryTime = Utils.getParameter("temporaryTime", params) ==null ? "":Utils.getParameter("temporaryTime", params);
- String alertName = Utils.getParameter("alertName", params) ==null ? "":Utils.getParameter("alertName", params);
- String areaId = Utils.getParameter("areaId", params) ==null ? "":Utils.getParameter("areaId", params);
- String areaName = Utils.getParameter("areaName", params) ==null ? "":Utils.getParameter("areaName", params);
- String alertLevel = Utils.getParameter("alertLevel", params) ==null ? "":Utils.getParameter("alertLevel", params);
- ReportPlanDao rpd=new ReportPlanDao();
- try {
-
- m=rpd.updatePlan(NEW_WARN, OLD_WARN, COMP_ID,IS_ALERT,circleTime,temporaryTime,alertName,areaId,areaName,alertLevel);
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return m;
- }
-
-
- /**
- * 解除报告填报计划
- * @param params
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/releasePlan/")
- public Msg releasePlan(String params){
-
- Msg m=new Msg();
- String WARNING_NUMBER = Utils.getParameter("WARNING_NUMBER", params) ==null ? "":Utils.getParameter("WARNING_NUMBER", params);//预警编号
- String COMP_ID = Utils.getParameter("COMP_ID", params) ==null ? "":Utils.getParameter("COMP_ID", params);//单位ID
- String IS_ALERT = Utils.getParameter("IS_ALERT", params) ==null ? "":Utils.getParameter("IS_ALERT", params);//预警-0或响应-1
- ReportPlanDao rpd=new ReportPlanDao();
- try {
- m=rpd.releasePlan(WARNING_NUMBER, COMP_ID,IS_ALERT);
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return m;
- }
-
- /**
- * 解除报告填报计划
- * @param params
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/updateCirclePlan/")
- public Msg updateCirclePlan(String params){
-
- Msg m=new Msg();
- String WARNING_NUMBER = Utils.getParameter("WARNING_NUMBER", params) ==null ? "":Utils.getParameter("WARNING_NUMBER", params);
- String COMP_ID = Utils.getParameter("COMP_ID", params) ==null ? "":Utils.getParameter("COMP_ID", params);
- String IS_ALERT = Utils.getParameter("IS_ALERT", params) ==null ? "":Utils.getParameter("IS_ALERT", params);
- String time = Utils.getParameter("time", params) ==null ? "":Utils.getParameter("time", params);
-
- ReportPlanDao rpd=new ReportPlanDao();
- try {
- m=rpd.updateCirclePlan(WARNING_NUMBER, COMP_ID,IS_ALERT,time);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return m;
- }
-
- }
|