lyhzzz 2 năm trước cách đây
mục cha
commit
3afc4ce94d

+ 4 - 2
src/main/java/com/fdkankan/sale/controller/RepairInfoController.java

@@ -45,7 +45,7 @@ public class RepairInfoController extends BaseController{
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         SysUser user = getUser();
-        RepairDetailVo detailVo = repairInfoService.getDetailsByRepairId(repairId);
+        RepairDetailVo detailVo = repairInfoService.getDetailsByRepairId(repairId,false);
 
         if(user == null){
             return ResultData.ok(detailVo);
@@ -86,11 +86,13 @@ public class RepairInfoController extends BaseController{
     @GetMapping("/exportExcel")
     public void exportExcel(@RequestParam(required = false) String repairId,
                             @RequestParam(required = false,defaultValue = "0") Integer type){
-        OrderListVo orderListVo = repairInfoService.getExportVo(repairId);
+
         if(type == 0){
+            OrderListVo orderListVo = repairInfoService.getExportVo(repairId,true);
             excelUtil.listFill(response,repairId+"_报价单",orderListVo,orderListVo.getPriceListExcelVos(),orderListVo.getExportImg(),type);
         }
         if(type == 1){
+            OrderListVo orderListVo = repairInfoService.getExportVo(repairId,false);
             excelUtil.listFill(response,repairId+"_维修工单",orderListVo,orderListVo.getPriceListExcelVos(),orderListVo.getExportImg(),type);
         }
     }

+ 1 - 1
src/main/java/com/fdkankan/sale/controller/TestController.java

@@ -101,7 +101,7 @@ public class TestController {
         String tempPath = "G:\\templates\\pdf\\四维时代售后服务清单-模版.pdf";
         //文字类
         // dataMap中的key要和模板中的域名对应
-        OrderListVo orderListVo = repairInfoService.getExportVo(repairId);
+        OrderListVo orderListVo = repairInfoService.getExportVo(repairId,true);
         Map<String, Object> dataMap = BeanUtil.beanToMap(orderListVo);
         //图片
         Map<String, Object> imgMap = BeanUtil.beanToMap(orderListVo.getExportImg());

+ 11 - 7
src/main/java/com/fdkankan/sale/service/impl/RepairInfoService.java

@@ -66,7 +66,7 @@ public class RepairInfoService {
     ISysUserService sysUserService;
 
 
-    public RepairDetailVo getDetailsByRepairId(String repairId) {
+    public RepairDetailVo getDetailsByRepairId(String repairId,Boolean allPrice) {
         Repair repair = repairService.getById(repairId);
         if(repair == null){
             throw new BusinessException( ResultCode.ORDER_PAY_NOT_EXITS);
@@ -93,11 +93,15 @@ public class RepairInfoService {
         }
 
         List<PriceList> priceLists = new ArrayList<>();
-        if(repair.getCancelStatus() == 1){
-            priceLists = priceListService.getCheckAmountByRepairId(repairId);
-        }
-        if(repair.getCancelStatus() == 0){
+        if(allPrice){
             priceLists =  priceListService.getByRepairId(repairId);
+        }else {
+            if(repair.getCancelStatus() == 1){
+                priceLists = priceListService.getCheckAmountByRepairId(repairId);
+            }
+            if(repair.getCancelStatus() == 0){
+                priceLists =  priceListService.getByRepairId(repairId);
+            }
         }
         BigDecimal payAmount = BigDecimal.ZERO;
 
@@ -303,8 +307,8 @@ public class RepairInfoService {
         return PageInfo.PageInfo(page);
     }
 
-    public OrderListVo getExportVo(String repairId) {
-        RepairDetailVo repairDetailVo = this.getDetailsByRepairId(repairId);
+    public OrderListVo getExportVo(String repairId,Boolean allPrice) {
+        RepairDetailVo repairDetailVo = this.getDetailsByRepairId(repairId,allPrice);
         OrderListVo vo = new OrderListVo();
         vo.setCompanyName(repairDetailVo.getCustomer().getCompanyName());
         vo.setCustomerName(repairDetailVo.getCustomer().getCustomerName());