Merge remote-tracking branch 'origin/uat_temp_castle_250213_44248' into uat-temp-wj-chongqingdaqu-prod

uat-temp-wj-chongqingdaqu-dev-temp-logic-20250313-45623
王杰 2 months ago
commit fdc82c4da0

@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
import io.swagger.annotations.Api;
import jodd.util.Base64;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -42,9 +43,10 @@ public class MesWhiteController {
@PostMapping("/picture")
public ResultBean savePicture(@RequestBody MesPictureModel model){
log.info("castle-保存图片开始");
String localUrl = mesConfigService.getCfgValue(model.getOrganizeCode(), "LOCAL_PICTURE_ABS_URL");
File file = new File(localUrl+model.getFileName());
String fileName = localUrl+model.getFileName();
File file = new File(fileName);
byte[] decode = Base64.decode(model.getFile());
OutputStream outputStream;
try {
@ -55,6 +57,17 @@ public class MesWhiteController {
log.error("保存图片出错:{}",e.getMessage());
log.error("入参为:{}", model);
}
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);
try {
Runtime.getRuntime().exec(scpCommand);
} catch (IOException e) {
log.error("调用scp命令失败,请手动同步图片:{}",fileName);
}
}
return ResultBean.success("查询成功");
}

@ -7,4 +7,8 @@ public class MesPictureModel {
private String file;
private String fileName;
private String organizeCode;
//nginx所在服务器ip
private String remoteNginxUrl;
private String remoteUserName;
private String remotePort;
}

Loading…
Cancel
Save