photo
This commit is contained in:
@@ -32,27 +32,18 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.IsAdmin;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
|
||||
import org.springblade.modules.kiosk.excel.CategoryExcel;
|
||||
import org.springblade.modules.kiosk.wrapper.CategoryWrapper;
|
||||
import org.springblade.modules.kiosk.service.ICategoryService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 自助终端产品目录表 控制器
|
||||
|
||||
@@ -3,12 +3,12 @@ package org.springblade.modules.kiosk.controller;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO;
|
||||
import org.springblade.modules.kiosk.service.IKioskApiService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,14 +20,42 @@ public class KioskApiController {
|
||||
private final IKioskApiService kioskApiService;
|
||||
|
||||
/**
|
||||
* api产品目录查询
|
||||
* 产品目录查询
|
||||
*
|
||||
* @return List<CategoryApiVO>
|
||||
*/
|
||||
@GetMapping("/category-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "产品目录")
|
||||
public R<List<CategoryApiVO>> categoryList() {
|
||||
List<CategoryApiVO> list = kioskApiService.categoryList();
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成上传地址
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@GetMapping("/generate-upload-url")
|
||||
@Operation(summary = "生成上传地址")
|
||||
public R<String> generateUploadUrl() {
|
||||
String url = kioskApiService.generateUploadUrl();
|
||||
return R.data(url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param code code
|
||||
* @param file file
|
||||
* @return Boolean
|
||||
*/
|
||||
@SneakyThrows
|
||||
@PostMapping("/upload")
|
||||
public R<Boolean> upload(@RequestParam String code, @RequestParam MultipartFile file) {
|
||||
Boolean result = kioskApiService.uploadByCode(code, file.getOriginalFilename(), file.getInputStream());
|
||||
return R.data(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.excel;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
|
||||
/**
|
||||
* 自助终端产品目录表 Excel实体类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-06
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(25)
|
||||
@HeadRowHeight(20)
|
||||
@ContentRowHeight(18)
|
||||
public class CategoryExcel implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("租户ID")
|
||||
private String tenantId;
|
||||
/**
|
||||
* 类型 1:单张,2:组合 3:配件
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("类型 1:单张,2:组合 3:配件")
|
||||
private Integer type;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("产品名称")
|
||||
private String name;
|
||||
/**
|
||||
* 目录图片地址
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("目录图片地址")
|
||||
private String imageUrl;
|
||||
/**
|
||||
* 照片数量
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("照片数量")
|
||||
private Integer photoLimit;
|
||||
/**
|
||||
* 形状
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("形状")
|
||||
private String shape;
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty("是否已删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
@@ -27,11 +27,8 @@ package org.springblade.modules.kiosk.mapper;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
|
||||
import org.springblade.modules.kiosk.excel.CategoryExcel;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.mapper;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 Mapper 接口
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
public interface PhotoAttachmentMapper extends BaseMapper<PhotoAttachmentEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param photoAttachment 查询参数
|
||||
* @return List<PhotoAttachmentVO>
|
||||
*/
|
||||
List<PhotoAttachmentVO> selectPhotoAttachmentPage(IPage page, PhotoAttachmentVO photoAttachment);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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="org.springblade.modules.kiosk.mapper.PhotoAttachmentMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="photoAttachmentResultMap" type="org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="link" property="link"/>
|
||||
<result column="domain_url" property="domainUrl"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="original_name" property="originalName"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectPhotoAttachmentPage" resultMap="photoAttachmentResultMap">
|
||||
select * from kiosk_photo_attachment where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.pojo.dto;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 数据传输对象实体类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PhotoAttachmentDTO extends PhotoAttachmentEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 实体类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
@Data
|
||||
@TableName("kiosk_photo_attachment")
|
||||
@Schema(description = "PhotoAttachment对象")
|
||||
public class PhotoAttachmentEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Schema(description = "主键")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private String tenantId;
|
||||
/**
|
||||
* 照片地址
|
||||
*/
|
||||
@Schema(description = "照片地址")
|
||||
private String link;
|
||||
/**
|
||||
* 照片域名
|
||||
*/
|
||||
@Schema(description = "照片域名")
|
||||
private String domainUrl;
|
||||
/**
|
||||
* 照片名称
|
||||
*/
|
||||
@Schema(description = "照片名称")
|
||||
private String name;
|
||||
/**
|
||||
* 照片原名
|
||||
*/
|
||||
@Schema(description = "照片原名")
|
||||
private String originalName;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private Long createUser;
|
||||
/**
|
||||
* 创建部门
|
||||
*/
|
||||
@Schema(description = "创建部门")
|
||||
private Long createDept;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Schema(description = "修改人")
|
||||
private Long updateUser;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 状态 1:用户可见,2:后台可见
|
||||
*/
|
||||
@Schema(description = "状态 1:用户可见,2:后台可见")
|
||||
private Integer status;
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
@Schema(description = "是否已删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.pojo.vo;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 视图实体类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PhotoAttachmentVO extends PhotoAttachmentEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -25,13 +25,10 @@
|
||||
*/
|
||||
package org.springblade.modules.kiosk.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
|
||||
import org.springblade.modules.kiosk.excel.CategoryExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端产品目录表 服务类
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.springblade.modules.kiosk.service;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public interface IKioskApiService {
|
||||
@@ -9,4 +10,8 @@ public interface IKioskApiService {
|
||||
|
||||
List<CategoryApiVO> categoryList();
|
||||
|
||||
Boolean uploadByCode(String code, String fileName, InputStream stream);
|
||||
|
||||
String generateUploadUrl();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.service;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 服务类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
public interface IPhotoAttachmentService extends IService<PhotoAttachmentEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param photoAttachment 查询参数
|
||||
* @return IPage<PhotoAttachmentVO>
|
||||
*/
|
||||
IPage<PhotoAttachmentVO> selectPhotoAttachmentPage(IPage<PhotoAttachmentVO> page, PhotoAttachmentVO photoAttachment);
|
||||
|
||||
}
|
||||
@@ -27,14 +27,11 @@ package org.springblade.modules.kiosk.service.impl;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.CategoryEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryVO;
|
||||
import org.springblade.modules.kiosk.excel.CategoryExcel;
|
||||
import org.springblade.modules.kiosk.mapper.CategoryMapper;
|
||||
import org.springblade.modules.kiosk.service.ICategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端产品目录表 服务实现类
|
||||
|
||||
@@ -1,17 +1,77 @@
|
||||
package org.springblade.modules.kiosk.service.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.file.BladeFileUtil;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.oss.model.BladeFile;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.core.tool.utils.WebUtil;
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO;
|
||||
import org.springblade.modules.kiosk.service.IKioskApiService;
|
||||
import org.springblade.modules.kiosk.service.IPhotoAttachmentService;
|
||||
import org.springblade.modules.resource.builder.OssBuilder;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class KioskServiceImpl implements IKioskApiService {
|
||||
|
||||
private final OssBuilder ossBuilder;
|
||||
|
||||
private final BladeRedis redis;
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
private final IPhotoAttachmentService photoAttachmentService;
|
||||
|
||||
@Override
|
||||
public List<CategoryApiVO> categoryList() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean uploadByCode(String code, String fileName, InputStream stream) {
|
||||
|
||||
String tenantId = WebUtil.getHeader("Tenant-Id");
|
||||
if (StringUtil.isBlank(tenantId)) {
|
||||
throw new ServiceException("Invalid tenantId.");
|
||||
}
|
||||
|
||||
if (!redis.exists(code) && redis.ttl(code) < 1) {
|
||||
throw new ServiceException("Invalid code.");
|
||||
}
|
||||
|
||||
String account = redis.get(code);
|
||||
|
||||
User user = userService.userByAccount(tenantId, account);
|
||||
|
||||
BladeFile bladeFile = ossBuilder.template(tenantId).putFile(fileName, stream);
|
||||
|
||||
PhotoAttachmentEntity photoAttachmentEntity = new PhotoAttachmentEntity();
|
||||
photoAttachmentEntity.setTenantId(tenantId);
|
||||
photoAttachmentEntity.setLink(bladeFile.getLink());
|
||||
photoAttachmentEntity.setDomainUrl(bladeFile.getDomain());
|
||||
photoAttachmentEntity.setName(bladeFile.getName());
|
||||
photoAttachmentEntity.setOriginalName(bladeFile.getOriginalName());
|
||||
photoAttachmentEntity.setCreateUser(user.getId());
|
||||
photoAttachmentEntity.setCreateDept(Long.valueOf(user.getDeptId()));
|
||||
photoAttachmentEntity.setCreateTime(DateUtil.now());
|
||||
|
||||
return photoAttachmentService.save(photoAttachmentEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateUploadUrl() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.service.impl;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentVO;
|
||||
import org.springblade.modules.kiosk.mapper.PhotoAttachmentMapper;
|
||||
import org.springblade.modules.kiosk.service.IPhotoAttachmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 服务实现类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
@Service
|
||||
public class PhotoAttachmentServiceImpl extends ServiceImpl<PhotoAttachmentMapper, PhotoAttachmentEntity> implements IPhotoAttachmentService {
|
||||
|
||||
@Override
|
||||
public IPage<PhotoAttachmentVO> selectPhotoAttachmentPage(IPage<PhotoAttachmentVO> page, PhotoAttachmentVO photoAttachment) {
|
||||
return page.setRecords(baseMapper.selectPhotoAttachmentPage(page, photoAttachment));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.kiosk.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
public class PhotoAttachmentWrapper extends BaseEntityWrapper<PhotoAttachmentEntity, PhotoAttachmentVO> {
|
||||
|
||||
public static PhotoAttachmentWrapper build() {
|
||||
return new PhotoAttachmentWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhotoAttachmentVO entityVO(PhotoAttachmentEntity photoAttachment) {
|
||||
PhotoAttachmentVO photoAttachmentVO = Objects.requireNonNull(BeanUtil.copyProperties(photoAttachment, PhotoAttachmentVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(photoAttachment.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(photoAttachment.getUpdateUser());
|
||||
//photoAttachmentVO.setCreateUserName(createUser.getName());
|
||||
//photoAttachmentVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return photoAttachmentVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user