diff --git a/src/main/java/cn/chjyj/szwh/controller/admin/AdminIndexController.java b/src/main/java/cn/chjyj/szwh/controller/admin/AdminIndexController.java new file mode 100644 index 0000000..dcbdc37 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/controller/admin/AdminIndexController.java @@ -0,0 +1,42 @@ +package cn.chjyj.szwh.controller.admin; + +import cn.chjyj.szwh.controller.BaseController; +import cn.chjyj.szwh.service.IndexService; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +/** + * 首页各种统计信息 + */ +@RestController +@RequestMapping("/admin/index") +public class AdminIndexController extends BaseController { + @Autowired + private IndexService indexService; + + @PostMapping("/home") + public JSONObject home(@RequestParam("leftDate") String leftDate, + @RequestParam("rightDate") String rightDate, + @RequestParam("sale_ranking")String saleRanking, + @RequestParam("saleRankingDate")String saleRankingDate){ + // 拼装查询条件 + Map queryMap = new HashMap<>(); + queryMap.put("leftDate",leftDate); + queryMap.put("rightDate",rightDate); + queryMap.put("sale_ranking",saleRanking); + queryMap.put("saleRankingDate",saleRankingDate); + // 执行查询操作 + Map result =indexService.getCountSys(queryMap); + // 拼装结果 + jsonObject.put("code",200); + jsonObject.put("data",result); + return jsonObject; + } +} diff --git a/src/main/java/cn/chjyj/szwh/service/IndexService.java b/src/main/java/cn/chjyj/szwh/service/IndexService.java new file mode 100644 index 0000000..d610a71 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/service/IndexService.java @@ -0,0 +1,15 @@ +package cn.chjyj.szwh.service; + +import java.util.Map; + +/** + * 首页统计各种数据 + */ +public interface IndexService { + /** + * 统计系统中的相关数据 + * @param map 统计查询条件 + * @return + */ + Map getCountSys(Map map); +} diff --git a/src/main/java/cn/chjyj/szwh/service/impl/IndexServiceImpl.java b/src/main/java/cn/chjyj/szwh/service/impl/IndexServiceImpl.java new file mode 100644 index 0000000..9fdb0d3 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/service/impl/IndexServiceImpl.java @@ -0,0 +1,14 @@ +package cn.chjyj.szwh.service.impl; + +import cn.chjyj.szwh.service.IndexService; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Service +public class IndexServiceImpl implements IndexService { + @Override + public Map getCountSys(Map map) { + return null; + } +}