Browse Source

视频平台对接

root 3 years ago
parent
commit
7b279c5b69

+ 1 - 1
src/main/java/com/zhiqiyun/open/core/mapper/equipment/EquipmentPassengerPeopleMapper.java

@@ -19,7 +19,7 @@ public interface EquipmentPassengerPeopleMapper extends BaseMapper<EquipmentPass
     Long peopleCount(@Param("ew") QueryWrapper<EquipmentPassengerPeople> wrapper);
 
 
-    @Select("select SUBSTRING_INDEX(xc.source_area,'、',1) as label, IFNULL(SUM(xc.person),0) as `value` from liucheng_smart.xc_monitor xc,liucheng_smart.industry_institution_manage im ${ew.customSqlSegment} and im.id = xc.mechanism_id group by label")
+    @Select("select SUBSTRING_INDEX(xc.source_area,'、',1) as label, IFNULL(SUM(xc.person),0) as `value` from liucheng_smart.xc_monitor xc,liucheng_smart.industry_institution_manage im ${ew.customSqlSegment} and im.id = xc.mechanism_id and xc.in_or_out = 1 group by label")
     List<EchartsModel> scenicSpotVisitsNoDate(@Param("ew") QueryWrapper<EquipmentPassengerPeople> wrapper);
 
     @Select("select IFNULL(SUM(xc.male),0) as male,IFNULL(SUM(xc.female),0) as female from liucheng_smart.xc_monitor xc,liucheng_smart.industry_institution_manage im ${ew.customSqlSegment} and im.id = xc.mechanism_id")

+ 36 - 13
src/main/java/com/zhiqiyun/open/core/mapper/place/PlaceBaseInfoMapper.java

