huang
2025-05-20 2c2413760b6467bf62402dba7338bd3bbcbd7341
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
82
83
84
85
86
87
88
89
package com.mes.md.controller;
 
import com.mes.md.service.TaskingLogService;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
 
import java.util.Date;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wu
 * @since 2024-08-28
 */
@RestController
@RequestMapping("/taskingLog")
public class TaskingLogController {
 
    @Autowired
    TaskingLogService taskingLogService;
 
    @ApiOperation("查询报表")
    @PostMapping("/mechanicalReport")
    @ResponseBody
    public Result mechanicalReport(
            @RequestParam(required = false) Integer dayCount,
            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startDate,
            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endDate,
            @RequestParam(required = false) String taskType,
            @RequestParam(required = false) String operationRecord,
            @RequestParam(required = false) String lineType) {
        try {
            List<Map> result = taskingLogService.selectMechanicalReport(
                dayCount,
                startDate,
                endDate,
                taskType,
                operationRecord,
                lineType
            );
            return Result.build(200, "查询成功", result);
        } catch (Exception e) {
            return Result.build(199, "查询异常", null);
        }
    }
 
    @ApiOperation("提交日志以及报工数据到九牧数据库")
    @PostMapping("/reportTaskingLog")
    @ResponseBody
    public Result reportTaskingLog(@RequestBody Map<String, String> map) {
        try {
            taskingLogService.reportTaskingLog();
            return Result.build(200,"提交成功",map);
        }catch (Exception e) {
            return Result.build(199,"提交异常",map);
        }
    }
 
    @ApiOperation("提交 设备联机记录到九牧数据库")
    @PostMapping("/reportOnLine")
    @ResponseBody
    public Result reportOnLine(@RequestBody Map<String, String> map) {
        try {
            taskingLogService.reportTaskingLog();
            return Result.build(200,"提交成功",map);
        }catch (Exception e) {
            return Result.build(199,"提交异常",map);
        }
    }
 
    @ApiOperation("提交 设备开机记录到九牧数据库")
    @PostMapping("/reportPowerOn")
    @ResponseBody
    public Result reportPowerOn(@RequestBody Map<String, String> map) {
        try {
            taskingLogService.reportTaskingLog();
            return Result.build(200,"提交成功",map);
        }catch (Exception e) {
            return Result.build(199,"提交异常",map);
        }
    }
}