调整二楼提出的意见
This commit is contained in:
@@ -757,8 +757,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
queryWrapper
|
queryWrapper
|
||||||
.eq("state", DataStateEnum.ENABLE.getCode())
|
.eq("state", DataStateEnum.ENABLE.getCode())
|
||||||
.eq("Dev_Type", param.getDevType())
|
.eq("Dev_Type", param.getDevType())
|
||||||
.and(q -> q.eq("name", param.getName()).or()
|
.and(q -> q.eq("Create_Id", param.getCreateId())); //设备序列号重复,不管设备类型,原设备类型条件删除
|
||||||
.eq("Create_Id", param.getCreateId())); //设备序列号重复
|
|
||||||
// .eq("pattern", param.getPattern())
|
// .eq("pattern", param.getPattern())
|
||||||
// .eq("manufacturer", param.getManufacturer())
|
// .eq("manufacturer", param.getManufacturer())
|
||||||
// .eq("Dev_Type", param.getDevType()).or()
|
// .eq("Dev_Type", param.getDevType()).or()
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import cn.hutool.core.text.StrPool;
|
|||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.ftp.Ftp;
|
|
||||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
import cn.hutool.extra.qrcode.QrConfig;
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@@ -22,7 +20,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.BinaryDataConverter;
|
|
||||||
import com.njcn.common.utils.images.ImageConverter;
|
import com.njcn.common.utils.images.ImageConverter;
|
||||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||||
import com.njcn.gather.detection.pojo.constant.DetectionCommunicateConstant;
|
import com.njcn.gather.detection.pojo.constant.DetectionCommunicateConstant;
|
||||||
@@ -73,7 +70,6 @@ import com.njcn.gather.type.pojo.po.DevType;
|
|||||||
import com.njcn.gather.type.service.IDevTypeService;
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
import com.njcn.http.util.RestTemplateUtil;
|
import com.njcn.http.util.RestTemplateUtil;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import com.njcn.web.utils.HttpServletUtil;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -91,19 +87,14 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.xml.bind.JAXBElement;
|
import javax.xml.bind.JAXBElement;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.DataBufferUShort;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@@ -128,6 +119,24 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
@Value("${report.reportDir:D:\\report}")
|
@Value("${report.reportDir:D:\\report}")
|
||||||
private String reportPath;
|
private String reportPath;
|
||||||
|
|
||||||
|
@Value("${socket.device.ip}")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@Value("${socket.device.port}")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
@Value("${qr.cloud}")
|
||||||
|
private String cloudUrl;
|
||||||
|
|
||||||
|
@Value("${qr.dev.name}")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
@Value("${qr.dev.password}")
|
||||||
|
private String devPsd;
|
||||||
|
|
||||||
|
@Value("${qr.dev.port}")
|
||||||
|
private Integer devPort;
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
private final PqDevMapper pqDevMapper;
|
private final PqDevMapper pqDevMapper;
|
||||||
|
|
||||||
@@ -147,6 +156,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
|
|
||||||
private final ISysTestConfigService sysTestConfigService;
|
private final ISysTestConfigService sysTestConfigService;
|
||||||
|
|
||||||
|
private final SocketDevResponseService socketDevResponseService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplateUtil restTemplateUtil;
|
private RestTemplateUtil restTemplateUtil;
|
||||||
|
|
||||||
@@ -585,16 +596,16 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
this.updateDevAndPlanState(devReportParam.getDevId(), devReportParam.getPlanId());
|
||||||
|
sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
||||||
// 检测报告上云
|
// // 检测报告上云
|
||||||
Future<?> future = executor.submit(() -> {
|
// Future<?> future = executor.submit(() -> {
|
||||||
sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
// sendReportToCloud(pqDevVO.getIp(), reportFullPath, pqDevVO.getCreateId() + ".docx");
|
||||||
});
|
// });
|
||||||
try {
|
// try {
|
||||||
future.get();
|
// future.get();
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
log.error("检测报告上云异常,异常为:"+e.getMessage());
|
// log.error("检测报告上云异常,异常为:"+e.getMessage());
|
||||||
}
|
// }
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
log.error(ReportResponseEnum.GENERATE_REPORT_ERROR.getMessage(), e);
|
||||||
@@ -603,13 +614,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${socket.device.ip}")
|
|
||||||
private String ip;
|
|
||||||
|
|
||||||
@Value("${socket.device.port}")
|
|
||||||
private Integer port;
|
|
||||||
|
|
||||||
private final SocketDevResponseService socketDevResponseService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理检测报告上传云服务器并生成二维码下装到装置
|
* 处理检测报告上传云服务器并生成二维码下装到装置
|
||||||
@@ -620,15 +625,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
* @param reportName 检测报告名称
|
* @param reportName 检测报告名称
|
||||||
*/
|
*/
|
||||||
public void sendReportToCloud(String devIp, String reportFullPath, String reportName) {
|
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";
|
|
||||||
// 将文件上传至目标服务器
|
// 将文件上传至目标服务器
|
||||||
File file = new File(reportFullPath);
|
File file = new File(reportFullPath);
|
||||||
try {
|
try {
|
||||||
ResponseEntity<String> responseEntity = restTemplateUtil.uploadFile(url + "/upload", file);
|
ResponseEntity<String> responseEntity = restTemplateUtil.uploadFile(cloudUrl + "/upload", file);
|
||||||
if (responseEntity.getStatusCode().is2xxSuccessful()) {
|
if (responseEntity.getStatusCode().is2xxSuccessful()) {
|
||||||
// 上传没问题后,拼接url生成二维码,并将二维码转为bin格式文件传递给设备通讯模块
|
// 上传没问题后,拼接url生成二维码,并将二维码转为bin格式文件传递给设备通讯模块
|
||||||
String qrUrl = url + "/download/" + reportName;
|
String qrUrl = cloudUrl + "/download/" + reportName;
|
||||||
BufferedImage bufferedImage = QrCodeUtil.generate(qrUrl, 148, 148);
|
BufferedImage bufferedImage = QrCodeUtil.generate(qrUrl, 148, 148);
|
||||||
// 将 BufferedImage 转换为单色图像
|
// 将 BufferedImage 转换为单色图像
|
||||||
BufferedImage monoImage = new BufferedImage(148, 148, BufferedImage.TYPE_BYTE_BINARY);
|
BufferedImage monoImage = new BufferedImage(148, 148, BufferedImage.TYPE_BYTE_BINARY);
|
||||||
@@ -648,9 +651,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
|||||||
sendFileMsg.setRequestId(SourceOperateCodeEnum.FTP_SEND_01.getValue());
|
sendFileMsg.setRequestId(SourceOperateCodeEnum.FTP_SEND_01.getValue());
|
||||||
// 组装业务数据
|
// 组装业务数据
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.set("name", "njcn");
|
data.set("name", devName);
|
||||||
data.set("password", "Pqs@12345678");
|
data.set("password", devPsd);
|
||||||
data.set("port", "21");
|
data.set("port", devPort);
|
||||||
data.set("path", "ftp://" + devIp + "/etc/qrc.bin");
|
data.set("path", "ftp://" + devIp + "/etc/qrc.bin");
|
||||||
data.set("file", base64String);
|
data.set("file", base64String);
|
||||||
sendFileMsg.setData(data.toString());
|
sendFileMsg.setData(data.toString());
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.1.24:13306/pqs91003?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://192.168.1.24:13306/pqs91003?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai
|
||||||
|
|
||||||
#url: jdbc:mysql://localhost:3306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
|
||||||
username: root
|
username: root
|
||||||
#password: root
|
|
||||||
password: njcnpqs
|
password: njcnpqs
|
||||||
|
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||||
|
# username: root
|
||||||
|
# password: root
|
||||||
#初始化建立物理连接的个数、最小、最大连接数
|
#初始化建立物理连接的个数、最小、最大连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
min-idle: 5
|
min-idle: 5
|
||||||
@@ -50,12 +50,16 @@ phaseAngle:
|
|||||||
socket:
|
socket:
|
||||||
source:
|
source:
|
||||||
ip: 192.168.1.138
|
ip: 192.168.1.138
|
||||||
#ip: localhost
|
|
||||||
port: 62000
|
port: 62000
|
||||||
device:
|
device:
|
||||||
ip: 192.168.1.138
|
ip: 192.168.1.138
|
||||||
#ip: localhost
|
|
||||||
port: 61000
|
port: 61000
|
||||||
|
# source:
|
||||||
|
# ip: 192.168.1.121
|
||||||
|
# port: 10086
|
||||||
|
# device:
|
||||||
|
# ip: 192.168.1.121
|
||||||
|
# port: 61000
|
||||||
|
|
||||||
webSocket:
|
webSocket:
|
||||||
port: 7777
|
port: 7777
|
||||||
@@ -84,3 +88,10 @@ report:
|
|||||||
template: D:\template
|
template: D:\template
|
||||||
reportDir: D:\report
|
reportDir: D:\report
|
||||||
|
|
||||||
|
qr:
|
||||||
|
cloud: http://pqmcc.com:18082/api/file
|
||||||
|
dev:
|
||||||
|
name: njcn
|
||||||
|
password: Pqs@12345678
|
||||||
|
port: 21
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user