zjh
2023-11-06 4aa9b8cb058bcf4bae95d80810ce2ccde3406ee8
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjHomePageController.java
@@ -6,6 +6,7 @@
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.core.domain.entity.SysDept;
import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.common.utils.DateUtils;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
@@ -42,6 +43,10 @@
    private ITjCustomerService customerService;
    @Resource
    private ITjProjectService projectService;
    @Resource
    private RedisCache redisCache;
    @Resource
    private TjAsyncService asyncService;
    @Resource
    private ISysDeptService deptService;
    @Resource
@@ -446,7 +451,16 @@
    @GetMapping("/getLineChart")
    @ApiOperation(value = "首页折线图数据")
    public AjaxResult getLineChart() {
        List<Map<Object, Object>> line = orderService.getLine();
        asyncService.getLineChart();
        if(redisCache.hasKey("getLineChart")){
            return redisCache.getCacheObject("getLineChart");
        }
        return getResult();
    }
    private AjaxResult getResult() {
//        List<Map<Object, Object>> line = orderService.getLine();
        List<LineChartsVo> line = orderService.getLine();
        Collections.reverse(line);
        return AjaxResult.success("折线图数据", line);
    }
@@ -454,6 +468,14 @@
    @GetMapping("/getPieChart")
    @ApiOperation(value = "首页饼状图登记人数接口")
    public AjaxResult getPieChart() {
        asyncService.getPieChart();
        if(redisCache.hasKey("getPieChart")){
            return redisCache.getCacheObject("getPieChart");
        }
        return getAjaxResult();
    }
    private AjaxResult getAjaxResult() {
        Map<String, Object> map = new HashMap<>();
        //获取体检登记数
@@ -477,6 +499,7 @@
        } else {
            map.put("tjyc", 0);
        }
        return AjaxResult.success(map);
    }