From e2d186fa2a3895ca43b1fa4fa563142a5bd730b3 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Wed, 9 Apr 2025 17:43:40 +0800 Subject: [PATCH] =?UTF-8?q?46196=20=20MES-PCN:=E8=BF=94=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A-=E6=9B=BF=E6=8D=A2=E8=A3=85=E9=85=8D=E4=BB=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=BA=94=E6=A0=B9=E6=8D=AEproduct=5Fsn?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=9F=A5=E8=AF=A2=EF=BC=8C=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=BD=BF=E7=94=A8cust=5Fsn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/apiservice/controller/base/MesWhiteController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java index 1b0ae92..49442ae 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesConfigService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesProduceSnExtService; import cn.estsh.impp.framework.boot.util.ResultBean; import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import jodd.util.Base64; import lombok.extern.slf4j.Slf4j; @@ -43,7 +44,7 @@ public class MesWhiteController { @PostMapping("/picture") public ResultBean savePicture(@RequestBody MesPictureModel model){ - log.info("castle-保存图片开始"); + log.info("castle-保存图片开始 model={}", JSONObject.toJSONString(model)); String localUrl = mesConfigService.getCfgValue(model.getOrganizeCode(), "LOCAL_PICTURE_ABS_URL"); String fileName = localUrl+model.getFileName(); File file = new File(fileName); @@ -60,10 +61,14 @@ public class MesWhiteController { if (!StringUtils.isBlank(model.getRemoteUserName()) && !StringUtils.isBlank(model.getRemoteNginxUrl()) ){ // 构建scp命令 log.info("castle-保存图片开始-scp命令"); - String scpCommand = String.format("scp -P %s %s %s@%s:%s", model.getRemotePort() ,fileName, model.getRemoteUserName(), model.getRemoteNginxUrl(), localUrl); + String scpCommand = String.format("scp %s %s@%s:%s" ,fileName, model.getRemoteUserName(), model.getRemoteNginxUrl(), localUrl); + log.info("castle-保存图片开始-scp命令开始={}",scpCommand); + try { Runtime.getRuntime().exec(scpCommand); - } catch (IOException e) { + log.info("castle-保存图片开始-scp命令结束={}",scpCommand); + + } catch (Exception e) { log.error("调用scp命令失败,请手动同步图片:{}",fileName); } }