代码提交

dev_xds
姜玉琦 2023-11-09 00:51:04 +08:00
parent 423d77a86c
commit 62b7a8bdd2
6 changed files with 1089 additions and 23 deletions

View File

@ -0,0 +1,242 @@
package com.ruoyi.common.utils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
public class ExcelUtils {
/**
*
* @param wb
* @return
*/
public static CellStyle createTitleCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);//居于底部
//cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());//背景颜色
Font headerFont1 = wb.createFont(); // 创建字体样式
headerFont1.setBold(true); //字体加粗
headerFont1.setFontName("宋体"); // 设置字体类型
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createHeadCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);// 设置自动换行
// cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setAlignment(HorizontalAlignment.CENTER); //水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直对齐
//cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// cellStyle.setBottomBorderColor(IndexedColors.BLACK.index);
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
Font headerFont = wb.createFont(); // 创建字体样式
// headerFont.setBold(true); //字体加粗
headerFont.setFontName("宋体"); // 设置字体类型
headerFont.setFontHeightInPoints((short) 10); // 设置字体大小
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentRightCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.RIGHT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentWeightCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.LEFT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setBold(true); //字体加粗
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentWeightRightCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.RIGHT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setBold(true); //字体加粗
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentWeightCenterCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景颜色
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setBold(true); //字体加粗
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle createContentNoBorderCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.LEFT);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle myCreateContentCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
cellStyle.setWrapText(true);// 设置自动换行
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
cellStyle.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());//背景颜色
// 生成12号字体
Font font = wb.createFont();
font.setColor((short)8);
font.setFontHeightInPoints((short) 10);
cellStyle.setFont(font);
return cellStyle;
}
/**
*
* @param wb
* @return
*/
public static CellStyle myCreateTitleCellStyle(SXSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);//居于底部
cellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());//背景颜色
cellStyle.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
Font headerFont1 = wb.createFont(); // 创建字体样式
headerFont1.setBold(true); //字体加粗
headerFont1.setFontName("宋体"); // 设置字体类型
headerFont1.setFontHeightInPoints((short) 15); // 设置字体大小
cellStyle.setFont(headerFont1); // 为标题样式设置字体样式
return cellStyle;
}
}

View File

@ -8,3 +8,12 @@ export function selectStatisticsProjectList(query) {
params: query
})
}
// 导出项目数据汇总
export function exportView(query) {
return request({
url: '/statistics/project/exportView',
method: 'get',
params: query
})
}

View File

@ -166,8 +166,11 @@
<script>
import {
selectStatisticsProjectList
selectStatisticsProjectList, exportView
} from "@/api/statistics/statisticsProject";
import axios from 'axios';
import { saveAs } from 'file-saver';
import { getToken } from '@/utils/auth'
export default {
name: "statisticsProject",
@ -267,13 +270,28 @@
},
/** 导出按钮操作 */
handleExport() {
this.download(
"statistics/project/exportView",
{
...this.queryParams,
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeTime && "" != this.daterangeTime) {
this.queryParams.params["beginTime"] = this.daterangeTime[0];
this.queryParams.params["endTime"] = this.daterangeTime[1];
}
let url = process.env.VUE_APP_BASE_API + '/statistics/project/exportView';
axios({
method: 'get',
url: url,
data: this.queryParams,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
}).then((res) => {
this.loading = false;
let timeStamp = new Date().getTime();
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel;charset=utf-8' })
this.saveAs(blob, decodeURIComponent('项目汇总数据_'+timeStamp+'.xlsx'))
})
},
`项目数据汇总_${new Date().getTime()}.xlsx`
);
saveAs(text, name, opts) {
saveAs(text, name, opts);
},
},
};

View File

