package com.system.role; import java.text.SimpleDateFormat; import java.util.Date; 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.vo.Msg; @Path("/GetRoleNumService/") public class GetRoleNumService { private final Logger log = Logger.getLogger(getClass()); @POST @ProduceMime("application/json") @Path("/getMaxRoleNum/") public String getMaxRoleNum(){ GetRoleDao dao = new GetRoleDao(); String result = ""; try { result = dao.getMaxRoleNum(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return result; } @POST @ProduceMime("application/json") @Path("/createRole/") public Msg createRole(String params){ log.info(params); GetRoleDao dao = new GetRoleDao(); String classid = Utils.getParameter("classid", params); String fd_id = Utils.getParameter("FD_OBJECTID" + classid, params); String role_id = Utils.getParameter("ROLE_ID_" + classid, params); String role_name = Utils.getParameter("ROLE_NAME_" + classid, params); String role_duty = Utils.getParameter("ROLE_DUTY_" + classid, params); Msg m = null; try { m = dao.createRole(fd_id,role_id,role_id,role_name,role_duty,"0", formatTime(new Date())); } catch (ClassNotFoundException e) { e.printStackTrace(); } return m; } public String formatTime(Date d) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = sd.format(d); return date; } }