fix: 美团券核销无法转map修复
This commit is contained in:
parent
71a4239741
commit
c1dbd68616
|
|
@ -31,7 +31,7 @@ public class ThirdPartyCouponServiceImpl implements ThirdPartyCouponService {
|
||||||
}
|
}
|
||||||
private final RestTemplate restTemplate;
|
private final RestTemplate restTemplate;
|
||||||
|
|
||||||
private <T> T exec(String url, Integer shopId, Object data) {
|
private <R, T> R exec(String url, Integer shopId, T data) {
|
||||||
// 获取店铺信息
|
// 获取店铺信息
|
||||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
||||||
if (shopInfo == null) {
|
if (shopInfo == null) {
|
||||||
|
|
@ -45,7 +45,12 @@ public class ThirdPartyCouponServiceImpl implements ThirdPartyCouponService {
|
||||||
// 构造请求实体,根据 data 是否为空设置请求体
|
// 构造请求实体,根据 data 是否为空设置请求体
|
||||||
HttpEntity<Object> entity;
|
HttpEntity<Object> entity;
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
Map<String, Object> map = BeanUtil.beanToMap(data);
|
Map<String, Object> map;
|
||||||
|
if (data instanceof Map) {
|
||||||
|
map = (Map<String, Object>) data;
|
||||||
|
}else {
|
||||||
|
map = BeanUtil.beanToMap(data, false, false);
|
||||||
|
}
|
||||||
map.put("title", shopInfo.getShopName());
|
map.put("title", shopInfo.getShopName());
|
||||||
entity = new HttpEntity<>(map, headers);
|
entity = new HttpEntity<>(map, headers);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -72,7 +77,7 @@ public class ThirdPartyCouponServiceImpl implements ThirdPartyCouponService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回数据
|
// 返回数据
|
||||||
return (T) resp.getData();
|
return (R) resp.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue