package zbooksoft.fams.controller; import com.ruili.wcp.web.model.AjaxResponse; import org.apache.shiro.authz.annotation.RequiresUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import zbooksoft.fams.service.AssetStatService; import java.time.LocalDate; /** * 资产统计分析页面 * @author ycq * @date 2026-10-16 */ @Controller @RequestMapping("/fams/stat") public class AssetStatController { @Autowired private AssetStatService assetStatService; /** * 统计分析页面 * @return 视图名 */ @RequestMapping(value = "/index", method = RequestMethod.GET) @RequiresUser public String index() { return "fams/stat/index"; } /** * 统计数据 * @param includeScrapped 分布统计是否包含报废资产 * @return 统计数据 */ @RequestMapping(value = "/data", method = RequestMethod.GET, produces = "application/json; charset=utf-8") @ResponseBody @RequiresUser public Object data(@RequestParam(defaultValue = "false") boolean includeScrapped) { return new AjaxResponse(assetStatService.dashboard(LocalDate.now(), includeScrapped)); } }