Bladeren bron

目的地明细统计查询

qiangxuan 5 maanden geleden
bovenliggende
commit
5d64a1f284
18 gewijzigde bestanden met toevoegingen van 436 en 23 verwijderingen
  1. 10 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/controller/RollClubOneController.java
  2. 2 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/IRollClubOneService.java
  3. 57 2
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/impl/RollClubOneServiceImpl.java
  4. 11 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/controller/RollClubThreeController.java
  5. 2 4
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/IRollClubThreeService.java
  6. 70 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/impl/RollClubThreeServiceImpl.java
  7. 10 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/controller/RollClubTwoController.java
  8. 3 4
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/IRollClubTwoService.java
  9. 68 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/impl/RollClubTwoServiceImpl.java
  10. 10 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/controller/RollHeightController.java
  11. 20 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/entity/DestinationStatistics.java
  12. 24 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/entity/DestinationStatisticsDetails.java
  13. 4 6
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/IRollHeightService.java
  14. 56 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/impl/RollHeightServiceImpl.java
  15. 11 1
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/controller/RollOutShippController.java
  16. 2 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/IRollOutShippService.java
  17. 72 0
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/impl/RollOutShippServiceImpl.java
  18. 4 3
      zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/impl/StackingAndLoadingVehiclesServiceImpl.java

+ 10 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/controller/RollClubOneController.java

@@ -13,6 +13,7 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.rollClubOne.entity.RollClubOne;
 import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -154,4 +155,13 @@ public class RollClubOneController {
 
 	}
 
+	 @ApiOperation(value="轧钢棒一-通过铸机号查询", notes="轧钢棒一-通过铸机号查询")
+	 @GetMapping(value = "/queryRollClubOneByCcmNo")
+	 public Result<DestinationStatistics> queryByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo) {
+		 DestinationStatistics destinationStatistics = rollClubOneService.queryByCcmNoHandle(ccmNo);
+		 if(destinationStatistics == null) {
+			 return Result.ok("未找到对应数据");
+		 }
+		 return Result.OK(destinationStatistics);
+	 }
 }

+ 2 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/IRollClubOneService.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.billet.rollClubOne.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.billet.rollClubOne.entity.RollClubOne;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 
 /**
  * @Description: 轧钢棒一
@@ -11,4 +12,5 @@ import org.jeecg.modules.billet.rollClubOne.entity.RollClubOne;
  */
 public interface IRollClubOneService extends IService<RollClubOne> {
 
+    DestinationStatistics queryByCcmNoHandle(String ccmNo);
 }

+ 57 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubOne/service/impl/RollClubOneServiceImpl.java

@@ -1,11 +1,24 @@
 package org.jeecg.modules.billet.rollClubOne.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.billet.rollClubOne.entity.RollClubOne;
+import org.jeecg.modules.billet.rollClubOne.entity.RollClubOneDetails;
 import org.jeecg.modules.billet.rollClubOne.mapper.RollClubOneMapper;
+import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneDetailsService;
 import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 轧钢棒一
@@ -15,5 +28,47 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class RollClubOneServiceImpl extends ServiceImpl<RollClubOneMapper, RollClubOne> implements IRollClubOneService {
-	
+
+    @Autowired
+    private IRollClubOneDetailsService rollClubOneDetailsService;
+
+    @Override
+    public DestinationStatistics queryByCcmNoHandle(String ccmNo) {
+        DestinationStatistics destinationStatistics = new DestinationStatistics();
+        LambdaQueryWrapper<RollClubOne> queryWrapper = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapper.eq(RollClubOne::getCcmNo, ccmNo);
+        }
+        List<RollClubOne> rollClubOneList = baseMapper.selectList(queryWrapper);
+        if (oConvertUtils.listIsEmpty(rollClubOneList)){
+            return null;
+        }
+        Integer amountTotal = rollClubOneList.stream().map(RollClubOne::getAmountTotal).reduce(0, Integer::sum);
+        // 先将每个RollHeight对象中的heightValue属性值乘以blankOutput,再求和
+        double sumResult = rollClubOneList.stream().mapToDouble(x -> x.getAmountTotal() * x.getBlankOutput()).sum();
+        BigDecimal bd = BigDecimal.valueOf(sumResult).setScale(2, BigDecimal.ROUND_HALF_UP);
+        double finalResult = bd.doubleValue();
+        destinationStatistics.setCounts(amountTotal);
+        destinationStatistics.setBlankOutput(finalResult);
+        LambdaQueryWrapper<RollClubOneDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapperDetails.eq(RollClubOneDetails::getCcmNo, ccmNo);
+        }
+        List<RollClubOneDetails> rollClubOneDetailsList = rollClubOneDetailsService.list(queryWrapperDetails);
+        if (oConvertUtils.listIsEmpty(rollClubOneDetailsList)){
+            return destinationStatistics;
+        }
+        // 根据size属性进行分组,并统计每组的总数和总重
+        Map<String, Double> sumBySize = rollClubOneDetailsList.stream()
+                .collect(Collectors.groupingBy(RollClubOneDetails::getSize,Collectors.summingDouble(RollClubOneDetails::getBlankOutput)));
+        Map<String, Long> countBySize = rollClubOneDetailsList.stream().collect(Collectors.groupingBy(RollClubOneDetails::getSize, Collectors.counting()));
+
+        List<DestinationStatisticsDetails> rollClubOneDetailsStatisticsList = new ArrayList<>();
+        sumBySize.forEach((size, totalWeight) -> {
+            long count = countBySize.get(size);
+            rollClubOneDetailsStatisticsList.add(new DestinationStatisticsDetails(size, (int) count, totalWeight));
+        });
+        destinationStatistics.setStatisticsDetailsList(rollClubOneDetailsStatisticsList);
+        return destinationStatistics;
+    }
 }

+ 11 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/controller/RollClubThreeController.java

@@ -12,6 +12,7 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.rollClubThree.entity.RollClubThree;
 import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -131,4 +132,14 @@ public class RollClubThreeController {
 		return Result.OK(rollClubThree);
 
 	}
+
+	 @ApiOperation(value="轧钢棒三-通过铸机号查询", notes="轧钢棒三-通过铸机号查询")
+	 @GetMapping(value = "/queryRollClubThreeByCcmNo")
+	 public Result<DestinationStatistics> queryByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo) {
+		 DestinationStatistics destinationStatistics = rollClubThreeService.queryByCcmNoHandle(ccmNo);
+		 if(destinationStatistics == null) {
+			 return Result.ok("未找到对应数据");
+		 }
+		 return Result.OK(destinationStatistics);
+	 }
 }

+ 2 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/IRollClubThreeService.java

@@ -2,10 +2,7 @@ package org.jeecg.modules.billet.rollClubThree.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.billet.rollClubThree.entity.RollClubThree;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 
 /**
  * @Description: 轧钢棒三
@@ -15,4 +12,5 @@ import java.util.List;
  */
 public interface IRollClubThreeService extends IService<RollClubThree> {
 
+    DestinationStatistics queryByCcmNoHandle(String ccmNo);
 }

+ 70 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/service/impl/RollClubThreeServiceImpl.java

@@ -1,11 +1,23 @@
 package org.jeecg.modules.billet.rollClubThree.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.billet.rollClubThree.entity.RollClubThree;
+import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
 import org.jeecg.modules.billet.rollClubThree.mapper.RollClubThreeMapper;
+import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
 import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 轧钢棒一
@@ -15,4 +27,61 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class RollClubThreeServiceImpl extends ServiceImpl<RollClubThreeMapper, RollClubThree> implements IRollClubThreeService {
+
+    @Autowired
+    private IRollClubThreeDetailsService rollClubThreeDetailsService;
+
+    @Override
+    public DestinationStatistics queryByCcmNoHandle(String ccmNo) {
+
+        DestinationStatistics destinationStatistics = new DestinationStatistics();
+//        LambdaQueryWrapper<RollClubThree> queryWrapper = new LambdaQueryWrapper<>();
+//        if (oConvertUtils.isNotEmpty(ccmNo)){
+//            queryWrapper.eq(RollClubThree::getCcmNo, ccmNo);
+//        }
+//        List<RollClubThree> rollClubThreeList = baseMapper.selectList(queryWrapper);
+//        if (oConvertUtils.listIsEmpty(rollClubThreeList)){
+//            return null;
+//        }
+//        Integer amountTotal = rollClubThreeList.stream().map(RollClubThree::getAmountTotal).reduce(0, Integer::sum);
+//        // 先将每个RollHeight对象中的heightValue属性值乘以blankOutput,再求和
+//        double sumResult = rollClubThreeList.stream().mapToDouble(x -> x.getAmountTotal() * x.getBlankOutput()).sum();
+//        BigDecimal bd = BigDecimal.valueOf(sumResult).setScale(2, BigDecimal.ROUND_HALF_UP);
+//        double finalResult = bd.doubleValue();
+//        destinationStatistics.setCounts(amountTotal);
+//        destinationStatistics.setBlankOutput(finalResult);
+        LambdaQueryWrapper<RollClubThreeDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapperDetails.eq(RollClubThreeDetails::getCcmNo, ccmNo);
+        }
+        List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapperDetails);
+        if (oConvertUtils.listIsEmpty(rollClubThreeDetailsList)){
+            return destinationStatistics;
+        }
+        // 根据size属性进行分组,并统计每组的总数和总重
+        Map<String, Double> sumBySize = rollClubThreeDetailsList.stream()
+                .collect(Collectors.groupingBy(RollClubThreeDetails::getSize,Collectors.summingDouble(RollClubThreeDetails::getBlankOutput)));
+        Map<String, Long> countBySize = rollClubThreeDetailsList.stream().collect(Collectors.groupingBy(RollClubThreeDetails::getSize, Collectors.counting()));
+
+        List<DestinationStatisticsDetails> rollClubThreeDetailsStatisticsList = new ArrayList<>();
+        sumBySize.forEach((size, totalWeight) -> {
+            long count = countBySize.get(size);
+            rollClubThreeDetailsStatisticsList.add(new DestinationStatisticsDetails(size, (int) count, totalWeight));
+        });
+
+        Integer sums = rollClubThreeDetailsStatisticsList.stream()
+                .map(DestinationStatisticsDetails::getNums)
+                .reduce(0, Integer::sum);
+        // 使用String.format方法对求和结果保留两位小数
+        double blankOutputSum = rollClubThreeDetailsStatisticsList.stream()
+                .mapToDouble(DestinationStatisticsDetails::getBlankOutput)
+                .sum();
+        String formattedResult = String.format("%.2f", blankOutputSum);
+        double finalBlankOutputSum = Double.parseDouble(formattedResult);
+        destinationStatistics.setCounts(sums);
+        destinationStatistics.setBlankOutput(finalBlankOutputSum);
+
+        destinationStatistics.setStatisticsDetailsList(rollClubThreeDetailsStatisticsList);
+        return destinationStatistics;
+    }
 }

+ 10 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/controller/RollClubTwoController.java

@@ -12,6 +12,7 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwo;
 import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -131,5 +132,13 @@ public class RollClubTwoController {
 
 	}
 
-
+	 @ApiOperation(value="轧钢棒二-通过铸机号查询", notes="轧钢棒二-通过铸机号查询")
+	 @GetMapping(value = "/queryRollClubTwoByCcmNo")
+	 public Result<DestinationStatistics> queryByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo) {
+		 DestinationStatistics destinationStatistics = rollClubTwoService.queryByCcmNoHandle(ccmNo);
+		 if(destinationStatistics == null) {
+			 return Result.ok("未找到对应数据");
+		 }
+		 return Result.OK(destinationStatistics);
+	 }
 }

+ 3 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/IRollClubTwoService.java

@@ -2,10 +2,7 @@ package org.jeecg.modules.billet.rollClubTwo.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwo;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 
 /**
  * @Description: 轧钢棒一
@@ -14,4 +11,6 @@ import java.util.List;
  * @Version: V1.0
  */
 public interface IRollClubTwoService extends IService<RollClubTwo> {
+
+    DestinationStatistics queryByCcmNoHandle(String ccmNo);
 }

+ 68 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/service/impl/RollClubTwoServiceImpl.java

@@ -1,10 +1,22 @@
 package org.jeecg.modules.billet.rollClubTwo.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwo;
+import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
 import org.jeecg.modules.billet.rollClubTwo.mapper.RollClubTwoMapper;
+import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoDetailsService;
 import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 轧钢棒一
@@ -14,4 +26,59 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class RollClubTwoServiceImpl extends ServiceImpl<RollClubTwoMapper, RollClubTwo> implements IRollClubTwoService {
+
+    @Autowired
+    private IRollClubTwoDetailsService rollClubTwoDetailsService;
+
+    @Override
+    public DestinationStatistics queryByCcmNoHandle(String ccmNo) {
+        DestinationStatistics destinationStatistics = new DestinationStatistics();
+//        LambdaQueryWrapper<RollClubTwo> queryWrapper = new LambdaQueryWrapper<>();
+//        if (oConvertUtils.isNotEmpty(ccmNo)){
+//            queryWrapper.eq(RollClubTwo::getCcmNo, ccmNo);
+//        }
+//        List<RollClubTwo> rollClubTwoList = baseMapper.selectList(queryWrapper);
+//        if (oConvertUtils.listIsEmpty(rollClubTwoList)){
+//            return null;
+//        }
+//        Integer amountTotal = rollClubTwoList.stream().map(RollClubTwo::getAmountTotal).reduce(0, Integer::sum);
+//        // 先将每个RollHeight对象中的heightValue属性值乘以blankOutput,再求和
+//        double sumResult = rollClubTwoList.stream().mapToDouble(x -> x.getAmountTotal() * x.getBlankOutput()).sum();
+//        BigDecimal bd = BigDecimal.valueOf(sumResult).setScale(2, BigDecimal.ROUND_HALF_UP);
+//        double finalResult = bd.doubleValue();
+//        destinationStatistics.setCounts(amountTotal);
+//        destinationStatistics.setBlankOutput(finalResult);
+        LambdaQueryWrapper<RollClubTwoDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapperDetails.eq(RollClubTwoDetails::getCcmNo, ccmNo);
+        }
+        List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapperDetails);
+        if (oConvertUtils.listIsEmpty(rollClubTwoDetailsList)){
+            return destinationStatistics;
+        }
+        // 根据size属性进行分组,并统计每组的总数和总重
+        Map<String, Double> sumBySize = rollClubTwoDetailsList.stream()
+                .collect(Collectors.groupingBy(RollClubTwoDetails::getSize,Collectors.summingDouble(RollClubTwoDetails::getBlankOutput)));
+        Map<String, Long> countBySize = rollClubTwoDetailsList.stream().collect(Collectors.groupingBy(RollClubTwoDetails::getSize, Collectors.counting()));
+
+        List<DestinationStatisticsDetails> rollClubTwoDetailsStatisticsList = new ArrayList<>();
+        sumBySize.forEach((size, totalWeight) -> {
+            long count = countBySize.get(size);
+            rollClubTwoDetailsStatisticsList.add(new DestinationStatisticsDetails(size, (int) count, totalWeight));
+        });
+
+        Integer sums = rollClubTwoDetailsStatisticsList.stream()
+                .map(DestinationStatisticsDetails::getNums)
+                .reduce(0, Integer::sum);
+        // 使用String.format方法对求和结果保留两位小数
+        double blankOutputSum = rollClubTwoDetailsStatisticsList.stream()
+                .mapToDouble(DestinationStatisticsDetails::getBlankOutput)
+                .sum();
+        String formattedResult = String.format("%.2f", blankOutputSum);
+        double finalBlankOutputSum = Double.parseDouble(formattedResult);
+        destinationStatistics.setCounts(sums);
+        destinationStatistics.setBlankOutput(finalBlankOutputSum);
+        destinationStatistics.setStatisticsDetailsList(rollClubTwoDetailsStatisticsList);
+        return destinationStatistics;
+    }
 }

+ 10 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/controller/RollHeightController.java

@@ -10,6 +10,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeight;
 import org.jeecg.modules.billet.rollHeight.service.IRollHeightService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -133,4 +134,13 @@ public class RollHeightController {
 
 	}
 
+	 @ApiOperation(value="高线统计-通过铸机号查询", notes="高线统计-通过铸机号查询")
+	 @GetMapping(value = "/queryRollHeightByCcmNo")
+	 public Result<DestinationStatistics> queryByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo) {
+		 DestinationStatistics destinationStatistics = rollHeightService.queryByCcmNoHandle(ccmNo);
+		 if(destinationStatistics == null) {
+			 return Result.ok("未找到对应数据");
+		 }
+		 return Result.OK(destinationStatistics);
+	 }
 }

+ 20 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/entity/DestinationStatistics.java

