|
|
@@ -86,38 +86,8 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic |
|
|
validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); |
|
|
validationcode.getExpiretime().after(currentdate)).collect(Collectors.toList()); |
|
|
if(wxmsgvalidationcodelist.size()>0) return new ResultData(ErrorCode.MSG_REPEAT_SEND.getCode(),ErrorCode.MSG_REPEAT_SEND.getMessage()); |
|
|
if(wxmsgvalidationcodelist.size()>0) return new ResultData(ErrorCode.MSG_REPEAT_SEND.getCode(),ErrorCode.MSG_REPEAT_SEND.getMessage()); |
|
|
|
|
|
|
|
|
//2、根据tenantid查询出商场名称作为签名 |
|
|
|
|
|
/*WxMall wxMall = new WxMall(); |
|
|
|
|
|
wxMall.setTenantId(wxMsgValidationcode.getTenantId()); |
|
|
|
|
|
List<WxMall> wxmallist = wxMallMapper.findList(wxMall);*/ |
|
|
|
|
|
|
|
|
|
|
|
//3、从短信配置中查询密钥 bid 等信息 |
|
|
|
|
|
// WxMsgConfig wxMsgConfig = new WxMsgConfig(); |
|
|
|
|
|
// wxMsgConfig.setTenantId(wxMsgValidationcode.getTenantId()); |
|
|
|
|
|
// List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); |
|
|
|
|
|
// if (wxMsgConfigs.size() == 0) new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(),"发送失败"); |
|
|
|
|
|
// wxMsgConfig = wxMsgConfigs.get(0); |
|
|
|
|
|
// |
|
|
|
|
|
// WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); |
|
|
|
|
|
// wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); |
|
|
|
|
|
// wxMsgValidationcodeModel.setType(EnumMsgModel.VALIDATION_CODE.getCode()); |
|
|
|
|
|
// wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); |
|
|
|
|
|
// wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); |
|
|
|
|
|
// |
|
|
|
|
|
// String secret = wxMsgConfig.getSecret(); |
|
|
|
|
|
// String bid = wxMsgConfig.getBid(); |
|
|
|
|
|
// String publickey = wxMsgConfig.getPublickey(); |
|
|
|
|
|
// //验证码 |
|
|
|
|
|
|
|
|
//验证码 |
|
|
int code = (int) ((Math.random() * 9 + 1) * 100000); |
|
|
int code = (int) ((Math.random() * 9 + 1) * 100000); |
|
|
// String phone = wxMsgValidationcode.getPhone(); |
|
|
|
|
|
// String signature = wxMsgValidationcode.getSignature(); |
|
|
|
|
|
// //内容 |
|
|
|
|
|
// String msg = wxMsgValidationcodeModel.getContent().replace("{s6}", String.valueOf(code)); |
|
|
|
|
|
// wxMsgValidationcode.setCode(String.valueOf(code)); |
|
|
|
|
|
// wxMsgValidationcode.setMsg(msg); |
|
|
|
|
|
// String notifyUrl = wxMsgConfig.getNotifyurl(); |
|
|
|
|
|
// Integer modelId = wxMsgValidationcodeModel.getModelId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//给发起人发送驳回消息 |
|
|
//给发起人发送驳回消息 |
|
|
Map<String,String> msgReplaceMap = new HashedMap(); |
|
|
Map<String,String> msgReplaceMap = new HashedMap(); |
|
|
@@ -130,26 +100,6 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic |
|
|
wxMsgRecord.setDynamicContentMap(msgReplaceMap); |
|
|
wxMsgRecord.setDynamicContentMap(msgReplaceMap); |
|
|
mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); |
|
|
mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); |
|
|
return new ResultData(Result.SUCCESS,"发送成功"); |
|
|
return new ResultData(Result.SUCCESS,"发送成功"); |
|
|
|
|
|
|
|
|
// String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId); |
|
|
|
|
|
// JSONObject jsonObjectResult = JSONObject.parseObject(result); |
|
|
|
|
|
// String ret = jsonObjectResult.get("ret").toString(); |
|
|
|
|
|
// String batchNo = jsonObjectResult.get("data").toString(); |
|
|
|
|
|
// if (ret.equals("1")) { |
|
|
|
|
|
// final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
// wxMsgValidationcode.setId(idWorker.nextId()); |
|
|
|
|
|
// long currentTime = System.currentTimeMillis() ; |
|
|
|
|
|
// Date createtime=new Date(currentTime); |
|
|
|
|
|
// Integer minutes = wxMsgValidationcodeModel.getMinutes(); |
|
|
|
|
|
// currentTime +=minutes*60*1000; |
|
|
|
|
|
// Date expiredate=new Date(currentTime); |
|
|
|
|
|
// wxMsgValidationcode.setExpiretime(expiredate); |
|
|
|
|
|
// wxMsgValidationcode.setCreatetime(createtime); |
|
|
|
|
|
// wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); |
|
|
|
|
|
// addMsgCallback(wxMsgValidationcode,batchNo); |
|
|
|
|
|
// return new ResultData(Result.SUCCESS,"发送成功"); |
|
|
|
|
|
// } |
|
|
|
|
|
// return new ResultData(ErrorCode.MSG_SEND_ERROR.getCode(),"发送失败"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|