|
@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -50,9 +51,22 @@ public class RepairCustomerService {
|
|
|
wrapper.in(Repair::getRepairId,repairIds);
|
|
|
wrapper.orderByDesc(Repair::getCreateTime);
|
|
|
List<Repair> repairList = repairService.list(wrapper);
|
|
|
- HashMap<String,BigDecimal> amountMap = priceListService.getAmountByRepairIds(repairIds);
|
|
|
+
|
|
|
for (Repair repair : repairList) {
|
|
|
- repair.setPayAmount(amountMap.get(repair.getRepairId()));
|
|
|
+ List<PriceList> priceLists = new ArrayList<>();
|
|
|
+ if(repair.getCancelStatus() == 1){
|
|
|
+ priceLists = priceListService.getCheckAmountByRepairId(repair.getRepairId());
|
|
|
+ }
|
|
|
+ if(repair.getCancelStatus() == 0){
|
|
|
+ priceLists = priceListService.getByRepairId(repair.getRepairId());
|
|
|
+ }
|
|
|
+ BigDecimal payAmount = BigDecimal.ZERO;
|
|
|
+
|
|
|
+ for (PriceList priceList : priceLists) {
|
|
|
+ BigDecimal price = priceList.getDiscount() == 1 ? priceList.getPriceDiscount() : priceList.getPrice();
|
|
|
+ payAmount = payAmount.add(price);
|
|
|
+ }
|
|
|
+ repair.setPayAmount(payAmount);
|
|
|
}
|
|
|
return repairList;
|
|
|
}
|