导入订单功能

This commit is contained in:
磷叶 2025-02-25 15:46:42 +08:00
parent 8084bff2fe
commit 6e3b303195
8 changed files with 396 additions and 116 deletions

View File

@ -288,6 +288,10 @@ public class ExcelUtil<T>
{
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
return this.importExcel(sheetName, wb, titleNum);
}
public List<T> importExcel(String sheetName, Workbook wb, int titleNum) throws Exception {
List<T> list = new ArrayList<T>();
// 如果指定sheet名,则取指定sheet中的内容 否则默认指向第1个sheet
Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0);
@ -295,16 +299,14 @@ public class ExcelUtil<T>
{
throw new IOException("文件sheet不存在");
}
boolean isXSSFWorkbook = !(wb instanceof HSSFWorkbook);
Map<String, PictureData> pictures;
if (isXSSFWorkbook)
{
if (wb instanceof HSSFWorkbook) {
pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb);
} else {
pictures = getSheetPictures07((XSSFSheet) sheet, (XSSFWorkbook) wb);
}
else
{
pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb);
}
// 获取最后一个非空行的行下标比如总行数为n则返回的为n-1
int rows = sheet.getLastRowNum();
if (rows > 0)
@ -1552,10 +1554,6 @@ public class ExcelUtil<T>
/**
* 获取单元格值
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
*/
public Object getCellValue(Row row, int column)
{
@ -1563,76 +1561,57 @@ public class ExcelUtil<T>
{
return row;
}
Cell cell = row.getCell(column);
return this.getCellValue(cell);
}
private static Object getCellValue(Cell cell) {
Object val = "";
try
{
Cell cell = row.getCell(column);
try {
if (StringUtils.isNotNull(cell))
{
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA)
switch (cell.getCellType())
{
val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell))
{
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
}
else
{
if ((Double) val % 1 != 0)
{
val = new BigDecimal(val.toString());
case NUMERIC:
val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
}
else
{
val = new DecimalFormat("0").format(val);
else {
if ((Double) val % 1 != 0) {
val = new BigDecimal(val.toString());
}
else {
val = new DecimalFormat("0").format(val);
}
}
}
break;
case STRING:
val = cell.getStringCellValue();
break;
case BOOLEAN:
val = cell.getBooleanCellValue();
break;
// case FORMULA:
// try {
// val = cell.getNumericCellValue();
// } catch (IllegalStateException e) {
// val = cell.getStringCellValue();
// }
// break;
case ERROR:
val = cell.getErrorCellValue();
break;
default:
val = "";
}
else if (cell.getCellType() == CellType.STRING)
{
val = cell.getStringCellValue();
}
else if (cell.getCellType() == CellType.BOOLEAN)
{
val = cell.getBooleanCellValue();
}
else if (cell.getCellType() == CellType.ERROR)
{
val = cell.getErrorCellValue();
}
}
}
catch (Exception e)
{
} catch ( Exception e) {
return val;
}
return val;
}
/**
* 判断是否是空行
*
* @param row 判断的行
* @return
*/
private boolean isRowEmpty(Row row)
{
if (row == null)
{
return true;
}
for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++)
{
Cell cell = row.getCell(i);
if (cell != null && cell.getCellType() != CellType.BLANK)
{
return false;
}
}
return true;
}
/**
* 获取Excel2003图片
*
@ -1673,31 +1652,90 @@ public class ExcelUtil<T>
* @param workbook 工作簿对象
* @return Map key:图片单元格索引1_1Stringvalue:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook)
{
public static Map<String, PictureData> getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook) {
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
for (POIXMLDocumentPart dr : sheet.getRelations())
{
if (dr instanceof XSSFDrawing)
{
XSSFDrawing drawing = (XSSFDrawing) dr;
List<XSSFShape> shapes = drawing.getShapes();
for (XSSFShape shape : shapes)
{
if (shape instanceof XSSFPicture)
{
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
sheetIndexPicMap.put(picIndex, pic.getPictureData());
try {
// 1. 处理常规Excel图片
for (POIXMLDocumentPart dr : sheet.getRelations()) {
if (dr instanceof XSSFDrawing) {
XSSFDrawing drawing = (XSSFDrawing) dr;
List<XSSFShape> shapes = drawing.getShapes();
for (XSSFShape shape : shapes) {
if (shape instanceof XSSFPicture) {
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
// 获取图片位置信息
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
// 存储图片数据
sheetIndexPicMap.put(picIndex, pic.getPictureData());
}
}
}
}
// 2. 处理WPS单元格内嵌图片
for (Row row : sheet) {
for (Cell cell : row) {
if (cell != null) {
Object cellValue = getCellValue(cell);
try {
// 获取单元格值
if (!(cellValue instanceof String)) {
continue;
}
String val = cellValue.toString();
// 检查是否包含WPS图片标记
if (val.startsWith("=DISPIMG(")) {
String imageId = extractImageId(val);
if (StringUtils.isNotEmpty(imageId)) {
// 使用行列索引作为key
String picIndex = cell.getRowIndex() + "_" + cell.getColumnIndex();
// 查找对应的图片数据
for (PictureData pic : workbook.getAllPictures()) {
// 这里可能需要根据实际情况调整图片ID的匹配逻辑
if (pic.toString().contains(imageId)) {
sheetIndexPicMap.put(picIndex, pic);
break;
}
}
}
}
} catch (Exception e) {
log.error("处理WPS单元格图片失败: row={}, col={}",
cell.getRowIndex(), cell.getColumnIndex(), e);
}
}
}
}
} catch (Exception e) {
log.error("获取Excel2007图片失败", e);
}
return sheetIndexPicMap;
}
/**
* 从图片引用格式中提取图片ID
*/
private static String extractImageId(String formula) {
try {
// 提取双引号中的内容
int start = formula.indexOf("\"") + 1;
int end = formula.indexOf("\"", start);
if (start > 0 && end > start) {
return formula.substring(start, end);
}
} catch (Exception e) {
log.error("提取图片ID失败: {}", formula, e);
}
return "";
}
/**
* 格式化不同类型的日期对象
*
@ -1787,4 +1825,103 @@ public class ExcelUtil<T>
}
return method;
}
/**
* 导入混合格式Excel(标签-值对+表格数据)
*/
public Map<String, Object> importMixedExcel(InputStream is, int labelEndRow, int tableHeaderRowNum) throws Exception {
if (is == null) {
throw new IOException("导入Excel文件为空");
}
Map<String, Object> result = new HashMap<>();
// 1. 读取Excel文件
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
sheet = wb.getSheetAt(0);
try {
// 2. 解析标签-值对
Map<String, Object> head = new HashMap<>();
for (int i = 0; i <= labelEndRow; i++) {
Row row = sheet.getRow(i);
if (row != null) {
Object label = getCellValue(row, 0); // A列为标签
if (StringUtils.isNotEmpty(Convert.toStr(label))) {
Object val = getCellValue(row, 1); // B列为值
head.put(Convert.toStr(label), val);
}
}
}
result.put("head", head);
// 3. 解析表格数据 - 直接从当前workbook读取
List<T> body = this.importExcel(StringUtils.EMPTY, wb, tableHeaderRowNum);
result.put("body", body);
return result;
} finally {
IOUtils.closeQuietly(wb);
IOUtils.closeQuietly(is);
}
}
/**
* 根据Excel注解的name查找对应的字段
*/
private Field findFieldByExcelName(String excelName) {
List<Field> allFields = new ArrayList<>();
allFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
allFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
for (Field field : allFields) {
Excel excel = field.getAnnotation(Excel.class);
if (excel != null && excel.name().equals(excelName)) {
return field;
}
Excels excels = field.getAnnotation(Excels.class);
if (excels != null) {
for (Excel ex : excels.value()) {
if (ex.name().equals(excelName)) {
return field;
}
}
}
}
return null;
}
/**
* 查找用于存储表格数据的集合字段
*/
private Field findCollectionField() {
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (Collection.class.isAssignableFrom(field.getType())) {
return field;
}
}
return null;
}
/**
* 判断是否是空行
*
* @param row 判断的行
* @return 如果是空行返回true否则返回false
*/
private boolean isRowEmpty(Row row) {
if (row == null) {
return true;
}
for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) {
Cell cell = row.getCell(i);
if (cell != null && cell.getCellType() != CellType.BLANK) {
return false;
}
}
return true;
}
}

