feat: 二维码新增或者编辑绑定景区素材

This commit is contained in:
2025-10-26 14:41:26 +08:00
parent 10a8e2a1ea
commit 7da24748fb
11 changed files with 309 additions and 206 deletions
@@ -9,6 +9,7 @@ CREATE TABLE IF NOT EXISTS `packages` (
`vlog_count` INT DEFAULT 0 COMMENT 'Vlog数量',
`video_count` INT DEFAULT 0 COMMENT '视频数量',
`photo_count` INT DEFAULT 0 COMMENT '照片数量',
`tourism_file_ids` VARCHAR(2048) DEFAULT NULL COMMENT '景区素材ID集合(逗号分隔)',
`tenant_id` VARCHAR(64) DEFAULT NULL COMMENT '租户ID',
`company` VARCHAR(128) DEFAULT NULL COMMENT '所属公司',
`is_del` TINYINT(1) DEFAULT 0 COMMENT '是否删除 0-否 1-是',
@@ -29,6 +29,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* qrcode information
@@ -222,6 +224,14 @@ public class QrCodeController {
if (vlogCount != null) plan.setVlogCount(vlogCount);
if (videoCount != null) plan.setVideoCount(videoCount);
if (photoCount != null) plan.setPhotoCount(photoCount);
// 景区素材ID集合存储到套餐表
if (body.getTourismFileIds() != null && !body.getTourismFileIds().isEmpty()) {
String idsStr = body.getTourismFileIds().stream()
.filter(Objects::nonNull)
.map(String::valueOf)
.collect(Collectors.joining(","));
plan.setTourismFileIds(idsStr);
}
packagePlanService.saveOrUpdate(plan);
}
@@ -89,4 +89,22 @@ public class TourismFileController {
return PageResult.<TourismFileGroupVO>builder().data(java.util.Collections.emptyList()).resp_code(1).count(0L).build();
}
}
}
/**
* 按景区ID获取资源列表
*/
@Operation(summary = "按景区ID获取资源列表")
@GetMapping("/byTourism/{tourismId}")
public Result listByTourismId(@PathVariable("tourismId") Long tourismId) {
java.util.List<TourismFile> list = tourismFileService.getByTourismId(tourismId);
if (list != null) {
for (TourismFile f : list) {
try {
if (f != null && f.getImageUrl() != null) {
f.setImageUrl(fileCenterService.getViewUrlByPath(f.getImageUrl()));
}
} catch (Exception ignored) {}
}
}
return Result.succeed(list, "操作成功");
}
}
@@ -33,6 +33,10 @@ public class PackagePlan extends SuperEntity {
@Schema(description = "照片数量")
private Integer photoCount;
@Schema(description = "景区素材ID集合(逗号分隔)")
private String tourismFileIds;
@Schema(description = "租户ID")
private String tenantId;
@@ -49,4 +53,4 @@ public class PackagePlan extends SuperEntity {
@Schema(description = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}
}
@@ -4,6 +4,8 @@ import com.central.order.model.QrCode;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "二维码与套餐创建/修改请求体")
public class QrcodeWithPlanDTO {
@@ -18,5 +20,8 @@ public class QrcodeWithPlanDTO {
@Schema(description = "照片数量")
private Integer photoCount;
@Schema(description = "景区素材ID集合(ID 数组)")
private List<Long> tourismFileIds;
}