|
|
@ -2700,16 +2700,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
public void writeAggregatePoster(JSONObject manager, String clientMoniker, OutputStream ous) {
|
|
|
|
public void writeAggregatePoster(JSONObject manager, String clientMoniker, OutputStream ous) {
|
|
|
|
JSONObject client = clientDetail(manager, clientMoniker);
|
|
|
|
JSONObject client = clientDetail(manager, clientMoniker);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
logger.debug("downloading aggregate poster from {}", clientMoniker);
|
|
|
|
String url = PlatformEnvironment.getEnv().concatUrl("/static/images/new_aggregate_poster.png");
|
|
|
|
|
|
|
|
logger.debug("downloading aggregate poster from {}--{}", clientMoniker, url);
|
|
|
|
HttpRequestResult boardBackgroundResult = new HttpRequestGenerator(
|
|
|
|
HttpRequestResult boardBackgroundResult = new HttpRequestGenerator(
|
|
|
|
PlatformEnvironment.getEnv().concatUrl("/static/images/new_aggregate_poster.png"), RequestMethod.GET).execute();
|
|
|
|
url, RequestMethod.GET).execute();
|
|
|
|
if (boardBackgroundResult.isSuccess()) {
|
|
|
|
if (boardBackgroundResult.isSuccess()) {
|
|
|
|
|
|
|
|
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
|
|
|
InputStream ins = boardBackgroundResult.getResponseContentStream();
|
|
|
|
InputStream ins = boardBackgroundResult.getResponseContentStream();
|
|
|
|
BufferedImage background = ImageIO.read(ins);
|
|
|
|
BufferedImage background = ImageIO.read(ins);
|
|
|
|
IOUtils.closeQuietly(ins);
|
|
|
|
IOUtils.closeQuietly(ins);
|
|
|
|
ImageIO.write(background, "jpeg", ous);
|
|
|
|
logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight());
|
|
|
|
ous.flush();
|
|
|
|
BufferedImage img = new BufferedImage(background.getWidth(), background.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
|
|
|
|
|
|
|
|
Graphics g = img.getGraphics();
|
|
|
|
|
|
|
|
g.drawImage(background, 0, 0, null);
|
|
|
|
|
|
|
|
g.dispose();
|
|
|
|
|
|
|
|
ImageIO.write(img, "jpeg", bos);
|
|
|
|
|
|
|
|
bos.flush();
|
|
|
|
|
|
|
|
byte[] imageBytes = bos.toByteArray();
|
|
|
|
|
|
|
|
logger.debug("aggregate image length {}", imageBytes.length);
|
|
|
|
|
|
|
|
ous.write(imageBytes);
|
|
|
|
IOUtils.closeQuietly(ous);
|
|
|
|
IOUtils.closeQuietly(ous);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(),
|
|
|
|
logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(),
|
|
|
|
boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException());
|
|
|
|
boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException());
|
|
|
|