package com.yanzhu.jh.bigscreen.web.controller;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.yanzhu.jh.project.domain.SurProjectMeasure;
import com.yanzhu.jh.project.service.ISurProjectMeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("/bgscreen/measure")
public class ProjectMeasureController {
    @Autowired
    ISurProjectMeasureService measureService;
    @Autowired
    private RedisCache redisCache;
    /**
     * 按测量内容分组查询
     * @param where  measureType 测量类型  deptId部门编号  projectId项目编号
     * @return
     */
    @PostMapping("groupMeasureInfo")
    public AjaxResult groupMeasureInfo(@RequestBody SurProjectMeasure where){
        String key="bgscreen_measure_groupMeasureInfo_"+where.getMeasureType()+"_"+where.getDeptId()+"_"+where.getProjectId();
        //Object obj=redisCache.getCacheObject(key);
       // if(obj!=null){
         //   return AjaxResult.success(obj);
       // }
        List<SurProjectMeasure> list=measureService.groupMeasureInfo(where);
        //redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
        return AjaxResult.success(list);
    }
}