@@ -0,0 +1,20 @@
+package org.jeecg.modules.billet.rollHeight.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class DestinationStatistics {
+
+    @ApiModelProperty(value = "总支数")
+    private Integer counts;
+
+    /**出坯量*/
+    @ApiModelProperty(value = "出坯总重量")
+    private Double blankOutput;
+
+    @ApiModelProperty(value = "明细")
+    private List<DestinationStatisticsDetails> statisticsDetailsList;
+}

+ 24 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/entity/DestinationStatisticsDetails.java

@@ -0,0 +1,24 @@
+package org.jeecg.modules.billet.rollHeight.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class DestinationStatisticsDetails {
+
+    /**定尺1*/
+    @ApiModelProperty(value = "定尺")
+    private String size;
+
+    @ApiModelProperty(value = "总支数")
+    private Integer nums;
+    /**出坯量*/
+    @ApiModelProperty(value = "出坯重量")
+    private Double blankOutput;
+
+    public DestinationStatisticsDetails(String size, Integer nums, Double blankOutput) {
+        this.size = size;
+        this.nums = nums;
+        this.blankOutput = blankOutput;
+    }
+}

+ 4 - 6
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/IRollHeightService.java

@@ -1,14 +1,9 @@
 package org.jeecg.modules.billet.rollHeight.service;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeight;
 
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-
 /**
  * @Description: 轧钢高线
  * @Author: jeecg-boot
@@ -16,4 +11,7 @@ import java.util.List;
  * @Version: V1.0
  */
 public interface IRollHeightService extends IService<RollHeight> {
+
+    DestinationStatistics queryByCcmNoHandle(String ccmNo);
+
 }

+ 56 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollHeight/service/impl/RollHeightServiceImpl.java

@@ -1,11 +1,24 @@
 package org.jeecg.modules.billet.rollHeight.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeight;
+import org.jeecg.modules.billet.rollHeight.entity.RollHeightDetails;
 import org.jeecg.modules.billet.rollHeight.mapper.RollHeightMapper;
+import org.jeecg.modules.billet.rollHeight.service.IRollHeightDetailsService;
 import org.jeecg.modules.billet.rollHeight.service.IRollHeightService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 /**
  * @Description: 轧钢棒一
  * @Author: jeecg-boot
@@ -14,4 +27,47 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class RollHeightServiceImpl extends ServiceImpl<RollHeightMapper, RollHeight> implements IRollHeightService {
+
+    @Autowired
+    private IRollHeightDetailsService rollHeightDetailsService;
+
+    @Override
+    public DestinationStatistics queryByCcmNoHandle(String ccmNo) {
+        DestinationStatistics destinationStatistics = new DestinationStatistics();
+        LambdaQueryWrapper<RollHeight> queryWrapper = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapper.eq(RollHeight::getCcmNo, ccmNo);
+        }
+        List<RollHeight> rollHeightList = baseMapper.selectList(queryWrapper);
+        if (oConvertUtils.listIsEmpty(rollHeightList)){
+            return null;
+        }
+        Integer amountTotal = rollHeightList.stream().map(RollHeight::getAmountTotal).reduce(0, Integer::sum);
+        // 先将每个RollHeight对象中的heightValue属性值乘以blankOutput,再求和
+        double sumResult = rollHeightList.stream().mapToDouble(rollHeight -> rollHeight.getAmountTotal() * rollHeight.getBlankOutput()).sum();
+        BigDecimal bd = BigDecimal.valueOf(sumResult).setScale(2, BigDecimal.ROUND_HALF_UP);
+        double finalResult = bd.doubleValue();
+        destinationStatistics.setCounts(amountTotal);
+        destinationStatistics.setBlankOutput(finalResult);
+        LambdaQueryWrapper<RollHeightDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapperDetails.eq(RollHeightDetails::getCcmNo, ccmNo);
+        }
+        List<RollHeightDetails> rollHeightDetailsList = rollHeightDetailsService.list(queryWrapperDetails);
+        if (oConvertUtils.listIsEmpty(rollHeightList)){
+            return destinationStatistics;
+        }
+        // 根据size属性进行分组,并统计每组的总数和总重
+        Map<String, Double> sumBySize = rollHeightDetailsList.stream()
+                .collect(Collectors.groupingBy(RollHeightDetails::getSize,Collectors.summingDouble(RollHeightDetails::getBlankOutput)));
+        Map<String, Long> countBySize = rollHeightDetailsList.stream().collect(Collectors.groupingBy( RollHeightDetails::getSize, Collectors.counting()));
+
+        List<DestinationStatisticsDetails> rollHeightStatisticsDetailsList = new ArrayList<>();
+        sumBySize.forEach((size, totalWeight) -> {
+            long count = countBySize.get(size);
+            rollHeightStatisticsDetailsList.add(new DestinationStatisticsDetails(size, (int) count, totalWeight));
+        });
+        destinationStatistics.setStatisticsDetailsList(rollHeightStatisticsDetailsList);
+        return destinationStatistics;
+    }
 }

+ 11 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/controller/RollOutShippController.java

@@ -10,6 +10,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
 import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -131,5 +132,14 @@ public class RollOutShippController {
 		return Result.OK(rollOutShipp);
 
 	}
-	
+
+	 @ApiOperation(value="上若-通过铸机号查询", notes="上若-通过铸机号查询")
+	 @GetMapping(value = "/queryRollOutShippByCcmNo")
+	 public Result<DestinationStatistics> queryByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo) {
+		 DestinationStatistics destinationStatistics = rollOutShippService.queryByCcmNoHandle(ccmNo);
+		 if(destinationStatistics == null) {
+			 return Result.ok("未找到对应数据");
+		 }
+		 return Result.OK(destinationStatistics);
+	 }
 }

+ 2 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/IRollOutShippService.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.billet.rollOutShipp.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
 
 /**
@@ -10,4 +11,5 @@ import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
  * @Version: V1.0
  */
 public interface IRollOutShippService extends IService<RollOutShipp> {
+    DestinationStatistics queryByCcmNoHandle(String ccmNo);
 }

