Commit 381789aa authored by duanruiming's avatar duanruiming

[update] test

parent cbf114b0
...@@ -4,6 +4,7 @@ import io.swagger.annotations.Api; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO; import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.vo.GreenwaveListVO; import net.wanji.databus.vo.GreenwaveListVO;
...@@ -31,6 +32,7 @@ import java.util.List; ...@@ -31,6 +32,7 @@ import java.util.List;
@Api(value = "TrendController", description = "态势监测") @Api(value = "TrendController", description = "态势监测")
@RequestMapping("/trend") @RequestMapping("/trend")
@RestController @RestController
@Slf4j
public class TrendController { public class TrendController {
private final TrendServiceImpl trendService; private final TrendServiceImpl trendService;
...@@ -286,7 +288,10 @@ public class TrendController { ...@@ -286,7 +288,10 @@ public class TrendController {
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.CycleDataElement.class), @ApiResponse(code = 200, message = "OK", response = TableQueryVO.CycleDataElement.class),
}) })
public JsonViewObject laneTrafficIndex(@RequestBody CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception { public JsonViewObject laneTrafficIndex(@RequestBody CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception {
long l = System.currentTimeMillis();
List<TableQueryVO.CycleDataElement> result = trendService.laneTrafficIndex(crossIdDateTimeVO); List<TableQueryVO.CycleDataElement> result = trendService.laneTrafficIndex(crossIdDateTimeVO);
long l1 = System.currentTimeMillis();
log.error("接口调用时间== " + (l1 - l)/1000);
return JsonViewObject.newInstance().success(result); return JsonViewObject.newInstance().success(result);
} }
......
...@@ -40,6 +40,7 @@ import net.wanji.opt.service.TrendService; ...@@ -40,6 +40,7 @@ import net.wanji.opt.service.TrendService;
import net.wanji.opt.service.es.LaneSnapshotDataQueryService; import net.wanji.opt.service.es.LaneSnapshotDataQueryService;
import net.wanji.opt.vo.*; import net.wanji.opt.vo.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -1972,8 +1973,32 @@ public class TrendServiceImpl implements TrendService { ...@@ -1972,8 +1973,32 @@ public class TrendServiceImpl implements TrendService {
int start = (int) (crossIdDateTimeVO.getStart().getTime() / 1000); int start = (int) (crossIdDateTimeVO.getStart().getTime() / 1000);
int end = (int) (crossIdDateTimeVO.getEnd().getTime() / 1000); int end = (int) (crossIdDateTimeVO.getEnd().getTime() / 1000);
LambdaQueryWrapper<CrossBaseLaneInfoPO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CrossBaseLaneInfoPO::getCrossId, crossId);
List<CrossBaseLaneInfoPO> crossBaseLaneInfoPOS = crossBaseLaneInfoMapper.selectList(queryWrapper);
// 查询周期数据 // 查询周期数据
List<CrossLaneDataHistPOExt> poExtList = crossLaneDataHistMapper.selectByCrossIdAndTimeSpan(crossId, start, end); LambdaQueryWrapper<CrossLaneDataHistPO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CrossLaneDataHistPO::getCrossId, crossId);
wrapper.between(CrossLaneDataHistPO::getBatchTime, start, end);
long l = System.currentTimeMillis();
List<CrossLaneDataHistPO> crossLaneDataHistPOS = crossLaneDataHistMapper.selectList(wrapper);
List<CrossLaneDataHistPOExt> poExtList = new ArrayList<>(crossLaneDataHistPOS.size());
if (!CollectionUtils.isEmpty(crossLaneDataHistPOS) && !CollectionUtils.isEmpty(crossBaseLaneInfoPOS)) {
for (CrossLaneDataHistPO po : crossLaneDataHistPOS) {
CrossLaneDataHistPOExt crossLaneDataHistPOExt = new CrossLaneDataHistPOExt();
BeanUtils.copyProperties(po, crossLaneDataHistPOExt);
for (CrossBaseLaneInfoPO laneInfoPO : crossBaseLaneInfoPOS) {
if (StringUtils.equalsIgnoreCase(po.getCrossId(), laneInfoPO.getCrossId())) {
crossLaneDataHistPOExt.setDir(laneInfoPO.getDir());
crossLaneDataHistPOExt.setTurn(laneInfoPO.getTurn());
crossLaneDataHistPOExt.setSort(laneInfoPO.getSort());
poExtList.add(crossLaneDataHistPOExt);
}
}
}
}
long l1 = System.currentTimeMillis();
log.error("实体复制需要时间:", ((l1 - l) / 1000));
return buildCycleData(crossId, poExtList); return buildCycleData(crossId, poExtList);
} catch (Exception e) { } catch (Exception e) {
log.error("车道数据查询异常:", e); log.error("车道数据查询异常:", e);
......
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