|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrProject.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson2.JSONArray; | 
|---|
|  |  |  | import com.alibaba.excel.EasyExcel; | 
|---|
|  |  |  | import com.alibaba.excel.support.ExcelTypeEnum; | 
|---|
|  |  |  | import com.alibaba.fastjson2.JSONArray; | 
|---|
|  |  |  | import com.dy.common.aop.SsoAop; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponse; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.common.webUtil.ResultCodeMsg; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.excel.CellWriteHandler; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.excel.ExcelUtil; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoBa.BaClient; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoPr.PrController; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voPr.VoController; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voPr.VoControllerSimple; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSe.VoActiveCard; | 
|---|
|  |  |  | import com.dy.pipIrrProject.result.ProjectResultCode; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.Operation; | 
|---|
|  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.io.UnsupportedEncodingException; | 
|---|
|  |  |  | import java.net.URLEncoder; | 
|---|
|  |  |  | import java.time.LocalDate; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | @SneakyThrows(IOException.class) | 
|---|
|  |  |  | @RequestMapping(value = "/export", method = RequestMethod.GET) | 
|---|
|  |  |  | public void export(HttpServletResponse response, QueryVo vo) { | 
|---|
|  |  |  | setExcelRespProp(response, "控制器列表"); | 
|---|
|  |  |  | //List<VoDivide> memberList = LocalJsonUtil.getListFromJson("json/members.json", VoDivide.class); | 
|---|
|  |  |  | List<VoController> memberList = controllerSv.export(vo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | EasyExcel.write(response.getOutputStream()) | 
|---|
|  |  |  | .head(VoController.class) | 
|---|
|  |  |  | .excelType(ExcelTypeEnum.XLSX) | 
|---|
|  |  |  | .sheet("控制器列表") | 
|---|
|  |  |  | .doWrite(memberList); | 
|---|
|  |  |  | List<VoController> controllerList = controllerSv.export(vo); | 
|---|
|  |  |  | ExcelUtil.setExcelRespProp(response, "控制器列表" + LocalDate.now()); | 
|---|
|  |  |  | EasyExcel.write(response.getOutputStream(), VoController.class) | 
|---|
|  |  |  | .registerWriteHandler(new CellWriteHandler("控制器列表")) | 
|---|
|  |  |  | .sheet("控制器") | 
|---|
|  |  |  | .doWrite(controllerList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 不分页获取全部未删除的阀控器列表 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getSimpleControllers") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<List<VoControllerSimple>> getSimpleControllers() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | List<VoControllerSimple> res = controllerSv.getSimpleControllers(); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("获取未完的计划异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|