feat:
1. order detail
This commit is contained in:
@@ -117,7 +117,8 @@ CREATE TABLE `kiosk_order_detail`
|
||||
`order_id` bigint NOT NULL COMMENT 'oid',
|
||||
`category_id` bigint NOT NULL COMMENT 'cid',
|
||||
`category_type` int NOT NULL DEFAULT 1 COMMENT '产品类型 1:单张 2:组合',
|
||||
`material` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '材质',
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
|
||||
`material` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '材质',
|
||||
`size` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '尺寸',
|
||||
`shape` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '形状',
|
||||
`snapshot_link` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '快照地址',
|
||||
|
||||
@@ -1,21 +1,30 @@
|
||||
package org.springblade.modules.kiosk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.modules.kiosk.pojo.dto.OrderApiRequest;
|
||||
import org.springblade.modules.kiosk.pojo.vo.CategoryApiVO;
|
||||
import org.springblade.modules.kiosk.pojo.vo.DictBizApiVO;
|
||||
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentApiVO;
|
||||
import org.springblade.modules.kiosk.pojo.vo.StickersApiVO;
|
||||
import org.springblade.modules.kiosk.service.IKioskApiService;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@PreAuth("hasRole('kiosk')")
|
||||
@RestController
|
||||
|
||||
@@ -25,17 +25,24 @@
|
||||
*/
|
||||
package org.springblade.modules.kiosk.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.excel.util.ExcelUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.kiosk.pojo.entity.OrderDetailEntity;
|
||||
@@ -43,6 +50,7 @@ import org.springblade.modules.kiosk.pojo.vo.OrderDetailVO;
|
||||
import org.springblade.modules.kiosk.wrapper.OrderDetailWrapper;
|
||||
import org.springblade.modules.kiosk.service.IOrderDetailService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -69,6 +77,7 @@ public class OrderDetailController extends BladeController {
|
||||
OrderDetailEntity detail = orderDetailService.getOne(Condition.getQueryWrapper(orderDetail));
|
||||
return R.data(OrderDetailWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自助终端订单表 分页
|
||||
*/
|
||||
@@ -131,5 +140,16 @@ public class OrderDetailController extends BladeController {
|
||||
return R.status(orderDetailService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@GetMapping("/export-assets")
|
||||
@Operation(summary = "导出素材", description = "传入user")
|
||||
public void exportUser(@Parameter(hidden = true) @RequestParam Map<String, Object> user, BladeUser bladeUser, HttpServletResponse response) {
|
||||
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
|
||||
if (!AuthUtil.isAdministrator()) {
|
||||
queryWrapper.lambda().eq(User::getTenantId, bladeUser.getTenantId());
|
||||
}
|
||||
queryWrapper.lambda().eq(User::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||
//todo package assets and export
|
||||
// ExcelUtil.export(response, "用户数据" + DateUtil.time(), "用户数据表", list, UserExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
<mapper namespace="org.springblade.modules.kiosk.mapper.OrderDetailMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="orderDetailResultMap" type="org.springblade.modules.kiosk.pojo.entity.OrderDetailEntity">
|
||||
<resultMap id="orderDetailResultMap" type="org.springblade.modules.kiosk.pojo.vo.OrderDetailVO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="order_id" property="orderId"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="category_type" property="categoryType"/>
|
||||
<result column="category_name" property="categoryName"/>
|
||||
<result column="material" property="material"/>
|
||||
<result column="size" property="size"/>
|
||||
<result column="shape" property="shape"/>
|
||||
@@ -24,8 +25,11 @@
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectOrderDetailPage" resultMap="orderDetailResultMap">
|
||||
<select id="selectOrderDetailPage" resultType="org.springblade.modules.kiosk.pojo.vo.OrderDetailVO">
|
||||
select * from kiosk_order_detail where is_deleted = 0
|
||||
<if test="orderDetail.orderId != null">
|
||||
and order_id = #{orderDetail.orderId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -48,4 +48,5 @@ public interface PhotoAttachmentMapper extends BaseMapper<PhotoAttachmentEntity>
|
||||
*/
|
||||
List<PhotoAttachmentVO> selectPhotoAttachmentPage(IPage page, PhotoAttachmentVO photoAttachment);
|
||||
|
||||
List<PhotoAttachmentEntity> selectPhotoAttachmentListByOrderDetailId(Long orderDetailId);
|
||||
}
|
||||
|
||||
@@ -24,4 +24,9 @@
|
||||
select * from kiosk_photo_attachment where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectPhotoAttachmentListByOrderDetailId" resultType="org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity">
|
||||
select k.*
|
||||
from kiosk_photo_attachment k inner join kiosk_order_detail_photo_attachment_r kr on k.id = kr.photo_id
|
||||
where k.is_deleted = 0 and kr.is_deleted = 0 and kr.detail_id = #{orderDetailId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -48,4 +48,6 @@ public interface StickersMapper extends BaseMapper<StickersEntity> {
|
||||
*/
|
||||
List<StickersVO> selectStickersPage(IPage page, StickersVO stickers);
|
||||
|
||||
List<StickersEntity> selectStickersListByOrderDetailId(Long orderDetailId);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,4 +24,9 @@
|
||||
select * from kiosk_stickers where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectStickersListByOrderDetailId" resultType="org.springblade.modules.kiosk.pojo.entity.StickersEntity">
|
||||
select k.*
|
||||
from kiosk_stickers k inner join kiosk_stickers_attachment_r kr on k.id = kr.stickers_id
|
||||
where k.is_deleted = 0 and kr.is_deleted = 0 and kr.detail_id = #{orderDetailId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -64,6 +64,11 @@ public class OrderDetailEntity extends TenantEntity {
|
||||
*/
|
||||
@Schema(description = "产品类型 1:单张 2:组合")
|
||||
private Integer categoryType;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
@Schema(description = "产品名称")
|
||||
private String categoryName;
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
*/
|
||||
package org.springblade.modules.kiosk.pojo.vo;
|
||||
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import org.springblade.modules.kiosk.pojo.entity.OrderDetailEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端订单表 视图实体类
|
||||
@@ -38,8 +41,40 @@ import java.io.Serial;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OrderDetailVO extends OrderDetailEntity {
|
||||
public class OrderDetailVO extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private Integer categoryType;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private String material;
|
||||
|
||||
private String size;
|
||||
|
||||
private String shape;
|
||||
|
||||
private String snapshotLink;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private List<String> photos;
|
||||
|
||||
private List<Text> texts;
|
||||
|
||||
private List<String> stickers;
|
||||
|
||||
@Data
|
||||
public static class Text {
|
||||
private Integer size;
|
||||
private String content;
|
||||
private String font;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 服务类
|
||||
*
|
||||
@@ -46,4 +48,5 @@ public interface IPhotoAttachmentService extends IService<PhotoAttachmentEntity>
|
||||
*/
|
||||
IPage<PhotoAttachmentVO> selectPhotoAttachmentPage(IPage<PhotoAttachmentVO> page, PhotoAttachmentVO photoAttachment);
|
||||
|
||||
List<PhotoAttachmentEntity> selectPhotoAttachmentListByOrderDetailId(Long orderDetailId);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.springblade.modules.kiosk.pojo.vo.StickersVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端贴纸表 服务类
|
||||
*
|
||||
@@ -46,4 +48,5 @@ public interface IStickersService extends IService<StickersEntity> {
|
||||
*/
|
||||
IPage<StickersVO> selectStickersPage(IPage<StickersVO> page, StickersVO stickers);
|
||||
|
||||
List<StickersEntity> selectStickersListByOrderDetailId(Long orderDetailId);
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
}
|
||||
orderDetail.setCategoryId(item.getCategory());
|
||||
orderDetail.setCategoryType(category.getType());
|
||||
orderDetail.setCategoryName(category.getName());
|
||||
String materialTypeValue = dictService.getValue(materialType, String.valueOf(item.getMaterial()));
|
||||
if (StringUtil.isBlank(materialTypeValue)) {
|
||||
throw new ServiceException("Invalid material.");
|
||||
|
||||
@@ -25,14 +25,18 @@
|
||||
*/
|
||||
package org.springblade.modules.kiosk.service.impl;
|
||||
|
||||
import org.springblade.modules.kiosk.pojo.entity.OrderDetailEntity;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.modules.kiosk.pojo.entity.*;
|
||||
import org.springblade.modules.kiosk.pojo.vo.OrderDetailVO;
|
||||
import org.springblade.modules.kiosk.mapper.OrderDetailMapper;
|
||||
import org.springblade.modules.kiosk.service.IOrderDetailService;
|
||||
import org.springblade.modules.kiosk.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端订单表 服务实现类
|
||||
*
|
||||
@@ -40,11 +44,37 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
* @since 2025-10-08
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class OrderDetailServiceImpl extends BaseServiceImpl<OrderDetailMapper, OrderDetailEntity> implements IOrderDetailService {
|
||||
|
||||
private final IPhotoAttachmentService photoAttachmentService;
|
||||
|
||||
private final IStickersService stickersService;
|
||||
|
||||
private final ITextAttachmentRService textAttachmentRService;
|
||||
|
||||
@Override
|
||||
public IPage<OrderDetailVO> selectOrderDetailPage(IPage<OrderDetailVO> page, OrderDetailVO orderDetail) {
|
||||
return page.setRecords(baseMapper.selectOrderDetailPage(page, orderDetail));
|
||||
List<OrderDetailVO> vos = baseMapper.selectOrderDetailPage(page, orderDetail);
|
||||
|
||||
vos.forEach(vo -> {
|
||||
List<PhotoAttachmentEntity> photoList = photoAttachmentService.selectPhotoAttachmentListByOrderDetailId(vo.getId());
|
||||
vo.setPhotos(photoList.stream().map(PhotoAttachmentEntity::getLink).toList());
|
||||
|
||||
List<StickersEntity> stickersList = stickersService.selectStickersListByOrderDetailId(vo.getId());
|
||||
vo.setStickers(stickersList.stream().map(StickersEntity::getLink).toList());
|
||||
|
||||
List<TextAttachmentREntity> tList = textAttachmentRService.list(Wrappers.<TextAttachmentREntity>lambdaQuery().eq(TextAttachmentREntity::getDetailId, vo.getId()));
|
||||
vo.setTexts(tList.stream().map(t -> {
|
||||
OrderDetailVO.Text tt = new OrderDetailVO.Text();
|
||||
tt.setContent(t.getTextContent());
|
||||
tt.setSize(t.getFontSize());
|
||||
tt.setFont(t.getFontName());
|
||||
return tt;
|
||||
}).toList());
|
||||
});
|
||||
|
||||
return page.setRecords(vos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.springblade.modules.kiosk.service.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.modules.kiosk.pojo.entity.PhotoAttachmentEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.PhotoAttachmentVO;
|
||||
import org.springblade.modules.kiosk.mapper.PhotoAttachmentMapper;
|
||||
@@ -33,6 +34,8 @@ import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端照片表 服务实现类
|
||||
*
|
||||
@@ -40,11 +43,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
* @since 2025-10-07
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
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));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PhotoAttachmentEntity> selectPhotoAttachmentListByOrderDetailId(Long orderDetailId) {
|
||||
return baseMapper.selectPhotoAttachmentListByOrderDetailId(orderDetailId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.springblade.modules.kiosk.service.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.modules.kiosk.pojo.entity.StickersEntity;
|
||||
import org.springblade.modules.kiosk.pojo.vo.StickersVO;
|
||||
import org.springblade.modules.kiosk.mapper.StickersMapper;
|
||||
@@ -33,6 +34,8 @@ import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自助终端贴纸表 服务实现类
|
||||
*
|
||||
@@ -40,6 +43,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
* @since 2025-10-08
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class StickersServiceImpl extends ServiceImpl<StickersMapper, StickersEntity> implements IStickersService {
|
||||
|
||||
@Override
|
||||
@@ -47,4 +51,9 @@ public class StickersServiceImpl extends ServiceImpl<StickersMapper, StickersEnt
|
||||
return page.setRecords(baseMapper.selectStickersPage(page, stickers));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StickersEntity> selectStickersListByOrderDetailId(Long orderDetailId) {
|
||||
return baseMapper.selectStickersListByOrderDetailId(orderDetailId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user