diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsSiteConfigController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsSiteConfigController.java index 61bf378..50d2276 100644 --- a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsSiteConfigController.java +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsSiteConfigController.java @@ -1,17 +1,19 @@ package com.xzzn.web.controller.ems; +import com.xzzn.common.config.RuoYiConfig; import com.xzzn.common.core.controller.BaseController; import com.xzzn.common.core.domain.AjaxResult; import com.xzzn.common.core.page.TableDataInfo; +import com.xzzn.common.utils.file.FileUploadUtils; +import com.xzzn.common.utils.file.MimeTypeUtils; +import com.xzzn.ems.domain.EmsDevicesSetting; import com.xzzn.ems.domain.EmsSiteSetting; import com.xzzn.ems.domain.vo.SiteDeviceListVo; import com.xzzn.ems.service.IEmsDeviceSettingService; import com.xzzn.ems.service.IEmsSiteService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -42,7 +44,7 @@ public class EmsSiteConfigController extends BaseController{ } /** - * 获取设备列表 + * 获取设备列表-分页 */ @GetMapping("/getDeviceInfoList") public TableDataInfo getDeviceInfoList(@RequestParam String siteId) @@ -56,8 +58,82 @@ public class EmsSiteConfigController extends BaseController{ * 获取设备详细信息 */ @GetMapping("/getDeviceDetailInfo") - public AjaxResult getDeviceDetailInfo(@RequestParam String deviceId) + public AjaxResult getDeviceDetailInfo(@RequestParam Long id) { - return success(iEmsDeviceSettingService.getDeviceDetailInfo(deviceId)); + return success(iEmsDeviceSettingService.getDeviceDetailInfo(id)); + } + + /** + * 获取设备列表-不分页 + */ + @GetMapping("/getDeviceList") + public AjaxResult getDeviceInfoList2(@RequestParam String siteId) + { + return success(iEmsSiteService.getAllDeviceList(siteId)); + } + + /** + * 获取所有设备类别 + */ + @GetMapping("/getDeviceCategory") + public AjaxResult getDeviceCategory() + { + return success(iEmsDeviceSettingService.getDeviceCategory()); + } + + /** + * 新增设备 + */ + @PostMapping("/addDevice") + public AjaxResult addDevice(@RequestBody EmsDevicesSetting devicesSetting) + { + int result = iEmsDeviceSettingService.addDevice(devicesSetting); + if (result > 0) { + return AjaxResult.success(result); + } else { + return AjaxResult.error("该设备已存在"); + } + } + + /** + * 上传设备图片 + */ + @PostMapping("/uploadDeviceImg") + public AjaxResult uploadDeviceImg(@RequestParam("avatarfile") MultipartFile file) throws Exception + { + if (!file.isEmpty()) { + String avatar = FileUploadUtils.upload(RuoYiConfig.getDevicePath(), file, MimeTypeUtils.IMAGE_EXTENSION); + + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + return ajax; + } + return error("上传图片异常,请联系管理员"); + } + + /** + * 修改Modbus设备配置 + */ + @PostMapping("/updateDevice") + public AjaxResult updateDevice(@RequestBody EmsDevicesSetting emsDevicesSetting) + { + int result = iEmsDeviceSettingService.updateDevice(emsDevicesSetting); + if (result > 0) { + return AjaxResult.success(result); + } else if (result == -1) { + return AjaxResult.error("数据不存在"); + } else if (result == -2) { + return AjaxResult.error("该设备已存在"); + } + return AjaxResult.success(result); + } + + /** + * 删除Modbus设备配置 + */ + @DeleteMapping("/deleteService/{id}") + public AjaxResult deleteService(@PathVariable Long id) + { + return toAjax(iEmsDeviceSettingService.deleteEmsDevicesSettingById(id)); } } diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyController.java index 5f82dda..4c3435e 100644 --- a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyController.java +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyController.java @@ -1,5 +1,6 @@ package com.xzzn.web.controller.ems; +import com.xzzn.common.utils.StringUtils; import com.xzzn.ems.domain.EmsStrategyRunning; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -60,8 +61,16 @@ public class EmsStrategyController extends BaseController @PostMapping(value = "/configStrategy") public AjaxResult configStrategy(@RequestBody EmsStrategyRunning emsStrategyRunning) { + if (emsStrategyRunning.getMainStrategyId() == null + || StringUtils.isEmpty(emsStrategyRunning.getSiteId())){ + return error("缺少必填字段"); + } emsStrategyRunning.setCreateBy(getUsername()); emsStrategyRunning.setUpdateBy(getUsername()); - return toAjax(emsStrategyService.configStrategy(emsStrategyRunning)); + int result = emsStrategyService.configStrategy(emsStrategyRunning); + if (result == -1){ + return error("不支持重复添加"); + } + return success(result); } } diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyCurveController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyCurveController.java new file mode 100644 index 0000000..f66bcc1 --- /dev/null +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyCurveController.java @@ -0,0 +1,102 @@ +package com.xzzn.web.controller.ems; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.xzzn.common.annotation.Log; +import com.xzzn.common.core.controller.BaseController; +import com.xzzn.common.core.domain.AjaxResult; +import com.xzzn.common.enums.BusinessType; +import com.xzzn.ems.domain.EmsStrategyCurve; +import com.xzzn.ems.service.IEmsStrategyCurveService; +import com.xzzn.common.utils.poi.ExcelUtil; +import com.xzzn.common.core.page.TableDataInfo; + +/** + * 策曲线Controller + * + * @author xzzn + * @date 2025-07-11 + */ +@RestController +@RequestMapping("/strategy/curve") +public class EmsStrategyCurveController extends BaseController +{ + @Autowired + private IEmsStrategyCurveService emsStrategyCurveService; + + /** + * 查询策曲线列表 + */ + @PreAuthorize("@ss.hasPermi('system:curve:list')") + @GetMapping("/list") + public AjaxResult list(EmsStrategyCurve emsStrategyCurve) + { + return success(emsStrategyCurveService.selectEmsStrategyCurveList(emsStrategyCurve)); + } + + /** + * 导出策曲线列表 + */ + @PreAuthorize("@ss.hasPermi('system:curve:export')") + @Log(title = "策曲线", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EmsStrategyCurve emsStrategyCurve) + { + List list = emsStrategyCurveService.selectEmsStrategyCurveList(emsStrategyCurve); + ExcelUtil util = new ExcelUtil(EmsStrategyCurve.class); + util.exportExcel(response, list, "策曲线数据"); + } + + /** + * 获取策曲线详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:curve:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(emsStrategyCurveService.selectEmsStrategyCurveById(id)); + } + + /** + * 新增策曲线 + */ + @PreAuthorize("@ss.hasPermi('system:curve:add')") + @Log(title = "策曲线", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EmsStrategyCurve emsStrategyCurve) + { + return toAjax(emsStrategyCurveService.insertEmsStrategyCurve(emsStrategyCurve)); + } + + /** + * 修改策曲线 + */ + @PreAuthorize("@ss.hasPermi('system:curve:edit')") + @Log(title = "策曲线", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EmsStrategyCurve emsStrategyCurve) + { + return toAjax(emsStrategyCurveService.updateEmsStrategyCurve(emsStrategyCurve)); + } + + /** + * 删除策曲线 + */ + @PreAuthorize("@ss.hasPermi('system:curve:remove')") + @Log(title = "策曲线", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(emsStrategyCurveService.deleteEmsStrategyCurveByIds(ids)); + } +} diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyTempController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyTempController.java new file mode 100644 index 0000000..b8a5071 --- /dev/null +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyTempController.java @@ -0,0 +1,94 @@ +package com.xzzn.web.controller.ems; + +import com.xzzn.ems.domain.vo.StrategyTempConfigRequest; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.xzzn.common.annotation.Log; +import com.xzzn.common.core.controller.BaseController; +import com.xzzn.common.core.domain.AjaxResult; +import com.xzzn.common.enums.BusinessType; +import com.xzzn.ems.service.IEmsStrategyTempService; + +/** + * 模板Controller + * + * @author xzzn + * @date 2025-07-11 + */ +@RestController +@RequestMapping("/strategy/temp") +public class EmsStrategyTempController extends BaseController +{ + @Autowired + private IEmsStrategyTempService emsStrategyTempService; + + /** + * 根据策略id站点id获取所有模板名称 + */ + @GetMapping("/getTempNameList") + public AjaxResult getTempNameList(Long strategyId, String siteId) + { + return success(emsStrategyTempService.getTempNameList(strategyId, siteId)); + } + + /** + * 获取单个模板时间配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:temp:list')") + @GetMapping("/list") + public AjaxResult list(String templateId) + { + return success(emsStrategyTempService.selectEmsStrategyTempList(templateId)); + } + + /** + * 新增模板及时间配置 + */ + @PreAuthorize("@ss.hasPermi('system:temp:add')") + @Log(title = "模板", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody StrategyTempConfigRequest requestVo) + { + boolean result = emsStrategyTempService.addNewTempAndTimeConfig(requestVo); + if (result) { + return success(); + } else { + return AjaxResult.error("新增失败请重试!"); + } + } + + /** + * 修改模板 + */ + @PreAuthorize("@ss.hasPermi('system:temp:edit')") + @Log(title = "模板", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody StrategyTempConfigRequest requestVo) + { + boolean result = emsStrategyTempService.updateEmsStrategyTemp(requestVo); + if (result) { + return success(); + } else { + return AjaxResult.error("更新失败,请重试!"); + } + } + + /** + * 删除模板 + */ + @PreAuthorize("@ss.hasPermi('system:temp:remove')") + @Log(title = "模板", businessType = BusinessType.DELETE) + @DeleteMapping("/{templateId}") + public AjaxResult remove(@PathVariable String templateId) + { + return success(emsStrategyTempService.deleteStrategyTempById(templateId)); + } +} diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyTimeConfigController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyTimeConfigController.java new file mode 100644 index 0000000..ad20c48 --- /dev/null +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsStrategyTimeConfigController.java @@ -0,0 +1,93 @@ +package com.xzzn.web.controller.ems; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.xzzn.common.annotation.Log; +import com.xzzn.common.core.controller.BaseController; +import com.xzzn.common.core.domain.AjaxResult; +import com.xzzn.common.enums.BusinessType; +import com.xzzn.ems.domain.EmsStrategyTimeConfig; +import com.xzzn.ems.service.IEmsStrategyTimeConfigService; + +/** + * 时间配置Controller + * + * @author xzzn + * @date 2025-07-11 + */ +@RestController +@RequestMapping("/strategy/timeConfig") +public class EmsStrategyTimeConfigController extends BaseController +{ + @Autowired + private IEmsStrategyTimeConfigService emsStrategyTimeConfigService; + + /** + * 查询时间配置列表 + */ + @PreAuthorize("@ss.hasPermi('system:config:list')") + @GetMapping("/list") + public AjaxResult list(EmsStrategyTimeConfig emsStrategyTimeConfig) + { + return success(emsStrategyTimeConfigService.getStrategyTimeList(emsStrategyTimeConfig)); + } + + /** + * 获取时间配置详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(emsStrategyTimeConfigService.selectEmsStrategyTimeConfigById(id)); + } + + /** + * 新增时间配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:add')") + @Log(title = "时间配置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody List emsStrategyTimeConfigList) + { + boolean result = emsStrategyTimeConfigService.insertEmsStrategyTimeConfig(emsStrategyTimeConfigList); + if (result){ + return success(); + }else { + return error("编辑失败请重试!"); + } + + } + + /** + * 修改时间配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:edit')") + @Log(title = "时间配置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EmsStrategyTimeConfig emsStrategyTimeConfig) + { + return toAjax(emsStrategyTimeConfigService.updateEmsStrategyTimeConfig(emsStrategyTimeConfig)); + } + + /** + * 删除时间配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "时间配置", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(emsStrategyTimeConfigService.deleteEmsStrategyTimeConfigByIds(ids)); + } +} diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsTicketController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsTicketController.java index 1970124..f1c26d9 100644 --- a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsTicketController.java +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsTicketController.java @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse; import com.xzzn.common.utils.poi.ExcelUtil; import com.xzzn.ems.domain.EmsTicket; +import com.xzzn.ems.domain.vo.TicketListVo; import com.xzzn.ems.service.IEmsTicketService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +44,7 @@ public class EmsTicketController extends BaseController public TableDataInfo list(EmsTicket emsTicket) { startPage(); - List list = emsTicketService.selectEmsTicketList(emsTicket); + List list = emsTicketService.getAllTicketList(emsTicket); return getDataTable(list); } diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/system/SysUserController.java b/ems-admin/src/main/java/com/xzzn/web/controller/system/SysUserController.java index ffe93bb..842620f 100644 --- a/ems-admin/src/main/java/com/xzzn/web/controller/system/SysUserController.java +++ b/ems-admin/src/main/java/com/xzzn/web/controller/system/SysUserController.java @@ -3,6 +3,8 @@ package com.xzzn.web.controller.system; import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import com.xzzn.system.service.impl.SysUserServiceImpl; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -52,6 +54,8 @@ public class SysUserController extends BaseController @Autowired private ISysPostService postService; + @Autowired + private SysUserServiceImpl sysUserServiceImpl; /** * 获取用户列表 @@ -253,4 +257,13 @@ public class SysUserController extends BaseController { return success(deptService.selectDeptTreeList(dept)); } + + /** + * 获取所有用户 + */ + @GetMapping("/getAllUser") + public AjaxResult getAllUser(SysUser user) + { + return success(userService.selectUserList(user)); + } } diff --git a/ems-admin/src/main/resources/application.yml b/ems-admin/src/main/resources/application.yml index 70ad9a7..7b1963f 100644 --- a/ems-admin/src/main/resources/application.yml +++ b/ems-admin/src/main/resources/application.yml @@ -34,7 +34,7 @@ server: # 日志配置 logging: level: - com.xzzn: debug + com.xzzn: info org.springframework: warn # 用户配置 @@ -135,4 +135,4 @@ mqtt: password: qwer1234 connection-timeout: 15 keep-alive-interval: 30 - automatic-reconnect: true \ No newline at end of file + automatic-reconnect: true diff --git a/ems-common/src/main/java/com/xzzn/common/config/RuoYiConfig.java b/ems-common/src/main/java/com/xzzn/common/config/RuoYiConfig.java index 39db47a..d56e411 100644 --- a/ems-common/src/main/java/com/xzzn/common/config/RuoYiConfig.java +++ b/ems-common/src/main/java/com/xzzn/common/config/RuoYiConfig.java @@ -119,4 +119,12 @@ public class RuoYiConfig { return getProfile() + "/upload"; } + + /** + * 获取头像上传路径 + */ + public static String getDevicePath() + { + return getProfile() + "/device"; + } } diff --git a/ems-common/src/main/java/com/xzzn/common/enums/DeviceCategory.java b/ems-common/src/main/java/com/xzzn/common/enums/DeviceCategory.java index aefa25a..3b48820 100644 --- a/ems-common/src/main/java/com/xzzn/common/enums/DeviceCategory.java +++ b/ems-common/src/main/java/com/xzzn/common/enums/DeviceCategory.java @@ -12,7 +12,8 @@ public enum DeviceCategory STACK("STACK", "电池堆"), CLUSTER("CLUSTER", "电池簇"), BATTERY("BATTERY", "单体电池"), - AMMETER("AMMETER", "电表"); + AMMETER("AMMETER", "电表"), + COOLING("COOLING", "冷液体"); private final String code; private final String info; diff --git a/ems-common/src/main/java/com/xzzn/common/enums/SdcLimitType.java b/ems-common/src/main/java/com/xzzn/common/enums/SdcLimitType.java new file mode 100644 index 0000000..d7a60f6 --- /dev/null +++ b/ems-common/src/main/java/com/xzzn/common/enums/SdcLimitType.java @@ -0,0 +1,30 @@ +package com.xzzn.common.enums; + +/** + * strategy模板-sdc限制 + * + * @author xzzn + */ +public enum SdcLimitType +{ + OFF("0", "关"), ON("1", "开"); + + private final String code; + private final String info; + + SdcLimitType(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } +} diff --git a/ems-system/pom.xml b/ems-system/pom.xml index 458ffa1..7f2b1e1 100644 --- a/ems-system/pom.xml +++ b/ems-system/pom.xml @@ -22,6 +22,10 @@ com.xzzn ems-common + + org.glassfish.jaxb + jaxb-runtime + diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/EmsDevicesSetting.java b/ems-system/src/main/java/com/xzzn/ems/domain/EmsDevicesSetting.java index 0f174ca..694d0e8 100644 --- a/ems-system/src/main/java/com/xzzn/ems/domain/EmsDevicesSetting.java +++ b/ems-system/src/main/java/com/xzzn/ems/domain/EmsDevicesSetting.java @@ -11,7 +11,7 @@ import com.xzzn.common.annotation.Excel; * Modbus设备配置对象 ems_devices_setting * * @author xzzn - * @date 2025-07-02 + * @date 2025-07-12 */ public class EmsDevicesSetting extends BaseEntity { @@ -102,6 +102,10 @@ public class EmsDevicesSetting extends BaseEntity @Excel(name = "设备类别,例如“STACK/CLUSTER/PCS等”") private String deviceCategory; + /** 设备图像地址 */ + @Excel(name = "设备图像地址") + private String pictureUrl; + public void setId(Long id) { this.id = id; @@ -312,6 +316,16 @@ public class EmsDevicesSetting extends BaseEntity return deviceCategory; } + public void setPictureUrl(String pictureUrl) + { + this.pictureUrl = pictureUrl; + } + + public String getPictureUrl() + { + return pictureUrl; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -336,6 +350,7 @@ public class EmsDevicesSetting extends BaseEntity .append("deviceId", getDeviceId()) .append("parentId", getParentId()) .append("deviceCategory", getDeviceCategory()) + .append("pictureUrl", getPictureUrl()) .toString(); } } diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyCurve.java b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyCurve.java new file mode 100644 index 0000000..dff611c --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyCurve.java @@ -0,0 +1,136 @@ +package com.xzzn.ems.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.xzzn.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.xzzn.common.annotation.Excel; + +/** + * 策曲线对象 ems_strategy_curve + * + * @author xzzn + * @date 2025-07-11 + */ +public class EmsStrategyCurve extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 关联的策略ID */ + @Excel(name = "关联的策略ID") + private Long strategyId; + + /** 任务编号 */ + @Excel(name = "任务编号") + private Long taskNumber; + + /** 开始日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date startDate; + + /** 结束日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date endDate; + + /** 功率数据,可以是JSON格式存储曲线数据 */ + @Excel(name = "功率数据,可以是JSON格式存储曲线数据") + private String powerData; + + /** 站点id */ + @Excel(name = "站点id") + private String siteId; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setStrategyId(Long strategyId) + { + this.strategyId = strategyId; + } + + public Long getStrategyId() + { + return strategyId; + } + + public void setTaskNumber(Long taskNumber) + { + this.taskNumber = taskNumber; + } + + public Long getTaskNumber() + { + return taskNumber; + } + + public void setStartDate(Date startDate) + { + this.startDate = startDate; + } + + public Date getStartDate() + { + return startDate; + } + + public void setEndDate(Date endDate) + { + this.endDate = endDate; + } + + public Date getEndDate() + { + return endDate; + } + + public void setPowerData(String powerData) + { + this.powerData = powerData; + } + + public String getPowerData() + { + return powerData; + } + + public void setSiteId(String siteId) + { + this.siteId = siteId; + } + + public String getSiteId() + { + return siteId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("strategyId", getStrategyId()) + .append("taskNumber", getTaskNumber()) + .append("startDate", getStartDate()) + .append("endDate", getEndDate()) + .append("powerData", getPowerData()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("siteId", getSiteId()) + .toString(); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTemp.java b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTemp.java new file mode 100644 index 0000000..8b05e5b --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTemp.java @@ -0,0 +1,212 @@ +package com.xzzn.ems.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.xzzn.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.xzzn.common.annotation.Excel; + +/** + * 模板对象 ems_strategy_temp + * + * @author xzzn + * @date 2025-07-13 + */ +public class EmsStrategyTemp extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + private Long id; + + /** 关联的策略ID */ + @Excel(name = "关联的策略ID") + private Long strategyId; + + /** 模板名称,如“模板一” */ + @Excel(name = "模板名称,如“模板一”") + private String templateName; + + /** SDC限制 (%) 1 = 开,0 = 关 */ + @Excel(name = "SDC限制 (%) 1 = 开,0 = 关") + private Integer sdcLimit; + + /** SDC下限 (%) */ + @Excel(name = "SDC下限 (%)") + private BigDecimal sdcDown; + + /** SDC上限 (%) */ + @Excel(name = "SDC上限 (%)") + private BigDecimal sdcUp; + + /** 开始时间 */ + @JsonFormat(pattern = "HH:mm") + @Excel(name = "开始时间", width = 30, dateFormat = "HH:mm") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "HH:mm") + @Excel(name = "结束时间", width = 30, dateFormat = "HH:mm") + private Date endTime; + + /** 充放功率 (kW) */ + @Excel(name = "充放功率 (kW)") + private BigDecimal chargeDischargePower; + + /** 充电状态,如“1-充电”、“2-待机” */ + @Excel(name = "充电状态,如“1-充电”、“2-待机”") + private String chargeStatus; + + /** 站点id */ + @Excel(name = "站点id") + private String siteId; + + /** 模板id */ + @Excel(name = "模板id") + private String templateId; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setStrategyId(Long strategyId) + { + this.strategyId = strategyId; + } + + public Long getStrategyId() + { + return strategyId; + } + + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + public String getTemplateName() + { + return templateName; + } + + public void setSdcLimit(Integer sdcLimit) + { + this.sdcLimit = sdcLimit; + } + + public Integer getSdcLimit() + { + return sdcLimit; + } + + public void setSdcDown(BigDecimal sdcDown) + { + this.sdcDown = sdcDown; + } + + public BigDecimal getSdcDown() + { + return sdcDown; + } + + public void setSdcUp(BigDecimal sdcUp) + { + this.sdcUp = sdcUp; + } + + public BigDecimal getSdcUp() + { + return sdcUp; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStartTime() + { + return startTime; + } + + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + + public void setChargeDischargePower(BigDecimal chargeDischargePower) + { + this.chargeDischargePower = chargeDischargePower; + } + + public BigDecimal getChargeDischargePower() + { + return chargeDischargePower; + } + + public void setChargeStatus(String chargeStatus) + { + this.chargeStatus = chargeStatus; + } + + public String getChargeStatus() + { + return chargeStatus; + } + + public void setSiteId(String siteId) + { + this.siteId = siteId; + } + + public String getSiteId() + { + return siteId; + } + + public void setTemplateId(String templateId) + { + this.templateId = templateId; + } + + public String getTemplateId() + { + return templateId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("strategyId", getStrategyId()) + .append("templateName", getTemplateName()) + .append("sdcLimit", getSdcLimit()) + .append("sdcDown", getSdcDown()) + .append("sdcUp", getSdcUp()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("chargeDischargePower", getChargeDischargePower()) + .append("chargeStatus", getChargeStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("siteId", getSiteId()) + .append("templateId", getTemplateId()) + .toString(); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTempTimeConfig.java b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTempTimeConfig.java new file mode 100644 index 0000000..1cf9f9f --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTempTimeConfig.java @@ -0,0 +1,122 @@ +package com.xzzn.ems.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.xzzn.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.xzzn.common.annotation.Excel; + +/** + * 模板配置对象 ems_strategy_temp_time_config + * + * @author xzzn + * @date 2025-07-12 + */ +public class EmsStrategyTempTimeConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 开始时间 */ + @JsonFormat(pattern = "HH:mm") + @Excel(name = "开始时间", width = 30, dateFormat = "HH:mm") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "HH:mm") + @Excel(name = "结束时间", width = 30, dateFormat = "HH:mm") + private Date endTime; + + /** 充放功率 (kW) */ + @Excel(name = "充放功率 (kW)") + private BigDecimal chargeDischargePower; + + /** 充电状态,如“1-充电”、“2-待机” */ + @Excel(name = "充电状态,如“1-充电”、“2-待机”") + private String chargeStatus; + + /** 模板id */ + @Excel(name = "模板id") + private String templateId; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStartTime() + { + return startTime; + } + + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } + + public Date getEndTime() + { + return endTime; + } + + public void setChargeDischargePower(BigDecimal chargeDischargePower) + { + this.chargeDischargePower = chargeDischargePower; + } + + public BigDecimal getChargeDischargePower() + { + return chargeDischargePower; + } + + public void setChargeStatus(String chargeStatus) + { + this.chargeStatus = chargeStatus; + } + + public String getChargeStatus() + { + return chargeStatus; + } + + public void setTemplateId(String templateId) + { + this.templateId = templateId; + } + + public String getTemplateId() + { + return templateId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) + .append("chargeDischargePower", getChargeDischargePower()) + .append("chargeStatus", getChargeStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("templateId", getTemplateId()) + .toString(); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTimeConfig.java b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTimeConfig.java new file mode 100644 index 0000000..de02b59 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/EmsStrategyTimeConfig.java @@ -0,0 +1,117 @@ +package com.xzzn.ems.domain; + +import com.xzzn.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.xzzn.common.annotation.Excel; + +/** + * 时间配置对象 ems_strategy_time_config + * + * @author xzzn + * @date 2025-07-12 + */ +public class EmsStrategyTimeConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + private Long id; + + /** 关联的策略ID */ + @Excel(name = "关联的策略ID") + private Long strategyId; + + /** 月份,1-12 */ + @Excel(name = "月份,1-12") + private Long month; + + /** 充放电模式,如“两充两放” */ + @Excel(name = "充放电模式,如“两充两放”") + private String chargeDischargeMode; + + /** 站点id */ + @Excel(name = "站点id") + private String siteId; + + /** 模版id */ + @Excel(name = "模版id") + private String templateId; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setStrategyId(Long strategyId) + { + this.strategyId = strategyId; + } + + public Long getStrategyId() + { + return strategyId; + } + + public void setMonth(Long month) + { + this.month = month; + } + + public Long getMonth() + { + return month; + } + + public void setChargeDischargeMode(String chargeDischargeMode) + { + this.chargeDischargeMode = chargeDischargeMode; + } + + public String getChargeDischargeMode() + { + return chargeDischargeMode; + } + + public void setSiteId(String siteId) + { + this.siteId = siteId; + } + + public String getSiteId() + { + return siteId; + } + + public void setTemplateId(String templateId) + { + this.templateId = templateId; + } + + public String getTemplateId() + { + return templateId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("strategyId", getStrategyId()) + .append("month", getMonth()) + .append("chargeDischargeMode", getChargeDischargeMode()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("siteId", getSiteId()) + .append("templateId", getTemplateId()) + .toString(); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/EmsTicket.java b/ems-system/src/main/java/com/xzzn/ems/domain/EmsTicket.java index da19310..ea401d1 100644 --- a/ems-system/src/main/java/com/xzzn/ems/domain/EmsTicket.java +++ b/ems-system/src/main/java/com/xzzn/ems/domain/EmsTicket.java @@ -26,7 +26,7 @@ public class EmsTicket extends BaseEntity /** 提交用户ID */ @Excel(name = "提交用户ID") - private String userId; + private Long userId; /** 工单标题 */ @Excel(name = "工单标题") @@ -77,12 +77,12 @@ public class EmsTicket extends BaseEntity return ticketNo; } - public void setUserId(String userId) + public void setUserId(Long userId) { this.userId = userId; } - public String getUserId() + public Long getUserId() { return userId; } diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/vo/SiteDeviceListVo.java b/ems-system/src/main/java/com/xzzn/ems/domain/vo/SiteDeviceListVo.java index 13e95b0..387b64c 100644 --- a/ems-system/src/main/java/com/xzzn/ems/domain/vo/SiteDeviceListVo.java +++ b/ems-system/src/main/java/com/xzzn/ems/domain/vo/SiteDeviceListVo.java @@ -19,6 +19,10 @@ public class SiteDeviceListVo { private String communicationStatus; /** 设备类型 */ private String deviceCategory; + /** 设备类型 */ + private String pictureUrl; + /** 唯一标识 */ + private String id; public String getSiteId() { return siteId; @@ -75,4 +79,20 @@ public class SiteDeviceListVo { public void setDeviceCategory(String deviceCategory) { this.deviceCategory = deviceCategory; } + + public String getPictureUrl() { + return pictureUrl; + } + + public void setPictureUrl(String pictureUrl) { + this.pictureUrl = pictureUrl; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } } diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyRunningVo.java b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyRunningVo.java index 5531027..4bac091 100644 --- a/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyRunningVo.java +++ b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyRunningVo.java @@ -26,6 +26,12 @@ public class StrategyRunningVo /** 策略运行id */ private Long id; + /** 主策略id */ + private Long mainStrategyId; + + /** 辅助策略id */ + private Long auxStrategyId; + public void setStatus(String status) { this.status = status; @@ -79,4 +85,20 @@ public class StrategyRunningVo public void setId(Long id) { this.id = id; } + + public Long getAuxStrategyId() { + return auxStrategyId; + } + + public void setAuxStrategyId(Long auxStrategyId) { + this.auxStrategyId = auxStrategyId; + } + + public Long getMainStrategyId() { + return mainStrategyId; + } + + public void setMainStrategyId(Long mainStrategyId) { + this.mainStrategyId = mainStrategyId; + } } diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTempConfigRequest.java b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTempConfigRequest.java new file mode 100644 index 0000000..f05d001 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTempConfigRequest.java @@ -0,0 +1,115 @@ +package com.xzzn.ems.domain.vo; + +import com.xzzn.ems.domain.EmsStrategyTempTimeConfig; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 新增模板+模板时间数据 + * + * @author xzzn + * @date 2025-07-12 + */ +public class StrategyTempConfigRequest +{ + + /** 模板id */ + private String templateId; + /** 站点id */ + private String siteId; + + /** 关联的策略ID */ + private Long strategyId; + + /** 模板名称,如“模板一” */ + private String templateName; + + /** SDC限制 (%) 1 = 开,0 = 关 */ + private Integer sdcLimit; + + /** SDC下限 (%) */ + private BigDecimal sdcDown; + + /** SDC上限 (%) */ + private BigDecimal sdcUp; + + /** 模板时间 */ + private List timeConfigList; + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public void setStrategyId(Long strategyId) + { + this.strategyId = strategyId; + } + + public Long getStrategyId() + { + return strategyId; + } + + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + public String getTemplateName() + { + return templateName; + } + + public void setSdcLimit(Integer sdcLimit) + { + this.sdcLimit = sdcLimit; + } + + public Integer getSdcLimit() + { + return sdcLimit; + } + + public void setSdcDown(BigDecimal sdcDown) + { + this.sdcDown = sdcDown; + } + + public BigDecimal getSdcDown() + { + return sdcDown; + } + + public void setSdcUp(BigDecimal sdcUp) + { + this.sdcUp = sdcUp; + } + + public BigDecimal getSdcUp() + { + return sdcUp; + } + + public void setSiteId(String siteId) + { + this.siteId = siteId; + } + + public String getSiteId() + { + return siteId; + } + + public List getTimeConfigList() { + return timeConfigList; + } + + public void setTimeConfigList(List timeConfigList) { + this.timeConfigList = timeConfigList; + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTempTimeConfigVo.java b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTempTimeConfigVo.java new file mode 100644 index 0000000..a3ef8d4 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTempTimeConfigVo.java @@ -0,0 +1,152 @@ +package com.xzzn.ems.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 模板+模板时间数据 + * + * @author xzzn + * @date 2025-07-12 + */ +public class StrategyTempTimeConfigVo +{ + /** 模版id */ + private Long id; + + /** 关联的策略ID */ + private Long strategyId; + + /** 模板名称,如“模板一” */ + private String templateName; + + /** SDC限制 (%) 1 = 开,0 = 关 */ + private Integer sdcLimit; + + /** SDC下限 (%) */ + private BigDecimal sdcDown; + + /** SDC上限 (%) */ + private BigDecimal sdcUp; + + /** 站点id */ + private String siteId; + + /** 开始时间 */ + @JsonFormat(pattern = "HH:mm:ss") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "HH:mm:ss") + private Date endTime; + + /** 充放功率 (kW) */ + private BigDecimal chargeDischargePower; + + /** 充电状态,如“1-充电”、“2-待机” */ + private String chargeStatus; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setStrategyId(Long strategyId) + { + this.strategyId = strategyId; + } + + public Long getStrategyId() + { + return strategyId; + } + + public void setTemplateName(String templateName) + { + this.templateName = templateName; + } + + public String getTemplateName() + { + return templateName; + } + + public void setSdcLimit(Integer sdcLimit) + { + this.sdcLimit = sdcLimit; + } + + public Integer getSdcLimit() + { + return sdcLimit; + } + + public void setSdcDown(BigDecimal sdcDown) + { + this.sdcDown = sdcDown; + } + + public BigDecimal getSdcDown() + { + return sdcDown; + } + + public void setSdcUp(BigDecimal sdcUp) + { + this.sdcUp = sdcUp; + } + + public BigDecimal getSdcUp() + { + return sdcUp; + } + + public void setSiteId(String siteId) + { + this.siteId = siteId; + } + + public String getSiteId() + { + return siteId; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public BigDecimal getChargeDischargePower() { + return chargeDischargePower; + } + + public void setChargeDischargePower(BigDecimal chargeDischargePower) { + this.chargeDischargePower = chargeDischargePower; + } + + public String getChargeStatus() { + return chargeStatus; + } + + public void setChargeStatus(String chargeStatus) { + this.chargeStatus = chargeStatus; + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTimeConfigVo.java b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTimeConfigVo.java new file mode 100644 index 0000000..4d7a202 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/vo/StrategyTimeConfigVo.java @@ -0,0 +1,99 @@ +package com.xzzn.ems.domain.vo; + +/** + * 时间配置显示对象 + * + * @author xzzn + * @date 2025-07-12 + */ +public class StrategyTimeConfigVo +{ + /** */ + private Long id; + + /** 关联的策略ID */ + private Long strategyId; + + /** 月份,1-12 */ + private Long month; + + /** 站点id */ + private String siteId; + + /** 充放电模式 */ + private String chargeDischargeMode; + + /** 模板id */ + private String templateId; + + /** 模板名称 */ + private String templateName; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setStrategyId(Long strategyId) + { + this.strategyId = strategyId; + } + + public Long getStrategyId() + { + return strategyId; + } + + public void setMonth(Long month) + { + this.month = month; + } + + public Long getMonth() + { + return month; + } + + public void setChargeDischargeMode(String chargeDischargeMode) + { + this.chargeDischargeMode = chargeDischargeMode; + } + + public String getChargeDischargeMode() + { + return chargeDischargeMode; + } + + public void setSiteId(String siteId) + { + this.siteId = siteId; + } + + public String getSiteId() + { + return siteId; + } + + public void setTemplateId(String templateId) + { + this.templateId = templateId; + } + + public String getTemplateId() + { + return templateId; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/domain/vo/TicketListVo.java b/ems-system/src/main/java/com/xzzn/ems/domain/vo/TicketListVo.java new file mode 100644 index 0000000..22d90ec --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/domain/vo/TicketListVo.java @@ -0,0 +1,40 @@ +package com.xzzn.ems.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.xzzn.common.annotation.Excel; +import com.xzzn.common.core.domain.BaseEntity; +import com.xzzn.ems.domain.EmsTicket; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 工单列表对象 + * + */ +public class TicketListVo extends EmsTicket +{ + private static final long serialVersionUID = 1L; + + // 提交人姓名 + private String userName; + // 处理人姓名 + private String workName; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getWorkName() { + return workName; + } + + public void setWorkName(String workName) { + this.workName = workName; + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsDevicesSettingMapper.java b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsDevicesSettingMapper.java index 6e0ef1f..66f78af 100644 --- a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsDevicesSettingMapper.java +++ b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsDevicesSettingMapper.java @@ -76,17 +76,12 @@ public interface EmsDevicesSettingMapper */ public List> getDeviceInfosBySiteIdAndCategory(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory); - /** - * 获取该设备的详细数据 - * @param deviceId - * @return - */ - public EmsDevicesSetting getDeviceDetailInfo(String deviceId); - /** * 获取该设备下的总表 * @param siteId * @return */ public List> getLoadNameList(String siteId); + + public EmsDevicesSetting getDeviceBySiteAndDeviceId(@Param("deviceId")String deviceId, @Param("siteId")String siteId); } diff --git a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyCurveMapper.java b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyCurveMapper.java new file mode 100644 index 0000000..9776cd1 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyCurveMapper.java @@ -0,0 +1,61 @@ +package com.xzzn.ems.mapper; + +import java.util.List; +import com.xzzn.ems.domain.EmsStrategyCurve; + +/** + * 策曲线Mapper接口 + * + * @author xzzn + * @date 2025-07-11 + */ +public interface EmsStrategyCurveMapper +{ + /** + * 查询策曲线 + * + * @param id 策曲线主键 + * @return 策曲线 + */ + public EmsStrategyCurve selectEmsStrategyCurveById(Long id); + + /** + * 查询策曲线列表 + * + * @param emsStrategyCurve 策曲线 + * @return 策曲线集合 + */ + public List selectEmsStrategyCurveList(EmsStrategyCurve emsStrategyCurve); + + /** + * 新增策曲线 + * + * @param emsStrategyCurve 策曲线 + * @return 结果 + */ + public int insertEmsStrategyCurve(EmsStrategyCurve emsStrategyCurve); + + /** + * 修改策曲线 + * + * @param emsStrategyCurve 策曲线 + * @return 结果 + */ + public int updateEmsStrategyCurve(EmsStrategyCurve emsStrategyCurve); + + /** + * 删除策曲线 + * + * @param id 策曲线主键 + * @return 结果 + */ + public int deleteEmsStrategyCurveById(Long id); + + /** + * 批量删除策曲线 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEmsStrategyCurveByIds(Long[] ids); +} diff --git a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyRunningMapper.java b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyRunningMapper.java index 2443df7..8d52260 100644 --- a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyRunningMapper.java +++ b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyRunningMapper.java @@ -60,7 +60,7 @@ public interface EmsStrategyRunningMapper */ public int deleteEmsStrategyRunningByIds(Long[] ids); - // 获取站点运行策略 + // 获取站点运行策略列表 public List getRunningList(String siteId); // 停止策略 diff --git a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyTempMapper.java b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyTempMapper.java new file mode 100644 index 0000000..24db8da --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyTempMapper.java @@ -0,0 +1,73 @@ +package com.xzzn.ems.mapper; + +import java.util.List; +import java.util.Map; + +import com.xzzn.ems.domain.EmsStrategyTemp; +import org.apache.ibatis.annotations.Param; + +/** + * 模板Mapper接口 + * + * @author xzzn + * @date 2025-07-11 + */ +public interface EmsStrategyTempMapper +{ + /** + * 查询模板 + * + * @param id 模板主键 + * @return 模板 + */ + public EmsStrategyTemp selectEmsStrategyTempById(Long id); + + /** + * 查询模板列表 + * + * @param emsStrategyTemp 模板 + * @return 模板集合 + */ + public List selectEmsStrategyTempList(EmsStrategyTemp emsStrategyTemp); + + /** + * 新增模板 + * + * @param emsStrategyTemp 模板 + * @return 结果 + */ + public int insertEmsStrategyTemp(EmsStrategyTemp emsStrategyTemp); + + /** + * 修改模板 + * + * @param emsStrategyTemp 模板 + * @return 结果 + */ + public int updateEmsStrategyTemp(EmsStrategyTemp emsStrategyTemp); + + /** + * 删除模板 + * + * @param id 模板主键 + * @return 结果 + */ + public int deleteEmsStrategyTempById(Long id); + + /** + * 批量删除模板 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEmsStrategyTempByIds(Long[] ids); + + // 获取模板名称和id + public List> getTempNameList(@Param("strategyId")Long strategyId, @Param("siteId")String siteId); + + // 根据模板id获取模板所有的时间配置 + public List selectStrategyTempByTempId(String templateId); + + // 根据模板id全部删除 + public int deleteTempByTempId(String templateId); +} diff --git a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyTimeConfigMapper.java b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyTimeConfigMapper.java new file mode 100644 index 0000000..8b0d4d4 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsStrategyTimeConfigMapper.java @@ -0,0 +1,68 @@ +package com.xzzn.ems.mapper; + +import java.util.List; +import com.xzzn.ems.domain.EmsStrategyTimeConfig; +import com.xzzn.ems.domain.vo.StrategyTimeConfigVo; + +/** + * 时间配置Mapper接口 + * + * @author xzzn + * @date 2025-07-11 + */ +public interface EmsStrategyTimeConfigMapper +{ + /** + * 查询时间配置 + * + * @param id 时间配置主键 + * @return 时间配置 + */ + public EmsStrategyTimeConfig selectEmsStrategyTimeConfigById(Long id); + + /** + * 查询时间配置列表 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 时间配置集合 + */ + public List selectEmsStrategyTimeConfigList(EmsStrategyTimeConfig emsStrategyTimeConfig); + + /** + * 新增时间配置 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 结果 + */ + public int insertEmsStrategyTimeConfig(EmsStrategyTimeConfig emsStrategyTimeConfig); + + /** + * 修改时间配置 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 结果 + */ + public int updateEmsStrategyTimeConfig(EmsStrategyTimeConfig emsStrategyTimeConfig); + + /** + * 删除时间配置 + * + * @param id 时间配置主键 + * @return 结果 + */ + public int deleteEmsStrategyTimeConfigById(Long id); + + /** + * 批量删除时间配置 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteEmsStrategyTimeConfigByIds(Long[] ids); + + // 获取该策略下的时间配置 + public List getStrategyTimeList(EmsStrategyTimeConfig emsStrategyTimeConfig); + + // 清空该月的模板信息 + public void cleanTemplateId(String templateId); +} diff --git a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsTicketMapper.java b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsTicketMapper.java index f944a4c..7dcf5a9 100644 --- a/ems-system/src/main/java/com/xzzn/ems/mapper/EmsTicketMapper.java +++ b/ems-system/src/main/java/com/xzzn/ems/mapper/EmsTicketMapper.java @@ -1,6 +1,7 @@ package com.xzzn.ems.mapper; import com.xzzn.ems.domain.EmsTicket; +import com.xzzn.ems.domain.vo.TicketListVo; import java.util.List; @@ -66,4 +67,11 @@ public interface EmsTicketMapper * @return */ public int dropEmsTicketById(String id); + + /** + * 获取工单列表 + * @param emsTicket + * @return + */ + public List getAllTicketList(EmsTicket emsTicket); } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/IEmsDeviceSettingService.java b/ems-system/src/main/java/com/xzzn/ems/service/IEmsDeviceSettingService.java index 970d040..3340e50 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/IEmsDeviceSettingService.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/IEmsDeviceSettingService.java @@ -1,7 +1,10 @@ package com.xzzn.ems.service; +import com.xzzn.common.enums.DeviceCategory; import com.xzzn.ems.domain.EmsDevicesSetting; +import java.util.List; + /** * 设备信息 服务层 * @@ -9,5 +12,13 @@ import com.xzzn.ems.domain.EmsDevicesSetting; public interface IEmsDeviceSettingService { - public EmsDevicesSetting getDeviceDetailInfo(String deviceId); + public EmsDevicesSetting getDeviceDetailInfo(Long deviceId); + + public int addDevice(EmsDevicesSetting devicesSetting); + + public int updateDevice(EmsDevicesSetting emsDevicesSetting); + + public int deleteEmsDevicesSettingById(Long id); + + public List getDeviceCategory(); } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyCurveService.java b/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyCurveService.java new file mode 100644 index 0000000..74e883a --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyCurveService.java @@ -0,0 +1,61 @@ +package com.xzzn.ems.service; + +import java.util.List; +import com.xzzn.ems.domain.EmsStrategyCurve; + +/** + * 策曲线Service接口 + * + * @author xzzn + * @date 2025-07-11 + */ +public interface IEmsStrategyCurveService +{ + /** + * 查询策曲线 + * + * @param id 策曲线主键 + * @return 策曲线 + */ + public EmsStrategyCurve selectEmsStrategyCurveById(Long id); + + /** + * 查询策曲线列表 + * + * @param emsStrategyCurve 策曲线 + * @return 策曲线集合 + */ + public List selectEmsStrategyCurveList(EmsStrategyCurve emsStrategyCurve); + + /** + * 新增策曲线 + * + * @param emsStrategyCurve 策曲线 + * @return 结果 + */ + public int insertEmsStrategyCurve(EmsStrategyCurve emsStrategyCurve); + + /** + * 修改策曲线 + * + * @param emsStrategyCurve 策曲线 + * @return 结果 + */ + public int updateEmsStrategyCurve(EmsStrategyCurve emsStrategyCurve); + + /** + * 批量删除策曲线 + * + * @param ids 需要删除的策曲线主键集合 + * @return 结果 + */ + public int deleteEmsStrategyCurveByIds(Long[] ids); + + /** + * 删除策曲线信息 + * + * @param id 策曲线主键 + * @return 结果 + */ + public int deleteEmsStrategyCurveById(Long id); +} diff --git a/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyTempService.java b/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyTempService.java new file mode 100644 index 0000000..35ac3b8 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyTempService.java @@ -0,0 +1,35 @@ +package com.xzzn.ems.service; + +import java.util.List; +import java.util.Map; + +import com.xzzn.ems.domain.EmsStrategyTemp; +import com.xzzn.ems.domain.vo.StrategyTempConfigRequest; + +/** + * 模板Service接口 + * + * @author xzzn + * @date 2025-07-11 + */ +public interface IEmsStrategyTempService +{ + /** + * 修改模板 + * + * @param requestVo 模板 + * @return 结果 + */ + public boolean updateEmsStrategyTemp(StrategyTempConfigRequest requestVo); + + public List> getTempNameList(Long strategyId, String siteId); + + // 获取该模板下的时间配置 + public List selectEmsStrategyTempList(String templateId); + + // 新增模板及时间配置 + public boolean addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo); + + //根据templateId删除模板 + public int deleteStrategyTempById(String templateId); +} diff --git a/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyTimeConfigService.java b/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyTimeConfigService.java new file mode 100644 index 0000000..3a8a1ea --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/service/IEmsStrategyTimeConfigService.java @@ -0,0 +1,70 @@ +package com.xzzn.ems.service; + +import java.util.List; +import com.xzzn.ems.domain.EmsStrategyTimeConfig; +import com.xzzn.ems.domain.vo.StrategyTimeConfigVo; + +/** + * 时间配置Service接口 + * + * @author xzzn + * @date 2025-07-11 + */ +public interface IEmsStrategyTimeConfigService +{ + /** + * 查询时间配置 + * + * @param id 时间配置主键 + * @return 时间配置 + */ + public EmsStrategyTimeConfig selectEmsStrategyTimeConfigById(Long id); + + /** + * 查询时间配置列表 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 时间配置集合 + */ + public List selectEmsStrategyTimeConfigList(EmsStrategyTimeConfig emsStrategyTimeConfig); + + /** + * 新增时间配置 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 结果 + */ + public boolean insertEmsStrategyTimeConfig(List emsStrategyTimeConfig); + + /** + * 修改时间配置 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 结果 + */ + public int updateEmsStrategyTimeConfig(EmsStrategyTimeConfig emsStrategyTimeConfig); + + /** + * 批量删除时间配置 + * + * @param ids 需要删除的时间配置主键集合 + * @return 结果 + */ + public int deleteEmsStrategyTimeConfigByIds(Long[] ids); + + /** + * 删除时间配置信息 + * + * @param id 时间配置主键 + * @return 结果 + */ + public int deleteEmsStrategyTimeConfigById(Long id); + + /** + * 获取策略的时间配置列表 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 时间配置集合 + */ + public List getStrategyTimeList(EmsStrategyTimeConfig emsStrategyTimeConfig); +} diff --git a/ems-system/src/main/java/com/xzzn/ems/service/IEmsTicketService.java b/ems-system/src/main/java/com/xzzn/ems/service/IEmsTicketService.java index 7fe9993..6eac8e2 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/IEmsTicketService.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/IEmsTicketService.java @@ -1,6 +1,7 @@ package com.xzzn.ems.service; import com.xzzn.ems.domain.EmsTicket; +import com.xzzn.ems.domain.vo.TicketListVo; import java.util.List; @@ -66,4 +67,12 @@ public interface IEmsTicketService * @return */ public int dropEmsTicketById(String id); + + /** + * 获取工单列表 + * + * @param emsTicket 工单主 + * @return 工单主集合 + */ + public List getAllTicketList(EmsTicket emsTicket); } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsAlarmRecordsServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsAlarmRecordsServiceImpl.java index 18ec20e..6e38d64 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsAlarmRecordsServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsAlarmRecordsServiceImpl.java @@ -143,7 +143,7 @@ public class EmsAlarmRecordsServiceImpl implements IEmsAlarmRecordsService emsTicket.setTicketNo(ticketNo); emsTicket.setTitle("工单"+id.toString()); emsTicket.setContent(emsAlarmRecords.getAlarmContent()); - emsTicket.setUserId(userId.toString()); + emsTicket.setUserId(userId); emsTicket.setWorkUserId(userId); emsTicket.setCreateTime(DateUtils.getNowDate()); emsTicket.setCreateBy(user.getUserName()); diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsDeviceSettingServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsDeviceSettingServiceImpl.java index b8485a1..1837a49 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsDeviceSettingServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsDeviceSettingServiceImpl.java @@ -1,11 +1,17 @@ package com.xzzn.ems.service.impl; +import com.xzzn.common.enums.DeviceCategory; +import com.xzzn.common.utils.DateUtils; +import com.xzzn.common.utils.StringUtils; import com.xzzn.ems.domain.EmsDevicesSetting; import com.xzzn.ems.mapper.EmsDevicesSettingMapper; import com.xzzn.ems.service.IEmsDeviceSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.List; + /** * 站点信息 服务层实现 * @@ -18,11 +24,86 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService /** * 获取设备详细信息 - * @param deviceId + * @param id * @return */ @Override - public EmsDevicesSetting getDeviceDetailInfo(String deviceId) { - return emsDevicesMapper.getDeviceDetailInfo(deviceId); + public EmsDevicesSetting getDeviceDetailInfo(Long id) { + return emsDevicesMapper.selectEmsDevicesSettingById(id); + } + + /** + * 新增设备 + * @param devicesSetting + * @return + */ + @Override + public int addDevice(EmsDevicesSetting devicesSetting) { + boolean flag = checkDeviceExist(devicesSetting); + if (flag) { + return -1; + } + devicesSetting.setCreateTime(DateUtils.getNowDate()); + return emsDevicesMapper.insertEmsDevicesSetting(devicesSetting); + } + + /** + * 更新设备 + * @param devicesSetting + * @return + */ + @Override + public int updateDevice(EmsDevicesSetting devicesSetting) { + boolean checkExist = false; + if (devicesSetting.getId() != null) { + // 根据id判断该数据是否存在 + EmsDevicesSetting existDevice = emsDevicesMapper.selectEmsDevicesSettingById(devicesSetting.getId()); + if (existDevice == null) { + return -1; + } + // 存在判断是否修改deviceId和siteId + String deviceId = existDevice.getDeviceId(); + String siteId = existDevice.getSiteId(); + if (!deviceId.equals(devicesSetting.getDeviceId()) + || !siteId.equals(devicesSetting.getSiteId())) { + checkExist = checkDeviceExist(devicesSetting); + } + } + // 已修改校验修改后数据是否存在 + if (checkExist) { + return -2; + } + devicesSetting.setUpdateTime(DateUtils.getNowDate()); + return emsDevicesMapper.updateEmsDevicesSetting(devicesSetting); + } + + private boolean checkDeviceExist(EmsDevicesSetting devicesSetting) { + String deviceId = devicesSetting.getDeviceId(); + String siteId = devicesSetting.getSiteId(); + if (!StringUtils.isEmpty(deviceId) && !StringUtils.isEmpty(siteId)) { + EmsDevicesSetting emsDevicesSetting = emsDevicesMapper.getDeviceBySiteAndDeviceId(deviceId, siteId); + if (emsDevicesSetting != null) { + return true; + } + } + return false; + } + + /** + * 删除设备配置信息 + * + * @param id Modbus设备配置主键 + * @return 结果 + */ + @Override + public int deleteEmsDevicesSettingById(Long id){ + + return emsDevicesMapper.deleteEmsDevicesSettingById(id); + } + + @Override + public List getDeviceCategory() { + List deviceList = Arrays.asList(DeviceCategory.values()); + return deviceList; } } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyCurveServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyCurveServiceImpl.java new file mode 100644 index 0000000..62a0bb2 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyCurveServiceImpl.java @@ -0,0 +1,96 @@ +package com.xzzn.ems.service.impl; + +import java.util.List; +import com.xzzn.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.xzzn.ems.mapper.EmsStrategyCurveMapper; +import com.xzzn.ems.domain.EmsStrategyCurve; +import com.xzzn.ems.service.IEmsStrategyCurveService; + +/** + * 策曲线Service业务层处理 + * + * @author xzzn + * @date 2025-07-11 + */ +@Service +public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService +{ + @Autowired + private EmsStrategyCurveMapper emsStrategyCurveMapper; + + /** + * 查询策曲线 + * + * @param id 策曲线主键 + * @return 策曲线 + */ + @Override + public EmsStrategyCurve selectEmsStrategyCurveById(Long id) + { + return emsStrategyCurveMapper.selectEmsStrategyCurveById(id); + } + + /** + * 查询策曲线列表 + * + * @param emsStrategyCurve 策曲线 + * @return 策曲线 + */ + @Override + public List selectEmsStrategyCurveList(EmsStrategyCurve emsStrategyCurve) + { + return emsStrategyCurveMapper.selectEmsStrategyCurveList(emsStrategyCurve); + } + + /** + * 新增策曲线 + * + * @param emsStrategyCurve 策曲线 + * @return 结果 + */ + @Override + public int insertEmsStrategyCurve(EmsStrategyCurve emsStrategyCurve) + { + emsStrategyCurve.setCreateTime(DateUtils.getNowDate()); + return emsStrategyCurveMapper.insertEmsStrategyCurve(emsStrategyCurve); + } + + /** + * 修改策曲线 + * + * @param emsStrategyCurve 策曲线 + * @return 结果 + */ + @Override + public int updateEmsStrategyCurve(EmsStrategyCurve emsStrategyCurve) + { + emsStrategyCurve.setUpdateTime(DateUtils.getNowDate()); + return emsStrategyCurveMapper.updateEmsStrategyCurve(emsStrategyCurve); + } + + /** + * 批量删除策曲线 + * + * @param ids 需要删除的策曲线主键 + * @return 结果 + */ + @Override + public int deleteEmsStrategyCurveByIds(Long[] ids) + { + return emsStrategyCurveMapper.deleteEmsStrategyCurveByIds(ids); + } + + /** + * 删除策曲线信息 + * + * @param id 策曲线主键 + * @return 结果 + */ + @Override + public int deleteEmsStrategyCurveById(Long id) + { + return emsStrategyCurveMapper.deleteEmsStrategyCurveById(id); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyServiceImpl.java index 78054e3..3f358a2 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyServiceImpl.java @@ -27,8 +27,7 @@ public class EmsStrategyServiceImpl implements IEmsStrategyService @Override public List selectEmsStrategyRunningList(String siteId) { - List dataList = emsStrategyRunningMapper.getRunningList(siteId); - return dataList; + return emsStrategyRunningMapper.getRunningList(siteId); } @Override @@ -48,15 +47,19 @@ public class EmsStrategyServiceImpl implements IEmsStrategyService @Override public int configStrategy(EmsStrategyRunning emsStrategyRunning) { - // 校验改策略是否已存在 + // 校验是否已存在已运行的相同策略 EmsStrategyRunning existStrategy = emsStrategyRunningMapper.selectEmsStrategyRunning(emsStrategyRunning); if (existStrategy != null) { return -1; } - // 不存在则插入 + // 传策略组id-更新 + if (emsStrategyRunning.getId() != null){ + emsStrategyRunning.setUpdateTime(DateUtils.getNowDate()); + return emsStrategyRunningMapper.updateEmsStrategyRunning(emsStrategyRunning); + } + // 否则新增 emsStrategyRunning.setStatus("1"); emsStrategyRunning.setCreateTime(DateUtils.getNowDate()); - emsStrategyRunning.setUpdateTime(DateUtils.getNowDate()); return emsStrategyRunningMapper.insertEmsStrategyRunning(emsStrategyRunning); } } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyTempServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyTempServiceImpl.java new file mode 100644 index 0000000..6352059 --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyTempServiceImpl.java @@ -0,0 +1,116 @@ +package com.xzzn.ems.service.impl; + +import java.util.List; +import java.util.Map; + +import com.xzzn.common.utils.DateUtils; +import com.xzzn.common.utils.StringUtils; +import com.xzzn.common.utils.bean.BeanUtils; +import com.xzzn.ems.domain.EmsStrategyTempTimeConfig; +import com.xzzn.ems.domain.vo.StrategyTempConfigRequest; +import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.xzzn.ems.mapper.EmsStrategyTempMapper; +import com.xzzn.ems.domain.EmsStrategyTemp; +import com.xzzn.ems.service.IEmsStrategyTempService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 模板Service业务层处理 + * + * @author xzzn + * @date 2025-07-11 + */ +@Service +public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService +{ + private static final String PREFIX= "Temp"; + @Autowired + private EmsStrategyTempMapper emsStrategyTempMapper; + @Autowired + private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper; + + /** + * 查询模板列表 + * + * @param templateId 模板 + * @return 模板 + */ + @Override + public List selectEmsStrategyTempList(String templateId) + { + return emsStrategyTempMapper.selectStrategyTempByTempId(templateId); + } + + /** + * 新增模板和时间配置 + * @param requestVo + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo) { + // 随机生产模板id格式:Temp+时间戳 + String templateId = requestVo.getTemplateId(); + if (StringUtils.isEmpty(templateId)) { + templateId = PREFIX + DateUtils.dateTimeNow(); + } + + EmsStrategyTemp publicTemp = new EmsStrategyTemp(); + BeanUtils.copyProperties(requestVo, publicTemp); + publicTemp.setTemplateId(templateId); + publicTemp.setCreateTime(DateUtils.getNowDate()); + + List timeList = requestVo.getTimeConfigList(); + if (timeList != null && !timeList.isEmpty()) { + for (EmsStrategyTempTimeConfig timeConfig : timeList) { + EmsStrategyTemp temp = new EmsStrategyTemp(); + BeanUtils.copyProperties(publicTemp, temp); + // 时间设置 + temp.setStartTime(timeConfig.getStartTime()); + temp.setEndTime(timeConfig.getEndTime()); + temp.setChargeDischargePower(timeConfig.getChargeDischargePower()); + temp.setChargeStatus(timeConfig.getChargeStatus()); + emsStrategyTempMapper.insertEmsStrategyTemp(temp); + } + } else {// 无时间配置只配置模板基本信息 + emsStrategyTempMapper.insertEmsStrategyTemp(publicTemp); + } + return true; + } + + /** + * 修改模板 + * + * @param requestVo 模板 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateEmsStrategyTemp(StrategyTempConfigRequest requestVo) + { + String templateId = requestVo.getTemplateId(); + // 无发匹配原数据 + // 全删 + emsStrategyTempMapper.deleteTempByTempId(templateId); + + // 重新新增 + addNewTempAndTimeConfig(requestVo); + + return true; + } + + @Override + public List> getTempNameList(Long strategyId, String siteId) { + return emsStrategyTempMapper.getTempNameList(strategyId, siteId); + } + + + @Override + public int deleteStrategyTempById(String templateId) { + // 先更新配置该模板的月份数据 + emsStrategyTimeConfigMapper.cleanTemplateId(templateId); + return emsStrategyTempMapper.deleteTempByTempId(templateId); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyTimeConfigServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyTimeConfigServiceImpl.java new file mode 100644 index 0000000..42f9d2b --- /dev/null +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsStrategyTimeConfigServiceImpl.java @@ -0,0 +1,121 @@ +package com.xzzn.ems.service.impl; + +import java.util.List; +import com.xzzn.common.utils.DateUtils; +import com.xzzn.ems.domain.vo.StrategyTimeConfigVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper; +import com.xzzn.ems.domain.EmsStrategyTimeConfig; +import com.xzzn.ems.service.IEmsStrategyTimeConfigService; + +/** + * 时间配置Service业务层处理 + * + * @author xzzn + * @date 2025-07-11 + */ +@Service +public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigService +{ + @Autowired + private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper; + + /** + * 查询时间配置 + * + * @param id 时间配置主键 + * @return 时间配置 + */ + @Override + public EmsStrategyTimeConfig selectEmsStrategyTimeConfigById(Long id) + { + return emsStrategyTimeConfigMapper.selectEmsStrategyTimeConfigById(id); + } + + /** + * 查询时间配置列表 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 时间配置 + */ + @Override + public List selectEmsStrategyTimeConfigList(EmsStrategyTimeConfig emsStrategyTimeConfig) + { + return emsStrategyTimeConfigMapper.selectEmsStrategyTimeConfigList(emsStrategyTimeConfig); + } + + /** + * 新增时间配置 + * + * @param timeConfigList 时间配置 + * @return 结果 + */ + @Override + public boolean insertEmsStrategyTimeConfig(List timeConfigList) + { + if (timeConfigList != null) { + for (EmsStrategyTimeConfig strategyTimeConfig : timeConfigList) { + Long id = strategyTimeConfig.getId(); + // 新增 + if (id == null) { + strategyTimeConfig.setCreateTime(DateUtils.getNowDate()); + emsStrategyTimeConfigMapper.insertEmsStrategyTimeConfig(strategyTimeConfig); + } else {//更新 + strategyTimeConfig.setUpdateTime(DateUtils.getNowDate()); + emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(strategyTimeConfig); + } + } + } else { + return false; + } + return true; + } + + /** + * 修改时间配置 + * + * @param emsStrategyTimeConfig 时间配置 + * @return 结果 + */ + @Override + public int updateEmsStrategyTimeConfig(EmsStrategyTimeConfig emsStrategyTimeConfig) + { + emsStrategyTimeConfig.setUpdateTime(DateUtils.getNowDate()); + return emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(emsStrategyTimeConfig); + } + + /** + * 批量删除时间配置 + * + * @param ids 需要删除的时间配置主键 + * @return 结果 + */ + @Override + public int deleteEmsStrategyTimeConfigByIds(Long[] ids) + { + return emsStrategyTimeConfigMapper.deleteEmsStrategyTimeConfigByIds(ids); + } + + /** + * 删除时间配置信息 + * + * @param id 时间配置主键 + * @return 结果 + */ + @Override + public int deleteEmsStrategyTimeConfigById(Long id) + { + return emsStrategyTimeConfigMapper.deleteEmsStrategyTimeConfigById(id); + } + + /** + * 获取策略时间配置显示数据 + * @param emsStrategyTimeConfig 时间配置 + * @return + */ + public List getStrategyTimeList(EmsStrategyTimeConfig emsStrategyTimeConfig) + { + return emsStrategyTimeConfigMapper.getStrategyTimeList(emsStrategyTimeConfig); + } +} diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsTicketServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsTicketServiceImpl.java index f9917ec..a63f057 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsTicketServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsTicketServiceImpl.java @@ -1,8 +1,11 @@ package com.xzzn.ems.service.impl; import java.util.List; +import java.util.Random; + import com.xzzn.common.utils.DateUtils; import com.xzzn.ems.domain.EmsTicket; +import com.xzzn.ems.domain.vo.TicketListVo; import com.xzzn.ems.mapper.EmsTicketMapper; import com.xzzn.ems.service.IEmsTicketService; import org.springframework.beans.factory.annotation.Autowired; @@ -54,6 +57,11 @@ public class EmsTicketServiceImpl implements IEmsTicketService @Override public int insertEmsTicket(EmsTicket emsTicket) { + // 工单号随机生产 + String ticketNo = ""; + String nowDate = DateUtils.dateTime(); + ticketNo = "T" + nowDate + String.format("%06d", new Random().nextInt(1000000)); + emsTicket.setTicketNo(ticketNo); emsTicket.setCreateTime(DateUtils.getNowDate()); return emsTicketMapper.insertEmsTicket(emsTicket); } @@ -106,4 +114,9 @@ public class EmsTicketServiceImpl implements IEmsTicketService { return emsTicketMapper.dropEmsTicketById(id); } + + @Override + public List getAllTicketList(EmsTicket emsTicket) { + return emsTicketMapper.getAllTicketList(emsTicket); + } } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/SingleSiteServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/SingleSiteServiceImpl.java index a456966..a67127e 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/SingleSiteServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/SingleSiteServiceImpl.java @@ -402,7 +402,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService { } else if (AMMETER_DEVICE_METE.equals(ammeterId)) { AmmeterMeteDataVo ammeterMeteDataVo = new AmmeterMeteDataVo(); ammeterMeteDataVo.setDeviceName(ammeterDevice.get("deviceName").toString()); - ammeterMeteDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus").toString()); + ammeterMeteDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus") == null? "" : + ammeterDevice.get("communicationStatus").toString()); // 处理储能表数据 dealAmmeterMeteData(ammeterData,ammeterMeteDataVo); ammeterResponse.setAmmeterMeteDataVoList(ammeterMeteDataVo); diff --git a/ems-system/src/main/resources/mapper/ems/EmsDevicesSettingMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsDevicesSettingMapper.xml index 679568b..df9a946 100644 --- a/ems-system/src/main/resources/mapper/ems/EmsDevicesSettingMapper.xml +++ b/ems-system/src/main/resources/mapper/ems/EmsDevicesSettingMapper.xml @@ -26,10 +26,11 @@ + - select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id, device_category from ems_devices_setting + select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id, device_category, picture_url from ems_devices_setting @@ -86,6 +88,7 @@ device_id, parent_id, device_category, + picture_url, #{deviceName}, @@ -108,6 +111,7 @@ #{deviceId}, #{parentId}, #{deviceCategory}, + #{pictureUrl}, @@ -134,6 +138,7 @@ device_id = #{deviceId}, parent_id = #{parentId}, device_category = #{deviceCategory}, + picture_url = #{pictureUrl}, where id = #{id} @@ -180,9 +185,10 @@ from ems_devices_setting where site_id = #{siteId} and device_category = #{deviceCategory} - where device_id = #{deviceId} + AND site_id = #{siteId} limit 1 diff --git a/ems-system/src/main/resources/mapper/ems/EmsSiteSettingMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsSiteSettingMapper.xml index 4968384..9b83f92 100644 --- a/ems-system/src/main/resources/mapper/ems/EmsSiteSettingMapper.xml +++ b/ems-system/src/main/resources/mapper/ems/EmsSiteSettingMapper.xml @@ -137,7 +137,9 @@ select es.site_id as siteId,es.site_name as siteName, ed.device_id as deviceId,ed.device_name as deviceName, ed.device_type as deviceType,ed.communication_status as communicationStatus, - ed.device_category as deviceCategory + ed.device_category as deviceCategory, + ed.picture_url as pictureUrl, + ed.id from ems_site_setting es INNER JOIN ems_devices_setting ed on es.site_id = ed.site_id where 1=1 diff --git a/ems-system/src/main/resources/mapper/ems/EmsStrategyCurveMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsStrategyCurveMapper.xml new file mode 100644 index 0000000..21666b5 --- /dev/null +++ b/ems-system/src/main/resources/mapper/ems/EmsStrategyCurveMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id from ems_strategy_curve + + + + + + + + insert into ems_strategy_curve + + strategy_id, + task_number, + start_date, + end_date, + power_data, + create_by, + create_time, + update_by, + update_time, + remark, + site_id, + + + #{strategyId}, + #{taskNumber}, + #{startDate}, + #{endDate}, + #{powerData}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{siteId}, + + + + + update ems_strategy_curve + + strategy_id = #{strategyId}, + task_number = #{taskNumber}, + start_date = #{startDate}, + end_date = #{endDate}, + power_data = #{powerData}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + site_id = #{siteId}, + + where id = #{id} + + + + delete from ems_strategy_curve where id = #{id} + + + + delete from ems_strategy_curve where id in + + #{id} + + + \ No newline at end of file diff --git a/ems-system/src/main/resources/mapper/ems/EmsStrategyRunningMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsStrategyRunningMapper.xml index d35175b..030e983 100644 --- a/ems-system/src/main/resources/mapper/ems/EmsStrategyRunningMapper.xml +++ b/ems-system/src/main/resources/mapper/ems/EmsStrategyRunningMapper.xml @@ -91,7 +91,9 @@ t.`status`, t.site_id as siteId, main.strategy_name as mainStrategyName, - aux.strategy_name as auxStrategyName + aux.strategy_name as auxStrategyName, + main.id as mainStrategyId, + aux.id as auxStrategyId from ems_strategy_running t LEFT JOIN ems_strategy main on t.main_strategy_id = main.id LEFT JOIN ems_strategy aux on t.auxiliary_strategy_id = aux.id @@ -108,6 +110,6 @@ where site_id = #{siteId} and main_strategy_id = #{mainStrategyId} and auxiliary_strategy_id = #{auxiliaryStrategyId} - and `status` != 4 + and `status` = 1 \ No newline at end of file diff --git a/ems-system/src/main/resources/mapper/ems/EmsStrategyTempMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsStrategyTempMapper.xml new file mode 100644 index 0000000..b297a52 --- /dev/null +++ b/ems-system/src/main/resources/mapper/ems/EmsStrategyTempMapper.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select id, strategy_id, template_name, sdc_limit, sdc_down, sdc_up, start_time, end_time, charge_discharge_power, charge_status, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_temp + + + + + + + + insert into ems_strategy_temp + + strategy_id, + template_name, + sdc_limit, + sdc_down, + sdc_up, + start_time, + end_time, + charge_discharge_power, + charge_status, + create_by, + create_time, + update_by, + update_time, + remark, + site_id, + template_id, + + + #{strategyId}, + #{templateName}, + #{sdcLimit}, + #{sdcDown}, + #{sdcUp}, + #{startTime}, + #{endTime}, + #{chargeDischargePower}, + #{chargeStatus}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{siteId}, + #{templateId}, + + + + + update ems_strategy_temp + + strategy_id = #{strategyId}, + template_name = #{templateName}, + sdc_limit = #{sdcLimit}, + sdc_down = #{sdcDown}, + sdc_up = #{sdcUp}, + start_time = #{startTime}, + end_time = #{endTime}, + charge_discharge_power = #{chargeDischargePower}, + charge_status = #{chargeStatus}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + site_id = #{siteId}, + template_id = #{templateId}, + + where id = #{id} + + + + delete from ems_strategy_temp where id = #{id} + + + + delete from ems_strategy_temp where id in + + #{id} + + + + + + + + + + + delete from ems_strategy_temp where template_id = #{templateId} + + \ No newline at end of file diff --git a/ems-system/src/main/resources/mapper/ems/EmsStrategyTimeConfigMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsStrategyTimeConfigMapper.xml new file mode 100644 index 0000000..08707c1 --- /dev/null +++ b/ems-system/src/main/resources/mapper/ems/EmsStrategyTimeConfigMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_time_config + + + + + + + + insert into ems_strategy_time_config + + strategy_id, + month, + charge_discharge_mode, + create_by, + create_time, + update_by, + update_time, + remark, + site_id, + template_id, + + + #{strategyId}, + #{month}, + #{chargeDischargeMode}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{siteId}, + #{templateId}, + + + + + update ems_strategy_time_config + + strategy_id = #{strategyId}, + month = #{month}, + charge_discharge_mode = #{chargeDischargeMode}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + site_id = #{siteId}, + template_id = #{templateId}, + + where id = #{id} + + + + delete from ems_strategy_time_config where id = #{id} + + + + delete from ems_strategy_time_config where id in + + #{id} + + + + + + + update ems_strategy_time_config set template_id = '' where template_id = #{templateId} + + \ No newline at end of file diff --git a/ems-system/src/main/resources/mapper/ems/EmsTicketMapper.xml b/ems-system/src/main/resources/mapper/ems/EmsTicketMapper.xml index f0901b2..eb0041e 100644 --- a/ems-system/src/main/resources/mapper/ems/EmsTicketMapper.xml +++ b/ems-system/src/main/resources/mapper/ems/EmsTicketMapper.xml @@ -114,4 +114,19 @@ update ems_ticket set isDelete = 0 where id = #{id} + + \ No newline at end of file