This commit is contained in:
parent
dd107d2b33
commit
2689832540
|
|
@ -0,0 +1,388 @@
|
|||
package com.bonus.sgzb.common.core.utils.poi;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.RegionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2025/4/17 10:02
|
||||
*/
|
||||
public class PoiOutPage {
|
||||
|
||||
/**
|
||||
* 生成带有样式的 Excel 文件
|
||||
* @param result
|
||||
* @param list
|
||||
* @param filename
|
||||
* @return
|
||||
*/
|
||||
public static HSSFWorkbook excel(List<Map<String, Object>> result, List<String> list, String filename) {
|
||||
// 获取工作簿对象
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFSheet sheet = workbook.createSheet();
|
||||
HSSFCellStyle titleStyle = createTitleStyle(workbook);
|
||||
HSSFCellStyle headerStyle = createHeaderStyle(workbook);
|
||||
HSSFCellStyle contentStyle = createCellStyle(workbook);
|
||||
|
||||
// 设置默认列宽
|
||||
sheet.setDefaultColumnWidth(15);
|
||||
|
||||
// 设置工作簿名称
|
||||
workbook.setSheetName(0, filename);
|
||||
|
||||
// 如果数据为空,创建一个空的工作表
|
||||
if (result == null || result.size() == 0) {
|
||||
createEmptySheet(sheet, list, titleStyle, headerStyle, filename);
|
||||
} else {
|
||||
// 如果数据不为空,创建工作表并填充数据
|
||||
int nColumn = list.size();
|
||||
int rowNum = createTitleRow(sheet, titleStyle, filename, nColumn);
|
||||
rowNum = createHeaderRow(sheet, headerStyle, list, rowNum);
|
||||
createDataRows(sheet, result, contentStyle, nColumn, rowNum);
|
||||
}
|
||||
|
||||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建标题行
|
||||
* @param sheet
|
||||
* @param titleStyle
|
||||
* @param filename
|
||||
* @param nColumn
|
||||
* @return
|
||||
*/
|
||||
private static int createTitleRow(HSSFSheet sheet, HSSFCellStyle titleStyle, String filename, int nColumn) {
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
row.setHeightInPoints(30);
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, (short) (nColumn - 1)));
|
||||
HSSFCell cell = row.createCell(0);
|
||||
cell.setCellStyle(titleStyle);
|
||||
cell.setCellValue(filename);
|
||||
return 1; // 下一行是表头
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头行
|
||||
* @param sheet
|
||||
* @param headerStyle
|
||||
* @param list
|
||||
* @param rowNum
|
||||
* @return
|
||||
*/
|
||||
private static int createHeaderRow(HSSFSheet sheet, HSSFCellStyle headerStyle, List<String> list, int rowNum) {
|
||||
HSSFRow row = sheet.createRow(rowNum);
|
||||
row.setHeightInPoints(20);
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
HSSFCell cell = row.createCell(j);
|
||||
String header = list.get(j);
|
||||
cell.setCellStyle(headerStyle);
|
||||
cell.setCellValue(header != null ? header : "");
|
||||
}
|
||||
return rowNum + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据行
|
||||
* @param sheet
|
||||
* @param result
|
||||
* @param contentStyle
|
||||
* @param nColumn
|
||||
* @param rowNum
|
||||
*/
|
||||
private static void createDataRows(HSSFSheet sheet, List<Map<String, Object>> result, HSSFCellStyle contentStyle, int nColumn, int rowNum) {
|
||||
for (Map<String, Object> resultRow : result) {
|
||||
List<Object> rowData = map2List(resultRow);
|
||||
HSSFRow row = sheet.createRow(rowNum++);
|
||||
row.setHeightInPoints(15);
|
||||
|
||||
// 第一列:单位数据
|
||||
if (rowData.size() != nColumn) {
|
||||
HSSFCell cell = row.createCell(0);
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue(rowData.get(0).toString());
|
||||
|
||||
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 1, (short) (nColumn - 1)));
|
||||
continue;
|
||||
}
|
||||
|
||||
// 填充数据行
|
||||
for (int j = 0; j < nColumn; j++) {
|
||||
HSSFCell cell = row.createCell(j);
|
||||
Object data = rowData.get(j);
|
||||
if (data != null) {
|
||||
setCellValue(cell, contentStyle, data);
|
||||
} else {
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单元格数据
|
||||
* @param cell
|
||||
* @param contentStyle
|
||||
* @param data
|
||||
*/
|
||||
private static void setCellValue(HSSFCell cell, HSSFCellStyle contentStyle, Object data) {
|
||||
if (isNumeric(data)) {
|
||||
contentStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue(Double.parseDouble(data.toString()));
|
||||
} else {
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个空的工作表
|
||||
* @param sheet
|
||||
* @param list
|
||||
* @param titleStyle
|
||||
* @param headerStyle
|
||||
* @param filename
|
||||
*/
|
||||
private static void createEmptySheet(HSSFSheet sheet, List<String> list, HSSFCellStyle titleStyle, HSSFCellStyle headerStyle, String filename) {
|
||||
int nColumn = list.size();
|
||||
int rowNum = createTitleRow(sheet, titleStyle, filename, nColumn);
|
||||
createHeaderRow(sheet, headerStyle, list, rowNum);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成带有样式的 Excel 文件
|
||||
*
|
||||
* @param result 数据内容(每行是一个 Map)
|
||||
* @param list 表头
|
||||
* @param filename 文件名
|
||||
* @param unit 单位信息
|
||||
* @param projectName 项目名称
|
||||
* @return HSSFWorkbook 生成的 Excel 文件
|
||||
*/
|
||||
public static HSSFWorkbook excelForCheck(List<Map<String, Object>> result, List<String> list,
|
||||
String filename, String unit, String projectName) {
|
||||
// 创建工作簿和工作表
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
HSSFSheet sheet = workbook.createSheet();
|
||||
sheet.setDefaultColumnWidth(15); // 设置列宽
|
||||
|
||||
// 创建样式
|
||||
HSSFCellStyle titleStyle = createTitleStyle(workbook);
|
||||
HSSFCellStyle headerStyle = createHeaderStyle(workbook);
|
||||
HSSFCellStyle contentStyle = createCellStyle(workbook);
|
||||
|
||||
// 设置工作簿名称
|
||||
workbook.setSheetName(0, filename);
|
||||
|
||||
// 填充标题行
|
||||
int rowNum = 0;
|
||||
rowNum = createTitleRow(sheet, rowNum, filename, titleStyle, list.size());
|
||||
rowNum = createProjectInfoRow(sheet, rowNum, projectName, unit, titleStyle, list.size());
|
||||
|
||||
// 填充表头
|
||||
rowNum = createHeaderRow(sheet, rowNum, list, headerStyle);
|
||||
|
||||
// 填充数据行
|
||||
if (result != null && !result.isEmpty()) {
|
||||
rowNum = createDataRows(sheet, rowNum, result, contentStyle, list.size());
|
||||
} else {
|
||||
// 如果没有数据,则仅显示表头
|
||||
rowNum++;
|
||||
}
|
||||
|
||||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建标题行
|
||||
*/
|
||||
private static int createTitleRow(HSSFSheet sheet, int rowNum, String filename, HSSFCellStyle titleStyle, int nColumn) {
|
||||
HSSFRow row = sheet.createRow(rowNum++);
|
||||
row.setHeightInPoints(30);
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, (short) (nColumn - 1)));
|
||||
HSSFCell cell = row.createCell(0);
|
||||
cell.setCellStyle(titleStyle);
|
||||
cell.setCellValue(filename);
|
||||
return rowNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建项目名称和单位信息行
|
||||
*/
|
||||
private static int createProjectInfoRow(HSSFSheet sheet, int rowNum, String projectName, String unit,
|
||||
HSSFCellStyle titleStyle, int nColumn) {
|
||||
HSSFRow row = sheet.createRow(rowNum++);
|
||||
row.setHeightInPoints(30);
|
||||
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (nColumn - 1)));
|
||||
HSSFCell cell = row.createCell(0);
|
||||
cell.setCellStyle(titleStyle);
|
||||
cell.setCellValue(projectName + " " + unit);
|
||||
|
||||
// 添加边框
|
||||
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (nColumn - 1));
|
||||
// 设置边框样式
|
||||
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
|
||||
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
|
||||
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
|
||||
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
|
||||
|
||||
return rowNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头行
|
||||
*/
|
||||
private static int createHeaderRow(HSSFSheet sheet, int rowNum, List<String> list, HSSFCellStyle headerStyle) {
|
||||
HSSFRow row = sheet.createRow(rowNum++);
|
||||
row.setHeightInPoints(20);
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
HSSFCell cell = row.createCell(j);
|
||||
String header = list.get(j);
|
||||
cell.setCellStyle(headerStyle);
|
||||
cell.setCellValue(header != null ? header : "");
|
||||
}
|
||||
return rowNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据行
|
||||
*/
|
||||
private static int createDataRows(HSSFSheet sheet, int rowNum, List<Map<String, Object>> result,
|
||||
HSSFCellStyle contentStyle, int nColumn) {
|
||||
for (Map<String, Object> resultRow : result) {
|
||||
HSSFRow row = sheet.createRow(rowNum++);
|
||||
row.setHeightInPoints(15);
|
||||
List<Object> rowData = map2List(resultRow);
|
||||
|
||||
for (int j = 0; j < nColumn; j++) {
|
||||
HSSFCell cell = row.createCell(j);
|
||||
Object data = rowData.get(j);
|
||||
setCellData(cell, data, contentStyle);
|
||||
}
|
||||
}
|
||||
return rowNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单元格数据,并自动判断数据类型
|
||||
*/
|
||||
private static void setCellData(HSSFCell cell, Object data, HSSFCellStyle contentStyle) {
|
||||
if (data != null) {
|
||||
if (isNumeric(data)) {
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue(Double.parseDouble(data.toString()));
|
||||
} else {
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue(data.toString());
|
||||
}
|
||||
} else {
|
||||
cell.setCellStyle(contentStyle);
|
||||
cell.setCellValue("");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是数字
|
||||
*/
|
||||
private static boolean isNumeric(Object data) {
|
||||
if (data == null) {
|
||||
return false;
|
||||
}
|
||||
return data.toString().matches("^(-?\\d+)(\\.\\d+)?$");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 Map 转换为 List
|
||||
*/
|
||||
private static List<Object> map2List(Map<String, Object> map) {
|
||||
List<Object> list = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
list.add(entry.getValue());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建标题样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
public static HSSFCellStyle createTitleStyle(HSSFWorkbook workbook) {
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setBold(true);
|
||||
font.setFontHeightInPoints((short) 14);
|
||||
style.setFont(font);
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建表头样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
public static HSSFCellStyle createHeaderStyle(HSSFWorkbook workbook) {
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setBold(true);
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
style.setFont(font);
|
||||
|
||||
// 设置边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 设置边框颜色为黑色
|
||||
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建内容样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle createCellStyle(HSSFWorkbook workbook) {
|
||||
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setFontHeightInPoints((short) 10);
|
||||
style.setFont(font);
|
||||
|
||||
// 设置边框
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 设置边框颜色为黑色
|
||||
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
||||
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
|
@ -654,6 +654,17 @@ public class TmTaskController extends BaseController {
|
|||
return getDataTable(leaseAuditList);
|
||||
}
|
||||
|
||||
@Log(title = "导出领料申请任务详情", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/exportLeaseApplyListAll")
|
||||
public void exportInfo(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId,
|
||||
HttpServletResponse response) {
|
||||
TmTask task = new TmTask();
|
||||
task.setTaskId(Long.parseLong(taskId));
|
||||
task.setFlag(1);
|
||||
List<TmTask> leaseAuditList = tmTaskService.getLeaseApplyListAll(task);
|
||||
tmTaskService.exportInfo(leaseAuditList, response);
|
||||
}
|
||||
|
||||
@Log(title = "获取领料申请-驳回提交数据", businessType = BusinessType.QUERY)
|
||||
@GetMapping("/getLeaseApplyAuditListAll")
|
||||
public TableDataInfo getLeaseApplyAuditListAll(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.sgzb.base.api.domain.MaType;
|
|||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -115,4 +116,11 @@ public interface TmTaskService{
|
|||
int updateLeaseAuditListByOne(TmTask task);
|
||||
|
||||
MaType getNumISenough(MaType maType);
|
||||
|
||||
/**
|
||||
* 导出领料申请任务详情
|
||||
* @param leaseAuditList
|
||||
* @param response
|
||||
*/
|
||||
void exportInfo(List<TmTask> leaseAuditList, HttpServletResponse response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.bonus.sgzb.common.core.enums.TaskStatusEnum;
|
|||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.utils.poi.PoiOutPage;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.system.api.RemoteUserService;
|
||||
|
|
@ -23,11 +24,15 @@ import com.bonus.sgzb.system.api.domain.SysUser;
|
|||
import com.bonus.sgzb.system.api.domain.UrgentProcessingUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -720,6 +725,104 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
return numByTypeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出领料申请任务详情
|
||||
* @param leaseAuditList
|
||||
* @param response
|
||||
*/
|
||||
@Override
|
||||
public void exportInfo(List<TmTask> leaseAuditList, HttpServletResponse response) {
|
||||
try {
|
||||
String fileName = "领料申请任务详情表";
|
||||
String projectName = "";
|
||||
String unitName = "";
|
||||
List<LeaseApplyDetails> list = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(leaseAuditList)) {
|
||||
unitName = "领料单位:" + leaseAuditList.get(0).getDeptName();
|
||||
projectName = "领料工程:" + leaseAuditList.get(0).getProName();
|
||||
list = leaseAuditList.get(0).getLeaseApplyDetails();
|
||||
}
|
||||
expOutExcel(response, list, fileName, projectName, unitName);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出领料申请任务详情
|
||||
* @param response
|
||||
* @param list
|
||||
* @param fileName
|
||||
* @param projectName
|
||||
* @param unitName
|
||||
*/
|
||||
private void expOutExcel(HttpServletResponse response, List<LeaseApplyDetails> list, String fileName, String projectName, String unitName)
|
||||
throws Exception {
|
||||
if (list != null && list.size() > 0) {
|
||||
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
LeaseApplyDetails bean = list.get(i);
|
||||
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean);
|
||||
results.add(maps);
|
||||
}
|
||||
List<String> headers = receiveDetailsHeader();
|
||||
HSSFWorkbook workbook = PoiOutPage.excelForCheck(results, headers, fileName, projectName, unitName);
|
||||
OutputStream out = null;
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls");
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
out = response.getOutputStream();
|
||||
workbook.write(out);
|
||||
out.flush();
|
||||
out.close();
|
||||
}else{
|
||||
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
|
||||
List<String> headers = receiveDetailsHeader();
|
||||
HSSFWorkbook workbook = PoiOutPage.excel(results, headers, fileName);
|
||||
OutputStream out = null;
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls");
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
out = response.getOutputStream();
|
||||
workbook.write(out);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 领料任务详情数据转换
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> outReceiveDetailsBeanToMap(LeaseApplyDetails bean) {
|
||||
Map<String, Object> maps = new LinkedHashMap<String, Object>();
|
||||
maps.put("typeName", bean.getTypeName());
|
||||
maps.put("typeModelName", bean.getTypeModelName());
|
||||
maps.put("unitName", bean.getUnitName());
|
||||
maps.put("num", bean.getNum());
|
||||
maps.put("outNum", bean.getOutNum());
|
||||
maps.put("remark", bean.getRemark());
|
||||
return maps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 领料单表头
|
||||
* @return
|
||||
*/
|
||||
private List<String> receiveDetailsHeader() {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add("类型名称");
|
||||
list.add("规格型号");
|
||||
list.add("计量单位");
|
||||
list.add("库存数量");
|
||||
list.add("预领数量");
|
||||
list.add("备注");
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取领料申请列表
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.MachinePart;
|
||||
import com.bonus.sgzb.material.domain.PurchaseInput;
|
||||
import com.bonus.sgzb.material.domain.PurchaseInputVo;
|
||||
import com.bonus.sgzb.material.service.IPurchaseCheckInfoService;
|
||||
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
|
||||
import com.bonus.sgzb.material.service.PurchaseCheckServiceCenterService;
|
||||
|
|
@ -76,7 +76,7 @@ public class PurchaseCheckInfoController extends BaseController {
|
|||
@Log(title = "新购验收任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
|
||||
List<PurchaseCheckInfo> list = purchaseCheckInfoService.exportList(purchaseCheckInfo);
|
||||
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo);
|
||||
ExcelUtil<PurchaseCheckInfo> util = new ExcelUtil<PurchaseCheckInfo>(PurchaseCheckInfo.class);
|
||||
util.exportExcel(response, list, "新购验收任务数据");
|
||||
}
|
||||
|
|
@ -88,8 +88,8 @@ public class PurchaseCheckInfoController extends BaseController {
|
|||
@Log(title = "导出新购工机具入库", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/putInExport")
|
||||
public void putInExport(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
|
||||
List<PurchaseInput> list = purchaseCheckInfoService.putInExportList(purchaseCheckInfo);
|
||||
ExcelUtil<PurchaseInput> util = new ExcelUtil<PurchaseInput>(PurchaseInput.class);
|
||||
List<PurchaseInputVo> list = purchaseCheckInfoService.putInExportList(purchaseCheckInfo);
|
||||
ExcelUtil<PurchaseInputVo> util = new ExcelUtil<PurchaseInputVo>(PurchaseInputVo.class);
|
||||
util.exportExcel(response, list, "新购工机具入库");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ public class BackRecord {
|
|||
* 退料工程
|
||||
*/
|
||||
@ApiModelProperty(value = "退料工程")
|
||||
@Excel(name = "退料工程")
|
||||
@Excel(name = "退料工程", width = 60)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public class LeaseRecord{
|
|||
* 领料工程
|
||||
*/
|
||||
@ApiModelProperty(value = "领料工程")
|
||||
@Excel(name = "领料工程")
|
||||
@Excel(name = "领料工程", width = 60)
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,334 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新购工机具入库
|
||||
*
|
||||
* @author bonus
|
||||
* @date 2023-12-10
|
||||
*/
|
||||
public class PurchaseInputVo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/** 任务ID */
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value = "采购单号")
|
||||
@Excel(name = "采购单号")
|
||||
private String code;
|
||||
|
||||
/** 采购日期 */
|
||||
@ApiModelProperty(value = "采购日期")
|
||||
@Excel(name = "采购日期")
|
||||
private String purchaseTime;
|
||||
|
||||
/** 到货日期 */
|
||||
@ApiModelProperty(value = "到货日期")
|
||||
@Excel(name = "到货日期")
|
||||
private String arrivalTime;
|
||||
|
||||
/** 采购机具设备名称 */
|
||||
@ApiModelProperty(value = "采购机具设备")
|
||||
@Excel(name = "采购机具设备", width = 30)
|
||||
private String purchasingTypeName;
|
||||
|
||||
/** 采购员名称 */
|
||||
@ApiModelProperty(value = "采购员名称")
|
||||
@Excel(name = "采购员")
|
||||
private String purchaserName;
|
||||
|
||||
/** 采购员 */
|
||||
@ApiModelProperty(value = "采购员")
|
||||
private Long purchaser;
|
||||
|
||||
/** 采购机具设备型号 */
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String purchasingTypeCode;
|
||||
|
||||
/** 管理模式 */
|
||||
@ApiModelProperty(value = "管理模式")
|
||||
private String manageType;
|
||||
|
||||
/** 机具厂家 */
|
||||
@ApiModelProperty(value = "机具厂家")
|
||||
private String supplier;
|
||||
|
||||
/** 采购数量 */
|
||||
@ApiModelProperty(value = "采购数量")
|
||||
private String purchaseNum;
|
||||
|
||||
/** 验收数量 */
|
||||
@ApiModelProperty(value = "验收数量")
|
||||
private String checkNum;
|
||||
|
||||
/** 采购状态 */
|
||||
@ApiModelProperty(value = "采购状态")
|
||||
private String purchasingStatus;
|
||||
|
||||
/** 入库人员 */
|
||||
@ApiModelProperty(value = "入库人员")
|
||||
@Excel(name = "入库人员")
|
||||
private String inputUser;
|
||||
|
||||
/** 入库时间 */
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
@Excel(name = "入库时间", width = 30)
|
||||
private String inputTime;
|
||||
|
||||
@ApiModelProperty(value = "发布时间")
|
||||
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date publishTime;
|
||||
|
||||
/** 入库状态 */
|
||||
@ApiModelProperty(value = "入库状态")
|
||||
@Excel(name = "状态")
|
||||
private String inputStatus;
|
||||
|
||||
|
||||
/** 不通过原因 */
|
||||
@ApiModelProperty(value = "不通过原因")
|
||||
private String reason;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Integer companyId;
|
||||
|
||||
public String getKeyWord() {
|
||||
return keyWord;
|
||||
}
|
||||
|
||||
public void setKeyWord(String keyWord) {
|
||||
this.keyWord = keyWord;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "新购验收任务详情")
|
||||
private List<PurchaseCheckDetails> checkDetailsList;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务状态(定义数据字典)
|
||||
*/
|
||||
@ApiModelProperty(value="任务状态(数据字典)")
|
||||
private Integer taskStatus;
|
||||
private String keyWord;
|
||||
|
||||
public void setPublishTime(Date publishTime)
|
||||
{
|
||||
this.publishTime = publishTime;
|
||||
}
|
||||
|
||||
public Date getPublishTime()
|
||||
{
|
||||
return publishTime;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setTaskId(Long taskId)
|
||||
{
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Long getTaskId()
|
||||
{
|
||||
return taskId;
|
||||
}
|
||||
public void setPurchaseTime(String purchaseTime)
|
||||
{
|
||||
this.purchaseTime = purchaseTime;
|
||||
}
|
||||
|
||||
public String getPurchaseTime()
|
||||
{
|
||||
return purchaseTime;
|
||||
}
|
||||
public void setArrivalTime(String arrivalTime)
|
||||
{
|
||||
this.arrivalTime = arrivalTime;
|
||||
}
|
||||
|
||||
public String getArrivalTime()
|
||||
{
|
||||
return arrivalTime;
|
||||
}
|
||||
public void setPurchaser(Long purchaser)
|
||||
{
|
||||
this.purchaser = purchaser;
|
||||
}
|
||||
|
||||
public Long getPurchaser()
|
||||
{
|
||||
return purchaser;
|
||||
}
|
||||
public void setCompanyId(Integer companyId)
|
||||
{
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public Integer getCompanyId()
|
||||
{
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public List<PurchaseCheckDetails> getCheckDetailsList() {
|
||||
return checkDetailsList;
|
||||
}
|
||||
|
||||
public void setCheckDetailsList(List<PurchaseCheckDetails> checkDetailsList) {
|
||||
this.checkDetailsList = checkDetailsList;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getPurchasingStatus() {
|
||||
return purchasingStatus;
|
||||
}
|
||||
|
||||
public void setPurchasingStatus(String purchasingStatus) {
|
||||
this.purchasingStatus = purchasingStatus;
|
||||
}
|
||||
|
||||
public String getPurchasingTypeName() {
|
||||
return purchasingTypeName;
|
||||
}
|
||||
|
||||
public void setPurchasingTypeName(String purchasingTypeName) {
|
||||
this.purchasingTypeName = purchasingTypeName;
|
||||
}
|
||||
|
||||
public String getPurchaserName() {
|
||||
return purchaserName;
|
||||
}
|
||||
|
||||
public void setPurchaserName(String purchaserName) {
|
||||
this.purchaserName = purchaserName;
|
||||
}
|
||||
|
||||
public Integer getTaskStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setTaskStatus(Integer taskStatus) {
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
public String getPurchasingTypeCode() {
|
||||
return purchasingTypeCode;
|
||||
}
|
||||
|
||||
public void setPurchasingTypeCode(String purchasingTypeCode) {
|
||||
this.purchasingTypeCode = purchasingTypeCode;
|
||||
}
|
||||
|
||||
public String getSupplier() {
|
||||
return supplier;
|
||||
}
|
||||
|
||||
public void setSupplier(String supplier) {
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
public String getPurchaseNum() {
|
||||
return purchaseNum;
|
||||
}
|
||||
|
||||
public void setPurchaseNum(String purchaseNum) {
|
||||
this.purchaseNum = purchaseNum;
|
||||
}
|
||||
|
||||
public String getCheckNum() {
|
||||
return checkNum;
|
||||
}
|
||||
|
||||
public void setCheckNum(String checkNum) {
|
||||
this.checkNum = checkNum;
|
||||
}
|
||||
|
||||
public String getManageType() {
|
||||
return manageType;
|
||||
}
|
||||
|
||||
public void setManageType(String manageType) {
|
||||
this.manageType = manageType;
|
||||
}
|
||||
|
||||
public String getInputUser() {
|
||||
return inputUser;
|
||||
}
|
||||
|
||||
public void setInputUser(String inputUser) {
|
||||
this.inputUser = inputUser;
|
||||
}
|
||||
|
||||
public String getInputTime() {
|
||||
return inputTime;
|
||||
}
|
||||
|
||||
public void setInputTime(String inputTime) {
|
||||
this.inputTime = inputTime;
|
||||
}
|
||||
|
||||
public String getInputStatus() {
|
||||
return inputStatus;
|
||||
}
|
||||
|
||||
public void setInputStatus(String inputStatus) {
|
||||
this.inputStatus = inputStatus;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("taskId", getTaskId())
|
||||
.append("purchaseTime", getPurchaseTime())
|
||||
.append("arrivalTime", getArrivalTime())
|
||||
.append("purchaser", getPurchaser())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("companyId", getCompanyId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,9 +2,8 @@ package com.bonus.sgzb.material.service;
|
|||
|
||||
import com.bonus.sgzb.base.api.domain.MachinePart;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.BmNoticeInfo;
|
||||
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
|
||||
import com.bonus.sgzb.material.domain.PurchaseInput;
|
||||
import com.bonus.sgzb.material.domain.PurchaseInputVo;
|
||||
import com.bonus.sgzb.material.vo.NoticeInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -92,7 +91,7 @@ public interface IPurchaseCheckInfoService
|
|||
* @param purchaseCheckInfo
|
||||
* @return
|
||||
*/
|
||||
List<PurchaseInput> putInExportList(PurchaseCheckInfo purchaseCheckInfo);
|
||||
List<PurchaseInputVo> putInExportList(PurchaseCheckInfo purchaseCheckInfo);
|
||||
|
||||
/**
|
||||
* 获取新购验收任务--验收单
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.sgzb.material.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.bonus.sgzb.base.api.domain.MachinePart;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||
|
|
@ -80,8 +82,64 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<PurchaseInput> putInExportList(PurchaseCheckInfo purchaseCheckInfo) {
|
||||
return purchaseCheckInfoMapper.putInExportList(purchaseCheckInfo);
|
||||
public List<PurchaseInputVo> putInExportList(PurchaseCheckInfo purchaseCheckInfo) {
|
||||
List<PurchaseInputVo> list = new ArrayList<>();
|
||||
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPutInListList(purchaseCheckInfo);
|
||||
if (CollectionUtils.isNotEmpty(purchaseCheckInfos)) {
|
||||
for (PurchaseCheckInfo checkInfo : purchaseCheckInfos) {
|
||||
String typeName = purchaseCheckInfoMapper.selectTypeNameByTaskId(checkInfo.getTaskId(), "3");
|
||||
checkInfo.setPurchasingTypeName(typeName);
|
||||
PurchaseInputVo purchaseInput = new PurchaseInputVo();
|
||||
purchaseInput.setTaskId(checkInfo.getTaskId());
|
||||
purchaseInput.setCode(checkInfo.getCode());
|
||||
purchaseInput.setPurchaseTime(checkInfo.getPurchaseTime());
|
||||
purchaseInput.setArrivalTime(checkInfo.getArrivalTime());
|
||||
purchaseInput.setPurchasingTypeName(typeName);
|
||||
purchaseInput.setPurchaserName(StringUtils.isNotBlank(checkInfo.getPurchaserName()) ? checkInfo.getPurchaserName() : null);
|
||||
purchaseInput.setInputUser(checkInfo.getInputUser());
|
||||
purchaseInput.setInputTime(checkInfo.getInputTime());
|
||||
purchaseInput.setPublishTime(checkInfo.getCreateTime());
|
||||
purchaseInput.setRemark(StringUtils.isNotBlank(checkInfo.getRemark()) ? checkInfo.getRemark() : null);
|
||||
//根据taskStatus查询任务状态
|
||||
switch (checkInfo.getTaskStatus()) {
|
||||
case 24:
|
||||
purchaseInput.setInputStatus("待通知");
|
||||
break;
|
||||
case 25:
|
||||
purchaseInput.setInputStatus("待验收");
|
||||
break;
|
||||
case 26:
|
||||
purchaseInput.setInputStatus("验收合格");
|
||||
break;
|
||||
case 27:
|
||||
purchaseInput.setInputStatus("验收未通过");
|
||||
break;
|
||||
case 28:
|
||||
purchaseInput.setInputStatus("已全部入库");
|
||||
break;
|
||||
case 105:
|
||||
purchaseInput.setInputStatus("入库审核中");
|
||||
break;
|
||||
case 106:
|
||||
purchaseInput.setInputStatus("综合服务中心未通过");
|
||||
break;
|
||||
case 107:
|
||||
purchaseInput.setInputStatus("入库审核未通过");
|
||||
break;
|
||||
case 122:
|
||||
purchaseInput.setInputStatus("综合服务中心审核中");
|
||||
break;
|
||||
case 123:
|
||||
purchaseInput.setInputStatus("部分已入库");
|
||||
break;
|
||||
default:
|
||||
purchaseInput.setInputStatus("未知状态");
|
||||
break;
|
||||
}
|
||||
list.add(purchaseInput);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -853,7 +853,7 @@ export default {
|
|||
} else {
|
||||
this.handleData(val)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
handleData(val) {
|
||||
let nodes = null
|
||||
|
|
@ -907,7 +907,7 @@ export default {
|
|||
} catch (error) {
|
||||
console.log('🚀 ~ handleDeviceType ~ error:', error)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
//// 将数据处理成 表格中需要的数据
|
||||
handelTableItemData(node) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue