feat: add group buy secondhand and file storage

This commit is contained in:
王鹏
2026-07-07 16:04:02 +08:00
parent 9c579b3173
commit fa8f243486
26 changed files with 2159 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
package com.linhelp.groupbuy;
import com.linhelp.common.api.ApiResponse;
import com.linhelp.common.security.AuthService;
import com.linhelp.common.security.CurrentUser;
import com.linhelp.common.security.RequireRole;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
@RestController
public class GroupBuyController {
private final GroupBuyService groupBuyService;
private final GroupBuyOrderService orderService;
private final AuthService authService;
public GroupBuyController(GroupBuyService groupBuyService,
GroupBuyOrderService orderService,
AuthService authService) {
this.groupBuyService = groupBuyService;
this.orderService = orderService;
this.authService = authService;
}
@GetMapping("/api/admin/group-buys")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<List<GroupBuyResponse>> listAdmin() {
CurrentUser user = authService.currentUser();
return ApiResponse.ok(groupBuyService.listAdmin(user.getCommunityId()));
}
@PostMapping("/api/admin/group-buys")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<GroupBuyResponse> create(@Valid @RequestBody GroupBuyRequest request) {
CurrentUser user = authService.currentUser();
request.setTenantId(user.getTenantId());
request.setCommunityId(user.getCommunityId());
return ApiResponse.ok(groupBuyService.create(request));
}
@PutMapping("/api/admin/group-buys/{id}")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<GroupBuyResponse> update(@PathVariable Long id, @Valid @RequestBody GroupBuyRequest request) {
CurrentUser user = authService.currentUser();
request.setTenantId(user.getTenantId());
request.setCommunityId(user.getCommunityId());
return ApiResponse.ok(groupBuyService.update(id, request));
}
@PutMapping("/api/admin/group-buys/{id}/start")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<GroupBuyResponse> start(@PathVariable Long id) {
return ApiResponse.ok(groupBuyService.start(id));
}
@PutMapping("/api/admin/group-buys/{id}/close")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<GroupBuyResponse> close(@PathVariable Long id) {
return ApiResponse.ok(groupBuyService.close(id));
}
@PutMapping("/api/admin/group-buys/{id}/complete")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<GroupBuyResponse> completeGroupBuy(@PathVariable Long id) {
return ApiResponse.ok(groupBuyService.complete(id));
}
@GetMapping("/api/admin/group-buys/{id}/orders")
@RequireRole({"PLATFORM_ADMIN", "COMMUNITY_ADMIN", "MERCHANT"})
public ApiResponse<List<GroupBuyOrderResponse>> listOrders(@PathVariable Long id) {
return ApiResponse.ok(orderService.listByGroupBuy(id));
}
@GetMapping("/api/mini/group-buys")
public ApiResponse<List<GroupBuyResponse>> listMini() {
CurrentUser user = authService.currentUser();
return ApiResponse.ok(groupBuyService.listMini(user.getCommunityId()));
}
@GetMapping("/api/mini/group-buys/{id}")
public ApiResponse<GroupBuyResponse> detail(@PathVariable Long id) {
return ApiResponse.ok(groupBuyService.detail(id));
}
@PostMapping("/api/mini/group-buy-orders")
public ApiResponse<GroupBuyOrderResponse> createOrder(@Valid @RequestBody GroupBuyOrderRequest request) {
CurrentUser user = authService.currentUser();
request.setTenantId(user.getTenantId());
request.setCommunityId(user.getCommunityId());
return ApiResponse.ok(orderService.create(user.getUserId(), request));
}
@GetMapping("/api/mini/group-buy-orders")
public ApiResponse<List<GroupBuyOrderResponse>> listMine() {
CurrentUser user = authService.currentUser();
return ApiResponse.ok(orderService.listMine(user.getUserId()));
}
@GetMapping("/api/mini/group-buy-orders/{id}")
public ApiResponse<GroupBuyOrderResponse> orderDetail(@PathVariable Long id) {
return ApiResponse.ok(orderService.detail(id));
}
@PutMapping("/api/mini/group-buy-orders/{id}/cancel")
public ApiResponse<GroupBuyOrderResponse> cancel(@PathVariable Long id) {
return ApiResponse.ok(orderService.cancel(id));
}
@PutMapping("/api/mini/group-buy-orders/{id}/complete")
public ApiResponse<GroupBuyOrderResponse> completeOrder(@PathVariable Long id) {
return ApiResponse.ok(orderService.complete(id));
}
}

View File

@@ -0,0 +1,80 @@
package com.linhelp.groupbuy;
import com.linhelp.common.enums.DeliveryMethod;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
public class GroupBuyOrderRequest {
private Long tenantId;
private Long communityId;
@NotNull
private Long groupBuyId;
private Long addressId;
@Min(1)
private int quantity;
@NotNull
private DeliveryMethod deliveryMethod = DeliveryMethod.IMMEDIATE;
private String remark;
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public Long getCommunityId() {
return communityId;
}
public void setCommunityId(Long communityId) {
this.communityId = communityId;
}
public Long getGroupBuyId() {
return groupBuyId;
}
public void setGroupBuyId(Long groupBuyId) {
this.groupBuyId = groupBuyId;
}
public Long getAddressId() {
return addressId;
}
public void setAddressId(Long addressId) {
this.addressId = addressId;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public DeliveryMethod getDeliveryMethod() {
return deliveryMethod;
}
public void setDeliveryMethod(DeliveryMethod deliveryMethod) {
this.deliveryMethod = deliveryMethod;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@@ -0,0 +1,172 @@
package com.linhelp.groupbuy;
import com.linhelp.common.enums.DeliveryMethod;
import com.linhelp.common.enums.GroupBuyOrderStatus;
import com.linhelp.common.enums.OfflinePayStatus;
import java.time.LocalDateTime;
public class GroupBuyOrderResponse {
private Long id;
private String orderNo;
private Long tenantId;
private Long communityId;
private Long userId;
private Long groupBuyId;
private String groupBuyTitle;
private String coverUrl;
private Long addressId;
private int quantity;
private int priceCent;
private int amountCent;
private DeliveryMethod deliveryMethod;
private GroupBuyOrderStatus status;
private OfflinePayStatus offlinePayStatus;
private String remark;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public Long getCommunityId() {
return communityId;
}
public void setCommunityId(Long communityId) {
this.communityId = communityId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getGroupBuyId() {
return groupBuyId;
}
public void setGroupBuyId(Long groupBuyId) {
this.groupBuyId = groupBuyId;
}
public String getGroupBuyTitle() {
return groupBuyTitle;
}
public void setGroupBuyTitle(String groupBuyTitle) {
this.groupBuyTitle = groupBuyTitle;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public Long getAddressId() {
return addressId;
}
public void setAddressId(Long addressId) {
this.addressId = addressId;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getPriceCent() {
return priceCent;
}
public void setPriceCent(int priceCent) {
this.priceCent = priceCent;
}
public int getAmountCent() {
return amountCent;
}
public void setAmountCent(int amountCent) {
this.amountCent = amountCent;
}
public DeliveryMethod getDeliveryMethod() {
return deliveryMethod;
}
public void setDeliveryMethod(DeliveryMethod deliveryMethod) {
this.deliveryMethod = deliveryMethod;
}
public GroupBuyOrderStatus getStatus() {
return status;
}
public void setStatus(GroupBuyOrderStatus status) {
this.status = status;
}
public OfflinePayStatus getOfflinePayStatus() {
return offlinePayStatus;
}
public void setOfflinePayStatus(OfflinePayStatus offlinePayStatus) {
this.offlinePayStatus = offlinePayStatus;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
}

View File

@@ -0,0 +1,158 @@
package com.linhelp.groupbuy;
import com.linhelp.common.enums.DeliveryMethod;
import com.linhelp.common.enums.GroupBuyOrderStatus;
import com.linhelp.common.enums.OfflinePayStatus;
import com.linhelp.common.exception.BizException;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
@Service
public class GroupBuyOrderService {
private final GroupBuyService groupBuyService;
private final AtomicLong ids = new AtomicLong(1L);
private final Map<Long, GroupBuyOrderResponse> orders = new LinkedHashMap<Long, GroupBuyOrderResponse>();
public GroupBuyOrderService(GroupBuyService groupBuyService) {
this.groupBuyService = groupBuyService;
}
public synchronized GroupBuyOrderResponse create(Long userId, GroupBuyOrderRequest request) {
if (request.getDeliveryMethod() != DeliveryMethod.SELF_PICKUP && request.getAddressId() == null) {
throw new BizException("配送地址不能为空");
}
GroupBuyResponse groupBuy = groupBuyService.reserveForOrder(request.getGroupBuyId(), request.getQuantity());
Long orderId = ids.getAndIncrement();
GroupBuyOrderResponse order = new GroupBuyOrderResponse();
order.setId(orderId);
order.setOrderNo("GB" + String.format("%08d", orderId));
order.setTenantId(request.getTenantId());
order.setCommunityId(request.getCommunityId());
order.setUserId(userId);
order.setGroupBuyId(groupBuy.getId());
order.setGroupBuyTitle(groupBuy.getTitle());
order.setCoverUrl(groupBuy.getCoverUrl());
order.setAddressId(request.getAddressId());
order.setQuantity(request.getQuantity());
order.setPriceCent(groupBuy.getPriceCent());
order.setAmountCent(groupBuy.getPriceCent() * request.getQuantity());
order.setDeliveryMethod(request.getDeliveryMethod());
order.setStatus(GroupBuyOrderStatus.PENDING_CONFIRM);
order.setOfflinePayStatus(OfflinePayStatus.UNPAID);
order.setRemark(request.getRemark());
order.setCreatedAt(LocalDateTime.now());
order.setUpdatedAt(order.getCreatedAt());
orders.put(order.getId(), order);
return copy(order);
}
public synchronized GroupBuyOrderResponse detail(Long id) {
return copy(require(id));
}
public synchronized List<GroupBuyOrderResponse> listMine(Long userId) {
List<GroupBuyOrderResponse> result = new ArrayList<GroupBuyOrderResponse>();
for (GroupBuyOrderResponse order : orders.values()) {
if (userId.equals(order.getUserId())) {
result.add(copy(order));
}
}
return result;
}
public synchronized List<GroupBuyOrderResponse> listByGroupBuy(Long groupBuyId) {
List<GroupBuyOrderResponse> result = new ArrayList<GroupBuyOrderResponse>();
for (GroupBuyOrderResponse order : orders.values()) {
if (groupBuyId.equals(order.getGroupBuyId())) {
result.add(copy(order));
}
}
return result;
}
public synchronized GroupBuyOrderResponse confirm(Long id) {
GroupBuyOrderResponse order = require(id);
move(order, GroupBuyOrderStatus.PENDING_CONFIRM, GroupBuyOrderStatus.CONFIRMED);
return copy(order);
}
public synchronized GroupBuyOrderResponse markReady(Long id) {
GroupBuyOrderResponse order = require(id);
GroupBuyOrderStatus target = DeliveryMethod.SELF_PICKUP.equals(order.getDeliveryMethod())
? GroupBuyOrderStatus.PENDING_PICKUP
: GroupBuyOrderStatus.PENDING_DELIVERY;
move(order, GroupBuyOrderStatus.CONFIRMED, target);
return copy(order);
}
public synchronized GroupBuyOrderResponse markDelivering(Long id) {
GroupBuyOrderResponse order = require(id);
move(order, GroupBuyOrderStatus.PENDING_DELIVERY, GroupBuyOrderStatus.DELIVERING);
return copy(order);
}
public synchronized GroupBuyOrderResponse complete(Long id) {
GroupBuyOrderResponse order = require(id);
if (order.getStatus() != GroupBuyOrderStatus.PENDING_PICKUP && order.getStatus() != GroupBuyOrderStatus.DELIVERING) {
throw new BizException("订单状态不允许操作");
}
order.setStatus(GroupBuyOrderStatus.COMPLETED);
order.setUpdatedAt(LocalDateTime.now());
return copy(order);
}
public synchronized GroupBuyOrderResponse cancel(Long id) {
GroupBuyOrderResponse order = require(id);
if (order.getStatus() == GroupBuyOrderStatus.COMPLETED) {
throw new BizException("订单状态不允许操作");
}
order.setStatus(GroupBuyOrderStatus.CANCELED);
order.setUpdatedAt(LocalDateTime.now());
return copy(order);
}
private void move(GroupBuyOrderResponse order, GroupBuyOrderStatus expected, GroupBuyOrderStatus target) {
if (order.getStatus() != expected) {
throw new BizException("订单状态不允许操作");
}
order.setStatus(target);
order.setUpdatedAt(LocalDateTime.now());
}
private GroupBuyOrderResponse require(Long id) {
GroupBuyOrderResponse order = orders.get(id);
if (order == null) {
throw new BizException(404, "团购订单不存在");
}
return order;
}
private GroupBuyOrderResponse copy(GroupBuyOrderResponse source) {
GroupBuyOrderResponse target = new GroupBuyOrderResponse();
target.setId(source.getId());
target.setOrderNo(source.getOrderNo());
target.setTenantId(source.getTenantId());
target.setCommunityId(source.getCommunityId());
target.setUserId(source.getUserId());
target.setGroupBuyId(source.getGroupBuyId());
target.setGroupBuyTitle(source.getGroupBuyTitle());
target.setCoverUrl(source.getCoverUrl());
target.setAddressId(source.getAddressId());
target.setQuantity(source.getQuantity());
target.setPriceCent(source.getPriceCent());
target.setAmountCent(source.getAmountCent());
target.setDeliveryMethod(source.getDeliveryMethod());
target.setStatus(source.getStatus());
target.setOfflinePayStatus(source.getOfflinePayStatus());
target.setRemark(source.getRemark());
target.setCreatedAt(source.getCreatedAt());
target.setUpdatedAt(source.getUpdatedAt());
return target;
}
}

View File

@@ -0,0 +1,121 @@
package com.linhelp.groupbuy;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
public class GroupBuyRequest {
private Long tenantId;
private Long communityId;
@NotBlank
private String title;
private String coverUrl;
private String description;
@Min(0)
private int priceCent;
private Integer originPriceCent;
@Min(0)
private int stock;
@NotNull
private LocalDateTime startTime;
@NotNull
private LocalDateTime endTime;
private String pickupAddress;
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public Long getCommunityId() {
return communityId;
}
public void setCommunityId(Long communityId) {
this.communityId = communityId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPriceCent() {
return priceCent;
}
public void setPriceCent(int priceCent) {
this.priceCent = priceCent;
}
public Integer getOriginPriceCent() {
return originPriceCent;
}
public void setOriginPriceCent(Integer originPriceCent) {
this.originPriceCent = originPriceCent;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public LocalDateTime getStartTime() {
return startTime;
}
public void setStartTime(LocalDateTime startTime) {
this.startTime = startTime;
}
public LocalDateTime getEndTime() {
return endTime;
}
public void setEndTime(LocalDateTime endTime) {
this.endTime = endTime;
}
public String getPickupAddress() {
return pickupAddress;
}
public void setPickupAddress(String pickupAddress) {
this.pickupAddress = pickupAddress;
}
}

View File

@@ -0,0 +1,132 @@
package com.linhelp.groupbuy;
import java.time.LocalDateTime;
public class GroupBuyResponse {
private Long id;
private Long tenantId;
private Long communityId;
private String title;
private String coverUrl;
private String description;
private int priceCent;
private Integer originPriceCent;
private int stock;
private int soldCount;
private String status;
private LocalDateTime startTime;
private LocalDateTime endTime;
private String pickupAddress;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public Long getCommunityId() {
return communityId;
}
public void setCommunityId(Long communityId) {
this.communityId = communityId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPriceCent() {
return priceCent;
}
public void setPriceCent(int priceCent) {
this.priceCent = priceCent;
}
public Integer getOriginPriceCent() {
return originPriceCent;
}
public void setOriginPriceCent(Integer originPriceCent) {
this.originPriceCent = originPriceCent;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public int getSoldCount() {
return soldCount;
}
public void setSoldCount(int soldCount) {
this.soldCount = soldCount;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public LocalDateTime getStartTime() {
return startTime;
}
public void setStartTime(LocalDateTime startTime) {
this.startTime = startTime;
}
public LocalDateTime getEndTime() {
return endTime;
}
public void setEndTime(LocalDateTime endTime) {
this.endTime = endTime;
}
public String getPickupAddress() {
return pickupAddress;
}
public void setPickupAddress(String pickupAddress) {
this.pickupAddress = pickupAddress;
}
}

View File

@@ -0,0 +1,141 @@
package com.linhelp.groupbuy;
import com.linhelp.common.exception.BizException;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
@Service
public class GroupBuyService {
public static final String STATUS_DRAFT = "DRAFT";
public static final String STATUS_ONGOING = "ONGOING";
public static final String STATUS_CLOSED = "CLOSED";
public static final String STATUS_COMPLETED = "COMPLETED";
private final AtomicLong ids = new AtomicLong(1L);
private final Map<Long, GroupBuyResponse> groupBuys = new LinkedHashMap<Long, GroupBuyResponse>();
public synchronized GroupBuyResponse create(GroupBuyRequest request) {
GroupBuyResponse groupBuy = new GroupBuyResponse();
groupBuy.setId(ids.getAndIncrement());
groupBuy.setTenantId(request.getTenantId());
groupBuy.setCommunityId(request.getCommunityId());
copyFields(request, groupBuy);
groupBuy.setStatus(STATUS_DRAFT);
groupBuys.put(groupBuy.getId(), groupBuy);
return copy(groupBuy);
}
public synchronized GroupBuyResponse update(Long id, GroupBuyRequest request) {
GroupBuyResponse groupBuy = require(id);
if (request.getTenantId() != null) {
groupBuy.setTenantId(request.getTenantId());
}
if (request.getCommunityId() != null) {
groupBuy.setCommunityId(request.getCommunityId());
}
copyFields(request, groupBuy);
return copy(groupBuy);
}
public synchronized GroupBuyResponse start(Long id) {
GroupBuyResponse groupBuy = require(id);
groupBuy.setStatus(STATUS_ONGOING);
return copy(groupBuy);
}
public synchronized GroupBuyResponse close(Long id) {
GroupBuyResponse groupBuy = require(id);
groupBuy.setStatus(STATUS_CLOSED);
return copy(groupBuy);
}
public synchronized GroupBuyResponse complete(Long id) {
GroupBuyResponse groupBuy = require(id);
groupBuy.setStatus(STATUS_COMPLETED);
return copy(groupBuy);
}
public synchronized GroupBuyResponse detail(Long id) {
return copy(require(id));
}
public synchronized List<GroupBuyResponse> listAdmin(Long communityId) {
List<GroupBuyResponse> result = new ArrayList<GroupBuyResponse>();
for (GroupBuyResponse groupBuy : groupBuys.values()) {
if (communityId.equals(groupBuy.getCommunityId())) {
result.add(copy(groupBuy));
}
}
return result;
}
public synchronized List<GroupBuyResponse> listMini(Long communityId) {
List<GroupBuyResponse> result = new ArrayList<GroupBuyResponse>();
for (GroupBuyResponse groupBuy : groupBuys.values()) {
if (communityId.equals(groupBuy.getCommunityId()) && STATUS_ONGOING.equals(groupBuy.getStatus())) {
result.add(copy(groupBuy));
}
}
return result;
}
public synchronized GroupBuyResponse reserveForOrder(Long id, int quantity) {
if (quantity <= 0) {
throw new BizException("购买数量必须大于0");
}
GroupBuyResponse groupBuy = require(id);
if (!STATUS_ONGOING.equals(groupBuy.getStatus()) || LocalDateTime.now().isAfter(groupBuy.getEndTime())) {
throw new BizException("团购已截单");
}
if (groupBuy.getSoldCount() + quantity > groupBuy.getStock()) {
throw new BizException("团购库存不足");
}
groupBuy.setSoldCount(groupBuy.getSoldCount() + quantity);
return copy(groupBuy);
}
private GroupBuyResponse require(Long id) {
GroupBuyResponse groupBuy = groupBuys.get(id);
if (groupBuy == null) {
throw new BizException(404, "团购不存在");
}
return groupBuy;
}
private void copyFields(GroupBuyRequest request, GroupBuyResponse groupBuy) {
groupBuy.setTitle(request.getTitle());
groupBuy.setCoverUrl(request.getCoverUrl());
groupBuy.setDescription(request.getDescription());
groupBuy.setPriceCent(request.getPriceCent());
groupBuy.setOriginPriceCent(request.getOriginPriceCent());
groupBuy.setStock(request.getStock());
groupBuy.setStartTime(request.getStartTime());
groupBuy.setEndTime(request.getEndTime());
groupBuy.setPickupAddress(request.getPickupAddress());
}
private GroupBuyResponse copy(GroupBuyResponse source) {
GroupBuyResponse target = new GroupBuyResponse();
target.setId(source.getId());
target.setTenantId(source.getTenantId());
target.setCommunityId(source.getCommunityId());
target.setTitle(source.getTitle());
target.setCoverUrl(source.getCoverUrl());
target.setDescription(source.getDescription());
target.setPriceCent(source.getPriceCent());
target.setOriginPriceCent(source.getOriginPriceCent());
target.setStock(source.getStock());
target.setSoldCount(source.getSoldCount());
target.setStatus(source.getStatus());
target.setStartTime(source.getStartTime());
target.setEndTime(source.getEndTime());
target.setPickupAddress(source.getPickupAddress());
return target;
}
}