You've already forked FrameTour-BE
feat(printer): add print task review and reprint functionality
- Add reprint endpoint with printer name update - Implement pending review task query and management - Add task URL update for pending review tasks - Support bulk approve/reject of pending tasks - Extend task status enum with review-related states - Create ReprintRequest DTO for printer information - Update mapper to handle status transitions and queries - Modify service layer to support review workflow - Adjust XML mapper for new database operations
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ycwl.basic.service.printer;
|
||||
|
||||
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity;
|
||||
import com.ycwl.basic.model.pc.printer.entity.PrinterEntity;
|
||||
import com.ycwl.basic.model.pc.printer.resp.MemberPrintResp;
|
||||
import com.ycwl.basic.model.pc.printer.resp.PrinterResp;
|
||||
@@ -18,13 +19,13 @@ public interface PrinterService {
|
||||
List<PrinterResp> listByScenicId(Long scenicId);
|
||||
|
||||
ApiResponse<List<PrinterEntity>> list(PrinterEntity condition);
|
||||
|
||||
|
||||
ApiResponse<PrinterEntity> get(Integer id);
|
||||
|
||||
|
||||
ApiResponse<Integer> add(PrinterEntity entity);
|
||||
|
||||
|
||||
ApiResponse<Integer> update(PrinterEntity entity);
|
||||
|
||||
|
||||
ApiResponse<Integer> delete(Integer id);
|
||||
|
||||
List<PrintTaskResp> sync(PrinterSyncReq req);
|
||||
@@ -60,4 +61,33 @@ public interface PrinterService {
|
||||
FaceRecognizeResp useSample(Long userId, Long sampleId);
|
||||
|
||||
void autoAddPhotosToPreferPrint(Long faceId);
|
||||
|
||||
/**
|
||||
* 查询待审核的打印任务
|
||||
* @param printerId 打印机ID(可选)
|
||||
* @return 待审核任务列表
|
||||
*/
|
||||
List<PrintTaskEntity> getPendingReviewTasks(Integer printerId);
|
||||
|
||||
/**
|
||||
* 更新待审核任务的URL
|
||||
* @param taskId 任务ID
|
||||
* @param url 新的打印URL
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updatePendingReviewTaskUrl(Integer taskId, String url);
|
||||
|
||||
/**
|
||||
* 批准待审核任务,下发到打印队列
|
||||
* @param taskIds 任务ID列表
|
||||
* @return 成功数量
|
||||
*/
|
||||
int approvePrintTasks(List<Integer> taskIds);
|
||||
|
||||
/**
|
||||
* 拒绝待审核任务
|
||||
* @param taskIds 任务ID列表
|
||||
* @return 成功数量
|
||||
*/
|
||||
int rejectPrintTasks(List<Integer> taskIds);
|
||||
}
|
||||
@@ -598,6 +598,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
private static final int PRINTER_INDEX_EXPIRE_MINUTES = 5;
|
||||
private static final int TASK_STATUS_PENDING = 0;
|
||||
private static final int TASK_STATUS_PROCESSING = 3;
|
||||
private static final int TASK_STATUS_PENDING_REVIEW = 4; // 待审核
|
||||
private final Lock syncTaskLock = new ReentrantLock();
|
||||
|
||||
@Override
|
||||
@@ -736,12 +737,20 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
// 获取打印机名称(支持轮询)
|
||||
String selectedPrinter = getNextPrinter(printer);
|
||||
|
||||
// 根据景区配置决定任务初始状态
|
||||
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(order.getScenicId());
|
||||
Boolean purchaseNeedReview = scenicConfig.getBoolean("printer_manual_approve");
|
||||
int initialStatus = (purchaseNeedReview != null && purchaseNeedReview)
|
||||
? TASK_STATUS_PENDING_REVIEW
|
||||
: TASK_STATUS_PENDING;
|
||||
|
||||
PrintTaskEntity task = new PrintTaskEntity();
|
||||
task.setPrinterId(printer.getId());
|
||||
task.setPrinterName(selectedPrinter);
|
||||
task.setMpId(item.getId());
|
||||
task.setPaper(printer.getPreferPaper());
|
||||
task.setStatus(0);
|
||||
task.setStatus(initialStatus);
|
||||
task.setUrl(printUrl);
|
||||
task.setHeight(printer.getPreferH());
|
||||
task.setWidth(printer.getPreferW());
|
||||
@@ -752,6 +761,59 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待审核的打印任务
|
||||
* @param printerId 打印机ID(可选)
|
||||
* @return 待审核任务列表
|
||||
*/
|
||||
@Override
|
||||
public List<PrintTaskEntity> getPendingReviewTasks(Integer printerId) {
|
||||
return printTaskMapper.queryPendingReviewTasks(printerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新待审核任务的URL(可用于重新添加水印等操作)
|
||||
* @param taskId 任务ID
|
||||
* @param url 新的打印URL
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean updatePendingReviewTaskUrl(Integer taskId, String url) {
|
||||
if (taskId == null || url == null || url.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
int rows = printTaskMapper.updateTaskUrl(taskId, url);
|
||||
return rows > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批准待审核任务,下发到打印队列
|
||||
* @param taskIds 任务ID列表
|
||||
* @return 成功数量
|
||||
*/
|
||||
@Override
|
||||
public int approvePrintTasks(List<Integer> taskIds) {
|
||||
if (taskIds == null || taskIds.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
// 将状态从4(待审核)改为0(待处理)
|
||||
return printTaskMapper.batchUpdateStatus(taskIds, TASK_STATUS_PENDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝待审核任务(取消打印)
|
||||
* @param taskIds 任务ID列表
|
||||
* @return 成功数量
|
||||
*/
|
||||
@Override
|
||||
public int rejectPrintTasks(List<Integer> taskIds) {
|
||||
if (taskIds == null || taskIds.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
// 将状态从4(待审核)改为5(已取消)
|
||||
return printTaskMapper.batchUpdateStatus(taskIds, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaceRecognizeResp useSample(Long userId, Long sampleId) {
|
||||
// 1. 查询 faceSample 获取其 URL
|
||||
|
||||
Reference in New Issue
Block a user