this is 3.24 update

This commit is contained in:
chen-xin-zhi 2025-03-29 01:59:04 +08:00
parent e009b105f8
commit e10feb602f
3 changed files with 38 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import com.cultural.heritage.service.good.AppointmentDateService;
import com.cultural.heritage.service.good.GoodService;
import com.cultural.heritage.service.good.TimePeriodService;
import com.cultural.heritage.service.order.PendingServiceGoodService;
import com.cultural.heritage.service.order.PendingServiceOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
@ -73,6 +74,11 @@ public class AppointmentDateController {
@Resource
private PendingServiceOrderService pendingServiceOrderService;
/**
* Web端管理员根据id删除预约日期
* @param commonRequest 预约日期id
@ -130,6 +136,12 @@ public class AppointmentDateController {
// 删除服务类商品待处理记录
QueryWrapper<PendingServiceGood> goodQueryWrapper = new QueryWrapper<>();
goodQueryWrapper.eq("timePeriodId", id);
// List<PendingServiceGood> pendingServiceGoodList = pendingServiceGoodService.list(goodQueryWrapper);
// PendingServiceGood pendingServiceGood = pendingServiceGoodList.get(0);
// Long pendingId = pendingServiceGood.getId();
// QueryWrapper<PendingServiceGood> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("pendingId", pendingId);
boolean result = pendingServiceGoodService.remove(goodQueryWrapper);
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR, "服务类商品待处理记录删除失败");

View File

@ -20,6 +20,7 @@ import com.cultural.heritage.service.common.CommonService;
import com.cultural.heritage.service.order.PendingServiceGoodService;
import com.cultural.heritage.service.order.PendingServiceOrderService;
import com.cultural.heritage.service.user.UserService;
import com.cultural.heritage.utils.Pagination;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
@ -94,8 +95,6 @@ public class PendingServiceGoodController {
List<PendingServiceGoodVO> pendingServiceGoodVOList = new ArrayList<>();
for (PendingServiceGood pendingServiceGood : pendingServiceGoodList) {
// TODO
// pendingServiceGood.setGoodImg(FileConstant.SERVER_HOST + pendingServiceGood.getGoodImg());
PendingServiceGoodVO pendingServiceGoodVO = new PendingServiceGoodVO();
BeanUtils.copyProperties(pendingServiceGood, pendingServiceGoodVO);
Long goodId = pendingServiceGood.getId();
@ -111,6 +110,7 @@ public class PendingServiceGoodController {
long pages = (total + pageSize - 1) / pageSize;
Page<PendingServiceGoodVO> voPage = new Page<>();
pendingServiceGoodVOList = Pagination.paginate(pendingServiceGoodVOList, current, pageSize);
voPage.setRecords(pendingServiceGoodVOList);
voPage.setTotal(total);
voPage.setSize(pageSize);

View File

@ -0,0 +1,24 @@
package com.cultural.heritage.utils;
import java.util.List;
import java.util.ArrayList;
public class Pagination {
public static <T> List<T> paginate(List<T> sourceList, long currentPage, long pageSize) {
// 计算起始索引
long startIndex = (currentPage - 1) * pageSize;
// 如果起始索引超出集合大小返回空列表
if (startIndex >= sourceList.size()) {
return new ArrayList<>();
}
// 计算结束索引
long endIndex = Math.min(startIndex + pageSize, sourceList.size());
// 返回分页后的子集
return sourceList.subList((int) startIndex, (int) endIndex);
}
}