|
|
|
|
@ -13,6 +13,7 @@ import com.zbkj.common.utils.WxUtil; |
|
|
|
|
import com.zbkj.common.vo.*; |
|
|
|
|
import com.zbkj.service.service.WechatNewService; |
|
|
|
|
import com.zbkj.service.service.WechatVideoSpuService; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
@ -34,6 +35,7 @@ import java.util.stream.Collectors; |
|
|
|
|
* +---------------------------------------------------------------------- |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@Slf4j |
|
|
|
|
public class WechatVideoSpuServiceImpl implements WechatVideoSpuService { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
@ -63,7 +65,7 @@ public class WechatVideoSpuServiceImpl implements WechatVideoSpuService { |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s); |
|
|
|
|
WxUtil.checkResult(jsonObject); |
|
|
|
|
ShopCatVo shopCatVo = JSONObject.parseObject(jsonObject.toJSONString(), ShopCatVo.class); |
|
|
|
|
System.out.println(StrUtil.format("请求微信数据返回,catData:" + jsonObject.toJSONString())); |
|
|
|
|
log.info(StrUtil.format("请求微信数据返回,catData:" + jsonObject.toJSONString())); |
|
|
|
|
return shopCatVo.getThirdCatList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -81,7 +83,7 @@ public class WechatVideoSpuServiceImpl implements WechatVideoSpuService { |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(s); |
|
|
|
|
WxUtil.checkResult(jsonObject); |
|
|
|
|
List<ShopBrandVo> brandVoList = JSONArray.parseArray(jsonObject.getJSONObject("data").toJSONString(), ShopBrandVo.class); |
|
|
|
|
System.out.println(StrUtil.format("请求微信数据返回,brandData:" + jsonObject.toJSONString())); |
|
|
|
|
log.info(StrUtil.format("请求微信数据返回,brandData:" + jsonObject.toJSONString())); |
|
|
|
|
return brandVoList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -92,13 +94,13 @@ public class WechatVideoSpuServiceImpl implements WechatVideoSpuService { |
|
|
|
|
@Override |
|
|
|
|
public ShopSpuAddResponseVo shopSpuAdd(ShopSpuAddVo shopSpuVo) { |
|
|
|
|
Map<String, Object> spuAddMap = assembleSpuAddMap(shopSpuVo); |
|
|
|
|
System.out.println("spuAddMap = " + spuAddMap); |
|
|
|
|
log.info("spuAddMap = " + spuAddMap); |
|
|
|
|
// 获取accessToken
|
|
|
|
|
String miniAccessToken = wechatNewService.getMiniAccessToken(); |
|
|
|
|
// 请求微信接口
|
|
|
|
|
String url = StrUtil.format(WeChatConstants.WECHAT_SHOP_SPU_ADD_URL, miniAccessToken); |
|
|
|
|
String postStringData = restTemplateUtil.postStringData(url, JSONObject.toJSONString(spuAddMap)); |
|
|
|
|
System.out.println("postStringData = " + postStringData); |
|
|
|
|
log.info("postStringData = " + postStringData); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(postStringData); |
|
|
|
|
WxUtil.checkResult(jsonObject); |
|
|
|
|
ShopSpuAddResponseVo addResponseVo = JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), ShopSpuAddResponseVo.class); |
|
|
|
|
@ -271,7 +273,7 @@ public class WechatVideoSpuServiceImpl implements WechatVideoSpuService { |
|
|
|
|
@Override |
|
|
|
|
public ShopSpuAddResponseVo shopSpuUpdate(ShopSpuAddVo shopSpuVo) { |
|
|
|
|
Map<String, Object> spuUpdateMap = assembleSpuAddMap(shopSpuVo); |
|
|
|
|
System.out.println("spuUpdateMap = " + spuUpdateMap); |
|
|
|
|
log.info("spuUpdateMap = " + spuUpdateMap); |
|
|
|
|
// 获取accessToken
|
|
|
|
|
String miniAccessToken = wechatNewService.getMiniAccessToken(); |
|
|
|
|
// 请求微信接口
|
|
|
|
|
|