diff --git a/pom.xml b/pom.xml index 40b2d6c0a3de3ead852f11a43bbb9e5e44d7ac95..030289f98676429fb4ec2dfbbf97e4f5ff6ea4ac 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,8 @@ com.cn.travel travel - 0.0.1-SNAPSHOT - war + v1 + travel Demo project for Spring Boot @@ -187,7 +187,33 @@ - + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + false + + + + + + diff --git a/src/main/java/com/cn/travel/base/entity/Item.java b/src/main/java/com/cn/travel/base/entity/Item.java new file mode 100644 index 0000000000000000000000000000000000000000..16372bbc15c691771b3ad14a8003b385148e5b4f --- /dev/null +++ b/src/main/java/com/cn/travel/base/entity/Item.java @@ -0,0 +1,24 @@ +package com.cn.travel.base.entity; + +public class Item { + + private String name; + + private Integer value; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } +} diff --git a/src/main/java/com/cn/travel/cms/product/dao/ProductDao.java b/src/main/java/com/cn/travel/cms/product/dao/ProductDao.java index f83de9d15728b609e1ef5b5052fb885e9b9c2844..0fa41118353f1097b55eeb1fd621748bd215c55d 100644 --- a/src/main/java/com/cn/travel/cms/product/dao/ProductDao.java +++ b/src/main/java/com/cn/travel/cms/product/dao/ProductDao.java @@ -1,5 +1,6 @@ package com.cn.travel.cms.product.dao; +import com.cn.travel.base.entity.Item; import com.cn.travel.cms.product.entity.Product; import org.apache.ibatis.annotations.*; @@ -39,4 +40,16 @@ public interface ProductDao { @Update("update t_product set name=#{name}, description=#{description},image_url=#{imageUrl},price=#{price} where id=#{id} ") void update(Product product); + + @Select("SELECT s.SPOT_NAME AS name, COUNT(*) AS count " + + "FROM t_yw_order tyo " + + "JOIN t_product tp ON tyo.product_id = tp.id " + + "LEFT JOIN t_cms_scenic_spot s ON s.ID = tp.spot_id " + + "GROUP BY tp.spot_id") + @Results({ + @Result(property = "name", column = "name"), + @Result(property = "value", column = "count") + }) + List getProductsCount(); + } diff --git a/src/main/java/com/cn/travel/web/manager/DataController.java b/src/main/java/com/cn/travel/web/manager/DataController.java index 0ab4862b34a60b99ea37204c05f835f94320add1..ba17b0202baf12c7544b1352003c7fa8c1f35a65 100644 --- a/src/main/java/com/cn/travel/web/manager/DataController.java +++ b/src/main/java/com/cn/travel/web/manager/DataController.java @@ -1,9 +1,12 @@ package com.cn.travel.web.manager; +import com.cn.travel.base.entity.Item; import com.cn.travel.cms.car.service.imp.CarService; import com.cn.travel.cms.hotel.service.imp.HotelService; import com.cn.travel.cms.insurance.service.imp.InsuranceService; import com.cn.travel.cms.order.service.imp.OrderService; +import com.cn.travel.cms.product.dao.ProductDao; +import com.cn.travel.cms.product.entity.Product; import com.cn.travel.cms.scenicSpot.service.imp.ScenicSpotService; import com.cn.travel.cms.strategy.service.imp.StrategyService; import com.cn.travel.cms.travelRoute.service.imp.TravelRouteService; @@ -14,6 +17,8 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; +import java.util.List; + @Controller @RequestMapping("/manager") public class DataController extends BaseController { @@ -34,6 +39,9 @@ public class DataController extends BaseController { @Autowired InsuranceService insuranceService; + @Autowired + ProductDao productDao; + @RequestMapping("/userData") public ModelAndView userDate()throws Exception{ @@ -63,6 +71,9 @@ public class DataController extends BaseController { mv.addObject("state0",scenicSpotService.state0count()); mv.addObject("state1",scenicSpotService.state1count()); mv.addObject("state2",scenicSpotService.state2count()); +// 销售量 + List items = productDao.getProductsCount(); + mv.addObject("items",items); mv.setViewName("data/scenicSpotData"); return mv; } diff --git a/src/main/resources/templates/data/scenicSpotData.html b/src/main/resources/templates/data/scenicSpotData.html index 8e128c9e1aae479b728da1ddf48af73f3ef64673..845c383e542ddb82c2341f62ad847db15557e3f6 100644 --- a/src/main/resources/templates/data/scenicSpotData.html +++ b/src/main/resources/templates/data/scenicSpotData.html @@ -1,67 +1,105 @@ + - + 首页--晋游天地运营平台 - - - - - - + + + + + + + + - - - - - - - - - - -
- - - - + + + + + + + + + +
+
+
+
+ + + + + + // 创建一个 echarts 实例,并指定容器 + var myChart = echarts.init(document.getElementById('pieChart')); + + // 配置项 + var option = { + title: { + text: '各景点文创订单占比', + left: 'center' + }, + tooltip: { + trigger: 'item', + formatter: '{a}
{b}: {c} ({d}%)' + }, + series: [ + { + name: '订单数', + type: 'pie', + radius: '50%', + data: [[${ items }]] + } + ] + }; + + // 使用配置项设置图表 + myChart.setOption(option); + + }); + + + \ No newline at end of file