补图功能
parent
3ead1c76f9
commit
1072fa672e
@ -0,0 +1,57 @@
|
|||||||
|
package com.shxy.xymanager_admin.controller;
|
||||||
|
|
||||||
|
import com.shxy.xymanager_common.base.BaseController;
|
||||||
|
import com.shxy.xymanager_common.base.ResponseReult;
|
||||||
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||||
|
import com.shxy.xymanager_common.bean.ServiceStatus;
|
||||||
|
import com.shxy.xymanager_service.service.TerminalPhotoService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
@Api(value = "补图片", tags = "补图片相关")
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class UpPhotoController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TerminalPhotoService terminalPhotoService;
|
||||||
|
|
||||||
|
@PostMapping("upload")
|
||||||
|
@ApiOperation("处理icd文件")
|
||||||
|
public ResponseReult<String> upload(@RequestParam("file") MultipartFile file,
|
||||||
|
@RequestParam(value = "termid",required = false) Integer termid,
|
||||||
|
@RequestParam(value = "cmdid",required = false) String cmdid,
|
||||||
|
@RequestParam(value = "channel",required = false) Integer channel,
|
||||||
|
@RequestParam(value = "phototime",required = false) BigInteger phototime) throws Exception {
|
||||||
|
// if (files != null && files.length > 0) {
|
||||||
|
// for (MultipartFile file : files) {
|
||||||
|
// if (StrUtil.isNotBlank(file.getOriginalFilename())) {
|
||||||
|
// int lastIndexOf = file.getOriginalFilename().lastIndexOf(".");
|
||||||
|
// String originalName = file.getOriginalFilename();
|
||||||
|
// String newName = System.currentTimeMillis() + file.getOriginalFilename().substring(lastIndexOf);
|
||||||
|
// String relativePath = "/sampleRecord/" + DateUtil.format(new Date(), "yyyyMMdd") + '/';
|
||||||
|
// fileService.uploadSampleAttachment(weblogid, originalName, relativePath, newName,
|
||||||
|
// file.getInputStream(), tid);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//保存在服务器中
|
||||||
|
ServiceBody<String> serviceBody = terminalPhotoService.uploadPhoto(file, termid, cmdid, channel, phototime);
|
||||||
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
||||||
|
return ResponseReult.success(serviceBody.getData());
|
||||||
|
} else {
|
||||||
|
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue