Beispiel #1
0
    /*
     * 状态报告
     *
     * 我们下发了submit订购成功消息后会上报一个状态
     * 订购成功:State=2  ErrorCode:100
     *
     *
     */
    private void report(Report command) {
      log.info("report:" + command.getErrorCode());
      log.info("report:" + command.getReportType());
      log.info("report:" + command.getReverse());
      log.info("report:" + command.getState());
      log.info("report:" + command.getSubmitSequenceNumber());
      log.info("report:" + command.getUserNumber());

      ReportModel req = new ReportModel();
      req.setErrorCode("" + command.getErrorCode());
      req.setReportType("" + command.getReportType());
      req.setReverse("" + command.getReverse());
      req.setState("" + command.getState());
      req.setSubmitSequenceNumber("" + command.getSubmitSequenceNumber());
      req.setUserNumber("" + command.getUserNumber());
      try {
        MongodbDAO.insertReport(req);
        // 第二步,更新订购状态,并通知portal已经订购成功
        MongodbDAO.updateMTReqStatus(
            command.getSubmitSequenceNumber(), Byte.toString(command.getErrorCode()));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Beispiel #2
0
 @Override
 public void run() {
   System.out.println("计费线程启动---------------");
   try {
     while (true) {
       MongodbDAO.dealJFReq(
           new ReqHandler() {
             @Override
             public void doAny(MTReq req) throws Exception {
               String seq = new SPSender().sendMTReq(req);
               req.setSequenceNumber(seq);
             }
           });
       Thread.sleep(300000);
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   System.out.println("计费线程结束---------------");
 }
Beispiel #3
0
    /**
     * 将收到的短信转发给相应的业务逻辑处理层 转发方式Socket、Http、WebService
     *
     * @param command
     * @throws IOException
     * @throws UnknownHostException
     */
    public void deliver(final Deliver command) throws UnknownHostException, IOException {
      log.info("deliver.getLinkID:" + command.getLinkID());
      log.info("deliver.getMessageCoding:" + command.getMessageCoding());
      log.info("deliver.getMessageLength:" + command.getMessageLength());
      log.info("deliver.getMessageContent:" + command.getMessageContent());
      log.info("deliver.getSPNumber:" + command.getSPNumber());
      log.info("deliver.getTP_pid:" + command.getTP_pid());
      log.info("deliver.getTP_udhi:" + command.getTP_udhi());
      log.info("deliver.getUserNumber:" + command.getUserNumber());

      try {
        if (command.getMessageContent().trim().toUpperCase().startsWith("TD")
            || command.getMessageContent().trim().equals("0000")
            || command.getMessageContent().trim().equals("00000")) {
          String servicetype =
              BusinessConfig.msg2BusMao
                  .get(command.getMessageContent().trim().toUpperCase())
                  .getServicetype();
          String date = DateHelper.getDateString("yyyyMMddHHmmss");
          SyncNotifySPServiceServiceLocator service = new SyncNotifySPServiceServiceLocator();
          SyncNotifySPSoapBindingStub stub =
              new SyncNotifySPSoapBindingStub(
                  new URL(
                      "http://119.254.84.182:9071/axiswebservice/services/SyncNotifySPServiceService"),
                  service);
          OrderRelationUpdateNotifyRequest orderRelationUpdateNotifyRequest =
              new OrderRelationUpdateNotifyRequest();
          orderRelationUpdateNotifyRequest.setContent(
              command.getMessageContent().trim().toUpperCase());
          orderRelationUpdateNotifyRequest.setEffectiveDate(date);
          orderRelationUpdateNotifyRequest.setEncodeStr("LTZX");
          orderRelationUpdateNotifyRequest.setExpireDate("20351231000000");
          orderRelationUpdateNotifyRequest.setLinkId(command.getLinkID());
          orderRelationUpdateNotifyRequest.setProductId("LTZX");
          orderRelationUpdateNotifyRequest.setRecordSequenceId(
              DateHelper.getDateString("yyyyMMddHHmmss") + Guid.genRandom(4));
          orderRelationUpdateNotifyRequest.setServiceType(servicetype);
          orderRelationUpdateNotifyRequest.setSpId(command.getSPNumber());
          orderRelationUpdateNotifyRequest.setTime_stamp(date);
          orderRelationUpdateNotifyRequest.setUpdateDesc("LTZX");
          orderRelationUpdateNotifyRequest.setUpdateTime(date);
          orderRelationUpdateNotifyRequest.setUpdateType(2);
          orderRelationUpdateNotifyRequest.setUserId(command.getUserNumber());
          orderRelationUpdateNotifyRequest.setUserIdType(1);
          stub.orderRelationUpdateNotify(orderRelationUpdateNotifyRequest);
          // cancel mtreq
          MongodbDAO.updateReqForCancel(command.getUserNumber().substring(2), servicetype);
        } else {

          MTReq mtreq = new MTReq();
          mtreq.setChargeType("0");
          mtreq.setLinkId(command.getLinkID());
          mtreq.setMessageContent("恭喜您,订购成功!");
          mtreq.setMobile(command.getUserNumber().substring(2));
          mtreq.setCreatedate(DateHelper.getTime());
          mtreq.setReportFlag("1");
          mtreq.setSpNumber(command.getSPNumber());
          mtreq.setServiceType(
              BusinessConfig.msg2BusMao
                  .get(command.getMessageContent().trim().toUpperCase())
                  .getServicetype());
          mtreq.setDealflag("0"); // 待处理
          mtreq.setMorelatetoMTFlag("2"); // 订购消息

          // 发送订购确认请求
          String seq = new SPSender().sendMTReq(mtreq); // confirm subscription
          mtreq.setSequenceNumber(seq);

          // 第一步,插入订购请求(待处理),等待状态上报的时候更新状态
          MongodbDAO.insertMTReq(mtreq);
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }