feat: 增加查询覆冰最新的

dev
huangfeng 1 year ago
parent 1bae3099b6
commit 86f5235de7

@ -4,10 +4,15 @@ import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.base.BaseController; import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.LeadPulls; import com.shxy.xymanager_common.entity.LeadPulls;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.page.TableDataInfo;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_service.service.LeadPullsService; import com.shxy.xymanager_service.service.LeadPullsService;
import com.shxy.xymanager_service.service.TerminalService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -22,6 +27,8 @@ public class LeadPullsController extends BaseController {
@Resource @Resource
LeadPullsService service; LeadPullsService service;
@Resource
TerminalService terminalService;
@GetMapping("list") @GetMapping("list")
@ApiOperation("查询列表") @ApiOperation("查询列表")
@ -33,4 +40,24 @@ public class LeadPullsController extends BaseController {
return ResponseReult.success(result); return ResponseReult.success(result);
} }
@GetMapping("latest")
@ApiOperation("查询最新的")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> latest(Integer dyId, Integer lineId, Integer towerId,
int pageNum, int pageSize) {
TerminalSelectVo vo = new TerminalSelectVo();
vo.setDyId(dyId);
vo.setLineId(lineId);
vo.setTowerId(towerId);
vo.setPageindex(pageNum);
vo.setPagesize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = terminalService.getTerminalList(vo).getData();
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminals : result.getList()) {
LeadPulls last = service.getLast(terminals.getId());
terminals.setLastLeadPulls(last);
}
}
return ResponseReult.success(result);
}
} }

@ -3,11 +3,16 @@ package com.shxy.xymanager_admin.controller;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.base.BaseController; import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.entity.Weathers; import com.shxy.xymanager_common.entity.Weathers;
import com.shxy.xymanager_common.page.TableDataInfo;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_service.service.TerminalService;
import com.shxy.xymanager_service.service.WeatherService; import com.shxy.xymanager_service.service.WeatherService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -20,6 +25,8 @@ public class WeatherController extends BaseController {
@Resource @Resource
WeatherService service; WeatherService service;
@Resource
TerminalService terminalService;
@GetMapping("list") @GetMapping("list")
@ApiOperation("查询列表") @ApiOperation("查询列表")
@ -31,4 +38,24 @@ public class WeatherController extends BaseController {
return ResponseReult.success(result); return ResponseReult.success(result);
} }
@GetMapping("latest")
@ApiOperation("查询最新的")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> latest(Integer dyId, Integer lineId, Integer towerId,
int pageNum, int pageSize) {
TerminalSelectVo vo = new TerminalSelectVo();
vo.setDyId(dyId);
vo.setLineId(lineId);
vo.setTowerId(towerId);
vo.setPageindex(pageNum);
vo.setPagesize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = terminalService.getTerminalList(vo).getData();
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminals : result.getList()) {
Weathers last = service.getLast(terminals.getId());
terminals.setLastWeathers(last);
}
}
return ResponseReult.success(result);
}
} }

@ -111,4 +111,7 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
@ApiModelProperty(value = "通道编号和名称", example = "213") @ApiModelProperty(value = "通道编号和名称", example = "213")
private List<TerminalChannels> list; private List<TerminalChannels> list;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Weathers lastWeathers;
private LeadPulls lastLeadPulls;
} }

@ -11,6 +11,7 @@ import com.shxy.xymanager_service.service.LeadPullsService;
import com.shxy.xymanager_service.service.TerminalService; import com.shxy.xymanager_service.service.TerminalService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
@ -62,4 +63,19 @@ public class LeadPullsServiceImpl implements LeadPullsService {
return new PageInfo<>(list); return new PageInfo<>(list);
} }
@Override
public LeadPulls getLast(Integer termId) {
PageHelper.startPage(1, 1);
LeadPullsExample example = new LeadPullsExample();
LeadPullsExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(termId);
List<LeadPulls> list = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return null;
} else {
return list.get(0);
}
}
} }

@ -3,14 +3,13 @@ package com.shxy.xymanager_service.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.entity.Weathers;
import com.shxy.xymanager_common.entity.WeathersExample;
import com.shxy.xymanager_dao.dao.WeathersMapper; import com.shxy.xymanager_dao.dao.WeathersMapper;
import com.shxy.xymanager_service.service.TerminalService; import com.shxy.xymanager_service.service.TerminalService;
import com.shxy.xymanager_service.service.WeatherService; import com.shxy.xymanager_service.service.WeatherService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
@ -62,4 +61,19 @@ public class WeatherServiceImpl implements WeatherService {
return new PageInfo<>(list); return new PageInfo<>(list);
} }
@Override
public Weathers getLast(Integer termId) {
PageHelper.startPage(1, 1);
WeathersExample example = new WeathersExample();
WeathersExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(termId);
List<Weathers> list = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return null;
} else {
return list.get(0);
}
}
} }

@ -9,4 +9,6 @@ public interface LeadPullsService {
PageInfo<LeadPulls> list(Integer lineId, Integer towerId, Integer termId, PageInfo<LeadPulls> list(Integer lineId, Integer towerId, Integer termId,
Long start, Long end, Long start, Long end,
int pageNum, int pageSize); int pageNum, int pageSize);
LeadPulls getLast(Integer termId);
} }

@ -9,4 +9,6 @@ public interface WeatherService {
PageInfo<Weathers> list(Integer lineId, Integer towerId, Integer termId, PageInfo<Weathers> list(Integer lineId, Integer towerId, Integer termId,
Long start, Long end, Long start, Long end,
int pageNum, int pageSize); int pageNum, int pageSize);
Weathers getLast(Integer termId);
} }

Loading…
Cancel
Save