|
|
@ -1,5 +1,8 @@ |
|
|
|
package com.hnac.hzims.safeproduct.hazard.service.impl; |
|
|
|
package com.hnac.hzims.safeproduct.hazard.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
@ -9,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.maintenance.vo.MaintenanceTaskQueryVO; |
|
|
|
import com.hnac.hzims.safeproduct.constants.DictConstants; |
|
|
|
import com.hnac.hzims.safeproduct.constants.DictConstants; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourcePositionDTO; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.dto.DangerSourcePositionDTO; |
|
|
@ -25,6 +29,7 @@ import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; |
|
|
|
import com.hnac.hzims.safeproduct.utils.ExcelToolListener; |
|
|
|
import com.hnac.hzims.safeproduct.utils.ExcelToolListener; |
|
|
|
import com.hnac.hzims.safeproduct.utils.TableJsonUtils; |
|
|
|
import com.hnac.hzims.safeproduct.utils.TableJsonUtils; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; |
|
|
|
|
|
|
|
import com.hnac.hzims.safeproduct.vo.DangerSourceExportVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; |
|
|
|
import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.SourceVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.SourceVO; |
|
|
@ -33,6 +38,7 @@ import com.hnac.hzims.safeproduct.hazard.wrapper.DangerSourceWrapper; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.BorderStyle; |
|
|
|
import org.springblade.core.excel.support.ExcelException; |
|
|
|
import org.springblade.core.excel.support.ExcelException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
@ -52,9 +58,12 @@ import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.BufferedInputStream; |
|
|
|
import java.io.BufferedInputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -342,6 +351,38 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
public void exportDangerSource(DangerSourceEntity req, HttpServletResponse response) { |
|
|
|
|
|
|
|
List<DangerSourceEntity> dangerSourceList = this.list(Condition.getQueryWrapper(req)); |
|
|
|
|
|
|
|
List<DangerSourceVO> voList = DangerSourceWrapper.build().listVO(dangerSourceList); |
|
|
|
|
|
|
|
List<DangerSourceExportVO> exportVOList = BeanUtil.copy(voList, DangerSourceExportVO.class); |
|
|
|
|
|
|
|
// 设置响应头
|
|
|
|
|
|
|
|
// URLEncoder.encode防止中文乱码
|
|
|
|
|
|
|
|
String fileName; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
fileName = URLEncoder.encode("危险点列表", "UTF-8"); |
|
|
|
|
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
|
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel"); |
|
|
|
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
|
|
|
WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderTop(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderRight(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN); |
|
|
|
|
|
|
|
contentWriteCellStyle.setWrapped(true); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
EasyExcel.write(response.getOutputStream(), DangerSourceExportVO.class) |
|
|
|
|
|
|
|
.registerWriteHandler(new HorizontalCellStyleStrategy(new WriteCellStyle(), contentWriteCellStyle)) |
|
|
|
|
|
|
|
.autoCloseStream(Boolean.FALSE).sheet("危险点列表") |
|
|
|
|
|
|
|
.doWrite(exportVOList); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<SourceVO> listByTenantId(String tenantId) { |
|
|
|
public List<SourceVO> listByTenantId(String tenantId) { |
|
|
|
return this.baseMapper.listByTenantId(tenantId); |
|
|
|
return this.baseMapper.listByTenantId(tenantId); |
|
|
|
} |
|
|
|
} |
|
|
|