+ 72 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/service/impl/RollOutShippServiceImpl.java

@@ -1,11 +1,23 @@
 package org.jeecg.modules.billet.rollOutShipp.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatistics;
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
+import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
 import org.jeecg.modules.billet.rollOutShipp.mapper.RollOutShippMapper;
+import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippDetailsService;
 import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 /**
  * @Description: 上若
  * @Author: jeecg-boot
@@ -14,4 +26,64 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class RollOutShippServiceImpl extends ServiceImpl<RollOutShippMapper, RollOutShipp> implements IRollOutShippService {
+
+
+    @Autowired
+    private IRollOutShippDetailsService rollOutShippDetailsService;
+
+    @Override
+    public DestinationStatistics queryByCcmNoHandle(String ccmNo) {
+
+        DestinationStatistics destinationStatistics = new DestinationStatistics();
+//        LambdaQueryWrapper<RollOutShipp> queryWrapper = new LambdaQueryWrapper<>();
+//        if (oConvertUtils.isNotEmpty(ccmNo)){
+//            queryWrapper.eq(RollOutShipp::getCcmNo, ccmNo);
+//        }
+//        List<RollOutShipp> rollOutShippsList = baseMapper.selectList(queryWrapper);
+//        if (oConvertUtils.listIsEmpty(rollOutShippsList)){
+//            return null;
+//        }
+//        Integer amountTotal = rollOutShippsList.stream().map(RollOutShipp::getAmountTotal).reduce(0, Integer::sum);
+//        // 先将每个RollHeight对象中的heightValue属性值乘以blankOutput,再求和
+//        double sumResult = rollOutShippsList.stream().mapToDouble(x -> x.getAmountTotal() * x.getBlankOutput()).sum();
+//        BigDecimal bd = BigDecimal.valueOf(sumResult).setScale(2, BigDecimal.ROUND_HALF_UP);
+//        double finalResult = bd.doubleValue();
+//        destinationStatistics.setCounts(amountTotal);
+//        destinationStatistics.setBlankOutput(finalResult);
+        LambdaQueryWrapper<RollOutShippDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
+        if (oConvertUtils.isNotEmpty(ccmNo)){
+            queryWrapperDetails.eq(RollOutShippDetails::getCcmNo, ccmNo);
+        }
+        List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapperDetails);
+        if (oConvertUtils.listIsEmpty(rollOutShippDetailsList)){
+            return destinationStatistics;
+        }
+        // 根据size属性进行分组,并统计每组的总数和总重
+        Map<String, Double> sumBySize = rollOutShippDetailsList.stream().collect(Collectors.groupingBy(RollOutShippDetails::getSize,Collectors.summingDouble(RollOutShippDetails::getBlankOutput)));
+        Map<String, Double> resultMap = sumBySize.entrySet().stream()
+                .collect(Collectors.toMap(
+                        Map.Entry::getKey,
+                        entry -> Double.parseDouble(String.format("%.2f", entry.getValue()))
+                ));
+        Map<String, Long> countBySize = rollOutShippDetailsList.stream().collect(Collectors.groupingBy(RollOutShippDetails::getSize, Collectors.counting()));
+
+        List<DestinationStatisticsDetails> rollOutShippDetailsStatisticsList = new ArrayList<>();
+        sumBySize.forEach((size, totalWeight) -> {
+            long count = countBySize.get(size);
+            rollOutShippDetailsStatisticsList.add(new DestinationStatisticsDetails(size, (int) count, totalWeight));
+        });
+        Integer sums = rollOutShippDetailsStatisticsList.stream()
+                .map(DestinationStatisticsDetails::getNums)
+                .reduce(0, Integer::sum);
+        // 使用String.format方法对求和结果保留两位小数
+        double blankOutputSum = rollOutShippDetailsStatisticsList.stream()
+                .mapToDouble(DestinationStatisticsDetails::getBlankOutput)
+                .sum();
+        String formattedResult = String.format("%.2f", blankOutputSum);
+        double finalBlankOutputSum = Double.parseDouble(formattedResult);
+        destinationStatistics.setCounts(sums);
+        destinationStatistics.setBlankOutput(finalBlankOutputSum);
+        destinationStatistics.setStatisticsDetailsList(rollOutShippDetailsStatisticsList);
+        return destinationStatistics;
+    }
 }

+ 4 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/impl/StackingAndLoadingVehiclesServiceImpl.java

@@ -609,6 +609,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
             List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
             BilletBasicInfo billetBasicInfo = billetBasicInfoList.stream().findFirst().orElse(null);
             List<String> heatNos = billetBasicInfoList.stream().map(BilletBasicInfo::getHeatNo).distinct().collect(Collectors.toList());
+            double amountTotal = billetBasicInfoList.stream().mapToDouble(BilletBasicInfo::getBilletWeight).sum();
             stackingDownLog.setHeatNo(String.join(",", heatNos));
             stackingDownLog.setBilletNo(x.getBilletNos());
             stackingDownLog.setStorageBillId(storageBill.getId());
@@ -633,7 +634,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
                 rollClubTwoDetails.setCreateTime(new Date());
                 rollClubTwoDetails.setUpdateTime(new Date());
                 rollClubTwoDetails.setId(String.valueOf(IdWorker.getId()));
-                rollClubTwoDetails.setBlankOutput(billetBasicInfo.getBilletWeight());//出坯量
+                rollClubTwoDetails.setBlankOutput(amountTotal);//出坯量
                 addRollClubTwoDetailsList.add(rollClubTwoDetails);
             }else if ("roll_club_three".equals(loadingParams.getDestinationTable())){
                 RollClubThreeDetails rollClubThreeDetails = new RollClubThreeDetails();
@@ -649,7 +650,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
                 rollClubThreeDetails.setCreateTime(new Date());
                 rollClubThreeDetails.setUpdateTime(new Date());
                 rollClubThreeDetails.setId(String.valueOf(IdWorker.getId()));
-                rollClubThreeDetails.setBlankOutput(billetBasicInfo.getBilletWeight());//出坯量
+                rollClubThreeDetails.setBlankOutput(amountTotal);//出坯量
                 addRollClubThreeDetailsList.add(rollClubThreeDetails);
             }else if ("roll_out_shipp".equals(loadingParams.getDestinationTable())){
                 RollOutShippDetails rollOutShippDetails = new RollOutShippDetails();
@@ -665,7 +666,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
                 rollOutShippDetails.setId(String.valueOf(IdWorker.getId()));
                 rollOutShippDetails.setCreateTime(new Date());
                 rollOutShippDetails.setUpdateTime(new Date());
-                rollOutShippDetails.setBlankOutput(billetBasicInfo.getBilletWeight());//出坯量
+                rollOutShippDetails.setBlankOutput(amountTotal);//出坯量
                 addRollOutShippDetailsList.add(rollOutShippDetails);
             }
         });