Commit cc9a27da authored by duanruiming's avatar duanruiming

[add] 绿波图查询

parent 6d289a9a
...@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.StringUtils; import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.vo.LightsStatusVO2; import net.wanji.databus.vo.LightsStatusVO2;
import net.wanji.opt.dto.GreenBeltChartDTO;
import net.wanji.opt.servicev2.TrendServiceV2; import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.vo2.*; import net.wanji.opt.vo2.*;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -288,4 +289,23 @@ public class TrendControllerV2 { ...@@ -288,4 +289,23 @@ public class TrendControllerV2 {
} }
return JsonViewObject.newInstance().success(lightsStatusVO2); return JsonViewObject.newInstance().success(lightsStatusVO2);
} }
@ApiOperation(value = "态势监测-绿波时序图", notes = "态势监测-绿波时序图",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/green4SchemeChart")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject green4SchemeChart(Integer greenId, String date) throws Exception {
GreenBeltChartDTO result = new GreenBeltChartDTO();
try {
result = trendServiceV2.green4SchemeChart(greenId, date);
} catch (Exception e) {
log.error("态势监测-绿波时序图:", e);
JsonViewObject.newInstance().success(result, "");
}
return JsonViewObject.newInstance().success(result, "");
}
} }
\ No newline at end of file
...@@ -30,9 +30,9 @@ public class GreenChartSchemeHist { ...@@ -30,9 +30,9 @@ public class GreenChartSchemeHist {
private String schemeDetail; private String schemeDetail;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField("gmt_create") @TableField("create_time")
private Date gmtCreate; private Date createTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@TableField("gmt_modified") @TableField("modify_time")
private Date gmtModified; private Date modifyTime;
} }
...@@ -2,6 +2,7 @@ package net.wanji.opt.servicev2; ...@@ -2,6 +2,7 @@ package net.wanji.opt.servicev2;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import net.wanji.databus.vo.LightsStatusVO2; import net.wanji.databus.vo.LightsStatusVO2;
import net.wanji.opt.dto.GreenBeltChartDTO;
import net.wanji.opt.vo2.*; import net.wanji.opt.vo2.*;
import java.util.List; import java.util.List;
...@@ -36,4 +37,5 @@ public interface TrendServiceV2 { ...@@ -36,4 +37,5 @@ public interface TrendServiceV2 {
LightsStatusVO2 selectLightStatusHist(String id, String date) throws Exception; LightsStatusVO2 selectLightStatusHist(String id, String date) throws Exception;
GreenBeltChartDTO green4SchemeChart(Integer id, String date) throws Exception;
} }
\ No newline at end of file
package net.wanji.opt.servicev2.implv2; package net.wanji.opt.servicev2.implv2;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -28,6 +29,8 @@ import net.wanji.opt.common.RedisUtils; ...@@ -28,6 +29,8 @@ import net.wanji.opt.common.RedisUtils;
import net.wanji.opt.common.enums.EventInfoTypeEnum; import net.wanji.opt.common.enums.EventInfoTypeEnum;
import net.wanji.opt.common.enums.GreenBeltDirEnum; import net.wanji.opt.common.enums.GreenBeltDirEnum;
import net.wanji.opt.dao.mapper.*; import net.wanji.opt.dao.mapper.*;
import net.wanji.opt.dto.GreenBeltChartDTO;
import net.wanji.opt.entity.GreenChartSchemeHist;
import net.wanji.opt.po.StrategyGreenOptHistEntity; import net.wanji.opt.po.StrategyGreenOptHistEntity;
import net.wanji.opt.servicev2.TrendServiceV2; import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity; import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
...@@ -81,6 +84,8 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -81,6 +84,8 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
private UtcFeignClients utcFeignClients; private UtcFeignClients utcFeignClients;
@Resource @Resource
private StrategyFactoryMapper strategyFactoryMapper; private StrategyFactoryMapper strategyFactoryMapper;
@Resource
private GreenChartSchemeHistMapper greenChartSchemeHistMapper;
private static List<OptMonitoringVO> greenListCache = new ArrayList<>(10); private static List<OptMonitoringVO> greenListCache = new ArrayList<>(10);
private static List<OptMonitoringVO> crossListCache = new ArrayList<>(80); private static List<OptMonitoringVO> crossListCache = new ArrayList<>(80);
...@@ -616,4 +621,26 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -616,4 +621,26 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
return null; return null;
} }
@Override
public GreenBeltChartDTO green4SchemeChart(Integer id, String date) throws Exception {
try {
GreenBeltChartDTO greenBeltChartDTO = new GreenBeltChartDTO();
LambdaQueryWrapper<GreenChartSchemeHist> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GreenChartSchemeHist::getGreenId, id);
queryWrapper.le(GreenChartSchemeHist::getCreateTime, date);
queryWrapper.orderByDesc(GreenChartSchemeHist::getCreateTime);
queryWrapper.last("limit 1");
List<GreenChartSchemeHist> greenChartSchemeHists = greenChartSchemeHistMapper.selectList(queryWrapper);
if (!CollectionUtils.isEmpty(greenChartSchemeHists)) {
for (GreenChartSchemeHist greenChartSchemeHist : greenChartSchemeHists) {
greenBeltChartDTO = JacksonUtils.getInstance().readValue(greenChartSchemeHist.getGreenChart(), GreenBeltChartDTO.class);
}
}
return greenBeltChartDTO;
} catch (Exception e) {
log.error("态势监测-绿波时序图查询异常:{}", e);
throw new RuntimeException(e);
}
}
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ import java.util.stream.Collectors; ...@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
* @date 2025/04/01 11:18 * @date 2025/04/01 11:18
* @description 海信通过reids缓存方案相位信息,设置绿波时序图 * @description 海信通过reids缓存方案相位信息,设置绿波时序图
*/ */
@Component //@Component
@Slf4j @Slf4j
@Profile("test") @Profile("test")
public class HisenseGreenChartTask { public class HisenseGreenChartTask {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment