|
|
|
@ -5,6 +5,7 @@ import com.shxy.xymanager_common.entity.TerminalPhotoExample;
|
|
|
|
|
import com.shxy.xymanager_common.model.PhotoPrepareModel;
|
|
|
|
|
import com.shxy.xymanager_common.util.DateUtil;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
|
|
|
|
|
import io.sigpipe.jbsdiff.Diff;
|
|
|
|
|
import io.sigpipe.jbsdiff.Patch;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
@ -141,10 +142,23 @@ public class AsyncService {
|
|
|
|
|
Patch.patch(oldIn, item.getData(), baos);
|
|
|
|
|
byte[] data = baos.toByteArray();
|
|
|
|
|
item.setData(data);
|
|
|
|
|
log.info("图片差分合并成功,termId=" + termId + ", oid=" + oid);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("patch合并图片失败.", e);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.saveOnePreparePhoto(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
byte[] oldIn = Files.readAllBytes(Paths.get("C:\\compare\\IMG_67FD1785_1_FF_67FDE104_67FDE109_67FDE10C.jpg"));
|
|
|
|
|
byte[] newIn = Files.readAllBytes(Paths.get("C:\\compare\\IMG_67FD1786_1_FF_67FDE80C_67FDE811_67FDE814.jpg"));
|
|
|
|
|
FileOutputStream fos = new FileOutputStream(new File("C:\\compare\\IMG_67FD1786_1_FF_67FDE80C_67FDE811_67FDE814.patch"));
|
|
|
|
|
Diff.diff(oldIn, newIn, fos);
|
|
|
|
|
|
|
|
|
|
byte[] patchIn = Files.readAllBytes(Paths.get("C:\\compare\\IMG_67FD1786_1_FF_67FDE80C_67FDE811_67FDE814.patch"));
|
|
|
|
|
FileOutputStream fos2 = new FileOutputStream(new File("C:\\compare\\bb.jpg"));
|
|
|
|
|
Patch.patch(oldIn, patchIn, fos2);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|