package com.ruoyi.web.controller.api; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.basic.PageDTO; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.ReportingStatusEnum; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.domain.TbBasicData; import com.ruoyi.system.dto.HistoryDataQueryDTO; import com.ruoyi.system.query.HistoryScoreQuery; import com.ruoyi.system.service.TbBasicDataService; import com.ruoyi.system.service.TbFieldService; import com.ruoyi.system.service.TbScoreService; import com.ruoyi.system.vo.BasicDataFieldVO; import com.ruoyi.system.vo.BasicDataVO; import com.ruoyi.system.vo.ScoreVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; /** * @author mitao * @date 2024/4/1 */ @Slf4j @RestController @RequestMapping("/history-data") @RequiredArgsConstructor @Api(tags = "历史数据相关接口") public class HistoryDataController { private final TbBasicDataService tbBasicDataService; private final TbFieldService tbFieldService; private final TbScoreService tbScoreService; @PostMapping("/list") @ApiOperation("历史数据分页查询") public R> list(HistoryDataQueryDTO dto) { String areaCode = SecurityUtils.getLoginUser().getUser().getAreaCode(); Page page = tbBasicDataService.lambdaQuery().eq(TbBasicData::getDeptAreaCode, areaCode) .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) .page(new Page(dto.getPageNum(), dto.getPageSize())); return R.ok(PageDTO.of(page, BasicDataVO.class)); } @GetMapping("/history-fields") @ApiOperation("字段查看") @ApiImplicitParam(name = "id", value = "基础数据id", required = true, dataType = "int", paramType = "query", dataTypeClass = Long.class) public R getHistoryFields(@RequestParam("id") Long id) { return R.ok(tbFieldService.getHistoryFields(id)); } @PostMapping("/history-score") @ApiOperation("得分计算") public R> getHistoryScore(@RequestBody HistoryScoreQuery query) { return R.ok(tbScoreService.getHistoryScore(query)); } }