1. fix bugs
This commit is contained in:
2025-10-09 13:56:14 +08:00
parent c863907310
commit b8367d3766
2 changed files with 23 additions and 10 deletions

View File

@@ -26,9 +26,11 @@ public class OrderApiRequest implements Serializable {
private Long snapshot; private Long snapshot;
@NotEmpty(message = "photos is missing") @NotEmpty(message = "photos is missing")
private List<Long> photos = List.of(); private List<Long> photos = List.of();
private String size; @NotNull(message = "size is missing")
private String material; private Integer size;
private String shape; @NotNull(message = "material is missing")
private Integer material;
private Integer shape;
private List<Text> text = List.of(); private List<Text> text = List.of();
private List<Long> stickers = List.of(); private List<Long> stickers = List.of();
private List<Long> accessories = List.of(); private List<Long> accessories = List.of();

View File

@@ -141,9 +141,7 @@ public class KioskServiceImpl implements IKioskApiService {
public String submitOrder(OrderApiRequest request) { public String submitOrder(OrderApiRequest request) {
try { try {
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
photoAttachmentService.update(Wrappers.<PhotoAttachmentEntity>lambdaUpdate() photoAttachmentService.update(Wrappers.<PhotoAttachmentEntity>lambdaUpdate().eq(PhotoAttachmentEntity::getCreateUser, user.getUserId()).set(PhotoAttachmentEntity::getStatus, 2));
.eq(PhotoAttachmentEntity::getCreateUser, user.getUserId())
.set(PhotoAttachmentEntity::getStatus, 2));
OrderEntity order = new OrderEntity(); OrderEntity order = new OrderEntity();
order.setUserPhone(request.getPhone()); order.setUserPhone(request.getPhone());
order.setUserEmail(request.getEmail()); order.setUserEmail(request.getEmail());
@@ -157,14 +155,27 @@ public class KioskServiceImpl implements IKioskApiService {
if (category == null) { if (category == null) {
throw new ServiceException("Invalid category."); throw new ServiceException("Invalid category.");
} }
if (category.getType() == 1 && StringUtil.isBlank(item.getShape())) { if (category.getType() == 1 && item.getShape() == null) {
throw new ServiceException("Invalid shape."); throw new ServiceException("Invalid shape.");
} }
orderDetail.setCategoryId(item.getCategory()); orderDetail.setCategoryId(item.getCategory());
orderDetail.setCategoryType(category.getType()); orderDetail.setCategoryType(category.getType());
orderDetail.setMaterial(item.getMaterial()); String materialTypeValue = dictService.getValue(materialType, String.valueOf(item.getMaterial()));
orderDetail.setSize(item.getSize()); if (StringUtil.isBlank(materialTypeValue)) {
orderDetail.setShape(category.getType() == 1 ? item.getShape() : category.getShape()); throw new ServiceException("Invalid material.");
}
orderDetail.setMaterial(materialTypeValue);
String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(item.getSize()));
if (StringUtil.isBlank(sizeTypeValue)) {
throw new ServiceException("Invalid size.");
}
orderDetail.setSize(sizeTypeValue);
String shapeTypeKey = category.getType() == 1 ? String.valueOf(item.getShape()) : category.getShape();
String shapeTypeValue = dictService.getValue(shapeType, shapeTypeKey);
if (StringUtil.isBlank(shapeTypeValue)) {
throw new ServiceException("Invalid shape.");
}
orderDetail.setShape(shapeTypeValue);
PhotoAttachmentEntity snapshotPhoto = photoAttachmentService.getById(item.getSnapshot()); PhotoAttachmentEntity snapshotPhoto = photoAttachmentService.getById(item.getSnapshot());
if (snapshotPhoto == null) { if (snapshotPhoto == null) {
throw new ServiceException("Invalid snapshot."); throw new ServiceException("Invalid snapshot.");