Procházet zdrojové kódy

取消维修,只显示检测费用

lyhzzz před 2 roky
rodič
revize
e88add5394

+ 5 - 0
src/main/java/com/fdkankan/sale/entity/Repair.java

@@ -110,4 +110,9 @@ public class Repair implements Serializable {
      */
     @TableField("warranty_type")
     private Integer warrantyType;
+    /**
+     * 是否取消维修,0 否,1是
+     */
+    @TableField("cancel_status")
+    private Integer cancelStatus;
 }

+ 2 - 0
src/main/java/com/fdkankan/sale/service/IRepairService.java

@@ -44,4 +44,6 @@ public interface IRepairService extends IService<Repair> {
     String getLastRepairId(String cameraSnCode, String repairId);
 
     void updateWarrantyType(String repairId, Integer warrantyType);
+
+    void updateCancelStatus(String repairId, Integer status);
 }

+ 2 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairCustomerService.java

@@ -84,6 +84,8 @@ public class RepairCustomerService {
             List<RepairRegisterPartVo> partVoList = repairSupplyService.partInfo(repair.getRepairId(), 1);
             BigDecimal robAmount = priceListService.getRobAmountByRepairId(repair.getRepairId());
 
+            repairService.updateCancelStatus(repair.getRepairId(),1);
+
             if(robAmount.compareTo(BigDecimal.ZERO) <=0  ||  repair.getWarrantyType() == 0 ){
                 if(partVoList.size() >0){
                     repairLogService.saveBySysUser(param.getUserId(),repair.getRepairId(),RepairStatusEnum.TO_BE_CANCELED_RECOVERED.status(),"已取消维修");

+ 14 - 8
src/main/java/com/fdkankan/sale/service/impl/RepairInfoService.java

@@ -64,7 +64,6 @@ public class RepairInfoService {
 
         Customer customer =  customerService.getByRepairId(repairId);
         CustomerAddress customerAddress = customerAddressService.getByRepairId(repairId);
-        List<PriceList> priceLists = priceListService.getByRepairId(repairId);
 
         RepairPay repairPay = repairPayService.getByRepairId(repairId,1);
         OrderReceivingVo receiving = orderReceivingService.getVoByRepairId(repairId);
@@ -81,19 +80,26 @@ public class RepairInfoService {
             detailVo.setRepairInvoice(repairInvoice);
             detailVo.setApplyInvoice(1);
         }
-        BigDecimal payAmount = BigDecimal.ZERO;
-        if(repair.getStatus().equals(RepairStatusEnum.TO_BE_CANCELED.status())){
-            payAmount = priceListService.getRobAmountByRepairId(repair.getRepairId());
+
+        List<PriceList> priceLists = new ArrayList<>();
+        if(repair.getCancelStatus() == 1){
+            priceLists = priceListService.getCheckAmountByRepairId(repairId);
         }
-        if(repair.getStatus().equals(RepairStatusEnum.TO_BE_PAID.status())){
-            payAmount = priceListService.getAmountByRepairId(repair.getRepairId());
+        if(repair.getCancelStatus() == 0){
+            priceLists =  priceListService.getByRepairId(repairId);
         }
-        detailVo.setPayAmount(payAmount);
+        BigDecimal payAmount = BigDecimal.ZERO;
 
+        for (PriceList priceList : priceLists) {
+            BigDecimal price = priceList.getDiscount() == 1 ? priceList.getPriceDiscount() : priceList.getPrice();
+            payAmount = payAmount.add(price);
+        }
+
+        detailVo.setPayAmount(payAmount);
+        detailVo.setPriceList(priceLists);
         detailVo.setCustomer(customer);
         detailVo.setCustomerAddress(customerAddress);
         detailVo.setRepairerVo(repair);
-        detailVo.setPriceList(priceLists);
         detailVo.setRepairPay(repairPay);
         detailVo.setOrderReceivingVo(receiving);
         detailVo.setRepairRegisterVo(repairRegisterVo);

+ 8 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairServiceImpl.java

@@ -165,4 +165,12 @@ public class RepairServiceImpl extends ServiceImpl<IRepairMapper, Repair> implem
         wrapper.set(Repair::getWarrantyType,warrantyType);
         this.update(wrapper);
     }
+
+    @Override
+    public void updateCancelStatus(String repairId, Integer status) {
+        LambdaUpdateWrapper<Repair> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(Repair::getRepairId,repairId);
+        wrapper.set(Repair::getCancelStatus,status);
+        this.update(wrapper);
+    }
 }