|
@@ -180,6 +180,9 @@ public class RepairSaleService {
|
|
|
&& !repair.getStatus().equals(RepairStatusEnum.TO_BE_CONFIRMED.status())){
|
|
|
throw new BusinessException(ResultCode.REPAIR_STATUS_NOT_EXITS);
|
|
|
}
|
|
|
+ if(param.getConvertWarranty() == 1){ //保外转保内
|
|
|
+ repairService.updateWarrantyType(repair.getRepairId(),3);
|
|
|
+ }
|
|
|
|
|
|
HashMap<Integer,Part> partMap = partService.getHashMap();
|
|
|
HashMap<Integer,LaborCost> laborMap = laborCostService.getHashMap();
|
|
@@ -189,11 +192,13 @@ public class RepairSaleService {
|
|
|
priceListList.forEach(entity -> priceListHashMap.put(entity.getPriceListId(),entity));
|
|
|
|
|
|
priceListService.delNoCm(repair.getRepairId());
|
|
|
+ Integer status = RepairStatusEnum.TO_BE_CONFIRMED.status();
|
|
|
+
|
|
|
for (PriceList priceList : param.getPriceLists()) {
|
|
|
if(priceList.getType() == null){
|
|
|
throw new BusinessException(ResultCode.PRICE_TYPE_NOT);
|
|
|
}
|
|
|
- if(priceList.getType() == 0){
|
|
|
+ if(priceList.getType() == 0){ //设备备件
|
|
|
if(priceList.getPartId() == null || partMap.get(priceList.getPartId()) == null || priceList.getDiscount() == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
@@ -201,16 +206,22 @@ public class RepairSaleService {
|
|
|
priceList.setPrice(part.getPartPrice());
|
|
|
priceList.setPriceDiscount(part.getPartPriceDiscount());
|
|
|
priceList.setName(part.getPartName());
|
|
|
-
|
|
|
+ if(param.getConvertWarranty() == 1){
|
|
|
+ status = RepairStatusEnum.TO_BE_PREPARED.status();
|
|
|
+ }
|
|
|
}
|
|
|
- if(priceList.getType() == 1){
|
|
|
+ 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.setPriceListId(null);
|
|
|
+ }
|
|
|
+ if(priceList.getType() == 2){ //自定义费用
|
|
|
+ if(StringUtils.isBlank(priceList.getName()) || priceList.getPrice() == null){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
}
|
|
|
priceList.setRepairId(param.getRepairId());
|
|
|
if(priceList.getPriceListId() != null){
|
|
@@ -219,13 +230,20 @@ public class RepairSaleService {
|
|
|
priceList.setStatus(priceList1.getStatus());
|
|
|
}
|
|
|
priceList.setPriceListId(null);
|
|
|
- priceListService.save(priceList);
|
|
|
- }else {
|
|
|
- priceListService.save(priceList);
|
|
|
}
|
|
|
|
|
|
+ if(param.getConvertWarranty() == 1){
|
|
|
+ priceList.setStatus(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ priceListService.save(priceList);
|
|
|
+
|
|
|
+ }
|
|
|
+ if(param.getConvertWarranty() == 1 && !status.equals(RepairStatusEnum.TO_BE_PREPARED.status())){
|
|
|
+ status = RepairStatusEnum.TO_BE_REPAIRED.status();
|
|
|
}
|
|
|
- repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.TO_BE_CONFIRMED.status(),repair.getStatus(),"维修报价");
|
|
|
+
|
|
|
+ repairLogService.saveBySysUser(userId,param.getRepairId(),status,repair.getStatus(),"维修报价");
|
|
|
}
|
|
|
|
|
|
public PriceListVo getPriceList(String repairId) {
|