| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vci.ubcs.code.dto.CodeDeleteBatchDTO; |
| | | import com.vci.ubcs.code.dto.CodeOrderDTO; |
| | | import com.vci.ubcs.code.dto.CodeOrderSecDTO; |
| | | import com.vci.ubcs.code.applyjtcodeservice.vo.BaseModelVO; |
| | | import com.vci.ubcs.code.dto.*; |
| | | import com.vci.ubcs.code.dto.datapush.BaseModelDTO; |
| | | 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.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.flow.core.dto.FlowStatusDTO; |
| | | import com.vci.ubcs.starter.annotation.VciBusinessLog; |
| | | import com.vci.ubcs.starter.revision.model.BaseModel; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.rmi.ServerException; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | @Api(value = "编码数据管理", tags = "编码数据管理") |
| | | public class MdmEngineController { |
| | | |
| | | // /** |
| | | // * 日志 |
| | | // */ |
| | | /** |
| | | * 日志 |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | /** |
| | | * 主数据引擎服务 |
| | |
| | | */ |
| | | @Autowired |
| | | private MdmIOService mdmIOService; |
| | | |
| | | |
| | | /** |
| | | * 下载批量申请的导入模板 |
| | |
| | | ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载批量申请的导入模板 |
| | | * @param codeClassifyOid 分类的主键 |
| | |
| | | } |
| | | ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出主题库的数据 |
| | | * @param exportAttrDTO 导出的相关配置 |
| | | */ |
| | | @VciBusinessLog(operateName = "导出主题库的数据") |
| | | @PostMapping("/exportCode") |
| | | public void exportCode(CodeExportAttrDTO exportAttrDTO, HttpServletResponse response) throws IOException { |
| | | String excelName = mdmIOService.exportCode(exportAttrDTO); |
| | | try { |
| | | ControllerUtil.writeFileToResponse(response,excelName); |
| | | } catch (Throwable e) { |
| | | //如果出错,把错误信息写到text |
| | | String msg = LangBaseUtil.getErrorMsg(e); |
| | | String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误.txt"; |
| | | LocalFileUtil.writeContentToFile(msg,errorFile); |
| | | ControllerUtil.writeFileToResponse(response,errorFile); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | codeImProtRusultVO.setFilePath(errorFile); |
| | | R r = R.fail("导入失败"); |
| | | r.setData(codeImProtRusultVO); |
| | | |
| | | |
| | | return r; |
| | | }finally { |
| | | file1.delete(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导入历史数据 |
| | | * @param codeClassifyOid 分类的主键 |
| | |
| | | R r = R.fail("导入失败"); |
| | | r.setData(codeImProtRusultVO); |
| | | |
| | | |
| | | return r; |
| | | }finally { |
| | | file1.delete(); |
| | |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping("changeStatus") |
| | | public R changeStatus(BaseModelDTO baseModelDTO) { |
| | | public R changeStatus(@RequestBody BaseModelDTO baseModelDTO) { |
| | | engineService.changeStatus(baseModelDTO); |
| | | return R.success("操作成功!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 申请编码保存 |
| | |
| | | public R addSaveCode(@RequestBody CodeOrderDTO orderDTO) throws Exception { |
| | | return R.success(engineService.addSaveCode(orderDTO)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用模板的主键获取表单的定义 |
| | |
| | | //TODO后续可以定义查询模板来查询 |
| | | return engineService.gridTableDataByClassifyOid(codeClassifyOid,templateOid,queryObject.getConditionMap(),queryObject.getPageHelper()); |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * 获取分类对象 |
| | |
| | | * @return 分类码值的内容 |
| | | */ |
| | | @GetMapping("/listCodeClassifyValueBySecOid") |
| | | public DataGrid<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid){ |
| | | public IPage<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid){ |
| | | List<CodeClassifyValueVO> valueVOS = engineService.listCodeClassifyValueBySecOid(classifySecOid, parentClassifyValueOid); |
| | | DataGrid<CodeClassifyValueVO> dataGrid = new DataGrid<>(); |
| | | dataGrid.setData(valueVOS); |
| | | dataGrid.setTotal(valueVOS==null?0:valueVOS.size()); |
| | | return dataGrid; |
| | | IPage<CodeClassifyValueVO> valueVOIPage = new Page<>(); |
| | | valueVOIPage.setRecords(valueVOS); |
| | | valueVOIPage.setTotal(valueVOS==null?0:valueVOS.size()); |
| | | return valueVOIPage; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 编码规则的内容 |
| | | */ |
| | | @GetMapping("/getCodeRuleByClassifyOid") |
| | | // @VciUnCheckRight |
| | | // @VciUnCheckRight |
| | | public R<CodeRuleVO> getCodeRuleByClassifyOid(String codeClassifyOid){ |
| | | return R.data(engineService.getCodeRuleByClassifyOid(codeClassifyOid)); |
| | | } |
| | |
| | | return engineService.getUIInfoByClassifyOid(codeClassifyOid,functionId); |
| | | } |
| | | |
| | | /** |
| | | * 使用分类获取表格的定义 |
| | | * @param codeClassifyOid 分类主键 |
| | | * @param functionId 功能的编号 |
| | | * @return UI相关的信息(仅包含表格) |
| | | */ |
| | | @GetMapping("/getFlowdUIInfoByClassifyOid") |
| | | public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid,String functionId,String templateId,String taskId,String modelKey){ |
| | | return engineService.getFlowUIInfoByClassifyOid(codeClassifyOid,functionId,templateId,taskId,modelKey); |
| | | } |
| | | |
| | | @GetMapping("/thisistest") |
| | | @ResponseBody |
| | |
| | | * @param referConfigVO 参照的配置信息 |
| | | * @return 执行的结果 |
| | | */ |
| | | @GetMapping("/defaultReferDataGrid") |
| | | public DataGrid<BaseModel> defaultReferDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject){ |
| | | @RequestMapping(value = "/defaultReferDataGrid",method = {RequestMethod.POST, RequestMethod.GET}) |
| | | public IPage<BaseModelVO> defaultReferDataGrid(UIFormReferVO referConfigVO, BaseQueryObject baseQueryObject){ |
| | | return engineService.referDataGrid(referConfigVO,baseQueryObject); |
| | | } |
| | | |
| | |
| | | return engineService.referTree(referConfigVO,queryObject); |
| | | } |
| | | |
| | | /** |
| | | * 流程中变更状态的简易接口 |
| | | * @param flowDTO 流程中携带的body |
| | | * @return |
| | | */ |
| | | @PostMapping("/processChangeStatus") |
| | | public R processChangeStatus(@RequestBody FlowStatusDTO flowDTO){ |
| | | return engineService.processChangeStatus(flowDTO); |
| | | } |
| | | |
| | | /** |
| | | * 标准申请和修订用 |
| | | * @param codeBZApplyDTO 编码申请相关的信息,需要有属性和码段相关的信息 |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping("/addSaveBZ") |
| | | @VciBusinessLog(operateName = "申请单个编码") |
| | | public R addSaveBZ (@RequestBody CodeBZApplyDTO codeBZApplyDTO) throws Exception { |
| | | return R.success(engineService.addSaveBZ(codeBZApplyDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 下载批量申请的导入模板 |
| | | * @param codeClassifyOid 分类的主键 |
| | | * @param response 响应对象 |
| | | * @throws IOException 抛出异常 |
| | | */ |
| | | @GetMapping("/exportGroupCodeExcel") |
| | | @VciBusinessLog(operateName = "导出集团码") |
| | | public void exportGroupCodeExcel(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); |
| | | } |
| | | } |
| | | } |