|
|
@ -5,7 +5,9 @@ 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.bean.ServiceBody;
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceStatus;
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceStatus;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.excel.PhotoStatExcel;
|
|
|
|
import com.shxy.xymanager_common.model.*;
|
|
|
|
import com.shxy.xymanager_common.model.*;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.util.DateUtil;
|
|
|
|
import com.shxy.xymanager_common.util.EasyExcelUtil;
|
|
|
|
import com.shxy.xymanager_common.util.EasyExcelUtil;
|
|
|
|
import com.shxy.xymanager_common.util.xinyin.HeaderUtil;
|
|
|
|
import com.shxy.xymanager_common.util.xinyin.HeaderUtil;
|
|
|
|
import com.shxy.xymanager_common.vo.*;
|
|
|
|
import com.shxy.xymanager_common.vo.*;
|
|
|
@ -24,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -154,25 +157,26 @@ public class TerminalPhotoController extends BaseController {
|
|
|
|
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp, vo);
|
|
|
|
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp, vo);
|
|
|
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
|
|
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
|
|
|
TerminalPhotoSelectListModel model = serviceBody.getData();
|
|
|
|
TerminalPhotoSelectListModel model = serviceBody.getData();
|
|
|
|
List<StatTerm> result = this.buildPhotoStat(model.getList());
|
|
|
|
List<String> hourList = DateUtil.getEachHour(vo.getStarttime(), vo.getEndtime());
|
|
|
|
|
|
|
|
List<StatTerm> result = this.buildPhotoStat(model.getList(), hourList);
|
|
|
|
return ResponseReult.success(result);
|
|
|
|
return ResponseReult.success(result);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
|
|
|
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<StatTerm> buildPhotoStat(List<TerminalPhotoSelectListModel.PhotoBean> list) {
|
|
|
|
private List<StatTerm> buildPhotoStat(List<TerminalPhotoSelectListModel.PhotoBean> list, List<String> hourList) {
|
|
|
|
List<StatTerm> result = new ArrayList<>();
|
|
|
|
List<StatTerm> result = new ArrayList<>();
|
|
|
|
if (list != null) {
|
|
|
|
if (list != null) {
|
|
|
|
for (TerminalPhotoSelectListModel.PhotoBean photo : list) {
|
|
|
|
for (TerminalPhotoSelectListModel.PhotoBean photo : list) {
|
|
|
|
StatTerm term = this.findStatTerm(result, photo);
|
|
|
|
StatTerm term = this.findStatTerm(result, photo, hourList);
|
|
|
|
term.addPhoto(photo);
|
|
|
|
term.addPhoto(photo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private StatTerm findStatTerm(List<StatTerm> list, TerminalPhotoSelectListModel.PhotoBean photo) {
|
|
|
|
private StatTerm findStatTerm(List<StatTerm> list, TerminalPhotoSelectListModel.PhotoBean photo, List<String> hourList) {
|
|
|
|
StatTerm the = null;
|
|
|
|
StatTerm the = null;
|
|
|
|
for (StatTerm item : list) {
|
|
|
|
for (StatTerm item : list) {
|
|
|
|
if (item.getTermId() == photo.getTermid()) {
|
|
|
|
if (item.getTermId() == photo.getTermid()) {
|
|
|
@ -182,6 +186,7 @@ public class TerminalPhotoController extends BaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (the == null) {
|
|
|
|
if (the == null) {
|
|
|
|
the = new StatTerm();
|
|
|
|
the = new StatTerm();
|
|
|
|
|
|
|
|
the.setHourList(hourList);
|
|
|
|
the.setTermId(photo.getTermid());
|
|
|
|
the.setTermId(photo.getTermid());
|
|
|
|
the.setCmdid(photo.getCmdid());
|
|
|
|
the.setCmdid(photo.getCmdid());
|
|
|
|
list.add(the);
|
|
|
|
list.add(the);
|
|
|
@ -201,7 +206,8 @@ public class TerminalPhotoController extends BaseController {
|
|
|
|
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp, vo);
|
|
|
|
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp, vo);
|
|
|
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
|
|
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
|
|
|
TerminalPhotoSelectListModel model = serviceBody.getData();
|
|
|
|
TerminalPhotoSelectListModel model = serviceBody.getData();
|
|
|
|
List<StatTerm> result = this.buildPhotoStat(model.getList());
|
|
|
|
List<String> hourList = DateUtil.getEachHour(vo.getStarttime(), vo.getEndtime());
|
|
|
|
|
|
|
|
List<StatTerm> result = this.buildPhotoStat(model.getList(), hourList);
|
|
|
|
|
|
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
@ -211,6 +217,81 @@ public class TerminalPhotoController extends BaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "图片统计导出合计", notes = "图片统计导出合计接口", httpMethod = "POST")
|
|
|
|
|
|
|
|
@RequestMapping("/exportPhotoStatSum")
|
|
|
|
|
|
|
|
@Log(title = "图片统计导出合计", type = "导出")
|
|
|
|
|
|
|
|
public void exportPhotoStatSum(@RequestHeader HttpHeaders headers,
|
|
|
|
|
|
|
|
@RequestBody @Validated TerminalPhotoSelectVo vo,
|
|
|
|
|
|
|
|
HttpServletResponse response) throws Exception {
|
|
|
|
|
|
|
|
String requestIp = HeaderUtil.getRequestIp(headers);
|
|
|
|
|
|
|
|
vo.setPageindex(1);
|
|
|
|
|
|
|
|
vo.setPagesize(100000);
|
|
|
|
|
|
|
|
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp, vo);
|
|
|
|
|
|
|
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
|
|
|
|
|
|
|
TerminalPhotoSelectListModel model = serviceBody.getData();
|
|
|
|
|
|
|
|
List<String> hourList = DateUtil.getEachHour(vo.getStarttime(), vo.getEndtime());
|
|
|
|
|
|
|
|
List<StatTerm> list = this.buildPhotoStat(model.getList(), hourList);
|
|
|
|
|
|
|
|
List<PhotoStatExcel> result = this.buildPhotoStatExcel(list);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EasyExcelUtil.createExcel(response, "图片统计合计", result, PhotoStatExcel.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<PhotoStatExcel> buildPhotoStatExcel(List<StatTerm> list) {
|
|
|
|
|
|
|
|
List<PhotoStatExcel> result = new ArrayList<>();
|
|
|
|
|
|
|
|
for (StatTerm term : list) {
|
|
|
|
|
|
|
|
PhotoStatExcel item = new PhotoStatExcel();
|
|
|
|
|
|
|
|
item.setCmdid(term.getCmdid());
|
|
|
|
|
|
|
|
item.setTotal(term.getTotal());
|
|
|
|
|
|
|
|
result.add(item);
|
|
|
|
|
|
|
|
if (term.getWrongCount() > 0) {
|
|
|
|
|
|
|
|
item.setStatus("有异常");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
item.setStatus("正常");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (StatChannel channel : term.getChannels()) {
|
|
|
|
|
|
|
|
PhotoStatExcel item2 = new PhotoStatExcel();
|
|
|
|
|
|
|
|
item2.setChannelId(channel.getChannelId());
|
|
|
|
|
|
|
|
item2.setTotal(channel.getTotal());
|
|
|
|
|
|
|
|
result.add(item2);
|
|
|
|
|
|
|
|
if (channel.getWrongCount() > 0) {
|
|
|
|
|
|
|
|
item2.setStatus("有异常");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
item2.setStatus("正常");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (StatPreset preset : channel.getPresets()) {
|
|
|
|
|
|
|
|
PhotoStatExcel item3 = new PhotoStatExcel();
|
|
|
|
|
|
|
|
item3.setChannelId(channel.getChannelId());
|
|
|
|
|
|
|
|
item3.setPresetId(preset.getPresetId());
|
|
|
|
|
|
|
|
item3.setTotal(preset.getTotal());
|
|
|
|
|
|
|
|
result.add(item3);
|
|
|
|
|
|
|
|
if (preset.getWrongCount() > 0) {
|
|
|
|
|
|
|
|
item3.setStatus("有异常");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
item3.setStatus("正常");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (StatHour hour : preset.getHours()) {
|
|
|
|
|
|
|
|
if (hour.isWrong()) {
|
|
|
|
|
|
|
|
PhotoStatExcel err = new PhotoStatExcel();
|
|
|
|
|
|
|
|
err.setChannelId(channel.getChannelId());
|
|
|
|
|
|
|
|
err.setPresetId(preset.getPresetId());
|
|
|
|
|
|
|
|
err.setHour(hour.getHour());
|
|
|
|
|
|
|
|
List<String> dateList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Date date : hour.getTimeList()) {
|
|
|
|
|
|
|
|
dateList.add(DateUtil.format(date));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err.setTotal(dateList.size());
|
|
|
|
|
|
|
|
err.setStatus(hour.getWrongDetail());
|
|
|
|
|
|
|
|
err.setDetail(String.join(System.lineSeparator(), dateList));
|
|
|
|
|
|
|
|
result.add(err);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "图片轮询", notes = "图片轮询接口", httpMethod = "POST")
|
|
|
|
@ApiOperation(value = "图片轮询", notes = "图片轮询接口", httpMethod = "POST")
|
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
|
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
|
|
|
|