|
|
|
@ -2,9 +2,9 @@ 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;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
@ -18,15 +18,24 @@ 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 {
|
|
|
|
|
new HttpRequestGenerator(url, RequestMethod.PUT).addQueryString("imgUrl", imgUrl).execute();
|
|
|
|
|
}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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|