@ -5,18 +5,30 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.SysRoleEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ExcelUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService;
import com.yanzhu.jh.project.domain.SurProject;
import com.yanzhu.jh.project.domain.vo.ProjectViewExport;
import com.yanzhu.jh.project.service.IProjectViewService;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -41,23 +53,723 @@ public class ProjectViewController extends BaseBuildNodeController{
surProject.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(surProject.getNowRole())){
surProject.setDeptId(sysDeptService.getZGSDeptId(getDeptId()));
}else{
surProject.setNowDept(Convert.toStr(getDeptId()));
}
List<ProjectViewExport> list = projectViewService.selectStatisticsProjectList(surProject);
return getDataTable(list);
}
/**
*
*/
@Log(title = "项目数据汇总", businessType = BusinessType.EXPORT)
@PostMapping("/exportView")
@GetMapping("/exportView")
public void exportView(HttpServletResponse response, SurProject surProject)
{
surProject.setNowRole(Convert.toStr(getUserFirstRole()));
if(SysRoleEnum.ZGS.getCode().equals(surProject.getNowRole())){
surProject.setDeptId(sysDeptService.getZGSDeptId(getDeptId()));
}
OutputStream outputStream = null;
List<ProjectViewExport> list = projectViewService.selectStatisticsProjectList(surProject);
ExcelUtil<ProjectViewExport> util = new ExcelUtil<ProjectViewExport>(ProjectViewExport.class);
util.exportExcel(response, list, "项目数据汇总");
try {
response.reset();// 清空输出流
response.setContentType("application/octet-stream;charset=UTF-8");
String fileName = "项目数据汇总_"+DateUtils.getDate() + ".xlsx";
fileName = new String(fileName.getBytes(StandardCharsets.UTF_8));
response.addHeader("Content-disposition", "attachment;filename=" + fileName);
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.addHeader("Pargam", "no-cache");
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Access-Control-Allow-Origin", "*");
SXSSFWorkbook wb = new SXSSFWorkbook(500);
Sheet sheet = wb.createSheet("项目数据汇总");
CellStyle titleStyle = ExcelUtils.myCreateTitleCellStyle(wb);
CellStyle headerStyle = ExcelUtils.createHeadCellStyle(wb);
CellStyle contentStyle = ExcelUtils.createContentCellStyle(wb);
// 行号
Row tempRow = null;
Cell tempCell = null;
int rowNum = 0;
// 创建第一页的第一行索引从0开始
tempRow = sheet.createRow(rowNum++);
tempRow.setHeight((short) 500);// 设置行高
String title = "泾河新城产发集团项目数据汇总";
tempCell = tempRow.createCell(0);
tempCell.setCellValue(title);
tempCell.setCellStyle(titleStyle);
//合计行
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 30));//单元格合并
tempRow = sheet.createRow(rowNum++);
tempRow.setHeight((short) 400);// 设置行高
tempCell = tempRow.createCell(0);
tempCell.setCellValue("项目名称");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(1);
tempCell.setCellValue("参建单位");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(2);
tempCell.setCellValue("项目详情");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(3);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(4);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(5);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(6);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(7);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(8);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(9);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 2, 9));//单元格合并
tempCell = tempRow.createCell(10);
tempCell.setCellValue("安全管理");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(11);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(12);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(13);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(14);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(15);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(16);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(17);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 10, 17));//单元格合并
tempCell = tempRow.createCell(18);
tempCell.setCellValue("质量管理");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(19);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(20);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(21);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(22);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(23);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(24);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 18, 24));//单元格合并
tempCell = tempRow.createCell(25);
tempCell.setCellValue("视频管理");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(26);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(27);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 25, 27));//单元格合并
tempCell = tempRow.createCell(28);
tempCell.setCellValue("工程管理");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(29);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(30);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 28, 30));//单元格合并
//合计行
sheet.setColumnWidth(0, 450 * 20 + 323);
sheet.setColumnWidth(1, 350 * 20 + 323);
sheet.setColumnWidth(2, 150 * 20 + 323);
sheet.setColumnWidth(3, 150 * 20 + 323);
sheet.setColumnWidth(4, 150 * 20 + 323);
sheet.setColumnWidth(5, 150 * 20 + 323);
sheet.setColumnWidth(6, 150 * 20 + 323);
sheet.setColumnWidth(7, 150 * 20 + 323);
sheet.setColumnWidth(8, 150 * 20 + 323);
sheet.setColumnWidth(9, 150 * 20 + 323);
sheet.setColumnWidth(10, 150 * 20 + 323);
sheet.setColumnWidth(11, 150 * 20 + 323);
sheet.setColumnWidth(12, 150 * 20 + 323);
sheet.setColumnWidth(13, 150 * 20 + 323);
sheet.setColumnWidth(14, 150 * 20 + 323);
sheet.setColumnWidth(15, 150 * 20 + 323);
sheet.setColumnWidth(16, 150 * 20 + 323);
sheet.setColumnWidth(17, 150 * 20 + 323);
sheet.setColumnWidth(18, 150 * 20 + 323);
sheet.setColumnWidth(19, 150 * 20 + 323);
sheet.setColumnWidth(20, 150 * 20 + 323);
sheet.setColumnWidth(21, 150 * 20 + 323);
sheet.setColumnWidth(22, 150 * 20 + 323);
sheet.setColumnWidth(23, 150 * 20 + 323);
sheet.setColumnWidth(24, 150 * 20 + 323);
sheet.setColumnWidth(25, 150 * 20 + 323);
sheet.setColumnWidth(26, 150 * 20 + 323);
sheet.setColumnWidth(27, 150 * 20 + 323);
sheet.setColumnWidth(28, 150 * 20 + 323);
sheet.setColumnWidth(29, 150 * 20 + 323);
sheet.setColumnWidth(30, 150 * 20 + 323);
tempRow = sheet.createRow(rowNum++);
tempRow.setHeight((short) 400);// 设置行高
tempCell = tempRow.createCell(0);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(1);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(2);
tempCell.setCellValue("劳务实名制");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(3);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 2, 3));//单元格合并
tempCell = tempRow.createCell(4);
tempCell.setCellValue("节点预警");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(5);
tempCell.setCellValue("环境检测");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(6);
tempCell.setCellValue("项目预警");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(7);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(8);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(9);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 6, 9));//单元格合并
tempCell = tempRow.createCell(10);
tempCell.setCellValue("安责险");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(11);
tempCell.setCellValue("一切险");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(12);
tempCell.setCellValue("安全隐患排查");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(13);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(14);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 12, 14));//单元格合并
tempCell = tempRow.createCell(15);
tempCell.setCellValue("特种人员");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(16);
tempCell.setCellValue("应急演练");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(17);
tempCell.setCellValue("专项培训");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(18);
tempCell.setCellValue("质量隐患排查");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(19);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(20);
tempCell.setCellValue("");
tempCell.setCellStyle(headerStyle);
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 18, 20));//单元格合并
tempCell = tempRow.createCell(21);
tempCell.setCellValue("材料取样复试");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(22);
tempCell.setCellValue("材料封样");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(23);
tempCell.setCellValue("实测实量");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(24);
tempCell.setCellValue("举牌验收");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(25);
tempCell.setCellValue("视频监控");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(26);
tempCell.setCellValue("AI监控");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(27);
tempCell.setCellValue("延迟摄影");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(28);
tempCell.setCellValue("项目标准化");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(29);
tempCell.setCellValue("审批进行中");
tempCell.setCellStyle(headerStyle);
tempCell = tempRow.createCell(30);
tempCell.setCellValue("审批已完成");
tempCell.setCellStyle(headerStyle);
List<String> headArrays = new ArrayList<>();
headArrays.add("");
headArrays.add("");
headArrays.add("劳务人员");
headArrays.add("实名制接入");
headArrays.add("");
headArrays.add("");
headArrays.add("AI预警");
headArrays.add("安全预警");
headArrays.add("质量预警");
headArrays.add("环境预警");
headArrays.add("");
headArrays.add("");
headArrays.add("甲方经理");
headArrays.add("监理单位");
headArrays.add("总包单位");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("甲方经理");
headArrays.add("监理单位");
headArrays.add("总包单位");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
headArrays.add("");
tempRow = sheet.createRow(rowNum++);
tempRow.setHeight((short) 400);// 设置行高
for (int i = 0; i < headArrays.size(); i++) {
tempCell = tempRow.createCell(i);
tempCell.setCellValue(headArrays.get(i));
tempCell.setCellStyle(headerStyle);
if(i<2){
sheet.addMergedRegion(new CellRangeAddress(rowNum-3, rowNum - 1, i, i));//单元格合并
}
if((i>3 && i<6) || (i>9 && i<12) || (i>14 && i<18) || i>20){
sheet.addMergedRegion(new CellRangeAddress(rowNum-2, rowNum - 1, i, i));//单元格合并
}
}
Integer trindex = 0;
for(int i=0;i<list.size();i++){
ProjectViewExport view = list.get(i);
tempRow = sheet.createRow(rowNum++);
tempRow.setHeight((short) 500);// 设置行高
tempCell = tempRow.createCell(0);
tempCell.setCellValue(view.getProjectName());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(1);
tempCell.setCellValue(view.getUnitName());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(2);
tempCell.setCellValue(view.getLwry());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(3);
tempCell.setCellValue(view.getLwsm().equals("0")?"未接入":"已接入");
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(4);
tempCell.setCellValue(view.getJdyj()==null?"":(view.getJdyj().equals("1")?"正常":"滞后"));
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(5);
tempCell.setCellValue(view.getHjjc().equals("0")?"未接入":"已接入");
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(6);
tempCell.setCellValue(view.getAiyjs());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(7);
tempCell.setCellValue(view.getAqyjs());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(8);
tempCell.setCellValue(view.getZlyjs());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(9);
tempCell.setCellValue(view.getHjyjs());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(10);
tempCell.setCellValue(view.getAzx().equals("0")?"未办理":"已办理");
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(11);
tempCell.setCellValue(view.getYqx().equals("0")?"未办理":"已办理");
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(12);
tempCell.setCellValue(view.getAqyhpc_jfdb());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(13);
tempCell.setCellValue(view.getAqyhpc_jldw());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(14);
tempCell.setCellValue(view.getAqyhpc_zbdw());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(15);
tempCell.setCellValue(view.getTzry());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(16);
tempCell.setCellValue(view.getYjyl());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(17);
tempCell.setCellValue(view.getZxpx());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(18);
tempCell.setCellValue(view.getZlyhpc_jfdb());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(19);
tempCell.setCellValue(view.getZlyhpc_jldw());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(20);
tempCell.setCellValue(view.getZlyhpc_zbdw());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(21);
tempCell.setCellValue(view.getClqyfs());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(22);
tempCell.setCellValue(view.getClfy());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(23);
tempCell.setCellValue(view.getCscl());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(24);
tempCell.setCellValue(view.getJpys());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(25);
tempCell.setCellValue(view.getSsjk().equals("0")?"未接入":"已接入");
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(26);
tempCell.setCellValue(view.getAijk().equals("0")?"未接入":"已接入");
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(27);
tempCell.setCellValue(view.getYssys());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(28);
tempCell.setCellValue(view.getBzh());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(29);
tempCell.setCellValue(view.getGcsq());
tempCell.setCellStyle(contentStyle);
tempCell = tempRow.createCell(30);
tempCell.setCellValue(view.getGcsp());
tempCell.setCellStyle(contentStyle);
if(i==list.size()-1 || !view.getProjectId().equals(list.get(i+1).getProjectId())){
if(trindex>0){
sheet.addMergedRegion(new CellRangeAddress(rowNum-(1+trindex), rowNum - 1, 0, 0));//单元格合并
sheet.addMergedRegion(new CellRangeAddress(rowNum-(1+trindex), rowNum - 1, 4, 4));//单元格合并
sheet.addMergedRegion(new CellRangeAddress(rowNum-(1+trindex), rowNum - 1, 12, 12));//单元格合并
sheet.addMergedRegion(new CellRangeAddress(rowNum-(1+trindex), rowNum - 1, 13, 13));//单元格合并
sheet.addMergedRegion(new CellRangeAddress(rowNum-(1+trindex), rowNum - 1, 18, 19));//单元格合并
sheet.addMergedRegion(new CellRangeAddress(rowNum-(1+trindex), rowNum - 1, 27, 27));//单元格合并
}
trindex=0;
}else{
trindex++;
}
}
// //合计
// tempRow = sheet.createRow(rowNum++);
// tempRow.setHeight((short) 400);// 设置行高
// tempCell = tempRow.createCell(0);
// tempCell.setCellValue("合计");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(1);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(2);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 2));//单元格合并
//
// tempCell = tempRow.createCell(3);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(4);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(5);
// tempCell.setCellValue(hj.toString());
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(6);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempRow = sheet.createRow(rowNum++);
// tempRow.setHeight((short) 1200);// 设置行高
// tempCell = tempRow.createCell(0);
// tempCell.setCellValue("神木德林荣泽能源运营股份有限公司(盖章)");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(1);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(2);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 2));//单元格合并
//
// tempCell = tempRow.createCell(3);
// tempCell.setCellValue(vo.getCusName()+"(盖章)");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(4);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(5);
// tempCell.setCellValue(hj.toString());
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(6);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 3, 6));//单元格合并
//
// //空行
// tempRow = sheet.createRow(rowNum++);
// tempRow.setHeight((short) 400);// 设置行高
// tempCell = tempRow.createCell(0);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(1);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(2);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(3);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(4);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(5);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(6);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, 6));//单元格合并
//
// //经办人
// tempRow = sheet.createRow(rowNum++);
// tempRow.setHeight((short) 400);// 设置行高
// tempCell = tempRow.createCell(0);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(1);
// tempCell.setCellValue("经办人:");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(2);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(3);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(4);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(5);
// tempCell.setCellValue("经办人:");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(6);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// //时间
// tempRow = sheet.createRow(rowNum++);
// tempRow.setHeight((short) 400);// 设置行高
// tempCell = tempRow.createCell(0);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(1);
// tempCell.setCellValue("时 间:");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(2);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(3);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(4);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(5);
// tempCell.setCellValue("时 间:");
// tempCell.setCellStyle(contentStyle);
//
// tempCell = tempRow.createCell(6);
// tempCell.setCellValue("");
// tempCell.setCellStyle(contentStyle);
try {
outputStream =new BufferedOutputStream(response.getOutputStream());
wb.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
} finally {
outputStream.flush();
outputStream.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -76,12 +76,40 @@ public class ProjectViewExport implements Serializable {
@Excel(name = "AI监控", width = 20,align = HorizontalAlignment.CENTER, dictType = "sys_common_devState")
private String aijk;
@Excel(name = "AI预警数", width = 20,align = HorizontalAlignment.CENTER, isStatistics = true)
private String aiyjs;
@Excel(name = "工程审批进行中", width = 20,align = HorizontalAlignment.CENTER)
private String gcsq;
@Excel(name = "工程审批已完成", width = 20,align = HorizontalAlignment.CENTER, isStatistics = true)
private String gcsp;
private String jdyj;
private String hjjc;
private String hjyjs;
private String zlyjs;
private String aqyjs;
private String lwry;
private String yssys;
public String getYssys() {
return yssys;
}
public void setYssys(String yssys) {
this.yssys = yssys;
}
public String getLwry() {
return lwry;
}
public void setLwry(String lwry) {
this.lwry = lwry;
}
public String getProjectName() {
return projectName;
}
@ -281,4 +309,52 @@ public class ProjectViewExport implements Serializable {
public void setGcsp(String gcsp) {
this.gcsp = gcsp;
}
public String getAiyjs() {
return aiyjs;
}
public void setAiyjs(String aiyjs) {
this.aiyjs = aiyjs;
}
public String getJdyj() {
return jdyj;
}
public void setJdyj(String jdyj) {
this.jdyj = jdyj;
}
public String getHjjc() {
return hjjc;
}
public void setHjjc(String hjjc) {
this.hjjc = hjjc;
}
public String getHjyjs() {
return hjyjs;
}
public void setHjyjs(String hjyjs) {
this.hjyjs = hjyjs;
}
public String getZlyjs() {
return zlyjs;
}
public void setZlyjs(String zlyjs) {
this.zlyjs = zlyjs;
}
public String getAqyjs() {
return aqyjs;
}
public void setAqyjs(String aqyjs) {
this.aqyjs = aqyjs;
}
}

View File

@ -35,11 +35,20 @@
(select count(1) from sur_project_insurance a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0 and a.insurance_type=1)as yqx,
(select count(1) from sur_project_insurance a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0 and a.insurance_type=2)as azx,
(select count(1) from sur_project_video_config a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as ssjk,
(select count(1) from dev_ai_project_data a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as aijk,
(select count(1) from dev_ai_project_config a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as aijk,
(select count(1) from dev_ai_project_data a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as aiyjs,
(select count(1) from sur_project_attendance_cfg a where a.project_id = sp.id and a.sub_dept_id = pui.unitId and a.state=0)as lwsm,
(select count(1) from sur_project_attendance_user a left join sur_project_attendance_cfg b on a.cfgid = b.id where b.project_id = sp.id and b.sub_dept_id = pui.unitId and b.state=0)as lwry,
(select count(1) from vw_flow_all a where a.businessKey = sp.id and a.startDeptName = pui.unitName and a.finishTime is null)as gcsq,
(select count(1) from vw_flow_all a where a.businessKey = sp.id and a.startDeptName = pui.unitName and a.finishTime is not null)as gcsp,
(select count(1) from sur_project_standard a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as bzh
(select count(1) from sur_project_standard a where a.project_id = sp.id and a.dept_id = pui.unitId and a.is_del=0)as bzh,
'0' as yssys,
'0' as hjjc,
'0' as hjyjs,
'0' as zlyjs,
'0' as aqyjs,
(select CASE when b.plan_end_date &gt; now() then 1 else 2 end as jdyj from vw_sur_project_build_node_data_current b where b.id in (select max(id) from vw_sur_project_build_node_data_current a where LENGTH(a.node_lvl)=2
and a.project_id=sp.id))as jdyj
from sur_project sp
left JOIN sur_project_unit_info pui on sp.id=pui.projectId and pui.unitType=2
where pui.del_flag=0