|
|
@@ -1,10 +1,52 @@
|
|
|
package net.mingsoft.tf.www;
|
|
|
|
|
|
+import net.mingsoft.base.entity.ResultData;
|
|
|
+import net.mingsoft.tf.biz.IEnterpriseBiz;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/${ms.manager.path}/tf/browse")
|
|
|
public class Browse2Action {
|
|
|
- // TODO 管理后台的主页报表
|
|
|
+ @Autowired
|
|
|
+ private IEnterpriseBiz biz;
|
|
|
+
|
|
|
+ @GetMapping(value = "/chart")
|
|
|
+ @ResponseBody
|
|
|
+ public ResultData chart() {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ // 用户数
|
|
|
+ biz.queryForList("select count(*) n from people")
|
|
|
+ .stream()
|
|
|
+ .findAny()
|
|
|
+ .ifPresent(m -> map.put("user", m.get("n")));
|
|
|
+ // 展商数
|
|
|
+ biz.queryForList("select count(*) n from mdiy_form_exhibitor")
|
|
|
+ .stream()
|
|
|
+ .findAny()
|
|
|
+ .ifPresent(m -> map.put("exhibitor", m.get("n")));
|
|
|
+ // 企业
|
|
|
+ map.put("enterprise", biz.queryForList("select t.floor, count(t.floor) as num from (select substring(ENTERPRISE_BOOTH, 1, 2) as floor from mdiy_form_enterprise) t group by t.floor order by t.floor"));
|
|
|
+ return ResultData.build().success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/day")
|
|
|
+ @ResponseBody
|
|
|
+ public ResultData day() {
|
|
|
+ // 浏览总量
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ biz.queryForList("select sum(BROWSE_VISITS) as n from mdiy_form_browse")
|
|
|
+ .stream()
|
|
|
+ .findAny()
|
|
|
+ .ifPresent(m -> map.put("total", m.get("n")));
|
|
|
+ // 前30天
|
|
|
+ map.put("item", biz.queryForList("SELECT BROWSE_DATA, BROWSE_VISITS FROM mdiy_form_browse WHERE BROWSE_DATA >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) order by BROWSE_DATA"));
|
|
|
+ return ResultData.build().success(map);
|
|
|
+ }
|
|
|
}
|