public DynamicObject get_author_common() throws Exception {
    // 获取各类权限
    // 流程信息
    DynamicObject swapFlow = ActionHelper.prepared_author_base();

    String runactkey = Mvcs.getReq().getParameter("runactkey");
    DynamicObject ract =
        partyduebaseapproveService
            .getWorkFlowEngine()
            .getActManager()
            .getRactService()
            .locate(runactkey);
    String runflowkey = ract.getFormatAttr("runflowkey");
    String dataid = ract.getFormatAttr("dataid");

    swapFlow.setAttr(GlobalConstants.swap_dataid, dataid);
    swapFlow.setAttr(GlobalConstants.swap_runactkey, runactkey);
    swapFlow.setAttr(GlobalConstants.swap_runflowkey, runflowkey);

    swapFlow.setAttr(GlobalConstants.swap_tableid, "PartyDue");

    return swapFlow;
  }
Ejemplo n.º 2
0
  @At("/wechat/gaoseng")
  @POST
  @Ok("raw")
  public void responseMsg() throws IOException, DocumentException {

    SAXReader reader = new SAXReader();
    InputStream in = Mvcs.getReq().getInputStream();
    Document doc = reader.read(in);
    Element root = doc.getRootElement();

    String toUserName = root.elementText("ToUserName"); // 开发者微信号
    String fromUserName = root.elementText("FromUserName"); // 发送方帐号(一个OpenID)
    String createTime = root.elementText("CreateTime"); // 消息创建时间 (整型)
    String msgType = root.elementText("MsgType"); // 消息类型
    String content = root.elementText("Content"); // 文本消息内容
    String msgId = root.elementText("MsgId"); // 消息id,64位整型

    //		System.out.println("fromUserName: "******"toUserName: "******"qq") || content.equals("求签")) {

      Date date = new Date();
      DateFormat format = new SimpleDateFormat("yyyy-MM-dd");

      Sql sql1 =
          Sqls.create(
              "SELECT t.* FROM gs_qiuqian_result t WHERE t.OPENID = @OPENID AND t.CREATETIME = @CREATETIME");
      sql1.params().set("CREATETIME", format.format(date).substring(0, 10));
      sql1.params().set("OPENID", fromUserName);
      sql1.setCallback(
          new SqlCallback() {
            public Object invoke(Connection conn, ResultSet rs, Sql sql1) throws SQLException {
              Map<String, String> map = new HashMap<String, String>();
              while (rs.next()) map.put("qwid", rs.getString("qwid"));
              return map;
            }
          });
      dao.execute(sql1);
      Map<String, String> map = sql1.getObject(HashMap.class);
      if (map.size() == 0) {
        String qwId = cn.gaoseng.tool.Lottery.getLottery("1");
        Sql sql2 = Sqls.create("SELECT t.* FROM gs_qiuqian_qianwen t WHERE t.ID=@ID");
        sql2.params().set("ID", qwId);

        Sql sql3 =
            Sqls.create(
                "INSERT INTO gs_qiuqian_result(OPENID,CREATETIME,QWID) VALUES(@OPENID,@CREATETIME,@QWID)");
        sql3.params().set("QWID", qwId);
        sql3.params().set("OPENID", fromUserName);
        sql3.params().set("CREATETIME", format.format(date).substring(0, 10));
        sql2.setCallback(
            new SqlCallback() {
              public Object invoke(Connection conn, ResultSet rs, Sql sql2) throws SQLException {
                Map<String, String> map1 = new HashMap<String, String>();
                while (rs.next()) {
                  map1.put("id", rs.getString("id"));
                  map1.put("title", rs.getString("title"));
                  map1.put("url", rs.getString("url"));
                  map1.put("jieqian", rs.getString("jieqian"));
                  map1.put("picurl", rs.getString("picurl"));
                  map1.put("typeid", rs.getString("typeid"));
                }
                return map1;
              }
            });
        dao.execute(sql2, sql3);
        Map<String, String> map1 = sql2.getObject(HashMap.class);
        if (map1.size() == 0) {
          out.printf(
              RESPONSE_TXT,
              fromUserName,
              toUserName,
              System.currentTimeMillis(),
              "text",
              "欢迎您访问高僧网[呲牙]   在线求签 请输入 qq或者求签");
        } else {

          out.printf(
              RESPONSE_IMAGE_TXT,
              fromUserName,
              toUserName,
              System.currentTimeMillis(),
              map1.get("title"),
              map1.get("jieqian"),
              map1.get("picurl"),
              map1.get("url"));
        }
      } else {
        Sql sql4 = Sqls.create("SELECT t.* FROM gs_qiuqian_qianwen t WHERE t.ID=@ID");
        sql4.params().set("ID", map.get("qwid"));
        sql4.setCallback(
            new SqlCallback() {
              public Object invoke(Connection conn, ResultSet rs, Sql sql4) throws SQLException {
                Map<String, String> map2 = new HashMap<String, String>();
                while (rs.next()) {
                  map2.put("id", rs.getString("id"));
                  map2.put("title", rs.getString("title"));
                  map2.put("url", rs.getString("url"));
                  map2.put("jieqian", rs.getString("jieqian"));
                  map2.put("picurl", rs.getString("picurl"));
                  map2.put("typeid", rs.getString("typeid"));
                }
                return map2;
              }
            });
        dao.execute(sql4);
        Map<String, String> map2 = sql4.getObject(HashMap.class);
        if (map2.size() == 0) {
          out.printf(
              RESPONSE_TXT,
              fromUserName,
              toUserName,
              System.currentTimeMillis(),
              "text",
              "欢迎您访问高僧网[呲牙]   在线求签 请输入 qq或者求签");
        } else {

          out.printf(
              RESPONSE_IMAGE_TXT,
              fromUserName,
              toUserName,
              System.currentTimeMillis(),
              map2.get("title"),
              map2.get("jieqian"),
              map2.get("picurl"),
              map2.get("url"));
        }
      }

    } else {

      out.printf(
          RESPONSE_TXT,
          fromUserName,
          toUserName,
          System.currentTimeMillis(),
          "text",
          "欢迎您访问高僧网[呲牙]   在线求签 请输入 qq或者求签");
    }
    /** The Dead Code end */
    in.close();
    in = null;
    out.close();
    out = null;
  }