You've already forked FrameTour-BE
下载不需要水印
This commit is contained in:
@@ -613,7 +613,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
sourceReqQuery.setFaceId(query.getFaceId());
|
sourceReqQuery.setFaceId(query.getFaceId());
|
||||||
List<SourceRespVO> list = sourceMapper.listUser(sourceReqQuery);
|
List<SourceRespVO> list = sourceMapper.listUser(sourceReqQuery);
|
||||||
if (query.getGoodsId() != null) {
|
if (query.getGoodsId() != null) {
|
||||||
list = list.stream().filter(source -> source.getId().equals(query.getGoodsId())).collect(Collectors.toList());
|
list = list.stream().filter(source -> source.getId().equals(query.getGoodsId())).toList();
|
||||||
}
|
}
|
||||||
if (!Integer.valueOf(2).equals(query.getSourceType())) {
|
if (!Integer.valueOf(2).equals(query.getSourceType())) {
|
||||||
return list.stream().map(source -> {
|
return list.stream().map(source -> {
|
||||||
@@ -634,8 +634,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}).count();
|
}).count();
|
||||||
|
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), face.getScenicId(), query.getSourceType(), face.getId());
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), face.getScenicId(), query.getSourceType(), face.getId());
|
|
||||||
if (!isBuy.isBuy()) {
|
if (!isBuy.isBuy()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -654,7 +654,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
log.warn("未配置小程序参数,无法生成二维码");
|
log.warn("未配置小程序参数,无法生成二维码");
|
||||||
return defaultUrlList;
|
return defaultUrlList;
|
||||||
}
|
}
|
||||||
if (scenicConfig != null && scenicConfig.getWatermarkType() != null) {
|
if (scenicConfig != null && scenicConfig.getWatermarkType() != null && !isBuy.isBuy()) {
|
||||||
ImageWatermarkOperatorEnum type = ImageWatermarkOperatorEnum.getByCode(scenicConfig.getWatermarkType());
|
ImageWatermarkOperatorEnum type = ImageWatermarkOperatorEnum.getByCode(scenicConfig.getWatermarkType());
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
IStorageAdapter adapter;
|
IStorageAdapter adapter;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.ycwl.basic.utils;
|
package com.ycwl.basic.utils;
|
||||||
|
|
||||||
import cn.hutool.core.codec.Base64;
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -12,6 +13,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class ImageUtils {
|
public class ImageUtils {
|
||||||
public static MultipartFile base64ToMultipartFile(String base64) {
|
public static MultipartFile base64ToMultipartFile(String base64) {
|
||||||
String[] baseStrs = base64.split(",");
|
String[] baseStrs = base64.split(",");
|
||||||
@@ -27,10 +29,12 @@ public class ImageUtils {
|
|||||||
|
|
||||||
public static MultipartFile cropImage(MultipartFile file, int x, int y, int w, int h) throws IOException {
|
public static MultipartFile cropImage(MultipartFile file, int x, int y, int w, int h) throws IOException {
|
||||||
BufferedImage image = ImageIO.read(file.getInputStream());
|
BufferedImage image = ImageIO.read(file.getInputStream());
|
||||||
if (image.getWidth() > w) {
|
log.info("图片宽高:{}", image.getWidth() + "x" + image.getHeight());
|
||||||
|
log.info("图片裁切:{}@{}", w + "x" + h, x + "," + y);
|
||||||
|
if (image.getWidth() < w) {
|
||||||
w = image.getWidth();
|
w = image.getWidth();
|
||||||
}
|
}
|
||||||
if (image.getHeight() > h) {
|
if (image.getHeight() < h) {
|
||||||
h = image.getHeight();
|
h = image.getHeight();
|
||||||
}
|
}
|
||||||
int targetX = x;
|
int targetX = x;
|
||||||
@@ -45,6 +49,7 @@ public class ImageUtils {
|
|||||||
} else if ((y + h) > image.getHeight()) {
|
} else if ((y + h) > image.getHeight()) {
|
||||||
targetY = image.getHeight() - h;
|
targetY = image.getHeight() - h;
|
||||||
}
|
}
|
||||||
|
log.info("图片实际裁切:{}@{}", w + "x" + h, targetX + "," + targetY);
|
||||||
BufferedImage targetImage = image.getSubimage(targetX, targetY, w, h);
|
BufferedImage targetImage = image.getSubimage(targetX, targetY, w, h);
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ImageIO.write(targetImage, "jpg", baos);
|
ImageIO.write(targetImage, "jpg", baos);
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
values (#{scenicId}, #{faceId}, #{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId}<if test="isFree">, #{isFree}</if>)
|
values (#{scenicId}, #{faceId}, #{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId}<if test="isFree">, #{isFree}</if>)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addRelations">
|
<insert id="addRelations">
|
||||||
insert member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id, is_free)
|
insert IGNORE member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id, is_free)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.scenicId}, #{item.faceId}, #{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{item.orderId}, #{item.isFree})
|
(#{item.scenicId}, #{item.faceId}, #{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{item.orderId}, #{item.isFree})
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 1.3 MiB |
Reference in New Issue
Block a user