|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|