feat: 1:优化景区素材,查询景区素材从套餐中获取
2:二维码列表添加描述
This commit is contained in:
+24
-9
@@ -2,6 +2,7 @@ package com.central.order.controller;
|
||||
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.utils.StringUtils;
|
||||
import com.central.order.feign.FileCenterService;
|
||||
import com.central.order.model.*;
|
||||
import com.central.order.service.IOrderService;
|
||||
@@ -25,11 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -127,16 +124,34 @@ public class QrCodeController {
|
||||
Assert.notNull(qrCode,"QRCODE不能为空");
|
||||
Tourism tourism = tourismService.getTourismById(qrCode.getTourismId());
|
||||
Assert.notNull(tourism,"TOURISM数据不能为空");
|
||||
List<TourismFile> tourismFiles = tourismFileService.getByTourismId(qrCode.getTourismId());
|
||||
if (!CollectionUtils.isEmpty(tourismFiles)) {
|
||||
for (TourismFile tourismFile: tourismFiles) {
|
||||
tourismFile.setImageUrl(fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()));
|
||||
tourism.setTourismName(StringUtils.isEmpty(qrCode.getName())?tourism.getTourismName():qrCode.getName());
|
||||
tourism.setTourismDesc(StringUtils.isEmpty(qrCode.getQrDescribe())?tourism.getTourismDesc():qrCode.getQrDescribe());
|
||||
//根据codeId获取套餐
|
||||
List<PackagePlan> list = packagePlanService.getByCodeId(codeId);
|
||||
List<TourismFile> tourismFiles = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
PackagePlan plan = list.get(0);
|
||||
String fileIds = plan.getTourismFileIds();
|
||||
if(fileIds!=null){
|
||||
List<Long> fileIdsList = Arrays.stream(fileIds.split(","))
|
||||
.map(String::trim) // 去除空格
|
||||
.filter(s -> !s.isEmpty()) // 过滤空字符串
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toList());
|
||||
for (Long fileId: fileIdsList ){
|
||||
TourismFile tourismFile = tourismFileService.getById(fileId);
|
||||
if(Objects.nonNull(tourismFile)){
|
||||
tourismFile.setImageUrl(fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()));
|
||||
tourismFiles.add(tourismFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QrCodeVO qrCodeVO = new QrCodeVO();
|
||||
qrCodeVO.setCodeId(codeId);
|
||||
qrCodeVO.setTourism(tourism);
|
||||
qrCodeVO.setTourismFiles(tourismFiles);
|
||||
// qrCodeVO.setQrCode(qrCode);
|
||||
return Result.succeed(qrCodeVO,"获取成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -117,4 +117,7 @@ public class QrCode extends SuperEntity {
|
||||
@Schema(description = "是否只显示一键成片(0:否,1:是)")
|
||||
private Integer showVideoEditOnly;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String qrDescribe;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,5 +22,6 @@ public class QrCodeVO {
|
||||
private String codeId;
|
||||
private Tourism tourism;
|
||||
private List<TourismFile> tourismFiles;
|
||||
// private QrCode qrCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface QrcodeItem {
|
||||
videoCount?: number;
|
||||
photoCount?: number;
|
||||
tourismFileIds?: number[];
|
||||
qrDescribe?: string;
|
||||
}
|
||||
export interface QrcodeFormProps {
|
||||
open: boolean;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { ModalForm, ProForm, ProFormDigit, ProFormSelect, ProFormText } from '@ant-design/pro-components';
|
||||
import { ModalForm, ProForm, ProFormDigit, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-components';
|
||||
import { ordersApi } from '@/services/orders';
|
||||
import { deviceApi } from '@/services/device';
|
||||
import { miniAppApi } from '@/services/miniapp';
|
||||
@@ -26,6 +26,7 @@ const QrcodeTourismForm: React.FC<QrcodeTourismFormProps> = ({ open, title, init
|
||||
vlogCount: 0,
|
||||
videoCount: 0,
|
||||
photoCount: 0,
|
||||
qrDescribe: '', // 描述
|
||||
};
|
||||
|
||||
// 过滤 initialValues 中的 undefined,避免覆盖默认值
|
||||
@@ -250,6 +251,18 @@ const QrcodeTourismForm: React.FC<QrcodeTourismFormProps> = ({ open, title, init
|
||||
colProps={{ span: 12 }}
|
||||
/>
|
||||
|
||||
<ProFormTextArea
|
||||
name="qrDescribe"
|
||||
label="描述"
|
||||
placeholder="请输入二维码描述"
|
||||
fieldProps={{
|
||||
rows: 3,
|
||||
showCount: true,
|
||||
maxLength: 500,
|
||||
}}
|
||||
colProps={{ span: 24 }}
|
||||
/>
|
||||
|
||||
{/* 注册一个隐藏字段以提交素材ID数组 */}
|
||||
<ProForm.Item name="tourismFileIds" hidden>
|
||||
<div />
|
||||
|
||||
Reference in New Issue
Block a user