package com.agentdriving.driver.modular.system.api; import com.agentdriving.driver.modular.system.service.IDriverService; import com.agentdriving.driver.modular.system.service.IDriverWorkService; import com.agentdriving.driver.modular.system.util.ResultUtil; import com.agentdriving.driver.modular.system.warpper.ResponseWarpper; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; /** * 司机上下班控制器 * @author pzb * @Date 2023/2/15 15:39 */ @RestController @RequestMapping("") public class DriverWorkController { @Autowired private IDriverService driverService; @Autowired private IDriverWorkService driverWorkService; @ResponseBody @PostMapping("/api/home/driverWork") // @ServiceLog(name = "司机上班操作", url = "/api/home/driverWork") @ApiOperation(value = "司机上班操作", tags = {"司机端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResponseWarpper driverWork(){ try { Integer uid = driverService.getUserByRequest(); if(null == uid){ return ResponseWarpper.tokenErr(); } ResultUtil resultUtil = driverWorkService.driverWork(uid); return ResponseWarpper.success(resultUtil); }catch (Exception e){ e.printStackTrace(); return new ResponseWarpper(500, e.getMessage()); } } @ResponseBody @PostMapping("/api/home/driverOffWork") // @ServiceLog(name = "司机下班操作", url = "/api/home/driverOffWork") @ApiOperation(value = "司机下班操作", tags = {"司机端-首页"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResponseWarpper driverOffWork(){ try { Integer uid = driverService.getUserByRequest(); if(null == uid){ return ResponseWarpper.tokenErr(); } ResultUtil resultUtil = driverWorkService.driverOffWork(uid, 0L); return ResponseWarpper.success(resultUtil); }catch (Exception e){ e.printStackTrace(); return new ResponseWarpper(500, e.getMessage()); } } }