|
|
|
@ -116,33 +116,20 @@ public class UpdateService {
|
|
|
|
|
FilePathUtil.deleteDir(picDir);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String lianZhongDir = findLianZhongDir(cardInfo);
|
|
|
|
|
if (lianZhongDir == null) {
|
|
|
|
|
//失败,说明原因
|
|
|
|
|
dataQuery.updateBatchState(cardInfo, 2, "未找到联众数据文件夹!");
|
|
|
|
|
FilePathUtil.deleteDir(picDir);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dataQuery.updatePicPath(cardInfo, lianZhongDir);
|
|
|
|
|
|
|
|
|
|
dataQuery.updatePicPath(cardInfo, "联众工具转换");
|
|
|
|
|
List<Future> fileFutures = new ArrayList<>();
|
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
|
Future fileFuture = fileExecutor.submit(() -> {
|
|
|
|
|
String tifFilePath = lianZhongDir + File.separator + removeFileExtension(picture.getPicname()) + ".tif";
|
|
|
|
|
File tifFile = new File(tifFilePath);
|
|
|
|
|
if (tifFile.exists()) {
|
|
|
|
|
try {
|
|
|
|
|
BufferedImage read = ImageIO.read(tifFile);
|
|
|
|
|
Thumbnails.of(read)
|
|
|
|
|
.scale(1)
|
|
|
|
|
.outputFormat("jpg")
|
|
|
|
|
.rotate(picture.getRotatedegree())
|
|
|
|
|
.toFile(picDir + File.separator + removeFileExtension(picture.getPicname()) + ".jpg");
|
|
|
|
|
read.flush();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
SimpleDateFormat sdfYmd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
String destJpgFilePath = picDir + File.separator + removeFileExtension(picture.getPicname()) + ".jpg";
|
|
|
|
|
String cmd = "C:\\lztool\\Debug\\lianzhong.exe 003 192.169.2.170 " + cardInfo.getId() + " " + picture.getPicid() + " " + cardInfo.getPatno() + " " + sdfYmd.format(cardInfo.getOutdate()) + " " + picture.getPicname() + " " + destJpgFilePath + " http://192.169.2.170:8080 " + picture.getRotatedegree();
|
|
|
|
|
try {
|
|
|
|
|
java.lang.Process process = java.lang.Runtime.getRuntime().exec(cmd);//执行命令生成cube
|
|
|
|
|
process.waitFor();
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
log.error("图片转换异常,命令:"+cmd,ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
fileFutures.add(fileFuture);
|
|
|
|
|
}
|
|
|
|
|