From 1349fda00a75a5cb6560c74ba9040ce138dd4883 Mon Sep 17 00:00:00 2001 From: wl <173@qq.com> Date: 星期一, 14 十一月 2022 10:56:27 +0800 Subject: [PATCH] 卡口管理调整 --- ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java | 45 ++++++++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 23 deletions(-) diff --git a/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java b/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java index ae445c6..28d34b3 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/epuipment/EquipmentBayonetController.java @@ -9,8 +9,11 @@ import com.ycl.controller.BaseController; import com.ycl.entity.dict.DataDictionary; import com.ycl.entity.equipment.EquipmentBayonet; +import com.ycl.entity.region.SccgRegion; import com.ycl.service.dict.IDataDictionaryService; import com.ycl.service.equipment.IEquipmentBayonetService; +import com.ycl.service.region.ISccgRegionService; +import com.ycl.utils.EasyExcelUtils; import com.ycl.vo.equipment.EquipmentBayonetVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -21,7 +24,6 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; -import java.net.URLEncoder; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.stream.Collectors; @@ -43,6 +45,8 @@ IEquipmentBayonetService iEquipmentBayonetService; @Autowired IDataDictionaryService iDataDictionaryService; + @Autowired + ISccgRegionService iSccgRegionService; @GetMapping("/query") @ApiOperation("鏌ヨ") @@ -63,20 +67,21 @@ BeanUtils.copyProperties(item, equipmentBayonetVO); equipmentBayonetVO.setFrontEndType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getFrontEndType())).getName()); equipmentBayonetVO.setInOutCityType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getInOutCityType())).getName()); + equipmentBayonetVO.setBelongArea(iSccgRegionService.getOne(new LambdaQueryWrapper<SccgRegion>().eq(SccgRegion::getId,item.getBelongArea())).getRegionName()); return equipmentBayonetVO; }).collect(Collectors.toList())); } @PostMapping("/addition") @ApiOperation("娣诲姞") - @LogSave(operationType = "鍗″彛绠$悊",contain = "娣诲姞鍗″彛") + @LogSave(operationType = "鍗″彛绠$悊", contain = "娣诲姞鍗″彛") public CommonResult add(@RequestBody EquipmentBayonet equipmentBayonet) { return CommonResult.success(iEquipmentBayonetService.save(equipmentBayonet)); } @PutMapping("/modification") @ApiOperation("淇敼") - @LogSave(operationType = "鍗″彛绠$悊",contain = "淇敼鍗″彛") + @LogSave(operationType = "鍗″彛绠$悊", contain = "淇敼鍗″彛") public CommonResult modify(@RequestBody EquipmentBayonet equipmentBayonet) { return CommonResult.success(iEquipmentBayonetService.updateById(equipmentBayonet)); } @@ -84,7 +89,7 @@ @GetMapping("/export") @ApiOperation("瀵煎嚭") @SneakyThrows - @LogSave(operationType = "鍗″彛绠$悊",contain = "鍒犻櫎鍗″彛") + @LogSave(operationType = "鍗″彛绠$悊", contain = "瀵煎嚭鍗″彛") public void export(HttpServletResponse response, @RequestParam(required = false) Integer size, @RequestParam(required = false) Integer current, @@ -92,23 +97,17 @@ Page<EquipmentBayonet> equipmentBayonetPage = new Page<>(); equipmentBayonetPage.setCurrent(current); equipmentBayonetPage.setSize(size); - response.setContentType("application/vnd.ms-excel"); - response.setCharacterEncoding("utf-8"); - response.setHeader("Content-disposition", "attachment;filename=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + URLEncoder.encode( ".xlsx", "utf-8")); - EasyExcel.write(response.getOutputStream(), EquipmentBayonetVO.class) - .sheet("鏁版嵁") - .doWrite(iEquipmentBayonetService - .page(equipmentBayonetPage, new LambdaQueryWrapper<EquipmentBayonet>() - .like(StringUtils.isNotBlank(bayonetName), EquipmentBayonet::getBayonetName, bayonetName)) - .getRecords() - .stream() - .map(item -> { - EquipmentBayonetVO equipmentBayonetVO = new EquipmentBayonetVO(); - BeanUtils.copyProperties(item, equipmentBayonetVO); - equipmentBayonetVO.setFrontEndType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getFrontEndType())).getName()); - equipmentBayonetVO.setInOutCityType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getInOutCityType())).getName()); - return equipmentBayonetVO; - }).collect(Collectors.toList())); + EasyExcelUtils.export(response,"鏁版嵁",EquipmentBayonetVO.class,iEquipmentBayonetService + .page(equipmentBayonetPage, new LambdaQueryWrapper<EquipmentBayonet>() + .like(StringUtils.isNotBlank(bayonetName), EquipmentBayonet::getBayonetName, bayonetName)) + .getRecords() + .stream() + .map(item -> { + EquipmentBayonetVO equipmentBayonetVO = new EquipmentBayonetVO(); + BeanUtils.copyProperties(item, equipmentBayonetVO); + equipmentBayonetVO.setFrontEndType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getFrontEndType())).getName()); + equipmentBayonetVO.setInOutCityType(iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getId, item.getInOutCityType())).getName()); + return equipmentBayonetVO; + }).collect(Collectors.toList())); } - -} +} \ No newline at end of file -- Gitblit v1.8.0