From 20d3e1da6517ed5e55ae3613ccbbb01f1b9eda2e Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期六, 25 四月 2026 11:53:11 +0800
Subject: [PATCH] fix(approve): 修复审批流程中的数据类型和业务逻辑问题
---
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
index 06a0782..5eed99f 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.production.service.impl;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -16,17 +17,21 @@
import com.ruoyi.production.service.ProductOrderService;
import com.ruoyi.production.service.ProductProcessService;
import com.ruoyi.production.service.ProductWorkOrderService;
+import com.ruoyi.production.service.ProductionPrintOrderService;
import com.ruoyi.quality.mapper.QualityInspectMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
import java.util.stream.Collectors;
@Service
@@ -35,6 +40,10 @@
private final ProductWorkOrderService productWorkOrderService;
private final ProductProcessService productProcessService;
+
+ @Autowired
+ @Lazy
+ private ProductionPrintOrderService productionPrintOrderService;
@Autowired
private ProductOrderMapper productOrderMapper;
@Autowired
@@ -62,7 +71,23 @@
@Override
public IPage<ProductOrderDto> pageProductOrder(Page page, ProductOrderDto productOrder) {
- return productOrderMapper.pageProductOrder(page, productOrder);
+ IPage<ProductOrderDto> productOrderDtoIPage = productOrderMapper.pageProductOrder(page, productOrder);
+ // 濉厖鍗板埛鍗曚俊鎭�
+ List<ProductOrderDto> records = productOrderDtoIPage.getRecords();
+ if (CollUtil.isNotEmpty(records)) {
+ List<Long> orderIds = records.stream().map(ProductOrderDto::getId).collect(Collectors.toList());
+ Map<Long, ProductionPrintOrder> collect = productionPrintOrderService.getListByOrders(orderIds).stream().collect(Collectors.toMap(ProductionPrintOrder::getProductOrderId, Function.identity()));
+ records.forEach(record -> {
+ ProductionPrintOrder productionPrintOrder = collect.get(record.getId());
+ if (productionPrintOrder != null) {
+ productionPrintOrder.convertProductOrderDto(record);
+ }
+ });
+
+
+ }
+
+ return productOrderDtoIPage;
}
@Override
@@ -157,6 +182,22 @@
return true;
}
+ @Override
+ public ProductWorkOrder startProduction(Long id) {
+ LocalDateTime now = LocalDateTime.now();
+ ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(id);
+ productWorkOrder.setStartProductTime(now);
+ Assert.notNull(productWorkOrder, "宸ュ崟涓嶅瓨鍦�");
+
+
+ ProductWorkOrder needUpdate = new ProductWorkOrder();
+ needUpdate.setId(id);
+ needUpdate.setStartProductTime(now);
+ productWorkOrderMapper.updateById(needUpdate);
+
+ return productWorkOrder;
+ }
+
//鑾峰彇褰撳墠鐢熶骇璁㈠崟鍙�
public String getMaxOrderNoByDate(String datePrefix) {
QueryWrapper<ProductOrder> queryWrapper = new QueryWrapper<>();
--
Gitblit v1.9.3