feat:统一小票打印机接口
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.dpkj.modules.autoReplyPrint.controller;
|
||||
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.autoReplyPrint.request.ReceiptPrintRequest;
|
||||
import com.dpkj.modules.autoReplyPrint.service.ImagePrintService;
|
||||
import com.dpkj.modules.autoReplyPrint.service.impl.TemplateService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 小票打印机控制层
|
||||
*
|
||||
* @author <a href="https://gitee.com/shi-chongli">石头人</a>
|
||||
* @version 1.0
|
||||
* @since 2025-03-10 9:29:22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/receipt")
|
||||
public class ReceiptPrintController {
|
||||
|
||||
@Resource(name = "USBImagePrint")
|
||||
private ImagePrintService usbImagePrintService;
|
||||
|
||||
@PostMapping("/print")
|
||||
private Result<Void> print(@Validated @RequestBody ReceiptPrintRequest request){
|
||||
String devName = "VID:0x0FE6,PID:0x811E"; // 采用默认的devName,不进行入参传值了
|
||||
usbImagePrintService.imagePrintFromPath(devName,
|
||||
request.getWidth(),
|
||||
request.getHeight(),
|
||||
request.getFileDir(),
|
||||
1,
|
||||
0);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user