|
@@ -25,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -129,8 +131,15 @@ public class RepairRegisterServiceImpl extends ServiceImpl<IRepairRegisterMapper
|
|
|
PriceListVo priceListVo = new PriceListVo();
|
|
|
priceListVo.setCount(1);
|
|
|
List<PriceList> priceLists = new ArrayList<>();
|
|
|
+
|
|
|
+ HashMap<Integer,Part> partHashMap = new HashMap<>();
|
|
|
+ List<Integer> collect = partList.stream().map(RepairRegisterPart::getPartId).collect(Collectors.toList());
|
|
|
+ if(collect.size() >0){
|
|
|
+ List<Part> parts = partService.listByIds(collect);
|
|
|
+ parts.forEach(entity -> partHashMap.put(entity.getPartId(),entity));
|
|
|
+ }
|
|
|
for (RepairRegisterPart repairRegisterPart : partList) {
|
|
|
- Part part = partService.getById(repairRegisterPart.getPartId());
|
|
|
+ Part part = partHashMap.get(repairRegisterPart.getPartId());
|
|
|
if(part == null){
|
|
|
continue;
|
|
|
}
|
|
@@ -141,6 +150,8 @@ public class RepairRegisterServiceImpl extends ServiceImpl<IRepairRegisterMapper
|
|
|
priceList.setCount(repairRegisterPart.getPartCount());
|
|
|
priceList.setPartId(part.getPartId());
|
|
|
priceList.setPriceDiscount(part.getPartPriceDiscount());
|
|
|
+ priceList.setPartUnit(part.getPartUnit());
|
|
|
+ priceList.setType(0);
|
|
|
priceLists.add(priceList);
|
|
|
}
|
|
|
priceListVo.setPriceLists(priceLists);
|