安全违章、质量检查导出
This commit is contained in:
parent
acec3e5119
commit
7b164c5247
|
|
@ -2,6 +2,7 @@ package com.bonus.imgTool.imgUpload.controller;
|
|||
|
||||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||
import com.bonus.imgTool.annotation.LogAnnotation;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
import com.bonus.imgTool.imgUpload.service.QualityInspectionService;
|
||||
import com.bonus.imgTool.imgUpload.service.SafetyViolationService;
|
||||
import com.bonus.imgTool.imgUpload.vo.SafetyViolationVo;
|
||||
|
|
@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +31,7 @@ public class QualityInspectionController {
|
|||
|
||||
@GetMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "安全违章", operation = "查询列表", operDesc = "系统级事件",operType="查询")
|
||||
@LogAnnotation(operModul = "质量检查", operation = "查询列表", operDesc = "系统级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:qualityInspection:query')" )
|
||||
public ServerResponse getList(EncryptedReq<SafetyViolationDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
|
|
@ -45,7 +47,7 @@ public class QualityInspectionController {
|
|||
|
||||
@PostMapping(value = "insertQualityInspection")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "安全违章", operation = "新增数据", operDesc = "系统级事件",operType="新增")
|
||||
@LogAnnotation(operModul = "质量检查", operation = "新增数据", operDesc = "系统级事件",operType="新增")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:qualityInspection:add')" )
|
||||
public ServerResponse insertQualityInspection(EncryptedReq<SafetyViolationDto> data) {
|
||||
try {
|
||||
|
|
@ -59,7 +61,7 @@ public class QualityInspectionController {
|
|||
|
||||
@GetMapping(value = "getQualityInspectionById")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "安全违章", operation = "查询单个数据", operDesc = "系统级事件",operType="查询")
|
||||
@LogAnnotation(operModul = "质量检查", operation = "查询单个数据", operDesc = "系统级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:qualityInspection:query')" )
|
||||
public ServerResponse getQualityInspectionById(EncryptedReq<SafetyViolationDto> data) {
|
||||
try {
|
||||
|
|
@ -73,7 +75,7 @@ public class QualityInspectionController {
|
|||
|
||||
@PostMapping(value = "updateQualityInspectionById")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "安全违章", operation = "修改单个数据", operDesc = "系统级事件",operType="修改")
|
||||
@LogAnnotation(operModul = "质量检查", operation = "修改单个数据", operDesc = "系统级事件",operType="修改")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:qualityInspection:update')" )
|
||||
public ServerResponse updateQualityInspectionById(EncryptedReq<SafetyViolationDto> data) {
|
||||
try {
|
||||
|
|
@ -87,7 +89,7 @@ public class QualityInspectionController {
|
|||
|
||||
@DeleteMapping(value = "delQualityInspectionById")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "安全违章", operation = "删除违章", operDesc = "系统级事件",operType="删除")
|
||||
@LogAnnotation(operModul = "质量检查", operation = "删除违章", operDesc = "系统级事件",operType="删除")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:qualityInspection:del')" )
|
||||
public ServerResponse delQualityInspectionById(EncryptedReq<SafetyViolationDto> data) {
|
||||
try {
|
||||
|
|
@ -99,4 +101,11 @@ public class QualityInspectionController {
|
|||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping("downloadExcel")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "质量检查", operation = "导出列表", operDesc = "系统级事件",operType="导出")
|
||||
public void downloadProExcel(HttpServletResponse response, EncryptedReq<SafetyViolationDto> dto) {
|
||||
service.downloadExcel(dto.getData(),response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -102,4 +103,11 @@ public class SafetyViolationController {
|
|||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping("downloadExcel")
|
||||
@DecryptAndVerify(decryptedClass = SafetyViolationDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "安全违章", operation = "导出列表", operDesc = "系统级事件",operType="导出")
|
||||
public void downloadProExcel(HttpServletResponse response, EncryptedReq<SafetyViolationDto> dto) {
|
||||
service.downloadExcel(dto.getData(),response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.imgTool.imgUpload.vo.SafetyViolationVo;
|
|||
import com.bonus.imgTool.imgUpload.vo.dto.SafetyViolationDto;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
public interface QualityInspectionService {
|
||||
|
|
@ -19,4 +20,6 @@ public interface QualityInspectionService {
|
|||
ServerResponse updateQualityInspectionById(SafetyViolationDto bean);
|
||||
|
||||
ServerResponse delQualityInspectionById(SafetyViolationDto bean);
|
||||
|
||||
void downloadExcel(SafetyViolationDto data, HttpServletResponse response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.imgTool.imgUpload.vo.SafetyViolationVo;
|
|||
import com.bonus.imgTool.imgUpload.vo.dto.SafetyViolationDto;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
public interface SafetyViolationService {
|
||||
|
|
@ -20,4 +21,6 @@ public interface SafetyViolationService {
|
|||
ServerResponse updateSafetyViolationById(SafetyViolationDto bean);
|
||||
|
||||
ServerResponse delSafetyViolationById(SafetyViolationDto bean);
|
||||
|
||||
void downloadExcel(SafetyViolationDto data, HttpServletResponse response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
package com.bonus.imgTool.imgUpload.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.bonus.imgTool.backstage.entity.ComprehensiveQueryVo;
|
||||
import com.bonus.imgTool.backstage.service.SynthesisQueryService;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
import com.bonus.imgTool.imgUpload.dao.QualityInspectionDao;
|
||||
import com.bonus.imgTool.imgUpload.dao.SafetyViolationDao;
|
||||
import com.bonus.imgTool.imgUpload.service.QualityInspectionService;
|
||||
|
|
@ -12,6 +16,7 @@ import com.bonus.imgTool.system.vo.LoginUser;
|
|||
import com.bonus.imgTool.system.vo.dto.FileStorageDto;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.bonus.imgTool.utils.UserUtil;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -19,7 +24,12 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@Service
|
||||
|
|
@ -137,5 +147,27 @@ public class QualityInspectionServiceImpl implements QualityInspectionService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadExcel(SafetyViolationDto data, HttpServletResponse response) {
|
||||
try {
|
||||
List<SafetyViolationVo> list = Optional.ofNullable(dao.getList(data)).orElseGet(ArrayList::new);
|
||||
final Long[] num = {1L};
|
||||
list.forEach(vo -> {
|
||||
vo.setId(num[0]);
|
||||
num[0]++;
|
||||
});
|
||||
ExportParams exportParams = new ExportParams("质量检查", "质量检查", ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SafetyViolationVo.class, list);
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("质量检查" + ".xlsx", "UTF-8"));
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.bonus.imgTool.imgUpload.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.bonus.imgTool.backstage.entity.ComprehensiveQueryVo;
|
||||
import com.bonus.imgTool.backstage.service.SynthesisQueryService;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
|
|
@ -12,6 +15,7 @@ import com.bonus.imgTool.system.vo.dto.FileStorageDto;
|
|||
import com.bonus.imgTool.task.job.ProPullTask;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.bonus.imgTool.utils.UserUtil;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -19,7 +23,12 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@Service
|
||||
|
|
@ -140,5 +149,26 @@ public class SafetyViolationServiceImpl implements SafetyViolationService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadExcel(SafetyViolationDto data, HttpServletResponse response) {
|
||||
try {
|
||||
List<SafetyViolationVo> list = Optional.ofNullable(dao.getList(data)).orElseGet(ArrayList::new);
|
||||
final Long[] num = {1L};
|
||||
list.forEach(vo -> {
|
||||
vo.setId(num[0]);
|
||||
num[0]++;
|
||||
});
|
||||
ExportParams exportParams = new ExportParams("安全违章", "安全违章", ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, SafetyViolationVo.class, list);
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("安全违章" + ".xlsx", "UTF-8"));
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.imgTool.imgUpload.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.bonus.imgTool.base.entity.PageEntity;
|
||||
import com.bonus.imgTool.system.vo.dto.FileStorageDto;
|
||||
import lombok.Data;
|
||||
|
|
@ -14,10 +15,12 @@ public class SafetyViolationVo extends PageEntity {
|
|||
/**
|
||||
* 检查人
|
||||
*/
|
||||
@Excel(name = "检查人", width = 20.0, orderNum = "6")
|
||||
private String checkUserName;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "违章/检查时间", width = 20.0, orderNum = "7")
|
||||
private String createTime;
|
||||
/**
|
||||
* 创建人
|
||||
|
|
@ -38,10 +41,12 @@ public class SafetyViolationVo extends PageEntity {
|
|||
/**
|
||||
* 工序名称
|
||||
*/
|
||||
@Excel(name = "工序名称", width = 20.0, orderNum = "2")
|
||||
private String gxName;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Excel(name = "序号", width = 20.0, orderNum = "0")
|
||||
private Long id;
|
||||
/**
|
||||
* 是否可用 1.可用 0.不可用
|
||||
|
|
@ -62,30 +67,37 @@ public class SafetyViolationVo extends PageEntity {
|
|||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称", width = 20.0, orderNum = "1")
|
||||
private String proName;
|
||||
/**
|
||||
* 整改期限
|
||||
*/
|
||||
@Excel(name = "整改期限", width = 20.0, orderNum = "8")
|
||||
private String rectDate;
|
||||
/**
|
||||
* 整改说明
|
||||
*/
|
||||
@Excel(name = "整改说明", width = 20.0, orderNum = "10")
|
||||
private String rectDesc;
|
||||
/**
|
||||
* 整改状态 0.待整改 1.已整改
|
||||
*/
|
||||
@Excel(name = "整改状态", width = 20.0, orderNum = "9",replace = "0=待整改,1=已整改")
|
||||
private String rectStatus;
|
||||
/**
|
||||
* 整改时间
|
||||
*/
|
||||
@Excel(name = "整改时间", width = 20.0, orderNum = "13")
|
||||
private String rectTime;
|
||||
/**
|
||||
* 整改人
|
||||
*/
|
||||
@Excel(name = "整改人", width = 20.0, orderNum = "12")
|
||||
private String rectUserName;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
|
||||
private String updateTime;
|
||||
/**
|
||||
* 修改人
|
||||
|
|
@ -102,18 +114,22 @@ public class SafetyViolationVo extends PageEntity {
|
|||
/**
|
||||
* 违章描述
|
||||
*/
|
||||
@Excel(name = "违章/检查描述", width = 20.0, orderNum = "4")
|
||||
private String vioDesc;
|
||||
/**
|
||||
* 违章地点
|
||||
*/
|
||||
@Excel(name = "违章/检查地点", width = 20.0, orderNum = "3")
|
||||
private String vioPlace;
|
||||
/**
|
||||
* 违章照片数量
|
||||
*/
|
||||
@Excel(name = "违章/缺陷照片数量", width = 20.0, orderNum = "5")
|
||||
private String vioPhotoNum;
|
||||
/**
|
||||
* 整改照片数量
|
||||
*/
|
||||
@Excel(name = "整改照片数量", width = 20.0, orderNum = "11")
|
||||
private String rectPhotoNum;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue