无关风月
2026-02-25 5bcdfc028035c1dc51e9f2b621db3d660d525978
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
package com.xiaopeng.maintenance.controller;
 
 
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xiaopeng.api.model.maintenance.XpClockIn;
import com.xiaopeng.api.model.maintenance.XpErrorType;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.security.service.TokenService;
import com.xiaopeng.maintenance.dto.ClockDTO;
import com.xiaopeng.maintenance.dto.ShiftAttendanceDTO;
import com.xiaopeng.maintenance.dto.VerifyRangeDTO;
import com.xiaopeng.maintenance.service.IXpClockInService;
import com.xiaopeng.maintenance.vo.ShiftAttendanceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 * 打卡明细 前端控制器
 * </p>
 * 打卡管理 Controller
 *
 * @author xiaochen
 * @since 2026-02-06
 * @author mitao
 * @date 2026-02-14
 */
@Slf4j
@RestController
@RequestMapping("")
public class XpClockInController {
 
    @Autowired
    private IXpClockInService xpClockInService;
    @Autowired
    private TokenService tokenService;
    @ApiOperation(value = "校验是否在打卡范围内", tags = "运维APP-排班与考勤")
    @PostMapping("/api/v1/clock/verifyRange")
    public R<Boolean> verifyRange(@RequestBody VerifyRangeDTO dto) {
        return R.ok(xpClockInService.verifyRange(dto));
    }
 
    @ApiOperation(value = "上班打卡", tags = "运维APP-排班与考勤")
    @PostMapping("/api/v1/clock/clockIn")
    public R<String> clockIn(@RequestBody ClockDTO dto) {
        Long id = tokenService.getLoginOperationUser().getId();
        dto.setOperationsUserId(id);
        return xpClockInService.clockIn(dto);
    }
 
    /**
     * 检查用户是否上班中(内部接口)
     */
    @GetMapping("/inner/clock-in/checkWorkStatus")
    @ApiOperation(value = "检查用户是否上班中", tags = {"内部接口"})
    public R<Boolean> checkWorkStatus(@RequestParam("appUserId") Long appUserId) {
        log.info("检查用户上班状态, appUserId={}", appUserId);
        Boolean workFlag = xpClockInService.checkWorkStatus(appUserId);
        return R.ok(workFlag);
    }
 
    @ApiOperation(value = "下班打卡", tags = "运维APP-排班与考勤")
    @PostMapping("/api/v1/clock/clockOut")
    public R<String> clockOut(@RequestBody ClockDTO dto) {
        Long id = tokenService.getLoginOperationUser().getId();
        dto.setOperationsUserId(id);
        return xpClockInService.clockOut(dto);
    }
 
}