Exemplo n.º 1
0
 /**
  * 保存数据至数据库中 主要是针对短信申请
  *
  * @param msg 短信对象
  * @param dispState 状态
  */
 public void saveEntityToDB(JmsSmParameter msg, String dispState) {
   CarApplyDispatchEntity applydispatchentity = new CarApplyDispatchEntity();
   Map<String, Object> map = carApplyDispatchService.selectUserByPhone(msg.getSrcTerminalId());
   if (null != map) {
     applydispatchentity.setApplicant(map.get("SID").toString()); // 申请人ID
     applydispatchentity.setUsers(map.get("USERNAME").toString()); // 用车人姓名
     applydispatchentity.setPhone(msg.getSrcTerminalId()); // 电话号码
     applydispatchentity.setApprove_date(sdf.format(new Date())); // 申请时间
     applydispatchentity.setUse_reason(msg.getContent()); // 手机短信内容都是申请原因。
     applydispatchentity.setDisp_state(dispState); // 入库时候 // 设置调度状态为0
     carApplyDispatchService.insertCarApplyDispatchByMobile(applydispatchentity);
     logger.info("success");
   }
 }
Exemplo n.º 2
0
  /*
   * 实现Jms onMessage()方法 接受短信 解析参数 修改分派表中状态
   */
  @Override
  public void doSomething(JmsSmParameter message) {
    CarApplyDispatchEntity applydispatchentity = new CarApplyDispatchEntity();
    String content = message.getContent();
    String bcodes = message.getBusinessCode();

    if (StringUtils.isBlank(bcodes)) {
      return;
    }
    if (StringUtils.isBlank(content)) {
      return;
    }
    if (bcodes.length() > 3) {
      dispCode = bcodes.substring(3, bcodes.length());
      applydispatchentity = carApplyDispatchService.selectCarDispatchByDispCode(dispCode);
      if (applydispatchentity != null) {
        saveOrUpdateDispatch(applydispatchentity, content);
      }
    } else {
      saveEntityToDB(message, MessageConfig.Code_WAITDisp);
      logger.info("短信申请已添加,等待调度!");
    }
  }