|
|
@@ -3,20 +3,17 @@ package com.xunmei.core.reportForms.resumption.service.impl;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
-import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan;
|
|
|
-import com.xunmei.common.core.domain.panel.vo.PanelListVo;
|
|
|
-import com.xunmei.common.core.enums.edu.EduTrainingPlanStatus;
|
|
|
+import com.xunmei.common.core.enums.OrgTypeEnum;
|
|
|
import com.xunmei.common.core.thread.ThreadPoolConfig;
|
|
|
+import com.xunmei.common.core.util.BeanHelper;
|
|
|
import com.xunmei.common.core.utils.DateHelper;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.edu.service.impl.ValueCellWriteHandler;
|
|
|
import com.xunmei.core.reportForms.monitor.mapper.MonitorAccessReportMapper;
|
|
|
-import com.xunmei.core.reportForms.monitor.vo.MonitoringAccessVO;
|
|
|
import com.xunmei.core.reportForms.resumption.dto.ResumptionDTO;
|
|
|
import com.xunmei.core.reportForms.resumption.mapper.ResumptionReportMapper;
|
|
|
import com.xunmei.core.reportForms.resumption.service.ResumptionReportService;
|
|
|
-import com.xunmei.core.reportForms.resumption.vo.IntrusionTestReportVO;
|
|
|
-import com.xunmei.core.reportForms.resumption.vo.ResumptionDayVO;
|
|
|
+import com.xunmei.core.reportForms.resumption.vo.*;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -34,10 +31,6 @@ import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.TimeoutException;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
-
|
|
|
-import static org.bouncycastle.asn1.x500.style.RFC4519Style.o;
|
|
|
|
|
|
/**
|
|
|
* @author :LuoWei
|
|
|
@@ -64,7 +57,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
//判断机构类型,如果机构类型大于行社,都展示行社数据
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
List<SysOrg> sysOrgs;
|
|
|
- if (null==sysOrg.getType()){
|
|
|
+ if (null == sysOrg.getType()) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
if (sysOrg.getType() < 3 || sysOrg.getShortName().endsWith("地区行社") || sysOrg.getType() == 9) {
|
|
|
@@ -149,10 +142,10 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
// resumptionDayVOS.add(resumptionDayVO);
|
|
|
// });
|
|
|
|
|
|
- List<CompletableFuture<ResumptionDayVO>> completableFutureList=new ArrayList<>();
|
|
|
+ List<CompletableFuture<ResumptionDayVO>> completableFutureList = new ArrayList<>();
|
|
|
sysOrgs.forEach(o -> {
|
|
|
CompletableFuture<ResumptionDayVO> getOneOrgResumptionDayVO = CompletableFuture.supplyAsync(() ->
|
|
|
- getOneOrgResumptionDayVO(o,resumptionDTO),threadPoolTaskExecutor
|
|
|
+ getOneOrgResumptionDayVO(o, resumptionDTO), threadPoolTaskExecutor
|
|
|
);
|
|
|
completableFutureList.add(getOneOrgResumptionDayVO);
|
|
|
});
|
|
|
@@ -161,23 +154,22 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
|
|
|
allQueries.get(10L, TimeUnit.SECONDS);
|
|
|
|
|
|
- completableFutureList.forEach(x->{
|
|
|
+ completableFutureList.forEach(x -> {
|
|
|
resumptionDayVOS.add(x.join());
|
|
|
});
|
|
|
return resumptionDayVOS;
|
|
|
}
|
|
|
|
|
|
- private ResumptionDayVO getOneOrgResumptionDayVO(SysOrg org,ResumptionDTO resumptionDTO)
|
|
|
- {
|
|
|
+ private ResumptionDayVO getOneOrgResumptionDayVO(SysOrg org, ResumptionDTO resumptionDTO) {
|
|
|
ResumptionDayVO resumptionDayVO = new ResumptionDayVO();
|
|
|
resumptionDayVO.setCity(org.getAffiliatedArea());
|
|
|
resumptionDayVO.setOrgName(org.getShortName());
|
|
|
- Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(org.getPath());
|
|
|
- ResumptionDayVO resumptionDayVO1 =null;
|
|
|
- ResumptionDayVO resumptionDayVO2 =null;
|
|
|
- ResumptionDayVO resumptionDayVO3 =null;
|
|
|
+ Integer integer = monitorAccessReportMapper.selectOrgNumByPathAndType(org.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
|
|
|
+ ResumptionDayVO resumptionDayVO1 = null;
|
|
|
+ ResumptionDayVO resumptionDayVO2 = null;
|
|
|
+ ResumptionDayVO resumptionDayVO3 = null;
|
|
|
|
|
|
- if(org.getType()!=4) {
|
|
|
+ if (org.getType() != 4) {
|
|
|
//营业前
|
|
|
resumptionDayVO1 = resumptionReportMapper.selectReport(resumptionDTO.getCycle(), 1, null, resumptionDTO.getSearchTime(), org.getPath());
|
|
|
//营业中
|
|
|
@@ -251,8 +243,8 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
ResumptionDayVO resumptionDayVO = report.get(i);
|
|
|
resumptionDayVO.setOrderNum(i + 1);
|
|
|
}
|
|
|
- String baseHeaderName="营业网点安全保卫履职情况表";
|
|
|
- String header=baseHeaderName+"(" + resumptionDTO.getSearchTime() + ")";
|
|
|
+ String baseHeaderName = "营业网点安全保卫履职情况表";
|
|
|
+ String header = baseHeaderName + "(" + resumptionDTO.getSearchTime() + ")";
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
@@ -282,11 +274,11 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
IntrusionTestReportVO intrusionTestReportVO = report.get(i);
|
|
|
intrusionTestReportVO.setOrderNum(i + 1);
|
|
|
}
|
|
|
- String baseHeaderName="报警测试情况表";
|
|
|
- String header=baseHeaderName+"(" + resumptionDTO.getSearchTime() + ")";
|
|
|
+ String baseHeaderName = "报警测试情况表";
|
|
|
+ String header = baseHeaderName + "(" + resumptionDTO.getSearchTime() + ")";
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
- String fileName = URLEncoder.encode("【" + orgName + "】-"+baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
+ String fileName = URLEncoder.encode("【" + orgName + "】-" + baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
// 调用EasyExcel的导出方法
|
|
|
EasyExcel.write(response.getOutputStream(), IntrusionTestReportVO.class)
|
|
|
@@ -302,7 +294,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
//判断机构类型,如果机构类型大于行社,都展示行社数据
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
List<SysOrg> sysOrgs;
|
|
|
- if (null==sysOrg.getType()){
|
|
|
+ if (null == sysOrg.getType()) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
if (sysOrg.getType() < 3 || sysOrg.getShortName().endsWith("地区行社") || sysOrg.getType() == 9) {
|
|
|
@@ -325,7 +317,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
}
|
|
|
}
|
|
|
IntrusionTestReportVO intrusionTestReportVO1 = resumptionReportMapper.selectIntrusionTestReport(null, resumptionDTO.getSearchTime(), o.getPath());
|
|
|
- Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(o.getPath());
|
|
|
+ Integer integer = monitorAccessReportMapper.selectOrgNumByPathAndType(o.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
|
|
|
//隐患
|
|
|
Map map = resumptionReportMapper.selectIntrusionTestAbnormalNumber(null, resumptionDTO.getSearchTime(), o.getPath());
|
|
|
if (o.getType() == 4) {
|
|
|
@@ -366,11 +358,11 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
IntrusionTestReportVO intrusionTestReportVO = report.get(i);
|
|
|
intrusionTestReportVO.setOrderNum(i + 1);
|
|
|
}
|
|
|
- String baseHeaderName="备用电源维护情况表";
|
|
|
- String header=baseHeaderName+"(" + resumptionDTO.getExportDateTitle() + ")";
|
|
|
+ String baseHeaderName = "备用电源维护情况表";
|
|
|
+ String header = baseHeaderName + "(" + resumptionDTO.getExportDateTitle() + ")";
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
- String fileName = URLEncoder.encode("【" + orgName + "】-"+baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
+ String fileName = URLEncoder.encode("【" + orgName + "】-" + baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
// 调用EasyExcel的导出方法
|
|
|
EasyExcel.write(response.getOutputStream(), IntrusionTestReportVO.class)
|
|
|
@@ -380,44 +372,51 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<IntrusionTestReportVO> serviceBank(ResumptionDTO resumptionDTO) {
|
|
|
+ public List<LhSelfBankInspectionReport> serviceBank(ResumptionDTO resumptionDTO) throws Exception {
|
|
|
if (null == resumptionDTO.getOrgId()) {
|
|
|
resumptionDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
|
|
|
}
|
|
|
//判断机构类型,如果机构类型大于行社,都展示行社数据
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
- List<SysOrg> sysOrgs;
|
|
|
- if (null==sysOrg.getType()){
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
- if (sysOrg.getType() < 3 || sysOrg.getShortName().endsWith("地区行社") || sysOrg.getType() == 9) {
|
|
|
- sysOrgs = orgService.selectSysOrgByPathAndType(sysOrg.getPath(), 3, SecurityConstants.INNER);
|
|
|
- } else if (sysOrg.getType() == 3) {
|
|
|
- sysOrgs = orgService.selectSysOrgByPathAndType(sysOrg.getPath(), 4, SecurityConstants.INNER);
|
|
|
- } else {
|
|
|
+ List<SysOrg> sysOrgs = orgService.selectSysOrgByPathAndType(sysOrg.getPath(), 3, SecurityConstants.INNER);
|
|
|
+ if (null == sysOrg.getType()) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
- List<IntrusionTestReportVO> intrusionTestReportVOList = new ArrayList<>(16);
|
|
|
- sysOrgs.forEach(o -> {
|
|
|
- IntrusionTestReportVO intrusionTestReportVO = new IntrusionTestReportVO();
|
|
|
- SysOrg sysOrg1;
|
|
|
- if (sysOrg.getType() < 3 || sysOrg.getShortName().endsWith("地区行社") || sysOrg.getType() == 9) {
|
|
|
- sysOrg1 = orgService.selectOrgById(o.getParentId(), SecurityConstants.INNER);
|
|
|
- } else {
|
|
|
- sysOrg1 = orgService.selectOrgById(orgService.selectOrgById(o.getParentId(), SecurityConstants.INNER).getParentId(), SecurityConstants.INNER);
|
|
|
+ //如果查看省联社/地区 数据,那么就展示离行机构数量
|
|
|
+ //如果查看行社数据,那么列表上展示离行机构名称
|
|
|
+ boolean showOrgName = sysOrg.getType() == 3;
|
|
|
+ List<LhSelfBankInspectionReport> intrusionTestReportVOList = new ArrayList<>();
|
|
|
+ if (!showOrgName) {
|
|
|
+ for (SysOrg hsOrg : sysOrgs) {
|
|
|
+ CompletableFuture<LhSelfBankInspectionReport> future = CompletableFuture.supplyAsync(() -> {
|
|
|
+ LhSelfBankInspectionReport intrusionTestReportVO = resumptionReportMapper.selectServiceBankReport(null, resumptionDTO.getSearchTime(), hsOrg.getPath());
|
|
|
+ Integer orgNums = monitorAccessReportMapper.selectOrgNumByPathAndType(hsOrg.getPath(), OrgTypeEnum.LIHANG_ZIZHU_YINGHANG.getCode());
|
|
|
+ intrusionTestReportVO.setCity(hsOrg.getAffiliatedArea());
|
|
|
+ intrusionTestReportVO.setOrgName(hsOrg.getShortName());
|
|
|
+ intrusionTestReportVO.setNetworkNumber(orgNums);
|
|
|
+ return intrusionTestReportVO;
|
|
|
+ }, threadPoolTaskExecutor);
|
|
|
+ intrusionTestReportVOList.add(future.get(5, TimeUnit.SECONDS));
|
|
|
}
|
|
|
- IntrusionTestReportVO intrusionTestReportVO1 = resumptionReportMapper.selectServiceBankReport(null, resumptionDTO.getSearchTime(), o.getPath());
|
|
|
- Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(o.getPath());
|
|
|
- if (o.getType() == 4) {
|
|
|
- integer = 1;
|
|
|
- intrusionTestReportVO1 = resumptionReportMapper.selectServiceBankReport(o.getId(), resumptionDTO.getSearchTime(), null);
|
|
|
+ } else {
|
|
|
+ for (SysOrg hsOrg : sysOrgs) {
|
|
|
+ List<SysOrg> lhOrgList = orgService.selectSysOrgByPathAndType(sysOrg.getPath(), OrgTypeEnum.LIHANG_ZIZHU_YINGHANG.getCode(), SecurityConstants.INNER);
|
|
|
+ for (SysOrg lhOrg : lhOrgList) {
|
|
|
+ CompletableFuture<LhSelfBankInspectionReport> future = CompletableFuture.supplyAsync(() -> {
|
|
|
+ LhSelfBankInspectionReport intrusionTestReportVO = resumptionReportMapper.selectServiceBankReport(null, resumptionDTO.getSearchTime(), lhOrg.getPath());
|
|
|
+ intrusionTestReportVO.setCity(lhOrg.getAffiliatedArea());
|
|
|
+ intrusionTestReportVO.setOrgName(hsOrg.getShortName());
|
|
|
+ intrusionTestReportVO.setLhOrgName(lhOrg.getShortName());
|
|
|
+ return intrusionTestReportVO;
|
|
|
+ }, threadPoolTaskExecutor);
|
|
|
+ intrusionTestReportVOList.add(future.get(5, TimeUnit.SECONDS));
|
|
|
+ }
|
|
|
}
|
|
|
- BeanUtils.copyProperties(intrusionTestReportVO1, intrusionTestReportVO);
|
|
|
- intrusionTestReportVO.setCity(sysOrg1.getShortName().indexOf("地区行社") == -1 ? sysOrg1.getShortName().substring(0, 2) : sysOrg1.getShortName().split("地区行社")[0]);
|
|
|
- intrusionTestReportVO.setOrgName(o.getShortName());
|
|
|
- intrusionTestReportVO.setNetworkNumber(integer);
|
|
|
- intrusionTestReportVOList.add(intrusionTestReportVO);
|
|
|
- });
|
|
|
+ }
|
|
|
+ //如果不展示离行机构名称,说明要展示离行机构数量,不展示离行机构数量为0的数据
|
|
|
+ if (!showOrgName) {
|
|
|
+ intrusionTestReportVOList.removeIf(r -> ObjectUtil.equal(0, r.getNetworkNumber()));
|
|
|
+ }
|
|
|
return intrusionTestReportVOList;
|
|
|
}
|
|
|
|
|
|
@@ -467,7 +466,7 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
IntrusionTestReportVO intrusionTestReportVO1 = resumptionReportMapper.selectStandbyPower(null, resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), o.getPath());
|
|
|
//隐患
|
|
|
Map map = resumptionReportMapper.selectStandbyPowerAbnormalNumber(null, resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), o.getPath());
|
|
|
- Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(o.getPath());
|
|
|
+ Integer integer = monitorAccessReportMapper.selectOrgNumByPathAndType(o.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
|
|
|
if (o.getType() == 4) {
|
|
|
integer = 1;
|
|
|
map = resumptionReportMapper.selectStandbyPowerAbnormalNumber(o.getId(), resumptionDTO.getStartTime(), resumptionDTO.getEndTime(), null);
|
|
|
@@ -491,13 +490,18 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void serviceBankExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException {
|
|
|
+ public void serviceBankExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws Exception {
|
|
|
String orgName = null;
|
|
|
+ boolean showOrgName = false;
|
|
|
if (null != resumptionDTO.getOrgId()) {
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
orgName = sysOrg.getName();
|
|
|
+ if (sysOrg.getType() == 3) {
|
|
|
+ showOrgName = true;
|
|
|
+ }
|
|
|
}
|
|
|
- List<IntrusionTestReportVO> report = this.serviceBank(resumptionDTO);
|
|
|
+
|
|
|
+ List<LhSelfBankInspectionReport> report = this.serviceBank(resumptionDTO);
|
|
|
if (ObjectUtil.isEmpty(report)) {
|
|
|
throw new RuntimeException("导出数据为空!");
|
|
|
}
|
|
|
@@ -505,19 +509,40 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
}
|
|
|
for (int i = 0; i < report.size(); i++) {
|
|
|
- IntrusionTestReportVO intrusionTestReportVO = report.get(i);
|
|
|
+ LhSelfBankInspectionReport intrusionTestReportVO = report.get(i);
|
|
|
intrusionTestReportVO.setOrderNum(i + 1);
|
|
|
}
|
|
|
- String baseHeaderName="离行式自助银行巡检情况表";
|
|
|
- String header=baseHeaderName+"(" + resumptionDTO.getSearchTime() + ")";
|
|
|
+
|
|
|
+ String baseHeaderName = "离行式自助银行巡检情况表";
|
|
|
+ String header = baseHeaderName + "(" + resumptionDTO.getSearchTime() + ")";
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
String fileName = URLEncoder.encode("【" + orgName + "】-" + baseHeaderName + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
- // 调用EasyExcel的导出方法
|
|
|
- EasyExcel.write(response.getOutputStream(), IntrusionTestReportVO.class)
|
|
|
- .registerWriteHandler(new ValueCellWriteHandler(header))
|
|
|
- .sheet(baseHeaderName).doWrite(report);
|
|
|
+ Class clazz;
|
|
|
+ if (showOrgName){
|
|
|
+ List<LhSelfBankInspectionReportNameVo> list = BeanHelper.copyProperties(report, LhSelfBankInspectionReportNameVo.class);
|
|
|
+ clazz = LhSelfBankInspectionReportNameVo.class;
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), clazz)
|
|
|
+ .registerWriteHandler(new ValueCellWriteHandler(header))
|
|
|
+ .sheet(baseHeaderName).doWrite(list);
|
|
|
+ }else {
|
|
|
+ List<LhSelfBankInspectionReportNumVo> list = BeanHelper.copyProperties(report, LhSelfBankInspectionReportNumVo.class);
|
|
|
+ clazz = LhSelfBankInspectionReportNumVo.class;
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), clazz)
|
|
|
+ .registerWriteHandler(new ValueCellWriteHandler(header))
|
|
|
+ .sheet(baseHeaderName).doWrite(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|