Remove join image func, push each image to frontend directly

This commit is contained in:
Bingkun Li 2026-03-09 10:47:07 +08:00
parent 6764c7bfe1
commit 460af8d011

View File

@ -67,7 +67,8 @@ public class SarImageServiceImpl implements ISarImageService {
* @param frameNo 当前帧号
* @return 返回非空的图像信息其字段 imageNo 一定有值
*/
private JmImage getBaseImage(Long airlineId, int singleWidth, int frameNo) {IMG_MAX_WITH=1;
private JmImage getBaseImage(Long airlineId, int singleWidth, int frameNo) {
// IMG_MAX_WITH=1;
List<JmImage> imageList = imageService.selectLowByAirline(airlineId);
String cacheKey = "jmImgJoin-" + airlineId;
JmImage base = null;
@ -80,17 +81,18 @@ public class SarImageServiceImpl implements ISarImageService {
}
// 情况2如果最后一张还能拼图则直接返回继续拼
JmImage last = imageList.get(imageList.size() - 1);
Integer startFrameNo = (Integer) redisUtil.hget(cacheKey, CACHE_FIELD_START_FRAME_NO);
int currWidth = startFrameNo == null ? 0 : singleWidth * (frameNo - startFrameNo + 1); // 图宽当前图+基准图
int surplusNum = (IMG_MAX_WITH - currWidth) / singleWidth; // 还可以拼图片数
Integer baseNo = (Integer) redisUtil.hget("jmImgJoin-" + airlineId, CACHE_FIELD_CURR_FRAME_NO);
if (startFrameNo == null || currWidth < IMG_MAX_WITH ||
baseNo == null || (frameNo - baseNo + 1 <= surplusNum)) { // 当前图+填充 不能超过允许拼接数
log.info("当前宽度:" + currWidth + " < " + IMG_MAX_WITH + " 可以继续拼接");
return last;
}
// Integer startFrameNo = (Integer) redisUtil.hget(cacheKey, CACHE_FIELD_START_FRAME_NO);
// int currWidth = startFrameNo == null ? 0 : singleWidth * (frameNo - startFrameNo + 1); // 图宽当前图+基准图
// int surplusNum = (IMG_MAX_WITH - currWidth) / singleWidth; // 还可以拼图片数
// log.info("surplusNum: = " + surplusNum);
// Integer baseNo = (Integer) redisUtil.hget("jmImgJoin-" + airlineId, CACHE_FIELD_CURR_FRAME_NO);
// if (startFrameNo == null || currWidth < IMG_MAX_WITH ||
// baseNo == null || (frameNo - baseNo + 1 <= surplusNum)) { // 当前图+填充 不能超过允许拼接数
// log.info("当前宽度:" + currWidth + " < " + IMG_MAX_WITH + " 可以继续拼接");
// return last;
// }
// 情况3已经拼接到最大数量或者当前图+填充数量超过允许拼接数量创建新图像文件
log.info("当前宽度:" + currWidth + " > " + IMG_MAX_WITH + " 重新拼接,当前帧号" + frameNo + "作为首帧");
// log.info("当前宽度:" + currWidth + " > " + IMG_MAX_WITH + " 重新拼接,当前帧号" + frameNo + "作为首帧");
base = new JmImage();
redisUtil.hset(cacheKey, CACHE_FIELD_START_FRAME_NO, frameNo, CACHE_EXPIRE_SECOND);
base.setImageNo(last.getImageNo() + 1);