提交 94f8c79b authored 作者: zhoushaopan's avatar zhoushaopan

修改代码

上级 9615c74d
......@@ -214,4 +214,8 @@ public class AllotBackBill {
@ApiModelProperty(value = "装备集合")
@Transient
private List<DeviceLibrary> deviceLibraries;
@ApiModelProperty("任务id")
@Transient
private Integer taskId;
}
......@@ -258,4 +258,8 @@ public class RepairBackBill {
@Transient
private List<FileRet> receiveFileList = new ArrayList<>();
@ApiModelProperty("任务id")
@Transient
private Integer taskId;
}
......@@ -127,4 +127,8 @@ public class RepairBill {
@ApiModelProperty(value = "区块链记录id")
private String recordId;
@ApiModelProperty("任务id")
@Transient
private Integer taskId;
}
......@@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
......@@ -29,25 +31,25 @@ public class ZxingController {
@Autowired
private ZXingUtil zXingUtil;
// @Value("${filePath}")
// private String filePath;
// @PostMapping("/decode")
// public ZxingTaskVo decode(@RequestBody ZxingFile file) throws NotFoundException, IOException {
// ZxingTaskVo taskVo = zXingUtil.decode(file.getFilePath());
// return taskVo;
// }
@PostMapping("/decode")
public ZxingTaskVo decode1(@RequestBody ZxingFile file) throws NotFoundException, IOException {
String stt= ResourceUtils.getURL("classpath:").getPath() + UUID.randomUUID() + ".png";
//生成临时文件
String stt = ResourceUtils.getURL("classpath:").getPath() + UUID.randomUUID() + ".png";
String path = file.getFilePath();
List<byte[]> bytes = PdfToImageUtil.pdfToImage(Base64Util.getFileBytes(path));
Base64Util.byte2image(bytes.get(0),stt);
String base64 = Base64Util.getImageStr( stt);
File file1 = new File(path);
//判断文件的类型
String name = file1.getName();
String substring = name.substring(name.lastIndexOf("." + 1));
if (substring.equals("pdf")) {
List<byte[]> bytes = PdfToImageUtil.pdfToImage(Base64Util.getFileBytes(path));
Base64Util.byte2image(bytes.get(0), stt);
}
String base64 = Base64Util.getImageStr(stt);
QRCodeUtils qrCodeUtils = new QRCodeUtils();
ZxingTaskVo zxingTaskVo = qrCodeUtils.deEncodeByBase64(base64);
return zxingTaskVo;
return qrCodeUtils.deEncodeByBase64(base64);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论