修复预约客户与员工管理问题
This commit is contained in:
+29
-2
@@ -33,6 +33,7 @@ import com.xiaowang.jayucloud.core.modules.order.mapper.OrderMapper;
|
||||
import com.xiaowang.jayucloud.core.modules.product.mapper.ProductMapper;
|
||||
import com.xiaowang.jayucloud.core.modules.shop.mapper.ShopMapper;
|
||||
import com.xiaowang.jayucloud.core.modules.shop.mapper.ShopScheduleExceptionMapper;
|
||||
import com.xiaowang.jayucloud.core.modules.shop.support.UserShopBindingSupport;
|
||||
import com.xiaowang.jayucloud.core.modules.user.mapper.UserMapper;
|
||||
import com.xiaowang.jayucloud.core.modules.planning.service.AppointmentCapacityService;
|
||||
import com.xiaowang.jayucloud.core.modules.order.service.OrderService;
|
||||
@@ -105,6 +106,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
private final ObjectStorageUrlSupport objectStorageUrlSupport;
|
||||
private final ShopMapper shopMapper;
|
||||
private final ShopScheduleExceptionMapper shopScheduleExceptionMapper;
|
||||
private final UserShopBindingSupport userShopBindingSupport;
|
||||
private final AppointmentCapacityService appointmentCapacityService;
|
||||
private final OrderService orderService;
|
||||
private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
|
||||
@@ -168,7 +170,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
}
|
||||
Long shopId = requirePlanningShopId(currentUser);
|
||||
requireAppointmentDuration(dto.getDurationMinutes());
|
||||
ProductDO product = resolveAppointmentProduct(dto, shopId);
|
||||
ProductDO product = resolveCreateAppointmentProduct(dto, shopId);
|
||||
UserDO artist = requireActiveArtist(dto.getArtistId(), shopId);
|
||||
UserDO customer = resolveCustomer(shopId, dto);
|
||||
|
||||
@@ -1084,6 +1086,30 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
return product;
|
||||
}
|
||||
|
||||
private ProductDO resolveCreateAppointmentProduct(PlanningAppointmentCreateDTO dto, Long shopId) {
|
||||
if (dto.getProductId() != null) {
|
||||
return requireActiveProduct(dto.getProductId(), shopId);
|
||||
}
|
||||
requireManualAppointmentProduct(dto);
|
||||
ProductDO product = new ProductDO();
|
||||
product.setShopId(shopId);
|
||||
product.setTitle(trimToNull(dto.getManualProductTitle()));
|
||||
product.setDescription(trimToNull(dto.getManualProductDescription()));
|
||||
product.setPrice(dto.getManualProductPrice());
|
||||
product.setTags(trimToNull(dto.getManualProductTags()));
|
||||
product.setPrecautions(trimToNull(dto.getManualProductPrecautions()));
|
||||
product.setImageFileIds(trimToNull(dto.getManualProductImageFileIds()));
|
||||
product.setApproximateDuration(String.valueOf(dto.getDurationMinutes()));
|
||||
product.setBookableArtists(dto.getArtistId() == null ? null : String.valueOf(dto.getArtistId()));
|
||||
product.setFrontVisible(0);
|
||||
product.setSourceType("MANAGER_APPOINTMENT");
|
||||
product.setLikeCount(0);
|
||||
product.setCollectCount(0);
|
||||
product.setIsDelete(0);
|
||||
productMapper.insert(product);
|
||||
return product;
|
||||
}
|
||||
|
||||
private ProductDO resolveAppointmentProduct(PlanningAppointmentCreateDTO dto, Long shopId) {
|
||||
if (dto.getProductId() != null) {
|
||||
return requireActiveProduct(dto.getProductId(), shopId);
|
||||
@@ -1184,12 +1210,13 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
customer.setNickname(firstNonBlank(customerName, phone, "到店客户"));
|
||||
customer.setPhone(phone);
|
||||
customer.setContactPhone(phone);
|
||||
customer.setAccount("guest" + snowflakeIdGenerator.nextIdString());
|
||||
customer.setAccount("tmp" + snowflakeIdGenerator.nextIdString());
|
||||
customer.setPassword(ENCODED_UNSET_PASSWORD);
|
||||
customer.setType(0);
|
||||
customer.setStatus(1);
|
||||
customer.setIsDelete(0);
|
||||
userMapper.insert(customer);
|
||||
userShopBindingSupport.ensureUserBoundToShop(customer.getId(), shopId);
|
||||
return customer;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1927,7 +1927,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
throw new RuntimeException("用户类型错误");
|
||||
}
|
||||
|
||||
if (currentUserType <= targetUserType) {
|
||||
if (currentUserType < targetUserType) {
|
||||
/**
|
||||
* Run business method `RuntimeException`.
|
||||
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
|
||||
|
||||
Reference in New Issue
Block a user