|
@@ -1,5 +1,7 @@
|
|
|
package com.fdkankan.agent.service.impl;
|
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.agent.common.PageInfo;
|
|
@@ -7,14 +9,18 @@ import com.fdkankan.agent.common.util.IncrementUtil;
|
|
|
import com.fdkankan.agent.entity.*;
|
|
|
import com.fdkankan.agent.mapper.ICameraMapper;
|
|
|
import com.fdkankan.agent.request.CameraParam;
|
|
|
-import com.fdkankan.agent.response.CameraDetailVo;
|
|
|
-import com.fdkankan.agent.response.CameraTimeVo;
|
|
|
+import com.fdkankan.agent.request.LogListParam;
|
|
|
+import com.fdkankan.agent.response.*;
|
|
|
import com.fdkankan.agent.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.security.interfaces.ECKey;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
@@ -43,10 +49,13 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
|
ICameraDetailService cameraDetailService;
|
|
|
@Autowired
|
|
|
IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ IExcelService excelService;
|
|
|
+ static CameraParam CameraParam = new CameraParam();
|
|
|
|
|
|
@Override
|
|
|
- public Object pageList(CameraParam param) {
|
|
|
-
|
|
|
+ public PageInfo<CameraDetailVo> pageList(CameraParam param) {
|
|
|
+ CameraParam = param;
|
|
|
List<CameraDetail> details = cameraDetailService.getListByAgentId(param.getAgentId());
|
|
|
List<Long> cameraIds = details.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
|
|
|
|
|
@@ -132,4 +141,33 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
|
public Camera getBySnCodeAndAgentId(String snCode,Integer agentId) {
|
|
|
return this.getBaseMapper().getBySnCodeAndAgentId(snCode,agentId);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void export(HttpServletRequest req, HttpServletResponse resp, String lang) {
|
|
|
+ CameraParam.setPageSize(100000);
|
|
|
+ List<CameraDetailVo> list = (List<CameraDetailVo>) this.pageList(CameraParam).getList();
|
|
|
+ ExcelWriter excelWriter = null;
|
|
|
+ try {
|
|
|
+ if("en".equals(lang)){
|
|
|
+ List<CameraDetailEnVo> listen = new ArrayList<>();
|
|
|
+ for (CameraDetailVo listVo : list) {
|
|
|
+ CameraDetailEnVo en = new CameraDetailEnVo();
|
|
|
+ BeanUtils.copyProperties(listVo,en);
|
|
|
+ listen.add(en);
|
|
|
+ }
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(), CameraDetailEnVo.class).build();
|
|
|
+ excelService.commonExport(req,resp,"equipment management",listen,excelWriter);
|
|
|
+ }else {
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(), CameraDetailVo.class).build();
|
|
|
+ excelService.commonExport(req,resp,"设备管理",list,excelWriter);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if(excelWriter != null){
|
|
|
+ excelWriter.finish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|