|
|
|
@ -1,20 +1,32 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.model.MesPictureModel;
|
|
|
|
|
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 io.swagger.annotations.Api;
|
|
|
|
|
import jodd.util.Base64;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/white")
|
|
|
|
|
@Api(tags = "白名单")
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesWhiteController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesProduceSnExtService mesProduceSnExtService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesConfigService mesConfigService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/mesPartSap/{productSn}/{organizeCode}")
|
|
|
|
|
public ResultBean getPartNo(@PathVariable String productSn,@PathVariable String organizeCode){
|
|
|
|
|
|
|
|
|
@ -27,4 +39,24 @@ public class MesWhiteController {
|
|
|
|
|
return ResultBean.success("查询成功").setResultObject(partNo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/picture")
|
|
|
|
|
public ResultBean savePicture(@RequestBody MesPictureModel model){
|
|
|
|
|
|
|
|
|
|
String localUrl = mesConfigService.getCfgValue(model.getOrganizeCode(), "LOCAL_PICTURE_ABS_URL");
|
|
|
|
|
File file = new File(localUrl+model.getFileName());
|
|
|
|
|
byte[] decode = Base64.decode(model.getFile());
|
|
|
|
|
OutputStream outputStream;
|
|
|
|
|
try {
|
|
|
|
|
outputStream = Files.newOutputStream(file.toPath());
|
|
|
|
|
outputStream.write(decode);
|
|
|
|
|
outputStream.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
log.error("保存图片出错:{}",e.getMessage());
|
|
|
|
|
log.error("入参为:{}", model);
|
|
|
|
|
}
|
|
|
|
|
return ResultBean.success("查询成功");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|