优化店务预约作品快照与图片维护
This commit is contained in:
+19
@@ -17,6 +17,7 @@ import com.xiaowang.jayucloud.core.modules.artist.vo.ArtistScheduleVO;
|
||||
import com.xiaowang.jayucloud.core.modules.manager.dto.ManagerCustomerCreateDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.manager.dto.ManagerCustomerUpdateDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentImageDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentUpdateDTO;
|
||||
@@ -112,9 +113,20 @@ public class AdminManagerController {
|
||||
@PathVariable Long orderItemId,
|
||||
@RequestBody PlanningAppointmentMoveDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
requireManagerOperator(currentUser);
|
||||
return Result.success(planningService.moveAppointment(currentUser, orderItemId, dto));
|
||||
}
|
||||
|
||||
@PutMapping("/planning/appointments/{orderItemId}/images")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "manager-planning-update-appointment-images", ttlSeconds = 10, message = "预约图片保存处理中,请勿重复提交")
|
||||
public Result<PlanningAppointmentVO> updateAppointmentImages(HttpServletRequest request,
|
||||
@PathVariable Long orderItemId,
|
||||
@RequestBody PlanningAppointmentImageDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.updateAppointmentImages(currentUser, orderItemId, dto));
|
||||
}
|
||||
|
||||
@PutMapping("/planning/appointments/{orderId}/status")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "manager-planning-update-appointment-status", ttlSeconds = 10, message = "预约状态处理中,请勿重复提交")
|
||||
@@ -432,6 +444,13 @@ public class AdminManagerController {
|
||||
}
|
||||
}
|
||||
|
||||
private void requireManagerOperator(UserDO currentUser) {
|
||||
if (Integer.valueOf(2).equals(currentUser.getType())) {
|
||||
return;
|
||||
}
|
||||
throw new RuntimeException("只有店长可以改派预约");
|
||||
}
|
||||
|
||||
private boolean hasEmployeeUserBasicChanges(NailArtistInfoDTO dto) {
|
||||
return dto.getNickname() != null
|
||||
|| dto.getAvatar() != null
|
||||
|
||||
+5
@@ -37,6 +37,11 @@ public class OrderItemDO extends BaseEntity {
|
||||
private Boolean depositPaid;
|
||||
private Boolean needRemoval;
|
||||
private Boolean fromMeituan;
|
||||
private String appointmentProductTitle;
|
||||
private String appointmentProductDescription;
|
||||
private String appointmentProductTags;
|
||||
private String appointmentProductPrecautions;
|
||||
private String appointmentProductImageFileIds;
|
||||
/**
|
||||
* Field `artistId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||
*/
|
||||
|
||||
+8
@@ -79,6 +79,7 @@ public class AdminPlanningController {
|
||||
@PathVariable Long orderItemId,
|
||||
@RequestBody PlanningAppointmentMoveDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
requireManagerOperator(currentUser);
|
||||
return Result.success(planningService.moveAppointment(currentUser, orderItemId, dto));
|
||||
}
|
||||
|
||||
@@ -91,4 +92,11 @@ public class AdminPlanningController {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.updateStatus(currentUser, orderId, dto));
|
||||
}
|
||||
|
||||
private void requireManagerOperator(UserDO currentUser) {
|
||||
if (Integer.valueOf(2).equals(currentUser.getType())) {
|
||||
return;
|
||||
}
|
||||
throw new RuntimeException("只有店长可以改派预约");
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.xiaowang.jayucloud.core.modules.planning.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PlanningAppointmentImageDTO {
|
||||
private String imageFileIds;
|
||||
}
|
||||
+3
@@ -1,6 +1,7 @@
|
||||
package com.xiaowang.jayucloud.core.modules.planning.service;
|
||||
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentImageDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentUpdateDTO;
|
||||
@@ -21,5 +22,7 @@ public interface PlanningService {
|
||||
|
||||
PlanningAppointmentVO moveAppointment(UserDO currentUser, Long orderItemId, PlanningAppointmentMoveDTO dto);
|
||||
|
||||
PlanningAppointmentVO updateAppointmentImages(UserDO currentUser, Long orderItemId, PlanningAppointmentImageDTO dto);
|
||||
|
||||
Boolean updateStatus(UserDO currentUser, Long orderId, PlanningAppointmentStatusDTO dto);
|
||||
}
|
||||
|
||||
+149
-33
@@ -2,6 +2,7 @@ package com.xiaowang.jayucloud.core.modules.planning.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentImageDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.dto.PlanningAppointmentUpdateDTO;
|
||||
@@ -10,6 +11,9 @@ import com.xiaowang.jayucloud.core.modules.artist.entity.ArtistScheduleException
|
||||
import com.xiaowang.jayucloud.core.modules.artist.entity.ArtistScheduleDO;
|
||||
import com.xiaowang.jayucloud.core.modules.artist.entity.ArtistScheduleRuleDO;
|
||||
import com.xiaowang.jayucloud.core.modules.artist.entity.NailArtistInfoDO;
|
||||
import com.xiaowang.jayucloud.core.modules.file.service.ObjectStorageFileService;
|
||||
import com.xiaowang.jayucloud.core.modules.file.support.ObjectStorageUrlSupport;
|
||||
import com.xiaowang.jayucloud.core.modules.file.vo.ObjectStorageFileVO;
|
||||
import com.xiaowang.jayucloud.core.modules.order.entity.OrderDO;
|
||||
import com.xiaowang.jayucloud.core.modules.order.entity.OrderItemDO;
|
||||
import com.xiaowang.jayucloud.core.modules.product.entity.ProductDO;
|
||||
@@ -57,6 +61,7 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -75,7 +80,6 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
private static final int MONTH_AVAILABLE_MINUTES = 90;
|
||||
private static final String RESERVATION_PENDING_QUOTE = "PENDING_QUOTE";
|
||||
private static final String RESERVATION_CONFIRMED = "CONFIRMED";
|
||||
private static final String PRODUCT_SOURCE_TYPE_MANAGER_APPOINTMENT = "MANAGER_APPOINTMENT";
|
||||
private static final String ENCODED_UNSET_PASSWORD = "$2a$10$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW";
|
||||
private static final List<String> ACTIVE_RESERVATION_STATUS = List.of("LOCKED", RESERVATION_PENDING_QUOTE, RESERVATION_CONFIRMED);
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -93,6 +97,8 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
private final OrderMapper orderMapper;
|
||||
private final OrderItemMapper orderItemMapper;
|
||||
private final ProductMapper productMapper;
|
||||
private final ObjectStorageFileService objectStorageFileService;
|
||||
private final ObjectStorageUrlSupport objectStorageUrlSupport;
|
||||
private final ShopMapper shopMapper;
|
||||
private final ShopScheduleExceptionMapper shopScheduleExceptionMapper;
|
||||
private final AppointmentCapacityService appointmentCapacityService;
|
||||
@@ -192,7 +198,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
|
||||
OrderItemDO item = new OrderItemDO();
|
||||
item.setOrderId(order.getId());
|
||||
item.setProductId(product.getId());
|
||||
item.setProductId(product == null ? null : product.getId());
|
||||
item.setQuantity(quantity);
|
||||
item.setPrice(unitPrice);
|
||||
item.setArtistId(artist.getId());
|
||||
@@ -200,6 +206,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
item.setDepositPaid(Boolean.TRUE.equals(dto.getDepositPaid()));
|
||||
item.setNeedRemoval(Boolean.TRUE.equals(dto.getNeedRemoval()));
|
||||
item.setFromMeituan(Boolean.TRUE.equals(dto.getFromMeituan()));
|
||||
applyAppointmentProductSnapshot(item, product, dto);
|
||||
item.setIsDelete(0);
|
||||
orderItemMapper.insert(item);
|
||||
|
||||
@@ -208,7 +215,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
item.getId(),
|
||||
shopId,
|
||||
artist.getId(),
|
||||
product.getTitle(),
|
||||
resolveAppointmentProductTitle(product, dto),
|
||||
startTime,
|
||||
endTime,
|
||||
trimToNull(dto.getClientRequestId())
|
||||
@@ -260,7 +267,9 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
LocalDateTime endTime = startTime.plusMinutes(durationMinutes);
|
||||
ensureWithinBusinessHours(order.getShopId(), startTime, endTime);
|
||||
|
||||
BigDecimal unitPrice = product.getPrice() == null ? BigDecimal.ZERO : product.getPrice();
|
||||
BigDecimal unitPrice = product == null
|
||||
? resolveAppointmentUnitPrice(null, dto)
|
||||
: product.getPrice() == null ? BigDecimal.ZERO : product.getPrice();
|
||||
BigDecimal amount = unitPrice.multiply(BigDecimal.valueOf(quantity));
|
||||
|
||||
appointmentCapacityService.moveReservationForArtistChange(
|
||||
@@ -269,7 +278,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
order.getShopId(),
|
||||
item.getArtistId(),
|
||||
artist.getId(),
|
||||
product.getTitle(),
|
||||
resolveAppointmentProductTitle(product, dto),
|
||||
startTime,
|
||||
endTime
|
||||
);
|
||||
@@ -282,11 +291,12 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
order.setPayAmount(amount);
|
||||
orderMapper.updateById(order);
|
||||
|
||||
item.setProductId(product.getId());
|
||||
item.setProductId(product == null ? null : product.getId());
|
||||
item.setQuantity(quantity);
|
||||
item.setPrice(unitPrice);
|
||||
item.setArtistId(artist.getId());
|
||||
item.setAppointmentTime(startTime);
|
||||
applyAppointmentProductSnapshot(item, product, dto);
|
||||
if (dto.getDepositPaid() != null) {
|
||||
item.setDepositPaid(dto.getDepositPaid());
|
||||
}
|
||||
@@ -312,7 +322,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
}
|
||||
OrderDO order = requireAccessibleOrder(currentUser, item.getOrderId());
|
||||
requireEditableAppointment(order);
|
||||
ProductDO product = requireActiveProduct(item.getProductId(), order.getShopId());
|
||||
ProductDO product = item.getProductId() == null ? null : requireActiveProduct(item.getProductId(), order.getShopId());
|
||||
Long targetArtistId = dto.getArtistId() == null ? item.getArtistId() : dto.getArtistId();
|
||||
UserDO artist = requireActiveArtist(targetArtistId, order.getShopId());
|
||||
int durationMinutes = resolveDurationMinutes(product, dto.getDurationMinutes()) *
|
||||
@@ -332,7 +342,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
order.getShopId(),
|
||||
item.getArtistId(),
|
||||
artist.getId(),
|
||||
product.getTitle(),
|
||||
resolveAppointmentDisplayTitle(null, item, product),
|
||||
startTime,
|
||||
endTime
|
||||
);
|
||||
@@ -343,6 +353,23 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
return getAppointment(currentUser, item.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PlanningAppointmentVO updateAppointmentImages(UserDO currentUser, Long orderItemId, PlanningAppointmentImageDTO dto) {
|
||||
if (orderItemId == null || dto == null) {
|
||||
throw new RuntimeException("预约图片信息不能为空");
|
||||
}
|
||||
OrderItemDO item = orderItemMapper.selectByIdForUpdate(orderItemId);
|
||||
if (item == null || Integer.valueOf(1).equals(item.getIsDelete())) {
|
||||
throw new RuntimeException("预约不存在");
|
||||
}
|
||||
OrderDO order = requireAccessibleOrder(currentUser, item.getOrderId());
|
||||
requireEditableAppointment(order);
|
||||
item.setAppointmentProductImageFileIds(trimToNull(dto.getImageFileIds()));
|
||||
orderItemMapper.updateById(item);
|
||||
return getAppointment(currentUser, item.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateStatus(UserDO currentUser, Long orderId, PlanningAppointmentStatusDTO dto) {
|
||||
@@ -670,9 +697,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
vo.setCustomerName(resolveAppointmentCustomerName(order, customer));
|
||||
vo.setCustomerPhone(customer == null ? null : firstNonBlank(customer.getContactPhone(), customer.getPhone(), ""));
|
||||
vo.setProductId(product == null ? item == null ? null : item.getProductId() : product.getId());
|
||||
vo.setProductTitle(reservation != null && hasText(reservation.getProductTitle())
|
||||
? reservation.getProductTitle()
|
||||
: product == null ? "预约作品" : product.getTitle());
|
||||
vo.setProductTitle(resolveAppointmentDisplayTitle(reservation, item, product));
|
||||
vo.setArtistId(artistId);
|
||||
vo.setArtistName(artist == null ? "未分配" : artist.getName());
|
||||
vo.setArtistColor(artist == null ? ARTIST_COLORS.get(0) : artist.getColor());
|
||||
@@ -693,6 +718,11 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
vo.setConflictReason(resolveAppointmentConflictReason(occupancyStatus));
|
||||
vo.setAmount(order == null ? null : order.getActualAmount());
|
||||
vo.setRemark(order == null ? null : order.getCustomerRemark());
|
||||
vo.setProductDescription(resolveAppointmentProductDescription(item, product));
|
||||
vo.setProductTags(resolveAppointmentProductTags(item, product));
|
||||
vo.setProductPrecautions(resolveAppointmentProductPrecautions(item, product));
|
||||
vo.setProductImageFileIds(resolveAppointmentProductImageFileIds(item, product));
|
||||
vo.setProductImageUrls(resolveImageUrls(parseLongTokens(vo.getProductImageFileIds())));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -857,10 +887,11 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
if (dto.getProductId() != null) {
|
||||
return requireActiveProduct(dto.getProductId(), shopId);
|
||||
}
|
||||
return createManualAppointmentProduct(dto, shopId);
|
||||
requireManualAppointmentProduct(dto);
|
||||
return null;
|
||||
}
|
||||
|
||||
private ProductDO createManualAppointmentProduct(PlanningAppointmentCreateDTO dto, Long shopId) {
|
||||
private void requireManualAppointmentProduct(PlanningAppointmentCreateDTO dto) {
|
||||
String title = trimToNull(dto.getManualProductTitle());
|
||||
if (!hasText(title)) {
|
||||
throw new RuntimeException("请选择预约作品或填写手动作品名称");
|
||||
@@ -869,30 +900,11 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
if (price == null || price.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new RuntimeException("手动作品价格不能小于0");
|
||||
}
|
||||
int durationMinutes = requireAppointmentDuration(dto.getDurationMinutes());
|
||||
ProductDO product = new ProductDO();
|
||||
product.setShopId(shopId);
|
||||
product.setTitle(title);
|
||||
product.setDescription(trimToNull(dto.getManualProductDescription()));
|
||||
product.setTags(trimToNull(dto.getManualProductTags()));
|
||||
product.setTargetAudience(trimToNull(dto.getManualProductTargetAudience()));
|
||||
product.setPrecautions(trimToNull(dto.getManualProductPrecautions()));
|
||||
product.setImageFileIds(trimToNull(dto.getManualProductImageFileIds()));
|
||||
product.setPrice(price);
|
||||
product.setLikeCount(0);
|
||||
product.setCollectCount(0);
|
||||
product.setApproximateDuration(durationMinutes + "分钟");
|
||||
product.setBookableArtists(dto.getArtistId() == null ? null : String.valueOf(dto.getArtistId()));
|
||||
product.setFrontVisible(0);
|
||||
product.setSourceType(PRODUCT_SOURCE_TYPE_MANAGER_APPOINTMENT);
|
||||
product.setIsDelete(0);
|
||||
productMapper.insert(product);
|
||||
return product;
|
||||
}
|
||||
|
||||
private BigDecimal resolveAppointmentUnitPrice(ProductDO product, PlanningAppointmentCreateDTO dto) {
|
||||
if (dto.getManualProductPrice() == null) {
|
||||
return product.getPrice() == null ? BigDecimal.ZERO : product.getPrice();
|
||||
return product == null || product.getPrice() == null ? BigDecimal.ZERO : product.getPrice();
|
||||
}
|
||||
if (dto.getManualProductPrice().compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new RuntimeException("本次价格不能小于0");
|
||||
@@ -900,6 +912,30 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
return dto.getManualProductPrice();
|
||||
}
|
||||
|
||||
private void applyAppointmentProductSnapshot(OrderItemDO item, ProductDO product, PlanningAppointmentCreateDTO dto) {
|
||||
item.setAppointmentProductTitle(resolveAppointmentProductTitle(product, dto));
|
||||
item.setAppointmentProductDescription(product == null
|
||||
? trimToNull(dto.getManualProductDescription())
|
||||
: trimToNull(product.getDescription()));
|
||||
item.setAppointmentProductTags(product == null
|
||||
? trimToNull(dto.getManualProductTags())
|
||||
: trimToNull(product.getTags()));
|
||||
item.setAppointmentProductPrecautions(product == null
|
||||
? trimToNull(dto.getManualProductPrecautions())
|
||||
: trimToNull(product.getPrecautions()));
|
||||
item.setAppointmentProductImageFileIds(product == null
|
||||
? trimToNull(dto.getManualProductImageFileIds())
|
||||
: trimToNull(product.getImageFileIds()));
|
||||
}
|
||||
|
||||
private String resolveAppointmentProductTitle(ProductDO product, PlanningAppointmentCreateDTO dto) {
|
||||
return firstNonBlank(
|
||||
dto == null ? null : dto.getManualProductTitle(),
|
||||
product == null ? null : product.getTitle(),
|
||||
"预约作品"
|
||||
);
|
||||
}
|
||||
|
||||
private int requireAppointmentDuration(Integer durationMinutes) {
|
||||
if (durationMinutes == null || durationMinutes <= 0) {
|
||||
throw new RuntimeException("预约时长不能为空且必须大于0分钟");
|
||||
@@ -984,6 +1020,47 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
);
|
||||
}
|
||||
|
||||
private String resolveAppointmentDisplayTitle(AppointmentReservationDO reservation, OrderItemDO item, ProductDO product) {
|
||||
return firstNonBlank(
|
||||
reservation == null ? null : reservation.getProductTitle(),
|
||||
item == null ? null : item.getAppointmentProductTitle(),
|
||||
product == null ? null : product.getTitle(),
|
||||
"预约作品"
|
||||
);
|
||||
}
|
||||
|
||||
private String resolveAppointmentProductDescription(OrderItemDO item, ProductDO product) {
|
||||
return firstNonBlank(
|
||||
item == null ? null : item.getAppointmentProductDescription(),
|
||||
product == null ? null : product.getDescription(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
private String resolveAppointmentProductTags(OrderItemDO item, ProductDO product) {
|
||||
return firstNonBlank(
|
||||
item == null ? null : item.getAppointmentProductTags(),
|
||||
product == null ? null : product.getTags(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
private String resolveAppointmentProductPrecautions(OrderItemDO item, ProductDO product) {
|
||||
return firstNonBlank(
|
||||
item == null ? null : item.getAppointmentProductPrecautions(),
|
||||
product == null ? null : product.getPrecautions(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
private String resolveAppointmentProductImageFileIds(OrderItemDO item, ProductDO product) {
|
||||
return firstNonBlank(
|
||||
item == null ? null : item.getAppointmentProductImageFileIds(),
|
||||
product == null ? null : product.getImageFileIds(),
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
private OrderDO requireAccessibleOrder(UserDO currentUser, Long orderId) {
|
||||
OrderDO order = orderMapper.selectById(orderId);
|
||||
if (order == null || Integer.valueOf(1).equals(order.getIsDelete())) {
|
||||
@@ -1176,6 +1253,45 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
return list == null ? List.of() : list;
|
||||
}
|
||||
|
||||
private List<Long> parseLongTokens(String value) {
|
||||
if (!hasText(value)) {
|
||||
return List.of();
|
||||
}
|
||||
List<Long> result = new ArrayList<>();
|
||||
String[] tokens = value.split(",");
|
||||
for (int index = 0; index < tokens.length; index += 1) {
|
||||
String token = tokens[index].trim();
|
||||
if (token.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
result.add(Long.parseLong(token));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new RuntimeException("预约作品图片文件ID格式不正确:" + token);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> resolveImageUrls(List<Long> fileIds) {
|
||||
if (fileIds == null || fileIds.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
Map<Long, ObjectStorageFileVO> fileMap = objectStorageFileService.getObjectStorageFileMapByIds(new LinkedHashSet<>(fileIds));
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (Long fileId : fileIds) {
|
||||
ObjectStorageFileVO file = fileMap.get(fileId);
|
||||
if (file == null) {
|
||||
continue;
|
||||
}
|
||||
String imageUrl = objectStorageUrlSupport.toAccessibleUrl(file);
|
||||
if (hasText(imageUrl)) {
|
||||
urls.add(imageUrl);
|
||||
}
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
private String firstNonBlank(String... values) {
|
||||
for (String value : values) {
|
||||
if (hasText(value)) {
|
||||
|
||||
+7
@@ -3,6 +3,8 @@ package com.xiaowang.jayucloud.core.modules.planning.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PlanningAppointmentVO {
|
||||
@@ -33,4 +35,9 @@ public class PlanningAppointmentVO {
|
||||
private String conflictReason;
|
||||
private BigDecimal amount;
|
||||
private String remark;
|
||||
private String productDescription;
|
||||
private String productTags;
|
||||
private String productPrecautions;
|
||||
private String productImageFileIds;
|
||||
private List<String> productImageUrls = new ArrayList<>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user