Browse Source

1.新增借阅信息导出

2.新增档案在库、借阅状态
master
xia 3 years ago
parent
commit
a4248be7b9
  1. 27
      archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java
  2. 24
      archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java
  3. 18
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
  4. 13
      archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java
  5. 103
      archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java

27
archives/src/main/java/com/storeroom/modules/archives/controller/BorrowController.java

@ -12,14 +12,19 @@ import com.storeroom.utils.ApiResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.sql.Time; import java.sql.Time;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
@RestController @RestController
@ -28,6 +33,8 @@ import java.util.List;
@RequestMapping("/api/borrow") @RequestMapping("/api/borrow")
public class BorrowController { public class BorrowController {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
private final BorrowService borrowService; private final BorrowService borrowService;
@ApiOperation("判断借阅流程管理在线离线") @ApiOperation("判断借阅流程管理在线离线")
@ -222,12 +229,26 @@ public class BorrowController {
HttpServletResponse response, HttpServletResponse response,
@RequestParam("orderNos") List<String> orderNos @RequestParam("orderNos") List<String> orderNos
){ ){
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
List<BorrowBillDetailsVO> bills = new ArrayList<>(); List<BorrowBillDetailsVO> bills = new ArrayList<>();
for(String orderNo:orderNos){ for(String orderNo:orderNos){
bills.add(borrowService.initBillDetailsByOrderNo(orderNo));
BorrowBillDetailsVO vo = borrowService.initBillDetailsByOrderNo(orderNo);
if(null!=vo){
bills.add(vo);
}
}
bills.removeAll(Collections.singleton(null));
XSSFWorkbook wb = ExcelUtil.createBorrowerExcel("借还记录",bills);
try {
ExcelUtil.setResponseHeader(response, "借还记录"+format.format(new Date())+".xls");
OutputStream os = response.getOutputStream();
wb.write(os);
os.flush();
os.close();
} catch (Exception e) {
e.printStackTrace();
} }
ExcelUtil.createBorrowerExcel("测试",bills);
} }

24
archives/src/main/java/com/storeroom/modules/archives/repository/BorrowArchivesRepository.java

@ -47,6 +47,16 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
value = "update borrow_archives set borrow_type = ?2 where id in ?1 ") value = "update borrow_archives set borrow_type = ?2 where id in ?1 ")
void updateAllTypeByRbIds(List<String> rbIds,Integer borrowType); void updateAllTypeByRbIds(List<String> rbIds,Integer borrowType);
@Modifying
@Query(nativeQuery = true,
value = "update borrow_archives set borrow_type = ?2,start_time = now() where id in (select ba_id from borrow_bill_archives where bill_id in ?1)")
void billBorrowConfirm(List<String> rbIds,Integer borrowType);
@Modifying
@Query(nativeQuery = true,
value = "update borrow_archives set borrow_type = ?2,end_time = now() where id in ?1 ")
void archivesReturnConfirm(List<String> rbIds,Integer borrowType);
@Modifying @Modifying
@Query(nativeQuery = true, @Query(nativeQuery = true,
value = "delete from borrow_archives where id in (select ba_id from borrow_bill_archives where bill_id in ?1)") value = "delete from borrow_archives where id in (select ba_id from borrow_bill_archives where bill_id in ?1)")
@ -97,8 +107,8 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
"inner join borrow_bill_archives bba on ba.id = bba.ba_id " + "inner join borrow_bill_archives bba on ba.id = bba.ba_id " +
"inner join borrow_bill bbl on bba.bill_id = bbl.id " + "inner join borrow_bill bbl on bba.bill_id = bbl.id " +
"inner join borrower br on bbl.borrower_id = br.id " + "inner join borrower br on bbl.borrower_id = br.id " +
"where ba.borrow_type = 3 " +
"and if(?1 is null,1=1,bbl.id like ?1) " +
"where " +
"if(?1 is null,1=1,bbl.id like ?1) " +
"and if(?2 is null,1=1,br.borrower_name like ?2) " + "and if(?2 is null,1=1,br.borrower_name like ?2) " +
"and if(?3 is null,1=1,br.phone like ?3) " + "and if(?3 is null,1=1,br.phone like ?3) " +
"and if(?4 is null,1=1,ba.archive_no like ?4) " + "and if(?4 is null,1=1,ba.archive_no like ?4) " +
@ -107,11 +117,11 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
"and if(?7 is null,1=1,ba.barcode like ?7) " + "and if(?7 is null,1=1,ba.barcode like ?7) " +
"and if(?8 is null,1=1,ba.tid like ?8) " + "and if(?8 is null,1=1,ba.tid like ?8) " +
"and if(?10 is null,1=1,ba.maintitle like ?10) " + "and if(?10 is null,1=1,ba.maintitle like ?10) " +
"and if(?9 is null,1=1,if(?9 = 5,bbl.borrow_end < DATE(now()),if(?9 = 4,bbl.borrow_type = ?9,ba.borrow_type = ?9))) ",
"and if(?9 is null,1=1,if(?9 = 5,bbl.borrow_type = 3 and bbl.borrow_end < DATE(now()),if(?9 = 4,bbl.borrow_type = ?9,ba.borrow_type = ?9))) ",
value = "select ba.id as id,bbl.id as orderNo,ba.category_name as categoryName,ba.archive_no as archiveNo,ba.maintitle," + value = "select ba.id as id,bbl.id as orderNo,ba.category_name as categoryName,ba.archive_no as archiveNo,ba.maintitle," +
"ba.case_name as caseName,ba.folder_location_details as folderLocationDetails,br.borrower_name as borrowerName," + "ba.case_name as caseName,ba.folder_location_details as folderLocationDetails,br.borrower_name as borrowerName," +
"bbl.borrow_start as borrowStart,bbl.borrow_end as borrowEnd,bbl.purpose,bbl.create_by as createBy,bbl.create_time as createTime," + "bbl.borrow_start as borrowStart,bbl.borrow_end as borrowEnd,bbl.purpose,bbl.create_by as createBy,bbl.create_time as createTime," +
"ba.end_time as endTime," +
"ba.start_time as startTime,ba.end_time as endTime," +
"CASE WHEN ba.borrow_type = 1 then '待登记' " + "CASE WHEN ba.borrow_type = 1 then '待登记' " +
"WHEN ba.borrow_type = 2 then '待借阅' " + "WHEN ba.borrow_type = 2 then '待借阅' " +
"WHEN ba.borrow_type = 3 && bbl.borrow_end < DATE(now()) THEN '逾期' " + "WHEN ba.borrow_type = 3 && bbl.borrow_end < DATE(now()) THEN '逾期' " +
@ -121,8 +131,8 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
"inner join borrow_bill_archives bba on ba.id = bba.ba_id " + "inner join borrow_bill_archives bba on ba.id = bba.ba_id " +
"inner join borrow_bill bbl on bba.bill_id = bbl.id " + "inner join borrow_bill bbl on bba.bill_id = bbl.id " +
"inner join borrower br on bbl.borrower_id = br.id " + "inner join borrower br on bbl.borrower_id = br.id " +
"where ba.borrow_type = 3 " +
"and if(?1 is null,1=1,bbl.id like ?1) " +
"where " +
"if(?1 is null,1=1,bbl.id like ?1) " +
"and if(?2 is null,1=1,br.borrower_name like ?2) " + "and if(?2 is null,1=1,br.borrower_name like ?2) " +
"and if(?3 is null,1=1,br.phone like ?3) " + "and if(?3 is null,1=1,br.phone like ?3) " +
"and if(?4 is null,1=1,ba.archive_no like ?4) " + "and if(?4 is null,1=1,ba.archive_no like ?4) " +
@ -131,7 +141,7 @@ public interface BorrowArchivesRepository extends JpaRepository<BorrowArchives,
"and if(?7 is null,1=1,ba.barcode like ?7) " + "and if(?7 is null,1=1,ba.barcode like ?7) " +
"and if(?8 is null,1=1,ba.tid like ?8) " + "and if(?8 is null,1=1,ba.tid like ?8) " +
"and if(?10 is null,1=1,ba.maintitle like ?10) " + "and if(?10 is null,1=1,ba.maintitle like ?10) " +
"and if(?9 is null,1=1,if(?9 = 5,bbl.borrow_end < DATE(now()),if(?9 = 4,bbl.borrow_type = ?9,ba.borrow_type = ?9))) "+
"and if(?9 is null,1=1,if(?9 = 5,bbl.borrow_type = 3 and bbl.borrow_end < DATE(now()),if(?9 = 4,bbl.borrow_type = ?9,ba.borrow_type = ?9))) "+
"order by bbl.create_time desc ") "order by bbl.create_time desc ")
Page<Map<String,Object>> initBorrowLog(String orderNo, String borrowerName, String phone, String archiveNo,String folderLocationDetails, Page<Map<String,Object>> initBorrowLog(String orderNo, String borrowerName, String phone, String archiveNo,String folderLocationDetails,
String caseName, String barcode, String tid,Integer borrowType,String maintitle, Pageable page); String caseName, String barcode, String tid,Integer borrowType,String maintitle, Pageable page);

18
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java

@ -85,6 +85,22 @@ public class ArchivesServiceImpl implements ArchivesService {
appendQuery = ",(select count(1) from file_"+queryTable+" c where c.archive_id = t.id) "; appendQuery = ",(select count(1) from file_"+queryTable+" c where c.archive_id = t.id) ";
} }
String isStorageQuery = " ";
String isBorrowQuery = " ";
//是否入库
if(archivesType.getIsType()!=ArchivesTypeEnum.project.getCode()){
queryFields.add("is_storage");
//文件级/案卷级
if(archivesType.getIsType() == ArchivesTypeEnum.archives.getCode() || archivesType.getIsType() == ArchivesTypeEnum.files.getCode()){
queryFields.add("is_borrow");
isStorageQuery = ",(select ace.storage_type from archives_case_cartoning acc inner join archives_case ace on acc.case_id = ace.id where acc.parent_id = t.id limit 0,1) as is_storage ";
isBorrowQuery = ",(select ba.borrow_type from borrow_archives ba where ba.borrow_type != 4 and ba.archives_id = t.id) as is_borrow ";
}
if(archivesType.getIsType() == ArchivesTypeEnum.inChive.getCode()){
isStorageQuery = ",(select ace.storage_type from archives_case_cartoning acc inner join archives_case ace on acc.case_id = ace.id where acc.archives_id = t.id) as is_storage ";
}
}
Sort sort = page.getSort(); Sort sort = page.getSort();
Object[] objects = sort.get().toArray(); Object[] objects = sort.get().toArray();
for(Object obj:objects){ for(Object obj:objects){
@ -111,7 +127,7 @@ public class ArchivesServiceImpl implements ArchivesService {
List<Object[]> countList = entityManager.createNativeQuery("select count(1) from "+queryTable+additional+queryparentsId).getResultList(); List<Object[]> countList = entityManager.createNativeQuery("select count(1) from "+queryTable+additional+queryparentsId).getResultList();
Object count = countList.get(0); Object count = countList.get(0);
List<Object[]> list = entityManager.createNativeQuery("select "+queryField+appendQuery+" from "+queryTable+additional+queryparentsId+quertOrder
List<Object[]> list = entityManager.createNativeQuery("select "+queryField+appendQuery+isStorageQuery+isBorrowQuery+" from "+queryTable+additional+queryparentsId+quertOrder
+" limit "+page.getPageNumber()*page.getPageSize()+","+page.getPageSize()).getResultList(); +" limit "+page.getPageNumber()*page.getPageSize()+","+page.getPageSize()).getResultList();
List<Map> returnlist = new ArrayList<>(); List<Map> returnlist = new ArrayList<>();
for(Object[] objs:list){ for(Object[] objs:list){

13
archives/src/main/java/com/storeroom/modules/archives/service/impl/BorrowServiceImpl.java

@ -117,6 +117,9 @@ public class BorrowServiceImpl implements BorrowService {
public BorrowBillDetailsVO initBillDetailsByOrderNo(String orderNo) { public BorrowBillDetailsVO initBillDetailsByOrderNo(String orderNo) {
BorrowBillDetailsVO vo = new BorrowBillDetailsVO(); BorrowBillDetailsVO vo = new BorrowBillDetailsVO();
BorrowBill bill = borrowBillRepository.findBillById(orderNo); BorrowBill bill = borrowBillRepository.findBillById(orderNo);
if(null == bill){
return null;
}
BeanUtils.copyProperties(bill,vo); BeanUtils.copyProperties(bill,vo);
vo.setBorrower(borrowerRepository.findByBorrowerId(bill.getBorrowerId())); vo.setBorrower(borrowerRepository.findByBorrowerId(bill.getBorrowerId()));
vo.setBorrowArchives(borrowArchivesRepository.initArchivesByOrderNo(orderNo)); vo.setBorrowArchives(borrowArchivesRepository.initArchivesByOrderNo(orderNo));
@ -163,14 +166,14 @@ public class BorrowServiceImpl implements BorrowService {
@Override @Override
public Object readyBorrowShowTid(List<String> orderNos) { public Object readyBorrowShowTid(List<String> orderNos) {
Map<String,Object> map = new HashMap<>();
// Map<String,Object> map = new HashMap<>();
//根据单据号获取有标签的档案基本信息 //根据单据号获取有标签的档案基本信息
List<Map<String,Object>> archives = borrowBillRepository.findArchivesTidByOrderNos(orderNos); List<Map<String,Object>> archives = borrowBillRepository.findArchivesTidByOrderNos(orderNos);
//根据单据号获取所有有标签的盒信息 //根据单据号获取所有有标签的盒信息
// List<Map<String,Object>> cases = borrowBillRepository.findCaseidByOrderNos(orderNos); // List<Map<String,Object>> cases = borrowBillRepository.findCaseidByOrderNos(orderNos);
map.put("archives",archives);
// map.put("archives",archives);
// map.put("cases",cases); // map.put("cases",cases);
return map;
return archives;
} }
@Override @Override
@ -183,7 +186,7 @@ public class BorrowServiceImpl implements BorrowService {
@Transactional @Transactional
public Object billBorrowConfirm(List<String> orderNos) { public Object billBorrowConfirm(List<String> orderNos) {
//更改清单内档案状态 //更改清单内档案状态
borrowArchivesRepository.updateAllTypeByOrderNos(orderNos,3);
borrowArchivesRepository.billBorrowConfirm(orderNos,3);
//更改清单状态 //更改清单状态
borrowBillRepository.updateBorrowTypeByOrderNos(orderNos,3); borrowBillRepository.updateBorrowTypeByOrderNos(orderNos,3);
return orderNos.size(); return orderNos.size();
@ -209,7 +212,7 @@ public class BorrowServiceImpl implements BorrowService {
public Object archivesReturnConfirm(List<String> rbIds) { public Object archivesReturnConfirm(List<String> rbIds) {
try { try {
//更新关联档案状态 //更新关联档案状态
borrowArchivesRepository.updateAllTypeByRbIds(rbIds,4);
borrowArchivesRepository.archivesReturnConfirm(rbIds,4);
//根据关联档案id获取相关所有单据 //根据关联档案id获取相关所有单据
List<String> orderNos = borrowBillRepository.findOrderIdsByRbId(rbIds); List<String> orderNos = borrowBillRepository.findOrderIdsByRbId(rbIds);
//更新相关单据状态 //更新相关单据状态

103
archives/src/main/java/com/storeroom/modules/common/ExcelUtil.java

@ -1,20 +1,28 @@
package com.storeroom.modules.common; package com.storeroom.modules.common;
import com.storeroom.modules.archives.domain.BorrowArchives;
import com.storeroom.modules.archives.domain.vo.BorrowBillDetailsVO; import com.storeroom.modules.archives.domain.vo.BorrowBillDetailsVO;
import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*; import org.apache.poi.xssf.usermodel.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
public class ExcelUtil { public class ExcelUtil {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private static SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
/** /**
* 导出Excel * 导出Excel
* @param sheetName sheet名称 * @param sheetName sheet名称
@ -97,15 +105,106 @@ public class ExcelUtil {
textStyle.setBorderBottom(BorderStyle.THIN); textStyle.setBorderBottom(BorderStyle.THIN);
textStyle.setBorderRight(BorderStyle.THIN); textStyle.setBorderRight(BorderStyle.THIN);
textStyle.setBorderLeft(BorderStyle.THIN); textStyle.setBorderLeft(BorderStyle.THIN);
textStyle.setBorderTop(BorderStyle.THIN);
textStyle.setFont(dataSetFont); textStyle.setFont(dataSetFont);
// 数据内容对齐方式居中 // 数据内容对齐方式居中
textStyle.setAlignment(HorizontalAlignment.CENTER); textStyle.setAlignment(HorizontalAlignment.CENTER);
textStyle.setVerticalAlignment(VerticalAlignment.CENTER);
// //
int index = 0; int index = 0;
String[] billTitle = {"单据号","借阅人","所属部门","证件类型","证件号码","电话号码","借阅目的","借阅日期","操作时间","借阅状态"};
String[] archivesTitle = {"序号","门类名称","题名","档号","盒名称","","存放位置","","借阅状态"};
for(BorrowBillDetailsVO vo:bills){
//清单title
XSSFRow billTitleRow = sheet.createRow(index);
List<BorrowArchives> borrowArchives = vo.getBorrowArchives();
for(int i = 0;i<billTitle.length;i++){
XSSFCell cell = billTitleRow.createCell(i);
cell.setCellStyle(textStyle);
cell.setCellValue(billTitle[i]);
}
index++;
//清单值
XSSFRow billValueRow = sheet.createRow(index);
XSSFCell billValueCell0 = billValueRow.createCell(0);billValueCell0.setCellValue(vo.getId());billValueCell0.setCellStyle(textStyle);
XSSFCell billValueCell1 = billValueRow.createCell(1);billValueCell1.setCellValue(vo.getBorrower().getBorrowerName());billValueCell1.setCellStyle(textStyle);
XSSFCell billValueCell2 = billValueRow.createCell(2);billValueCell2.setCellValue(vo.getBorrower().getDepartment());billValueCell2.setCellStyle(textStyle);
XSSFCell billValueCell3 = billValueRow.createCell(3);billValueCell3.setCellValue(vo.getBorrower().getCardType());billValueCell3.setCellStyle(textStyle);
XSSFCell billValueCell4 = billValueRow.createCell(4);billValueCell4.setCellValue(vo.getBorrower().getIdcard());billValueCell4.setCellStyle(textStyle);
XSSFCell billValueCell5 = billValueRow.createCell(5);billValueCell5.setCellValue(vo.getBorrower().getPhone());billValueCell5.setCellStyle(textStyle);
XSSFCell billValueCell6 = billValueRow.createCell(6);billValueCell6.setCellValue(vo.getPurpose());billValueCell6.setCellStyle(textStyle);
XSSFCell billValueCell7 = billValueRow.createCell(7);billValueCell7.setCellValue(sdf.format(new Date(vo.getBorrowStart().getTime())) +"至" + sdf.format(new Date(vo.getBorrowEnd().getTime())));billValueCell7.setCellStyle(textStyle);
XSSFCell billValueCell8 = billValueRow.createCell(8);billValueCell8.setCellValue(sdf1.format(new Date(vo.getCreateTime().getTime())));billValueCell8.setCellStyle(textStyle);
Integer borrowType = vo.getBorrowType();
String showBorrowType = "";
if(borrowType==2){
showBorrowType = "待借阅";
}else if(borrowType==3 && vo.getBorrowEnd().getTime() >= new Timestamp(System.currentTimeMillis()).getTime()){
showBorrowType = "待归还";
}else if(borrowType==3 && vo.getBorrowEnd().getTime() < new Timestamp(System.currentTimeMillis()).getTime()){
showBorrowType = "逾期";
}else if(borrowType == 4){
showBorrowType = "已归还";
}
XSSFCell billValueCell9 = billValueRow.createCell(9);billValueCell9.setCellValue(showBorrowType);billValueCell9.setCellStyle(textStyle);
Integer billRowStart = index;
if(null!=borrowArchives && borrowArchives.size()!=0){
index++;
XSSFRow archivesTitleRow = sheet.createRow(index);
XSSFCell cell0 = archivesTitleRow.createCell(0);cell0.setCellStyle(textStyle);
for(int i = 0;i<archivesTitle.length;i++){
XSSFCell cell = archivesTitleRow.createCell(i+1);
cell.setCellStyle(textStyle);
cell.setCellValue(archivesTitle[i]);
}
sheet.addMergedRegion(new CellRangeAddress(index, index, 5, 6));
sheet.addMergedRegion(new CellRangeAddress(index, index, 7, 8));
for (int ba = 0;ba<borrowArchives.size();ba++){
index++;
BorrowArchives borrowArchive = borrowArchives.get(ba);
XSSFRow archivesValueRow = sheet.createRow(index);
XSSFCell baValueCell0 = archivesValueRow.createCell(0);baValueCell0.setCellStyle(textStyle);
XSSFCell baValueCell1 = archivesValueRow.createCell(1);baValueCell1.setCellValue(ba+1);baValueCell1.setCellStyle(textStyle);
XSSFCell baValueCell2 = archivesValueRow.createCell(2);baValueCell2.setCellValue(borrowArchive.getCategoryName());baValueCell2.setCellStyle(textStyle);
XSSFCell baValueCell3 = archivesValueRow.createCell(3);baValueCell3.setCellValue(borrowArchive.getMaintitle());baValueCell3.setCellStyle(textStyle);
XSSFCell baValueCell4 = archivesValueRow.createCell(4);baValueCell4.setCellValue(borrowArchive.getArchiveNo());baValueCell4.setCellStyle(textStyle);
XSSFCell baValueCell5 = archivesValueRow.createCell(5);baValueCell5.setCellValue(borrowArchive.getCaseName());baValueCell5.setCellStyle(textStyle);
XSSFCell baValueCell6 = archivesValueRow.createCell(6);baValueCell6.setCellStyle(textStyle);
XSSFCell baValueCell7 = archivesValueRow.createCell(7);baValueCell7.setCellValue(borrowArchive.getFolderLocationDetails());baValueCell7.setCellStyle(textStyle);
XSSFCell baValueCell8 = archivesValueRow.createCell(8);baValueCell8.setCellStyle(textStyle);
Integer borrowArchiType = borrowArchive.getBorrowType();
String showBorrowArchiType = "";
if(borrowArchiType==2){
showBorrowArchiType = "待借阅";
}else if(borrowArchiType==3 && borrowArchive.getEndTime().getTime() >= new Timestamp(System.currentTimeMillis()).getTime()){
showBorrowArchiType = "待归还";
}else if(borrowArchiType==3 && borrowArchive.getEndTime().getTime() < new Timestamp(System.currentTimeMillis()).getTime()){
showBorrowArchiType = "逾期";
}else if(borrowArchiType == 4){
showBorrowArchiType = "已归还";
}
XSSFCell baValueCell9 = archivesValueRow.createCell(9);baValueCell9.setCellValue(showBorrowArchiType);baValueCell9.setCellStyle(textStyle);
sheet.addMergedRegion(new CellRangeAddress(index, index, 5, 6));
sheet.addMergedRegion(new CellRangeAddress(index, index, 7, 8));
}
Integer billRowEnd = index;
sheet.addMergedRegion(new CellRangeAddress(billRowStart, billRowEnd, 0, 0));
}
index++;
XSSFRow nullRow = sheet.createRow(index);
index++;
}
//自适应单元格
for (int i = 0; i < sheet.getLastRowNum(); i++) {
sheet.autoSizeColumn(i);
sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 17 / 10);
}
return workbook; return workbook;
} }

Loading…
Cancel
Save