身份证读取(完成)、社保卡读取(待调试)
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
package com.dpkj.modules.autoReplyPrint.controller;
|
||||
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.autoReplyPrint.service.ImagePrintService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 图片打印控制层
|
||||
*
|
||||
* @author <a href="https://gitee.com/shi-chongli">石头人</a>
|
||||
* @version 1.0
|
||||
* @since 2025-01-17 13:57:11
|
||||
*/
|
||||
@RequestMapping("/autoReplyPrint")
|
||||
public class ImagePrintController {
|
||||
|
||||
@Resource(name = "USBImagePrint")
|
||||
private ImagePrintService usbImagePrintService;
|
||||
|
||||
/**
|
||||
* 图片打印,通过路径
|
||||
*/
|
||||
@GetMapping("/usb/imagePrint/path")
|
||||
Result<Void> usbImagePrintFromPath(@RequestParam(defaultValue = "VID:0x0FE6,PID:0x811E") String usbName,
|
||||
@RequestParam(defaultValue = "500") Integer width,
|
||||
@RequestParam(defaultValue = "500") Integer height,
|
||||
@RequestParam String path, Integer binaryMethod, Integer compressionMethod){
|
||||
this.usbImagePrintService.imagePrintFromPath(usbName, width, height, path, binaryMethod, compressionMethod);
|
||||
return Result.ok("图片打印成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片打印,通过byte[]
|
||||
*/
|
||||
@GetMapping("/usb/imagePrint/pathData")
|
||||
Result<Void> usbImagePrintFromData(@RequestParam(defaultValue = "VID:0x0FE6,PID:0x811E") String usbName,
|
||||
@RequestParam(defaultValue = "500") Integer width,
|
||||
@RequestParam(defaultValue = "500") Integer height,
|
||||
@RequestParam String path, Integer binaryMethod, Integer compressionMethod){
|
||||
this.usbImagePrintService.imagePrintFromPathData(usbName, width, height, path, binaryMethod, compressionMethod);
|
||||
return Result.ok("图片打印成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片打印,通过multipartFile文件
|
||||
*/
|
||||
@GetMapping("/usb/imagePrint/multipartFile")
|
||||
Result<Void> usbImagePrintFromData(@RequestParam(defaultValue = "VID:0x0FE6,PID:0x811E") String usbName,
|
||||
@RequestParam(defaultValue = "500") Integer width,
|
||||
@RequestParam(defaultValue = "500") Integer height,
|
||||
@RequestParam MultipartFile file, Integer binaryMethod, Integer compressionMethod){
|
||||
this.usbImagePrintService.imagePrintFromMultipartFile(usbName, width, height, file, binaryMethod, compressionMethod);
|
||||
return Result.ok("图片打印成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片打印,通过byte[]
|
||||
*/
|
||||
@GetMapping("/usb/imagePrint/data")
|
||||
Result<Void> usbImagePrintFromData(@RequestParam(defaultValue = "VID:0x0FE6,PID:0x811E") String usbName,
|
||||
@RequestParam(defaultValue = "500") Integer width,
|
||||
@RequestParam(defaultValue = "500") Integer height,
|
||||
@RequestParam byte[] data, Integer binaryMethod, Integer compressionMethod){
|
||||
this.usbImagePrintService.imagePrintFromData(usbName, width, height, data, binaryMethod, compressionMethod);
|
||||
return Result.ok("图片打印成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.dpkj.modules.autoReplyPrint.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.autoReplyPrint.service.impl.TemplateService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 打印模板控制层
|
||||
*
|
||||
* @author <a href="https://gitee.com/shi-chongli">石头人</a>
|
||||
* @version 1.0
|
||||
* @since 2025-01-17 15:25:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/autoReplyPrint")
|
||||
public class TemplateController {
|
||||
|
||||
@Resource
|
||||
private TemplateService templateService;
|
||||
|
||||
|
||||
@GetMapping("/template/{templateName}")
|
||||
public Result<String> testTemplate(@RequestParam String jsonData,
|
||||
@RequestParam Integer width,
|
||||
@RequestParam Integer height,
|
||||
@PathVariable String templateName,
|
||||
@RequestParam(defaultValue = "E:\\images") String saveDir) {
|
||||
this.templateService.generateReceiptImage(JSONObject.parseObject(jsonData), templateName, width, height, saveDir);
|
||||
return Result.ok("模板生成成功");
|
||||
}
|
||||
|
||||
@GetMapping("/template")
|
||||
public Result<String> testTemplate(@RequestParam String jsonData,
|
||||
@RequestParam Integer width,
|
||||
@RequestParam Integer height, @RequestParam(defaultValue = "E:\\images") String saveDir) {
|
||||
String html = "<!DOCTYPE html>\n" +
|
||||
"<html>\n" +
|
||||
"<head><title>Test</title></head>\n" +
|
||||
"<body>\n" +
|
||||
"<h1>你好,我是一个好的模板</h1>\n" +
|
||||
"<h2><span th:text='${name}'> </span></h2>\n" +
|
||||
"</body>\n" +
|
||||
"</html>";
|
||||
this.templateService.generateReceiptImage(JSONObject.parseObject(jsonData), html, width, height, saveDir);
|
||||
return Result.ok("模板生成成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user