|  |  | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.dao.business.model.Cars; | 
 |  |  | import com.doumee.service.business.CarsService; | 
 |  |  | import com.doumee.service.business.ParkBookService; | 
 |  |  | import com.doumee.service.business.impl.hksync.fhk.HkSyncVehicleFromHKServiceImpl; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import io.swagger.annotations.*; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  | import org.springframework.web.multipart.MultipartFile; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import java.io.File; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  | /** | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private CarsService carsService; | 
 |  |  |     @Autowired | 
 |  |  |     private ParkBookService parkBookService; | 
 |  |  |     @Autowired | 
 |  |  |     private HkSyncVehicleFromHKServiceImpl hkSyncVehicleFromHKService; | 
 |  |  |  | 
 |  |  | 
 |  |  |     @PostMapping("/page") | 
 |  |  |     @CloudRequiredPermission("business:cars:query") | 
 |  |  |     public ApiResponse<PageData<Cars>> findPage (@RequestBody PageWrap<Cars> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
 |  |  |         pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(carsService.findPage(pageWrap)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @PostMapping("/list") | 
 |  |  |     @CloudRequiredPermission("business:cars:query") | 
 |  |  |     public ApiResponse<List<Cars>> findList (@RequestBody Cars cars,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
 |  |  |        cars.setLoginUserInfo(this.getLoginUser(token)); | 
 |  |  |         return ApiResponse.success(carsService.findList(cars)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @PostMapping("/exportExcel") | 
 |  |  |     @CloudRequiredPermission("business:cars:exportExcel") | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<Cars> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
 |  |  |         pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); | 
 |  |  |         ExcelExporter.build(Cars.class).export(carsService.findPage(pageWrap).getRecords(), "车辆信息表", response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
 |  |  |         return ApiResponse.success(carsService.findById(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "车辆信息导入" ,notes = "车辆信息导入") | 
 |  |  |     @PostMapping("/importExcel") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), | 
 |  |  |     }) | 
 |  |  |     @CloudRequiredPermission("business:cars:create") | 
 |  |  |     public ApiResponse<String> importExcel (@ApiParam(value = "file") MultipartFile file, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         List<Cars> carsList = carsService.importBatch(file,this.getLoginUser(token)); | 
 |  |  |         //异步更新车辆授权数据 | 
 |  |  |         carsService.dealCarsAuthBiz(carsList); | 
 |  |  |         return ApiResponse.success("导入成功"); | 
 |  |  |     } | 
 |  |  | } |