|  |  | 
 |  |  | import com.doumee.config.annotation.CloudRequiredPermission; | 
 |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
 |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
 |  |  | import com.doumee.core.model.ApiResponse; | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.model.PageWrap; | 
 |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
 |  |  | import com.doumee.service.business.third.model.PageData; | 
 |  |  | import com.doumee.service.business.third.model.PageWrap; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.dao.business.model.PlatformWaterGas; | 
 |  |  | import com.doumee.dao.business.vo.PlatformWaterGasForExcelVO; | 
 |  |  | import com.doumee.service.business.PlatformWaterGasService; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import io.swagger.annotations.*; | 
 |  |  | import org.springframework.beans.BeanUtils; | 
 |  |  | 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.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Objects; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author 江蹄蹄 | 
 |  |  | 
 |  |  |     @PostMapping("/exportExcel") | 
 |  |  |     @CloudRequiredPermission("business:platformwatergas:exportExcel") | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<PlatformWaterGas> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ExcelExporter.build(PlatformWaterGas.class).export(platformWaterGasService.findPage(pageWrap).getRecords(), "月台_用水用气信息记录表", response); | 
 |  |  |         List<PlatformWaterGas>  waterGasPageData = platformWaterGasService.findPage(pageWrap).getRecords(); | 
 |  |  |         if(Objects.nonNull(pageWrap.getModel()) | 
 |  |  |             && Objects.nonNull(pageWrap.getModel().getType()) && !Constants.equalsInteger(pageWrap.getModel().getType(),Constants.TWO)){ | 
 |  |  |             List<PlatformWaterGasForExcelVO> pageData = new ArrayList<>(); | 
 |  |  |             for (PlatformWaterGas platformWaterGas:waterGasPageData) { | 
 |  |  |                 PlatformWaterGasForExcelVO platformWaterGasForExcelVO = new PlatformWaterGasForExcelVO(); | 
 |  |  |                 BeanUtils.copyProperties(platformWaterGas,platformWaterGasForExcelVO); | 
 |  |  |                 pageData.add(platformWaterGasForExcelVO); | 
 |  |  |             } | 
 |  |  |             String title = "月台_循环烟箱记录表"; | 
 |  |  |             if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.ZERO)){ | 
 |  |  |                 title = "月台_用水信息记录表"; | 
 |  |  |             }else if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.ONE)){ | 
 |  |  |                 title = "月台_用气信息记录表"; | 
 |  |  |             } | 
 |  |  |             ExcelExporter.build(PlatformWaterGasForExcelVO.class).export(pageData, title, response); | 
 |  |  |         }else{ | 
 |  |  |             ExcelExporter.build(PlatformWaterGas.class).export(waterGasPageData, "月台_油耗信息记录表", response); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "油耗信息导入") | 
 |  |  |     @PostMapping("/importExcel") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), | 
 |  |  |     }) | 
 |  |  |     @CloudRequiredPermission("business:platformwatergas:exportExcel") | 
 |  |  |     public ApiResponse<String> importExcel (@ApiParam(value = "file") MultipartFile file, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         return ApiResponse.success(platformWaterGasService.importBatch(file,this.getLoginUser(token))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID查询") | 
 |  |  |     @GetMapping("/{id}") | 
 |  |  |     @CloudRequiredPermission("business:platformwatergas:query") |