8beaac99c82c68ab441ade7c4ad9ce0329f27794.svn-base 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package com.system.role;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import javax.ws.rs.POST;
  5. import javax.ws.rs.Path;
  6. import javax.ws.rs.ProduceMime;
  7. import org.apache.log4j.Logger;
  8. import com.formaction.Utils;
  9. import com.formaction.vo.Msg;
  10. @Path("/GetRoleNumService/")
  11. public class GetRoleNumService {
  12. private final Logger log = Logger.getLogger(getClass());
  13. @POST
  14. @ProduceMime("application/json")
  15. @Path("/getMaxRoleNum/")
  16. public String getMaxRoleNum(){
  17. GetRoleDao dao = new GetRoleDao();
  18. String result = "";
  19. try {
  20. result = dao.getMaxRoleNum();
  21. } catch (ClassNotFoundException e) {
  22. e.printStackTrace();
  23. }
  24. return result;
  25. }
  26. @POST
  27. @ProduceMime("application/json")
  28. @Path("/createRole/")
  29. public Msg createRole(String params){
  30. log.info(params);
  31. GetRoleDao dao = new GetRoleDao();
  32. String classid = Utils.getParameter("classid", params);
  33. String fd_id = Utils.getParameter("FD_OBJECTID" + classid, params);
  34. String role_id = Utils.getParameter("ROLE_ID_" + classid, params);
  35. String role_name = Utils.getParameter("ROLE_NAME_" + classid, params);
  36. String role_duty = Utils.getParameter("ROLE_DUTY_" + classid, params);
  37. Msg m = null;
  38. try {
  39. m = dao.createRole(fd_id,role_id,role_id,role_name,role_duty,"0", formatTime(new Date()));
  40. } catch (ClassNotFoundException e) {
  41. e.printStackTrace();
  42. }
  43. return m;
  44. }
  45. public String formatTime(Date d) {
  46. SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  47. String date = sd.format(d);
  48. return date;
  49. }
  50. }