ludc
2024-10-08 435e3366a85f797ce02008698c28c9a8ca73b4a6
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
@@ -1,6 +1,7 @@
package com.vci.web.controller;
import cn.hutool.core.io.FileUtil;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.portal.data.PLTabPage;
import com.vci.corba.portal.data.PLUILayout;
@@ -211,14 +212,32 @@
    /**
     * 导入UI上下文
     * @param file 上传的文件
     * @param isCovered 是否覆盖
     * @param selectBtm 选择导入到的业务类型
     * @return
     */
    @PostMapping("/impUiContextData")
    public BaseResult impUIContextData(MultipartFile file){try {
        return uiManagerService.impUIContextData(file);
    }catch (Throwable e) {
        throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
    }
    @PostMapping("/impUIContextData")
    public BaseResult impUIContextData(MultipartFile file, boolean isCovered,String selectBtm){
        File file1 = null;
        try {
            //覆盖,不需要传file
            if(!isCovered){
                String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
                file1 = new File(excelFileName);
                file.transferTo(new File(excelFileName));
            }
            if (file != null || isCovered) {
                return uiManagerService.impUIContextData(file1, isCovered,selectBtm);
            } else {
                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"无导入的文件"});
            }
        }catch (Throwable e) {
            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
        }finally {
            if(!isCovered){
                file1.delete();
            }
        }
    }
    /**
@@ -378,6 +397,102 @@
        }
    }
    /**
     * 业务类型下拉查询
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    @GetMapping( "/getBtmDatasByPage")
    @VciBusinessLog(operateName = "业务类型下拉查询")
    public BaseResult getBtmDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getBtmDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "业务类型下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * 链接类型下拉查询
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    @GetMapping( "/getLinkDatasByPage")
    @VciBusinessLog(operateName = "链接类型下拉查询")
    public BaseResult getLinkDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getLinkDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "链接类型下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * UI定义下拉查询(templateType为UI定义时的选择对象下拉查询)
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    @GetMapping( "/getUILayoutDatasByPage")
    @VciBusinessLog(operateName = "UI定义下拉查询")
    public BaseResult getUILayoutDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getUILayoutDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "UI定义下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * 选择模板下拉查询
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    @GetMapping( "/getPortalVIDatasByPage")
    @VciBusinessLog(operateName = "选择模板下拉查询")
    public BaseResult getPortalVIDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getPortalVIDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "选择模板下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    /**
     * 查询模板下拉查询
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    @GetMapping( "/getQTInfoDatasByPage")
    @VciBusinessLog(operateName = "查询模板下拉查询")
    public BaseResult getQTInfoDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getQTInfoDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "查询模板下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    //页面设计下配置按钮相关接口
    /**
     * 获取页签区域按钮配置信息
@@ -403,9 +518,9 @@
     * @return 保存结果
     */
    @PostMapping("/addTapButton")
    public BaseResult addTapButton(@RequestBody PLTabButtonVO tabButtonVO){
    public BaseResult addTabButton(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.addTapButton(tabButtonVO);
            return uiManagerService.addTabButton(tabButtonVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "按钮配置信息添加时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
@@ -419,10 +534,10 @@
     * @param  tabButtonVO
     * @return 修改结果
     */
    @PutMapping("/updateTapButton")
    public BaseResult updateTapButton(@RequestBody PLTabButtonVO tabButtonVO){
    @PutMapping("/updateTapbutton")
    public BaseResult updateTabButton(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.updateTapButton(tabButtonVO);
            return uiManagerService.updateTabButton(tabButtonVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "修改按钮配置信息时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
@@ -437,9 +552,9 @@
     * @return
     */
    @DeleteMapping("/deleteTapButton")
    public BaseResult deleteTapButton(@RequestBody PLTabButtonVO tabButtonVO){
    public BaseResult deleteTabButton(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.deleteTapButton(tabButtonVO) ? BaseResult.success("删除单个按钮配置成功!"):BaseResult.fail("删除单个按钮配置失败!");
            return uiManagerService.deleteTabButton(tabButtonVO) ? BaseResult.success("删除单个按钮配置成功!"):BaseResult.fail("删除单个按钮配置失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "删除单个按钮配置时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
@@ -517,4 +632,22 @@
        }
    }
    /**
     * 通过业务类型获取UI上下文包含其下关联的区域定义>页面定义等所有关联数据,归纳成tree结构
     * @param btmName
     * @param level
     * @return
     */
    @GetMapping( "/getAllLevelTreeByBtm")
    public BaseResult getAllLevelTreeByBtm(String btmName,String level){
        try {
            return BaseResult.success(uiManagerService.getAllLevelTreeByBtm(btmName,level));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取UI树时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
}