feat(ems): 添加告警、能耗记录和能源费率模块- 新增告警实体类 EmsAlert 及相关业务对象、控制器、映射器和服务实现
- 新增能耗记录实体类 EmsEnergyConsumption 及相关业务对象、控制器、映射器和服务实现 - 新增能源费率实体类 EmsEnergyRate 及相关业务对象、控制器、映射器和服务实现 - 实现各模块的基础 CRUD 功能,包括分页查询、导出 Excel 等操作 - 配置 MyBatis 映射文件及逻辑删除支持
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsAlertVo;
|
||||
import com.klp.ems.domain.bo.EmsAlertBo;
|
||||
import com.klp.ems.service.IEmsAlertService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 告警
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/ems/alert")
|
||||
public class EmsAlertController extends BaseController {
|
||||
|
||||
private final IEmsAlertService iEmsAlertService;
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsAlertVo> list(EmsAlertBo bo, PageQuery pageQuery) {
|
||||
return iEmsAlertService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出告警列表
|
||||
*/
|
||||
@Log(title = "告警", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsAlertBo bo, HttpServletResponse response) {
|
||||
List<EmsAlertVo> list = iEmsAlertService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "告警", EmsAlertVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取告警详细信息
|
||||
*
|
||||
* @param alertId 主键
|
||||
*/
|
||||
@GetMapping("/{alertId}")
|
||||
public R<EmsAlertVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long alertId) {
|
||||
return R.ok(iEmsAlertService.queryById(alertId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增告警
|
||||
*/
|
||||
@Log(title = "告警", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsAlertBo bo) {
|
||||
return toAjax(iEmsAlertService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改告警
|
||||
*/
|
||||
@Log(title = "告警", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsAlertBo bo) {
|
||||
return toAjax(iEmsAlertService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除告警
|
||||
*
|
||||
* @param alertIds 主键串
|
||||
*/
|
||||
@Log(title = "告警", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{alertIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] alertIds) {
|
||||
return toAjax(iEmsAlertService.deleteWithValidByIds(Arrays.asList(alertIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsEnergyConsumptionVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyConsumptionBo;
|
||||
import com.klp.ems.service.IEmsEnergyConsumptionService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 能耗记录
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/ems/energyConsumption")
|
||||
public class EmsEnergyConsumptionController extends BaseController {
|
||||
|
||||
private final IEmsEnergyConsumptionService iEmsEnergyConsumptionService;
|
||||
|
||||
/**
|
||||
* 查询能耗记录列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsEnergyConsumptionVo> list(EmsEnergyConsumptionBo bo, PageQuery pageQuery) {
|
||||
return iEmsEnergyConsumptionService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出能耗记录列表
|
||||
*/
|
||||
@Log(title = "能耗记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsEnergyConsumptionBo bo, HttpServletResponse response) {
|
||||
List<EmsEnergyConsumptionVo> list = iEmsEnergyConsumptionService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "能耗记录", EmsEnergyConsumptionVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取能耗记录详细信息
|
||||
*
|
||||
* @param energyConsumptionId 主键
|
||||
*/
|
||||
@GetMapping("/{energyConsumptionId}")
|
||||
public R<EmsEnergyConsumptionVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long energyConsumptionId) {
|
||||
return R.ok(iEmsEnergyConsumptionService.queryById(energyConsumptionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能耗记录
|
||||
*/
|
||||
@Log(title = "能耗记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsEnergyConsumptionBo bo) {
|
||||
return toAjax(iEmsEnergyConsumptionService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能耗记录
|
||||
*/
|
||||
@Log(title = "能耗记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsEnergyConsumptionBo bo) {
|
||||
return toAjax(iEmsEnergyConsumptionService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除能耗记录
|
||||
*
|
||||
* @param energyConsumptionIds 主键串
|
||||
*/
|
||||
@Log(title = "能耗记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{energyConsumptionIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] energyConsumptionIds) {
|
||||
return toAjax(iEmsEnergyConsumptionService.deleteWithValidByIds(Arrays.asList(energyConsumptionIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsEnergyRateVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyRateBo;
|
||||
import com.klp.ems.service.IEmsEnergyRateService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/ems/energyRate")
|
||||
public class EmsEnergyRateController extends BaseController {
|
||||
|
||||
private final IEmsEnergyRateService iEmsEnergyRateService;
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsEnergyRateVo> list(EmsEnergyRateBo bo, PageQuery pageQuery) {
|
||||
return iEmsEnergyRateService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)列表
|
||||
*/
|
||||
@Log(title = "能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsEnergyRateBo bo, HttpServletResponse response) {
|
||||
List<EmsEnergyRateVo> list = iEmsEnergyRateService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)", EmsEnergyRateVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)详细信息
|
||||
*
|
||||
* @param energyRateId 主键
|
||||
*/
|
||||
@GetMapping("/{energyRateId}")
|
||||
public R<EmsEnergyRateVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long energyRateId) {
|
||||
return R.ok(iEmsEnergyRateService.queryById(energyRateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
@Log(title = "能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsEnergyRateBo bo) {
|
||||
return toAjax(iEmsEnergyRateService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
@Log(title = "能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsEnergyRateBo bo) {
|
||||
return toAjax(iEmsEnergyRateService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*
|
||||
* @param energyRateIds 主键串
|
||||
*/
|
||||
@Log(title = "能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{energyRateIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] energyRateIds) {
|
||||
return toAjax(iEmsEnergyRateService.deleteWithValidByIds(Arrays.asList(energyRateIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsEnergyTypeVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyTypeBo;
|
||||
import com.klp.ems.service.IEmsEnergyTypeService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mes/energyType")
|
||||
public class EmsEnergyTypeController extends BaseController {
|
||||
|
||||
private final IEmsEnergyTypeService iEmsEnergyTypeService;
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsEnergyTypeVo> list(EmsEnergyTypeBo bo, PageQuery pageQuery) {
|
||||
return iEmsEnergyTypeService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出能源类型(阈值已移除)列表
|
||||
*/
|
||||
@Log(title = "能源类型(阈值已移除)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsEnergyTypeBo bo, HttpServletResponse response) {
|
||||
List<EmsEnergyTypeVo> list = iEmsEnergyTypeService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "能源类型(阈值已移除)", EmsEnergyTypeVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取能源类型(阈值已移除)详细信息
|
||||
*
|
||||
* @param energyTypeId 主键
|
||||
*/
|
||||
@GetMapping("/{energyTypeId}")
|
||||
public R<EmsEnergyTypeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long energyTypeId) {
|
||||
return R.ok(iEmsEnergyTypeService.queryById(energyTypeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能源类型(阈值已移除)
|
||||
*/
|
||||
@Log(title = "能源类型(阈值已移除)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsEnergyTypeBo bo) {
|
||||
return toAjax(iEmsEnergyTypeService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能源类型(阈值已移除)
|
||||
*/
|
||||
@Log(title = "能源类型(阈值已移除)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsEnergyTypeBo bo) {
|
||||
return toAjax(iEmsEnergyTypeService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除能源类型(阈值已移除)
|
||||
*
|
||||
* @param energyTypeIds 主键串
|
||||
*/
|
||||
@Log(title = "能源类型(阈值已移除)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{energyTypeIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] energyTypeIds) {
|
||||
return toAjax(iEmsEnergyTypeService.deleteWithValidByIds(Arrays.asList(energyTypeIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsLocationVo;
|
||||
import com.klp.ems.domain.bo.EmsLocationBo;
|
||||
import com.klp.ems.service.IEmsLocationService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mes/location")
|
||||
public class EmsLocationController extends BaseController {
|
||||
|
||||
private final IEmsLocationService iEmsLocationService;
|
||||
|
||||
/**
|
||||
* 查询位置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsLocationVo> list(EmsLocationBo bo, PageQuery pageQuery) {
|
||||
return iEmsLocationService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出位置列表
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsLocationBo bo, HttpServletResponse response) {
|
||||
List<EmsLocationVo> list = iEmsLocationService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "位置", EmsLocationVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取位置详细信息
|
||||
*
|
||||
* @param locationId 主键
|
||||
*/
|
||||
@GetMapping("/{locationId}")
|
||||
public R<EmsLocationVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long locationId) {
|
||||
return R.ok(iEmsLocationService.queryById(locationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增位置
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsLocationBo bo) {
|
||||
return toAjax(iEmsLocationService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改位置
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsLocationBo bo) {
|
||||
return toAjax(iEmsLocationService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除位置
|
||||
*
|
||||
* @param locationIds 主键串
|
||||
*/
|
||||
@Log(title = "位置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{locationIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] locationIds) {
|
||||
return toAjax(iEmsLocationService.deleteWithValidByIds(Arrays.asList(locationIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsMeterVo;
|
||||
import com.klp.ems.domain.bo.EmsMeterBo;
|
||||
import com.klp.ems.service.IEmsMeterService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mes/meter")
|
||||
public class EmsMeterController extends BaseController {
|
||||
|
||||
private final IEmsMeterService iEmsMeterService;
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EmsMeterVo> list(EmsMeterBo bo, PageQuery pageQuery) {
|
||||
return iEmsMeterService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出计量设备(阈值移至此处)列表
|
||||
*/
|
||||
@Log(title = "计量设备(阈值移至此处)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EmsMeterBo bo, HttpServletResponse response) {
|
||||
List<EmsMeterVo> list = iEmsMeterService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "计量设备(阈值移至此处)", EmsMeterVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取计量设备(阈值移至此处)详细信息
|
||||
*
|
||||
* @param meterId 主键
|
||||
*/
|
||||
@GetMapping("/{meterId}")
|
||||
public R<EmsMeterVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long meterId) {
|
||||
return R.ok(iEmsMeterService.queryById(meterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增计量设备(阈值移至此处)
|
||||
*/
|
||||
@Log(title = "计量设备(阈值移至此处)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EmsMeterBo bo) {
|
||||
return toAjax(iEmsMeterService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计量设备(阈值移至此处)
|
||||
*/
|
||||
@Log(title = "计量设备(阈值移至此处)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EmsMeterBo bo) {
|
||||
return toAjax(iEmsMeterService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计量设备(阈值移至此处)
|
||||
*
|
||||
* @param meterIds 主键串
|
||||
*/
|
||||
@Log(title = "计量设备(阈值移至此处)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{meterIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] meterIds) {
|
||||
return toAjax(iEmsMeterService.deleteWithValidByIds(Arrays.asList(meterIds), true));
|
||||
}
|
||||
}
|
||||
67
klp-ems/src/main/java/com/klp/ems/domain/EmsAlert.java
Normal file
67
klp-ems/src/main/java/com/klp/ems/domain/EmsAlert.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 告警对象 ems_alert
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ems_alert")
|
||||
public class EmsAlert extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "alert_id")
|
||||
private Long alertId;
|
||||
/**
|
||||
* 关联计量设备
|
||||
*/
|
||||
private Long meterId;
|
||||
/**
|
||||
* 告警类型:0=异常用量,1=高用量,2=设备故障
|
||||
*/
|
||||
private Long alertType;
|
||||
/**
|
||||
* 实际值
|
||||
*/
|
||||
private BigDecimal actualValue;
|
||||
/**
|
||||
* 告警时间
|
||||
*/
|
||||
private Date alertTime;
|
||||
/**
|
||||
* 告警状态:0=待处理,1=已处理
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 处理人(不设外键)
|
||||
*/
|
||||
private Long resolvedBy;
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
private Date resolvedTime;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 能耗记录对象 ems_energy_consumption
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ems_energy_consumption")
|
||||
public class EmsEnergyConsumption extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "energy_consumption_id")
|
||||
private Long energyConsumptionId;
|
||||
/**
|
||||
* 关联计量设备
|
||||
*/
|
||||
private Long meterId;
|
||||
/**
|
||||
* 起始读数
|
||||
*/
|
||||
private BigDecimal startReading;
|
||||
/**
|
||||
* 结束读数
|
||||
*/
|
||||
private BigDecimal endReading;
|
||||
/**
|
||||
* 消耗量
|
||||
*/
|
||||
private BigDecimal consumption;
|
||||
/**
|
||||
* 起始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 记录人(不设外键)
|
||||
*/
|
||||
private Long recordedBy;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
60
klp-ems/src/main/java/com/klp/ems/domain/EmsEnergyRate.java
Normal file
60
klp-ems/src/main/java/com/klp/ems/domain/EmsEnergyRate.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)对象 ems_energy_rate
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ems_energy_rate")
|
||||
public class EmsEnergyRate extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "energy_rate_id")
|
||||
private Long energyRateId;
|
||||
/**
|
||||
* 关联能源类型
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
/**
|
||||
* 费率
|
||||
*/
|
||||
private BigDecimal rate;
|
||||
/**
|
||||
* 货币:0=CNY,1=USD,2=EUR
|
||||
*/
|
||||
private Long currency;
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
private Date effectiveDate;
|
||||
/**
|
||||
* 失效日期,NULL表示长期有效
|
||||
*/
|
||||
private Date expiryDate;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
53
klp-ems/src/main/java/com/klp/ems/domain/EmsEnergyType.java
Normal file
53
klp-ems/src/main/java/com/klp/ems/domain/EmsEnergyType.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)对象 ems_energy_type
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ems_energy_type")
|
||||
public class EmsEnergyType extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "energy_type_id")
|
||||
private Long energyTypeId;
|
||||
/**
|
||||
* 能源名称,如:电力、自来水、天然气
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 计量单位,如:kWh、m³
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 能源编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 能源描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
53
klp-ems/src/main/java/com/klp/ems/domain/EmsLocation.java
Normal file
53
klp-ems/src/main/java/com/klp/ems/domain/EmsLocation.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 位置对象 ems_location
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ems_location")
|
||||
public class EmsLocation extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "location_id")
|
||||
private Long locationId;
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 父级区域ID,用于构建区域层级
|
||||
*/
|
||||
private Long parentId;
|
||||
/**
|
||||
* 区域描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
76
klp-ems/src/main/java/com/klp/ems/domain/EmsMeter.java
Normal file
76
klp-ems/src/main/java/com/klp/ems/domain/EmsMeter.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)对象 ems_meter
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ems_meter")
|
||||
public class EmsMeter extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "meter_id")
|
||||
private Long meterId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String meterCode;
|
||||
/**
|
||||
* 关联能源类型
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
private Long locationId;
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String model;
|
||||
/**
|
||||
* 制造商
|
||||
*/
|
||||
private String manufacturer;
|
||||
/**
|
||||
* 安装日期
|
||||
*/
|
||||
private Date installDate;
|
||||
/**
|
||||
* 设备状态:0=在用,1=停用,2=维护
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 上次校准日期
|
||||
*/
|
||||
private Date lastCalibrationDate;
|
||||
/**
|
||||
* 阈值(按设备设置)
|
||||
*/
|
||||
private BigDecimal thresholdValue;
|
||||
/**
|
||||
* 删除标志(0=存在 2=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
69
klp-ems/src/main/java/com/klp/ems/domain/bo/EmsAlertBo.java
Normal file
69
klp-ems/src/main/java/com/klp/ems/domain/bo/EmsAlertBo.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 告警业务对象 ems_alert
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmsAlertBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long alertId;
|
||||
|
||||
/**
|
||||
* 关联计量设备
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 告警类型:0=异常用量,1=高用量,2=设备故障
|
||||
*/
|
||||
private Long alertType;
|
||||
|
||||
/**
|
||||
* 实际值
|
||||
*/
|
||||
private BigDecimal actualValue;
|
||||
|
||||
/**
|
||||
* 告警时间
|
||||
*/
|
||||
private Date alertTime;
|
||||
|
||||
/**
|
||||
* 告警状态:0=待处理,1=已处理
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 处理人(不设外键)
|
||||
*/
|
||||
private Long resolvedBy;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
private Date resolvedTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 能耗记录业务对象 ems_energy_consumption
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmsEnergyConsumptionBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long energyConsumptionId;
|
||||
|
||||
/**
|
||||
* 关联计量设备
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 起始读数
|
||||
*/
|
||||
private BigDecimal startReading;
|
||||
|
||||
/**
|
||||
* 结束读数
|
||||
*/
|
||||
private BigDecimal endReading;
|
||||
|
||||
/**
|
||||
* 消耗量
|
||||
*/
|
||||
private BigDecimal consumption;
|
||||
|
||||
/**
|
||||
* 起始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 记录人(不设外键)
|
||||
*/
|
||||
private Long recordedBy;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)业务对象 ems_energy_rate
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmsEnergyRateBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long energyRateId;
|
||||
|
||||
/**
|
||||
* 关联能源类型
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 费率
|
||||
*/
|
||||
private BigDecimal rate;
|
||||
|
||||
/**
|
||||
* 货币:0=CNY,1=USD,2=EUR
|
||||
*/
|
||||
private Long currency;
|
||||
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
private Date effectiveDate;
|
||||
|
||||
/**
|
||||
* 失效日期,NULL表示长期有效
|
||||
*/
|
||||
private Date expiryDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)业务对象 ems_energy_type
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmsEnergyTypeBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 能源名称,如:电力、自来水、天然气
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 计量单位,如:kWh、m³
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 能源编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 能源描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 位置业务对象 ems_location
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmsLocationBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父级区域ID,用于构建区域层级
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 区域描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
79
klp-ems/src/main/java/com/klp/ems/domain/bo/EmsMeterBo.java
Normal file
79
klp-ems/src/main/java/com/klp/ems/domain/bo/EmsMeterBo.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)业务对象 ems_meter
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmsMeterBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String meterCode;
|
||||
|
||||
/**
|
||||
* 关联能源类型
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 制造商
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 安装日期
|
||||
*/
|
||||
private Date installDate;
|
||||
|
||||
/**
|
||||
* 设备状态:0=在用,1=停用,2=维护
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 上次校准日期
|
||||
*/
|
||||
private Date lastCalibrationDate;
|
||||
|
||||
/**
|
||||
* 阈值(按设备设置)
|
||||
*/
|
||||
private BigDecimal thresholdValue;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
81
klp-ems/src/main/java/com/klp/ems/domain/vo/EmsAlertVo.java
Normal file
81
klp-ems/src/main/java/com/klp/ems/domain/vo/EmsAlertVo.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 告警视图对象 ems_alert
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EmsAlertVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long alertId;
|
||||
|
||||
/**
|
||||
* 关联计量设备
|
||||
*/
|
||||
@ExcelProperty(value = "关联计量设备")
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 告警类型:0=异常用量,1=高用量,2=设备故障
|
||||
*/
|
||||
@ExcelProperty(value = "告警类型:0=异常用量,1=高用量,2=设备故障")
|
||||
private Long alertType;
|
||||
|
||||
/**
|
||||
* 实际值
|
||||
*/
|
||||
@ExcelProperty(value = "实际值")
|
||||
private BigDecimal actualValue;
|
||||
|
||||
/**
|
||||
* 告警时间
|
||||
*/
|
||||
@ExcelProperty(value = "告警时间")
|
||||
private Date alertTime;
|
||||
|
||||
/**
|
||||
* 告警状态:0=待处理,1=已处理
|
||||
*/
|
||||
@ExcelProperty(value = "告警状态:0=待处理,1=已处理")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 处理人(不设外键)
|
||||
*/
|
||||
@ExcelProperty(value = "处理人", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "不=设外键")
|
||||
private Long resolvedBy;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
@ExcelProperty(value = "处理时间")
|
||||
private Date resolvedTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 能耗记录视图对象 ems_energy_consumption
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EmsEnergyConsumptionVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long energyConsumptionId;
|
||||
|
||||
/**
|
||||
* 关联计量设备
|
||||
*/
|
||||
@ExcelProperty(value = "关联计量设备")
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 起始读数
|
||||
*/
|
||||
@ExcelProperty(value = "起始读数")
|
||||
private BigDecimal startReading;
|
||||
|
||||
/**
|
||||
* 结束读数
|
||||
*/
|
||||
@ExcelProperty(value = "结束读数")
|
||||
private BigDecimal endReading;
|
||||
|
||||
/**
|
||||
* 消耗量
|
||||
*/
|
||||
@ExcelProperty(value = "消耗量")
|
||||
private BigDecimal consumption;
|
||||
|
||||
/**
|
||||
* 起始时间
|
||||
*/
|
||||
@ExcelProperty(value = "起始时间")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@ExcelProperty(value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 记录人(不设外键)
|
||||
*/
|
||||
@ExcelProperty(value = "记录人", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "不=设外键")
|
||||
private Long recordedBy;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)视图对象 ems_energy_rate
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EmsEnergyRateVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long energyRateId;
|
||||
|
||||
/**
|
||||
* 关联能源类型
|
||||
*/
|
||||
@ExcelProperty(value = "关联能源类型")
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 费率
|
||||
*/
|
||||
@ExcelProperty(value = "费率")
|
||||
private BigDecimal rate;
|
||||
|
||||
/**
|
||||
* 货币:0=CNY,1=USD,2=EUR
|
||||
*/
|
||||
@ExcelProperty(value = "货币:0=CNY,1=USD,2=EUR")
|
||||
private Long currency;
|
||||
|
||||
/**
|
||||
* 生效日期
|
||||
*/
|
||||
@ExcelProperty(value = "生效日期")
|
||||
private Date effectiveDate;
|
||||
|
||||
/**
|
||||
* 失效日期,NULL表示长期有效
|
||||
*/
|
||||
@ExcelProperty(value = "失效日期,NULL表示长期有效")
|
||||
private Date expiryDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)视图对象 ems_energy_type
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EmsEnergyTypeVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 能源名称,如:电力、自来水、天然气
|
||||
*/
|
||||
@ExcelProperty(value = "能源名称,如:电力、自来水、天然气")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 计量单位,如:kWh、m³
|
||||
*/
|
||||
@ExcelProperty(value = "计量单位,如:kWh、m³")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 能源编码
|
||||
*/
|
||||
@ExcelProperty(value = "能源编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 能源描述
|
||||
*/
|
||||
@ExcelProperty(value = "能源描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 位置视图对象 ems_location
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EmsLocationVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
@ExcelProperty(value = "区域名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父级区域ID,用于构建区域层级
|
||||
*/
|
||||
@ExcelProperty(value = "父级区域ID,用于构建区域层级")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 区域描述
|
||||
*/
|
||||
@ExcelProperty(value = "区域描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@ExcelProperty(value = "详细地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
93
klp-ems/src/main/java/com/klp/ems/domain/vo/EmsMeterVo.java
Normal file
93
klp-ems/src/main/java/com/klp/ems/domain/vo/EmsMeterVo.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)视图对象 ems_meter
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EmsMeterVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelProperty(value = "设备编号")
|
||||
private String meterCode;
|
||||
|
||||
/**
|
||||
* 关联能源类型
|
||||
*/
|
||||
@ExcelProperty(value = "关联能源类型")
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
@ExcelProperty(value = "安装位置")
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
@ExcelProperty(value = "设备型号")
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 制造商
|
||||
*/
|
||||
@ExcelProperty(value = "制造商")
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 安装日期
|
||||
*/
|
||||
@ExcelProperty(value = "安装日期")
|
||||
private Date installDate;
|
||||
|
||||
/**
|
||||
* 设备状态:0=在用,1=停用,2=维护
|
||||
*/
|
||||
@ExcelProperty(value = "设备状态:0=在用,1=停用,2=维护")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 上次校准日期
|
||||
*/
|
||||
@ExcelProperty(value = "上次校准日期")
|
||||
private Date lastCalibrationDate;
|
||||
|
||||
/**
|
||||
* 阈值(按设备设置)
|
||||
*/
|
||||
@ExcelProperty(value = "阈值", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "按=设备设置")
|
||||
private BigDecimal thresholdValue;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
15
klp-ems/src/main/java/com/klp/ems/mapper/EmsAlertMapper.java
Normal file
15
klp-ems/src/main/java/com/klp/ems/mapper/EmsAlertMapper.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.EmsAlert;
|
||||
import com.klp.ems.domain.vo.EmsAlertVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 告警Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface EmsAlertMapper extends BaseMapperPlus<EmsAlertMapper, EmsAlert, EmsAlertVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.EmsEnergyConsumption;
|
||||
import com.klp.ems.domain.vo.EmsEnergyConsumptionVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 能耗记录Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface EmsEnergyConsumptionMapper extends BaseMapperPlus<EmsEnergyConsumptionMapper, EmsEnergyConsumption, EmsEnergyConsumptionVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.EmsEnergyRate;
|
||||
import com.klp.ems.domain.vo.EmsEnergyRateVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface EmsEnergyRateMapper extends BaseMapperPlus<EmsEnergyRateMapper, EmsEnergyRate, EmsEnergyRateVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.EmsEnergyType;
|
||||
import com.klp.ems.domain.vo.EmsEnergyTypeVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface EmsEnergyTypeMapper extends BaseMapperPlus<EmsEnergyTypeMapper, EmsEnergyType, EmsEnergyTypeVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.EmsLocation;
|
||||
import com.klp.ems.domain.vo.EmsLocationVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 位置Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface EmsLocationMapper extends BaseMapperPlus<EmsLocationMapper, EmsLocation, EmsLocationVo> {
|
||||
|
||||
}
|
||||
15
klp-ems/src/main/java/com/klp/ems/mapper/EmsMeterMapper.java
Normal file
15
klp-ems/src/main/java/com/klp/ems/mapper/EmsMeterMapper.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.EmsMeter;
|
||||
import com.klp.ems.domain.vo.EmsMeterVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface EmsMeterMapper extends BaseMapperPlus<EmsMeterMapper, EmsMeter, EmsMeterVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.EmsAlert;
|
||||
import com.klp.ems.domain.vo.EmsAlertVo;
|
||||
import com.klp.ems.domain.bo.EmsAlertBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 告警Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface IEmsAlertService {
|
||||
|
||||
/**
|
||||
* 查询告警
|
||||
*/
|
||||
EmsAlertVo queryById(Long alertId);
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
TableDataInfo<EmsAlertVo> queryPageList(EmsAlertBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
List<EmsAlertVo> queryList(EmsAlertBo bo);
|
||||
|
||||
/**
|
||||
* 新增告警
|
||||
*/
|
||||
Boolean insertByBo(EmsAlertBo bo);
|
||||
|
||||
/**
|
||||
* 修改告警
|
||||
*/
|
||||
Boolean updateByBo(EmsAlertBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除告警信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.EmsEnergyConsumption;
|
||||
import com.klp.ems.domain.vo.EmsEnergyConsumptionVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyConsumptionBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 能耗记录Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface IEmsEnergyConsumptionService {
|
||||
|
||||
/**
|
||||
* 查询能耗记录
|
||||
*/
|
||||
EmsEnergyConsumptionVo queryById(Long energyConsumptionId);
|
||||
|
||||
/**
|
||||
* 查询能耗记录列表
|
||||
*/
|
||||
TableDataInfo<EmsEnergyConsumptionVo> queryPageList(EmsEnergyConsumptionBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询能耗记录列表
|
||||
*/
|
||||
List<EmsEnergyConsumptionVo> queryList(EmsEnergyConsumptionBo bo);
|
||||
|
||||
/**
|
||||
* 新增能耗记录
|
||||
*/
|
||||
Boolean insertByBo(EmsEnergyConsumptionBo bo);
|
||||
|
||||
/**
|
||||
* 修改能耗记录
|
||||
*/
|
||||
Boolean updateByBo(EmsEnergyConsumptionBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除能耗记录信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.EmsEnergyRate;
|
||||
import com.klp.ems.domain.vo.EmsEnergyRateVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyRateBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface IEmsEnergyRateService {
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
EmsEnergyRateVo queryById(Long energyRateId);
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)列表
|
||||
*/
|
||||
TableDataInfo<EmsEnergyRateVo> queryPageList(EmsEnergyRateBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)列表
|
||||
*/
|
||||
List<EmsEnergyRateVo> queryList(EmsEnergyRateBo bo);
|
||||
|
||||
/**
|
||||
* 新增能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
Boolean insertByBo(EmsEnergyRateBo bo);
|
||||
|
||||
/**
|
||||
* 修改能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
Boolean updateByBo(EmsEnergyRateBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.EmsEnergyType;
|
||||
import com.klp.ems.domain.vo.EmsEnergyTypeVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyTypeBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface IEmsEnergyTypeService {
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)
|
||||
*/
|
||||
EmsEnergyTypeVo queryById(Long energyTypeId);
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)列表
|
||||
*/
|
||||
TableDataInfo<EmsEnergyTypeVo> queryPageList(EmsEnergyTypeBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)列表
|
||||
*/
|
||||
List<EmsEnergyTypeVo> queryList(EmsEnergyTypeBo bo);
|
||||
|
||||
/**
|
||||
* 新增能源类型(阈值已移除)
|
||||
*/
|
||||
Boolean insertByBo(EmsEnergyTypeBo bo);
|
||||
|
||||
/**
|
||||
* 修改能源类型(阈值已移除)
|
||||
*/
|
||||
Boolean updateByBo(EmsEnergyTypeBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除能源类型(阈值已移除)信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.EmsLocation;
|
||||
import com.klp.ems.domain.vo.EmsLocationVo;
|
||||
import com.klp.ems.domain.bo.EmsLocationBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 位置Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface IEmsLocationService {
|
||||
|
||||
/**
|
||||
* 查询位置
|
||||
*/
|
||||
EmsLocationVo queryById(Long locationId);
|
||||
|
||||
/**
|
||||
* 查询位置列表
|
||||
*/
|
||||
TableDataInfo<EmsLocationVo> queryPageList(EmsLocationBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询位置列表
|
||||
*/
|
||||
List<EmsLocationVo> queryList(EmsLocationBo bo);
|
||||
|
||||
/**
|
||||
* 新增位置
|
||||
*/
|
||||
Boolean insertByBo(EmsLocationBo bo);
|
||||
|
||||
/**
|
||||
* 修改位置
|
||||
*/
|
||||
Boolean updateByBo(EmsLocationBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除位置信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.EmsMeter;
|
||||
import com.klp.ems.domain.vo.EmsMeterVo;
|
||||
import com.klp.ems.domain.bo.EmsMeterBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
public interface IEmsMeterService {
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)
|
||||
*/
|
||||
EmsMeterVo queryById(Long meterId);
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)列表
|
||||
*/
|
||||
TableDataInfo<EmsMeterVo> queryPageList(EmsMeterBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)列表
|
||||
*/
|
||||
List<EmsMeterVo> queryList(EmsMeterBo bo);
|
||||
|
||||
/**
|
||||
* 新增计量设备(阈值移至此处)
|
||||
*/
|
||||
Boolean insertByBo(EmsMeterBo bo);
|
||||
|
||||
/**
|
||||
* 修改计量设备(阈值移至此处)
|
||||
*/
|
||||
Boolean updateByBo(EmsMeterBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除计量设备(阈值移至此处)信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.EmsAlertBo;
|
||||
import com.klp.ems.domain.vo.EmsAlertVo;
|
||||
import com.klp.ems.domain.EmsAlert;
|
||||
import com.klp.ems.mapper.EmsAlertMapper;
|
||||
import com.klp.ems.service.IEmsAlertService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 告警Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmsAlertServiceImpl implements IEmsAlertService {
|
||||
|
||||
private final EmsAlertMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询告警
|
||||
*/
|
||||
@Override
|
||||
public EmsAlertVo queryById(Long alertId){
|
||||
return baseMapper.selectVoById(alertId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmsAlertVo> queryPageList(EmsAlertBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmsAlert> lqw = buildQueryWrapper(bo);
|
||||
Page<EmsAlertVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询告警列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmsAlertVo> queryList(EmsAlertBo bo) {
|
||||
LambdaQueryWrapper<EmsAlert> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmsAlert> buildQueryWrapper(EmsAlertBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmsAlert> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getMeterId() != null, EmsAlert::getMeterId, bo.getMeterId());
|
||||
lqw.eq(bo.getAlertType() != null, EmsAlert::getAlertType, bo.getAlertType());
|
||||
lqw.eq(bo.getActualValue() != null, EmsAlert::getActualValue, bo.getActualValue());
|
||||
lqw.eq(bo.getAlertTime() != null, EmsAlert::getAlertTime, bo.getAlertTime());
|
||||
lqw.eq(bo.getStatus() != null, EmsAlert::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getResolvedBy() != null, EmsAlert::getResolvedBy, bo.getResolvedBy());
|
||||
lqw.eq(bo.getResolvedTime() != null, EmsAlert::getResolvedTime, bo.getResolvedTime());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增告警
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EmsAlertBo bo) {
|
||||
EmsAlert add = BeanUtil.toBean(bo, EmsAlert.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setAlertId(add.getAlertId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改告警
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmsAlertBo bo) {
|
||||
EmsAlert update = BeanUtil.toBean(bo, EmsAlert.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmsAlert entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除告警
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.EmsEnergyConsumptionBo;
|
||||
import com.klp.ems.domain.vo.EmsEnergyConsumptionVo;
|
||||
import com.klp.ems.domain.EmsEnergyConsumption;
|
||||
import com.klp.ems.mapper.EmsEnergyConsumptionMapper;
|
||||
import com.klp.ems.service.IEmsEnergyConsumptionService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 能耗记录Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmsEnergyConsumptionServiceImpl implements IEmsEnergyConsumptionService {
|
||||
|
||||
private final EmsEnergyConsumptionMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询能耗记录
|
||||
*/
|
||||
@Override
|
||||
public EmsEnergyConsumptionVo queryById(Long energyConsumptionId){
|
||||
return baseMapper.selectVoById(energyConsumptionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能耗记录列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmsEnergyConsumptionVo> queryPageList(EmsEnergyConsumptionBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmsEnergyConsumption> lqw = buildQueryWrapper(bo);
|
||||
Page<EmsEnergyConsumptionVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能耗记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmsEnergyConsumptionVo> queryList(EmsEnergyConsumptionBo bo) {
|
||||
LambdaQueryWrapper<EmsEnergyConsumption> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmsEnergyConsumption> buildQueryWrapper(EmsEnergyConsumptionBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmsEnergyConsumption> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getMeterId() != null, EmsEnergyConsumption::getMeterId, bo.getMeterId());
|
||||
lqw.eq(bo.getStartReading() != null, EmsEnergyConsumption::getStartReading, bo.getStartReading());
|
||||
lqw.eq(bo.getEndReading() != null, EmsEnergyConsumption::getEndReading, bo.getEndReading());
|
||||
lqw.eq(bo.getConsumption() != null, EmsEnergyConsumption::getConsumption, bo.getConsumption());
|
||||
lqw.eq(bo.getStartTime() != null, EmsEnergyConsumption::getStartTime, bo.getStartTime());
|
||||
lqw.eq(bo.getEndTime() != null, EmsEnergyConsumption::getEndTime, bo.getEndTime());
|
||||
lqw.eq(bo.getRecordedBy() != null, EmsEnergyConsumption::getRecordedBy, bo.getRecordedBy());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能耗记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EmsEnergyConsumptionBo bo) {
|
||||
EmsEnergyConsumption add = BeanUtil.toBean(bo, EmsEnergyConsumption.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setEnergyConsumptionId(add.getEnergyConsumptionId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能耗记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmsEnergyConsumptionBo bo) {
|
||||
EmsEnergyConsumption update = BeanUtil.toBean(bo, EmsEnergyConsumption.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmsEnergyConsumption entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除能耗记录
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.EmsEnergyRateBo;
|
||||
import com.klp.ems.domain.vo.EmsEnergyRateVo;
|
||||
import com.klp.ems.domain.EmsEnergyRate;
|
||||
import com.klp.ems.mapper.EmsEnergyRateMapper;
|
||||
import com.klp.ems.service.IEmsEnergyRateService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmsEnergyRateServiceImpl implements IEmsEnergyRateService {
|
||||
|
||||
private final EmsEnergyRateMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
@Override
|
||||
public EmsEnergyRateVo queryById(Long energyRateId){
|
||||
return baseMapper.selectVoById(energyRateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmsEnergyRateVo> queryPageList(EmsEnergyRateBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmsEnergyRate> lqw = buildQueryWrapper(bo);
|
||||
Page<EmsEnergyRateVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmsEnergyRateVo> queryList(EmsEnergyRateBo bo) {
|
||||
LambdaQueryWrapper<EmsEnergyRate> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmsEnergyRate> buildQueryWrapper(EmsEnergyRateBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmsEnergyRate> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getEnergyTypeId() != null, EmsEnergyRate::getEnergyTypeId, bo.getEnergyTypeId());
|
||||
lqw.eq(bo.getRate() != null, EmsEnergyRate::getRate, bo.getRate());
|
||||
lqw.eq(bo.getCurrency() != null, EmsEnergyRate::getCurrency, bo.getCurrency());
|
||||
lqw.eq(bo.getEffectiveDate() != null, EmsEnergyRate::getEffectiveDate, bo.getEffectiveDate());
|
||||
lqw.eq(bo.getExpiryDate() != null, EmsEnergyRate::getExpiryDate, bo.getExpiryDate());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EmsEnergyRateBo bo) {
|
||||
EmsEnergyRate add = BeanUtil.toBean(bo, EmsEnergyRate.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setEnergyRateId(add.getEnergyRateId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmsEnergyRateBo bo) {
|
||||
EmsEnergyRate update = BeanUtil.toBean(bo, EmsEnergyRate.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmsEnergyRate entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.EmsEnergyTypeBo;
|
||||
import com.klp.ems.domain.vo.EmsEnergyTypeVo;
|
||||
import com.klp.ems.domain.EmsEnergyType;
|
||||
import com.klp.ems.mapper.EmsEnergyTypeMapper;
|
||||
import com.klp.ems.service.IEmsEnergyTypeService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 能源类型(阈值已移除)Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmsEnergyTypeServiceImpl implements IEmsEnergyTypeService {
|
||||
|
||||
private final EmsEnergyTypeMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)
|
||||
*/
|
||||
@Override
|
||||
public EmsEnergyTypeVo queryById(Long energyTypeId){
|
||||
return baseMapper.selectVoById(energyTypeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmsEnergyTypeVo> queryPageList(EmsEnergyTypeBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmsEnergyType> lqw = buildQueryWrapper(bo);
|
||||
Page<EmsEnergyTypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询能源类型(阈值已移除)列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmsEnergyTypeVo> queryList(EmsEnergyTypeBo bo) {
|
||||
LambdaQueryWrapper<EmsEnergyType> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmsEnergyType> buildQueryWrapper(EmsEnergyTypeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmsEnergyType> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), EmsEnergyType::getName, bo.getName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), EmsEnergyType::getUnit, bo.getUnit());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCode()), EmsEnergyType::getCode, bo.getCode());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), EmsEnergyType::getDescription, bo.getDescription());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增能源类型(阈值已移除)
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EmsEnergyTypeBo bo) {
|
||||
EmsEnergyType add = BeanUtil.toBean(bo, EmsEnergyType.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setEnergyTypeId(add.getEnergyTypeId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改能源类型(阈值已移除)
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmsEnergyTypeBo bo) {
|
||||
EmsEnergyType update = BeanUtil.toBean(bo, EmsEnergyType.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmsEnergyType entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除能源类型(阈值已移除)
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.EmsLocationBo;
|
||||
import com.klp.ems.domain.vo.EmsLocationVo;
|
||||
import com.klp.ems.domain.EmsLocation;
|
||||
import com.klp.ems.mapper.EmsLocationMapper;
|
||||
import com.klp.ems.service.IEmsLocationService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 位置Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmsLocationServiceImpl implements IEmsLocationService {
|
||||
|
||||
private final EmsLocationMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询位置
|
||||
*/
|
||||
@Override
|
||||
public EmsLocationVo queryById(Long locationId){
|
||||
return baseMapper.selectVoById(locationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询位置列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmsLocationVo> queryPageList(EmsLocationBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmsLocation> lqw = buildQueryWrapper(bo);
|
||||
Page<EmsLocationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询位置列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmsLocationVo> queryList(EmsLocationBo bo) {
|
||||
LambdaQueryWrapper<EmsLocation> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmsLocation> buildQueryWrapper(EmsLocationBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmsLocation> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), EmsLocation::getName, bo.getName());
|
||||
lqw.eq(bo.getParentId() != null, EmsLocation::getParentId, bo.getParentId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), EmsLocation::getDescription, bo.getDescription());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getAddress()), EmsLocation::getAddress, bo.getAddress());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增位置
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EmsLocationBo bo) {
|
||||
EmsLocation add = BeanUtil.toBean(bo, EmsLocation.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setLocationId(add.getLocationId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改位置
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmsLocationBo bo) {
|
||||
EmsLocation update = BeanUtil.toBean(bo, EmsLocation.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmsLocation entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除位置
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.EmsMeterBo;
|
||||
import com.klp.ems.domain.vo.EmsMeterVo;
|
||||
import com.klp.ems.domain.EmsMeter;
|
||||
import com.klp.ems.mapper.EmsMeterMapper;
|
||||
import com.klp.ems.service.IEmsMeterService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 计量设备(阈值移至此处)Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EmsMeterServiceImpl implements IEmsMeterService {
|
||||
|
||||
private final EmsMeterMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)
|
||||
*/
|
||||
@Override
|
||||
public EmsMeterVo queryById(Long meterId){
|
||||
return baseMapper.selectVoById(meterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EmsMeterVo> queryPageList(EmsMeterBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EmsMeter> lqw = buildQueryWrapper(bo);
|
||||
Page<EmsMeterVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计量设备(阈值移至此处)列表
|
||||
*/
|
||||
@Override
|
||||
public List<EmsMeterVo> queryList(EmsMeterBo bo) {
|
||||
LambdaQueryWrapper<EmsMeter> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EmsMeter> buildQueryWrapper(EmsMeterBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EmsMeter> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMeterCode()), EmsMeter::getMeterCode, bo.getMeterCode());
|
||||
lqw.eq(bo.getEnergyTypeId() != null, EmsMeter::getEnergyTypeId, bo.getEnergyTypeId());
|
||||
lqw.eq(bo.getLocationId() != null, EmsMeter::getLocationId, bo.getLocationId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getModel()), EmsMeter::getModel, bo.getModel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getManufacturer()), EmsMeter::getManufacturer, bo.getManufacturer());
|
||||
lqw.eq(bo.getInstallDate() != null, EmsMeter::getInstallDate, bo.getInstallDate());
|
||||
lqw.eq(bo.getStatus() != null, EmsMeter::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getLastCalibrationDate() != null, EmsMeter::getLastCalibrationDate, bo.getLastCalibrationDate());
|
||||
lqw.eq(bo.getThresholdValue() != null, EmsMeter::getThresholdValue, bo.getThresholdValue());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增计量设备(阈值移至此处)
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EmsMeterBo bo) {
|
||||
EmsMeter add = BeanUtil.toBean(bo, EmsMeter.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setMeterId(add.getMeterId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计量设备(阈值移至此处)
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EmsMeterBo bo) {
|
||||
EmsMeter update = BeanUtil.toBean(bo, EmsMeter.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EmsMeter entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除计量设备(阈值移至此处)
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user