package com.iailab.module.data.api.controller; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.data.api.ind.dto.ApiIndItemQueryDTO; import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; import com.iailab.module.data.ind.collection.IndItemCollector; import com.iailab.module.data.ind.item.vo.IndItemValueVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.security.PermitAll; import java.util.List; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年10月10日 */ @Slf4j @RestController @RequestMapping("/api/data/ind-item") @Tag(name = "指标") public class IndItemController { @Autowired private IndItemCollector indItemCollector; @PermitAll @GetMapping("/query-ind/default-value") @Operation(summary = "查询指标默认值") public CommonResult> queryIndItemDefaultValue(@RequestParam String itemNo) { List list = indItemCollector.queryValue(itemNo); return success(ConvertUtils.sourceToTarget(list, ApiIndItemValueDTO.class)); } @PermitAll @GetMapping("/query-ind/history-value") @Operation(summary = "查询指标历史值") public CommonResult> queryIndItemHistoryValue(@RequestParam ApiIndItemQueryDTO dto) { List list = indItemCollector.queryValue(dto.getItemNo(), dto.getStart(), dto.getEnd()); return success(ConvertUtils.sourceToTarget(list, ApiIndItemValueDTO.class)); } }