|
|
@@ -1,8 +1,18 @@
|
|
|
package com.zksy.web.controller.base;
|
|
|
|
|
|
-import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
|
|
|
-import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
|
|
|
-import com.zksy.WaterSupply.export.FireHydrantImportDTO;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.zksy.watersupply.domain.WaterFireHydrantInfo;
|
|
|
+import com.zksy.watersupply.domain.WaterPlantInfo;
|
|
|
+import com.zksy.watersupply.domain.WaterSourceInfo;
|
|
|
+import com.zksy.watersupply.domain.WaterUserInfo;
|
|
|
+import com.zksy.watersupply.service.IWaterFireHydrantInfoService;
|
|
|
+import com.zksy.watersupply.service.IWaterPlantInfoService;
|
|
|
+import com.zksy.watersupply.service.IWaterSourceInfoService;
|
|
|
+import com.zksy.watersupply.service.IWaterUserInfoService;
|
|
|
+import com.zksy.watersupply.dto.FireHydrantImportDTO;
|
|
|
+import com.zksy.watersupply.dto.WaterPlantExportDTO;
|
|
|
+import com.zksy.watersupply.dto.WaterSourceExportDTO;
|
|
|
+import com.zksy.watersupply.dto.WaterUserExportDTO;
|
|
|
import com.zksy.base.domain.ManholeBase;
|
|
|
import com.zksy.base.domain.PipeNetworkBase;
|
|
|
import com.zksy.base.dto.ManholeImportDTO;
|
|
|
@@ -25,18 +35,21 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 基础设施档案统一导入/导出端点。
|
|
|
*
|
|
|
- * <p>覆盖管网基础、窨井、消火栓、排水闸门、排水调蓄五类。模板列来自各 {@code XxxImportDTO}
|
|
|
+ * <p>覆盖管网基础、窨井、消火栓、排水闸门、排水调蓄、水源地、水厂、用水户八类。模板列来自各 {@code XxxImportDTO}
|
|
|
* 的 {@code @Excel} 注解;字典列用 {@code comboReadDict} 生成中文下拉,导入时由 ExcelUtil
|
|
|
* 按 dictType 反向转换成码值,保证“模板下拉中文、库里存码值”。</p>
|
|
|
*/
|
|
|
@@ -49,6 +62,9 @@ public class InfrastructureFacilityDataController {
|
|
|
@Resource private IWaterFireHydrantInfoService fireHydrantService;
|
|
|
@Resource private DrainageGateInfoService gateService;
|
|
|
@Resource private DrainageStorageInfoService storageService;
|
|
|
+ @Resource private IWaterSourceInfoService sourceService;
|
|
|
+ @Resource private IWaterPlantInfoService plantService;
|
|
|
+ @Resource private IWaterUserInfoService userService;
|
|
|
@Resource private InfrastructureFacilityImportService importService;
|
|
|
|
|
|
private String operator() {
|
|
|
@@ -176,4 +192,106 @@ public class InfrastructureFacilityDataController {
|
|
|
new ExcelUtil<DrainageStorageImportDTO>(DrainageStorageImportDTO.class)
|
|
|
.importTemplateExcel(response, "排水调蓄设施信息");
|
|
|
}
|
|
|
+
|
|
|
+ // ==================== 水源地信息 ====================
|
|
|
+
|
|
|
+ @GetMapping("/waterSource/export")
|
|
|
+ @Log(title = "导出水源地信息", businessType = BusinessType.EXPORT)
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterSource:export')")
|
|
|
+ public void sourceExport(HttpServletResponse response,
|
|
|
+ @RequestParam(required = false) String sourceId,
|
|
|
+ @RequestParam(required = false) String sourceName,
|
|
|
+ @RequestParam(required = false) String status,
|
|
|
+ @RequestParam(required = false) String unit,
|
|
|
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
|
|
|
+ var page = sourceService.queryPage(new Page<WaterSourceInfo>(1, Integer.MAX_VALUE),
|
|
|
+ sourceId, sourceName, status, unit, startTime, endTime);
|
|
|
+ new ExcelUtil<>(WaterSourceExportDTO.class).exportExcel(response,
|
|
|
+ page.getRecords().stream().map(WaterSourceExportDTO::from).collect(Collectors.toList()), "水源地信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/waterSource/importData")
|
|
|
+ @Log(title = "导入水源地信息", businessType = BusinessType.IMPORT)
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterSource:import')")
|
|
|
+ public AjaxResult sourceImportData(@RequestParam("file") MultipartFile file,
|
|
|
+ @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
|
|
|
+ return AjaxResult.success(importService.importSources(
|
|
|
+ new ExcelUtil<WaterSourceExportDTO>(WaterSourceExportDTO.class).importExcel(file.getInputStream()),
|
|
|
+ updateSupport, operator()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/waterSource/importTemplate")
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterSource:import')")
|
|
|
+ public void sourceImportTemplate(HttpServletResponse response) {
|
|
|
+ new ExcelUtil<WaterSourceExportDTO>(WaterSourceExportDTO.class).importTemplateExcel(response, "水源地信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 水厂信息 ====================
|
|
|
+
|
|
|
+ @GetMapping("/waterPlant/export")
|
|
|
+ @Log(title = "导出水厂信息", businessType = BusinessType.EXPORT)
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterPlant:export')")
|
|
|
+ public void plantExport(HttpServletResponse response,
|
|
|
+ @RequestParam(required = false) String plantCode,
|
|
|
+ @RequestParam(required = false) String plantName,
|
|
|
+ @RequestParam(required = false) String status,
|
|
|
+ @RequestParam(required = false) String principal,
|
|
|
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
|
|
|
+ var page = plantService.queryPage(new Page<WaterPlantInfo>(1, Integer.MAX_VALUE),
|
|
|
+ plantCode, plantName, status, principal, startTime, endTime);
|
|
|
+ new ExcelUtil<>(WaterPlantExportDTO.class).exportExcel(response,
|
|
|
+ page.getRecords().stream().map(WaterPlantExportDTO::from).collect(Collectors.toList()), "水厂信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/waterPlant/importData")
|
|
|
+ @Log(title = "导入水厂信息", businessType = BusinessType.IMPORT)
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterPlant:import')")
|
|
|
+ public AjaxResult plantImportData(@RequestParam("file") MultipartFile file,
|
|
|
+ @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
|
|
|
+ return AjaxResult.success(importService.importPlants(
|
|
|
+ new ExcelUtil<WaterPlantExportDTO>(WaterPlantExportDTO.class).importExcel(file.getInputStream()),
|
|
|
+ updateSupport, operator()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/waterPlant/importTemplate")
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterPlant:import')")
|
|
|
+ public void plantImportTemplate(HttpServletResponse response) {
|
|
|
+ new ExcelUtil<WaterPlantExportDTO>(WaterPlantExportDTO.class).importTemplateExcel(response, "水厂信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ==================== 用水户信息 ====================
|
|
|
+
|
|
|
+ @GetMapping("/waterUser/export")
|
|
|
+ @Log(title = "导出用水户信息", businessType = BusinessType.EXPORT)
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterUser:export')")
|
|
|
+ public void userExport(HttpServletResponse response,
|
|
|
+ @RequestParam(required = false) String userCode,
|
|
|
+ @RequestParam(required = false) String userName,
|
|
|
+ @RequestParam(required = false) String status,
|
|
|
+ @RequestParam(required = false) String userType,
|
|
|
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+ @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
|
|
|
+ var page = userService.queryPage(new Page<WaterUserInfo>(1, Integer.MAX_VALUE),
|
|
|
+ userCode, userName, status, userType, startTime, endTime);
|
|
|
+ new ExcelUtil<>(WaterUserExportDTO.class).exportExcel(response,
|
|
|
+ page.getRecords().stream().map(WaterUserExportDTO::from).collect(Collectors.toList()), "用水户信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/waterUser/importData")
|
|
|
+ @Log(title = "导入用水户信息", businessType = BusinessType.IMPORT)
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterUser:import')")
|
|
|
+ public AjaxResult userImportData(@RequestParam("file") MultipartFile file,
|
|
|
+ @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
|
|
|
+ return AjaxResult.success(importService.importUsers(
|
|
|
+ new ExcelUtil<WaterUserExportDTO>(WaterUserExportDTO.class).importExcel(file.getInputStream()),
|
|
|
+ updateSupport, operator()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/waterUser/importTemplate")
|
|
|
+ @PreAuthorize("@ss.hasPermi('waterSupply:waterUser:import')")
|
|
|
+ public void userImportTemplate(HttpServletResponse response) {
|
|
|
+ new ExcelUtil<WaterUserExportDTO>(WaterUserExportDTO.class).importTemplateExcel(response, "用水户信息");
|
|
|
+ }
|
|
|
}
|