| | |
| | | package com.vci.web.controller; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.portal.data.PLTabPage; |
| | | import com.vci.corba.portal.data.PLUILayout; |
| | | import com.vci.dto.OsBtmTypeDTO; |
| | | import com.vci.dto.RoleRightDTO; |
| | | import com.vci.dto.UIAuthorDTO; |
| | | import com.vci.pagemodel.PLDefinationVO; |
| | | import com.vci.pagemodel.PLTabButtonVO; |
| | | import com.vci.pagemodel.PLUILayoutCloneVO; |
| | | import com.vci.starter.web.annotation.log.VciBusinessLog; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.Tree; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.util.ControllerUtil; |
| | | import com.vci.starter.web.util.LocalFileUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.service.OsBtmServiceI; |
| | | import com.vci.web.service.UIManagerServiceI; |
| | | import com.vci.web.util.Func; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | 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.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * UI定义控制层 |
| | |
| | | * @return 删除结果 |
| | | */ |
| | | @DeleteMapping("/delUIContextData") |
| | | public BaseResult delUIContextData(String[] oids){ |
| | | public BaseResult delUIContextData(String[] oids,String plRelatedType){ |
| | | try { |
| | | return uiManagerService.delUIContextData(oids) ? BaseResult.success("UI上下文删除成功!"):BaseResult.fail("UI上下文删除失败!"); |
| | | return uiManagerService.delUIContextData(oids,plRelatedType) ? BaseResult.success("UI上下文删除成功!"):BaseResult.fail("UI上下文删除失败!"); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "删除UI上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | |
| | | * pluiLayoutCloneVO 克隆参数对象 |
| | | * @return 克隆结构 |
| | | */ |
| | | @PostMapping("/cloneUiContextData") |
| | | public BaseResult cloneUiContextData(@RequestBody PLUILayoutCloneVO pluiLayoutCloneVO){ |
| | | @PostMapping("/cloneUIContextData") |
| | | public BaseResult cloneUIContextData(@RequestBody PLUILayoutCloneVO pluiLayoutCloneVO){ |
| | | try { |
| | | return uiManagerService.cloneUiContextData(pluiLayoutCloneVO) ? BaseResult.success("UI上下文克隆成功!"):BaseResult.fail("UI上下文克隆失败!"); |
| | | return uiManagerService.cloneUIContextData(pluiLayoutCloneVO) ? BaseResult.success("UI上下文克隆成功!"):BaseResult.fail("UI上下文克隆失败!"); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "UI上下文克隆时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询要导出UI上下文树 |
| | | * @param expDatas |
| | | * @return |
| | | * @throws PLException |
| | | */ |
| | | @GetMapping( "/getExpContextTree") |
| | | @VciBusinessLog(operateName = "查询要导出UI上下文树") |
| | | public BaseResult getExpContextTree(String[] expDatas){ |
| | | try { |
| | | return BaseResult.success(uiManagerService.getExpContextTree(Arrays.asList(expDatas)),"Success"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "查询要导出UI上下文树时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出UI上下文 |
| | | * name 链接类型名称 |
| | | * @return |
| | | */ |
| | | @PostMapping("/expUIContextData") |
| | | public void expUIContextData(@RequestBody Map<String,String> expConditionMap, HttpServletResponse response) throws PLException, IOException { |
| | | try { |
| | | String excelPath = uiManagerService.expUIContextData(expConditionMap); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | FileUtil.del(LocalFileUtil.getDefaultTempFolder() + File.separator); |
| | | } catch (Exception e) { |
| | | String msg = "导出UI上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | try { |
| | | //出错时 |
| | | e.printStackTrace(); |
| | | ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null); |
| | | } catch (IOException ioException) { |
| | | ioException.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导入UI上下文 |
| | | * @param file 上传的文件 |
| | | * @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); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据上下文ID和区域类型,按顺序获取当前区域的tab页 |
| | | * @param contextId |
| | | * @param areaType |
| | | * @return |
| | | */ |
| | | @GetMapping( "/getTabByContextIdAndType") |
| | | @VciBusinessLog(operateName = "根据上下文ID和区域类型,按顺序获取当前区域的tab页") |
| | | public BaseResult<DataGrid> getTabByContextIdAndType(String contextId, int areaType){ |
| | | try { |
| | | return BaseResult.dataGrid(uiManagerService.getTabByContextIdAndType(contextId,areaType)); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "根据上下文ID和区域类型,按顺序获取当前区域的tab时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建区域数据 |
| | | * @param plTabPage |
| | | * @return 保存结果 |
| | | */ |
| | | @PostMapping("/addTabData") |
| | | public BaseResult addTabData(@RequestBody PLTabPage plTabPage){ |
| | | try { |
| | | return uiManagerService.addTabData(plTabPage) ? BaseResult.success("创建成功!"):BaseResult.fail("创建失败!"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "创建时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改区域数据 |
| | | * @param plTabPage |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping("/updateTabData") |
| | | public BaseResult updateTabData(@RequestBody PLTabPage plTabPage){ |
| | | try { |
| | | return uiManagerService.updateTabData(plTabPage) ? BaseResult.success("修改成功!"):BaseResult.fail("修改失败!"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "修改时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * UI解析类正则检查 |
| | | * @param extAttr |
| | | * @return |
| | | */ |
| | | @GetMapping("/checkTabPageExtAttrIsOk") |
| | | public BaseResult checkTabPageExtAttrIsOk(String extAttr){ |
| | | try { |
| | | return uiManagerService.checkTabPageExtAttrIsOk(extAttr); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "UI解析类正则检查时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除区域定义数据 |
| | | * @param oids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteTabData") |
| | | public BaseResult deleteTabData(String[] oids){ |
| | | try { |
| | | return uiManagerService.deleteTabData(oids) ? BaseResult.success("删除成功!"):BaseResult.fail("删除失败!"); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "删除时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | //页面设计相关接口 |
| | | /** |
| | | * 查询页面设计定义 |
| | | * @param pageContextOId |
| | | * @return |
| | | */ |
| | | @GetMapping( "/getPLPageDefinations") |
| | | @VciBusinessLog(operateName = "查询页面设计定义") |
| | | public BaseResult<DataGrid> getPLPageDefinations(String pageContextOId){ |
| | | try { |
| | | return BaseResult.dataGrid(uiManagerService.getPLPageDefinations(pageContextOId)); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "查询页面设计定义时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加页面定义 |
| | | * @param pdVO |
| | | * @return 保存结果 |
| | | */ |
| | | @PostMapping("/addPageDefination") |
| | | public BaseResult addPageDefination(@RequestBody PLDefinationVO pdVO){ |
| | | try { |
| | | return uiManagerService.addPageDefination(pdVO) ? BaseResult.success("页面定义添加成功!"):BaseResult.fail("页面定义添加失败!"); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "页面定义添加时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改页面定义数据 |
| | | * @param pdVO |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping("/updatePageDefination") |
| | | public BaseResult updatePageDefination(@RequestBody PLDefinationVO pdVO){ |
| | | try { |
| | | return uiManagerService.updatePageDefination(pdVO) ? BaseResult.success("修改页面定义成功!"):BaseResult.fail("修改页面定义失败!"); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "修改页面定义时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除页面定义数据 |
| | | * @param oids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delPageDefination") |
| | | public BaseResult delPageDefination(String[] oids){ |
| | | try { |
| | | return uiManagerService.delPageDefination(oids) ? BaseResult.success("删除页面定义成功!"):BaseResult.fail("删除页面定义数据失败!"); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "删除页面定义数据时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | //页面设计下配置按钮相关接口 |
| | | /** |
| | | * 获取页签区域按钮配置信息 |
| | | * @param pageDefinationOid |
| | | * @return |
| | | */ |
| | | @GetMapping( "/getTabButtons") |
| | | @VciBusinessLog(operateName = "获取页签区域按钮配置信息") |
| | | public BaseResult getTabButtons(String pageDefinationOid){ |
| | | try { |
| | | return BaseResult.dataList(uiManagerService.getTabButtons(pageDefinationOid)); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "获取页签区域按钮配置信息时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加按钮配置信息 |
| | | * @param tabButtonVO |
| | | * @return 保存结果 |
| | | */ |
| | | @PostMapping("/addTapButton") |
| | | public BaseResult addTapButton(@RequestBody PLTabButtonVO tabButtonVO){ |
| | | try { |
| | | return uiManagerService.addTapButton(tabButtonVO); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "按钮配置信息添加时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改按钮配置信息 |
| | | * @param tabButtonVO |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping("/updateTapButton") |
| | | public BaseResult updateTapButton(@RequestBody PLTabButtonVO tabButtonVO){ |
| | | try { |
| | | return uiManagerService.updateTapButton(tabButtonVO); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "修改按钮配置信息时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除单个按钮配置 |
| | | * @param tabButtonVO |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteTapButton") |
| | | public BaseResult deleteTapButton(@RequestBody PLTabButtonVO tabButtonVO){ |
| | | try { |
| | | return uiManagerService.deleteTapButton(tabButtonVO) ? BaseResult.success("删除单个按钮配置成功!"):BaseResult.fail("删除单个按钮配置失败!"); |
| | | } catch (PLException e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "删除单个按钮配置时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 调整为下级按钮 |
| | | * @param tabButtonVO |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping("/joinBtn") |
| | | public BaseResult joinBtn(@RequestBody PLTabButtonVO tabButtonVO){ |
| | | try { |
| | | return uiManagerService.joinBtn(tabButtonVO); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "调整为下级按钮时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 调整为上级按钮 |
| | | * @param tabButtonVO |
| | | * @return 修改结果 |
| | | */ |
| | | @PutMapping("/exitBtn") |
| | | public BaseResult exitBtn(@RequestBody PLTabButtonVO tabButtonVO){ |
| | | try { |
| | | return uiManagerService.exitBtn(tabButtonVO); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "调整为上级按钮时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | |
| | | } |
| | | |
| | | /*** |
| | | * @param selectTreeList 勾选的需要保存的数据对象 |
| | | * @param uiAuthorDTO 勾选的需要保存的数据对象 |
| | | * @return |
| | | */ |
| | | @PostMapping( "/authorizedUI") |
| | | @VciBusinessLog(operateName = "UI授权") |
| | | public BaseResult authorizedUI(UIAuthorDTO uiAuthorDTO){ |
| | | public BaseResult authorizedUI(@RequestBody UIAuthorDTO uiAuthorDTO){ |
| | | try { |
| | | return uiManagerService.authorizedUI(uiAuthorDTO)?BaseResult.success("授权成功!"):BaseResult.fail("授权失败!"); |
| | | }catch (Throwable e) { |
| | |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | } |