1. fix for new design
This commit is contained in:
2026-03-15 22:47:54 +08:00
parent d66a3c762f
commit baadf552f6
2 changed files with 11 additions and 14 deletions

View File

@@ -9,8 +9,6 @@ public class RefillApiRequest implements Serializable {
private Long id; private Long id;
private String phone; private String content;
private String email;
} }

View File

@@ -199,6 +199,7 @@ public class KioskServiceImpl implements IKioskApiService {
throw new ServiceException("Invalid price."); throw new ServiceException("Invalid price.");
} }
detailAmount = detailAmount.add(priceList.getActualPrice()); detailAmount = detailAmount.add(priceList.getActualPrice());
orderDetail.setPriceListId(item.getPriceList());
orderDetail.setQuantity(item.getQuantity()); orderDetail.setQuantity(item.getQuantity());
orderDetail.setTag(priceList.getTag()); orderDetail.setTag(priceList.getTag());
@@ -416,9 +417,7 @@ public class KioskServiceImpl implements IKioskApiService {
@Override @Override
public boolean refillOrder(RefillApiRequest request) { public boolean refillOrder(RefillApiRequest request) {
if (StringUtil.isBlank(request.getEmail()) && StringUtil.isBlank(request.getPhone())) {
throw new ServiceException("Invalid parameters.");
}
OrderEntity order = orderService.getById(request.getId()); OrderEntity order = orderService.getById(request.getId());
if (order == null) { if (order == null) {
throw new ServiceException("Invalid order."); throw new ServiceException("Invalid order.");
@@ -426,14 +425,14 @@ public class KioskServiceImpl implements IKioskApiService {
if (order.getStatus() != 1) { if (order.getStatus() != 1) {
throw new ServiceException("Invalid order status."); throw new ServiceException("Invalid order status.");
} }
if (StringUtil.isNotBlank(request.getEmail()) && StringUtil.isNotBlank(order.getUserEmail())) {
throw new ServiceException("Email already exists."); boolean match = RegexUtil.match(request.getContent(), RegexUtil.EMAIL);
} if (StringUtil.isBlank(request.getContent())) {
boolean match = RegexUtil.match(request.getEmail(), RegexUtil.EMAIL); if (match) {
if (match) { order.setUserEmail(request.getContent());
order.setUserEmail(request.getEmail()); } else if (request.getContent().chars().allMatch(Character::isDigit)) {
} else { order.setUserPhone(request.getContent());
order.setUserPhone(request.getPhone()); }
} }
// if (StringUtil.isNotBlank(request.getEmail())) { // if (StringUtil.isNotBlank(request.getEmail())) {