策略配置-模板修改&模板时间配置
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
package com.xzzn.web.controller.ems;
|
package com.xzzn.web.controller.ems;
|
||||||
|
|
||||||
|
import com.xzzn.common.utils.StringUtils;
|
||||||
import com.xzzn.ems.domain.EmsStrategyRunning;
|
import com.xzzn.ems.domain.EmsStrategyRunning;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -60,8 +61,16 @@ public class EmsStrategyController extends BaseController
|
|||||||
@PostMapping(value = "/configStrategy")
|
@PostMapping(value = "/configStrategy")
|
||||||
public AjaxResult configStrategy(@RequestBody EmsStrategyRunning emsStrategyRunning)
|
public AjaxResult configStrategy(@RequestBody EmsStrategyRunning emsStrategyRunning)
|
||||||
{
|
{
|
||||||
|
if (emsStrategyRunning.getMainStrategyId() == null
|
||||||
|
|| StringUtils.isEmpty(emsStrategyRunning.getSiteId())){
|
||||||
|
return error("缺少必填字段");
|
||||||
|
}
|
||||||
emsStrategyRunning.setCreateBy(getUsername());
|
emsStrategyRunning.setCreateBy(getUsername());
|
||||||
emsStrategyRunning.setUpdateBy(getUsername());
|
emsStrategyRunning.setUpdateBy(getUsername());
|
||||||
return toAjax(emsStrategyService.configStrategy(emsStrategyRunning));
|
int result = emsStrategyService.configStrategy(emsStrategyRunning);
|
||||||
|
if (result == -1){
|
||||||
|
return error("站点该策略配置运行中");
|
||||||
|
}
|
||||||
|
return success(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.xzzn.web.controller.ems;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.xzzn.ems.domain.vo.StrategyTempConfigRequest;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -34,47 +36,24 @@ public class EmsStrategyTempController extends BaseController
|
|||||||
private IEmsStrategyTempService emsStrategyTempService;
|
private IEmsStrategyTempService emsStrategyTempService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询模板列表
|
* 获取单个模板时间配置详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:temp:list')")
|
@PreAuthorize("@ss.hasPermi('system:temp:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(EmsStrategyTemp emsStrategyTemp)
|
public AjaxResult list(Long templateId)
|
||||||
{
|
{
|
||||||
return success(emsStrategyTempService.selectEmsStrategyTempList(emsStrategyTemp));
|
return success(emsStrategyTempService.selectEmsStrategyTempList(templateId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出模板列表
|
* 新增模板及时间配置
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:temp:export')")
|
|
||||||
@Log(title = "模板", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, EmsStrategyTemp emsStrategyTemp)
|
|
||||||
{
|
|
||||||
List<EmsStrategyTemp> list = emsStrategyTempService.selectEmsStrategyTempList(emsStrategyTemp);
|
|
||||||
ExcelUtil<EmsStrategyTemp> util = new ExcelUtil<EmsStrategyTemp>(EmsStrategyTemp.class);
|
|
||||||
util.exportExcel(response, list, "模板数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取模板详细信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:temp:query')")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return success(emsStrategyTempService.selectEmsStrategyTempById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增模板
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:temp:add')")
|
@PreAuthorize("@ss.hasPermi('system:temp:add')")
|
||||||
@Log(title = "模板", businessType = BusinessType.INSERT)
|
@Log(title = "模板", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody EmsStrategyTemp emsStrategyTemp)
|
public AjaxResult add(@RequestBody StrategyTempConfigRequest requestVo)
|
||||||
{
|
{
|
||||||
return toAjax(emsStrategyTempService.insertEmsStrategyTemp(emsStrategyTemp));
|
return success(emsStrategyTempService.addNewTempAndTimeConfig(requestVo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +64,12 @@ public class EmsStrategyTempController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody EmsStrategyTemp emsStrategyTemp)
|
public AjaxResult edit(@RequestBody EmsStrategyTemp emsStrategyTemp)
|
||||||
{
|
{
|
||||||
return toAjax(emsStrategyTempService.updateEmsStrategyTemp(emsStrategyTemp));
|
int result = emsStrategyTempService.updateEmsStrategyTemp(emsStrategyTemp);
|
||||||
|
if (result > 0) {
|
||||||
|
return success(result);
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("新增失败请重试!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,10 +77,11 @@ public class EmsStrategyTempController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:temp:remove')")
|
@PreAuthorize("@ss.hasPermi('system:temp:remove')")
|
||||||
@Log(title = "模板", businessType = BusinessType.DELETE)
|
@Log(title = "模板", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{id}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long id)
|
||||||
{
|
{
|
||||||
return toAjax(emsStrategyTempService.deleteEmsStrategyTempByIds(ids));
|
emsStrategyTempService.deleteStrategyTempById(id);
|
||||||
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,6 +22,10 @@
|
|||||||
<groupId>com.xzzn</groupId>
|
<groupId>com.xzzn</groupId>
|
||||||
<artifactId>ems-common</artifactId>
|
<artifactId>ems-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package com.xzzn.ems.domain;
|
package com.xzzn.ems.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.xzzn.common.core.domain.BaseEntity;
|
import com.xzzn.common.core.domain.BaseEntity;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
@ -13,13 +11,13 @@ import com.xzzn.common.annotation.Excel;
|
|||||||
* 模板对象 ems_strategy_temp
|
* 模板对象 ems_strategy_temp
|
||||||
*
|
*
|
||||||
* @author xzzn
|
* @author xzzn
|
||||||
* @date 2025-07-11
|
* @date 2025-07-12
|
||||||
*/
|
*/
|
||||||
public class EmsStrategyTemp extends BaseEntity
|
public class EmsStrategyTemp extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** $column.columnComment */
|
/** */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 关联的策略ID */
|
/** 关联的策略ID */
|
||||||
@ -30,9 +28,9 @@ public class EmsStrategyTemp extends BaseEntity
|
|||||||
@Excel(name = "模板名称,如“模板一”")
|
@Excel(name = "模板名称,如“模板一”")
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
/** SDC限制 (%) */
|
/** SDC限制 (%) 1 = 开,0 = 关 */
|
||||||
@Excel(name = "SDC限制 (%)")
|
@Excel(name = "SDC限制 (%) 1 = 开,0 = 关")
|
||||||
private BigDecimal sdcLimit;
|
private Integer sdcLimit;
|
||||||
|
|
||||||
/** SDC下限 (%) */
|
/** SDC下限 (%) */
|
||||||
@Excel(name = "SDC下限 (%)")
|
@Excel(name = "SDC下限 (%)")
|
||||||
@ -42,24 +40,6 @@ public class EmsStrategyTemp extends BaseEntity
|
|||||||
@Excel(name = "SDC上限 (%)")
|
@Excel(name = "SDC上限 (%)")
|
||||||
private BigDecimal sdcUp;
|
private BigDecimal sdcUp;
|
||||||
|
|
||||||
/** 开始时间 */
|
|
||||||
@JsonFormat(pattern = "HH:mm:ss")
|
|
||||||
@Excel(name = "开始时间", width = 30, dateFormat = "HH:mm:ss")
|
|
||||||
private LocalTime startTime;
|
|
||||||
|
|
||||||
/** 结束时间 */
|
|
||||||
@JsonFormat(pattern = "HH:mm:ss")
|
|
||||||
@Excel(name = "结束时间", width = 30, dateFormat = "HH:mm:ss")
|
|
||||||
private LocalTime endTime;
|
|
||||||
|
|
||||||
/** 充放功率 (kW) */
|
|
||||||
@Excel(name = "充放功率 (kW)")
|
|
||||||
private BigDecimal chargeDischargePower;
|
|
||||||
|
|
||||||
/** 充电状态,如“1-充电”、“2-待机” */
|
|
||||||
@Excel(name = "充电状态,如“1-充电”、“2-待机”")
|
|
||||||
private String chargeStatus;
|
|
||||||
|
|
||||||
/** 站点id */
|
/** 站点id */
|
||||||
@Excel(name = "站点id")
|
@Excel(name = "站点id")
|
||||||
private String siteId;
|
private String siteId;
|
||||||
@ -94,12 +74,12 @@ public class EmsStrategyTemp extends BaseEntity
|
|||||||
return templateName;
|
return templateName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSdcLimit(BigDecimal sdcLimit)
|
public void setSdcLimit(Integer sdcLimit)
|
||||||
{
|
{
|
||||||
this.sdcLimit = sdcLimit;
|
this.sdcLimit = sdcLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSdcLimit()
|
public Integer getSdcLimit()
|
||||||
{
|
{
|
||||||
return sdcLimit;
|
return sdcLimit;
|
||||||
}
|
}
|
||||||
@ -124,42 +104,6 @@ public class EmsStrategyTemp extends BaseEntity
|
|||||||
return sdcUp;
|
return sdcUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalTime getStartTime() {
|
|
||||||
return startTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStartTime(LocalTime startTime) {
|
|
||||||
this.startTime = startTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalTime getEndTime() {
|
|
||||||
return endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEndTime(LocalTime endTime) {
|
|
||||||
this.endTime = 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)
|
public void setSiteId(String siteId)
|
||||||
{
|
{
|
||||||
this.siteId = siteId;
|
this.siteId = siteId;
|
||||||
@ -179,10 +123,6 @@ public class EmsStrategyTemp extends BaseEntity
|
|||||||
.append("sdcLimit", getSdcLimit())
|
.append("sdcLimit", getSdcLimit())
|
||||||
.append("sdcDown", getSdcDown())
|
.append("sdcDown", getSdcDown())
|
||||||
.append("sdcUp", getSdcUp())
|
.append("sdcUp", getSdcUp())
|
||||||
.append("startTime", getStartTime())
|
|
||||||
.append("endTime", getEndTime())
|
|
||||||
.append("chargeDischargePower", getChargeDischargePower())
|
|
||||||
.append("chargeStatus", getChargeStatus())
|
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
|
|||||||
@ -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 = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/** 结束时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/** 充放功率 (kW) */
|
||||||
|
@Excel(name = "充放功率 (kW)")
|
||||||
|
private BigDecimal chargeDischargePower;
|
||||||
|
|
||||||
|
/** 充电状态,如“1-充电”、“2-待机” */
|
||||||
|
@Excel(name = "充电状态,如“1-充电”、“2-待机”")
|
||||||
|
private String chargeStatus;
|
||||||
|
|
||||||
|
/** 模板id */
|
||||||
|
@Excel(name = "模板id")
|
||||||
|
private Long 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(Long templateId)
|
||||||
|
{
|
||||||
|
this.templateId = templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,13 +9,13 @@ import com.xzzn.common.annotation.Excel;
|
|||||||
* 时间配置对象 ems_strategy_time_config
|
* 时间配置对象 ems_strategy_time_config
|
||||||
*
|
*
|
||||||
* @author xzzn
|
* @author xzzn
|
||||||
* @date 2025-07-11
|
* @date 2025-07-12
|
||||||
*/
|
*/
|
||||||
public class EmsStrategyTimeConfig extends BaseEntity
|
public class EmsStrategyTimeConfig extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** $column.columnComment */
|
/** */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 关联的策略ID */
|
/** 关联的策略ID */
|
||||||
@ -34,6 +34,10 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
|||||||
@Excel(name = "站点id")
|
@Excel(name = "站点id")
|
||||||
private String siteId;
|
private String siteId;
|
||||||
|
|
||||||
|
/** 模板id */
|
||||||
|
@Excel(name = "模板id")
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -84,6 +88,16 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
|||||||
return siteId;
|
return siteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTemplateId(String templateId)
|
||||||
|
{
|
||||||
|
this.templateId = templateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemplateId()
|
||||||
|
{
|
||||||
|
return templateId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -97,6 +111,7 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
|||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("siteId", getSiteId())
|
.append("siteId", getSiteId())
|
||||||
|
.append("templateId", getTemplateId())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,107 @@
|
|||||||
|
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 Long id;
|
||||||
|
/** 站点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<EmsStrategyTempTimeConfig> timeConfigList;
|
||||||
|
|
||||||
|
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<EmsStrategyTempTimeConfig> getTimeConfigList() {
|
||||||
|
return timeConfigList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeConfigList(List<EmsStrategyTempTimeConfig> timeConfigList) {
|
||||||
|
this.timeConfigList = timeConfigList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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 = "yyyy-MM-dd")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/** 结束时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -60,7 +60,7 @@ public interface EmsStrategyRunningMapper
|
|||||||
*/
|
*/
|
||||||
public int deleteEmsStrategyRunningByIds(Long[] ids);
|
public int deleteEmsStrategyRunningByIds(Long[] ids);
|
||||||
|
|
||||||
// 获取站点运行策略
|
// 获取站点运行策略列表
|
||||||
public List<StrategyRunningVo> getRunningList(String siteId);
|
public List<StrategyRunningVo> getRunningList(String siteId);
|
||||||
|
|
||||||
// 停止策略
|
// 停止策略
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.xzzn.ems.mapper;
|
package com.xzzn.ems.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsStrategyTemp;
|
import com.xzzn.ems.domain.EmsStrategyTemp;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -60,5 +62,9 @@ public interface EmsStrategyTempMapper
|
|||||||
*/
|
*/
|
||||||
public int deleteEmsStrategyTempByIds(Long[] ids);
|
public int deleteEmsStrategyTempByIds(Long[] ids);
|
||||||
|
|
||||||
public List<String> getTempNameList(@Param("strategyId")Long strategyId, @Param("siteId")String siteId);
|
// 获取模板名称和id
|
||||||
|
public List<Map<String,String>> getTempNameList(@Param("strategyId")Long strategyId, @Param("siteId")String siteId);
|
||||||
|
|
||||||
|
// 删除模板
|
||||||
|
public int deleteEmsStrategyTempByIds(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.xzzn.ems.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.xzzn.ems.domain.EmsStrategyTempTimeConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板配置Mapper接口
|
||||||
|
*
|
||||||
|
* @author xzzn
|
||||||
|
* @date 2025-07-12
|
||||||
|
*/
|
||||||
|
public interface EmsStrategyTempTimeConfigMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询模板配置
|
||||||
|
*
|
||||||
|
* @param id 模板配置主键
|
||||||
|
* @return 模板配置
|
||||||
|
*/
|
||||||
|
public EmsStrategyTempTimeConfig selectEmsStrategyTempTimeConfigById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询模板配置列表
|
||||||
|
*
|
||||||
|
* @param emsStrategyTempTimeConfig 模板配置
|
||||||
|
* @return 模板配置集合
|
||||||
|
*/
|
||||||
|
public List<EmsStrategyTempTimeConfig> selectEmsStrategyTempTimeConfigList(EmsStrategyTempTimeConfig emsStrategyTempTimeConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增模板配置
|
||||||
|
*
|
||||||
|
* @param emsStrategyTempTimeConfig 模板配置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEmsStrategyTempTimeConfig(EmsStrategyTempTimeConfig emsStrategyTempTimeConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改模板配置
|
||||||
|
*
|
||||||
|
* @param emsStrategyTempTimeConfig 模板配置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEmsStrategyTempTimeConfig(EmsStrategyTempTimeConfig emsStrategyTempTimeConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模板配置
|
||||||
|
*
|
||||||
|
* @param id 模板配置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEmsStrategyTempTimeConfigById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除模板配置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEmsStrategyTempTimeConfigByIds(Long[] ids);
|
||||||
|
|
||||||
|
// 获取模板的时间
|
||||||
|
public List<EmsStrategyTempTimeConfig> getTimeListByTempId(Long templateId);
|
||||||
|
|
||||||
|
// 根据模板id删除时间配置
|
||||||
|
public void deleteTimeConfigByTempId(Long templateId);
|
||||||
|
}
|
||||||
@ -1,7 +1,11 @@
|
|||||||
package com.xzzn.ems.service;
|
package com.xzzn.ems.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsStrategyTemp;
|
import com.xzzn.ems.domain.EmsStrategyTemp;
|
||||||
|
import com.xzzn.ems.domain.vo.StrategyTempConfigRequest;
|
||||||
|
import com.xzzn.ems.domain.vo.StrategyTempTimeConfigVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板Service接口
|
* 模板Service接口
|
||||||
@ -11,29 +15,12 @@ import com.xzzn.ems.domain.EmsStrategyTemp;
|
|||||||
*/
|
*/
|
||||||
public interface IEmsStrategyTempService
|
public interface IEmsStrategyTempService
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 查询模板
|
|
||||||
*
|
|
||||||
* @param id 模板主键
|
|
||||||
* @return 模板
|
|
||||||
*/
|
|
||||||
public EmsStrategyTemp selectEmsStrategyTempById(Long id);
|
|
||||||
|
|
||||||
/**
|
// 获取该模板下的时间配置
|
||||||
* 查询模板列表
|
public List<StrategyTempTimeConfigVo> selectEmsStrategyTempList(Long id);
|
||||||
*
|
|
||||||
* @param emsStrategyTemp 模板
|
|
||||||
* @return 模板集合
|
|
||||||
*/
|
|
||||||
public List<EmsStrategyTemp> selectEmsStrategyTempList(EmsStrategyTemp emsStrategyTemp);
|
|
||||||
|
|
||||||
/**
|
// 新增模板及时间配置
|
||||||
* 新增模板
|
public int addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo);
|
||||||
*
|
|
||||||
* @param emsStrategyTemp 模板
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertEmsStrategyTemp(EmsStrategyTemp emsStrategyTemp);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改模板
|
* 修改模板
|
||||||
@ -59,5 +46,7 @@ public interface IEmsStrategyTempService
|
|||||||
*/
|
*/
|
||||||
public int deleteEmsStrategyTempById(Long id);
|
public int deleteEmsStrategyTempById(Long id);
|
||||||
|
|
||||||
public List<String> getTempNameList(Long strategyId, String siteId);
|
public List<Map<String,String>> getTempNameList(Long strategyId, String siteId);
|
||||||
|
|
||||||
|
public void deleteStrategyTempById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class EmsStrategyServiceImpl implements IEmsStrategyService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int configStrategy(EmsStrategyRunning emsStrategyRunning) {
|
public int configStrategy(EmsStrategyRunning emsStrategyRunning) {
|
||||||
// 校验改策略是否已存在
|
// 校验是否已存在已运行的相同策略
|
||||||
EmsStrategyRunning existStrategy = emsStrategyRunningMapper.selectEmsStrategyRunning(emsStrategyRunning);
|
EmsStrategyRunning existStrategy = emsStrategyRunningMapper.selectEmsStrategyRunning(emsStrategyRunning);
|
||||||
if (existStrategy != null) {
|
if (existStrategy != null) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -1,7 +1,15 @@
|
|||||||
package com.xzzn.ems.service.impl;
|
package com.xzzn.ems.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.xzzn.common.utils.DateUtils;
|
import com.xzzn.common.utils.DateUtils;
|
||||||
|
import com.xzzn.common.utils.bean.BeanUtils;
|
||||||
|
import com.xzzn.ems.domain.EmsStrategyTempTimeConfig;
|
||||||
|
import com.xzzn.ems.domain.vo.StrategyTempConfigRequest;
|
||||||
|
import com.xzzn.ems.domain.vo.StrategyTempTimeConfigVo;
|
||||||
|
import com.xzzn.ems.mapper.EmsStrategyTempTimeConfigMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.xzzn.ems.mapper.EmsStrategyTempMapper;
|
import com.xzzn.ems.mapper.EmsStrategyTempMapper;
|
||||||
@ -19,42 +27,36 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmsStrategyTempMapper emsStrategyTempMapper;
|
private EmsStrategyTempMapper emsStrategyTempMapper;
|
||||||
|
@Autowired
|
||||||
/**
|
private EmsStrategyTempTimeConfigMapper emsStrategyTempTimeConfigMapper;
|
||||||
* 查询模板
|
|
||||||
*
|
|
||||||
* @param id 模板主键
|
|
||||||
* @return 模板
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public EmsStrategyTemp selectEmsStrategyTempById(Long id)
|
|
||||||
{
|
|
||||||
return emsStrategyTempMapper.selectEmsStrategyTempById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询模板列表
|
* 查询模板列表
|
||||||
*
|
*
|
||||||
* @param emsStrategyTemp 模板
|
* @param templateId 模板
|
||||||
* @return 模板
|
* @return 模板
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<EmsStrategyTemp> selectEmsStrategyTempList(EmsStrategyTemp emsStrategyTemp)
|
public List<StrategyTempTimeConfigVo> selectEmsStrategyTempList(Long templateId)
|
||||||
{
|
{
|
||||||
return emsStrategyTempMapper.selectEmsStrategyTempList(emsStrategyTemp);
|
List<StrategyTempTimeConfigVo> dataList = new ArrayList<>();
|
||||||
|
EmsStrategyTemp temp = emsStrategyTempMapper.selectEmsStrategyTempById(templateId);
|
||||||
|
if (temp != null) {
|
||||||
|
List<EmsStrategyTempTimeConfig> timeList = emsStrategyTempTimeConfigMapper.getTimeListByTempId(templateId);
|
||||||
|
if (timeList != null) {
|
||||||
|
for (EmsStrategyTempTimeConfig timeConfig : timeList) {
|
||||||
|
StrategyTempTimeConfigVo vo = new StrategyTempTimeConfigVo();
|
||||||
|
BeanUtils.copyProperties(timeConfig, vo);
|
||||||
|
BeanUtils.copyProperties(temp, vo);
|
||||||
|
dataList.add(vo);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
/**
|
StrategyTempTimeConfigVo vo = new StrategyTempTimeConfigVo();
|
||||||
* 新增模板
|
BeanUtils.copyProperties(temp, vo);
|
||||||
*
|
dataList.add(vo);
|
||||||
* @param emsStrategyTemp 模板
|
}
|
||||||
* @return 结果
|
}
|
||||||
*/
|
return dataList;
|
||||||
@Override
|
|
||||||
public int insertEmsStrategyTemp(EmsStrategyTemp emsStrategyTemp)
|
|
||||||
{
|
|
||||||
emsStrategyTemp.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return emsStrategyTempMapper.insertEmsStrategyTemp(emsStrategyTemp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +97,35 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTempNameList(Long strategyId, String siteId) {
|
public List<Map<String,String>> getTempNameList(Long strategyId, String siteId) {
|
||||||
return emsStrategyTempMapper.getTempNameList(strategyId, siteId);
|
return emsStrategyTempMapper.getTempNameList(strategyId, siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo) {
|
||||||
|
EmsStrategyTemp emsStrategyTemp = new EmsStrategyTemp();
|
||||||
|
BeanUtils.copyProperties(requestVo, emsStrategyTemp);
|
||||||
|
emsStrategyTemp.setCreateTime(DateUtils.getNowDate());
|
||||||
|
emsStrategyTempMapper.insertEmsStrategyTemp(emsStrategyTemp);
|
||||||
|
|
||||||
|
List<EmsStrategyTempTimeConfig> timeList = requestVo.getTimeConfigList();
|
||||||
|
if (timeList != null) {
|
||||||
|
for (EmsStrategyTempTimeConfig timeConfig : timeList) {
|
||||||
|
timeConfig.setCreateTime(DateUtils.getNowDate());
|
||||||
|
timeConfig.setTemplateId(emsStrategyTemp.getId());
|
||||||
|
emsStrategyTempTimeConfigMapper.insertEmsStrategyTempTimeConfig(timeConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteStrategyTempById(Long id) {
|
||||||
|
// 先删除时间配置
|
||||||
|
emsStrategyTempTimeConfigMapper.deleteTimeConfigByTempId(id);
|
||||||
|
|
||||||
|
// 再删除模板
|
||||||
|
emsStrategyTempMapper.deleteEmsStrategyTempById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,6 +108,6 @@
|
|||||||
where site_id = #{siteId}
|
where site_id = #{siteId}
|
||||||
and main_strategy_id = #{mainStrategyId}
|
and main_strategy_id = #{mainStrategyId}
|
||||||
and auxiliary_strategy_id = #{auxiliaryStrategyId}
|
and auxiliary_strategy_id = #{auxiliaryStrategyId}
|
||||||
and `status` != 4
|
and `status` = 1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -11,10 +11,6 @@
|
|||||||
<result property="sdcLimit" column="sdc_limit" />
|
<result property="sdcLimit" column="sdc_limit" />
|
||||||
<result property="sdcDown" column="sdc_down" />
|
<result property="sdcDown" column="sdc_down" />
|
||||||
<result property="sdcUp" column="sdc_up" />
|
<result property="sdcUp" column="sdc_up" />
|
||||||
<result property="startTime" column="start_time" />
|
|
||||||
<result property="endTime" column="end_time" />
|
|
||||||
<result property="chargeDischargePower" column="charge_discharge_power" />
|
|
||||||
<result property="chargeStatus" column="charge_status" />
|
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
@ -24,7 +20,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmsStrategyTempVo">
|
<sql id="selectEmsStrategyTempVo">
|
||||||
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 from ems_strategy_temp
|
select id, strategy_id, template_name, sdc_limit, sdc_down, sdc_up, create_by, create_time, update_by, update_time, remark, site_id from ems_strategy_temp
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmsStrategyTempList" parameterType="EmsStrategyTemp" resultMap="EmsStrategyTempResult">
|
<select id="selectEmsStrategyTempList" parameterType="EmsStrategyTemp" resultMap="EmsStrategyTempResult">
|
||||||
@ -35,10 +31,6 @@
|
|||||||
<if test="sdcLimit != null "> and sdc_limit = #{sdcLimit}</if>
|
<if test="sdcLimit != null "> and sdc_limit = #{sdcLimit}</if>
|
||||||
<if test="sdcDown != null "> and sdc_down = #{sdcDown}</if>
|
<if test="sdcDown != null "> and sdc_down = #{sdcDown}</if>
|
||||||
<if test="sdcUp != null "> and sdc_up = #{sdcUp}</if>
|
<if test="sdcUp != null "> and sdc_up = #{sdcUp}</if>
|
||||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
|
||||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
|
||||||
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
|
||||||
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
|
||||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
@ -56,10 +48,6 @@
|
|||||||
<if test="sdcLimit != null">sdc_limit,</if>
|
<if test="sdcLimit != null">sdc_limit,</if>
|
||||||
<if test="sdcDown != null">sdc_down,</if>
|
<if test="sdcDown != null">sdc_down,</if>
|
||||||
<if test="sdcUp != null">sdc_up,</if>
|
<if test="sdcUp != null">sdc_up,</if>
|
||||||
<if test="startTime != null">start_time,</if>
|
|
||||||
<if test="endTime != null">end_time,</if>
|
|
||||||
<if test="chargeDischargePower != null">charge_discharge_power,</if>
|
|
||||||
<if test="chargeStatus != null">charge_status,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
@ -73,10 +61,6 @@
|
|||||||
<if test="sdcLimit != null">#{sdcLimit},</if>
|
<if test="sdcLimit != null">#{sdcLimit},</if>
|
||||||
<if test="sdcDown != null">#{sdcDown},</if>
|
<if test="sdcDown != null">#{sdcDown},</if>
|
||||||
<if test="sdcUp != null">#{sdcUp},</if>
|
<if test="sdcUp != null">#{sdcUp},</if>
|
||||||
<if test="startTime != null">#{startTime},</if>
|
|
||||||
<if test="endTime != null">#{endTime},</if>
|
|
||||||
<if test="chargeDischargePower != null">#{chargeDischargePower},</if>
|
|
||||||
<if test="chargeStatus != null">#{chargeStatus},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
@ -94,10 +78,6 @@
|
|||||||
<if test="sdcLimit != null">sdc_limit = #{sdcLimit},</if>
|
<if test="sdcLimit != null">sdc_limit = #{sdcLimit},</if>
|
||||||
<if test="sdcDown != null">sdc_down = #{sdcDown},</if>
|
<if test="sdcDown != null">sdc_down = #{sdcDown},</if>
|
||||||
<if test="sdcUp != null">sdc_up = #{sdcUp},</if>
|
<if test="sdcUp != null">sdc_up = #{sdcUp},</if>
|
||||||
<if test="startTime != null">start_time = #{startTime},</if>
|
|
||||||
<if test="endTime != null">end_time = #{endTime},</if>
|
|
||||||
<if test="chargeDischargePower != null">charge_discharge_power = #{chargeDischargePower},</if>
|
|
||||||
<if test="chargeStatus != null">charge_status = #{chargeStatus},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
@ -119,10 +99,14 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getTempNameList" resultType="String">
|
<select id="getTempNameList" resultType="Map">
|
||||||
select DISTINCT template_name as templateName
|
select DISTINCT id as templateId,template_name as templateName
|
||||||
from ems_strategy_temp
|
from ems_strategy_temp
|
||||||
where site_id = #{siteId}
|
where site_id = #{siteId}
|
||||||
and strategy_id = #{strategyId}
|
and strategy_id = #{strategyId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getStrategyTempByTempId" parameterType="String" resultType="int">
|
||||||
|
select count(1) from ems_strategy_temp where template_id = #{templateId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xzzn.ems.mapper.EmsStrategyTempTimeConfigMapper">
|
||||||
|
|
||||||
|
<resultMap type="EmsStrategyTempTimeConfig" id="EmsStrategyTempTimeConfigResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="startTime" column="start_time" />
|
||||||
|
<result property="endTime" column="end_time" />
|
||||||
|
<result property="chargeDischargePower" column="charge_discharge_power" />
|
||||||
|
<result property="chargeStatus" column="charge_status" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="templateId" column="template_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEmsStrategyTempTimeConfigVo">
|
||||||
|
select id, start_time, end_time, charge_discharge_power, charge_status, create_by, create_time, update_by, update_time, remark, template_id from ems_strategy_temp_time_config
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEmsStrategyTempTimeConfigList" parameterType="EmsStrategyTempTimeConfig" resultMap="EmsStrategyTempTimeConfigResult">
|
||||||
|
<include refid="selectEmsStrategyTempTimeConfigVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||||
|
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||||
|
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
||||||
|
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
||||||
|
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEmsStrategyTempTimeConfigById" parameterType="Long" resultMap="EmsStrategyTempTimeConfigResult">
|
||||||
|
<include refid="selectEmsStrategyTempTimeConfigVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEmsStrategyTempTimeConfig" parameterType="EmsStrategyTempTimeConfig" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ems_strategy_temp_time_config
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="startTime != null">start_time,</if>
|
||||||
|
<if test="endTime != null">end_time,</if>
|
||||||
|
<if test="chargeDischargePower != null">charge_discharge_power,</if>
|
||||||
|
<if test="chargeStatus != null">charge_status,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="templateId != null">template_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="startTime != null">#{startTime},</if>
|
||||||
|
<if test="endTime != null">#{endTime},</if>
|
||||||
|
<if test="chargeDischargePower != null">#{chargeDischargePower},</if>
|
||||||
|
<if test="chargeStatus != null">#{chargeStatus},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="templateId != null">#{templateId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEmsStrategyTempTimeConfig" parameterType="EmsStrategyTempTimeConfig">
|
||||||
|
update ems_strategy_temp_time_config
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="startTime != null">start_time = #{startTime},</if>
|
||||||
|
<if test="endTime != null">end_time = #{endTime},</if>
|
||||||
|
<if test="chargeDischargePower != null">charge_discharge_power = #{chargeDischargePower},</if>
|
||||||
|
<if test="chargeStatus != null">charge_status = #{chargeStatus},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="templateId != null">template_id = #{templateId},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEmsStrategyTempTimeConfigById" parameterType="Long">
|
||||||
|
delete from ems_strategy_temp_time_config where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEmsStrategyTempTimeConfigByIds" parameterType="String">
|
||||||
|
delete from ems_strategy_temp_time_config where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getTimeListByTempId" parameterType="Long" resultMap="EmsStrategyTempTimeConfigResult">
|
||||||
|
<include refid="selectEmsStrategyTempTimeConfigVo"/>
|
||||||
|
where template_id = #{templateId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteTimeConfigByTempId" parameterType="Long">
|
||||||
|
delete from ems_strategy_temp_time_config where template_id = #{templateId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@ -15,10 +15,11 @@
|
|||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="siteId" column="site_id" />
|
<result property="siteId" column="site_id" />
|
||||||
|
<result property="templateId" column="template_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmsStrategyTimeConfigVo">
|
<sql id="selectEmsStrategyTimeConfigVo">
|
||||||
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id from ems_strategy_time_config
|
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
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmsStrategyTimeConfigList" parameterType="EmsStrategyTimeConfig" resultMap="EmsStrategyTimeConfigResult">
|
<select id="selectEmsStrategyTimeConfigList" parameterType="EmsStrategyTimeConfig" resultMap="EmsStrategyTimeConfigResult">
|
||||||
@ -28,8 +29,8 @@
|
|||||||
<if test="month != null "> and month = #{month}</if>
|
<if test="month != null "> and month = #{month}</if>
|
||||||
<if test="chargeDischargeMode != null and chargeDischargeMode != ''"> and charge_discharge_mode = #{chargeDischargeMode}</if>
|
<if test="chargeDischargeMode != null and chargeDischargeMode != ''"> and charge_discharge_mode = #{chargeDischargeMode}</if>
|
||||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||||
|
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||||
</where>
|
</where>
|
||||||
order by month
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEmsStrategyTimeConfigById" parameterType="Long" resultMap="EmsStrategyTimeConfigResult">
|
<select id="selectEmsStrategyTimeConfigById" parameterType="Long" resultMap="EmsStrategyTimeConfigResult">
|
||||||
@ -49,6 +50,7 @@
|
|||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="siteId != null">site_id,</if>
|
<if test="siteId != null">site_id,</if>
|
||||||
|
<if test="templateId != null">template_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="strategyId != null">#{strategyId},</if>
|
<if test="strategyId != null">#{strategyId},</if>
|
||||||
@ -60,6 +62,7 @@
|
|||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="siteId != null">#{siteId},</if>
|
<if test="siteId != null">#{siteId},</if>
|
||||||
|
<if test="templateId != null">#{templateId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -75,6 +78,7 @@
|
|||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="siteId != null">site_id = #{siteId},</if>
|
<if test="siteId != null">site_id = #{siteId},</if>
|
||||||
|
<if test="templateId != null">template_id = #{templateId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
Reference in New Issue
Block a user