二维码功能开发
This commit is contained in:
@@ -584,17 +584,18 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
}
|
||||
out.close();
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||
|
||||
// 检测报告上云
|
||||
Future<?> future = executor.submit(() -> {
|
||||
this.updateDevAndPlanState(devReportParam.getDevId(), pqDevVO.getCreateId() + ".docx");
|
||||
sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
||||
});
|
||||
|
||||
try {
|
||||
future.get();
|
||||
} catch (Exception e) {
|
||||
log.error("检测报告上云异常,异常为:"+e.getMessage());
|
||||
}
|
||||
sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||
throw new BusinessException(ReportResponseEnum.GENERATE_REPORT_ERROR);
|
||||
@@ -621,7 +622,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
public void sendReportToCloud(String devIp, String reportFullPath, String reportName) {
|
||||
// String url = "http://pqmcc.com:8060/api/file";
|
||||
String url = "http://127.0.0.1:18082/api/file";
|
||||
devIp = "192.168.1.239";
|
||||
// 将文件上传至目标服务器
|
||||
File file = new File(reportFullPath);
|
||||
try {
|
||||
@@ -640,9 +640,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
monochromeImage.getGraphics().drawImage(bufferedImage, 0, 0, null);
|
||||
// 4. 将单色图像在内存中编码为完整的BMP文件流
|
||||
byte[] finalBinData = ImageConverter.convertToBinFormat(bufferedImage);
|
||||
|
||||
String base64String = Base64.getEncoder().encodeToString(finalBinData);
|
||||
System.out.println("二维码base64数据为:" + base64String);
|
||||
|
||||
// 组装设备通讯模块的参数
|
||||
SocketMsg<String> sendFileMsg = new SocketMsg<>();
|
||||
@@ -655,9 +653,6 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
data.set("port", "21");
|
||||
data.set("path", "ftp://" + devIp + "/etc/qrc.bin");
|
||||
data.set("file", base64String);
|
||||
|
||||
|
||||
|
||||
sendFileMsg.setData(data.toString());
|
||||
String msg = JSON.toJSONString(sendFileMsg);
|
||||
Channel channel = SocketManager.getChannelByUserId("cdf" + DetectionCommunicateConstant.DEV);
|
||||
|
||||
Reference in New Issue
Block a user