|
|
|
@ -2700,16 +2700,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
|
|
|
|
|
public void writeAggregatePoster(JSONObject manager, String clientMoniker, OutputStream ous) {
|
|
|
|
|
JSONObject client = clientDetail(manager, clientMoniker);
|
|
|
|
|
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(
|
|
|
|
|
PlatformEnvironment.getEnv().concatUrl("/static/images/new_aggregate_poster.png"), RequestMethod.GET).execute();
|
|
|
|
|
url, RequestMethod.GET).execute();
|
|
|
|
|
if (boardBackgroundResult.isSuccess()) {
|
|
|
|
|
InputStream ins = boardBackgroundResult.getResponseContentStream();
|
|
|
|
|
BufferedImage background = ImageIO.read(ins);
|
|
|
|
|
IOUtils.closeQuietly(ins);
|
|
|
|
|
ImageIO.write(background, "jpeg", ous);
|
|
|
|
|
ous.flush();
|
|
|
|
|
IOUtils.closeQuietly(ous);
|
|
|
|
|
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
|
|
|
|
InputStream ins = boardBackgroundResult.getResponseContentStream();
|
|
|
|
|
BufferedImage background = ImageIO.read(ins);
|
|
|
|
|
IOUtils.closeQuietly(ins);
|
|
|
|
|
logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight());
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(),
|
|
|
|
|
boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException());
|
|
|
|
|