策略曲线图修改
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;
|
||||
|
||||
Reference in New Issue
Block a user