Пример #1
0
  @Override
  public Map<String, Object> insertSendMessage(Map<String, Object> map) {
    Map<String, Object> rmap = new HashMap<String, Object>();

    map.put("createTime", DateUtil.getNowDateStr());
    map.put("sendCode", DateUtil.getNowDateStr2() + RandomUtil.getRandom());
    //		Map<String,String> m=getExamineId((String)map.get("spr"));
    //		if(m==null ||m.size()==0){
    //			rmap.put("status", "N");
    //			rmap.put("msg", "未查询到审核人信息!");
    //			return rmap;
    //		}
    //		map.put("examine_id", m.get("examine_id"));
    //		map.put("phone_no",m.get("examine_phone"));
    int i = 0;
    // 判断推送信息是否重复
    String dxCode = "";
    try {
      dxCode = sendMessageDao.queryMessageCode((String) map.get("send_ms"));
    } catch (Exception e1) {
      log.error("查询dxCode出错:" + e1.getMessage());
      rmap.put("status", "N");
      rmap.put("msg", "保存推送信息出错!");
      return rmap;
    }
    if (null == dxCode || "".equals(dxCode)) {
      dxCode = UUID.randomUUID().toString().replaceAll("-", "");
    }
    map.put("dxCode", dxCode);
    try {
      map.put("status", "2");
      sendMessageDao.updateAfterSendMessageStatus(map);
      i = sendMessageDao.insertSendMessage(map);
    } catch (Exception e) {
      log.info("插入推送信息出错!" + e.getMessage());
    }
    if (1 != i) {
      rmap.put("status", "N");
      rmap.put("msg", "保存推送信息出错!");
      return rmap;
    }

    //		if(sendExamineRandomNo(map)){
    //			try {//创建成功  修改目前状态等于2的 保证 一个类型下 只有一个推送信息可用
    //				map.put("status", "2");
    //				sendMessageDao.updateAfterSendMessageStatus(map);
    //			} catch (Exception e) {
    //			}
    //			rmap.put("status","Y");
    //			rmap.put("sendCode",map.get("sendCode"));
    //			rmap.put("exName", m.get("examine_name"));
    //			rmap.put("exPhoneNo", m.get("examine_phone"));
    //		}else{
    //			rmap.put("status", "N");
    //			rmap.put("msg", "生成随机码出错,请重新提交");
    //		}
    rmap.put("status", "Y");
    rmap.put("msg", "保存推送信息成功!");
    return rmap;
  }
Пример #2
0
  @Override
  public String shortMessageCodeSend(Map<String, Object> map) {
    map.put("create_time", DateUtil.getNowDateStr());
    map.put("sendCode", DateUtil.getNowDateStr2() + RandomUtil.getRandom());
    String resultms = (String) map.get("sendCode");

    String isql = "短信表";
    try {
      String r = insertShortMessageCode(map);
      if (r.equals("N")) {
        resultms = "F";
      } else {
        map.put("status", "2"); // 插入成功,修改目前状态已经为2的数据
        sendMessageDao.updateAfterSendMessageStatus(map);
      }
      Connection con = DataBaseJdbc.getDB2Connection();
      if (con != null) {
        Statement stmt = con.createStatement();
        int i = stmt.executeUpdate(isql);
        if (i < 1) {
          resultms = "F";
        }
      } else {
        resultms = "F";
      }
    } catch (Exception e) {
      log.error("cc=" + e.getMessage());
      resultms = "E";
    }
    return resultms;
  }
Пример #3
0
 @Override
 public boolean addWebServiceSendMessage(Map<String, Object> map) throws Exception {
   sendMessageDao.updatAllSendMessageStatus(map.get("activeCode").toString());
   map.put("sendCode", DateUtil.getNowDateStr2() + RandomUtil.getRandom());
   map.put("createTime", DateUtil.getNowDateStr());
   int i = sendMessageDao.addWebServiceSendMessage(map);
   if (i > 0) {
     return true;
   } else {
     return false;
   }
 }
Пример #4
0
  @Override
  public boolean sendExamineRandomNo(Map<String, Object> map) {
    if ("Y".equals(map.get("rsend"))) { // 从新发送短信随机码
      // 修改现有的随机码状态
      map.put("randomStatus", "2"); // 超时状态
      try {
        randomDao.updateRandomNo(map);
      } catch (Exception e) {
        log.error("更新随机码状态(失效)出错=" + e.getMessage());
      }
      Map<String, Object> smMap = sendMessageDao.getSendMessages(map);
      Map<String, String> m = getExamineId((String) map.get("user_id")); // 获取审核人
      map.put("examine_id", m.get("examine_id"));
      map.put("send_ms", smMap.get("send_ms"));
    }
    String randomNo = RandomUtil.getRandom();
    map.put("random_type", "sh");
    map.put("create_time", DateUtil.getNowDateStr());
    map.put("random_no", randomNo);
    map.put("status", "0"); // 0未使用

    int r = 0;
    try {
      r = randomDao.insertRandomCode(map);
    } catch (Exception e) {
      log.info("随机码插入日志表出错=" + e.getMessage());
    } // 随机码入库
    if (1 != r) {
      return false;
    }

    // 生成短信信息
    map.put("send_time", DateUtil.getNowDateStr());
    map.put("send_ms", map.get("send_ms") + "|本次审核随机码:" + randomNo);
    map.put("ms_type", "9"); // 系统内部短信

    // 调用发送信息方法
    // if短信是否发送成功
    log.info("下发短信信息=" + map);

    // 发送短信入库日志表  》》
    try {
      sendMessageDao.insertSendMessageLog(map);
    } catch (Exception e) {
      log.info("发送短信入库日志表出错=" + e.getMessage());
    }

    return sendmsdb(map);
  }
Пример #5
0
  @Override
  public String randomNoSend(Map<String, Object> map) {
    String randomNo = RandomUtil.getRandom();
    map.put("random_type", "sh");
    map.put("create_time", DateUtil.getNowDateStr());
    map.put("random_no", randomNo);
    map.put("status", "0"); // 0未使用
    int r = 0;
    try {
      r = randomDao.insertRandomCode(map);
    } catch (Exception e) {
      log.info("随机码插入日志表出错=" + e.getMessage());
      return "E";
    } // 随机码入库
    if (1 != r) {
      return "N";
    }

    Map<String, String> pm = getExamineId((String) map.get("spr"));
    if (pm != null) {
      map.put("phone_no", pm.get("examine_phone"));
    }
    // 生成短信信息
    map.put("send_time", DateUtil.getNowDateStr());
    map.put("send_ms", map.get("smbCode") + "|本次审核随机码:" + randomNo);
    map.put("ms_type", "9"); // 系统内部短信
    // 调用发送信息方法
    // select * from vgop.msm_upload_his where msm_phonenum='15828295348' order by msm_date desc
    // fetch first 10 rows only

    // if短信是否发送成功
    log.info("下发短信信息=" + map);
    // 发送短信入库日志表  》》
    try {
      sendMessageDao.insertSendMessageLog(map);
    } catch (Exception e) {
      log.info("发送短信入库日志表出错=" + e.getMessage());
      return "E";
    }

    if (!sendmsdb(map)) {
      return "N";
    }
    return "Y";
  }