puzhibing
2023-06-20 f3672f3dbcb943bf2d21047bb0c474502bc29930
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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());
        }
    }
 
 
 
 
}