OUTDataServlet.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package flow;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import org.apache.log4j.Logger;
  5. import org.codehaus.jettison.json.JSONObject;
  6. /**
  7. * A basic servlet which allows a user to define their code, generate
  8. * any output, and to select where to transition to next.
  9. * Last generated by Orchestration Designer at: 2020年3月23日 上午05时27分20秒
  10. */
  11. public class OUTDataServlet extends com.avaya.sce.runtime.BasicServlet {
  12. private static final boolean List = false;
  13. private static Logger log = Logger.getLogger(OUTDataServlet.class);
  14. //{{START:CLASS:FIELDS
  15. //}}END:CLASS:FIELDS
  16. /**
  17. * Default constructor
  18. * Last generated by Orchestration Designer at: 2020年3月23日 上午05时27分20秒
  19. */
  20. public OUTDataServlet() {
  21. //{{START:CLASS:CONSTRUCTOR
  22. super();
  23. //}}END:CLASS:CONSTRUCTOR
  24. }
  25. /**
  26. * This method allows for custom integration with other Java components.
  27. * You may use Java for sophisticated logic or to integrate with custom
  28. * connectors (i.e. JMS, custom web services, sockets, XML, JAXB, etc.)
  29. *
  30. * Any custom code added here should work as efficiently as possible to prevent delays.
  31. * It's important to design your callflow so that the voice browser (Voice Portal/IR)
  32. * is not waiting too long for a response as this can lead to a poor caller experience.
  33. * Additionally, if the response to the client voice browser exceeds the configured
  34. * timeout, the platform may throw an "error.badfetch".
  35. *
  36. * Using this method, you have access to all session variables through the
  37. * SCESession object.
  38. *
  39. * The code generator will *** NOT *** overwrite this method in the future.
  40. * Last generated by Orchestration Designer at: 2020年3月23日 上午05时27分20秒
  41. */
  42. public void servletImplementation(com.avaya.sce.runtimecommon.SCESession mySession) {
  43. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
  44. log.info("OUTDataServlet开始时间=======" + df.format(new Date()));
  45. String ani = mySession.getVariableField(IProjectVariables.SESSION,
  46. IProjectVariables.SESSION_FIELD_ANI).getStringValue();
  47. log.info("OUTDataServlet 来电号码=======" + ani);
  48. String zcd_menu = mySession.getVariableField(IProjectVariables.ZCD_MENU,IProjectVariables.ZCD_MENU_FIELD_VALUE).getStringValue();
  49. String jszc_menu = mySession.getVariableField(IProjectVariables.JSZC_MENU,IProjectVariables.JSZC_MENU_FIELD_VALUE).getStringValue();
  50. String isvip = mySession.getVariableField(IProjectVariables.IS_VIP).getStringValue();
  51. if(jszc_menu.equals("")||jszc_menu==null){
  52. jszc_menu="0";
  53. }
  54. String data=null;
  55. if (isvip.equals("1")) {
  56. data="key1="+0+"|key2="+0;
  57. mySession.getVariableField(IProjectVariables.UUI).setValue(data);
  58. mySession.getVariableField(IProjectVariables.PHONE).setValue("1068");
  59. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  60. log.info("OUTDataServlet 呼出号码是=======" + phone);
  61. }else {
  62. data="key1="+zcd_menu+"|key2="+jszc_menu;
  63. mySession.getVariableField(IProjectVariables.UUI).setValue(data);
  64. if(zcd_menu.equals("1")){
  65. mySession.getVariableField(IProjectVariables.PHONE).setValue("1002");
  66. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  67. log.info("OUTDataServlet 呼出号码是=======" + phone);
  68. }else if (zcd_menu.equals("2")) {
  69. if (jszc_menu.equals("1")) {
  70. mySession.getVariableField(IProjectVariables.PHONE).setValue("1004");
  71. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  72. log.info("OUTDataServlet 呼出号码是=======" + phone);
  73. }else if(jszc_menu.equals("2")){
  74. mySession.getVariableField(IProjectVariables.PHONE).setValue("1006");
  75. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  76. log.info("OUTDataServlet 呼出号码是=======" + phone);
  77. }else {
  78. mySession.getVariableField(IProjectVariables.PHONE).setValue("1013");
  79. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  80. log.info("OUTDataServlet 呼出号码是=======" + phone);
  81. }
  82. }else if (zcd_menu.equals("3")) {
  83. mySession.getVariableField(IProjectVariables.PHONE).setValue("1008");
  84. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  85. log.info("OUTDataServlet 呼出号码是=======" + phone);
  86. }else{
  87. mySession.getVariableField(IProjectVariables.PHONE).setValue("1010");
  88. String phone = mySession.getVariableField(IProjectVariables.PHONE).getStringValue();
  89. log.info("OUTDataServlet 呼出号码是=======" + phone);
  90. }
  91. }
  92. log.info("OUTDataServlet UCID 是 :"+mySession.getVariableField(IProjectVariables.SESSION,IProjectVariables.SESSION_FIELD_UCID).getStringValue()+" 来电号码是 :"+mySession.getVariableField(IProjectVariables.SESSION,IProjectVariables.SESSION_FIELD_ANI).getStringValue()+"传输参数======="+data);
  93. // TODO: Add your code here!
  94. }
  95. /**
  96. * Builds the list of branches that are defined for this servlet object.
  97. * This list is built automatically by defining Goto nodes in the call flow editor.
  98. * It is the programmer's responsibilty to provide at least one enabled Goto.<BR>
  99. *
  100. * The user should override updateBranches() to determine which Goto that the
  101. * framework will activate. If there is not at least one enabled Goto item,
  102. * the framework will throw a runtime exception.<BR>
  103. *
  104. * This method is generated automatically and changes to it may
  105. * be overwritten next time code is generated. To modify the list
  106. * of branches for the flow item, override:
  107. * <code>updateBranches(Collection branches, SCESession mySession)</code>
  108. *
  109. * @return a Collection of <code>com.avaya.sce.runtime.Goto</code>
  110. * objects that will be evaluated at runtime. If there are no gotos
  111. * defined in the Servlet node, then this returns null.
  112. * Last generated by Orchestration Designer at: 2021年12月20日 下午09时59分54秒
  113. */
  114. public java.util.Collection getBranches(com.avaya.sce.runtimecommon.SCESession mySession) {
  115. java.util.List list = null;
  116. com.avaya.sce.runtime.Goto aGoto = null;
  117. list = new java.util.ArrayList(1);
  118. aGoto = new com.avaya.sce.runtime.Goto("ZxjyAnnounce", 0, true, "Default");
  119. list.add(aGoto);
  120. return list;
  121. }
  122. }