package com.idorabox.manage.web.app;
import java.util.HashMap;
import java.util.Map;
import java.io.IOException;
import java.io.PrintWriter;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.idorabox.manage.service.book.JdBookTokenService;
import com.idorabox.manage.service.jd.JdTokenService;
import com.idorabox.manage.web.util.HttpUtils;
/**
* 3.12 商品可售验证接口
* @author chen
*
*/
@Controller
@RequestMapping("/appMessage")
public class CheckAction {
@Resource
JdTokenService jdTokenService;
@Resource
JdBookTokenService jdBookTokenService;
@RequestMapping("/productCheck.html")
public void check(
@RequestParam(value = "skuIds", required = false)String skuIds,
@RequestParam(value = "token", required = false)String token,
HttpServletResponse response) {
Map<String, String> params = new HashMap<String, String>();
//京东查询接口
String url = "https://bizapi.jd.com/api/product/check";
params.put("token", token);
params.put("skuIds", skuIds);
String jsonResult = HttpUtils.sendPost(url, params);
//将调用京东查询的接口的数据写出给app端
PrintWriter writer = null;
try {
writer = response.getWriter();
writer.write(jsonResult);
} catch (IOException e) {
e.printStackTrace();
} finally {
writer.close();
}
}
}
java接口供APP端调用
最新推荐文章于 2024-05-22 16:47:58 发布