10770396538c5d8e28e89064e7470af5a27060f1.svn-base 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.sinosoft.lz.system.sms.service;
  2. import javax.ws.rs.POST;
  3. import javax.ws.rs.Path;
  4. import javax.ws.rs.ProduceMime;
  5. import org.apache.log4j.Logger;
  6. import com.formaction.Utils;
  7. import com.formaction.vo.Msg;
  8. import com.sinosoft.lz.system.sms.dao.ContactPeopleDao;
  9. @Path("/ContactpeopleService/")
  10. public class ContactpeopleService {
  11. private Logger log = Logger.getLogger(this.getClass());
  12. @POST
  13. @ProduceMime("application/json")
  14. @Path("/addContactPeople/")
  15. public Msg addContactPeople(String params){
  16. Msg m = new Msg();
  17. String userId = Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
  18. String dept = Utils.getParameter("dept", params)==null?"":Utils.getParameter("dept", params);
  19. String comp = Utils.getParameter("comp", params)==null?"":Utils.getParameter("comp", params);
  20. String tel = Utils.getParameter("tel", params)==null?"":Utils.getParameter("tel", params);
  21. String name = Utils.getParameter("name", params)==null?"":Utils.getParameter("name", params);
  22. ContactPeopleDao dao = new ContactPeopleDao();
  23. try {
  24. m = dao.addPeople(userId, name, tel, comp, dept);
  25. } catch (ClassNotFoundException e) {
  26. // TODO Auto-generated catch block
  27. e.printStackTrace();
  28. }
  29. return m;
  30. }
  31. @POST
  32. @ProduceMime("application/json")
  33. @Path("/updateContactPeople/")
  34. public Msg updateContactPeople(String params){
  35. Msg m = new Msg();
  36. String userId = Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
  37. String fd_id = Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  38. String comp = Utils.getParameter("comp", params)==null?"":Utils.getParameter("comp", params);
  39. String dept = Utils.getParameter("dept", params)==null?"":Utils.getParameter("dept", params);
  40. String tel = Utils.getParameter("tel", params)==null?"":Utils.getParameter("tel", params);
  41. String name = Utils.getParameter("name", params)==null?"":Utils.getParameter("name", params);
  42. ContactPeopleDao dao = new ContactPeopleDao();
  43. try {
  44. m = dao.updateContactPeople(userId, fd_id, comp, dept, tel, name);
  45. } catch (ClassNotFoundException e) {
  46. // TODO Auto-generated catch block
  47. e.printStackTrace();
  48. }
  49. return m;
  50. }
  51. @POST
  52. @ProduceMime("application/json")
  53. @Path("/deleteContactPeople/")
  54. public Msg deleteContactPeople(String params){
  55. Msg m = new Msg();
  56. String userId = Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
  57. String fd_id = Utils.getParameter("fd_id", params)==null?"":Utils.getParameter("fd_id", params);
  58. ContactPeopleDao dao = new ContactPeopleDao();
  59. try {
  60. m = dao.deleteContactPeople(fd_id, userId);
  61. } catch (ClassNotFoundException e) {
  62. // TODO Auto-generated catch block
  63. e.printStackTrace();
  64. }
  65. return m;
  66. }
  67. @POST
  68. @ProduceMime("application/json")
  69. @Path("/getTel/")
  70. public String getTel(String params){
  71. String userId = Utils.getParameter("userId", params)==null?"":Utils.getParameter("userId", params);
  72. ContactPeopleDao dao = new ContactPeopleDao();
  73. String result = dao.getTel(userId);
  74. return result;
  75. }
  76. }