Commit 026399d8 authored by shiyu's avatar shiyu

预估价模板消息4

parent a5522abd
......@@ -490,6 +490,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
exchangeNoticeMsg.setItemName(item.getName());
exchangeNoticeMsg.setOpenId(buyerOpenId);
exchangeNoticeMsg.setOfficialEstimatedPrice(PriceUtil.convertPriceFenToYuan(item.getOfficialEstimatedPrice()));
logger.info("ExchangeNoticeMsg :{}", JsonUtils.from(exchangeNoticeMsg));
sendMsgService.sendOfficialEstimatedPriceMsg(exchangeNoticeMsg);
} else {
logger.info(">>>>> 买家openid为空, 发送消息失败 <<<<<");
......
......@@ -978,6 +978,7 @@ public class SendMsgServiceImpl implements SendMsgService {
public Result sendOfficialEstimatedPriceMsg(ExchangeNoticeMsg exchangeNoticeMsg) {
try {
String openId = exchangeNoticeMsg.getOpenId();
logger.info("sendOfficialEstimatedPriceMsg openid:{}", openId);
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
......@@ -999,21 +1000,21 @@ public class SendMsgServiceImpl implements SendMsgService {
put("value", exchangeNoticeMsg.getOfficialEstimatedPrice()+ "元");
}});
map.put("data", paramMap);
logger.info("============ 发送官方估完成通知模板消息内容 : {}", JsonUtils.fromMap(map));
logger.info("============ 发送官方估完成通知模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送官方估完成通知模板消息 response :{}", openId, responseStr);
logger.info("openid : {}, 发送官方估完成通知模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送官方估完成通知模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
logger.error("openid : {}, 发送官方估完成通知模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送官方估完成通知模板消息成功 ===========");
logger.info("=============发送官方估完成通知模板消息成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送官方估完成通知模板消息 error :{}", e);
logger.error("发送官方估完成通知模板消息 error :{}", e);
}
return Result.failed();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment