|
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -50,6 +51,10 @@ public class RepairSaleService {
|
|
IPriceListService priceListService;
|
|
IPriceListService priceListService;
|
|
@Autowired
|
|
@Autowired
|
|
IRepairPayService repairPayService;
|
|
IRepairPayService repairPayService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IPartService partService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ILaborCostService laborCostService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 售后工程师
|
|
* 售后工程师
|
|
@@ -136,14 +141,36 @@ public class RepairSaleService {
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
throw new BusinessException(ResultCode.REPAIR_NOT_EXITS);
|
|
}
|
|
}
|
|
|
|
|
|
- List<PriceList> priceLists = param.getPriceLists();
|
|
|
|
- for (PriceList priceList : priceLists) {
|
|
|
|
|
|
+
|
|
|
|
+ HashMap<Integer,Part> partMap = partService.getHashMap();
|
|
|
|
+ HashMap<Integer,LaborCost> laborMap = laborCostService.getHashMap();
|
|
|
|
+ priceListService.delNoCm(param.getRepairId());
|
|
|
|
+
|
|
|
|
+ for (PriceList priceList : param.getPriceLists()) {
|
|
if(priceList.getType() == null){
|
|
if(priceList.getType() == null){
|
|
throw new BusinessException(ResultCode.PRICE_TYPE_NOT);
|
|
throw new BusinessException(ResultCode.PRICE_TYPE_NOT);
|
|
}
|
|
}
|
|
|
|
+ if(priceList.getType() == 0){
|
|
|
|
+ if(priceList.getPartId() == null || partMap.get(priceList.getPartId()) == null){
|
|
|
|
+ throw new BusinessException(ResultCode.PART_ID_EMPTY);
|
|
|
|
+ }
|
|
|
|
+ Part part = partMap.get(priceList.getPartId());
|
|
|
|
+ priceList.setPrice(part.getPartPrice());
|
|
|
|
+ priceList.setName(part.getPartName());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(priceList.getType() == 1){
|
|
|
|
+ if(priceList.getLaborId() == null || laborMap.get(priceList.getLaborId()) == null){
|
|
|
|
+ throw new BusinessException(ResultCode.LABOR_ID_EMPTY);
|
|
|
|
+ }
|
|
|
|
+ LaborCost laborCost = laborMap.get(priceList.getLaborId());
|
|
|
|
+ priceList.setPrice(laborCost.getPrice());
|
|
|
|
+ priceList.setName(laborCost.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
priceList.setRepairId(param.getRepairId());
|
|
priceList.setRepairId(param.getRepairId());
|
|
}
|
|
}
|
|
- priceListService.saveOrUpdateBatch(priceLists);
|
|
|
|
|
|
+ priceListService.saveOrUpdateBatch(param.getPriceLists());
|
|
repairLogService.saveBySysUser(userId,param.getRepairId(),3,"维修报价");
|
|
repairLogService.saveBySysUser(userId,param.getRepairId(),3,"维修报价");
|
|
}
|
|
}
|
|
|
|
|