新增历史补单与服务中状态
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ public class OperationsAnalyticsServiceImpl implements OperationsAnalyticsServic
|
||||
vo.setCartCount(0L);
|
||||
vo.setOrderCount((long) orders.size());
|
||||
vo.setPaidOrderCount(orders.stream().filter(order -> "PAID".equals(order.getPaymentStatus())).count());
|
||||
vo.setCompletedOrderCount(orders.stream().filter(order -> Integer.valueOf(2).equals(order.getStatus())).count());
|
||||
vo.setCompletedOrderCount(orders.stream().filter(order -> Integer.valueOf(2).equals(order.getStatus()) || Integer.valueOf(4).equals(order.getStatus())).count());
|
||||
vo.setReviewCount(userGrowthRecordMapper.selectCount(new LambdaQueryWrapper<UserGrowthRecordDO>()
|
||||
.eq(UserGrowthRecordDO::getSourceType, "REVIEW")));
|
||||
vo.setRebookCount(userGrowthRecordMapper.selectCount(new LambdaQueryWrapper<UserGrowthRecordDO>()
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
|
||||
vo.setLowStockItemCount(countLowStock(shopId));
|
||||
vo.setScheduleReminderCount(countMissingSchedules(shopId, artistId, todayStart.toLocalDate()));
|
||||
vo.setTodayServiceCount(countTodayServices(artistId, todayStart, tomorrowStart));
|
||||
vo.setCompletedServiceCount(orders.stream().filter(order -> Integer.valueOf(2).equals(order.getStatus())).count());
|
||||
vo.setCompletedServiceCount(orders.stream().filter(order -> Integer.valueOf(2).equals(order.getStatus()) || Integer.valueOf(4).equals(order.getStatus())).count());
|
||||
vo.setServiceAmount(orders.stream()
|
||||
.map(order -> order.getActualAmount() == null ? BigDecimal.ZERO : order.getActualAmount())
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
|
||||
+10
@@ -18,6 +18,7 @@ import com.xiaowang.jacyucloudsalon.core.modules.manager.dto.ManagerCustomerCrea
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningBackfillOrderCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.service.PlanningService;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.vo.PlanningAppointmentVO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.vo.PlanningCalendarVO;
|
||||
@@ -89,6 +90,15 @@ public class AdminManagerController {
|
||||
return Result.success(planningService.createAppointment(currentUser, dto));
|
||||
}
|
||||
|
||||
@PostMapping("/planning/backfill-orders")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "manager-planning-create-backfill-order", ttlSeconds = 10, message = "补单创建处理中,请勿重复提交")
|
||||
public Result<PlanningAppointmentVO> createBackfillOrder(HttpServletRequest request,
|
||||
@RequestBody PlanningBackfillOrderCreateDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.createBackfillOrder(currentUser, dto));
|
||||
}
|
||||
|
||||
@GetMapping("/planning/appointments/{orderItemId}")
|
||||
@RequirePermission("order:view")
|
||||
public Result<PlanningAppointmentVO> appointment(HttpServletRequest request,
|
||||
|
||||
+3
@@ -54,7 +54,10 @@ public class OrderDO extends BaseEntity {
|
||||
private String paymentOrderNo;
|
||||
private String refundStatus;
|
||||
private String customerRemark;
|
||||
private String customerNameSnapshot;
|
||||
private String customerPhoneSnapshot;
|
||||
private String quoteStatus;
|
||||
private String orderSource;
|
||||
private Integer quoteUserConfirmed;
|
||||
private Integer quoteShopConfirmed;
|
||||
private LocalDateTime quoteExpireTime;
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ public class OrderItemDO extends BaseEntity {
|
||||
* Field `appointmentTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||
*/
|
||||
private LocalDateTime appointmentTime;
|
||||
private java.time.LocalDate serviceDate;
|
||||
|
||||
/**
|
||||
* Field `createTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||
|
||||
+19
-1
@@ -1519,7 +1519,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
*/
|
||||
throw new RuntimeException("订单不存在");
|
||||
}
|
||||
if (status != 2 && status != 3) {
|
||||
if (status != 2 && status != 3 && status != 4) {
|
||||
/**
|
||||
* 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.
|
||||
@@ -1528,7 +1528,13 @@ public class OrderServiceImpl implements OrderService {
|
||||
throw new RuntimeException("无效的订单状态");
|
||||
}
|
||||
OrderStatus targetStatus = OrderStatus.requireKnown(status);
|
||||
if (status == OrderStatus.IN_SERVICE.getCode()
|
||||
&& !"HISTORICAL_BACKFILL".equals(order.getOrderSource())) {
|
||||
throw new RuntimeException("普通预约不能进入服务中状态");
|
||||
}
|
||||
if (!Integer.valueOf(OrderStatus.PENDING_SERVICE.getCode()).equals(order.getStatus())
|
||||
&& !(Integer.valueOf(OrderStatus.IN_SERVICE.getCode()).equals(order.getStatus())
|
||||
&& (status == OrderStatus.COMPLETED.getCode() || status == OrderStatus.CANCELLED.getCode()))
|
||||
&& !(Integer.valueOf(OrderStatus.PRICE_CONFIRMING.getCode()).equals(order.getStatus())
|
||||
&& Integer.valueOf(OrderStatus.CANCELLED.getCode()).equals(status))) {
|
||||
/**
|
||||
@@ -3278,6 +3284,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (Integer.valueOf(3).equals(status)) {
|
||||
return "已取消";
|
||||
}
|
||||
if (Integer.valueOf(4).equals(status)) {
|
||||
return "服务中";
|
||||
}
|
||||
return "未知状态";
|
||||
}
|
||||
|
||||
@@ -3327,6 +3336,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderVO.setCustomerNickname(resolveCustomerNickname(customer));
|
||||
orderVO.setCustomerPhoneMasked(maskPhone(customer == null ? null : customer.getPhone()));
|
||||
orderVO.setStatus(order.getStatus());
|
||||
orderVO.setOrderSource(order.getOrderSource());
|
||||
|
||||
switch (order.getStatus()) {
|
||||
case 0:
|
||||
@@ -3341,6 +3351,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
case 3:
|
||||
orderVO.setStatusText("已取消");
|
||||
break;
|
||||
case 4:
|
||||
orderVO.setStatusText("服务中");
|
||||
break;
|
||||
default:
|
||||
orderVO.setStatusText("未知状态");
|
||||
}
|
||||
@@ -3395,6 +3408,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
itemVO.setPrice(displayPrice);
|
||||
itemVO.setTotalPrice(displayPrice.multiply(BigDecimal.valueOf(item.getQuantity())));
|
||||
itemVO.setAppointmentTime(formatAppointmentTime(item.getAppointmentTime()));
|
||||
itemVO.setServiceDate(item.getServiceDate() == null ? null : item.getServiceDate().toString());
|
||||
itemVO.setHistoricalBackfill("HISTORICAL_BACKFILL".equals(order.getOrderSource()));
|
||||
String occupancyStatus = resolveOrderItemOccupancyStatus(order);
|
||||
itemVO.setOccupancyStatus(occupancyStatus);
|
||||
itemVO.setCanEdit(canEditOrderItem(order));
|
||||
@@ -3453,6 +3468,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (Integer.valueOf(OrderStatus.COMPLETED.getCode()).equals(order.getStatus())) {
|
||||
return "COMPLETED";
|
||||
}
|
||||
if (Integer.valueOf(OrderStatus.IN_SERVICE.getCode()).equals(order.getStatus())) {
|
||||
return "HISTORICAL_BACKFILL";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -19,7 +19,10 @@ public final class OrderStateMachine {
|
||||
if (from == OrderStatus.PRICE_CONFIRMING) {
|
||||
return to == OrderStatus.PENDING_SERVICE || to == OrderStatus.CANCELLED;
|
||||
}
|
||||
return from == OrderStatus.PENDING_SERVICE
|
||||
if (from == OrderStatus.PENDING_SERVICE) {
|
||||
return to == OrderStatus.COMPLETED || to == OrderStatus.CANCELLED;
|
||||
}
|
||||
return from == OrderStatus.IN_SERVICE
|
||||
&& (to == OrderStatus.COMPLETED || to == OrderStatus.CANCELLED);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -10,7 +10,8 @@ public enum OrderStatus {
|
||||
PRICE_CONFIRMING(0),
|
||||
PENDING_SERVICE(1),
|
||||
COMPLETED(2),
|
||||
CANCELLED(3);
|
||||
CANCELLED(3),
|
||||
IN_SERVICE(4);
|
||||
|
||||
/**
|
||||
* Purpose: code supports OrderStatus.java by holding or executing the code business role.
|
||||
|
||||
+2
@@ -57,6 +57,8 @@ public class OrderItemVO {
|
||||
* Field `appointmentTime` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
|
||||
*/
|
||||
private String appointmentTime;
|
||||
private String serviceDate;
|
||||
private Boolean historicalBackfill;
|
||||
private String occupancyStatus;
|
||||
private Boolean canEdit;
|
||||
private Boolean canCancel;
|
||||
|
||||
+1
@@ -66,6 +66,7 @@ public class OrderVO {
|
||||
private String refundStatus;
|
||||
private String customerRemark;
|
||||
private String quoteStatus;
|
||||
private String orderSource;
|
||||
private String quoteStatusText;
|
||||
private Boolean quoteUserConfirmed;
|
||||
private Boolean quoteShopConfirmed;
|
||||
|
||||
+10
@@ -4,6 +4,7 @@ import com.xiaowang.jacyucloudsalon.core.annotation.OperationGuard;
|
||||
import com.xiaowang.jacyucloudsalon.core.annotation.RequirePermission;
|
||||
import com.xiaowang.jacyucloudsalon.core.common.Result;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningBackfillOrderCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO;
|
||||
@@ -53,6 +54,15 @@ public class AdminPlanningController {
|
||||
return Result.success(planningService.createAppointment(currentUser, dto));
|
||||
}
|
||||
|
||||
@PostMapping("/backfill-orders")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "admin-planning-create-backfill-order", ttlSeconds = 10, message = "补单创建处理中,请勿重复提交")
|
||||
public Result<PlanningAppointmentVO> createBackfillOrder(HttpServletRequest request,
|
||||
@RequestBody PlanningBackfillOrderCreateDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.createBackfillOrder(currentUser, dto));
|
||||
}
|
||||
|
||||
@GetMapping("/appointments/{orderItemId}")
|
||||
@RequirePermission("order:view")
|
||||
public Result<PlanningAppointmentVO> appointment(HttpServletRequest request,
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.xiaowang.jacyucloudsalon.core.modules.planning.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class PlanningBackfillOrderCreateDTO {
|
||||
private Long productId;
|
||||
private String manualProductTitle;
|
||||
private BigDecimal manualProductPrice;
|
||||
private Long customerUserId;
|
||||
private String customerName;
|
||||
private String phone;
|
||||
private String serviceDate;
|
||||
private String serviceTime;
|
||||
private Long artistId;
|
||||
private BigDecimal amount;
|
||||
private Integer status;
|
||||
private String remark;
|
||||
}
|
||||
+3
@@ -1,6 +1,7 @@
|
||||
package com.xiaowang.jacyucloudsalon.core.modules.planning.service;
|
||||
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningBackfillOrderCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.user.entity.UserDO;
|
||||
@@ -17,6 +18,8 @@ public interface PlanningService {
|
||||
|
||||
PlanningAppointmentVO createAppointment(UserDO currentUser, PlanningAppointmentCreateDTO dto);
|
||||
|
||||
PlanningAppointmentVO createBackfillOrder(UserDO currentUser, PlanningBackfillOrderCreateDTO dto);
|
||||
|
||||
PlanningAppointmentVO getAppointment(UserDO currentUser, Long orderItemId);
|
||||
|
||||
PlanningAppointmentVO moveAppointment(UserDO currentUser, Long orderItemId, PlanningAppointmentMoveDTO dto);
|
||||
|
||||
+72
-10
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.dto.PlanningBackfillOrderCreateDTO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.planning.entity.AppointmentReservationDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.artist.entity.ArtistScheduleDO;
|
||||
import com.xiaowang.jacyucloudsalon.core.modules.artist.entity.ArtistScheduleExceptionDO;
|
||||
@@ -198,6 +199,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
order.setPayAmount(amount);
|
||||
order.setPaidAmount(BigDecimal.ZERO);
|
||||
order.setStatus(OrderStatus.PENDING_SERVICE.getCode());
|
||||
order.setOrderSource("NORMAL_APPOINTMENT");
|
||||
order.setIsDelete(0);
|
||||
orderMapper.insert(order);
|
||||
|
||||
@@ -227,6 +229,56 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
return getAppointment(currentUser, item.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PlanningAppointmentVO createBackfillOrder(UserDO currentUser, PlanningBackfillOrderCreateDTO dto) {
|
||||
if (dto == null) throw new RuntimeException("补单信息不能为空");
|
||||
if (Integer.valueOf(3).equals(currentUser.getType())) throw new RuntimeException("美甲师账号不能创建补单");
|
||||
Long shopId = requirePlanningShopId(currentUser);
|
||||
if (!hasText(dto.getServiceDate())) throw new RuntimeException("服务日期不能为空");
|
||||
LocalDate serviceDate;
|
||||
try { serviceDate = LocalDate.parse(dto.getServiceDate()); }
|
||||
catch (DateTimeParseException ex) { throw new RuntimeException("服务日期格式不正确"); }
|
||||
UserDO artist = requireActiveArtist(dto.getArtistId(), shopId);
|
||||
ProductDO product;
|
||||
if (dto.getProductId() != null) product = requireActiveProduct(dto.getProductId(), shopId);
|
||||
else {
|
||||
String title = trimToNull(dto.getManualProductTitle());
|
||||
if (!hasText(title)) throw new RuntimeException("请选择项目或填写项目名称");
|
||||
BigDecimal price = dto.getManualProductPrice() == null ? dto.getAmount() : dto.getManualProductPrice();
|
||||
if (price == null || price.compareTo(BigDecimal.ZERO) < 0) throw new RuntimeException("项目金额不能小于0");
|
||||
product = new ProductDO(); product.setShopId(shopId); product.setTitle(title); product.setPrice(price);
|
||||
product.setSourceType(PRODUCT_SOURCE_TYPE_MANAGER_APPOINTMENT); product.setFrontVisible(0);
|
||||
product.setLikeCount(0); product.setCollectCount(0); product.setIsDelete(0); productMapper.insert(product);
|
||||
}
|
||||
if (dto.getAmount() == null || dto.getAmount().compareTo(BigDecimal.ZERO) < 0) throw new RuntimeException("金额不能为空且不能小于0");
|
||||
int status = dto.getStatus() == null ? OrderStatus.COMPLETED.getCode() : dto.getStatus();
|
||||
if (status != OrderStatus.IN_SERVICE.getCode() && status != OrderStatus.COMPLETED.getCode()) throw new RuntimeException("补单状态只能为服务中或已完成");
|
||||
UserDO customer = null;
|
||||
if (dto.getCustomerUserId() != null) {
|
||||
customer = userMapper.selectById(dto.getCustomerUserId());
|
||||
if (customer == null || Integer.valueOf(1).equals(customer.getIsDelete())) throw new RuntimeException("客户不存在");
|
||||
}
|
||||
LocalDateTime appointmentTime = null;
|
||||
if (hasText(dto.getServiceTime())) {
|
||||
try { appointmentTime = LocalDateTime.of(serviceDate, LocalTime.parse(dto.getServiceTime())); }
|
||||
catch (DateTimeParseException ex) { throw new RuntimeException("服务时间格式不正确"); }
|
||||
}
|
||||
OrderDO order = new OrderDO(); order.setOrderNo("ORD" + snowflakeIdGenerator.nextIdString());
|
||||
order.setUserId(customer == null ? null : customer.getId()); order.setShopId(shopId);
|
||||
order.setTotalAmount(dto.getAmount()); order.setActualAmount(dto.getAmount()); order.setPayAmount(dto.getAmount());
|
||||
order.setPaidAmount(dto.getAmount()); order.setPaymentStatus("PAID"); order.setQuoteStatus("CONFIRMED");
|
||||
order.setQuoteUserConfirmed(1); order.setQuoteShopConfirmed(1); order.setQuoteConfirmedTime(LocalDateTime.now());
|
||||
order.setStatus(status); order.setOrderSource("HISTORICAL_BACKFILL"); order.setCustomerRemark(trimToNull(dto.getRemark()));
|
||||
order.setCustomerNameSnapshot(trimToNull(dto.getCustomerName()));
|
||||
order.setCustomerPhoneSnapshot(trimToNull(dto.getPhone()));
|
||||
order.setIsDelete(0); orderMapper.insert(order);
|
||||
OrderItemDO item = new OrderItemDO(); item.setOrderId(order.getId()); item.setProductId(product.getId());
|
||||
item.setQuantity(1); item.setPrice(dto.getAmount()); item.setArtistId(artist.getId()); item.setServiceDate(serviceDate);
|
||||
item.setAppointmentTime(appointmentTime); item.setIsDelete(0); orderItemMapper.insert(item);
|
||||
return getAppointment(currentUser, item.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanningAppointmentVO getAppointment(UserDO currentUser, Long orderItemId) {
|
||||
if (orderItemId == null) {
|
||||
@@ -241,7 +293,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
AppointmentReservationDO reservation = findActiveReservation(orderItemId);
|
||||
Map<Long, PlanningArtistVO> artistMap = listArtists(order.getShopId(), item.getArtistId()).stream()
|
||||
.collect(Collectors.toMap(PlanningArtistVO::getId, Function.identity(), (a, b) -> a));
|
||||
Map<Long, UserDO> customerMap = loadUsers(Set.of(order.getUserId()));
|
||||
Map<Long, UserDO> customerMap = order.getUserId() == null ? Map.of() : loadUsers(Set.of(order.getUserId()));
|
||||
return toAppointmentVO(reservation, item, order, product, customerMap.get(order.getUserId()), artistMap);
|
||||
}
|
||||
|
||||
@@ -406,9 +458,9 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
|
||||
QueryWrapper<OrderItemDO> itemWrapper = new QueryWrapper<>();
|
||||
itemWrapper.eq("is_delete", 0)
|
||||
.isNotNull("appointment_time")
|
||||
.ge("appointment_time", rangeStart)
|
||||
.lt("appointment_time", rangeEnd)
|
||||
.and(wrapper -> wrapper
|
||||
.and(q -> q.isNotNull("appointment_time").ge("appointment_time", rangeStart).lt("appointment_time", rangeEnd))
|
||||
.or(q -> q.isNotNull("service_date").ge("service_date", rangeStart.toLocalDate()).lt("service_date", rangeEnd.toLocalDate())))
|
||||
.orderByAsc("appointment_time");
|
||||
if (artistId != null && artistId > 0) {
|
||||
itemWrapper.eq("artist_id", artistId);
|
||||
@@ -508,18 +560,20 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
vo.setOrderNo(order == null ? null : order.getOrderNo());
|
||||
vo.setOrderItemId(item == null ? reservation == null ? null : reservation.getOrderItemId() : item.getId());
|
||||
vo.setCustomerId(customer == null ? order == null ? null : order.getUserId() : customer.getId());
|
||||
vo.setCustomerName(customer == null ? "到店客户" : firstNonBlank(customer.getNickname(), customer.getAccount(), "到店客户"));
|
||||
vo.setCustomerPhone(customer == null ? null : firstNonBlank(customer.getContactPhone(), customer.getPhone(), ""));
|
||||
vo.setCustomerName(customer == null ? firstNonBlank(order == null ? null : order.getCustomerNameSnapshot(), "散客") : firstNonBlank(customer.getNickname(), customer.getAccount(), "到店客户"));
|
||||
vo.setCustomerPhone(customer == null ? order == null ? null : order.getCustomerPhoneSnapshot() : 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.setArtistId(artistId);
|
||||
boolean unassigned = artistId == null;
|
||||
vo.setArtistName(unassigned ? "待分配" : artist.getName());
|
||||
vo.setArtistColor(unassigned ? "#D59A52" : artist.getColor());
|
||||
vo.setArtistName(unassigned ? "待分配" : artist == null ? "美甲师" : artist.getName());
|
||||
vo.setArtistColor(unassigned ? "#D59A52" : artist == null ? "#7BA7C7" : artist.getColor());
|
||||
vo.setAssignmentStatus(unassigned ? RESERVATION_UNASSIGNED : ASSIGNMENT_ASSIGNED);
|
||||
vo.setDate(start == null ? null : start.toLocalDate().toString());
|
||||
vo.setHistoricalBackfill(order != null && "HISTORICAL_BACKFILL".equals(order.getOrderSource()));
|
||||
LocalDate serviceDate = item == null ? null : item.getServiceDate();
|
||||
vo.setDate(start == null ? serviceDate == null ? null : serviceDate.toString() : start.toLocalDate().toString());
|
||||
vo.setStartTime(start == null ? null : DATE_TIME_FORMATTER.format(start));
|
||||
vo.setEndTime(end == null ? null : DATE_TIME_FORMATTER.format(end));
|
||||
vo.setStartMinute(start == null ? null : start.toLocalTime().toSecondOfDay() / 60);
|
||||
@@ -527,7 +581,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
vo.setStatus(order == null ? null : order.getStatus());
|
||||
vo.setStatusText(statusText(order == null ? null : order.getStatus()));
|
||||
String occupancyStatus = unassigned ? RESERVATION_UNASSIGNED : resolveOccupancyStatus(reservation, order);
|
||||
vo.setOccupancyStatus(occupancyStatus);
|
||||
vo.setOccupancyStatus(Boolean.TRUE.equals(vo.getHistoricalBackfill()) ? "HISTORICAL_BACKFILL" : occupancyStatus);
|
||||
vo.setCanEdit(canEditAppointment(order, occupancyStatus));
|
||||
vo.setCanCancel(canCancelAppointment(order, occupancyStatus));
|
||||
vo.setConflictReason(resolveAppointmentConflictReason(occupancyStatus));
|
||||
@@ -866,12 +920,18 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
if (Integer.valueOf(OrderStatus.COMPLETED.getCode()).equals(status)) {
|
||||
return "已完成";
|
||||
}
|
||||
if (Integer.valueOf(OrderStatus.IN_SERVICE.getCode()).equals(status)) {
|
||||
return "服务中";
|
||||
}
|
||||
if (Integer.valueOf(OrderStatus.CANCELLED.getCode()).equals(status)) {
|
||||
return "已取消";
|
||||
}
|
||||
if (Integer.valueOf(OrderStatus.PRICE_CONFIRMING.getCode()).equals(status)) {
|
||||
return "待确认";
|
||||
}
|
||||
if (Integer.valueOf(OrderStatus.IN_SERVICE.getCode()).equals(status)) {
|
||||
return "服务中";
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
|
||||
@@ -896,6 +956,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
|
||||
private Boolean canEditAppointment(OrderDO order, String occupancyStatus) {
|
||||
return order != null
|
||||
&& !"HISTORICAL_BACKFILL".equals(order.getOrderSource())
|
||||
&& (RESERVATION_PENDING_QUOTE.equals(occupancyStatus)
|
||||
|| RESERVATION_CONFIRMED.equals(occupancyStatus)
|
||||
|| RESERVATION_UNASSIGNED.equals(occupancyStatus))
|
||||
@@ -905,6 +966,7 @@ public class PlanningServiceImpl implements PlanningService {
|
||||
|
||||
private Boolean canCancelAppointment(OrderDO order, String occupancyStatus) {
|
||||
return order != null
|
||||
&& (!"HISTORICAL_BACKFILL".equals(order.getOrderSource()) || Integer.valueOf(OrderStatus.IN_SERVICE.getCode()).equals(order.getStatus()))
|
||||
&& (RESERVATION_PENDING_QUOTE.equals(occupancyStatus)
|
||||
|| RESERVATION_CONFIRMED.equals(occupancyStatus)
|
||||
|| RESERVATION_UNASSIGNED.equals(occupancyStatus))
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ public class PlanningAppointmentVO {
|
||||
private String artistName;
|
||||
private String artistColor;
|
||||
private String assignmentStatus;
|
||||
private Boolean historicalBackfill;
|
||||
private String date;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
Reference in New Issue
Block a user