yangys
2024-12-30 7cd413d0f1e3235223848d47e428aad97f9f13fc
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
package com.qianwen.smartman.modules.workinghour.controller;
 
import java.util.List;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qianwen.core.boot.ctrl.BladeController;
import com.qianwen.core.mp.support.Condition;
import com.qianwen.core.mp.support.Query;
import com.qianwen.core.oss.model.BladeFile;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.tenant.annotation.NonDS;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.common.vo.CommonIdsVO;
import com.qianwen.smartman.modules.workinghour.service.PartWorkingHourExportService;
import com.qianwen.smartman.modules.workinghour.service.PartWorkingHourService;
import com.qianwen.smartman.modules.workinghour.vo.PartWorkingHourQueryVO;
import com.qianwen.smartman.modules.workinghour.vo.PartWorkingHourVO;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
 
@Api(value = "工时分析", tags = {"工时分析"})
@RestController
@ApiResource({"workinghour"})
@NonDS
@Validated
public class PartWorkHourController extends BladeController {
    private Logger log = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private PartWorkingHourService partWorkingHourService;
    @Autowired
    private PartWorkingHourExportService partWorkingHourExportService;
 
    @PostMapping({"/page"})
    @ApiOperation("查询零件列表分页")
    public R<IPage<PartWorkingHourVO>> page(@RequestBody PartWorkingHourQueryVO queryVO,Query query) {
        //@RequestParam(value = "partNo", required = false) String partNo, @RequestParam(value="workstationName", required = false) String workstationName, @RequestParam("startDate") LocalDate startDate, @RequestParam("endDate") LocalDate endDate
        return R.data(partWorkingHourService.listPage(Condition.getPage(query), queryVO.getPartNo(), queryVO.getWorkstationName(), queryVO.getStartDate(),queryVO.getEndDate()));
    }
    
    
    
    @PostMapping({"/listByIds"})
    @ApiOperation("查询零件列表-按ids")
    public R<List<PartWorkingHourVO>> listByIds(@RequestBody CommonIdsVO idsVO) {
        return R.data(partWorkingHourService.listVOByIds(idsVO.getIds()));
    }
 
    
    @GetMapping({"/exportold"})
    @ApiOperation("工时数据导出old")
    public R<BladeFile> exportOld(long id) {
        return R.data(partWorkingHourService.export(id));
    }
    
    @GetMapping({"/export"})
    @ApiOperation("工时数据导出")
    public R<BladeFile> export(long id) {
        try {
            return R.data(partWorkingHourExportService.export(id));
        } catch (Exception e) {
            log.error("导出公式数据错误",e);
            
            return R.fail(e.getMessage());
        }
    }
}