| | |
| | | package com.vci.ubcs.code.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.vci.ubcs.code.service.MdmEngineService; |
| | | import com.vci.ubcs.code.service.MdmIOService; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.common.validator.ComprehensiveFileValidator; |
| | | import com.vci.ubcs.flow.core.dto.FlowStatusDTO; |
| | | import com.vci.ubcs.starter.annotation.VciBusinessLog; |
| | | import com.vci.ubcs.starter.revision.model.BaseModel; |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.rmi.ServerException; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | //@AllArgsConstructor |
| | | @RequestMapping("/mdmEngineController") |
| | | @Api(value = "编码数据管理", tags = "编码数据管理") |
| | | public class MdmEngineController { |
| | |
| | | * 日志 |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * 主数据引擎服务 |
| | | */ |
| | | @Autowired |
| | | private MdmEngineService engineService; |
| | | |
| | | /** |
| | | * 主数据导入导出服务 |
| | | */ |
| | | @Autowired |
| | | private MdmIOService mdmIOService; |
| | | |
| | | /** |
| | | * 日志保存工具类 |
| | | */ |
| | | @Autowired |
| | | private SaveLogUtil saveLogUtil; |
| | | |
| | | /** |
| | | * 文件安全检查 |
| | | */ |
| | | @Autowired |
| | | private ComprehensiveFileValidator fileValidator; |
| | | |
| | | |
| | | /** |
| | | * 下载批量申请的导入模板 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入批量编辑数据 |
| | | * @param codeClassifyOid 分类的主键 |
| | |
| | | @VciBusinessLog(operateName = "导入批量编辑数据") |
| | | @PostMapping("/batchImportEdit") |
| | | public R batchImportEdit(String codeClassifyOid, String classifyAttr,MultipartFile file,HttpServletResponse response) throws Throwable { |
| | | // 使用文件安全验证器 |
| | | ComprehensiveFileValidator.UploadValidationResult validationResult = fileValidator.validateFile(file); |
| | | if (!validationResult.isValid()) { |
| | | return R.fail(validationResult.getMessage()); |
| | | } |
| | | |
| | | String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + file.getOriginalFilename(); |
| | | File file1 = new File(excelFileName); |
| | | try { |
| | |
| | | @VciBusinessLog(operateName = "批量申请编码的信息") |
| | | @PostMapping("/batchImportCode") |
| | | public R batchImportCode(String secDTOList, String codeClassifyOid, MultipartFile file, HttpServletResponse response) throws Throwable { |
| | | // 使用文件安全验证器 |
| | | ComprehensiveFileValidator.UploadValidationResult validationResult = fileValidator.validateFile(file); |
| | | if (!validationResult.isValid()) { |
| | | return R.fail(validationResult.getMessage()); |
| | | } |
| | | |
| | | CodeOrderDTO orderDTO = new CodeOrderDTO(); |
| | | orderDTO.setCodeClassifyOid(codeClassifyOid); |
| | | if(StringUtils.isNotBlank(secDTOList)){ |
| | |
| | | @VciBusinessLog(operateName = "导入编码的历史数据") |
| | | @PostMapping("/batchImportHistoryData") |
| | | public R batchImportHistoryData(String codeClassifyOid, String classifyAttr,MultipartFile file,HttpServletResponse response) throws Throwable { |
| | | // 使用文件安全验证器 |
| | | ComprehensiveFileValidator.UploadValidationResult validationResult = fileValidator.validateFile(file); |
| | | if (!validationResult.isValid()) { |
| | | return R.fail(validationResult.getMessage()); |
| | | } |
| | | |
| | | String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + file.getOriginalFilename(); |
| | | File file1 = new File(excelFileName); |
| | | try { |
| | |
| | | @VciBusinessLog(operateName = "批量申请编码的信息") |
| | | @PostMapping("/batchTopImportCode") |
| | | public R batchTopImportCode(String codeClassifyOid, String classifyAttr,MultipartFile file,HttpServletResponse response) throws Throwable { |
| | | // 使用文件安全验证器 |
| | | ComprehensiveFileValidator.UploadValidationResult result = fileValidator.validateFile(file); |
| | | if (!result.isValid()) { |
| | | return R.fail(result.getMessage()); |
| | | } |
| | | |
| | | String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + file.getOriginalFilename(); |
| | | File file1 = new File(excelFileName); |
| | | try { |
| | |
| | | * @param baseModelDTO 数据传输对象 |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping("changeStatus") |
| | | @PostMapping("/changeStatus") |
| | | public R changeStatus(@RequestBody BaseModelDTO baseModelDTO) { |
| | | engineService.changeStatus(baseModelDTO); |
| | | return R.success("操作成功!"); |
| | |
| | | return engineService.gridTableDataByClassifyOid(codeClassifyOid,templateOid,queryObject.getConditionMap(),queryObject.getPageHelper()); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 获取分类对象 |
| | | * @param redisOid |
| | | * @return |
| | |
| | | return R.data(codeImportTemplateVOs); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 从redis缓存里获取到导入正确的数据 |
| | | * @param codeClassifyOid |
| | | * @param redisOid |
| | |
| | | return mdmIOService.gridDatas(codeClassifyOid,redisOid); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 从redis缓存里获取到导入行相似项的数据 |
| | | * @param dataOid |
| | | * @param redisOid |
| | |
| | | return mdmIOService.gridRowResemble(dataOid,redisOid); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 从redis缓存里获取到导入具有相似项的数据 |
| | | * @param codeClassifyOid |
| | | * @param redisOid |
| | |
| | | return mdmIOService.gridDatas(codeClassifyOid,redisOid); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 导入数据 |
| | | * @param codeImprotSaveDatVO//数据对象 |
| | | * @return |
| | |
| | | return mdmIOService.batchImportData(codeImprotSaveDatVO.getCodeImprotSaveDatVOList(),codeImprotSaveDatVO.getClassifyAttr(),codeImprotSaveDatVO.getImprot()); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 根据数据oid从缓存中移除数据 |
| | | * @param redisOid redisid |
| | | * @param codeClassifyOid 存储规则的oid |
| | |
| | | * @param idPath 编号的路径 |
| | | * @return UI相关的信息(仅包含表单) |
| | | */ |
| | | // @VciUnCheckRight |
| | | // @VciUnCheckRight |
| | | @GetMapping("/getFormDefineByClassifyIdPath") |
| | | public MdmUIInfoVO getFormDefineByClassifyIdPath(String idPath){ |
| | | return engineService.getFormDefineByClassifyIdPath(idPath); |
| | |
| | | * @return UI相关的信息(仅包含表格) |
| | | */ |
| | | @GetMapping("/getFlowdUIInfoByClassifyOid") |
| | | public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid,String functionId,String templateId,String taskId,String modelKey){ |
| | | public MdmUIInfoVO getFlowUIInfoByClassifyOid(String codeClassifyOid,String functionId,String templateId,String taskId,String modelKey){ |
| | | return engineService.getFlowUIInfoByClassifyOid(codeClassifyOid,functionId,templateId,taskId,modelKey); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/exportGroupCodeExcel") |
| | | @VciBusinessLog(operateName = "导出集团码") |
| | | public R exportGroupCodeExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{ |
| | | public void exportGroupCodeExcel(String codeClassifyOid, HttpServletResponse response) throws IOException { |
| | | try { |
| | | String excelName = mdmIOService.exportGroupCodeExcel(codeClassifyOid); |
| | | ControllerUtil.writeFileToResponse(response,excelName); |
| | |
| | | if(StringUtils.isBlank(msg)){ |
| | | msg = "未知错误"; |
| | | } |
| | | return R.fail(msg); |
| | | // ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误.txt"; |
| | | LocalFileUtil.writeContentToFile(msg,errorFile); |
| | | ControllerUtil.writeFileToResponse(response,errorFile); |
| | | // return R.fail(msg); |
| | | } |
| | | return R.status(true); |
| | | // return R.status(true); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 集团码导入 |
| | | * @param codeClassifyOid |
| | | * @param file |
| | |
| | | */ |
| | | @PostMapping("/importGroupCode") |
| | | public R importGroupCode(String codeClassifyOid,MultipartFile file,HttpServletResponse response){ |
| | | // 使用文件安全验证器 |
| | | ComprehensiveFileValidator.UploadValidationResult result = fileValidator.validateFile(file); |
| | | if (!result.isValid()) { |
| | | return R.fail(result.getMessage()); |
| | | } |
| | | |
| | | String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + file.getOriginalFilename(); |
| | | File file1 = new File(excelFileName); |