feat: 增加查询附带全部额外信息

dev
huangfeng 1 year ago
parent e7b92c9d64
commit 89277e21a9

@ -2,13 +2,13 @@ package com.shxy.xymanager_admin.controller;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.LeadPulls;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.entity.Weathers;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.model.PhotoDayModel;
import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.page.TableDataInfo;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_dao.dao.TerminalPositionsDao;
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
import com.shxy.xymanager_service.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -39,7 +39,37 @@ public class TerminalExtController extends BaseController {
LeadPullsService leadPullsService;
@Resource
TerminalPhotoService photoService;
@Resource
TerminalStatusDao terminalStatusDao;
@Resource
TerminalPositionsDao terminalPositionsDao;
@GetMapping("listWithAll")
@ApiOperation("查询附带全部额外信息")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> listWithAll(Integer dyId, Integer lineId, Integer towerId, String search,
Long start, Long end,
Integer channelId,
Integer pageNum, Integer pageSize) {
pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = this.getTerminalPage(dyId, lineId, towerId, search,
pageNum, pageSize);
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminal : result.getList()) {
TerminalGpsModel last = gpsService.getTermLastGPSPosition(terminal.getId())
.getData();
terminal.setLastGps(last);
PhotoDayModel photoInfo = photoService.getDayModel(terminal.getId(), channelId, start, end);
terminal.setPhotoInfo(photoInfo);
TerminalStatus status = terminalStatusDao.selectByPrimaryKey(terminal.getId());
terminal.setWorkingStatus(status);
TerminalPositions positions = terminalPositionsDao.selectByPrimaryKey(terminal.getId());
terminal.setPositions(positions);
}
}
return ResponseReult.success(result);
}
@GetMapping("listWithGPS")
@ApiOperation("查询附带定位")

@ -124,4 +124,6 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
private LeadPulls lastLeadPulls;
private TerminalGpsModel lastGps;
private PhotoDayModel photoInfo;
private TerminalStatus workingStatus;
private TerminalPositions positions;
}

@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.PermissionDetail;
import com.shxy.xymanager_common.bean.ServiceBody;
@ -799,19 +800,29 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
TerminalPhotoExample example = new TerminalPhotoExample();
TerminalPhotoExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(termid);
criteria.andPhotoTimeBetween(start, end);
if (start != null) {
criteria.andPhotoTimeGreaterThanOrEqualTo(start);
}
if (end != null) {
criteria.andPhotoTimeLessThan(end);
}
if (channelId != null) {
criteria.andChannelIdEqualTo(channelId);
}
example.setOrderByClause("photo_time desc");
List<TerminalPhoto> list = terminalPhotoDao.selectByExample(example);
long count = terminalPhotoDao.countByExample(example);
PhotoDayModel result = new PhotoDayModel();
if (!CollectionUtils.isEmpty(list)) {
int count = list.size();
result.setPhotoCount(count);
if (count > 0) {
example.setOrderByClause("photo_time desc");
PageHelper.startPage(1, 1);
List<TerminalPhoto> list = terminalPhotoDao.selectByExample(example);
result.setLastRecvTime(list.get(0).getRecvTime().longValue());
result.setFirstPhotoTime(list.get(count - 1).getPhotoTime().longValue());
example.setOrderByClause("photo_time asc");
PageHelper.startPage(1, 1);
list = terminalPhotoDao.selectByExample(example);
result.setFirstPhotoTime(list.get(0).getPhotoTime().longValue());
}
return result;
}

Loading…
Cancel
Save