|
|
|
@ -4,11 +4,15 @@ import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.shxy.xymanager_common.annotation.Log;
|
|
|
|
|
import com.shxy.xymanager_common.base.BaseController;
|
|
|
|
|
import com.shxy.xymanager_common.base.ResponseReult;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceStatus;
|
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
|
import com.shxy.xymanager_common.excel.TerminalExcel;
|
|
|
|
|
import com.shxy.xymanager_common.exception.ApiException;
|
|
|
|
|
import com.shxy.xymanager_common.model.*;
|
|
|
|
|
import com.shxy.xymanager_common.util.EasyExcelUtil;
|
|
|
|
|
import com.shxy.xymanager_common.util.xinyin.HeaderUtil;
|
|
|
|
|
import com.shxy.xymanager_common.vo.TerminalPhotoSelectVo;
|
|
|
|
|
import com.shxy.xymanager_common.vo.TerminalSelectVo;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalPositionsMapper;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
|
|
|
|
@ -16,6 +20,7 @@ import com.shxy.xymanager_service.service.*;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@ -53,6 +58,8 @@ public class TerminalExtController extends BaseController {
|
|
|
|
|
TerminalExtService terminalExtService;
|
|
|
|
|
@Resource
|
|
|
|
|
TerminalSimcardService simcardService;
|
|
|
|
|
@Resource
|
|
|
|
|
CameraScheduleService cameraScheduleService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("importTerminal")
|
|
|
|
@ -312,4 +319,76 @@ public class TerminalExtController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
return ResponseReult.success("OK");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "图片覆冰天气的按时间表统计", notes = "图片覆冰天气的按时间表统计接口", httpMethod = "POST")
|
|
|
|
|
@RequestMapping("/getScheduleStat")
|
|
|
|
|
@Log(title = "图片覆冰天气的按时间表统计", type = "统计")
|
|
|
|
|
public ResponseReult<List<StatTerm>> getScheduleStat(@RequestHeader HttpHeaders headers, @RequestBody @Validated TerminalPhotoSelectVo vo) throws Exception {
|
|
|
|
|
String requestIp = HeaderUtil.getRequestIp(headers);
|
|
|
|
|
vo.setPageindex(1);
|
|
|
|
|
vo.setPagesize(100000);
|
|
|
|
|
if (vo.getInterval() == null) {
|
|
|
|
|
vo.setInterval(10);
|
|
|
|
|
}
|
|
|
|
|
List<StatTerm> termList = new ArrayList<>();
|
|
|
|
|
ServiceBody<TerminalPhotoSelectListModel> serviceBody = photoService.getPhotoList(requestIp, vo, termList);
|
|
|
|
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
|
|
|
|
TerminalPhotoSelectListModel model = serviceBody.getData();
|
|
|
|
|
this.buildPhotoStat(termList, model.getList(), vo);
|
|
|
|
|
|
|
|
|
|
List<Integer> idList = new ArrayList<>();
|
|
|
|
|
for (StatTerm st : termList) {
|
|
|
|
|
idList.add(st.getTermId());
|
|
|
|
|
}
|
|
|
|
|
PageInfo<Weathers> weatherPage = weatherService.list(null, null, idList,
|
|
|
|
|
vo.getStarttime().getTime() / 1000, vo.getEndtime().getTime() / 1000, 1, 100000);
|
|
|
|
|
if (!CollectionUtils.isEmpty(weatherPage.getList())) {
|
|
|
|
|
for (Weathers weather : weatherPage.getList()) {
|
|
|
|
|
StatTerm term = this.findStatTerm(termList, weather.getTermId(), weather.getCmdid());
|
|
|
|
|
term.addWeather(weather);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PageInfo<LeadPulls> pullPage = leadPullsService.list(null, null, idList,
|
|
|
|
|
vo.getStarttime().getTime() / 1000, vo.getEndtime().getTime() / 1000, 1, 100000);
|
|
|
|
|
if (!CollectionUtils.isEmpty(pullPage.getList())) {
|
|
|
|
|
for (LeadPulls pull : pullPage.getList()) {
|
|
|
|
|
StatTerm term = this.findStatTerm(termList, pull.getTermId(), pull.getCmdid());
|
|
|
|
|
term.addLeadPulls(pull);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResponseReult.success(termList);
|
|
|
|
|
} else {
|
|
|
|
|
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buildPhotoStat(List<StatTerm> termList, List<TerminalPhotoSelectListModel.PhotoBean> list, TerminalPhotoSelectVo vo) throws Exception {
|
|
|
|
|
for (StatTerm statTerm : termList) {
|
|
|
|
|
List<CameraSchedule> scheduleList = cameraScheduleService.list(statTerm.getTermId());
|
|
|
|
|
statTerm.initScheduleList(scheduleList, vo.getStarttime().getTime(), vo.getEndtime().getTime(), vo.getInterval());
|
|
|
|
|
}
|
|
|
|
|
if (list != null) {
|
|
|
|
|
for (TerminalPhotoSelectListModel.PhotoBean photo : list) {
|
|
|
|
|
StatTerm term = this.findStatTerm(termList, photo.getTermid(), photo.getCmdid());
|
|
|
|
|
term.addPhoto(photo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private StatTerm findStatTerm(List<StatTerm> list, Integer termId, String cmdid) {
|
|
|
|
|
StatTerm the = null;
|
|
|
|
|
for (StatTerm item : list) {
|
|
|
|
|
if (item.getTermId() == termId) {
|
|
|
|
|
the = item;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (the == null) {
|
|
|
|
|
the = new StatTerm();
|
|
|
|
|
the.setTermId(termId);
|
|
|
|
|
the.setCmdid(cmdid);
|
|
|
|
|
list.add(the);
|
|
|
|
|
}
|
|
|
|
|
return the;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|