|
@@ -5,13 +5,20 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.example.dao.house.HouseRepairExceptionDao;
|
|
import com.example.dao.house.HouseRepairExceptionDao;
|
|
import com.example.entity.house.HouseBuildingHighRepairPo;
|
|
import com.example.entity.house.HouseBuildingHighRepairPo;
|
|
|
|
+import com.example.entity.house.HouseBuildingHighSporadicRepairPo;
|
|
import com.example.entity.house.HouseBuildingSameRepairFrequencyPo;
|
|
import com.example.entity.house.HouseBuildingSameRepairFrequencyPo;
|
|
|
|
+import com.example.enums.ListBuildingHighRepairOrderEnum;
|
|
|
|
+import com.example.enums.ListBuildingHighSporadicRepairOrderEnum;
|
|
|
|
+import com.example.enums.ListBuildingSameRepairFrequencyOrderEnum;
|
|
import com.example.enums.OrderEnum;
|
|
import com.example.enums.OrderEnum;
|
|
import com.example.pojo.bo.ListBuildingHighRepairBo;
|
|
import com.example.pojo.bo.ListBuildingHighRepairBo;
|
|
|
|
+import com.example.pojo.bo.ListBuildingHighSporadicRepairBo;
|
|
import com.example.pojo.bo.ListBuildingSameRepairFrequencyBo;
|
|
import com.example.pojo.bo.ListBuildingSameRepairFrequencyBo;
|
|
import com.example.pojo.dto.ListBuildingHighRepairDto;
|
|
import com.example.pojo.dto.ListBuildingHighRepairDto;
|
|
|
|
+import com.example.pojo.dto.ListBuildingHighSporadicRepairDto;
|
|
import com.example.pojo.dto.ListBuildingSameRepairFrequencyDto;
|
|
import com.example.pojo.dto.ListBuildingSameRepairFrequencyDto;
|
|
import com.example.pojo.vo.ListBuildingHighRepairVo;
|
|
import com.example.pojo.vo.ListBuildingHighRepairVo;
|
|
|
|
+import com.example.pojo.vo.ListBuildingHighSporadicRepairVo;
|
|
import com.example.pojo.vo.ListBuildingSameRepairFrequencyVo;
|
|
import com.example.pojo.vo.ListBuildingSameRepairFrequencyVo;
|
|
import com.example.utils.PageUtils;
|
|
import com.example.utils.PageUtils;
|
|
import com.example.utils.R;
|
|
import com.example.utils.R;
|
|
@@ -22,7 +29,6 @@ import org.apache.poi.ss.usermodel.DataFormat;
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|
-import org.apache.poi.ss.util.CellReference;
|
|
|
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -95,12 +101,20 @@ public class HouseWzHouseMaintenaCostService {
|
|
if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getCounty())) {
|
|
if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getCounty())) {
|
|
bo.setCityNo(dto.getMap().getCounty());
|
|
bo.setCityNo(dto.getMap().getCounty());
|
|
}
|
|
}
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getBuildingAddressNumber())) {
|
|
|
|
+ bo.setSiteNum(dto.getMap().getBuildingAddressNumber());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getBuildingNameAlias())) {
|
|
|
|
+ bo.setSiteName(dto.getMap().getBuildingNameAlias());
|
|
|
|
+ }
|
|
if (dto.getMap() != null && dto.getMap().getOrder() != null && dto.getMap().getSidx() != null) {
|
|
if (dto.getMap() != null && dto.getMap().getOrder() != null && dto.getMap().getSidx() != null) {
|
|
if (OrderEnum.asc.equals(dto.getMap().getOrder())) {
|
|
if (OrderEnum.asc.equals(dto.getMap().getOrder())) {
|
|
page.addOrder(OrderItem.asc(dto.getMap().getSidx().getColumnName()));
|
|
page.addOrder(OrderItem.asc(dto.getMap().getSidx().getColumnName()));
|
|
} else {
|
|
} else {
|
|
page.addOrder(OrderItem.desc(dto.getMap().getSidx().getColumnName()));
|
|
page.addOrder(OrderItem.desc(dto.getMap().getSidx().getColumnName()));
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ page.addOrder(OrderItem.desc(ListBuildingHighRepairOrderEnum.erpCreditedAmount.getColumnName()));
|
|
}
|
|
}
|
|
return houseRepairExceptionDao.listBuildingHighRepair(page, bo);
|
|
return houseRepairExceptionDao.listBuildingHighRepair(page, bo);
|
|
}
|
|
}
|
|
@@ -121,12 +135,12 @@ public class HouseWzHouseMaintenaCostService {
|
|
baseCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
baseCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
baseCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
baseCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
SXSSFSheet sheet = wb.createSheet();
|
|
SXSSFSheet sheet = wb.createSheet();
|
|
- AtomicInteger columnIndex = new AtomicInteger(0);
|
|
|
|
|
|
+ AtomicInteger rowIndex = new AtomicInteger(0);
|
|
// 表头
|
|
// 表头
|
|
- Row headerRow = sheet.createRow(columnIndex.getAndIncrement());
|
|
|
|
- List<String> headers = Stream.of("入账日期", "二级单位", "三级单位", "建筑别名", "维修类型", "维修内容",
|
|
|
|
- "erp入账金额元", "标准地址", "建筑用途", "建筑面积㎡", "建筑面积自用㎡", "建筑面积出租㎡", "建筑面积闲置㎡",
|
|
|
|
- "建筑面积不可使用㎡").toList();
|
|
|
|
|
|
+ Row headerRow = sheet.createRow(rowIndex.getAndIncrement());
|
|
|
|
+ List<String> headers = Stream.of("入账日期", "二级单位", "三级单位", "局址编号", "局址别名", "建筑别名",
|
|
|
|
+ "维修类型", "维修内容", "erp入账金额元", "标准地址", "建筑用途", "建筑面积㎡", "建筑面积自用㎡", "建筑面积出租㎡",
|
|
|
|
+ "建筑面积闲置㎡", "建筑面积不可使用㎡").toList();
|
|
int headerLength = headers.size();
|
|
int headerLength = headers.size();
|
|
for (int i = 0; i < headerLength; i++) {
|
|
for (int i = 0; i < headerLength; i++) {
|
|
Cell cell = headerRow.createCell(i);
|
|
Cell cell = headerRow.createCell(i);
|
|
@@ -137,84 +151,95 @@ public class HouseWzHouseMaintenaCostService {
|
|
sheet.setColumnWidth(i, columnWidth);
|
|
sheet.setColumnWidth(i, columnWidth);
|
|
}
|
|
}
|
|
// 数据
|
|
// 数据
|
|
- for (HouseBuildingHighRepairPo houseBuildingHighRepairPo : list) {
|
|
|
|
- Row row = sheet.createRow(columnIndex.getAndIncrement());
|
|
|
|
|
|
+ for (HouseBuildingHighRepairPo po : list) {
|
|
|
|
+ AtomicInteger columnIndex = new AtomicInteger(0);
|
|
|
|
+ Row row = sheet.createRow(rowIndex.getAndIncrement());
|
|
// 入账日期
|
|
// 入账日期
|
|
- Cell a = row.createCell(CellReference.convertColStringToIndex("a"));
|
|
|
|
- if (houseBuildingHighRepairPo.getLatestRepairMonth() != null) {
|
|
|
|
- a.setCellValue(houseBuildingHighRepairPo.getLatestRepairMonth());
|
|
|
|
|
|
+ Cell latestRepairMonthCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getLatestRepairMonth() != null) {
|
|
|
|
+ latestRepairMonthCell.setCellValue(po.getLatestRepairMonth());
|
|
}
|
|
}
|
|
// 二级单位
|
|
// 二级单位
|
|
- Cell b = row.createCell(CellReference.convertColStringToIndex("b"));
|
|
|
|
- if (houseBuildingHighRepairPo.getAreaName() != null) {
|
|
|
|
- b.setCellValue(houseBuildingHighRepairPo.getAreaName());
|
|
|
|
|
|
+ Cell areaNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getAreaName() != null) {
|
|
|
|
+ areaNameCell.setCellValue(po.getAreaName());
|
|
}
|
|
}
|
|
// 三级单位
|
|
// 三级单位
|
|
- Cell c = row.createCell(CellReference.convertColStringToIndex("c"));
|
|
|
|
- if (houseBuildingHighRepairPo.getCityName() != null) {
|
|
|
|
- c.setCellValue(houseBuildingHighRepairPo.getCityName());
|
|
|
|
|
|
+ Cell cityNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getCityName() != null) {
|
|
|
|
+ cityNameCell.setCellValue(po.getCityName());
|
|
|
|
+ }
|
|
|
|
+ // 局址编号
|
|
|
|
+ Cell siteNumCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getSiteName() != null) {
|
|
|
|
+ siteNumCell.setCellValue(po.getSiteNum());
|
|
|
|
+ }
|
|
|
|
+ // 局址别名
|
|
|
|
+ Cell siteNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getSiteName() != null) {
|
|
|
|
+ siteNameCell.setCellValue(po.getSiteName());
|
|
}
|
|
}
|
|
// 建筑别名
|
|
// 建筑别名
|
|
- Cell d = row.createCell(CellReference.convertColStringToIndex("d"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingName() != null) {
|
|
|
|
- d.setCellValue(houseBuildingHighRepairPo.getBuildingName());
|
|
|
|
|
|
+ Cell buildingNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingName() != null) {
|
|
|
|
+ buildingNameCell.setCellValue(po.getBuildingName());
|
|
}
|
|
}
|
|
// 维修类型
|
|
// 维修类型
|
|
- Cell e = row.createCell(CellReference.convertColStringToIndex("e"));
|
|
|
|
- if (houseBuildingHighRepairPo.getRepairType() != null) {
|
|
|
|
- e.setCellValue(houseBuildingHighRepairPo.getRepairType());
|
|
|
|
|
|
+ Cell repairTypeCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getRepairType() != null) {
|
|
|
|
+ repairTypeCell.setCellValue(po.getRepairType());
|
|
}
|
|
}
|
|
// 维修内容
|
|
// 维修内容
|
|
- Cell f = row.createCell(CellReference.convertColStringToIndex("f"));
|
|
|
|
- if (houseBuildingHighRepairPo.getContentCategory() != null) {
|
|
|
|
- f.setCellValue(houseBuildingHighRepairPo.getContentCategory());
|
|
|
|
|
|
+ Cell contentCategoryCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getContentCategory() != null) {
|
|
|
|
+ contentCategoryCell.setCellValue(po.getContentCategory());
|
|
}
|
|
}
|
|
// erp入账金额元
|
|
// erp入账金额元
|
|
- Cell g = row.createCell(CellReference.convertColStringToIndex("g"));
|
|
|
|
- if (houseBuildingHighRepairPo.getFinalCostSum() != null) {
|
|
|
|
- g.setCellValue(houseBuildingHighRepairPo.getFinalCostSum().doubleValue());
|
|
|
|
|
|
+ Cell finalCostSumCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getFinalCostSum() != null) {
|
|
|
|
+ finalCostSumCell.setCellValue(po.getFinalCostSum().doubleValue());
|
|
}
|
|
}
|
|
- g.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ finalCostSumCell.setCellStyle(numberCellStyle);
|
|
// 标准地址
|
|
// 标准地址
|
|
- Cell h = row.createCell(CellReference.convertColStringToIndex("h"));
|
|
|
|
- if (houseBuildingHighRepairPo.getAddress() != null) {
|
|
|
|
- h.setCellValue(houseBuildingHighRepairPo.getAddress());
|
|
|
|
|
|
+ Cell addressCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getAddress() != null) {
|
|
|
|
+ addressCell.setCellValue(po.getAddress());
|
|
}
|
|
}
|
|
// 建筑用途
|
|
// 建筑用途
|
|
- Cell i = row.createCell(CellReference.convertColStringToIndex("i"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingUse() != null) {
|
|
|
|
- i.setCellValue(houseBuildingHighRepairPo.getBuildingUse());
|
|
|
|
|
|
+ Cell buildingUseCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingUse() != null) {
|
|
|
|
+ buildingUseCell.setCellValue(po.getBuildingUse());
|
|
}
|
|
}
|
|
// 建筑面积㎡
|
|
// 建筑面积㎡
|
|
- Cell j = row.createCell(CellReference.convertColStringToIndex("j"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingArea() != null) {
|
|
|
|
- j.setCellValue(houseBuildingHighRepairPo.getBuildingArea().doubleValue());
|
|
|
|
|
|
+ Cell buildingAreaCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingArea() != null) {
|
|
|
|
+ buildingAreaCell.setCellValue(po.getBuildingArea().doubleValue());
|
|
}
|
|
}
|
|
- j.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ buildingAreaCell.setCellStyle(numberCellStyle);
|
|
// 建筑面积自用㎡
|
|
// 建筑面积自用㎡
|
|
- Cell k = row.createCell(CellReference.convertColStringToIndex("k"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingAreaSelfUse() != null) {
|
|
|
|
- k.setCellValue(houseBuildingHighRepairPo.getBuildingAreaSelfUse().doubleValue());
|
|
|
|
|
|
+ Cell buildingAreaSelfUseCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingAreaSelfUse() != null) {
|
|
|
|
+ buildingAreaSelfUseCell.setCellValue(po.getBuildingAreaSelfUse().doubleValue());
|
|
}
|
|
}
|
|
- k.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ buildingAreaSelfUseCell.setCellStyle(numberCellStyle);
|
|
// 建筑面积出租㎡
|
|
// 建筑面积出租㎡
|
|
- Cell l = row.createCell(CellReference.convertColStringToIndex("l"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingAreaRent() != null) {
|
|
|
|
- l.setCellValue(houseBuildingHighRepairPo.getBuildingAreaRent().doubleValue());
|
|
|
|
|
|
+ Cell buildingAreaRentCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingAreaRent() != null) {
|
|
|
|
+ buildingAreaRentCell.setCellValue(po.getBuildingAreaRent().doubleValue());
|
|
}
|
|
}
|
|
- l.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ buildingAreaRentCell.setCellStyle(numberCellStyle);
|
|
// 建筑面积闲置㎡
|
|
// 建筑面积闲置㎡
|
|
- Cell m = row.createCell(CellReference.convertColStringToIndex("m"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingAreaIdle() != null) {
|
|
|
|
- m.setCellValue(houseBuildingHighRepairPo.getBuildingAreaIdle().doubleValue());
|
|
|
|
|
|
+ Cell buildingAreaIdleCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingAreaIdle() != null) {
|
|
|
|
+ buildingAreaIdleCell.setCellValue(po.getBuildingAreaIdle().doubleValue());
|
|
}
|
|
}
|
|
- m.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ buildingAreaIdleCell.setCellStyle(numberCellStyle);
|
|
// 建筑面积不可使用㎡
|
|
// 建筑面积不可使用㎡
|
|
- Cell n = row.createCell(CellReference.convertColStringToIndex("n"));
|
|
|
|
- if (houseBuildingHighRepairPo.getBuildingAreaUnusable() != null) {
|
|
|
|
- n.setCellValue(houseBuildingHighRepairPo.getBuildingAreaUnusable().doubleValue());
|
|
|
|
|
|
+ Cell buildingAreaUnusableCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingAreaUnusable() != null) {
|
|
|
|
+ buildingAreaUnusableCell.setCellValue(po.getBuildingAreaUnusable().doubleValue());
|
|
}
|
|
}
|
|
- n.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ buildingAreaUnusableCell.setCellStyle(numberCellStyle);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -245,12 +270,20 @@ public class HouseWzHouseMaintenaCostService {
|
|
if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getCounty())) {
|
|
if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getCounty())) {
|
|
bo.setCityNo(dto.getMap().getCounty());
|
|
bo.setCityNo(dto.getMap().getCounty());
|
|
}
|
|
}
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getBuildingAddressNumber())) {
|
|
|
|
+ bo.setSiteNum(dto.getMap().getBuildingAddressNumber());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getBuildingNameAlias())) {
|
|
|
|
+ bo.setSiteName(dto.getMap().getBuildingNameAlias());
|
|
|
|
+ }
|
|
if (dto.getMap() != null && dto.getMap().getOrder() != null && dto.getMap().getSidx() != null) {
|
|
if (dto.getMap() != null && dto.getMap().getOrder() != null && dto.getMap().getSidx() != null) {
|
|
if (OrderEnum.asc.equals(dto.getMap().getOrder())) {
|
|
if (OrderEnum.asc.equals(dto.getMap().getOrder())) {
|
|
page.addOrder(OrderItem.asc(dto.getMap().getSidx().getColumnName()));
|
|
page.addOrder(OrderItem.asc(dto.getMap().getSidx().getColumnName()));
|
|
} else {
|
|
} else {
|
|
page.addOrder(OrderItem.desc(dto.getMap().getSidx().getColumnName()));
|
|
page.addOrder(OrderItem.desc(dto.getMap().getSidx().getColumnName()));
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ page.addOrder(OrderItem.asc(ListBuildingSameRepairFrequencyOrderEnum.tyTotalRank.getColumnName()));
|
|
}
|
|
}
|
|
return houseRepairExceptionDao.listBuildingSameRepairFrequency(page, bo);
|
|
return houseRepairExceptionDao.listBuildingSameRepairFrequency(page, bo);
|
|
}
|
|
}
|
|
@@ -293,11 +326,11 @@ public class HouseWzHouseMaintenaCostService {
|
|
baseCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
baseCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
baseCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
baseCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
SXSSFSheet sheet = wb.createSheet();
|
|
SXSSFSheet sheet = wb.createSheet();
|
|
- AtomicInteger columnIndex = new AtomicInteger(0);
|
|
|
|
|
|
+ AtomicInteger rowIndex = new AtomicInteger(0);
|
|
// 表头
|
|
// 表头
|
|
- Row headerRow = sheet.createRow(columnIndex.getAndIncrement());
|
|
|
|
- List<String> headers = Stream.of("建筑id", "单位", "维修建筑", "维修类别", "维修内容", "账期时间",
|
|
|
|
- "本年累计发生频率", "排名", "202301至今累计发生频率").toList();
|
|
|
|
|
|
+ Row headerRow = sheet.createRow(rowIndex.getAndIncrement());
|
|
|
|
+ List<String> headers = Stream.of("局址编号", "局址别名", "单位", "维修建筑", "维修类别", "维修内容",
|
|
|
|
+ "账期时间", "本年累计发生频率", "排名", "202301至今累计发生频率").toList();
|
|
int headerLength = headers.size();
|
|
int headerLength = headers.size();
|
|
for (int i = 0; i < headerLength; i++) {
|
|
for (int i = 0; i < headerLength; i++) {
|
|
Cell cell = headerRow.createCell(i);
|
|
Cell cell = headerRow.createCell(i);
|
|
@@ -308,55 +341,210 @@ public class HouseWzHouseMaintenaCostService {
|
|
sheet.setColumnWidth(i, columnWidth);
|
|
sheet.setColumnWidth(i, columnWidth);
|
|
}
|
|
}
|
|
// 数据
|
|
// 数据
|
|
- for (HouseBuildingSameRepairFrequencyPo houseBuildingSameRepairFrequencyPo : list) {
|
|
|
|
- Row row = sheet.createRow(columnIndex.getAndIncrement());
|
|
|
|
- // 建筑id
|
|
|
|
- Cell a = row.createCell(CellReference.convertColStringToIndex("a"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getBuildingId() != null) {
|
|
|
|
- a.setCellValue(houseBuildingSameRepairFrequencyPo.getBuildingId());
|
|
|
|
|
|
+ for (HouseBuildingSameRepairFrequencyPo po : list) {
|
|
|
|
+ AtomicInteger columnIndex = new AtomicInteger(0);
|
|
|
|
+ Row row = sheet.createRow(rowIndex.getAndIncrement());
|
|
|
|
+ // 局址编号
|
|
|
|
+ Cell siteNumCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getSiteName() != null) {
|
|
|
|
+ siteNumCell.setCellValue(po.getSiteNum());
|
|
|
|
+ }
|
|
|
|
+ // 局址别名
|
|
|
|
+ Cell siteNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getSiteName() != null) {
|
|
|
|
+ siteNameCell.setCellValue(po.getSiteName());
|
|
}
|
|
}
|
|
// 二级单位
|
|
// 二级单位
|
|
- Cell b = row.createCell(CellReference.convertColStringToIndex("b"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getAreaName() != null) {
|
|
|
|
- b.setCellValue(houseBuildingSameRepairFrequencyPo.getAreaName());
|
|
|
|
|
|
+ Cell areaNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getAreaName() != null) {
|
|
|
|
+ areaNameCell.setCellValue(po.getAreaName());
|
|
}
|
|
}
|
|
// 维修建筑
|
|
// 维修建筑
|
|
- Cell c = row.createCell(CellReference.convertColStringToIndex("c"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getBuildingName() != null) {
|
|
|
|
- c.setCellValue(houseBuildingSameRepairFrequencyPo.getBuildingName());
|
|
|
|
|
|
+ Cell buildingNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingName() != null) {
|
|
|
|
+ buildingNameCell.setCellValue(po.getBuildingName());
|
|
}
|
|
}
|
|
// 维修类别
|
|
// 维修类别
|
|
- Cell d = row.createCell(CellReference.convertColStringToIndex("d"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getRepairType() != null) {
|
|
|
|
- d.setCellValue(houseBuildingSameRepairFrequencyPo.getRepairType());
|
|
|
|
|
|
+ Cell repairTypeCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getRepairType() != null) {
|
|
|
|
+ repairTypeCell.setCellValue(po.getRepairType());
|
|
}
|
|
}
|
|
// 维修内容
|
|
// 维修内容
|
|
- Cell e = row.createCell(CellReference.convertColStringToIndex("e"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getContentCategory() != null) {
|
|
|
|
- e.setCellValue(houseBuildingSameRepairFrequencyPo.getContentCategory());
|
|
|
|
|
|
+ Cell contentCategoryCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getContentCategory() != null) {
|
|
|
|
+ contentCategoryCell.setCellValue(po.getContentCategory());
|
|
}
|
|
}
|
|
// 账期时间
|
|
// 账期时间
|
|
- Cell f = row.createCell(CellReference.convertColStringToIndex("f"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getYearMonth() != null) {
|
|
|
|
- f.setCellValue(houseBuildingSameRepairFrequencyPo.getYearMonth());
|
|
|
|
|
|
+ Cell yearMonthCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getYearMonth() != null) {
|
|
|
|
+ yearMonthCell.setCellValue(po.getYearMonth());
|
|
}
|
|
}
|
|
// 本年累计发生频率
|
|
// 本年累计发生频率
|
|
- Cell g = row.createCell(CellReference.convertColStringToIndex("g"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getTyTotal() != null) {
|
|
|
|
- g.setCellValue(houseBuildingSameRepairFrequencyPo.getTyTotal());
|
|
|
|
|
|
+ Cell tyTotalCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getTyTotal() != null) {
|
|
|
|
+ tyTotalCell.setCellValue(po.getTyTotal());
|
|
}
|
|
}
|
|
- g.setCellStyle(numberCellStyle);
|
|
|
|
|
|
+ tyTotalCell.setCellStyle(numberCellStyle);
|
|
// 排名
|
|
// 排名
|
|
- Cell h = row.createCell(CellReference.convertColStringToIndex("h"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getTyTotalRank() != null) {
|
|
|
|
- h.setCellValue(houseBuildingSameRepairFrequencyPo.getTyTotalRank());
|
|
|
|
|
|
+ Cell tyTotalRankCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getTyTotalRank() != null) {
|
|
|
|
+ tyTotalRankCell.setCellValue(po.getTyTotalRank());
|
|
}
|
|
}
|
|
// 202301至今累计发生频率
|
|
// 202301至今累计发生频率
|
|
- Cell i = row.createCell(CellReference.convertColStringToIndex("i"));
|
|
|
|
- if (houseBuildingSameRepairFrequencyPo.getHistoryTotal() != null) {
|
|
|
|
- i.setCellValue(houseBuildingSameRepairFrequencyPo.getHistoryTotal());
|
|
|
|
|
|
+ Cell historyTotalCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getHistoryTotal() != null) {
|
|
|
|
+ historyTotalCell.setCellValue(po.getHistoryTotal());
|
|
|
|
+ }
|
|
|
|
+ historyTotalCell.setCellStyle(numberCellStyle);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public R queryDailyModify(ListBuildingHighSporadicRepairDto dto) {
|
|
|
|
+ Page<HouseBuildingHighSporadicRepairPo> page = new Page<>(dto.getPage().getPageNum(), dto.getPage().getPageSize());
|
|
|
|
+ List<HouseBuildingHighSporadicRepairPo> list = getHouseBuildingHighSporadicRepairPos(dto, page);
|
|
|
|
+ List<ListBuildingHighSporadicRepairVo> vos = new ArrayList<>();
|
|
|
|
+ for (HouseBuildingHighSporadicRepairPo po : list) {
|
|
|
|
+ vos.add(new ListBuildingHighSporadicRepairVo(po));
|
|
|
|
+ }
|
|
|
|
+ PageUtils pageUtil = new PageUtils(vos, page);
|
|
|
|
+ return R.ok().put("page", pageUtil);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询不动产自有房产高额零星维修统计
|
|
|
|
+ */
|
|
|
|
+ private List<HouseBuildingHighSporadicRepairPo> getHouseBuildingHighSporadicRepairPos(
|
|
|
|
+ ListBuildingHighSporadicRepairDto dto, Page<HouseBuildingHighSporadicRepairPo> page) {
|
|
|
|
+ ListBuildingHighSporadicRepairBo bo = new ListBuildingHighSporadicRepairBo();
|
|
|
|
+ if (dto.getMap() != null && dto.getMap().getStatisticalMonth() != null) {
|
|
|
|
+ bo.setYearMonth(dto.getMap().getStatisticalMonth());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getCity()) && !"全省".equals(dto.getMap().getCity())) {
|
|
|
|
+ bo.setAreaNo(dto.getMap().getCity());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getCounty())) {
|
|
|
|
+ bo.setCityNo(dto.getMap().getCounty());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getBuildingAddressNumber())) {
|
|
|
|
+ bo.setSiteNum(dto.getMap().getBuildingAddressNumber());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && StringUtils.hasText(dto.getMap().getBuildingNameAlias())) {
|
|
|
|
+ bo.setSiteName(dto.getMap().getBuildingNameAlias());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getMap() != null && dto.getMap().getOrder() != null && dto.getMap().getSidx() != null) {
|
|
|
|
+ if (OrderEnum.asc.equals(dto.getMap().getOrder())) {
|
|
|
|
+ page.addOrder(OrderItem.asc(dto.getMap().getSidx().getColumnName()));
|
|
|
|
+ } else {
|
|
|
|
+ page.addOrder(OrderItem.desc(dto.getMap().getSidx().getColumnName()));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ page.addOrder(OrderItem.desc(ListBuildingHighSporadicRepairOrderEnum.erpMoney.getColumnName()));
|
|
|
|
+ }
|
|
|
|
+ return houseRepairExceptionDao.ListBuildingHighSporadicRepair(page, bo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void queryDailyModifyExport(ListBuildingHighSporadicRepairDto dto) {
|
|
|
|
+ ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder
|
|
|
|
+ .getRequestAttributes();
|
|
|
|
+ if (servletRequestAttributes == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ HttpServletResponse response = servletRequestAttributes.getResponse();
|
|
|
|
+ if (response == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ String filename = "维修异常监控_高额日常零星维修"
|
|
|
|
+ + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + URLEncodeUtil.encode(filename));
|
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
|
+ try (SXSSFWorkbook wb = new SXSSFWorkbook()) {
|
|
|
|
+ writeQueryDailyModify(dto, wb);
|
|
|
|
+ wb.write(response.getOutputStream());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 写高额日常零星维修文件
|
|
|
|
+ */
|
|
|
|
+ private void writeQueryDailyModify(ListBuildingHighSporadicRepairDto dto, SXSSFWorkbook wb) {
|
|
|
|
+ Page<HouseBuildingHighSporadicRepairPo> page = new Page<>(1, Long.MAX_VALUE);
|
|
|
|
+ List<HouseBuildingHighSporadicRepairPo> list = getHouseBuildingHighSporadicRepairPos(dto, page);
|
|
|
|
+ DataFormat dataFormat = wb.createDataFormat();
|
|
|
|
+ // 数字样式
|
|
|
|
+ CellStyle numberCellStyle = wb.createCellStyle();
|
|
|
|
+ numberCellStyle.setDataFormat(dataFormat.getFormat("#,##0.00"));
|
|
|
|
+ numberCellStyle.setAlignment(HorizontalAlignment.RIGHT);
|
|
|
|
+ // 默认样式
|
|
|
|
+ CellStyle baseCellStyle = wb.createCellStyle();
|
|
|
|
+ baseCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ baseCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ SXSSFSheet sheet = wb.createSheet();
|
|
|
|
+ AtomicInteger rowIndex = new AtomicInteger(0);
|
|
|
|
+ // 表头
|
|
|
|
+ Row headerRow = sheet.createRow(rowIndex.getAndIncrement());
|
|
|
|
+ List<String> headers = Stream.of("单位", "维修建筑", "维修时间", "局址编号",
|
|
|
|
+ "局址别名", "维修类型", "维修内容", "维修金额", "本年超万元次数").toList();
|
|
|
|
+ int headerLength = headers.size();
|
|
|
|
+ for (int i = 0; i < headerLength; i++) {
|
|
|
|
+ Cell cell = headerRow.createCell(i);
|
|
|
|
+ cell.setCellValue(headers.get(i));
|
|
|
|
+ cell.setCellStyle(baseCellStyle);
|
|
|
|
+ // 根据内容长度设置列宽
|
|
|
|
+ int columnWidth = headers.get(i).length() * 256 * 2 + 256;
|
|
|
|
+ sheet.setColumnWidth(i, columnWidth);
|
|
|
|
+ }
|
|
|
|
+ // 数据
|
|
|
|
+ for (HouseBuildingHighSporadicRepairPo po : list) {
|
|
|
|
+ AtomicInteger columnIndex = new AtomicInteger(0);
|
|
|
|
+ Row row = sheet.createRow(rowIndex.getAndIncrement());
|
|
|
|
+ // 二级单位
|
|
|
|
+ Cell areaNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getAreaName() != null) {
|
|
|
|
+ areaNameCell.setCellValue(po.getAreaName());
|
|
|
|
+ }
|
|
|
|
+ // 维修建筑
|
|
|
|
+ Cell buildingNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getBuildingName() != null) {
|
|
|
|
+ buildingNameCell.setCellValue(po.getBuildingName());
|
|
|
|
+ }
|
|
|
|
+ // 维修时间
|
|
|
|
+ Cell repairYearMonthCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getRepairYearMonth() != null) {
|
|
|
|
+ repairYearMonthCell.setCellValue(po.getRepairYearMonth());
|
|
|
|
+ }
|
|
|
|
+ // 局址编号
|
|
|
|
+ Cell siteNumCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getSiteName() != null) {
|
|
|
|
+ siteNumCell.setCellValue(po.getSiteNum());
|
|
|
|
+ }
|
|
|
|
+ // 局址别名
|
|
|
|
+ Cell siteNameCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getSiteName() != null) {
|
|
|
|
+ siteNameCell.setCellValue(po.getSiteName());
|
|
|
|
+ }
|
|
|
|
+ // 维修类型
|
|
|
|
+ Cell repairTypeCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getRepairType() != null) {
|
|
|
|
+ repairTypeCell.setCellValue(po.getRepairType());
|
|
|
|
+ }
|
|
|
|
+ // 维修内容
|
|
|
|
+ Cell repairContentCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getRepairContent() != null) {
|
|
|
|
+ repairContentCell.setCellValue(po.getRepairContent());
|
|
|
|
+ }
|
|
|
|
+ // 维修金额
|
|
|
|
+ Cell amountCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getAmount() != null) {
|
|
|
|
+ amountCell.setCellValue(po.getAmount().doubleValue());
|
|
|
|
+ }
|
|
|
|
+ amountCell.setCellStyle(numberCellStyle);
|
|
|
|
+ // 本年超万元次数
|
|
|
|
+ Cell totalCell = row.createCell(columnIndex.getAndIncrement());
|
|
|
|
+ if (po.getTotal() != null) {
|
|
|
|
+ totalCell.setCellValue(po.getTotal());
|
|
}
|
|
}
|
|
- i.setCellStyle(numberCellStyle);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|