From 060390ca9dbafe23c84c0e29ddb7572e24e5b70e Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 5 Jun 2019 14:22:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A2=9E=E5=8A=A0poster=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../posters/core/impls/PosterServiceImpl.java | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 7802d4737..bf4484fa7 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.1.2 - 1.0.27 + 1.0.28 diff --git a/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java index e4640d8d0..f2df7f4d7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/posters/core/impls/PosterServiceImpl.java @@ -2,9 +2,7 @@ package au.com.royalpay.payment.manage.posters.core.impls; import au.com.royalpay.payment.manage.posters.core.PosterService; import cn.yixblog.platform.http.HttpRequestGenerator; -import com.alibaba.fastjson.JSONObject; -import com.yeepay.shade.org.apache.http.protocol.HTTP; -import org.apache.http.entity.StringEntity; +import cn.yixblog.platform.http.HttpRequestResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -21,17 +19,23 @@ import java.net.URISyntaxException; @Service public class PosterServiceImpl implements PosterService { private Logger logger = LoggerFactory.getLogger(getClass()); + @Value("${app.cms.host}") private String cmsHost; @Override public void updatePoster(String imgUrl) { String url = cmsHost + "/api/statistics/count"; + HttpRequestGenerator htg = new HttpRequestGenerator(url, RequestMethod.PUT); try { - logger.info("Before : Request CMS service"); - new HttpRequestGenerator(url, RequestMethod.PUT).addQueryString("imgUrl", imgUrl).execute(); - logger.info("Before : Request CMS service"); - }catch (URISyntaxException e) { + HttpRequestResult result = htg.addQueryString("imgUrl", imgUrl).execute(); + if (result.isSuccess()) { + int statusCode = result.getStatusCode(); + if (statusCode == 200) { + logger.info("CMS request succeeded"); + } + } + } catch (URISyntaxException e) { e.printStackTrace(); } }