123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- package com.sinosoft.lz.system.userFriend.service;
- import java.util.ArrayList;
- import java.util.List;
- import javax.ws.rs.POST;
- import javax.ws.rs.Path;
- import javax.ws.rs.ProduceMime;
- import org.apache.log4j.Logger;
- import com.formaction.Parameter;
- import com.formaction.Utils;
- import com.formaction.vo.Msg;
- import com.sinosoft.lz.system.userFriend.dao.SendMsgDao;
- import com.sinosoft.lz.system.userFriend.vo.MsgInfo;
- import com.system.push.MessagePush;
- @Path("/SendMsgService/")
- public class SendMsgService{
- private Logger log = Logger.getLogger(this.getClass());
-
- @ProduceMime("application/json")
- @POST
- @Path("/dwrMsg")
- public String dwrMsg(String params){
- String msg = Utils.getParameter("msg", params) == null ? "" : Utils.getParameter(
- "msg", params);
- String method=Utils.getParameter("method", params) == null ? "" : Utils.getParameter(
- "method", params);
- String url= Utils.getParameter("url", params) == null ? "" : Utils.getParameter(
- "url", params);
- //"sendMessage"
- MessagePush.showMsg(null,null,"<a href=\"javascript:void(0)\" onclick=\"openZ("+url+")\">"+msg+"</a>",method);
- return "{}";
- }
-
- @SuppressWarnings("unused")
- @ProduceMime("application/json")
- @POST
- @Path("/sendMsg")
- public Msg sendMsg(String params) throws ClassNotFoundException {
- log.info("params===" + params);
- String sendId = Utils.getParameter("sendId", params) == null ? "" : Utils.getParameter(
- "sendId", params);
- log.info("sendId===" + sendId);
- String recivedId = Utils.getParameter("recivedId", params) == null ? "" : Utils
- .getParameter("recivedId", params);
- log.info("recivedId===" + recivedId);
- String msg = Utils.getParameter("msg", params) == null ? "" : Utils.getParameter("msg",
- params);
- log.info("msg===" + msg);
- List<String> recid = new ArrayList<String>();
- String[] arr = recivedId.split(";");
- for (int i = 0; i < arr.length; i++) {
- recid.add(arr[i]);
- }
- Msg saveMsg = new Msg();
-
- if("".equals(recivedId.trim())){
- saveMsg.setInfo("recived");
- return saveMsg;
- }
- if("".equals(msg.trim())){
- //saveMsg.setSucsess(new Boolean(true).toString());
- saveMsg.setInfo("msg");
- return saveMsg;
- }
-
- MsgInfo mg = new MsgInfo();
- mg.setSendUser(sendId);
- mg.setRecivedUser(recid);
- mg.setSendMsg(msg);
- mg.setFlag("1");
- SendMsgDao sd = null;
- try {
- sd = new SendMsgDao();
- } catch (Exception e) {
- e.printStackTrace();
- }
- saveMsg = sd.saveMsg(mg);
- boolean addRecentFri = sd.addRecentUser(sendId, recivedId);
- return saveMsg;
- }
- // @ProduceMime("application/json")
- // @POST
- // @Path("/getRecMsgList")
-
- @ProduceMime("application/json")
- @POST
- @Path("/getRecMsgList")
- public String recivedMsgList(String params) {
- log.info("recivedMsgList开始执行");
- String userId = Utils.getParameter("userId", params) == null ? "" : Utils.getParameter(
- "userId", params);
- String query = com.sinosoft.lz.system.Utils.getParameter("userName", params) == null ? ""
- : Utils.getParameter("userName", params);
- String page = com.sinosoft.lz.system.Utils.getParameter("pager.pageNo", params) == null ? "0"
- : Utils.getParameter("pager.pageNo", params);
- String pageSize = com.sinosoft.lz.system.Utils.getParameter("pager.pageSize", params) == null ? "10"
- : Utils.getParameter("pager.pageSize", params);
- log.info("===================" + query);
- SendMsgDao smd = new SendMsgDao();
- String result = smd.getRecMsgList(userId, query,Integer.parseInt(page),Integer.parseInt(pageSize));
- return result;
- }
- @ProduceMime("application/json")
- @POST
- @Path("/getRecMsgInfo")
- public String recivedMsgInfo(String params) {
- log.info("recivedMsgInfo开始执行");
- String userId = Utils.getParameter("userId", params) == null ? "" : Utils.getParameter(
- "userId", params);
- String objectId = Utils.getParameter("objectID", params) == null ? "" : Utils.getParameter(
- "objectID", params);
- SendMsgDao smd = new SendMsgDao();
- String result = smd.getRecMsgInfo(userId, objectId);
- log.info("result===" + result);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/PlanInfo")
- public String PlanInfo(String params) {
- String result="";
- log.info("recivedMsgInfo开始执行");
- String file_id = Utils.getParameter("file_id", params) == null ? "" : Utils.getParameter(
- "file_id", params);
- String grade_type = Utils.getParameter("grade_type", params) == null ? "" : Utils.getParameter(
- "grade_type", params);
- String dept_type = Utils.getParameter("dept_type", params) == null ? "" : Utils.getParameter(
- "dept_type", params);
- SendMsgDao smd = new SendMsgDao();
- result = smd.getPlanInfo(file_id, grade_type,dept_type);
- log.info("result===" + result);
-
- return result;
- }
-
-
- @ProduceMime("application/json")
- @POST
- @Path("/getZhuanxiangPlan")
- public String getZhuanxiangPlan(String params) {
- String result="";
- log.info("recivedMsgInfo开始执行");
- String parent_id = Utils.getParameter("parent_id", params) == null ? "" : Utils.getParameter(
- "parent_id", params);
- String grade_type = Utils.getParameter("grade_type", params) == null ? "" : Utils.getParameter(
- "grade_type", params);
- SendMsgDao smd = new SendMsgDao();
- result = smd.getZhuanxiang(parent_id, grade_type);
-
- log.info("result===" + result);
-
- return result;
- }
-
-
-
- //取应急组织联系人的JSON
- @ProduceMime("application/json")
- @POST
- @Path("/getOrgLinkInfo")
- public String getOrgLinkInfo(String params) {
- String result="";
- log.info("recivedMsgInfo开始执行");
- String file_id = Utils.getParameter("file_id", params) == null ? "" : Utils.getParameter(
- "file_id", params);
- String grade_type = Utils.getParameter("grade_type", params) == null ? "" : Utils.getParameter(
- "grade_type", params);
- SendMsgDao smd = new SendMsgDao();
- result = smd.getOrgLinkInfo(file_id, grade_type);
- log.info("result===" + result);
-
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/PlanInfoEM")
- public String PlanInfoEM(String params) {
- String result="";
- log.info("recivedMsgInfo开始执行");
- String file_id = Utils.getParameter("file_id", params) == null ? "" : Utils.getParameter("file_id", params);//预案ID【表214的fd_id】
- String grade_type = Utils.getParameter("grade_type", params) == null ? "" : Utils.getParameter("grade_type", params);
- SendMsgDao smd = new SendMsgDao();
- result = smd.getPlanInfoEM(file_id, grade_type);
- log.info("result===" + result);
-
- return result;
- }
-
- /**
- * 获取突发事件类型中绑定的报表和填报时间
- * @param params
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getReportAndPlanTime")
- public String getReportAndPlanTime(String params) {
- String result="";
- String event_type_id = Utils.getParameter("event_type_id", params) == null ? "" : Utils.getParameter("event_type_id", params);//预案ID【表214的fd_id】
- String event_level = Utils.getParameter("event_level", params) == null ? "" : Utils.getParameter("event_level", params);
- String comp_id = Utils.getParameter("comp_id", params) == null ? "" : Utils.getParameter("comp_id", params);
- SendMsgDao smd = new SendMsgDao();
- result = smd.getReportAndPlanTime(event_type_id, event_level, comp_id);
- log.info("result===" + result);
-
- return result;
- }
- @ProduceMime("application/json")
- @POST
- @Path("/getSendMsgList")
- public String sendMsgList(String params) {
- log.info("sendMsgList开始执行");
- String userId = Utils.getParameter("userId", params) == null ? "" : Utils.getParameter(
- "userId", params);
- String userName = Utils.getParameter("userName", params) == null ? "" : Utils.getParameter(
- "userName", params);
- String page = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils.getParameter(
- "pager.pageNo", params);
- String pageSize = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils.getParameter(
- "pager.pageSize", params);
- SendMsgDao smd = new SendMsgDao();
- String result = smd.getSendMsgList(userId, userName,Integer.parseInt(page),Integer.parseInt(pageSize));
- return result;
- }
- @ProduceMime("application/json")
- @POST
- @Path("/getSendMsgInfo")
- public String sendMsgInfo(String params) {
- log.info("sendMsgInfo开始执行");
- String userId = Utils.getParameter("userId", params) == null ? "" : Utils.getParameter(
- "userId", params);
- String objectId = Utils.getParameter("objectID", params) == null ? "" : Utils.getParameter(
- "objectID", params);
- SendMsgDao smd = new SendMsgDao();
- String result = smd.getSendMsgInfo(userId, objectId);
- log.info("result===" + result);
- return result;
- }
- @ProduceMime("application/json")
- @POST
- @Path("/deleteMsg")
- public Msg deleteMsg(String params) {
- log.info("删除消息开始执行");
- String stat = Utils.getParameter("stat", params) == null ? "" : Utils.getParameter("stat",
- params);
- String objectId = Utils.getParameter("objectID", params) == null ? "" : Utils.getParameter(
- "objectID", params);
- Msg result = new Msg();
- log.info("stat===" + stat);
- log.info("objectid===" + objectId);
- if((!"".equals(stat))&&(!"".equals(objectId))){
- SendMsgDao smd = new SendMsgDao();
- try {
- result = smd.deleteMsg(stat, objectId);
- return result;
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- result.setSucsess(new Boolean(false).toString());
- result.setInfo(Parameter.DELETE_FAILURE);
- return result;
- }
- }else{
- result.setSucsess(new Boolean(false).toString());
- result.setInfo(Parameter.DELETE_FAILURE);
- return result;
- }
-
- }
- @SuppressWarnings("unused")
- public String hisSend(String param) {
- String user = "";
- return null;
- }
-
-
- @ProduceMime("application/text")
- @POST
- @Path("/getReadedCount")
- public String getReadedCount(String params){
- int num =0;
- String userId = Utils.getParameter("userId", params) == null ? "" : Utils.getParameter("userId",
- params);
- SendMsgDao dao = new SendMsgDao();
- try {
- num = dao.getReadedCount(userId);
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- String result = ""+num;
- return result;
- }
- }
|