策略曲线图修改
This commit is contained in:
@ -50,6 +50,14 @@ public class EmsStrategyCurve extends BaseEntity
|
||||
@Excel(name = "模板id")
|
||||
private String templateId;
|
||||
|
||||
/** 月份,1-12 */
|
||||
@Excel(name = "月份,1-12")
|
||||
private Long month;
|
||||
|
||||
/** 是否删除 0-已删除 1-未删除 */
|
||||
@Excel(name = "是否删除 0-已删除 1-未删除")
|
||||
private Long isDelete;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -128,6 +136,22 @@ public class EmsStrategyCurve extends BaseEntity
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Long month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public Long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -144,6 +168,8 @@ public class EmsStrategyCurve extends BaseEntity
|
||||
.append("remark", getRemark())
|
||||
.append("siteId", getSiteId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("month", getMonth())
|
||||
.append("isDelete", getIsDelete())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,10 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
||||
@Excel(name = "模版id")
|
||||
private String templateId;
|
||||
|
||||
/** 是否下发 0-已下发 1-未下发 */
|
||||
@Excel(name = "是否下发 0-已下发 1-未下发")
|
||||
private int isPost;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -98,6 +102,14 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public int getIsPost() {
|
||||
return isPost;
|
||||
}
|
||||
|
||||
public void setIsPost(int isPost) {
|
||||
this.isPost = isPost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -112,6 +124,7 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
||||
.append("remark", getRemark())
|
||||
.append("siteId", getSiteId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("isPost", getIsPost())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
import com.xzzn.ems.domain.EmsStrategyCurve;
|
||||
|
||||
import java.util.List;
|
||||
@ -13,13 +14,39 @@ import java.util.List;
|
||||
public class StrategyCurveVo
|
||||
{
|
||||
|
||||
/** 站点id */
|
||||
private String siteId;
|
||||
|
||||
/** 关联的策略ID */
|
||||
private Long strategyId;
|
||||
|
||||
/** 模板名称 */
|
||||
private String templateName;
|
||||
|
||||
/** 模板id */
|
||||
private String templateId;
|
||||
|
||||
List<EmsStrategyCurve> cureList;
|
||||
/** 月份 */
|
||||
private Long month;
|
||||
|
||||
/** 模板时间功率 */
|
||||
List<StrategyPowerDataVo> powerList;
|
||||
|
||||
public String getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public Long getStrategyId() {
|
||||
return strategyId;
|
||||
}
|
||||
|
||||
public void setStrategyId(Long strategyId) {
|
||||
this.strategyId = strategyId;
|
||||
}
|
||||
|
||||
public String getTemplateName() {
|
||||
return templateName;
|
||||
@ -29,14 +56,6 @@ public class StrategyCurveVo
|
||||
this.templateName = templateName;
|
||||
}
|
||||
|
||||
public List<EmsStrategyCurve> getCureList() {
|
||||
return cureList;
|
||||
}
|
||||
|
||||
public void setCureList(List<EmsStrategyCurve> cureList) {
|
||||
this.cureList = cureList;
|
||||
}
|
||||
|
||||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
@ -44,4 +63,20 @@ public class StrategyCurveVo
|
||||
public void setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Long month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public List<StrategyPowerDataVo> getPowerList() {
|
||||
return powerList;
|
||||
}
|
||||
|
||||
public void setPowerList(List<StrategyPowerDataVo> powerList) {
|
||||
this.powerList = powerList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsStrategyCurve;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 策曲线Mapper接口
|
||||
@ -65,4 +66,8 @@ public interface EmsStrategyCurveMapper
|
||||
* @return
|
||||
*/
|
||||
public List<EmsStrategyCurve> getTemplateCurve(String templateId);
|
||||
|
||||
public void physicalDeleteCurve(@Param("strategyId")Long strategyId,@Param("siteId")String siteId);
|
||||
// 根据模版id 删除推送的曲线图数据
|
||||
public void physicalDeleteByTemplateId(String templateId);
|
||||
}
|
||||
|
||||
@ -4,10 +4,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.EmsStrategyTemp;
|
||||
import com.xzzn.ems.domain.vo.StrategyCurveVo;
|
||||
import com.xzzn.ems.domain.vo.StrategyPowerDataVo;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTempMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -113,17 +115,27 @@ public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService
|
||||
|
||||
if (tempList != null && !tempList.isEmpty()) {
|
||||
for (Map<String,String> map : tempList) {
|
||||
StrategyCurveVo vo = new StrategyCurveVo();
|
||||
String tempName = map.get("templateName");
|
||||
String tempId = map.get("templateId");
|
||||
vo.setTemplateName(tempName);
|
||||
vo.setTemplateId(tempId);
|
||||
|
||||
if (StringUtils.isNotEmpty(tempId)) {
|
||||
List<EmsStrategyCurve> taskList = emsStrategyCurveMapper.getTemplateCurve(tempId);
|
||||
vo.setCureList(taskList);
|
||||
|
||||
for (int i = 0; i < taskList.size(); i++) {
|
||||
StrategyCurveVo vo = new StrategyCurveVo();
|
||||
vo.setTemplateName(tempName);
|
||||
vo.setTemplateId(tempId);
|
||||
vo.setStrategyId(taskList.get(i).getStrategyId());
|
||||
vo.setSiteId(taskList.get(i).getSiteId());
|
||||
vo.setMonth(taskList.get(i).getMonth());
|
||||
// 时间功率
|
||||
String powerJson = taskList.get(i).getPowerData();
|
||||
List<StrategyPowerDataVo> powerList = JSON.parseArray(powerJson, StrategyPowerDataVo.class);
|
||||
vo.setPowerList(powerList);
|
||||
|
||||
dataList.add(vo);
|
||||
}
|
||||
}
|
||||
dataList.add(vo);
|
||||
}
|
||||
}
|
||||
return dataList;
|
||||
|
||||
@ -8,6 +8,7 @@ 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.EmsStrategyCurveMapper;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -30,6 +31,8 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
private EmsStrategyTempMapper emsStrategyTempMapper;
|
||||
@Autowired
|
||||
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
|
||||
@Autowired
|
||||
private EmsStrategyCurveMapper emsStrategyCurveMapper;
|
||||
|
||||
/**
|
||||
* 查询模板列表
|
||||
@ -95,6 +98,9 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
// 全删
|
||||
emsStrategyTempMapper.deleteTempByTempId(templateId);
|
||||
|
||||
|
||||
// 根据模版id 删除推送的曲线图数据
|
||||
emsStrategyCurveMapper.physicalDeleteByTemplateId(templateId);
|
||||
// 重新新增
|
||||
addNewTempAndTimeConfig(requestVo);
|
||||
|
||||
@ -111,6 +117,9 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
public int deleteStrategyTempById(String templateId) {
|
||||
// 先更新配置该模板的月份数据
|
||||
emsStrategyTimeConfigMapper.cleanTemplateId(templateId);
|
||||
// 根据模版id 删除推送的曲线图数据
|
||||
emsStrategyCurveMapper.physicalDeleteByTemplateId(templateId);
|
||||
|
||||
return emsStrategyTempMapper.deleteTempByTempId(templateId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@ package com.xzzn.ems.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.vo.StrategyTimeConfigVo;
|
||||
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper;
|
||||
@ -20,6 +22,8 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
|
||||
{
|
||||
@Autowired
|
||||
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
|
||||
@Autowired
|
||||
private EmsStrategyCurveMapper emsStrategyCurveMapper;
|
||||
|
||||
/**
|
||||
* 查询时间配置
|
||||
@ -57,6 +61,9 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
|
||||
if (timeConfigList != null) {
|
||||
for (EmsStrategyTimeConfig strategyTimeConfig : timeConfigList) {
|
||||
Long id = strategyTimeConfig.getId();
|
||||
Long strategyId = strategyTimeConfig.getStrategyId();
|
||||
String siteId = strategyTimeConfig.getSiteId();
|
||||
strategyTimeConfig.setIsPost(1);//默认未下发
|
||||
// 新增
|
||||
if (id == null) {
|
||||
strategyTimeConfig.setCreateTime(DateUtils.getNowDate());
|
||||
@ -65,6 +72,10 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
|
||||
strategyTimeConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(strategyTimeConfig);
|
||||
}
|
||||
// 处理曲线图:物理删除该策略的曲线图
|
||||
if (StringUtils.isNotEmpty(siteId) && strategyId != null) {
|
||||
emsStrategyCurveMapper.physicalDeleteCurve(strategyId,siteId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@ -18,10 +18,12 @@
|
||||
<result property="remark" column="remark" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="month" column="month" />
|
||||
<result property="isDelete" column="isDelete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyCurveVo">
|
||||
select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_curve
|
||||
select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id, template_id, month, isDelete from ems_strategy_curve
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyCurveList" parameterType="EmsStrategyCurve" resultMap="EmsStrategyCurveResult">
|
||||
@ -34,6 +36,8 @@
|
||||
<if test="powerData != null and powerData != ''"> and power_data = #{powerData}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="month != null "> and month = #{month}</if>
|
||||
<if test="isDelete != null "> and isDelete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -57,6 +61,8 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="month != null">month,</if>
|
||||
<if test="isDelete != null">isDelete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">#{strategyId},</if>
|
||||
@ -71,6 +77,8 @@
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="month != null">#{month},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -89,6 +97,8 @@
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="month != null">month = #{month},</if>
|
||||
<if test="isDelete != null">isDelete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -107,6 +117,18 @@
|
||||
<select id="getTemplateCurve" parameterType="String" resultMap="EmsStrategyCurveResult">
|
||||
<include refid="selectEmsStrategyCurveVo"/>
|
||||
<where> template_id = #{templateId}
|
||||
and isDelete = 1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="physicalDeleteCurve">
|
||||
update ems_strategy_curve set isDelete = 0
|
||||
where site_id = #{siteId}
|
||||
and strategy_id = #{strategyId}
|
||||
</update>
|
||||
|
||||
<update id="physicalDeleteByTemplateId">
|
||||
update ems_strategy_curve set isDelete = 0
|
||||
where template_id = #{templateId}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -16,10 +16,11 @@
|
||||
<result property="remark" column="remark" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="isPost" column="isPost" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyTimeConfigVo">
|
||||
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
|
||||
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id, isPost from ems_strategy_time_config
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyTimeConfigList" parameterType="EmsStrategyTimeConfig" resultMap="EmsStrategyTimeConfigResult">
|
||||
@ -30,6 +31,7 @@
|
||||
<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="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="isPost != null "> and isPost = #{isPost}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -51,6 +53,7 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="isPost != null">isPost,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">#{strategyId},</if>
|
||||
@ -63,6 +66,7 @@
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="isPost != null">#{isPost},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -79,6 +83,7 @@
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="isPost != null">isPost = #{isPost},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -99,7 +104,9 @@
|
||||
t.month,
|
||||
t.charge_discharge_mode as chargeDischargeMode,
|
||||
t.template_id as templateId,
|
||||
temp.template_name as templateName
|
||||
temp.template_name as templateName,
|
||||
t.site_id as siteId,
|
||||
t.strategy_id as strategyId
|
||||
from ems_strategy_time_config t
|
||||
LEFT JOIN ems_strategy_temp temp on t.template_id = temp.template_id
|
||||
where t.site_id = #{siteId}
|
||||
@ -114,5 +121,6 @@
|
||||
<select id="getAllTimeConfigByTempId" parameterType="String" resultMap="EmsStrategyTimeConfigResult">
|
||||
<include refid="selectEmsStrategyTimeConfigVo"/>
|
||||
where template_id = #{templateId}
|
||||
and isPost = 1
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user