|
|
@ -1,69 +1,69 @@
|
|
|
|
//package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.controller.base;
|
|
|
|
//
|
|
|
|
|
|
|
|
//import cn.estsh.i3plus.ext.mes.api.base.IMesMediaFileCfgService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesMediaFileCfgService;
|
|
|
|
//import cn.estsh.i3plus.ext.mes.apiservice.config.HuaWeiCloudObsConfig;
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.config.HuaWeiCloudObsConfig;
|
|
|
|
//import cn.estsh.i3plus.ext.mes.apiservice.utils.HuaWeiOBSUtil;
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.utils.HuaWeiOBSUtil;
|
|
|
|
//import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.constant.MesCommonConstant;
|
|
|
|
//import cn.estsh.i3plus.icloud.core.sdk.ICoreSysFileCloud;
|
|
|
|
import cn.estsh.i3plus.icloud.core.sdk.ICoreSysFileCloud;
|
|
|
|
//import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
//import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
|
|
|
//import cn.estsh.i3plus.pojo.mes.bean.MesMediaFileCfg;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesMediaFileCfg;
|
|
|
|
//import cn.estsh.i3plus.pojo.mes.repository.MesMediaFileCfgRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesMediaFileCfgRepository;
|
|
|
|
//import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
//import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
//import cn.estsh.impp.framework.boot.fileservice.ImppFileService;
|
|
|
|
import cn.estsh.impp.framework.boot.fileservice.ImppFileService;
|
|
|
|
//import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
//import com.obs.services.ObsClient;
|
|
|
|
import com.obs.services.ObsClient;
|
|
|
|
//import com.obs.services.exception.ObsException;
|
|
|
|
import com.obs.services.exception.ObsException;
|
|
|
|
//import com.obs.services.model.*;
|
|
|
|
import com.obs.services.model.*;
|
|
|
|
//import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
//import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
//import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
//import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
//import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
//import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
//
|
|
|
|
|
|
|
|
//import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
//import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
//import java.io.FileInputStream;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
//import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
//import java.io.OutputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
//import java.net.URLEncoder;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
//import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
//import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
//import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
|
//
|
|
|
|
|
|
|
|
///**
|
|
|
|
/**
|
|
|
|
// * @Description: 媒体文件维护
|
|
|
|
* @Description: 媒体文件维护
|
|
|
|
// * @CreateDate 2024/6/6
|
|
|
|
* @CreateDate 2024/6/6
|
|
|
|
// * @Author gsz
|
|
|
|
* @Author gsz
|
|
|
|
// */
|
|
|
|
*/
|
|
|
|
//@Api("媒体文件维护")
|
|
|
|
@Api("媒体文件维护")
|
|
|
|
//@RestController
|
|
|
|
@RestController
|
|
|
|
//@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesMediaFileCfg")
|
|
|
|
@RequestMapping(MesCommonConstant.MES_YANFEN + "/mesMediaFileCfg")
|
|
|
|
//public class MesMediaFileCfgController extends BaseMesController<MesMediaFileCfg> {
|
|
|
|
public class MesMediaFileCfgController extends BaseMesController<MesMediaFileCfg> {
|
|
|
|
// public static final Logger LOGGER = LoggerFactory.getLogger(MesMediaFileCfgController.class);
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(MesMediaFileCfgController.class);
|
|
|
|
// @Autowired
|
|
|
|
@Autowired
|
|
|
|
// private MesMediaFileCfgRepository mediaFileCfgRepository;
|
|
|
|
private MesMediaFileCfgRepository mediaFileCfgRepository;
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
@Autowired
|
|
|
|
// private ICoreSysFileCloud coreSysFileCloud;
|
|
|
|
private ICoreSysFileCloud coreSysFileCloud;
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// @Autowired
|
|
|
|
// @Autowired
|
|
|
|
// HuaWeiCloudObsConfig obsConfig;
|
|
|
|
// HuaWeiCloudObsConfig obsConfig;
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
@Autowired
|
|
|
|
// private IMesMediaFileCfgService mediaFileCfgService;
|
|
|
|
private IMesMediaFileCfgService mediaFileCfgService;
|
|
|
|
// /**
|
|
|
|
/**
|
|
|
|
// * fastDfs客户端
|
|
|
|
* fastDfs客户端
|
|
|
|
// */
|
|
|
|
*/
|
|
|
|
// @Autowired
|
|
|
|
@Autowired
|
|
|
|
// private ImppFileService fileService;
|
|
|
|
private ImppFileService fileService;
|
|
|
|
// //默认大小
|
|
|
|
//默认大小
|
|
|
|
// private static final long FILE_SIZE = 1024 * 1024;
|
|
|
|
private static final long FILE_SIZE = 1024 * 1024;
|
|
|
|
//
|
|
|
|
|
|
|
|
// @PostMapping(value = "/obs/upload")
|
|
|
|
// @PostMapping(value = "/obs/upload")
|
|
|
|
// @ApiOperation(value = "上传媒体文件")
|
|
|
|
// @ApiOperation(value = "上传媒体文件")
|
|
|
|
// public ResultBean obsUploadFile(@RequestParam("file") MultipartFile file, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
|
// public ResultBean obsUploadFile(@RequestParam("file") MultipartFile file, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
@ -128,8 +128,8 @@
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// @ApiOperation("查看文件")
|
|
|
|
// @ApiOperation("查看文件")
|
|
|
|
// @GetMapping("/obs/query-file")
|
|
|
|
// @GetMapping("/obs/query-file")
|
|
|
|
// public ResultBean queryObjectFile(HttpServletResponse response, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
|
// public ResultBean queryObjectFile(HttpServletResponse response, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
@ -157,7 +157,7 @@
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
|
|
|
|
// @ApiOperation("创建桶")
|
|
|
|
// @ApiOperation("创建桶")
|
|
|
|
// @GetMapping("/obs/createMesBucket")
|
|
|
|
// @GetMapping("/obs/createMesBucket")
|
|
|
|
// public ResultBean CreateMesBucket() {
|
|
|
|
// public ResultBean CreateMesBucket() {
|
|
|
@ -198,7 +198,7 @@
|
|
|
|
// return ResultBean.success("创建成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
// return ResultBean.success("创建成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
|
|
|
|
// @ApiOperation("列举桶")
|
|
|
|
// @ApiOperation("列举桶")
|
|
|
|
// @GetMapping("/obs/getObsClient")
|
|
|
|
// @GetMapping("/obs/getObsClient")
|
|
|
|
// public ResultBean getObsClient() {
|
|
|
|
// public ResultBean getObsClient() {
|
|
|
@ -217,7 +217,7 @@
|
|
|
|
// return ResultBean.success("创建成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(buckets);
|
|
|
|
// return ResultBean.success("创建成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(buckets);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
|
|
|
|
// @PostMapping(value = "/media-file/insert")
|
|
|
|
// @PostMapping(value = "/media-file/insert")
|
|
|
|
// @ApiOperation(value = "上传媒体文件")
|
|
|
|
// @ApiOperation(value = "上传媒体文件")
|
|
|
|
// public ResultBean insertProduceCtgyPicture(@RequestParam("file") MultipartFile file, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
|
// public ResultBean insertProduceCtgyPicture(@RequestParam("file") MultipartFile file, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
@ -296,37 +296,37 @@
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//// @PostMapping(value = "/sys-upload")
|
|
|
|
// @PostMapping(value = "/sys-upload")
|
|
|
|
//// @ApiOperation(value = "系统导入")
|
|
|
|
// @ApiOperation(value = "系统导入")
|
|
|
|
//// public ResultBean insertPartFurnace(@RequestParam("file") MultipartFile file, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
|
// public ResultBean insertPartFurnace(@RequestParam("file") MultipartFile file, MesMediaFileCfg mesMediaFileCfg) {
|
|
|
|
//// try {
|
|
|
|
// try {
|
|
|
|
//// if (file.isEmpty()) {
|
|
|
|
// if (file.isEmpty()) {
|
|
|
|
//// throw ImppExceptionBuilder.newInstance()
|
|
|
|
// throw ImppExceptionBuilder.newInstance()
|
|
|
|
//// .setSystemID(CommonEnumUtil.SOFT_TYPE.REPORT.getCode())
|
|
|
|
// .setSystemID(CommonEnumUtil.SOFT_TYPE.REPORT.getCode())
|
|
|
|
//// .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
// .setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
//// .setErrorDetail("不允许上传空文件")
|
|
|
|
// .setErrorDetail("不允许上传空文件")
|
|
|
|
//// .build();
|
|
|
|
// .build();
|
|
|
|
//// }
|
|
|
|
// }
|
|
|
|
//// SysFile sysFile = fileService.upload(file, CommonEnumUtil.SOFT_TYPE.MES.getValue());
|
|
|
|
// SysFile sysFile = fileService.upload(file, CommonEnumUtil.SOFT_TYPE.MES.getValue());
|
|
|
|
////// MesFile mesFile = fileService.uploadMesFile(file, AuthUtil.getOrganizeCode(), AuthUtil.getSessionUser().getUserName());
|
|
|
|
//// MesFile mesFile = fileService.uploadMesFile(file, AuthUtil.getOrganizeCode(), AuthUtil.getSessionUser().getUserName());
|
|
|
|
////
|
|
|
|
|
|
|
|
//// //属性验证
|
|
|
|
|
|
|
|
//// ValidatorBean.beginValid(mesMediaFileCfg)
|
|
|
|
|
|
|
|
//// .notNull("modelNo", mesMediaFileCfg.getFileType());
|
|
|
|
|
|
|
|
////
|
|
|
|
|
|
|
|
//// MesMediaFileCfg mesMediaFileCfg1 = new MesMediaFileCfg();
|
|
|
|
|
|
|
|
//// mesMediaFileCfg1.setFileName(sysFile.getDfsFileName());
|
|
|
|
|
|
|
|
//// mesMediaFileCfg1.setFileUrl(sysFile.getFilePath());
|
|
|
|
|
|
|
|
//// mesMediaFileCfg1.setFileType(mesMediaFileCfg.getFileType());
|
|
|
|
|
|
|
|
//// mediaFileCfgRepository.save(mesMediaFileCfg1);
|
|
|
|
|
|
|
|
////
|
|
|
|
|
|
|
|
//// return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
|
|
|
//// } catch (ImppBusiException imppException) {
|
|
|
|
|
|
|
|
//// LOGGER.error(imppException.getErrorMsg() + ":{}", imppException.getErrorDetail(), imppException);
|
|
|
|
|
|
|
|
//// return ResultBean.fail(imppException);
|
|
|
|
|
|
|
|
//// } catch (Exception e) {
|
|
|
|
|
|
|
|
//// return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//}
|
|
|
|
// //属性验证
|
|
|
|
|
|
|
|
// ValidatorBean.beginValid(mesMediaFileCfg)
|
|
|
|
|
|
|
|
// .notNull("modelNo", mesMediaFileCfg.getFileType());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// MesMediaFileCfg mesMediaFileCfg1 = new MesMediaFileCfg();
|
|
|
|
|
|
|
|
// mesMediaFileCfg1.setFileName(sysFile.getDfsFileName());
|
|
|
|
|
|
|
|
// mesMediaFileCfg1.setFileUrl(sysFile.getFilePath());
|
|
|
|
|
|
|
|
// mesMediaFileCfg1.setFileType(mesMediaFileCfg.getFileType());
|
|
|
|
|
|
|
|
// mediaFileCfgRepository.save(mesMediaFileCfg1);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
|
|
|
|
|
|
|
// } catch (ImppBusiException imppException) {
|
|
|
|
|
|
|
|
// LOGGER.error(imppException.getErrorMsg() + ":{}", imppException.getErrorDetail(), imppException);
|
|
|
|
|
|
|
|
// return ResultBean.fail(imppException);
|
|
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
|
|
// return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|