Authored by peuei

add 调用platform接口打印门店商品吊牌

package com.yohoufo.product.controller;
import com.yoho.core.common.utils.URIBuilder;
import com.yoho.tools.docs.ApiOperation;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.HashMap;
/***
* @author peuei
* @date 2019/1/8 13:49
* @description 门店商品吊牌打印
*/
@RestController
public class InfoPrintController {
private final Logger logger = LoggerFactory.getLogger(InfoPrintController.class);
@Resource
RestTemplate restTemplate;
@Value("${ufo.platform.url}")
String platformUrl;
@ApiOperation(name = "ufo.product.shopScreen.printCode", desc = "门店商品吊牌打印")
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.shopScreen.printCode")
public ApiResponse shopScreenPrintCode(@RequestParam(value = "storeIds") String storeIds) {
if (storeIds == null) {
logger.info("in method=ufo.product.shopScreen.printCode storeIds is null");
return new ApiResponse(400, "storeIds can not be null", null);
}
logger.info("in method=ufo.product.shopScreen.printCode storeIds={}", storeIds);
URIBuilder uriBuilder = new URIBuilder(platformUrl);
uriBuilder.addPath("/infoPrint/getPrintContent.do");
uriBuilder.addParameter("storeIds", storeIds);
ApiResponse response = restTemplate.getForObject(uriBuilder.build(), ApiResponse.class);
return new ApiResponse.ApiResponseBuilder().data(response.getData()).code(200).message("print code content").build();
}
}
... ...
... ... @@ -118,3 +118,5 @@ rabbit_password=yoho
yoho.gateway.url=http://api-test3.dev.yohocorp.com
ufo.platform.url=http://java-ufo-platform.test3.ingress.dev.yohocorp.com/ufoPlatform
\ No newline at end of file
... ...