@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface PlaceBaseInfoMapper extends BaseMapper<PlaceBaseInfo> {
@@ -34,19 +35,41 @@ public interface PlaceBaseInfoMapper extends BaseMapper<PlaceBaseInfo> {
     @Select("select * from (select DATE_FORMAT(hmc.create_date,'%Y-%m-%d') as `label`,SUM(hmc.person) AS `value` from liucheng_smart.xc_monitor hmc where hmc.is_deleted = 0 and hmc.mechanism_type = #{type} group by DATE_FORMAT(hmc.create_date,'%Y-%m-%d')) h where h.label >= #{start} and h.label <= #{end}")
     List<EchartsModel> visitsByDay(@Param("start") String start, @Param("end") String end, @Param("type") Integer type);
 
-    @Select("SELECT f.* FROM (SELECT " +
-            " sr.id," +
-            " sr.name, " +
-            " sr.pic AS litpic, " +
-            " sr.address, " +
-            " sr.phone AS contactNumber, " +
-            " SUBSTRING_INDEX(sfv.field_value,',',1) AS lat, " +
-            " SUBSTRING_INDEX(sfv.field_value,',',-1) AS lng, " +
-            " sr.supplier_type AS categoryId " +
+    @Select("SELECT " +
+            " f.*  " +
             "FROM " +
-            " liucheng_smart.supplier sr " +
-            " LEFT JOIN liucheng_smart.sys_field_value sfv ON sfv.bind_id = sr.id AND sfv.type = 2  and sfv.field_type = 8 " +
-            "WHERE " +
-            " sr.is_deleted = 0 AND sr.app_id IS NULL) f ${ew.customSqlSegment}")
+            " ( " +
+            " SELECT sr.id,sr.`name`,sr.pic AS litpic,sr.address,sr.phone AS contactNumber,SUBSTRING_INDEX( sfv.field_value, ',', 1 ) AS lat,SUBSTRING_INDEX( sfv.field_value, ',',- 1 ) AS lng,sr.supplier_type AS categoryId  " +
+            " FROM " +
+            "  liucheng_smart.supplier sr " +
+            "  LEFT JOIN liucheng_smart.sys_field_value sfv ON sfv.bind_id = sr.id AND sfv.type = 2 AND sfv.field_type = 8  " +
+            " WHERE sr.is_deleted = 0 AND sr.app_id IS NULL UNION ALL " +
+            " SELECT ii.id,ii.`name`,ii.pic AS litpic,ii.address,ii.phone AS contactNumber,SUBSTRING_INDEX( sfv.field_value, ',', 1 ) AS lat,SUBSTRING_INDEX( sfv.field_value, ',',- 1 ) AS lng,ii.type AS categoryId  " +
+            " FROM " +
+            "  liucheng_smart.industry_institution_manage ii " +
+            "  LEFT JOIN liucheng_smart.sys_field_value sfv ON sfv.bind_id = ii.id AND sfv.type = 3 AND sfv.field_type = 8  " +
+            " WHERE " +
+            "  ii.org_id NOT IN ( SELECT sr.org_id FROM liucheng_smart.supplier sr WHERE sr.is_deleted = 0 AND sr.org_id IS NOT NULL ) UNION ALL " +
+            " SELECT " +
+            "  ct.id,ct.title AS `name`,ct.pic AS litpic,( SELECT sv.field_value FROM liucheng_smart.cms_content_field_value sv WHERE sv.content_id = ct.id AND sv.field_key = 'detailAddress' ) AS address,'' AS contactNumber,SUBSTRING_INDEX( fv.field_value, ',', 1 ) AS lat,SUBSTRING_INDEX( fv.field_value, ',',- 1 ) AS lng,22040713148455 AS categoryId  " +
+            " FROM " +
+            "  liucheng_smart.cms_content ct " +
+            "  LEFT JOIN liucheng_smart.cms_content_field_value fv ON fv.content_id = ct.id AND fv.field_type = 8, " +
+            "  liucheng_smart.cms_category cc  " +
+            " WHERE " +
+            "  cc.id = ct.cid AND ct.is_deleted = 0 AND cc.`code` = 'daoyoudaolan' AND ct.type = 7  " +
+            " ) f ${ew.customSqlSegment}")
     List<PlaceBaseInfo> findByMapBounds(@Param("ew") QueryWrapper<PlaceBaseInfo> queryWrapper);
+
+    @Select("SELECT f.label,COUNT(f.id) AS `value` FROM ( " +
+            " SELECT sr.id,sr.supplier_type AS label FROM liucheng_smart.supplier sr  " +
+            " WHERE sr.is_deleted = 0 AND sr.app_id IS NULL " +
+            " UNION ALL " +
+            " SELECT ii.id,ii.`type` AS label FROM liucheng_smart.industry_institution_manage ii " +
+            " WHERE ii.is_deleted = 0 AND ii.org_id NOT IN ( SELECT sr.org_id FROM liucheng_smart.supplier sr WHERE sr.is_deleted = 0 AND sr.org_id IS NOT NULL )  " +
+            " UNION ALL " +
+            " SELECT ct.id,22040713148455 as label FROM liucheng_smart.cms_content ct,liucheng_smart.cms_category cc " +
+            " WHERE cc.id = ct.cid AND ct.is_deleted = 0 AND cc.`code` = 'daoyoudaolan' AND ct.type = 7 " +
+            ") f GROUP BY f.label")
+    List<EchartsModel> findByGroupByDataType();
 }

+ 5 - 5
src/main/java/com/zhiqiyun/open/core/mapper/statistics/HyMonitorConsumeMapper.java

@@ -29,19 +29,19 @@ public interface HyMonitorConsumeMapper extends BaseMapper<HyMonitorConsume> {
     @Select("select * from (select DATE_FORMAT(hmc.create_date,'%Y-%m-%d') as `label`,SUM(hmc.quantity) AS `value` from liucheng_smart.xc_monitor_desc hmc where hmc.is_deleted = 0 and hmc.monitor_type = 3 group by DATE_FORMAT(hmc.create_date,'%Y-%m-%d')) h where h.label >= #{start} and h.label <= #{end}")
     List<EchartsModel> dispatchMonitorByDay(@Param("start") String start, @Param("end") String end);
 
-    @Select("select count(id) from liucheng_smart.xc_monitor where is_deleted = 0")
+    @Select("select SUM(person) from liucheng_smart.xc_monitor where is_deleted = 0 and in_or_out = 1")
     int visitsTotal();
 
-    @Select("select count(id) from liucheng_smart.xc_monitor where is_deleted = 0 and source_area like '广西%'")
+    @Select("select SUM(person) from liucheng_smart.xc_monitor where is_deleted = 0 and source_area like '广西%'  and in_or_out = 1")
     int provinceTotal();
 
-    @Select("select count(id) from liucheng_smart.xc_monitor where is_deleted = 0 and source_area not like '广西%'")
+    @Select("select SUM(person) from liucheng_smart.xc_monitor where is_deleted = 0 and source_area not like '广西%'  and in_or_out = 1")
     int outsideTotal();
 
-    @Select("SELECT SUBSTRING_INDEX(xc.source_area,'、',1) AS label,SUM(xc.person) AS `value` FROM liucheng_smart.xc_monitor xc WHERE is_deleted = 0 GROUP BY label ORDER BY `value` DESC LIMIT 10")
+    @Select("SELECT SUBSTRING_INDEX(xc.source_area,'、',1) AS label,SUM(xc.person) AS `value` FROM liucheng_smart.xc_monitor xc WHERE is_deleted = 0  and in_or_out = 1 GROUP BY label ORDER BY `value` DESC LIMIT 10")
     List<EchartsModel> sourceProvinceRank();
 
-    @Select("SELECT xc.source_area AS label,SUM(xc.person) AS `value` FROM liucheng_smart.xc_monitor xc WHERE is_deleted = 0 GROUP BY label ORDER BY `value` DESC LIMIT 10")
+    @Select("SELECT xc.source_area AS label,SUM(xc.person) AS `value` FROM liucheng_smart.xc_monitor xc WHERE is_deleted = 0  and in_or_out = 1 GROUP BY label ORDER BY `value` DESC LIMIT 10")
     List<EchartsModel> sourceCityRank();
 
     @Select("select hmc.gender as label,count(hmc.id) as `value` from hy_monitor_consume hmc where hmc.is_deleted = 0 and hmc.mechanism_id = #{orgId} group by hmc.gender")

+ 6 - 0
src/main/java/com/zhiqiyun/open/core/service/CategoryOrganizationService.java

@@ -1,7 +1,13 @@
 package com.zhiqiyun.open.core.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhiqiyun.open.core.models.category.CategoryOrganization;
 
+import java.util.Map;
+
 public interface CategoryOrganizationService extends IService<CategoryOrganization> {
+
+    Page<Map<String, Object>> pageList(Page<CategoryOrganization> page, QueryWrapper<CategoryOrganization> queryWrapper);
 }

+ 3 - 0
src/main/java/com/zhiqiyun/open/core/service/PlaceBaseInfoService.java

@@ -27,6 +27,9 @@ public interface PlaceBaseInfoService extends IService<PlaceBaseInfo> {
 
     Map<String, Object> census();
 
+
+    Map<String, Object> findByGroupByDataType();
+
     /**
      * 各景点访问量
      *

+ 8 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/CategoryOrganizationServiceImpl.java

@@ -1,11 +1,19 @@
 package com.zhiqiyun.open.core.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhiqiyun.open.core.mapper.category.CategoryOrganizationMapper;
 import com.zhiqiyun.open.core.models.category.CategoryOrganization;
 import com.zhiqiyun.open.core.service.CategoryOrganizationService;
 import org.springframework.stereotype.Service;
 
+import java.util.Map;
+
 @Service
 public class CategoryOrganizationServiceImpl extends ServiceImpl<CategoryOrganizationMapper, CategoryOrganization> implements CategoryOrganizationService {
+    @Override
+    public Page<Map<String, Object>> pageList(Page<CategoryOrganization> page, QueryWrapper<CategoryOrganization> queryWrapper) {
+        return null;
+    }
 }

+ 21 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/PlaceBaseInfoServiceImpl.java

@@ -11,6 +11,7 @@ import com.zhiqiyun.open.core.service.PlaceBaseInfoService;
 import com.zhiqiyun.open.utils.CommonUtils;
 import com.zhiqiyun.open.utils.DateUtil;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -79,6 +80,26 @@ public class PlaceBaseInfoServiceImpl extends ServiceImpl<PlaceBaseInfoMapper, P
     }
 
     @Override
+    public Map<String, Object> findByGroupByDataType() {
+        List<EchartsModel> models = baseMapper.cencus();
+        Map<String, Object> result = new HashMap<>();
+        if (models != null && models.size() > 0) {
+            models.forEach(md -> result.put("resource_" + md.getLabel(), md.getValue()));
+        }
+
+        List<EchartsModel> echartsModels = baseMapper.findByGroupByDataType();
+        if (echartsModels != null && echartsModels.size() > 0) {
+            echartsModels.forEach(md -> {
+                String key = "resource_" + md.getLabel();
+                if (ObjectUtils.isEmpty(result.get(key))) {
+                    result.put("resource_" + md.getLabel(), md.getValue());
+                }
+            });
+        }
+        return result;
+    }
+
+    @Override
     public List<EchartsModel> scenicSpotVisits(Integer type, Integer dateTime) {
         if (dateTime != null && dateTime.compareTo(1) == 0) {
             String date = DateUtil.format("yyyyMMdd");

+ 10 - 2
src/main/java/com/zhiqiyun/open/mvc/controller/BzResourceController.java

@@ -1,5 +1,6 @@
 package com.zhiqiyun.open.mvc.controller;
 
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.service.PlaceBaseInfoService;
 import com.zhiqiyun.open.mvc.Result;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -8,7 +9,10 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Comparator;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/bz/resource/")
@@ -23,8 +27,12 @@ public class BzResourceController {
     }
 
     @GetMapping("visits")
-    public Result visits(Integer type, Integer dateTime) throws Exception {
-        return Result.instance(Result.Code.SUCCESS).setData(placeBaseInfoService.scenicSpotVisits(type,dateTime));
+    public Result visits(Integer type, Integer dateTime, Boolean isSort) throws Exception {
+        List<EchartsModel> echartsModels = placeBaseInfoService.scenicSpotVisits(type, dateTime);
+        if (isSort != null && isSort) {
+            echartsModels = echartsModels.stream().sorted((o1, o2) -> o2.getValue().compareTo(o1.getValue())).collect(Collectors.toList());
+        }
+        return Result.instance(Result.Code.SUCCESS).setData(echartsModels);
     }
 
     @GetMapping("visitsByDay")

+ 2 - 17
src/main/java/com/zhiqiyun/open/mvc/controller/PlaceBaseInfoController.java

@@ -146,29 +146,14 @@ public class PlaceBaseInfoController {
         List<PlaceCategory> list = this.placeCategoryService.list();
         List<Map<String, Object>> listData = new ArrayList<>();
 
-        Map<String, Object> mapList = this.placeBaseInfoService.cencus();
+        Map<String, Object> mapList = this.placeBaseInfoService.findByGroupByDataType();
         for (PlaceCategory category : list) {
             Map<String, Object> dataMap = new HashMap<>();
-
-//			QueryWrapper<PlaceBaseInfo> queryWrapper = new QueryWrapper<>();
-//			queryWrapper.eq("category_id", category.getId());
-//
-//			long num = this.placeBaseInfoService.count(queryWrapper);
+            dataMap.put("category", category);
             Object l = mapList.get("resource_" + category.getId());
             dataMap.put("num", l != null ? l : 0);
-            dataMap.put("category", category);
             listData.add(dataMap);
         }
-
-//		QueryWrapper<PlaceBaseInfo> queryWrapper = new QueryWrapper<>();
-//		queryWrapper.select("category_id, count(1) num");
-//		queryWrapper.groupBy("category_id");
-//		List<Map<String, Object>> listData = this.placeBaseInfoService.listMaps(queryWrapper);
-//		for (Map<String, Object> dataMap : listData) {
-//			Long categoryId = Long.valueOf(dataMap.get("category_id").toString());
-//			PlaceCategory category = this.placeCategoryService.getById(categoryId);
-//			dataMap.put("category", category);
-//		}
         return Result.instance(Result.Code.SUCCESS).setData(listData);
     }
 

File diff suppressed because it is too large
+ 1 - 1
src/main/resources/public/index.html


Some files were not shown because too many files changed in this diff