d76e1ea3e1a8153232a0c1376644223d193b9d6b.svn-base 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. package com.sinosoft.em.warning.duty;
  2. import java.io.UnsupportedEncodingException;
  3. import java.util.List;
  4. import java.util.Map;
  5. import javax.ws.rs.POST;
  6. import javax.ws.rs.Path;
  7. import javax.ws.rs.ProduceMime;
  8. import org.apache.log4j.Logger;
  9. import com.formaction.Utils;
  10. import com.formaction.service.CRUDServiceImpl;
  11. import com.formaction.vo.Msg;
  12. import com.persistence.service.exception.PersistenceException;
  13. import com.sinosoft.common.excel.JsonPluginsUtil;
  14. import com.sinosoft.em.alert.report.manage.dao.QueryReportProgrammeDaoImpl;
  15. @Path("/WarningDutyService/")
  16. public class WarningDutyService {
  17. private final static Logger log = Logger.getLogger(QueryReportProgrammeDaoImpl.class);
  18. /**
  19. * 功能:保存值班详细
  20. */
  21. @POST
  22. @ProduceMime("application/json")
  23. @Path("/saveDutyDetail/")
  24. public String saveDutyDetail(String params) {
  25. try {
  26. params = java.net.URLDecoder.decode(java.net.URLDecoder.decode(params, "UTF-8"), "UTF-8");
  27. } catch (UnsupportedEncodingException e1) {
  28. e1.printStackTrace();
  29. }
  30. String[] paramArr = params.split("[||]");
  31. CRUDServiceImpl crud = new CRUDServiceImpl();
  32. try {
  33. for (int i = 0; i < paramArr.length; i++) {
  34. if(!"".equals(paramArr[i].trim())){
  35. if(paramArr[i]!=null && paramArr[i].indexOf("FD_OBJECTID312")>-1){
  36. crud.update(paramArr[i]);
  37. }else{
  38. crud.create(paramArr[i]);
  39. }
  40. }
  41. }
  42. } catch (Exception e) {
  43. e.printStackTrace();
  44. }
  45. return null;
  46. }
  47. /**
  48. * 功能:根据值班任务id查询各部门值班填报详细
  49. */
  50. @POST
  51. @ProduceMime("application/json")
  52. @Path("/loadDutyDetailByDeptIds/")
  53. public String loadDutyDetailByDeptIds(String params) {
  54. String deptids = Utils.getParameter("deptids", params) == null ? "" : Utils
  55. .getParameter("deptids", params);
  56. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  57. .getParameter("planId", params);
  58. WarningDutyDao dao = new WarningDutyDao();
  59. try {
  60. String result = dao.loadDutyDetailByDeptIds(deptids,planId);
  61. return result;
  62. } catch (Exception e) {
  63. e.printStackTrace();
  64. }
  65. return null;
  66. }
  67. /**
  68. * 功能:根据值班任务id查询各部门值班填报详细
  69. */
  70. @POST
  71. @ProduceMime("application/json")
  72. @Path("/loadPlanByDeptId/")
  73. public String loadPlanByDeptId(String params) {
  74. String deptId = Utils.getParameter("deptId", params) == null ? "" : Utils
  75. .getParameter("deptId", params);
  76. WarningDutyDao dao = new WarningDutyDao();
  77. try {
  78. String result = dao.loadPlanByDeptId(deptId);
  79. return result;
  80. } catch (Exception e) {
  81. e.printStackTrace();
  82. }
  83. return null;
  84. }
  85. /**
  86. * 功能:根据值班记录id查询值班填报详细
  87. */
  88. @POST
  89. @ProduceMime("application/json")
  90. @Path("/loadDutyDetailByRecordsId/")
  91. public String loadDutyDetailByRecordsId(String params) {
  92. String recordsId = Utils.getParameter("recordsId", params) == null ? "" : Utils
  93. .getParameter("recordsId", params);
  94. WarningDutyDao dao = new WarningDutyDao();
  95. try {
  96. String result = dao.loadDutyDetailByRecordsId(recordsId);
  97. return result;
  98. } catch (Exception e) {
  99. e.printStackTrace();
  100. }
  101. return null;
  102. }
  103. /**
  104. *保存值班辅助表格数据
  105. */
  106. @POST
  107. @ProduceMime("application/json")
  108. @Path("/saveDutyFuZhu/")
  109. public Msg saveDutyFuZhu(String params) {
  110. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  111. .getParameter("planId", params);
  112. String data = Utils.getParameter("data", params) == null ? "" : Utils
  113. .getParameter("data", params);
  114. List<Map<String, String>> list = JsonPluginsUtil.jsonToMapList(data);
  115. WarningDutyDao dao = new WarningDutyDao();
  116. try {
  117. Msg m = dao.saveDutyFuZhu(planId,list);
  118. return m;
  119. } catch (Exception e) {
  120. e.printStackTrace();
  121. }
  122. return null;
  123. }
  124. /**
  125. *删除值班辅助表格数据
  126. */
  127. @POST
  128. @ProduceMime("application/json")
  129. @Path("/deleteDutyFuZhu/")
  130. public Msg deleteDutyFuZhu(String params) {
  131. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  132. .getParameter("planId", params);
  133. WarningDutyDao dao = new WarningDutyDao();
  134. try {
  135. Msg m = dao.deleteDutyFuZhu(planId);
  136. return m;
  137. } catch (Exception e) {
  138. e.printStackTrace();
  139. }
  140. return null;
  141. }
  142. @POST
  143. @ProduceMime("application/json")
  144. @Path("/getPeople/")
  145. public String getPeople(String params){
  146. String pageSize = Utils.getParameter("pageSize", params) == null ? "10" : Utils
  147. .getParameter("pageSize", params);
  148. String page = Utils.getParameter("page", params) == null ? "1" : Utils
  149. .getParameter("page", params);
  150. String name = Utils.getParameter("name", params) == null ? "" : Utils
  151. .getParameter("name", params);
  152. String id = Utils.getParameter("id", params) == null ? "" : Utils
  153. .getParameter("id", params);
  154. String result = "";
  155. WarningDutyDao dao = new WarningDutyDao();
  156. try {
  157. result = dao.getPeople(name,Integer.parseInt(pageSize),Integer.parseInt(page),id);
  158. } catch (NumberFormatException e) {
  159. log.info(e.getMessage(),e);
  160. } catch (PersistenceException e) {
  161. log.info(e.getMessage(),e);
  162. }
  163. return result;
  164. }
  165. }