package com.vci.ubcs.code.controller;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
import com.vci.ubcs.code.dto.CodeOrderDTO;
|
import com.vci.ubcs.code.dto.CodeOrderSecDTO;
|
import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
|
import com.vci.ubcs.code.service.MdmIOService;
|
import com.vci.ubcs.code.vo.pagemodel.CodeImProtRusultVO;
|
import com.vci.ubcs.code.vo.pagemodel.MdmUIInfoVO;
|
import com.vci.ubcs.starter.annotation.VciBusinessLog;
|
import com.vci.ubcs.starter.util.LocalFileUtil;
|
import com.vci.ubcs.starter.web.pagemodel.DataGrid;
|
import com.vci.ubcs.starter.web.util.ControllerUtil;
|
import com.vci.ubcs.starter.web.util.LangBaseUtil;
|
import io.swagger.annotations.Api;
|
import lombok.AllArgsConstructor;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springblade.core.tool.api.R;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.File;
|
import java.io.IOException;
|
import java.nio.charset.StandardCharsets;
|
import java.util.List;
|
import java.util.Map;
|
|
@RestController
|
//@AllArgsConstructor
|
@RequestMapping("/mdmEngineController")
|
@Api(value = "编码数据管理", tags = "编码数据管理")
|
public class MdmEngineController {
|
//
|
//// /**
|
//// * 日志
|
//// */
|
// private Logger logger = LoggerFactory.getLogger(getClass());
|
// /**
|
// * 主数据引擎服务
|
// */
|
// @Autowired
|
// private MdmEngineService engineService;
|
// /**
|
// * 主数据导入导出服务
|
// */
|
// @Autowired
|
// private MdmIOService mdmIOService;
|
//
|
// /**
|
// * 下载批量申请的导入模板
|
// * @param codeClassifyOid 分类的主键
|
// * @param response 响应对象
|
// * @throws IOException 抛出异常
|
// */
|
// @GetMapping("/downloadImportExcel")
|
// @VciBusinessLog(operateName = "下载批量申请编码的导入模板")
|
// public void downloadImportExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{
|
// String excelName = mdmIOService.createImportExcel(codeClassifyOid,false);
|
// try {
|
// ControllerUtil.writeFileToResponse(response,excelName);
|
// } catch (Throwable e) {
|
// //如果出错,把错误信息写到text
|
// String msg = LangBaseUtil.getErrorMsg(e);
|
// if(StringUtils.isBlank(msg)){
|
// msg = "未知错误";
|
// }
|
// ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null);
|
// }
|
// }
|
//
|
//
|
// /**
|
// * 批量申请编码的信息
|
// * @param secDTOList 申请编码的信息,必须包含码段和分类主键的信息
|
// * @param file 文件的内容
|
// */
|
// @VciBusinessLog(operateName = "批量申请编码的信息")
|
// @PostMapping("/batchImportCode")
|
// public R batchImportCode(String secDTOList, String codeClassifyOid, MultipartFile file, HttpServletResponse response) throws Throwable {
|
// CodeOrderDTO orderDTO = new CodeOrderDTO();
|
// orderDTO.setCodeClassifyOid(codeClassifyOid);
|
// if(StringUtils.isNotBlank(secDTOList)){
|
// List<CodeOrderSecDTO> secDTOS = JSONObject.parseArray(secDTOList, CodeOrderSecDTO.class);
|
// orderDTO.setSecDTOList(secDTOS);
|
// }
|
// String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
|
// File file1 = new File(excelFileName);
|
// try {
|
// file.transferTo(new File(excelFileName));
|
// CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1);
|
// if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){
|
// //放到map里
|
// R result = R.fail("导入失败");
|
// if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) {
|
// String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath());
|
// codeImProtRusultVO.setFileOid(filedUUid);
|
// }
|
// result.setData(codeImProtRusultVO);
|
// return result;
|
// }else {
|
// return R.success("操作成功!");
|
// }
|
// }catch (Throwable e) {
|
// logger.error("导入错误",e);
|
// String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误.txt";
|
// LocalFileUtil.writeContentToFile( LangBaseUtil.getErrorMsg(e),errorFile);
|
// String uuid=ControllerUtil.putErrorFile(errorFile);
|
// CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO();
|
// codeImProtRusultVO.setRedisUuid("");
|
// codeImProtRusultVO.setFileOid(uuid);
|
// codeImProtRusultVO.setFilePath(errorFile);
|
// R result = R.fail("导入失败");
|
// result.setData(codeImProtRusultVO);
|
//// result.setObj(codeImProtRusultVO);
|
// return result;
|
// }finally {
|
// file1.delete();
|
// }
|
// }
|
//
|
//
|
// /**
|
// * 修改状态
|
// * @param baseModelDTO 数据传输对象
|
// * @return 执行结果
|
// */
|
// @PostMapping("changeStatus")
|
// public R changeStatus(BaseModelDTO baseModelDTO) {
|
// engineService.changeStatus(baseModelDTO);
|
// return R.success("操作成功!");
|
// }
|
//
|
//
|
// /**
|
// * 申请编码保存
|
// * @param orderDTO 编码申请相关的信息,需要有属性和码段相关的信息
|
// * @return 执行结果
|
// */
|
// @PostMapping("/addSaveCode")
|
// @VciBusinessLog(operateName = "申请单个编码")
|
// public R addSaveCode(@RequestBody CodeOrderDTO orderDTO){
|
// return R.success(engineService.addSaveCode(orderDTO));
|
// }
|
//
|
//
|
// /**
|
// * 使用模板的主键获取表单的定义
|
// * @param templateOid 模板的主键
|
// * @param codeClassifyOid 使用模板的分类主键
|
// * @return UI相关的信息(仅包含表单)
|
// */
|
// @GetMapping("/getFormDefineByTemplateOid")
|
// public MdmUIInfoVO getFormDefineByTemplateOid(String templateOid, String codeClassifyOid){
|
// return engineService.getFormDefineByTemplateOid(templateOid,codeClassifyOid);
|
// }
|
//
|
// /**
|
// * 相似项查询
|
// * @param orderDTO 编码的相关信息
|
// * @return 数据列表
|
// */
|
// @PostMapping("/resembleQuery")
|
// public DataGrid<Map<String,String>> resembleQuery(@RequestBody CodeOrderDTO orderDTO){
|
// return engineService.resembleQuery(orderDTO);
|
// }
|
//
|
// /**
|
// * 修改单条主题库的数据
|
// * @param orderDTO 编码申请相关的信息,不需要码段的信息
|
// * @return 执行结果
|
// */
|
// @PutMapping("/editSaveCode")
|
// @VciBusinessLog(operateName = "修改编码数据")
|
// public R editSaveCode(@RequestBody CodeOrderDTO orderDTO){
|
// engineService.editSaveCode(orderDTO);
|
// return R.success("修改成功!");
|
// }
|
|
}
|