| @@ -102,6 +102,7 @@ public class WxMallApplyServiceImpl implements WxMallApplyService { | |||||
| WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | ||||
| wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); | wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); | ||||
| wxMsgValidationcodeModel.setType(wxMsgValidationcode.getType()); | wxMsgValidationcodeModel.setType(wxMsgValidationcode.getType()); | ||||
| wxMsgValidationcodeModel.setName("验证码"); | |||||
| wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | ||||
| wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | ||||
| @@ -119,7 +120,8 @@ public class WxMallApplyServiceImpl implements WxMallApplyService { | |||||
| wxMsgValidationcode.setMsg(msg); | wxMsgValidationcode.setMsg(msg); | ||||
| String notifyUrl = wxMsgConfig.getNotifyurl(); | String notifyUrl = wxMsgConfig.getNotifyurl(); | ||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl,EnumVerifyCode.YES.getCode().toString()); | |||||
| Integer modelId = wxMsgValidationcodeModel.getModelId(); | |||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId); | |||||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | JSONObject jsonObjectResult = JSONObject.parseObject(result); | ||||
| String ret = jsonObjectResult.get("ret").toString(); | String ret = jsonObjectResult.get("ret").toString(); | ||||
| @@ -7,18 +7,12 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCouponInject; | |||||
| import com.iformall.domain.po.WxMsg; | |||||
| import com.iformall.domain.po.WxMsgCallback; | |||||
| import com.iformall.domain.po.WxMsgConfig; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.EnumMsgSend; | import com.iformall.enums.EnumMsgSend; | ||||
| import com.iformall.enums.EnumMsgSendStatus; | import com.iformall.enums.EnumMsgSendStatus; | ||||
| import com.iformall.enums.EnumMsgStatus; | import com.iformall.enums.EnumMsgStatus; | ||||
| import com.iformall.enums.EnumVerifyCode; | import com.iformall.enums.EnumVerifyCode; | ||||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | |||||
| import com.iformall.mapper.WxMsgCallbackMapper; | |||||
| import com.iformall.mapper.WxMsgConfigMapper; | |||||
| import com.iformall.mapper.WxMsgMapper; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.WxCUserTagsService; | import com.iformall.service.WxCUserTagsService; | ||||
| import com.iformall.service.WxMsgService; | import com.iformall.service.WxMsgService; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| @@ -55,6 +49,9 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| @Autowired | @Autowired | ||||
| WxMsgCallbackMapper wxMsgCallbackMapper; | WxMsgCallbackMapper wxMsgCallbackMapper; | ||||
| @Autowired | |||||
| WxMsgModelMapper wxMsgModelMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) { | ||||
| PageHelper.startPage(pageIndex, pageSize); | PageHelper.startPage(pageIndex, pageSize); | ||||
| @@ -200,8 +197,10 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| String signature = record.getSignature(); | String signature = record.getSignature(); | ||||
| String msg = record.getMsg(); | String msg = record.getMsg(); | ||||
| String notifyUrl = wxMsgConfig.getNotifyurl(); | String notifyUrl = wxMsgConfig.getNotifyurl(); | ||||
| WxMsgModel wxMsgModel = wxMsgModelMapper.selectByPrimaryKey(record.getId()); | |||||
| Integer modelId = wxMsgModel.getModelId(); | |||||
| logger.info("=============迈外迪API开始调用"); | logger.info("=============迈外迪API开始调用"); | ||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.NO.getCode().toString()); | |||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.NO.getCode().toString(), modelId); | |||||
| logger.info("=============迈外迪API返回结果:" + result); | logger.info("=============迈外迪API返回结果:" + result); | ||||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | JSONObject jsonObjectResult = JSONObject.parseObject(result); | ||||
| String ret = jsonObjectResult.get("ret").toString(); | String ret = jsonObjectResult.get("ret").toString(); | ||||
| @@ -80,7 +80,8 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| wxMsgValidationcode.setMsg(msg); | wxMsgValidationcode.setMsg(msg); | ||||
| String notifyUrl = wxMsgConfig.getNotifyurl(); | String notifyUrl = wxMsgConfig.getNotifyurl(); | ||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString()); | |||||
| Integer modelId = wxMsgValidationcodeModel.getModelId(); | |||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId); | |||||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | JSONObject jsonObjectResult = JSONObject.parseObject(result); | ||||
| String ret = jsonObjectResult.get("ret").toString(); | String ret = jsonObjectResult.get("ret").toString(); | ||||
| String batchNo = jsonObjectResult.get("data").toString(); | String batchNo = jsonObjectResult.get("data").toString(); | ||||
| @@ -157,6 +158,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | ||||
| wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); | wxMsgValidationcodeModel.setTenantId(wxMsgConfig.getTenantId()); | ||||
| wxMsgValidationcodeModel.setType(wxMsgValidationcode.getType()); | wxMsgValidationcodeModel.setType(wxMsgValidationcode.getType()); | ||||
| wxMsgValidationcodeModel.setName("验证码"); | |||||
| wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | ||||
| wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | ||||
| @@ -172,9 +174,9 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| String msg = wxMsgValidationcodeModel.getContent().replace("{s6}", String.valueOf(code)); | String msg = wxMsgValidationcodeModel.getContent().replace("{s6}", String.valueOf(code)); | ||||
| wxMsgValidationcode.setCode(String.valueOf(code)); | wxMsgValidationcode.setCode(String.valueOf(code)); | ||||
| wxMsgValidationcode.setMsg(msg); | wxMsgValidationcode.setMsg(msg); | ||||
| String notifyUrl = wxMsgConfig.getNotifyurl(); | String notifyUrl = wxMsgConfig.getNotifyurl(); | ||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString()); | |||||
| Integer modelId = wxMsgValidationcodeModel.getModelId(); | |||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId); | |||||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | JSONObject jsonObjectResult = JSONObject.parseObject(result); | ||||
| String ret = jsonObjectResult.get("ret").toString(); | String ret = jsonObjectResult.get("ret").toString(); | ||||
| String batchNo = jsonObjectResult.get("data").toString(); | String batchNo = jsonObjectResult.get("data").toString(); | ||||
| @@ -60,18 +60,20 @@ public class WiwideUtil { | |||||
| } | } | ||||
| public static String sendMsg(String secret, String bid, String publickey, | public static String sendMsg(String secret, String bid, String publickey, | ||||
| String phone, String signature, String msg, String notifyUrl, String verifysms) { | |||||
| TreeMap<String, String> message = new TreeMap<>(); | |||||
| String phone, String signature, String msg, String notifyUrl, String verifysms, Integer modelId) { | |||||
| TreeMap<String, Object> message = new TreeMap<>(); | |||||
| message.put("bid", bid); | message.put("bid", bid); | ||||
| message.put("phone", phone); | message.put("phone", phone); | ||||
| message.put("signature", signature); | message.put("signature", signature); | ||||
| message.put("msg", msg); | message.put("msg", msg); | ||||
| message.put("notify_url", notifyUrl); | message.put("notify_url", notifyUrl); | ||||
| message.put("verifysms", verifysms); | message.put("verifysms", verifysms); | ||||
| if (modelId != null) { | |||||
| message.put("model_id", modelId); | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | ||||
| Set<Map.Entry<String, String>> entries = message.entrySet(); | |||||
| for (Map.Entry<String, String> entry : entries) { | |||||
| Set<Map.Entry<String, Object>> entries = message.entrySet(); | |||||
| for (Map.Entry<String, Object> entry : entries) { | |||||
| sb.append(entry.getKey()).append("=").append(entry.getValue()); | sb.append(entry.getKey()).append("=").append(entry.getValue()); | ||||
| } | } | ||||
| sb.append("&secret=").append(secret); | sb.append("&secret=").append(secret); | ||||