| | |
| | | package com.vci.web.controller; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.qtm.QTD; |
| | | import com.vci.dto.QTInfoDTO; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | 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.OsQuereyTemplateServiceI; |
| | | import com.vci.web.util.Func; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.dom4j.DocumentException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 查询模板的控制器 |
| | |
| | | return objectBaseResult; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导出链接类型查询模板 |
| | | * names 查询模板名 |
| | | * @return |
| | | */ |
| | | @PostMapping("/expLinkTemplate") |
| | | public void expLinkTemplate(@RequestBody List<String> names,HttpServletResponse response) throws PLException, IOException { |
| | | quereyTemplateServiceI.expLinkTemplate(names, response); |
| | | public void expLinkTemplate(@RequestBody Map qtNames, HttpServletResponse response) throws PLException, IOException { |
| | | quereyTemplateServiceI.expLinkTemplate(String.valueOf(qtNames.get("qtNames")), response); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/expBtmQTTemplate") |
| | | public void expBtmQTTemplate(List<String> qtNames,HttpServletResponse response) throws PLException, IOException { |
| | | quereyTemplateServiceI.expBtmQTTemplate(qtNames, response); |
| | | public void expBtmQTTemplate(@RequestBody Map qtNames, HttpServletResponse response) throws PLException, IOException { |
| | | try { |
| | | String excelPath = quereyTemplateServiceI.expBtmQTTemplate(String.valueOf(qtNames.get("qtNames"))); |
| | | ControllerUtil.writeFileToResponse(response,excelPath); |
| | | FileUtil.del(LocalFileUtil.getDefaultTempFolder() + File.separator); |
| | | } catch (Exception e) { |
| | | String msg = "导出业务类型查询模板时出现错误,原因:" + 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(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |