package com.engine.web.ModeForm; import com.alibaba.fastjson.JSONObject; import com.engine.common.util.ParamUtil; import com.engine.service.ModeForm.ModeFormService; import com.engine.service.ModeForm.impl.ModeFormServiceImpl; import com.google.gson.JsonObject; import com.icbc.api.internal.apache.http.impl.cookie.S; import weaver.conn.RecordSet; import weaver.general.Util; import weaver.wechat.util.Utils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Context; import java.util.HashMap; import java.util.Map; public class ModeFormWeb { private static final String nodeCountsql = "select count(1) num from uf_qzsxqp t1 left join " + " uf_qzsxqp_dt1 d1 on t1.id = d1.mainid where lc = ? and jdmc = ?"; @Path("/gethld") @GET public String getDataById(@Context HttpServletRequest request, @Context HttpServletResponse response) { try { Map map = ParamUtil.request2Map(request); // String dataTable = (String) map.get("dataTable"); RecordSet recordSet = new RecordSet(); recordSet.executeQuery("select * from uf_View_resume_perm where sfqy = 0"); StringBuilder s = new StringBuilder(); while (recordSet.next()){ String xld = Utils.null2String(recordSet.getString("xld")); s.append(xld).append(","); } HashMap result = new HashMap<>(); if (s.length()>0){ result.put("data",s.toString().substring(0, s.length()-1)); }else { result.put("data",""); } result.put("code","200"); return JSONObject.toJSONString(result); }catch (Exception e){ e.printStackTrace(); HashMap result = new HashMap<>(); result.put("data",e.getMessage()); result.put("code","500"); return JSONObject.toJSONString(result); } } @Path("/getDepartmentFormField") @GET public String getDepartmentFormField(@Context HttpServletRequest request, @Context HttpServletResponse response) { try { Map paramMap = ParamUtil.request2Map(request); ModeFormService service = new ModeFormServiceImpl(); return JSONObject.toJSONString(service.getDepartmentFormField(paramMap)); }catch (Exception e){ e.printStackTrace(); HashMap result = new HashMap<>(); result.put("data",e.getMessage()); result.put("code","500"); return JSONObject.toJSONString(result); } } @Path("/getSignByid") @GET public String getSignByid(@Context HttpServletRequest request, @Context HttpServletResponse response) { try { Map paramMap = ParamUtil.request2Map(request); Object wfid = paramMap.get("wfid"); Object nodeid = paramMap.get("nodeid"); RecordSet recordSet = new RecordSet(); recordSet.executeQuery(nodeCountsql,wfid,nodeid); int num = 0; if(recordSet.next()){ num = Util.getIntValue(recordSet.getString("num"),0) ; } HashMap result = new HashMap<>(); result.put("flag",num > 0); result.put("code","200"); return JSONObject.toJSONString(result); }catch (Exception e){ e.printStackTrace(); HashMap result = new HashMap<>(); result.put("data",e.getMessage()); result.put("code","500"); return JSONObject.toJSONString(result); } } }