策略配置-曲线图模型修改

This commit is contained in:
2025-07-15 12:57:00 +08:00
parent d22a71739f
commit e6d6f806e4
8 changed files with 135 additions and 4 deletions

View File

@ -2,6 +2,9 @@ package com.xzzn.web.controller.ems;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.xzzn.ems.domain.EmsStrategyTemp;
import com.xzzn.ems.domain.EmsStrategyTimeConfig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -19,7 +22,6 @@ 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
@ -99,4 +101,13 @@ public class EmsStrategyCurveController extends BaseController
{
return toAjax(emsStrategyCurveService.deleteEmsStrategyCurveByIds(ids));
}
/**
* 获取策略曲线图数据
*/
@GetMapping("/curveList")
public AjaxResult getCurveList(EmsStrategyTemp tempConfig)
{
return success(emsStrategyCurveService.getStrategyCurveList(tempConfig));
}
}

View File

@ -46,6 +46,10 @@ public class EmsStrategyCurve extends BaseEntity
@Excel(name = "站点id")
private String siteId;
/** 模板id */
@Excel(name = "模板id")
private String templateId;
public void setId(Long id)
{
this.id = id;
@ -116,6 +120,14 @@ public class EmsStrategyCurve extends BaseEntity
return siteId;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -131,6 +143,7 @@ public class EmsStrategyCurve extends BaseEntity
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("siteId", getSiteId())
.append("templateId", getTemplateId())
.toString();
}
}

View File

@ -0,0 +1,47 @@
package com.xzzn.ems.domain.vo;
import com.xzzn.ems.domain.EmsStrategyCurve;
import java.util.List;
/**
*策略模块曲线图
*
* @author xzzn
* @date 2025-07-13
*/
public class StrategyCurveVo
{
/** 模板名称 */
private String templateName;
/** 模板id */
private String templateId;
List<EmsStrategyCurve> cureList;
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public List<EmsStrategyCurve> getCureList() {
return cureList;
}
public void setCureList(List<EmsStrategyCurve> cureList) {
this.cureList = cureList;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
}

View File

@ -58,4 +58,11 @@ public interface EmsStrategyCurveMapper
* @return 结果
*/
public int deleteEmsStrategyCurveByIds(Long[] ids);
/**
* 根据模板id获取曲线图数据
* @param templateId
* @return
*/
public List<EmsStrategyCurve> getTemplateCurve(String templateId);
}

View File

@ -2,6 +2,8 @@ package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsStrategyCurve;
import com.xzzn.ems.domain.EmsStrategyTemp;
import com.xzzn.ems.domain.vo.StrategyCurveVo;
/**
* 策曲线Service接口
@ -58,4 +60,7 @@ public interface IEmsStrategyCurveService
* @return 结果
*/
public int deleteEmsStrategyCurveById(Long id);
// 获取站点策略的运行曲线数据
public List<StrategyCurveVo> getStrategyCurveList(EmsStrategyTemp tempConfig);
}

View File

@ -1,7 +1,14 @@
package com.xzzn.ems.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
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.mapper.EmsStrategyTempMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
@ -19,6 +26,8 @@ public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService
{
@Autowired
private EmsStrategyCurveMapper emsStrategyCurveMapper;
@Autowired
private EmsStrategyTempMapper emsStrategyTempMapper;
/**
* 查询策曲线
@ -93,4 +102,30 @@ public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService
{
return emsStrategyCurveMapper.deleteEmsStrategyCurveById(id);
}
@Override
public List<StrategyCurveVo> getStrategyCurveList(EmsStrategyTemp tempConfig) {
List<StrategyCurveVo> dataList = new ArrayList();
String siteId = tempConfig.getSiteId();
Long strategyId = tempConfig.getStrategyId();
// 获取该策略的所有模板配置
List<Map<String,String>> tempList = emsStrategyTempMapper.getTempNameList(strategyId, siteId);
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);
}
dataList.add(vo);
}
}
return dataList;
}
}

View File

@ -197,7 +197,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
for (Map<String, Object> pcsDevice : pcsIds) {
PcsDetailInfoVo pcsDetailInfoVo = new PcsDetailInfoVo();
pcsDetailInfoVo.setDeviceName(pcsDevice.get("deviceName").toString());
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus").toString());
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus") == null ?
"" :pcsDevice.get("communicationStatus").toString());
// 从redis取pcs单个详细数据
String pcsId = pcsDevice.get("id").toString();
EmsPcsData pcsData = redisCache.getCacheObject(RedisKeyConstants.PCS +siteId+"_"+pcsId);
@ -395,7 +396,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
if (AMMETER_DEVICE_LOAD.equals(ammeterId)) {
AmmeterLoadDataVo ammeterLoadDataVo = new AmmeterLoadDataVo();
ammeterLoadDataVo.setDeviceName(ammeterDevice.get("deviceName").toString());
ammeterLoadDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus").toString());
ammeterLoadDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus") == null? "" :
ammeterDevice.get("communicationStatus").toString());
// 处理总表数据
dealAmmeterLoadData(ammeterData,ammeterLoadDataVo);
ammeterResponse.setAmmeterLoadDataVoList(ammeterLoadDataVo);

View File

@ -17,10 +17,11 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="templateId" column="template_id" />
</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 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 from ems_strategy_curve
</sql>
<select id="selectEmsStrategyCurveList" parameterType="EmsStrategyCurve" resultMap="EmsStrategyCurveResult">
@ -32,6 +33,7 @@
<if test="endDate != null "> and end_date = #{endDate}</if>
<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>
</where>
</select>
@ -54,6 +56,7 @@
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if>
<if test="templateId != null">template_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="strategyId != null">#{strategyId},</if>
@ -67,6 +70,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if>
<if test="templateId != null">#{templateId},</if>
</trim>
</insert>
@ -84,6 +88,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="siteId != null">site_id = #{siteId},</if>
<if test="templateId != null">template_id = #{templateId},</if>
</trim>
where id = #{id}
</update>
@ -98,4 +103,10 @@
#{id}
</foreach>
</delete>
<select id="getTemplateCurve" parameterType="String" resultMap="EmsStrategyCurveResult">
<include refid="selectEmsStrategyCurveVo"/>
<where> template_id = #{templateId}
</where>
</select>
</mapper>