实现预约草稿和资料头像编辑
This commit is contained in:
+5
@@ -18,6 +18,11 @@ public class PlanningAppointmentCreateDTO {
|
||||
private Integer durationMinutes;
|
||||
private String manualProductTitle;
|
||||
private BigDecimal manualProductPrice;
|
||||
private String manualProductDescription;
|
||||
private String manualProductTags;
|
||||
private String manualProductTargetAudience;
|
||||
private String manualProductPrecautions;
|
||||
private String manualProductImageFileIds;
|
||||
private String remark;
|
||||
private String clientRequestId;
|
||||
}
|
||||
|
||||
+14
-3
@@ -142,6 +142,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
throw new RuntimeException("美甲师账号只能查看预约,不能新建预约");
|
||||
}
|
||||
Long shopId = requirePlanningShopId(currentUser);
|
||||
requireAppointmentDuration(dto.getDurationMinutes());
|
||||
ProductDO product = resolveAppointmentProduct(dto, shopId);
|
||||
UserDO artist = requireActiveArtist(dto.getArtistId(), shopId);
|
||||
UserDO customer = resolveCustomer(shopId, dto);
|
||||
@@ -645,12 +646,15 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
if (price == null || price.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new RuntimeException("手动作品价格不能小于0");
|
||||
}
|
||||
int durationMinutes = dto.getDurationMinutes() == null || dto.getDurationMinutes() <= 0
|
||||
? DEFAULT_DURATION_MINUTES
|
||||
: dto.getDurationMinutes();
|
||||
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);
|
||||
@@ -663,6 +667,13 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
return product;
|
||||
}
|
||||
|
||||
private int requireAppointmentDuration(Integer durationMinutes) {
|
||||
if (durationMinutes == null || durationMinutes <= 0) {
|
||||
throw new RuntimeException("预约时长不能为空且必须大于0分钟");
|
||||
}
|
||||
return durationMinutes;
|
||||
}
|
||||
|
||||
private UserDO requireActiveArtist(Long artistId, Long shopId) {
|
||||
if (artistId == null) {
|
||||
throw new RuntimeException("请选择美甲师");
|
||||
|
||||
+5
-2
@@ -421,8 +421,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
userDO.setVipId(userDTO.getVipId());
|
||||
userDO.setIsDelete(0);
|
||||
userDO.setStatus(1);
|
||||
// 设置默认头像
|
||||
userDO.setAvatar(DEFAULT_AVATAR_URL);
|
||||
if (StringUtils.hasText(userDTO.getAvatar())) {
|
||||
userDO.setAvatar(normalizeStoredAvatar(userDTO.getAvatar()));
|
||||
} else {
|
||||
userDO.setAvatar(DEFAULT_AVATAR_URL);
|
||||
}
|
||||
|
||||
if (Integer.valueOf(0).equals(userDO.getType())) {
|
||||
if (!StringUtils.hasText(userDO.getLevel())) {
|
||||
|
||||
Reference in New Issue
Block a user