View File

@ -4,8 +4,10 @@ import com.ruoyi.bst.order.domain.Order;
import com.ruoyi.bst.order.domain.OrderBO;
import com.ruoyi.bst.order.domain.OrderQuery;
import com.ruoyi.bst.order.domain.OrderVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 生产订单Service接口
@ -87,4 +89,11 @@ public interface OrderService
* 查询数量
*/
int selectCount(OrderQuery query);
/**
* 读取EXCEL文件并返回数据
* @param file
* @return
*/
Map<String, Object> parseExcelData(MultipartFile file);
}

View File

@ -17,17 +17,23 @@ import com.ruoyi.bst.prodProcess.domain.ProdProcess;
import com.ruoyi.bst.prodProcess.domain.ProdProcessBO;
import com.ruoyi.bst.prodProcess.domain.ProdProcessVO;
import com.ruoyi.bst.prodProcess.service.IProdProcessService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.common.utils.collection.DiffListVO;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.dept.domain.SysDeptQuery;
import com.ruoyi.system.dept.domain.SysDeptVO;
import com.ruoyi.system.dept.service.ISysDeptService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -57,6 +63,9 @@ public class OrderServiceImpl implements OrderService
@Autowired
private OrderAssembler orderAssembler;
@Autowired
private ISysDeptService deptService;
/**
* 查询生产订单
*
@ -245,6 +254,62 @@ public class OrderServiceImpl implements OrderService
return orderMapper.selectCount(query);
}
@Override
public Map<String, Object> parseExcelData(MultipartFile file) {
ServiceUtil.assertion(file == null, "请选择需要解析的数据");
ExcelUtil<OrderProdVO> util = new ExcelUtil<>(OrderProdVO.class);
try {
Map<String, Object> data = util.importMixedExcel(file.getInputStream(), 7, 8);
List<OrderProdVO> body = (List<OrderProdVO>) data.get("body");
// 查询全部部门
List<SysDeptVO> depts = deptService.selectDeptList(new SysDeptQuery());
// 将处理方式转为部门数据
for (OrderProdVO item : body) {
String handleWay = item.getHandleWay();
if (StringUtils.isBlank(handleWay)) {
continue;
}
// 通过部门名称或者工序简称来匹配部门
List<String> handleWayList = Arrays.asList(handleWay.split("\\+"));
List<ProdProcessVO> processList = new ArrayList<>();
for (int i = 0; i < handleWayList.size(); i++) {
String way = handleWayList.get(i).trim();
SysDeptVO dept = depts.stream()
.filter(deptItem -> {
List<String> deptProcess = Arrays.asList(deptItem.getProcess().split(","));
return Objects.equals(deptItem.getDeptName(), way) || deptProcess.contains(way);
})
.findFirst().orElse(null);
if (dept != null) {
ProdProcessVO process = new ProdProcessVO();
process.setDeptId(dept.getDeptId());
process.setDeptName(dept.getDeptName());
process.setNum(item.getNum());
if (i == handleWayList.size() - 1) {
process.setIsEnd(true);
} else {
process.setIsEnd(false);
}
processList.add(process);
}
}
String newHandleWay = processList.stream().map(ProdProcessVO::getDeptName).collect(Collectors.joining("+"));
item.setHandleWay(newHandleWay);
item.setProcessList(processList);
}
return data;
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
private int updateByQuery(Order data, OrderQuery query) {
return orderMapper.updateByQuery(data, query);
}

View File

@ -49,8 +49,8 @@ public class OrderValidatorImpl implements OrderValidator {
this.checkCustomOrderNo(data.getId(), data.getCustomOrderNo());
// 有且仅有一个结束的产品
boolean singleEndProd = this.hasSingleEndProd(data.getProdList());
ServiceUtil.assertion(!singleEndProd, "订单中必须有且仅有一个产品为成品");
// boolean singleEndProd = this.hasSingleEndProd(data.getProdList());
// ServiceUtil.assertion(!singleEndProd, "订单中必须有且仅有一个产品为成品");
// 每个产品有且仅有一个结束的工序
for (OrderProdBO prod : data.getProdList()) {

View File

@ -31,29 +31,28 @@ public class OrderProd extends BaseEntity
@ApiModelProperty("订单ID")
private Long orderId;
@Excel(name = "加工类型", readConverterExp = "1=自加工,2=外加工")
@ApiModelProperty("加工类型")
@DictValid(type = DictType.ORDER_PROD_WORK_TYPE, message = "非法的产品加工类型")
@NotBlank(message = "产品加工类型不能为空", groups = {ValidGroup.Create.class})
@Excel(name = "加工方式", dictType = DictType.ORDER_PROD_WORK_TYPE, comboReadDict = true)
@ApiModelProperty("加工方式")
@DictValid(type = DictType.ORDER_PROD_WORK_TYPE, message = "非法的产品加工方式")
@NotBlank(message = "产品加工方式不能为空", groups = {ValidGroup.Create.class})
private String workType;
@Excel(name = "是否成品")
@ApiModelProperty("是否成品")
@NotNull(message = "是否成品不能为空", groups = {ValidGroup.Create.class})
private Boolean isEnd;
@Excel(name = "物料编")
@ApiModelProperty("物料编")
@Size(max = 50, message = "物料编码长度不能超过50个字符")
@Excel(name = "物料编")
@ApiModelProperty("物料编")
@Size(max = 200, message = "物料编号长度不能超过200个字符")
private String materialNo;
@Excel(name = "")
@ApiModelProperty("")
@Excel(name = "", cellType = Excel.ColumnType.IMAGE)
@ApiModelProperty("")
private String picture;
@Excel(name = "名称")
@ApiModelProperty("名称")
@Size(max = 50, message = "产品名称长度不能超过50个字符")
@Excel(name = "产品名称")
@ApiModelProperty("产品名称")
@Size(max = 200, message = "产品名称长度不能超过200个字符")
@NotBlank(message = "产品名称不能为空", groups = {ValidGroup.Create.class})
private String name;
@ -62,10 +61,10 @@ public class OrderProd extends BaseEntity
@Size(max = 50, message = "规格长度不能超过50个字符")
private String spec;
@Excel(name = "数量")
@ApiModelProperty("数量")
@Min(value = 1, message = "产品数量不能小于1")
@NotNull(message = "产品数量不能为空", groups = {ValidGroup.Create.class})
@Excel(name = "订单数量")
@ApiModelProperty("订单数量")
@Min(value = 1, message = "订单数量不能小于1")
@NotNull(message = "订单数量不能为空", groups = {ValidGroup.Create.class})
private BigDecimal num;
@Excel(name = "排序")
@ -74,22 +73,22 @@ public class OrderProd extends BaseEntity
@Excel(name = "处理方式")
@ApiModelProperty("处理方式")
@Size(max = 50, message = "处理方式长度不能超过50个字符")
@Size(max = 200, message = "处理方式长度不能超过200个字符")
private String handleWay;
@Excel(name = "效果")
@ApiModelProperty("效果")
@Size(max = 50, message = "效果长度不能超过50个字符")
@Excel(name = "效果/包装尺寸")
@ApiModelProperty("效果/包装尺寸")
@Size(max = 200, message = "效果/包装尺寸长度不能超过200个字符")
private String effect;
@Excel(name = "颜色")
@ApiModelProperty("颜色")
@Size(max = 50, message = "颜色长度不能超过50个字符")
@Size(max = 200, message = "颜色长度不能超过200个字符")
private String color;
@Excel(name = "颜色")
@ApiModelProperty("颜色")
@Size(max = 50, message = "盖子颜色长度不能超过50个字符")
@Excel(name = "盖颜色/外箱尺寸")
@ApiModelProperty("盖颜色/外箱尺寸")
@Size(max = 200, message = "球盖颜色/外箱尺寸长度不能超过200个字符")
private String coverColor;
@Excel(name = "装量")
@ -97,4 +96,18 @@ public class OrderProd extends BaseEntity
@Min(value = 1, message = "装量不能小于1")
@NotNull(message = "装量不能为空", groups = {ValidGroup.Create.class})
private Integer contentNum;
@Excel(name = "序号")
@ApiModelProperty("序号")
private String no;
@Excel(name = "加工商")
@ApiModelProperty("加工商名称")
private String workName;
@Excel(name = "备注")
@ApiModelProperty("备注")
@Size(max = 200, message = "备注长度不能超过200个字符")
private String remark;
}

View File

@ -26,6 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bop.color,
bop.cover_color,
bop.content_num,
bop.no,
bop.work_name,
bo.order_no as order_no
from bst_order_prod bop
left join bst_order bo on bo.id = bop.order_id
@ -47,6 +49,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.effect != null and query.effect != ''"> and bop.effect like concat('%', #{query.effect}, '%')</if>
<if test="query.color != null and query.color != ''"> and bop.color like concat('%', #{query.color}, '%')</if>
<if test="query.coverColor != null and query.coverColor != ''"> and bop.cover_color like concat('%', #{query.coverColor}, '%')</if>
<if test="query.no != null and query.no != ''"> and bop.no like concat('%', #{query.no}, '%')</if>
<if test="query.workName != null and query.workName != ''"> and bop.work_name like concat('%', #{query.workName}, '%')</if>
<if test="query.orderIds != null and query.orderIds.size() > 0">
and bop.order_id in
<foreach collection="query.orderIds" item="item" open="(" close=")" separator=",">
@ -88,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="color != null">color,</if>
<if test="coverColor != null">cover_color,</if>
<if test="contentNum != null">content_num,</if>
<if test="no != null">no,</if>
<if test="workName != null">work_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
@ -107,6 +113,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="color != null">#{color},</if>
<if test="coverColor != null">#{coverColor},</if>
<if test="contentNum != null">#{contentNum},</if>
<if test="no != null">#{no},</if>
<if test="workName != null">#{workName},</if>
</trim>
</insert>
@ -130,6 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
color,
cover_color,
content_num,
no,
work_name
</trim>
values
<foreach collection="list" item="i" separator=",">
@ -168,6 +178,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="i.coverColor == null ">default,</if>
<if test="i.contentNum != null ">#{i.contentNum},</if>
<if test="i.contentNum == null ">default,</if>
<if test="i.no != null ">#{i.no},</if>
<if test="i.no == null ">default,</if>
<if test="i.workName != null ">#{i.workName},</if>
<if test="i.workName == null ">default,</if>
</trim>
</foreach>
</insert>
@ -345,6 +359,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</otherwise>
</choose>
</foreach>
<foreach open="no = CASE id" collection="list" item="item" close="END,">
<choose>
<when test="item.no != null ">
WHEN #{item.id} THEN #{item.no}
</when>
<otherwise>
WHEN #{item.id} THEN `no`
</otherwise>
</choose>
</foreach>
<foreach open="work_name = CASE id" collection="list" item="item" close="END,">
<choose>
<when test="item.workName != null ">
WHEN #{item.id} THEN #{item.workName}
</when>
<otherwise>
WHEN #{item.id} THEN `work_name`
</otherwise>
</choose>
</foreach>
</trim>
where id in
<foreach item="item" collection="list" open="(" separator="," close=")">
@ -394,6 +428,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.color != null">color = #{data.color},</if>
<if test="data.coverColor != null">cover_color = #{data.coverColor},</if>
<if test="data.contentNum != null">content_num = #{data.contentNum},</if>
<if test="data.no != null">no = #{data.no},</if>
<if test="data.workName != null">work_name = #{data.workName},</if>
</sql>
<delete id="deleteOrderProdById" parameterType="Long">

View File

@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -34,7 +35,9 @@ public class OrderProdConverterImpl implements OrderProdConverter {
}
// 拼接部门信息
List<ProdProcessBO> processList = list.stream().map(OrderProdBO::getProcessList).flatMap(List::stream).collect(Collectors.toList());
List<ProdProcessBO> processList = list.stream().map(OrderProdBO::getProcessList)
.filter(Objects::nonNull)
.flatMap(List::stream).collect(Collectors.toList());
prodProcessAssembler.assembleDept(processList);
List<OrderProdBO> boList = new ArrayList<>();
@ -54,6 +57,8 @@ public class OrderProdConverterImpl implements OrderProdConverter {
bo.setColor(prod.getColor());
bo.setCoverColor(prod.getCoverColor());
bo.setContentNum(prod.getContentNum());
bo.setNo(prod.getNo());
bo.setWorkName(prod.getWorkName());
bo.setProcessList(prodProcessConverter.toBOListByCreate(prod.getProcessList()));
boList.add(bo);
@ -68,7 +73,9 @@ public class OrderProdConverterImpl implements OrderProdConverter {
}
// 拼接部门信息
List<ProdProcessBO> processList = list.stream().map(OrderProdBO::getProcessList).flatMap(List::stream).collect(Collectors.toList());
List<ProdProcessBO> processList = list.stream().map(OrderProdBO::getProcessList)
.filter(Objects::nonNull)
.flatMap(List::stream).collect(Collectors.toList());
prodProcessAssembler.assembleDept(processList);
List<OrderProdBO> boList = new ArrayList<>();
@ -89,6 +96,8 @@ public class OrderProdConverterImpl implements OrderProdConverter {
bo.setColor(prod.getColor());
bo.setCoverColor(prod.getCoverColor());
bo.setContentNum(prod.getContentNum());
bo.setNo(prod.getNo());
bo.setWorkName(prod.getWorkName());
bo.setProcessList(prodProcessConverter.toBOListByUpdate(prod.getProcessList()));
boList.add(bo);

View File

@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
@ -135,4 +136,14 @@ public class OrderController extends BaseController
return toAjax(orderService.logicDel(id));
}
/**
* 获取生产订单列表
*/
@PreAuthorize("@ss.hasPermi('bst:order:parseExcelData')")
@PostMapping("/parseExcelData")
public AjaxResult parseExcelData(MultipartFile file) {
return success(orderService.parseExcelData(file));
}
}