|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
package com.shxy.xymanager_service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalPhoto;
|
|
|
|
|
import com.shxy.xymanager_common.exception.Asserts;
|
|
|
|
|
import com.shxy.xymanager_common.model.TerminalPhotoListModel;
|
|
|
|
|
import com.shxy.xymanager_common.util.MyDateUtils;
|
|
|
|
|
import com.shxy.xymanager_common.vo.TerminalAndChannelIdAndTimeVo;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
|
|
|
|
|
import com.shxy.xymanager_service.service.TerminalPhotoService;
|
|
|
|
@ -14,7 +14,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -36,13 +38,35 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotoListModel> getTerminalPhotoList(TerminalAndChannelIdAndTimeVo vo) {
|
|
|
|
|
TerminalPhotoListModel model = new TerminalPhotoListModel();
|
|
|
|
|
List<TerminalPhoto> list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), vo.getChannelid(),vo.getTime());
|
|
|
|
|
Date time = vo.getTime();
|
|
|
|
|
DateTime begindateTime = MyDateUtils.beginOfDay(time);
|
|
|
|
|
DateTime enddateTime = MyDateUtils.endOfDay(time);
|
|
|
|
|
BigInteger start = MyDateUtils.TimeMillSecond2Second(begindateTime);
|
|
|
|
|
BigInteger end = MyDateUtils.TimeMillSecond2Second(enddateTime);
|
|
|
|
|
List<TerminalPhoto> list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), vo.getChannelid(), start, end);
|
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list);
|
|
|
|
|
model.setTime(vo.getTime());
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
List<TerminalPhotoListModel.PhotoBean> beans = BeanUtil.copyToList(list, TerminalPhotoListModel.PhotoBean.class, CopyOptions.create().ignoreCase());
|
|
|
|
|
List<TerminalPhotoListModel.PhotoBean> beans = new ArrayList<>();
|
|
|
|
|
for (TerminalPhoto item : list) {
|
|
|
|
|
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
|
|
|
|
|
photoBean.setChannelId(item.getChannelId());
|
|
|
|
|
photoBean.setFileSize(item.getFileSize());
|
|
|
|
|
photoBean.setHeight(item.getHeight());
|
|
|
|
|
photoBean.setManualRequest(item.getManualRequest());
|
|
|
|
|
photoBean.setPath("http://47.96.238.157/image/"+item.getPath());
|
|
|
|
|
photoBean.setId(item.getId());
|
|
|
|
|
photoBean.setTermId(item.getTermId());
|
|
|
|
|
photoBean.setWidth(item.getWidth());
|
|
|
|
|
photoBean.setPresetId(item.getPresetId());
|
|
|
|
|
BigInteger phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
|
|
|
|
|
photoBean.setPhotoTime(MyDateUtils.date(phototime.longValue()));
|
|
|
|
|
BigInteger rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
|
|
|
|
|
photoBean.setPhotoTime(MyDateUtils.date(rectime.longValue()));
|
|
|
|
|
beans.add(photoBean);
|
|
|
|
|
}
|
|
|
|
|
model.setList(beans);
|
|
|
|
|
}
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|