123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- package com.sinosoft.em.warning.duty;
- import java.io.UnsupportedEncodingException;
- 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.service.CRUDServiceImpl;
- import com.formaction.vo.Msg;
- import com.persistence.service.exception.PersistenceException;
- import com.sinosoft.common.excel.JsonPluginsUtil;
- import com.sinosoft.em.alert.report.manage.dao.QueryReportProgrammeDaoImpl;
- @Path("/WarningDutyService/")
- public class WarningDutyService {
- private final static Logger log = Logger.getLogger(QueryReportProgrammeDaoImpl.class);
- /**
- * 功能:保存值班详细
- */
- @POST
- @ProduceMime("application/json")
- @Path("/saveDutyDetail/")
- public String saveDutyDetail(String params) {
- try {
- params = java.net.URLDecoder.decode(java.net.URLDecoder.decode(params, "UTF-8"), "UTF-8");
- } catch (UnsupportedEncodingException e1) {
- e1.printStackTrace();
- }
- String[] paramArr = params.split("[||]");
-
- CRUDServiceImpl crud = new CRUDServiceImpl();
- try {
- for (int i = 0; i < paramArr.length; i++) {
- if(!"".equals(paramArr[i].trim())){
- if(paramArr[i]!=null && paramArr[i].indexOf("FD_OBJECTID312")>-1){
- crud.update(paramArr[i]);
- }else{
- crud.create(paramArr[i]);
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- /**
- * 功能:根据值班任务id查询各部门值班填报详细
- */
- @POST
- @ProduceMime("application/json")
- @Path("/loadDutyDetailByDeptIds/")
- public String loadDutyDetailByDeptIds(String params) {
- String deptids = Utils.getParameter("deptids", params) == null ? "" : Utils
- .getParameter("deptids", params);
- String planId = Utils.getParameter("planId", params) == null ? "" : Utils
- .getParameter("planId", params);
- WarningDutyDao dao = new WarningDutyDao();
- try {
- String result = dao.loadDutyDetailByDeptIds(deptids,planId);
- return result;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
- /**
- * 功能:根据值班任务id查询各部门值班填报详细
- */
- @POST
- @ProduceMime("application/json")
- @Path("/loadPlanByDeptId/")
- public String loadPlanByDeptId(String params) {
- String deptId = Utils.getParameter("deptId", params) == null ? "" : Utils
- .getParameter("deptId", params);
- WarningDutyDao dao = new WarningDutyDao();
- try {
- String result = dao.loadPlanByDeptId(deptId);
- return result;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
- /**
- * 功能:根据值班记录id查询值班填报详细
- */
- @POST
- @ProduceMime("application/json")
- @Path("/loadDutyDetailByRecordsId/")
- public String loadDutyDetailByRecordsId(String params) {
- String recordsId = Utils.getParameter("recordsId", params) == null ? "" : Utils
- .getParameter("recordsId", params);
- WarningDutyDao dao = new WarningDutyDao();
- try {
- String result = dao.loadDutyDetailByRecordsId(recordsId);
- return result;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
- /**
- *保存值班辅助表格数据
- */
- @POST
- @ProduceMime("application/json")
- @Path("/saveDutyFuZhu/")
- public Msg saveDutyFuZhu(String params) {
- String planId = Utils.getParameter("planId", params) == null ? "" : Utils
- .getParameter("planId", params);
- String data = Utils.getParameter("data", params) == null ? "" : Utils
- .getParameter("data", params);
- List<Map<String, String>> list = JsonPluginsUtil.jsonToMapList(data);
- WarningDutyDao dao = new WarningDutyDao();
- try {
- Msg m = dao.saveDutyFuZhu(planId,list);
- return m;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- *删除值班辅助表格数据
- */
- @POST
- @ProduceMime("application/json")
- @Path("/deleteDutyFuZhu/")
- public Msg deleteDutyFuZhu(String params) {
- String planId = Utils.getParameter("planId", params) == null ? "" : Utils
- .getParameter("planId", params);
- WarningDutyDao dao = new WarningDutyDao();
- try {
- Msg m = dao.deleteDutyFuZhu(planId);
- return m;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
- @POST
- @ProduceMime("application/json")
- @Path("/getPeople/")
- public String getPeople(String params){
- String pageSize = Utils.getParameter("pageSize", params) == null ? "10" : Utils
- .getParameter("pageSize", params);
- String page = Utils.getParameter("page", params) == null ? "1" : Utils
- .getParameter("page", params);
- String name = Utils.getParameter("name", params) == null ? "" : Utils
- .getParameter("name", params);
- String id = Utils.getParameter("id", params) == null ? "" : Utils
- .getParameter("id", params);
- String result = "";
- WarningDutyDao dao = new WarningDutyDao();
- try {
- result = dao.getPeople(name,Integer.parseInt(pageSize),Integer.parseInt(page),id);
- } catch (NumberFormatException e) {
-
- log.info(e.getMessage(),e);
- } catch (PersistenceException e) {
-
- log.info(e.getMessage(),e);
- }
- return result;
- }
-
- }
|