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> 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> listByIds(@RequestBody CommonIdsVO idsVO) { return R.data(partWorkingHourService.listVOByIds(idsVO.getIds())); } @GetMapping({"/exportold"}) @ApiOperation("工时数据导出old") public R exportOld(long id) { return R.data(partWorkingHourService.export(id)); } @GetMapping({"/export"}) @ApiOperation("工时数据导出") public R export(long id) { try { return R.data(partWorkingHourExportService.export(id)); } catch (Exception e) { log.error("导出公式数据错误",e); return R.fail(e.getMessage()); } } }