|
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -45,6 +47,24 @@ public class PriceListServiceImpl extends ServiceImpl<IPriceListMapper, PriceLis
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public HashMap<String, BigDecimal> getAmountByRepairIds(List<String> repairIds) {
|
|
|
+ HashMap<String, BigDecimal> map = new HashMap<>();
|
|
|
+ List<PriceList> byRepairId = this.getByRepairIdsAndStatus(repairIds,1);
|
|
|
+ for (PriceList priceList : byRepairId) {
|
|
|
+ map.putIfAbsent(priceList.getRepairId(), BigDecimal.ZERO);
|
|
|
+ BigDecimal amount = map.get(priceList.getRepairId());
|
|
|
+ if(priceList.getDiscount() == 0){
|
|
|
+ amount = amount.add(priceList.getPrice().multiply(new BigDecimal(priceList.getCount())));
|
|
|
+ }
|
|
|
+ if(priceList.getDiscount() == 1){
|
|
|
+ amount = amount.add(priceList.getPriceDiscount().multiply(new BigDecimal(priceList.getCount())));
|
|
|
+ }
|
|
|
+ map.put(priceList.getRepairId(),amount);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public BigDecimal getRobAmountByRepairId(String repairId) {
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
List<PriceList> byRepairId = this.getCheckAmountByRepairId(repairId);
|
|
@@ -69,6 +89,15 @@ public class PriceListServiceImpl extends ServiceImpl<IPriceListMapper, PriceLis
|
|
|
wrapper.eq(PriceList::getStatus,1);
|
|
|
return list(wrapper);
|
|
|
}
|
|
|
+ public List<PriceList> getByRepairIdsAndStatus(List<String> repairIds, Integer status) {
|
|
|
+ if(repairIds.size() >0){
|
|
|
+ LambdaQueryWrapper<PriceList> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.in(PriceList::getRepairId,repairIds);
|
|
|
+ wrapper.eq(PriceList::getStatus,1);
|
|
|
+ return list(wrapper);
|
|
|
+ }
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public List<PriceList> getCheckAmountByRepairId(String repairId) {
|