fix:
1. fix bugs
This commit is contained in:
@@ -26,9 +26,11 @@ public class OrderApiRequest implements Serializable {
|
||||
private Long snapshot;
|
||||
@NotEmpty(message = "photos is missing")
|
||||
private List<Long> photos = List.of();
|
||||
private String size;
|
||||
private String material;
|
||||
private String shape;
|
||||
@NotNull(message = "size is missing")
|
||||
private Integer size;
|
||||
@NotNull(message = "material is missing")
|
||||
private Integer material;
|
||||
private Integer shape;
|
||||
private List<Text> text = List.of();
|
||||
private List<Long> stickers = List.of();
|
||||
private List<Long> accessories = List.of();
|
||||
|
||||
@@ -141,9 +141,7 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
public String submitOrder(OrderApiRequest request) {
|
||||
try {
|
||||
BladeUser user = AuthUtil.getUser();
|
||||
photoAttachmentService.update(Wrappers.<PhotoAttachmentEntity>lambdaUpdate()
|
||||
.eq(PhotoAttachmentEntity::getCreateUser, user.getUserId())
|
||||
.set(PhotoAttachmentEntity::getStatus, 2));
|
||||
photoAttachmentService.update(Wrappers.<PhotoAttachmentEntity>lambdaUpdate().eq(PhotoAttachmentEntity::getCreateUser, user.getUserId()).set(PhotoAttachmentEntity::getStatus, 2));
|
||||
OrderEntity order = new OrderEntity();
|
||||
order.setUserPhone(request.getPhone());
|
||||
order.setUserEmail(request.getEmail());
|
||||
@@ -157,14 +155,27 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
if (category == null) {
|
||||
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.");
|
||||
}
|
||||
orderDetail.setCategoryId(item.getCategory());
|
||||
orderDetail.setCategoryType(category.getType());
|
||||
orderDetail.setMaterial(item.getMaterial());
|
||||
orderDetail.setSize(item.getSize());
|
||||
orderDetail.setShape(category.getType() == 1 ? item.getShape() : category.getShape());
|
||||
String materialTypeValue = dictService.getValue(materialType, String.valueOf(item.getMaterial()));
|
||||
if (StringUtil.isBlank(materialTypeValue)) {
|
||||
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());
|
||||
if (snapshotPhoto == null) {
|
||||
throw new ServiceException("Invalid snapshot.");
|
||||
|
||||
Reference in New Issue
Block a user