feat[景区管理]: 景区素材管理逻辑新增
This commit is contained in:
+8
-8
@@ -81,7 +81,7 @@ public class FileController {
|
||||
PageResult<FileInfo> pageResult = fileService.findList(params);
|
||||
if(pageResult.getCount() >0){
|
||||
for (FileInfo fileInfo: pageResult.getData()){
|
||||
fileInfo.setUrl(getViewUrlByName(fileInfo.getName()));
|
||||
fileInfo.setUrl(getViewUrlByPath(fileInfo.getName()));
|
||||
}
|
||||
}
|
||||
return pageResult;
|
||||
@@ -92,14 +92,14 @@ public class FileController {
|
||||
return fileService.getViewUrl(id);
|
||||
}
|
||||
|
||||
@GetMapping("/files/name")
|
||||
public String getViewUrlByName(@RequestParam String name) {
|
||||
return fileService.getViewUrlByName(name);
|
||||
@GetMapping("/files/path")
|
||||
public String getViewUrlByPath(@RequestParam String path) {
|
||||
return fileService.getViewUrlByPath(path);
|
||||
}
|
||||
|
||||
@GetMapping("/files/name/style")
|
||||
public String getViewUrlByNameStyle(@RequestParam Map<String, Object> params) {
|
||||
return fileService.getZipViewUrlByName(MapUtils.getString(params,"name"),MapUtils.getString(params, "style"));
|
||||
@GetMapping("/files/path/style")
|
||||
public String getViewUrlByPathStyle(@RequestParam Map<String, Object> params) {
|
||||
return fileService.getZipViewUrlByPath(MapUtils.getString(params,"path"),MapUtils.getString(params, "style"));
|
||||
}
|
||||
|
||||
@GetMapping("/type/{id}")
|
||||
@@ -119,7 +119,7 @@ public class FileController {
|
||||
FileInfo fileInfo = fileService.upload(codeId+".jpeg",getQRCode(accessToken,codeId));
|
||||
map.put("codeId", codeId);
|
||||
map.put("fileId", fileInfo.getId());
|
||||
map.put("fileName", fileInfo.getName());
|
||||
map.put("filePath", fileInfo.getPath());
|
||||
return Result.succeed(map);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ public interface IFileService extends IService<FileInfo> {
|
||||
|
||||
String getViewUrl(String id);
|
||||
|
||||
String getViewUrlByName(String name);
|
||||
String getViewUrlByPath(String name);
|
||||
|
||||
String getZipViewUrlByName(String name, String style);
|
||||
String getZipViewUrlByPath(String name, String style);
|
||||
|
||||
FileInfo getFileInfo(String id);
|
||||
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ public abstract class AbstractIFileService extends ServiceImpl<FileMapper, FileI
|
||||
return PageResult.<FileInfo>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||
}
|
||||
|
||||
public abstract String getViewUrlByName(String name);
|
||||
public abstract String getViewUrlByPath(String name);
|
||||
|
||||
@Override
|
||||
public FileInfo getFileInfo(String id) {
|
||||
|
||||
+2
-2
@@ -50,12 +50,12 @@ public class CosService extends AbstractIFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getViewUrlByName(String name) {
|
||||
public String getViewUrlByPath(String name) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getZipViewUrlByName(String name, String style) {
|
||||
public String getZipViewUrlByPath(String name, String style) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -46,12 +46,12 @@ public class FastdfsService extends AbstractIFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getViewUrlByName(String name) {
|
||||
public String getViewUrlByPath(String name) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getZipViewUrlByName(String name, String style) {
|
||||
public String getZipViewUrlByPath(String name, String style) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -74,15 +74,15 @@ public class OssService extends AbstractIFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getViewUrlByName(String name) {
|
||||
public String getViewUrlByPath(String path) {
|
||||
|
||||
return ossTemplate.getViewUrl(name);
|
||||
return ossTemplate.getViewUrl(path);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getZipViewUrlByName(String name, String style) {
|
||||
return ossTemplate.getViewUrl(name,style);
|
||||
public String getZipViewUrlByPath(String path, String style) {
|
||||
return ossTemplate.getViewUrl(path,style);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,12 +51,12 @@ public class S3Service extends AbstractIFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getViewUrlByName(String name) {
|
||||
public String getViewUrlByPath(String name) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getZipViewUrlByName(String name, String style) {
|
||||
public String getZipViewUrlByPath(String name, String style) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: file-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 119.45.169.13
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 119.45.169.13
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<select id="findList" resultType="com.central.common.model.FileInfo">
|
||||
select * from file_info t
|
||||
<include refid="where" />
|
||||
<include refid= "where" />
|
||||
order by t.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
+2
-2
@@ -147,12 +147,12 @@ public class OrderController {
|
||||
if (!list.isEmpty()){
|
||||
for (OrderFile orderFile : list){
|
||||
Map<String,String> imgMap = new HashMap<>();
|
||||
String url = fileCenterService.getViewUrlByName(orderFile.getFilePath());
|
||||
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
|
||||
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
|
||||
imgMap.put("contentType", ContentTypeUtil.getContentTypeFromUrl(url));
|
||||
|
||||
fileMap.put("name",orderFile.getFilePath());
|
||||
imgMap.put("viewUrl", fileCenterService.getViewUrlByNameStyle(fileMap));
|
||||
imgMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
resultList.add(imgMap);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -66,9 +66,9 @@ public class OrderFileController {
|
||||
fileMap.put("style", fileStyle);
|
||||
if (pageResult.getResp_code() == 0){
|
||||
for (OrderFile orderFile: pageResult.getData()){
|
||||
orderFile.setViewUrl(fileCenterService.getViewUrlByName(orderFile.getFilePath()));
|
||||
fileMap.put("name", orderFile.getFilePath());
|
||||
orderFile.setZipViewUrl(fileCenterService.getViewUrlByNameStyle(fileMap));
|
||||
orderFile.setViewUrl(fileCenterService.getViewUrlByPath(orderFile.getFilePath()));
|
||||
fileMap.put("path", orderFile.getFilePath());
|
||||
orderFile.setZipViewUrl(fileCenterService.getViewUrlByPathStyle(fileMap));
|
||||
}
|
||||
}
|
||||
return pageResult;
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ public class QrCodeController {
|
||||
PageResult<QrCode> pageResult = qrCodeService.findList(params);
|
||||
if (pageResult.getResp_code() == 0){
|
||||
for (QrCode qrCode: pageResult.getData()){
|
||||
qrCode.setViewUrl(fileCenterService.getViewUrlByName(qrCode.getPath()));
|
||||
qrCode.setViewUrl(fileCenterService.getViewUrlByPath(qrCode.getFilePath()));
|
||||
}
|
||||
}
|
||||
return pageResult;
|
||||
@@ -68,7 +68,7 @@ public class QrCodeController {
|
||||
Result<Map> result = fileCenterService.uploadQrCodeFile(codeId);
|
||||
if (result.getResp_code() == 0){
|
||||
qrCode.setCodeId(codeId);
|
||||
qrCode.setPath(result.getData().get("fileName").toString());
|
||||
qrCode.setFilePath(result.getData().get("filePath").toString());
|
||||
qrCode.setFileId(result.getData().get("fileId").toString());
|
||||
boolean res = qrCodeService.saveOrUpdate(qrCode);
|
||||
if (res) {
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.central.order.controller;
|
||||
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.order.model.TourismFile;
|
||||
import com.central.order.service.ITourismFileService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Tourism File information
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2025-2-19 17:51:47
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "TourismFile管理")
|
||||
@RequestMapping("/tourism/files")
|
||||
@RequiredArgsConstructor
|
||||
public class TourismFileController {
|
||||
|
||||
@Autowired
|
||||
private ITourismFileService tourismFileService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@Operation(summary = "查询列表")
|
||||
@Parameters({
|
||||
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
|
||||
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
||||
})
|
||||
@GetMapping
|
||||
public PageResult list(@RequestParam Map<String, Object> params) {
|
||||
return tourismFileService.findList(params);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
public Result saveOrUpdate(@RequestBody TourismFile tourismFile) {
|
||||
return tourismFileService.saveOrUpdateTourismFile(tourismFile);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询TourismFile")
|
||||
@GetMapping("/{id}")
|
||||
public Result<TourismFile> getTourismFile(@PathVariable("id") Long id) {
|
||||
TourismFile tourismFile = tourismFileService.getById(id);
|
||||
if (tourismFile == null) {
|
||||
return Result.failed("暂无数据");
|
||||
}
|
||||
return Result.succeed(tourismFile,"获取成功");
|
||||
}
|
||||
|
||||
@DeleteMapping()
|
||||
public Result delete(@RequestBody TourismFile tourismFile) {
|
||||
boolean result = tourismFileService.removeById(tourismFile.getId());
|
||||
return result ? Result.succeed(tourismFile, "操作成功") : Result.failed("操作失败");
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -38,9 +38,9 @@ public interface FileCenterService {
|
||||
@PostMapping("/path")
|
||||
FileInfo creatFileInfo(@RequestBody String path);
|
||||
|
||||
@GetMapping("/files/name")
|
||||
String getViewUrlByName(@RequestParam("name") String name) ;
|
||||
@GetMapping("/files/path")
|
||||
String getViewUrlByPath(@RequestParam("path") String path) ;
|
||||
|
||||
@GetMapping("/files/name/style")
|
||||
String getViewUrlByNameStyle(@RequestParam("params") Map<String,String> params) ;
|
||||
@GetMapping("/files/path/style")
|
||||
String getViewUrlByPathStyle(@RequestParam("params") Map<String,String> params) ;
|
||||
}
|
||||
|
||||
+2
-2
@@ -46,12 +46,12 @@ public class FileCenterServiceFallbackFactory implements FallbackFactory<FileCen
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getViewUrlByName(String name) {
|
||||
public String getViewUrlByPath(String path) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getViewUrlByNameStyle(Map<String, String> params) {
|
||||
public String getViewUrlByPathStyle(Map<String, String> params) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.central.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.central.db.mapper.SuperMapper;
|
||||
import com.central.order.model.TourismFile;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Tourism File information
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2025-2-17 17:52:54
|
||||
*/
|
||||
@Mapper
|
||||
public interface TourismFileMapper extends SuperMapper<TourismFile> {
|
||||
/**
|
||||
* 分页查询用户列表
|
||||
*
|
||||
* @param page
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<TourismFile> findList(Page<TourismFile> page, @Param("p") Map<String, Object> params);
|
||||
|
||||
// ID查询
|
||||
TourismFile getByTourismId(@Param("tourismId") Long tourismId);
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class QrCode extends SuperEntity {
|
||||
private String codeId;
|
||||
private Long tourismId;
|
||||
|
||||
private String path;
|
||||
private String filePath;
|
||||
|
||||
private transient String viewUrl;
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.central.order.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.central.common.model.SuperEntity;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Tourism File information
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2025-2-17 17:51:47
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("tourism_files")
|
||||
public class TourismFile extends SuperEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private Long tourismId;
|
||||
private String imageUrl;
|
||||
private String contentType;
|
||||
private Integer status;
|
||||
|
||||
private String linkUrl;
|
||||
private String description;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
private Long createId;
|
||||
//租户ID
|
||||
private Long tenantId;
|
||||
private String company;
|
||||
private Integer isDel;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.central.order.service;
|
||||
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.service.ISuperService;
|
||||
import com.central.order.model.TourismFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Firmware file information
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2024-12-19 17:52:54
|
||||
*/
|
||||
public interface ITourismFileService extends ISuperService<TourismFile> {
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
PageResult<TourismFile> findList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param tourismFile
|
||||
* @return
|
||||
*/
|
||||
Result saveOrUpdateTourismFile(TourismFile tourismFile) ;
|
||||
|
||||
/**
|
||||
* id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
TourismFile getByTourismId(Long id);
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.central.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.service.impl.SuperServiceImpl;
|
||||
import com.central.order.mapper.TourismFileMapper;
|
||||
import com.central.order.model.TourismFile;
|
||||
import com.central.order.service.ITourismFileService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Order information
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2024-12-19 17:52:54
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TourismFileServiceImpl extends SuperServiceImpl<TourismFileMapper, TourismFile> implements ITourismFileService {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResult<TourismFile> findList(Map<String, Object> params){
|
||||
Page<TourismFile> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||
List<TourismFile> list = baseMapper.findList(page, params);
|
||||
return PageResult.<TourismFile>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result saveOrUpdateTourismFile(TourismFile tourismFile) {
|
||||
boolean result = saveOrUpdate(tourismFile);
|
||||
return result ? Result.succeed(tourismFile, "操作成功") : Result.failed("操作失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TourismFile getByTourismId(Long id) {
|
||||
return baseMapper.getByTourismId(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,10 +4,10 @@ server:
|
||||
spring:
|
||||
application:
|
||||
name: order-center
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# ip: 81.70.164.178
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: 81.70.164.178
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.central.order.mapper.TourismFileMapper">
|
||||
|
||||
<select id="findList" resultType="com.central.order.model.TourismFile">
|
||||
select * from tourisms t
|
||||
</select>
|
||||
|
||||
<resultMap id="TourismFileResultMap" type="com.central.order.model.TourismFile">
|
||||
</resultMap>
|
||||
<select id="getByTourismId" resultMap="TourismFileResultMap">
|
||||
SELECT * FROM tourisms_files WHERE tourism_id = #{tourismId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,10 +1,10 @@
|
||||
########################## bootstrap级别通用配置 ##########################
|
||||
# 默认开发环境
|
||||
spring.profiles.active=dev
|
||||
spring.profiles.active=prod
|
||||
|
||||
##### nacos(注册中心和配置中心)地址
|
||||
#spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.username=nacos
|
||||
spring.cloud.nacos.password=nacos
|
||||
spring.cloud.nacos.config.file-extension=yml
|
||||
|
||||
@@ -50,11 +50,11 @@ const TableList: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: '文件',
|
||||
dataIndex: 'zipViewUrl',
|
||||
render: (zipViewUrl, entity) => (
|
||||
dataIndex: 'viewUrl',
|
||||
render: (viewUrl, entity) => (
|
||||
<>
|
||||
{imagePreviewTypes.includes(entity.fileType) ? (
|
||||
<Image src={zipViewUrl} width={100} />
|
||||
<Image src={viewUrl} width={100} />
|
||||
) : (
|
||||
<Link href={entity.viewUrl} target="_blank" rel="noopener noreferrer">
|
||||
下载文件
|
||||
|
||||
Reference in New Issue
Block a user