Bläddra i källkod

积木报表的导出接口增加日报可以查询月份;月报可以查询年份的条件

lingpeng.li 5 månader sedan
förälder
incheckning
ee63403de4

+ 300 - 303
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/controller/FpgLeanModelController.java

@@ -13,10 +13,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.fpgLeanModel.entity.DeviceStatiscsModelMongodb;
-import org.jeecg.modules.fpgLeanModel.entity.FpgLeanModel;
-import org.jeecg.modules.fpgLeanModel.entity.FpgLeanModelResult;
-import org.jeecg.modules.fpgLeanModel.entity.LeanModelDeviceHistoryInfo;
+import org.jeecg.modules.fpgLeanModel.entity.*;
 import org.jeecg.modules.fpgLeanModel.service.IFpgLeanModelService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -30,122 +27,122 @@ import java.util.List;
 /**
  * @Description: 峰平谷模型
  * @Author: jeecg-boot
- * @Date:   2024-10-31
+ * @Date: 2024-10-31
  * @Version: V1.0
  */
-@Api(tags="峰平谷模型")
+@Api(tags = "峰平谷模型")
 @RestController
 @RequestMapping("/fpgLeanModel/fpgLeanModel")
 @Slf4j
 public class FpgLeanModelController extends JeecgController<FpgLeanModel, IFpgLeanModelService> {
-	@Autowired
-	private IFpgLeanModelService fpgLeanModelService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param fpgLeanModel
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "峰平谷模型-分页列表查询")
-	@ApiOperation(value="峰平谷模型-分页列表查询", notes="峰平谷模型-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<FpgLeanModel>> queryPageList(FpgLeanModel fpgLeanModel,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
-		QueryWrapper<FpgLeanModel> queryWrapper = QueryGenerator.initQueryWrapper(fpgLeanModel, req.getParameterMap());
-		Page<FpgLeanModel> page = new Page<FpgLeanModel>(pageNo, pageSize);
-		IPage<FpgLeanModel> pageList = fpgLeanModelService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param fpgLeanModel
-	 * @return
-	 */
-	@AutoLog(value = "峰平谷模型-添加")
-	@ApiOperation(value="峰平谷模型-添加", notes="峰平谷模型-添加")
-	@RequiresPermissions("fpgLeanModel:fpg_lean_model:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody FpgLeanModel fpgLeanModel) {
-		fpgLeanModelService.save(fpgLeanModel);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param fpgLeanModel
-	 * @return
-	 */
-	@AutoLog(value = "峰平谷模型-编辑")
-	@ApiOperation(value="峰平谷模型-编辑", notes="峰平谷模型-编辑")
-	@RequiresPermissions("fpgLeanModel:fpg_lean_model:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody FpgLeanModel fpgLeanModel) {
-		fpgLeanModelService.updateById(fpgLeanModel);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "峰平谷模型-通过id删除")
-	@ApiOperation(value="峰平谷模型-通过id删除", notes="峰平谷模型-通过id删除")
-	@RequiresPermissions("fpgLeanModel:fpg_lean_model:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		fpgLeanModelService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "峰平谷模型-批量删除")
-	@ApiOperation(value="峰平谷模型-批量删除", notes="峰平谷模型-批量删除")
-	@RequiresPermissions("fpgLeanModel:fpg_lean_model:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.fpgLeanModelService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "峰平谷模型-通过id查询")
-	@ApiOperation(value="峰平谷模型-通过id查询", notes="峰平谷模型-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<FpgLeanModel> queryById(@RequestParam(name="id",required=true) String id) {
-		FpgLeanModel fpgLeanModel = fpgLeanModelService.getById(id);
-		if(fpgLeanModel==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(fpgLeanModel);
-	}
+    @Autowired
+    private IFpgLeanModelService fpgLeanModelService;
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param fpgLeanModel
-    */
+     * 分页列表查询
+     *
+     * @param fpgLeanModel
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "峰平谷模型-分页列表查询")
+    @ApiOperation(value = "峰平谷模型-分页列表查询", notes = "峰平谷模型-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<FpgLeanModel>> queryPageList(FpgLeanModel fpgLeanModel,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                     HttpServletRequest req) {
+        QueryWrapper<FpgLeanModel> queryWrapper = QueryGenerator.initQueryWrapper(fpgLeanModel, req.getParameterMap());
+        Page<FpgLeanModel> page = new Page<FpgLeanModel>(pageNo, pageSize);
+        IPage<FpgLeanModel> pageList = fpgLeanModelService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param fpgLeanModel
+     * @return
+     */
+    @AutoLog(value = "峰平谷模型-添加")
+    @ApiOperation(value = "峰平谷模型-添加", notes = "峰平谷模型-添加")
+    @RequiresPermissions("fpgLeanModel:fpg_lean_model:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody FpgLeanModel fpgLeanModel) {
+        fpgLeanModelService.save(fpgLeanModel);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param fpgLeanModel
+     * @return
+     */
+    @AutoLog(value = "峰平谷模型-编辑")
+    @ApiOperation(value = "峰平谷模型-编辑", notes = "峰平谷模型-编辑")
+    @RequiresPermissions("fpgLeanModel:fpg_lean_model:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody FpgLeanModel fpgLeanModel) {
+        fpgLeanModelService.updateById(fpgLeanModel);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "峰平谷模型-通过id删除")
+    @ApiOperation(value = "峰平谷模型-通过id删除", notes = "峰平谷模型-通过id删除")
+    @RequiresPermissions("fpgLeanModel:fpg_lean_model:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        fpgLeanModelService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "峰平谷模型-批量删除")
+    @ApiOperation(value = "峰平谷模型-批量删除", notes = "峰平谷模型-批量删除")
+    @RequiresPermissions("fpgLeanModel:fpg_lean_model:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.fpgLeanModelService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "峰平谷模型-通过id查询")
+    @ApiOperation(value = "峰平谷模型-通过id查询", notes = "峰平谷模型-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<FpgLeanModel> queryById(@RequestParam(name = "id", required = true) String id) {
+        FpgLeanModel fpgLeanModel = fpgLeanModelService.getById(id);
+        if (fpgLeanModel == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(fpgLeanModel);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param fpgLeanModel
+     */
     @RequiresPermissions("fpgLeanModel:fpg_lean_model:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, FpgLeanModel fpgLeanModel) {
@@ -153,291 +150,291 @@ public class FpgLeanModelController extends JeecgController<FpgLeanModel, IFpgLe
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("fpgLeanModel:fpg_lean_model:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         return super.importExcel(request, response, FpgLeanModel.class);
     }
 
-	 @ApiOperation(value="峰平谷模型和设备信息-通过id查询", notes="峰平谷模型和设备信息-通过id查询")
-	 @GetMapping(value = "/queryFpgLeanModelById")
-	 public Result<FpgLeanModelResult> queryFpgLeanModelById(@RequestParam(name="id",required=true) String id) {
-		 FpgLeanModelResult fpgLeanModelResult = fpgLeanModelService.queryFpgLeanModelById(id);
-		 if(fpgLeanModelResult==null) {
-			 return Result.error("未找到对应数据");
-		 }
-		 return Result.OK(fpgLeanModelResult);
-	 }
-
-	 @ApiOperation(value="设备模型历史记录-通过区域ID设备ID查询", notes="设备模型历史记录-通过区域ID设备ID查询")
-	 @GetMapping(value = "/getDeviceHistoryInfo")
-	 public Result<IPage<LeanModelDeviceHistoryInfo>> getDeviceHistoryInfo(
-			 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-			 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-			 @RequestParam(name = "deviceRegionId", required = false) String deviceRegionId,
-			 @RequestParam(name="deviceInformationId") String deviceInformationId) {
-		 IPage<LeanModelDeviceHistoryInfo> pageList = fpgLeanModelService.getDeviceHistoryInfo(deviceRegionId, deviceInformationId, pageSize, pageNo);
-		 return Result.OK(pageList);
-	 }
-
-
-	 @ApiOperation(value="实时功率和电流-通过设备id查询", notes="实时功率和电流-通过设备id查询")
-	 @GetMapping(value = "/queryRealTimeDataById")
-	 public Result<List<DeviceStatiscsModelMongodb>> queryRealTimeDataById(@RequestParam(name="deviceInformationId") String deviceInformationId) {
-		 List<DeviceStatiscsModelMongodb> deviceStatiscsModelMongodbList = fpgLeanModelService.queryRealTimeDataById(deviceInformationId);
-		 if(oConvertUtils.listIsEmpty(deviceStatiscsModelMongodbList)) {
-			 return Result.error("未找到对应数据");
-		 }
-		 return Result.OK(deviceStatiscsModelMongodbList);
-	 }
+    @ApiOperation(value = "峰平谷模型和设备信息-通过id查询", notes = "峰平谷模型和设备信息-通过id查询")
+    @GetMapping(value = "/queryFpgLeanModelById")
+    public Result<FpgLeanModelResult> queryFpgLeanModelById(@RequestParam(name = "id", required = true) String id) {
+        FpgLeanModelResult fpgLeanModelResult = fpgLeanModelService.queryFpgLeanModelById(id);
+        if (fpgLeanModelResult == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(fpgLeanModelResult);
+    }
 
+    @ApiOperation(value = "设备模型历史记录-通过区域ID设备ID查询", notes = "设备模型历史记录-通过区域ID设备ID查询")
+    @GetMapping(value = "/getDeviceHistoryInfo")
+    public Result<IPage<LeanModelDeviceHistoryInfo>> getDeviceHistoryInfo(
+            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+            @RequestParam(name = "deviceRegionId", required = false) String deviceRegionId,
+            @RequestParam(name = "deviceInformationId") String deviceInformationId) {
+        IPage<LeanModelDeviceHistoryInfo> pageList = fpgLeanModelService.getDeviceHistoryInfo(deviceRegionId, deviceInformationId, pageSize, pageNo);
+        return Result.OK(pageList);
+    }
 
-	/**
-	 * 	龙钢变各工序报表		http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataByCode?leanModelCode=total_day_wp_report			       total_day_wp_report
-	 * 	总用电量报表	    	http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataPowerByCode?leanModelCode=total_day_eu_report		   total_day_eu_report
-	 * 	峰平谷用电控制日报报表  http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataControlByCode?leanModelCode=total_day_ec_report         total_day_ec_report
-	 * 	线路峰平谷日报 		http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataRunByCode?leanModelCode=total_day_dn_report             total_day_dn_report
-	 * 	谷峰差统计报表    		http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataDifferenceByCode?leanModelCode=total_day_ds_report      total_day_ds_report
-	 *
- 	 * @param leanModelCode
-	 * @return
-	 */
 
-	@ApiOperation(value="龙钢变各工序报表-通过模型编码导出", notes="龙钢变各工序报表-通过模型编码导出")
-	@GetMapping(value = "/exportModelDataByCode")
-	public JSONObject exportModelDataByLeanModelCode(@RequestParam(name="leanModelCode") String leanModelCode) {
+    @ApiOperation(value = "实时功率和电流-通过设备id查询", notes = "实时功率和电流-通过设备id查询")
+    @GetMapping(value = "/queryRealTimeDataById")
+    public Result<List<DeviceStatiscsModelMongodb>> queryRealTimeDataById(@RequestParam(name = "deviceInformationId") String deviceInformationId) {
+        List<DeviceStatiscsModelMongodb> deviceStatiscsModelMongodbList = fpgLeanModelService.queryRealTimeDataById(deviceInformationId);
+        if (oConvertUtils.listIsEmpty(deviceStatiscsModelMongodbList)) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(deviceStatiscsModelMongodbList);
+    }
 
-		JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
 
-		return result;
-	}
+    /**
+     * 龙钢变各工序报表		http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataByCode?leanModelCode=total_day_wp_report			       total_day_wp_report
+     * 总用电量报表	    	http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataPowerByCode?leanModelCode=total_day_eu_report		   total_day_eu_report
+     * 峰平谷用电控制日报报表  http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataControlByCode?leanModelCode=total_day_ec_report         total_day_ec_report
+     * 线路峰平谷日报 		http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataRunByCode?leanModelCode=total_day_dn_report             total_day_dn_report
+     * 谷峰差统计报表    		http://localhost:7004/fpgLeanModel/fpgLeanModel/exportModelDataDifferenceByCode?leanModelCode=total_day_ds_report      total_day_ds_report
+     *
+     * @param leanModelCode
+     * @return
+     */
+
+    @ApiOperation(value = "龙钢变各工序报表-通过模型编码导出", notes = "龙钢变各工序报表-通过模型编码导出")
+    @GetMapping(value = "/exportModelDataByCode")
+    public JSONObject exportModelDataByLeanModelCode(@RequestParam(name = "leanModelCode") String leanModelCode) {
+
+        JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
+
+        return result;
+    }
 
-	@ApiOperation(value="总用电量报表-通过模型编码导出", notes="用电总量报表-通过模型编码导出")
-	@GetMapping(value = "/exportModelDataPowerByCode")
-	public JSONObject exportModelPowerDataByLeanModelCode(@RequestParam(name="leanModelCode") String leanModelCode) {
+    @ApiOperation(value = "总用电量报表-通过模型编码导出", notes = "用电总量报表-通过模型编码导出")
+    @GetMapping(value = "/exportModelDataPowerByCode")
+    public JSONObject exportModelPowerDataByLeanModelCode(@RequestParam(name = "leanModelCode") String leanModelCode) {
 
-		JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
+        JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
 
-		return result;
-	}
+        return result;
+    }
 
-	@ApiOperation(value="峰平谷用电控制日报报表-通过模型编码导出", notes="峰平谷用电控制日报报表-通过模型编码导出")
-	@GetMapping(value = "/exportModelDataControlByCode")
-	public JSONObject exportModelControlDataByLeanModelCode(@RequestParam(name="leanModelCode") String leanModelCode) {
+    @ApiOperation(value = "峰平谷用电控制日报报表-通过模型编码导出", notes = "峰平谷用电控制日报报表-通过模型编码导出")
+    @GetMapping(value = "/exportModelDataControlByCode")
+    public JSONObject exportModelControlDataByLeanModelCode(@RequestParam(name = "leanModelCode") String leanModelCode) {
 
-		JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
+        JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
 
-		return result;
-	}
+        return result;
+    }
 
-	@ApiOperation(value="线路峰平谷日报报表-通过模型编码导出", notes="线路峰平谷日报报表-通过模型编码导出")
-	@GetMapping(value = "/exportModelDataRunByCode")
-	public JSONObject exportModelRunDataByLeanModelCode(@RequestParam(name="leanModelCode") String leanModelCode) {
+    @ApiOperation(value = "线路峰平谷日报报表-通过模型编码导出", notes = "线路峰平谷日报报表-通过模型编码导出")
+    @GetMapping(value = "/exportModelDataRunByCode")
+    public JSONObject exportModelRunDataByLeanModelCode(@RequestParam(name = "leanModelCode") String leanModelCode) {
 
-		JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
+        JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
 
-		return result;
-	}
+        return result;
+    }
 
-	@ApiOperation(value="谷峰差统计报表-通过模型编码导出", notes="谷峰差统计报表-通过模型编码导出")
-	@GetMapping(value = "/exportModelDataDifferenceByCode")
-	public JSONObject exportModelDifferenceDataByLeanModelCode(@RequestParam(name="leanModelCode") String leanModelCode) {
+    @ApiOperation(value = "谷峰差统计报表-通过模型编码导出", notes = "谷峰差统计报表-通过模型编码导出")
+    @GetMapping(value = "/exportModelDataDifferenceByCode")
+    public JSONObject exportModelDifferenceDataByLeanModelCode(@RequestParam(name = "leanModelCode") String leanModelCode) {
 
-		JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
+        JSONObject result = fpgLeanModelService.queryFpgPowerDataByLeanModelCode(leanModelCode);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="总用电量报表", notes="总用电量报表")
-	@GetMapping(value = "/totalElectricityConsumptionReport")
-	public JSONObject totalElectricityConsumptionReport() {
+    @ApiOperation(value = "总用电量报表", notes = "总用电量报表")
+    @GetMapping(value = "/totalElectricityConsumptionReport")
+    public JSONObject totalElectricityConsumptionReport() {
 
-		JSONObject result = fpgLeanModelService.totalElectricityConsumptionReport();
+        JSONObject result = fpgLeanModelService.totalElectricityConsumptionReport();
 
-		return result;
-	}
+        return result;
+    }
 
-	@ApiOperation(value="峰平谷用电控制", notes="峰平谷用电控制")
-	@GetMapping(value = "/electricityControl")
-	public JSONObject electricityControl() {
+    @ApiOperation(value = "峰平谷用电控制", notes = "峰平谷用电控制")
+    @GetMapping(value = "/electricityControl")
+    public JSONObject electricityControl(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControl();
+        JSONObject result = fpgLeanModelService.electricityControl(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制设备日报", notes="峰平谷用电控制设备日报")
-	@GetMapping(value = "/electricityControlDay")
-	public JSONObject electricityControlDay() {
+    @ApiOperation(value = "峰平谷用电控制设备日报", notes = "峰平谷用电控制设备日报")
+    @GetMapping(value = "/electricityControlDay")
+    public JSONObject electricityControlDay(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlDay();
+        JSONObject result = fpgLeanModelService.electricityControlDay(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制各线日报", notes="峰平谷用电控制各线日报")
-	@GetMapping(value = "/electricityControlGxDay")
-	public JSONObject electricityControlGxDay() {
+    @ApiOperation(value = "峰平谷用电控制各线日报", notes = "峰平谷用电控制各线日报")
+    @GetMapping(value = "/electricityControlGxDay")
+    public JSONObject electricityControlGxDay(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlGxDay();
+        JSONObject result = fpgLeanModelService.electricityControlGxDay(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制分厂日报", notes="峰平谷用电控制分厂日报")
-	@GetMapping(value = "/electricityControlFcDay")
-	public JSONObject electricityControlFcDay() {
+    @ApiOperation(value = "峰平谷用电控制分厂日报", notes = "峰平谷用电控制分厂日报")
+    @GetMapping(value = "/electricityControlFcDay")
+    public JSONObject electricityControlFcDay(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlFcDay();
+        JSONObject result = fpgLeanModelService.electricityControlFcDay(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制公司日报", notes="峰平谷用电控制公司日报")
-	@GetMapping(value = "/electricityControlGsDay")
-	public JSONObject electricityControlGsDay() {
+    @ApiOperation(value = "峰平谷用电控制公司日报", notes = "峰平谷用电控制公司日报")
+    @GetMapping(value = "/electricityControlGsDay")
+    public JSONObject electricityControlGsDay(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlGsDay();
+        JSONObject result = fpgLeanModelService.electricityControlGsDay(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制设备月报", notes="峰平谷用电控制设备月报")
-	@GetMapping(value = "/electricityControlMonth")
-	public JSONObject electricityControlMonth() {
+    @ApiOperation(value = "峰平谷用电控制设备月报", notes = "峰平谷用电控制设备月报")
+    @GetMapping(value = "/electricityControlMonth")
+    public JSONObject electricityControlMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlMonth();
+        JSONObject result = fpgLeanModelService.electricityControlMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制各线月报", notes="峰平谷用电控制各线月报")
-	@GetMapping(value = "/electricityControlGxMonth")
-	public JSONObject electricityControlGxMonth() {
+    @ApiOperation(value = "峰平谷用电控制各线月报", notes = "峰平谷用电控制各线月报")
+    @GetMapping(value = "/electricityControlGxMonth")
+    public JSONObject electricityControlGxMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlGxMonth();
+        JSONObject result = fpgLeanModelService.electricityControlGxMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷用电控制分厂月报", notes="峰平谷用电控制分厂月报")
-	@GetMapping(value = "/electricityControlFcMonth")
-	public JSONObject electricityControlFcMonth() {
+    @ApiOperation(value = "峰平谷用电控制分厂月报", notes = "峰平谷用电控制分厂月报")
+    @GetMapping(value = "/electricityControlFcMonth")
+    public JSONObject electricityControlFcMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlFcMonth();
+        JSONObject result = fpgLeanModelService.electricityControlFcMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
-	@ApiOperation(value="峰平谷用电控制分厂月报", notes="峰平谷用电控制分厂月报")
-	@GetMapping(value = "/electricityControlGsMonth")
-	public JSONObject electricityControlGsMonth() {
+    @ApiOperation(value = "峰平谷用电控制公司月报", notes = "峰平谷用电控制公司月报")
+    @GetMapping(value = "/electricityControlGsMonth")
+    public JSONObject electricityControlGsMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.electricityControlGsMonth();
+        JSONObject result = fpgLeanModelService.electricityControlGsMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="峰平谷运行统计表", notes="峰平谷运行统计表")
-	@GetMapping(value = "/operatingStatistic")
-	public JSONObject operatingStatistic() {
+    @ApiOperation(value = "峰平谷运行统计表", notes = "峰平谷运行统计表")
+    @GetMapping(value = "/operatingStatistic")
+    public JSONObject operatingStatistic() {
 
-		JSONObject result = fpgLeanModelService.operatingStatistic();
+        JSONObject result = fpgLeanModelService.operatingStatistic();
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差日统计", notes="谷峰差日统计")
-	@GetMapping(value = "/valleyPeakDifferenceStatistics")
-	public JSONObject valleyPeakDifferenceStatistics() {
+    @ApiOperation(value = "谷峰差日统计", notes = "谷峰差日统计")
+    @GetMapping(value = "/valleyPeakDifferenceStatistics")
+    public JSONObject valleyPeakDifferenceStatistics(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceStatistics();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceStatistics(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差各线日统计", notes="谷峰差各线日统计")
-	@GetMapping(value = "/valleyPeakDifferenceGxStatistics")
-	public JSONObject valleyPeakDifferenceGxStatistics() {
+    @ApiOperation(value = "谷峰差各线日统计", notes = "谷峰差各线日统计")
+    @GetMapping(value = "/valleyPeakDifferenceGxStatistics")
+    public JSONObject valleyPeakDifferenceGxStatistics(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceGxStatistics();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceGxStatistics(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差分厂日统计", notes="谷峰差分厂日统计")
-	@GetMapping(value = "/valleyPeakDifferenceFcStatistics")
-	public JSONObject valleyPeakDifferenceFcStatistics() {
+    @ApiOperation(value = "谷峰差分厂日统计", notes = "谷峰差分厂日统计")
+    @GetMapping(value = "/valleyPeakDifferenceFcStatistics")
+    public JSONObject valleyPeakDifferenceFcStatistics(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceFcStatistics();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceFcStatistics(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差公司日统计", notes="谷峰差公司日统计")
-	@GetMapping(value = "/valleyPeakDifferenceGsStatistics")
-	public JSONObject valleyPeakDifferenceGsStatistics() {
+    @ApiOperation(value = "谷峰差公司日统计", notes = "谷峰差公司日统计")
+    @GetMapping(value = "/valleyPeakDifferenceGsStatistics")
+    public JSONObject valleyPeakDifferenceGsStatistics(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceGsStatistics();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceGsStatistics(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差设备月统计", notes="谷峰差设备月统计")
-	@GetMapping(value = "/valleyPeakDifferenceStatisticsMonth")
-	public JSONObject valleyPeakDifferenceStatisticsMonth() {
+    @ApiOperation(value = "谷峰差设备月统计", notes = "谷峰差设备月统计")
+    @GetMapping(value = "/valleyPeakDifferenceStatisticsMonth")
+    public JSONObject valleyPeakDifferenceStatisticsMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceStatisticsMonth();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceStatisticsMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差各线月统计", notes="谷峰差各线月统计")
-	@GetMapping(value = "/valleyPeakDifferenceGxStatisticsMonth")
-	public JSONObject valleyPeakDifferenceGxStatisticsMonth() {
+    @ApiOperation(value = "谷峰差各线月统计", notes = "谷峰差各线月统计")
+    @GetMapping(value = "/valleyPeakDifferenceGxStatisticsMonth")
+    public JSONObject valleyPeakDifferenceGxStatisticsMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceGxStatisticsMonth();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceGxStatisticsMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
-	@ApiOperation(value="谷峰差分厂月统计", notes="谷峰差分厂月统计")
-	@GetMapping(value = "/valleyPeakDifferenceFcStatisticsMonth")
-	public JSONObject valleyPeakDifferenceFcStatisticsMonth() {
+    @ApiOperation(value = "谷峰差分厂月统计", notes = "谷峰差分厂月统计")
+    @GetMapping(value = "/valleyPeakDifferenceFcStatisticsMonth")
+    public JSONObject valleyPeakDifferenceFcStatisticsMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceFcStatisticsMonth();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceFcStatisticsMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 
 
-	@ApiOperation(value="谷峰差公司月统计", notes="谷峰差公司月统计")
-	@GetMapping(value = "/valleyPeakDifferenceGsStatisticsMonth")
-	public JSONObject valleyPeakDifferenceGsStatisticsMonth() {
+    @ApiOperation(value = "谷峰差公司月统计", notes = "谷峰差公司月统计")
+    @GetMapping(value = "/valleyPeakDifferenceGsStatisticsMonth")
+    public JSONObject valleyPeakDifferenceGsStatisticsMonth(ExportQueryDTO queryDTO) {
 
-		JSONObject result = fpgLeanModelService.valleyPeakDifferenceGsStatisticsMonth();
+        JSONObject result = fpgLeanModelService.valleyPeakDifferenceGsStatisticsMonth(queryDTO);
 
-		return result;
-	}
+        return result;
+    }
 }

+ 18 - 0
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/entity/ExportQueryDTO.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.fpgLeanModel.entity;
+
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+public class ExportQueryDTO {
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date date;
+
+    private String month;
+
+    private String year;
+
+}

+ 18 - 21
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/service/IFpgLeanModelService.java

@@ -3,10 +3,7 @@ package org.jeecg.modules.fpgLeanModel.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.fpgLeanModel.entity.DeviceStatiscsModelMongodb;
-import org.jeecg.modules.fpgLeanModel.entity.FpgLeanModel;
-import org.jeecg.modules.fpgLeanModel.entity.FpgLeanModelResult;
-import org.jeecg.modules.fpgLeanModel.entity.LeanModelDeviceHistoryInfo;
+import org.jeecg.modules.fpgLeanModel.entity.*;
 
 import java.util.List;
 
@@ -28,41 +25,41 @@ public interface IFpgLeanModelService extends IService<FpgLeanModel> {
 
     JSONObject totalElectricityConsumptionReport();
 
-    JSONObject electricityControl();
+    JSONObject electricityControl(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlDay();
+    JSONObject electricityControlDay(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlGxDay();
+    JSONObject electricityControlGxDay(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlFcDay();
+    JSONObject electricityControlFcDay(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlGsDay();
+    JSONObject electricityControlGsDay(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlMonth();
+    JSONObject electricityControlMonth(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlGxMonth();
+    JSONObject electricityControlGxMonth(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlFcMonth();
+    JSONObject electricityControlFcMonth(ExportQueryDTO queryDTO);
 
-    JSONObject electricityControlGsMonth();
+    JSONObject electricityControlGsMonth(ExportQueryDTO queryDTO);
 
     JSONObject operatingStatistic();
 
-    JSONObject valleyPeakDifferenceStatistics();
+    JSONObject valleyPeakDifferenceStatistics(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceGxStatistics();
+    JSONObject valleyPeakDifferenceGxStatistics(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceFcStatistics();
+    JSONObject valleyPeakDifferenceFcStatistics(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceGsStatistics();
+    JSONObject valleyPeakDifferenceGsStatistics(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceStatisticsMonth();
+    JSONObject valleyPeakDifferenceStatisticsMonth(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceGxStatisticsMonth();
+    JSONObject valleyPeakDifferenceGxStatisticsMonth(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceFcStatisticsMonth();
+    JSONObject valleyPeakDifferenceFcStatisticsMonth(ExportQueryDTO queryDTO);
 
-    JSONObject valleyPeakDifferenceGsStatisticsMonth();
+    JSONObject valleyPeakDifferenceGsStatisticsMonth(ExportQueryDTO queryDTO);
 
 
 }

+ 368 - 64
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/service/impl/FpgLeanModelServiceImpl.java

@@ -216,7 +216,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
-                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, null, null,null);
+                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, null, null, null);
                     }
                     return null;
                 }).filter(x -> x != null).collect(Collectors.toList());
@@ -369,7 +369,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
-                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()),"龙钢公司");
+                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()), "龙钢公司");
                     }
                     return null;
                 }).filter(x -> x != null).collect(Collectors.toList());
@@ -443,13 +443,31 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControl() {
+    public JSONObject electricityControl(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
@@ -505,7 +523,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
-                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()),"龙钢公司");
+                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()), "龙钢公司");
                     }
                     return null;
                 }).filter(x -> x != null).collect(Collectors.toList());
@@ -772,12 +790,30 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControlDay() {
+    public JSONObject electricityControlDay(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
+
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
@@ -833,7 +869,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
-                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()),"龙钢公司");
+                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()), "龙钢公司");
                     }
                     return null;
                 }).filter(x -> x != null).collect(Collectors.toList());
@@ -1026,7 +1062,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         Collectors.mapping(ElectricityControlReport::getValue,
                                 Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
 
-      // 根据分组结果,将totalNum字段设置为对应的分组总和
+        // 根据分组结果,将totalNum字段设置为对应的分组总和
         modelDataResults.forEach(report -> {
             BigDecimal totalValueForGroup = groupedTotalValues.get(report.getCreateTime() + "_" + report.getDeviceTitle());
             report.setTotalNum(totalValueForGroup); // 将分组总和赋值给totalNum// 计算占比(value / totalValueForGroup)
@@ -1049,12 +1085,30 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControlGxDay() {
+    public JSONObject electricityControlGxDay(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
@@ -1125,7 +1179,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         Map<String, BigDecimal> dailyTotals = finalResult.stream()
                 .collect(Collectors.groupingBy(report -> {
                     String key = report.getCreateTime() + "_" + report.getRegionTitle();
-                    if (report.getDeviceTypeName()!= null &&!report.getDeviceTypeName().isEmpty()) {
+                    if (report.getDeviceTypeName() != null && !report.getDeviceTypeName().isEmpty()) {
                         key += "_" + report.getDeviceTypeName();
                     }
                     return key;
@@ -1150,7 +1204,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
             String yearFormattedDate = date.getYear() + "年";
 
             String totalKey = createTime + "_" + regionTitle;
-            if (deviceTypeName!= null &&!deviceTypeName.isEmpty()) {
+            if (deviceTypeName != null && !deviceTypeName.isEmpty()) {
                 totalKey += "_" + deviceTypeName;
             }
             BigDecimal dailyTotal = dailyTotals.get(totalKey); // 获取当天总值
@@ -1206,12 +1260,30 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControlFcDay() {
+    public JSONObject electricityControlFcDay(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
@@ -1352,13 +1424,31 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
 
 
     @Override
-    public JSONObject electricityControlGsDay() {
+    public JSONObject electricityControlGsDay(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
@@ -1496,7 +1586,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
 
 
     @Override
-    public JSONObject electricityControlMonth() {
+    public JSONObject electricityControlMonth(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -1504,6 +1594,27 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         JSONObject result = new JSONObject();
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList)) {
@@ -1556,7 +1667,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
-                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()),"龙钢公司");
+                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()), "龙钢公司");
                     }
                     return null;
                 }).filter(x -> x != null).collect(Collectors.toList());
@@ -1662,13 +1773,34 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControlGxMonth() {
+    public JSONObject electricityControlGxMonth(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList)) {
@@ -1719,7 +1851,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                             DeviceInformation deviceInfo = deviceInfoMap.get(data.getDeviceInformationId());
                             if (deviceInfo != null) {
                                 ElectricityControlReport report = new ElectricityControlReport();
-                                LocalDate date = LocalDate.parse(DateUtils.date2Str(data.getCreateTime(), DateUtils.date_sdf.get()), formatter);
+                                LocalDate date = LocalDate.parse(data.getDates(), formatter);
                                 String monthStr = date.getYear() + "年" + date.getMonthValue() + "月";
                                 report.setRegionTitle(data.getRegionTitle());
                                 report.setDeviceTypeName(mapDeviceType(deviceInfo.getDeviceType()));
@@ -1741,7 +1873,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         Map<String, BigDecimal> monthTotals = finalResult.stream()
                 .collect(Collectors.groupingBy(report -> {
                     String key = report.getMonth() + "_" + report.getRegionTitle();
-                    if (report.getDeviceTypeName()!= null &&!report.getDeviceTypeName().isEmpty()) {
+                    if (report.getDeviceTypeName() != null && !report.getDeviceTypeName().isEmpty()) {
                         key += "_" + report.getDeviceTypeName();
                     }
                     return key;
@@ -1767,7 +1899,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
 
 
                 String totalKey = month + "_" + regionTitle;
-                if (deviceTypeName!= null &&!deviceTypeName.isEmpty()) {
+                if (deviceTypeName != null && !deviceTypeName.isEmpty()) {
                     totalKey += "_" + deviceTypeName;
                 }
                 BigDecimal monthlyTotal = monthTotals.get(totalKey); // 获取当天总值
@@ -1827,7 +1959,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControlFcMonth() {
+    public JSONObject electricityControlFcMonth(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -1835,6 +1967,27 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         JSONObject result = new JSONObject();
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList)) {
@@ -1885,7 +2038,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                             DeviceInformation deviceInfo = deviceInfoMap.get(data.getDeviceInformationId());
                             if (deviceInfo != null) {
                                 ElectricityControlReport report = new ElectricityControlReport();
-                                LocalDate date = LocalDate.parse(DateUtils.date2Str(data.getCreateTime(), DateUtils.date_sdf.get()), formatter);
+                                LocalDate date = LocalDate.parse(data.getDates(), formatter);
                                 String monthStr = date.getYear() + "年" + date.getMonthValue() + "月";
                                 report.setRegionTitle(data.getRegionTitle());
                                 report.setDeviceTypeName(mapDeviceType(deviceInfo.getDeviceType()));
@@ -1983,13 +2136,34 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject electricityControlGsMonth() {
+    public JSONObject electricityControlGsMonth(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (oConvertUtils.listIsEmpty(fpgStatiscsModelDataList)) {
@@ -2026,7 +2200,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                             DeviceInformation deviceInfo = deviceInfoMap.get(data.getDeviceInformationId());
                             if (deviceInfo != null) {
                                 ElectricityControlReport report = new ElectricityControlReport();
-                                LocalDate date = LocalDate.parse(DateUtils.date2Str(data.getCreateTime(), DateUtils.date_sdf.get()), formatter);
+                                LocalDate date = LocalDate.parse(data.getDates(), formatter);
                                 String monthStr = date.getYear() + "年" + date.getMonthValue() + "月";
                                 report.setCompanyName("龙钢公司");
                                 report.setKey1(key);
@@ -2172,7 +2346,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
-                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()),"龙钢公司");
+                                b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(), b.getProportion(), b.getDates(), dateString, b.getRegionTitle(), mapDeviceType(a.getDeviceType()), "龙钢公司");
                     }
                     return null;
                 }).filter(x -> x != null).collect(Collectors.toList());
@@ -2494,19 +2668,33 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceStatistics() {
+    public JSONObject valleyPeakDifferenceStatistics(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
-        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
 
+        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
             result.put("data", new JSONArray());
@@ -2555,7 +2743,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
                                 b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(),
-                                b.getProportion(), b.getDates(), dateString, null, null,"龙钢公司");
+                                b.getProportion(), b.getDates(), dateString, null, null, "龙钢公司");
                     }
                     return null;
                 }).filter(Objects::nonNull).collect(Collectors.toList());
@@ -2651,17 +2839,32 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceGxStatistics() {
+    public JSONObject valleyPeakDifferenceGxStatistics(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
-        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
@@ -2712,7 +2915,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
                                 b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(),
-                                b.getProportion(), b.getDates(), dateString, regionMap.get(b.getDeviceRegionId()), mapDeviceType(a.getDeviceType()),"龙钢公司");
+                                b.getProportion(), b.getDates(), dateString, regionMap.get(b.getDeviceRegionId()), mapDeviceType(a.getDeviceType()), "龙钢公司");
                     }
                     return null;
                 }).filter(Objects::nonNull).collect(Collectors.toList());
@@ -2778,18 +2981,33 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceFcStatistics() {
+    public JSONObject valleyPeakDifferenceFcStatistics(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
-        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
@@ -2840,7 +3058,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
                                 b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(),
-                                b.getProportion(), b.getDates(), dateString, regionMap.get(b.getDeviceRegionId()), null,"龙钢公司");
+                                b.getProportion(), b.getDates(), dateString, regionMap.get(b.getDeviceRegionId()), null, "龙钢公司");
                     }
                     return null;
                 }).filter(Objects::nonNull).collect(Collectors.toList());
@@ -2897,19 +3115,33 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceGsStatistics() {
+    public JSONObject valleyPeakDifferenceGsStatistics(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
         JSONObject result = new JSONObject();
         Query query = new Query();
-        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
+        String month = queryDTO.getMonth();
+        LocalDate startDate, endDate;
+
+        if (month == null || month.isEmpty()) {
+            // 如果 month 为空,则默认查询当前月份的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfMonth(1); // 当前月的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        } else {
+            // 解析传入的 month 参数
+            startDate = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份的第一天
+            endDate = startDate.plusMonths(1); // 下个月的第一天
+        }
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
 
+        query.with(Sort.by(Sort.Direction.ASC, "createTime"));
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
             result.put("data", new JSONArray());
@@ -2943,7 +3175,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
                                 b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(),
-                                b.getProportion(), b.getDates(), dateString, null, null,"龙钢公司"); // 使用DeviceInformation中的CompanyName
+                                b.getProportion(), b.getDates(), dateString, null, null, "龙钢公司"); // 使用DeviceInformation中的CompanyName
                     }
                     return null;
                 }).filter(Objects::nonNull).collect(Collectors.toList());
@@ -3000,7 +3232,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceStatisticsMonth() {
+    public JSONObject valleyPeakDifferenceStatisticsMonth(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
@@ -3008,9 +3240,27 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
@@ -3057,7 +3307,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
                                 b.getTopsProportion(), b.getPeaksProportion(), b.getFlatProportion(), b.getValleysProportion(),
-                                b.getProportion(), b.getDates(), dateString, null, null,"龙钢公司");
+                                b.getProportion(), b.getDates(), dateString, null, null, "龙钢公司");
                     }
                     return null;
                 }).filter(Objects::nonNull).collect(Collectors.toList());
@@ -3109,7 +3359,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceGxStatisticsMonth() {
+    public JSONObject valleyPeakDifferenceGxStatisticsMonth(ExportQueryDTO queryDTO) {
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
@@ -3117,9 +3367,27 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
@@ -3231,7 +3499,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceFcStatisticsMonth() {
+    public JSONObject valleyPeakDifferenceFcStatisticsMonth(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -3240,9 +3508,27 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");
@@ -3353,7 +3639,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject valleyPeakDifferenceGsStatisticsMonth() {
+    public JSONObject valleyPeakDifferenceGsStatisticsMonth(ExportQueryDTO queryDTO) {
 
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@@ -3362,9 +3648,27 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
 
-        // 查询 MongoDB 中的数据
-        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList =
-                mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
+        // 获取 queryDTO 中的 year 字段
+        String year = queryDTO.getYear();
+        LocalDate startDate, endDate;
+
+        // 判断是否传入了 year 参数
+        if (year == null || year.isEmpty()) {
+            // 如果 year 为空,默认查询当前年的数据
+            LocalDate currentDate = LocalDate.now();
+            startDate = currentDate.withDayOfYear(1); // 当前年的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        } else {
+            // 如果 year 不为空,解析 year 为年范围
+            startDate = LocalDate.parse(year + "-01-01", formatter); // 年份的第一天
+            endDate = startDate.plusYears(1); // 下一年的第一天
+        }
+
+        // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
+        query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
+
+        // 查询数据
+        List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
         if (CollectionUtils.isEmpty(fpgStatiscsModelDataList)) {
             log.info("{}{}", "mongo数据查询为空,峰平谷报表导出失败!", "total_day_powerproportioncurrent");