Quellcode durchsuchen

视频平台对接

root vor 3 Jahren
Ursprung
Commit
c0ab72f1ef
24 geänderte Dateien mit 997 neuen und 77 gelöschten Zeilen
  1. 18 0
      src/main/java/com/zhiqiyun/open/core/mapper/equipment/EquipmentPassengerPeopleMapper.java
  2. 26 0
      src/main/java/com/zhiqiyun/open/core/mapper/place/PlaceBaseInfoMapper.java
  3. 43 0
      src/main/java/com/zhiqiyun/open/core/mapper/statistics/HyMonitorConsumeMapper.java
  4. 12 0
      src/main/java/com/zhiqiyun/open/core/mapper/statistics/TravelReportMapper.java
  5. 1 1
      src/main/java/com/zhiqiyun/open/core/models/EchartsModel.java
  6. 14 0
      src/main/java/com/zhiqiyun/open/core/service/EquipmentPassengerPeopleService.java
  7. 88 1
      src/main/java/com/zhiqiyun/open/core/service/HyMonitorConsumeService.java
  8. 23 1
      src/main/java/com/zhiqiyun/open/core/service/PlaceBaseInfoService.java
  9. 10 0
      src/main/java/com/zhiqiyun/open/core/service/TravelReportService.java
  10. 27 0
      src/main/java/com/zhiqiyun/open/core/service/impl/EquipmentPassengerPeopleServiceImpl.java
  11. 85 0
      src/main/java/com/zhiqiyun/open/core/service/impl/HyMonitorConsumeServiceImpl.java
  12. 41 0
      src/main/java/com/zhiqiyun/open/core/service/impl/PlaceBaseInfoServiceImpl.java
  13. 17 0
      src/main/java/com/zhiqiyun/open/core/service/impl/TravelReportServiceImpl.java
  14. 40 0
      src/main/java/com/zhiqiyun/open/mvc/controller/BzConsumeController.java
  15. 34 0
      src/main/java/com/zhiqiyun/open/mvc/controller/BzResourceController.java
  16. 19 73
      src/main/java/com/zhiqiyun/open/mvc/controller/EquipmentPassengerController.java
  17. 107 0
      src/main/java/com/zhiqiyun/open/mvc/controller/MonitorController.java
  18. 109 0
      src/main/java/com/zhiqiyun/open/mvc/controller/TravelReportController.java
  19. 29 0
      src/main/java/com/zhiqiyun/open/mvc/params/travel/TravelReportHotelPageParams.java
  20. 19 0
      src/main/java/com/zhiqiyun/open/mvc/params/travel/TravelReportPageParams.java
  21. 25 0
      src/main/java/com/zhiqiyun/open/utils/CommonUtils.java
  22. 70 1
      src/main/java/com/zhiqiyun/open/utils/DateUtil.java
  23. 140 0
      src/main/resources/mybatis/mappers/TraveReportMapper.xml
  24. 0 0
      src/main/resources/public/index.html

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

@@ -1,9 +1,27 @@
 package com.zhiqiyun.open.core.mapper.equipment;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.equipment.EquipmentPassengerPeople;
+import com.zhiqiyun.open.mvc.params.equipment.QueryEquipmentPassengerParams;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface EquipmentPassengerPeopleMapper extends BaseMapper<EquipmentPassengerPeople> {
+
+    @Select("select IFNULL(SUM(xc.person),0) from liucheng_smart.xc_monitor xc,liucheng_smart.industry_institution_manage im ${ew.customSqlSegment} and im.id = xc.mechanism_id")
+    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")
+    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")
+    Map<String,Object> groupByOrg(@Param("ew") QueryWrapper<EquipmentPassengerPeople> wrapper);
 }

+ 26 - 0
src/main/java/com/zhiqiyun/open/core/mapper/place/PlaceBaseInfoMapper.java

@@ -1,9 +1,35 @@
 package com.zhiqiyun.open.core.mapper.place;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.place.PlaceBaseInfo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 @Mapper
 public interface PlaceBaseInfoMapper extends BaseMapper<PlaceBaseInfo> {
+
+    @Select("select sr.supplier_type as label,count(sr.id) as `value` from liucheng_smart.supplier sr where sr.is_deleted = 0 group by sr.supplier_type")
+    List<EchartsModel> cencus();
+
+    @Select("select count(sr.id) from liucheng_smart.product sr where sr.is_deleted = 0 and sr.is_otc = 23")
+    int culturalTourismLineTotal();
+
+    @Select("select count(sr.id) from liucheng_smart.cms_content sr,liucheng_smart.cms_category cc where cc.id = sr.cid and sr.is_deleted = 0 and cc.code = 'intangible_cultural_heritage'")
+    int intangibleCulturalHeritage();
+
+    @Select("select count(sr.id) from liucheng_smart.cms_content sr,liucheng_smart.cms_category cc where cc.id = sr.cid and sr.is_deleted = 0 and cc.code = 'daoyoudaolan' and sr.type = 7")
+    int parkingLot();
+
+    @Select("select sr.mechanism_name as label,SUM(sr.person) as `value` from liucheng_smart.xc_monitor sr where sr.is_deleted = 0 and sr.mechanism_type = #{type} and DATE_FORMAT(sr.create_date,'%Y%m%d') = #{date} and sr.mechanism_name is not null group by sr.mechanism_name")
+    List<EchartsModel> scenicSpotVisits(@Param("type") Integer type, @Param("date") String date);
+
+    @Select("select sr.mechanism_name as label,SUM(sr.person) as `value` from liucheng_smart.xc_monitor sr where sr.is_deleted = 0 and sr.mechanism_type = #{type} group by sr.mechanism_name")
+    List<EchartsModel> scenicSpotVisitsNoDate(@Param("type") Integer type);
+
+    @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);
 }

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

@@ -1,9 +1,52 @@
 package com.zhiqiyun.open.core.mapper.statistics;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.statistics.HyMonitorConsume;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface HyMonitorConsumeMapper extends BaseMapper<HyMonitorConsume> {
+
+    @Select("select IFNULL(SUM(hmc.money),0) as money,IFNULL(count(hmc.id),0) as total from hy_monitor_consume hmc where hmc.is_deleted = 0 and DATE_FORMAT(hmc.create_date,'%Y%m') = #{time}")
+    Map<String, Object> countMonthConsume(String time);
+
+    @Select("select * from (select DATE_FORMAT(hmc.create_date,'%Y-%m-%d') as `label`,SUM(hmc.money) AS `value` from hy_monitor_consume hmc where hmc.is_deleted = 0 group by DATE_FORMAT(hmc.create_date,'%Y-%m-%d')) h where h.label >= #{start} and h.label <= #{end}")
+    List<EchartsModel> consumeMonitorByDay(@Param("start") String start, @Param("end") String end);
+
+    @Select("select * from (select DATE_FORMAT(hmc.create_date,'%Y-%m') as `label`,SUM(hmc.money) AS `value` from hy_monitor_consume hmc where hmc.is_deleted = 0 group by DATE_FORMAT(hmc.create_date,'%Y-%m')) h where h.label >= #{start} and h.label <= #{end}")
+    List<EchartsModel> consumeMonitorByMonths(@Param("start") String start, @Param("end") String end);
+
+    @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 = 2 group by DATE_FORMAT(hmc.create_date,'%Y-%m-%d')) h where h.label >= #{start} and h.label <= #{end}")
+    List<EchartsModel> sentimentMonitorByDay(@Param("start") String start, @Param("end") String end);
+
+    @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")
+    int visitsTotal();
+
+    @Select("select count(id) from liucheng_smart.xc_monitor where is_deleted = 0 and source_area like '广西%'")
+    int provinceTotal();
+
+    @Select("select count(id) from liucheng_smart.xc_monitor where is_deleted = 0 and source_area not like '广西%'")
+    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")
+    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")
+    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")
+    List<EchartsModel> spotGender(Long orgId);
+
+    @Select("select SUBSTRING_INDEX(hmc.source_area,'、',1) as label,count(hmc.id) as `value` from hy_monitor_consume hmc where hmc.is_deleted = 0 and hmc.mechanism_id = #{orgId} group by label ORDER BY `value` DESC LIMIT 10")
+    List<EchartsModel> sourceGender(Long orgId);
 }

+ 12 - 0
src/main/java/com/zhiqiyun/open/core/mapper/statistics/TravelReportMapper.java

@@ -1,9 +1,21 @@
 package com.zhiqiyun.open.core.mapper.statistics;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zhiqiyun.open.core.models.statistics.TravelReport;
+import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 @Mapper
 public interface TravelReportMapper extends BaseMapper<TravelReport> {
+
+    Page<Map<String, Object>> pageList(Page<TravelReport> page, @Param("ew") QueryWrapper<TravelReport> wrapper);
+
+    Page<Map<String, Object>> pageHotelAudit(Page<TravelReport> page, @Param("ew") QueryWrapper<TravelReport> wrapper);
+
+    Page<Map<String, Object>> pageScenicAudit(Page<TravelReport> page, @Param("ew") QueryWrapper<TravelReport> wrapper);
 }

+ 1 - 1
src/main/java/com/zhiqiyun/open/core/models/EchartsModel.java

@@ -16,5 +16,5 @@ public class EchartsModel implements Serializable {
 
     private String label;
 
-    private BigDecimal value;
+    private BigDecimal value = BigDecimal.ZERO;
 }

+ 14 - 0
src/main/java/com/zhiqiyun/open/core/service/EquipmentPassengerPeopleService.java

@@ -1,7 +1,21 @@
 package com.zhiqiyun.open.core.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.equipment.EquipmentPassengerPeople;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 public interface EquipmentPassengerPeopleService extends IService<EquipmentPassengerPeople> {
+
+    Long inPeopleCount(QueryWrapper<EquipmentPassengerPeople> wrapper);
+
+    Long outPeopleCount(QueryWrapper<EquipmentPassengerPeople> wrapper);
+
+    List<EchartsModel> scenicSpotVisitsNoDate(QueryWrapper<EquipmentPassengerPeople> wrapper);
+
+    Map<String,Object> groupByOrg(QueryWrapper<EquipmentPassengerPeople> wrapper);
 }

+ 88 - 1
src/main/java/com/zhiqiyun/open/core/service/HyMonitorConsumeService.java

@@ -1,8 +1,95 @@
 package com.zhiqiyun.open.core.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.statistics.HyMonitorConsume;
-import com.zhiqiyun.open.core.models.statistics.TravelScenicAudit;
+
+import java.util.List;
+import java.util.Map;
 
 public interface HyMonitorConsumeService extends IService<HyMonitorConsume> {
+
+    /**
+     * 月消费数据统计
+     *
+     * @return
+     */
+    Map<String, Object> countMonthConsume();
+
+    /**
+     * 消费检测按日
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> consumeMonitorByDay();
+
+    /**
+     * 消费检测按月
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> consumeMonitorByMonths();
+
+    /**
+     * 舆情监测按日
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> sentimentMonitorByDay();
+
+    /**
+     * 应急指挥调度按日
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> dispatchMonitorByDay();
+
+    /**
+     * 统计总访问量
+     *
+     * @return int
+     */
+    int visitsTotal();
+
+    /**
+     * 统计省内总访问量
+     *
+     * @return int
+     */
+    int provinceTotal();
+
+    /**
+     * 统计省外总访问量
+     *
+     * @return int
+     */
+    int outsideTotal();
+
+    /**
+     * 来源省份TOP10
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> sourceProvinceRank();
+
+    /**
+     * 来源城市TOP10
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> sourceCityRank();
+
+    /**
+     * 性别
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> spotGender(Long orgId);
+
+    /**
+     * 景区来源省份TOP10
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> sourceGender(Long orgId);
 }

+ 23 - 1
src/main/java/com/zhiqiyun/open/core/service/PlaceBaseInfoService.java

@@ -1,18 +1,40 @@
 package com.zhiqiyun.open.core.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.place.PlaceBaseInfo;
 import com.zhiqiyun.open.core.models.place.PlaceBaseInfoExtend;
 
 import java.util.List;
+import java.util.Map;
 
 public interface PlaceBaseInfoService extends IService<PlaceBaseInfo> {
     /**
-     *
      * @param entity
      * @param listExtends
      */
     void save(PlaceBaseInfo entity, List<PlaceBaseInfoExtend> listExtends);
 
     void updateById(PlaceBaseInfo entity, List<PlaceBaseInfoExtend> listExtends);
+
+    /**
+     * 文旅资源统计数据
+     *
+     * @return Map<String, Object>
+     */
+    Map<String, Object> cencus();
+
+    /**
+     * 各景点访问量
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> scenicSpotVisits(Integer type,Integer dateTime);
+
+    /**
+     * 访问量趋势
+     *
+     * @return List<EchartsModel>
+     */
+    List<EchartsModel> visitsByDay(Integer type);
 }

+ 10 - 0
src/main/java/com/zhiqiyun/open/core/service/TravelReportService.java

@@ -1,7 +1,17 @@
 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.statistics.TravelReport;
 
+import java.util.Map;
+
 public interface TravelReportService extends IService<TravelReport> {
+
+    Page<Map<String, Object>> pageList(Page<TravelReport> page, QueryWrapper<TravelReport> wrapper);
+
+    Page<Map<String, Object>> pageHotelAudit(Page<TravelReport> page, QueryWrapper<TravelReport> wrapper);
+
+    Page<Map<String, Object>> pageScenicAudit(Page<TravelReport> page, QueryWrapper<TravelReport> wrapper);
 }

+ 27 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/EquipmentPassengerPeopleServiceImpl.java

@@ -1,11 +1,38 @@
 package com.zhiqiyun.open.core.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhiqiyun.open.core.mapper.equipment.EquipmentPassengerPeopleMapper;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.equipment.EquipmentPassengerPeople;
 import com.zhiqiyun.open.core.service.EquipmentPassengerPeopleService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class EquipmentPassengerPeopleServiceImpl extends ServiceImpl<EquipmentPassengerPeopleMapper, EquipmentPassengerPeople> implements EquipmentPassengerPeopleService {
+
+    @Override
+    public Long inPeopleCount(QueryWrapper<EquipmentPassengerPeople> wrapper) {
+        wrapper.eq("xc.in_or_out", 1);
+        return this.baseMapper.peopleCount(wrapper);
+    }
+
+    @Override
+    public Long outPeopleCount(QueryWrapper<EquipmentPassengerPeople> wrapper) {
+        wrapper.eq("xc.in_or_out", 2);
+        return this.baseMapper.peopleCount(wrapper);
+    }
+
+    @Override
+    public List<EchartsModel> scenicSpotVisitsNoDate(QueryWrapper<EquipmentPassengerPeople> wrapper) {
+        return baseMapper.scenicSpotVisitsNoDate(wrapper);
+    }
+
+    @Override
+    public Map<String, Object> groupByOrg(QueryWrapper<EquipmentPassengerPeople> wrapper) {
+        return baseMapper.groupByOrg(wrapper);
+    }
 }

+ 85 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/HyMonitorConsumeServiceImpl.java

@@ -2,10 +2,95 @@ package com.zhiqiyun.open.core.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhiqiyun.open.core.mapper.statistics.HyMonitorConsumeMapper;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.statistics.HyMonitorConsume;
 import com.zhiqiyun.open.core.service.HyMonitorConsumeService;
+import com.zhiqiyun.open.utils.CommonUtils;
+import com.zhiqiyun.open.utils.DateUtil;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class HyMonitorConsumeServiceImpl extends ServiceImpl<HyMonitorConsumeMapper, HyMonitorConsume> implements HyMonitorConsumeService {
+    @Override
+    public Map<String, Object> countMonthConsume() {
+        Map<String, Object> map = baseMapper.countMonthConsume(DateUtil.format("yyyyMM"));
+        if (map != null) {
+            BigDecimal money = new BigDecimal(String.valueOf(map.get("money")));
+            BigDecimal total = new BigDecimal(String.valueOf(map.get("total")));
+            BigDecimal rjxf = BigDecimal.ZERO;
+            if (money.compareTo(BigDecimal.ZERO) > 0 && total.compareTo(BigDecimal.ZERO) > 0) {
+                rjxf = money.divide(total, 2, RoundingMode.HALF_UP);
+            }
+            map.put("rjxf", rjxf);
+        }
+        return map;
+    }
+
+    @Override
+    public List<EchartsModel> consumeMonitorByDay() {
+        List<String> dayList = DateUtil.getDayList(7);
+        List<EchartsModel> models = baseMapper.consumeMonitorByDay(dayList.get(0), dayList.get(6));
+        return CommonUtils.getEchartsModel(dayList, models);
+    }
+
+    @Override
+    public List<EchartsModel> consumeMonitorByMonths() {
+        List<String> dayList = DateUtil.getMonths(7);
+        List<EchartsModel> models = baseMapper.consumeMonitorByMonths(dayList.get(0), dayList.get(6));
+        return CommonUtils.getEchartsModel(dayList, models);
+    }
+
+    @Override
+    public List<EchartsModel> sentimentMonitorByDay() {
+        List<String> dayList = DateUtil.getDayList(7);
+        List<EchartsModel> models = baseMapper.sentimentMonitorByDay(dayList.get(0), dayList.get(6));
+        return CommonUtils.getEchartsModel(dayList, models);
+    }
+
+    @Override
+    public List<EchartsModel> dispatchMonitorByDay() {
+        List<String> dayList = DateUtil.getDayList(7);
+        List<EchartsModel> models = baseMapper.dispatchMonitorByDay(dayList.get(0), dayList.get(6));
+        return CommonUtils.getEchartsModel(dayList, models);
+    }
+
+    @Override
+    public int visitsTotal() {
+        return baseMapper.visitsTotal();
+    }
+
+    @Override
+    public int provinceTotal() {
+        return baseMapper.provinceTotal();
+    }
+
+    @Override
+    public int outsideTotal() {
+        return baseMapper.outsideTotal();
+    }
+
+    @Override
+    public List<EchartsModel> sourceProvinceRank() {
+        return baseMapper.sourceProvinceRank();
+    }
+
+    @Override
+    public List<EchartsModel> sourceCityRank() {
+        return baseMapper.sourceCityRank();
+    }
+
+    @Override
+    public List<EchartsModel> spotGender(Long orgId) {
+        return baseMapper.spotGender(orgId);
+    }
+
+    @Override
+    public List<EchartsModel> sourceGender(Long orgId) {
+        return baseMapper.sourceGender(orgId);
+    }
 }

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

@@ -4,16 +4,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhiqiyun.open.core.mapper.place.PlaceBaseInfoExtendMapper;
 import com.zhiqiyun.open.core.mapper.place.PlaceBaseInfoMapper;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.place.PlaceBaseInfo;
 import com.zhiqiyun.open.core.models.place.PlaceBaseInfoExtend;
 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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class PlaceBaseInfoServiceImpl extends ServiceImpl<PlaceBaseInfoMapper, PlaceBaseInfo> implements PlaceBaseInfoService {
@@ -49,6 +55,41 @@ public class PlaceBaseInfoServiceImpl extends ServiceImpl<PlaceBaseInfoMapper, P
     }
 
     @Override
+    public Map<String, Object> cencus() {
+        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()));
+        }
+
+        int lineTotal = baseMapper.culturalTourismLineTotal();
+        result.put("lineTotal", lineTotal);
+
+        int heritageTotal = baseMapper.intangibleCulturalHeritage();
+        result.put("heritageTotal", heritageTotal);
+
+        int parkingLot = baseMapper.parkingLot();
+        result.put("parkingLot", parkingLot);
+        return result;
+    }
+
+    @Override
+    public List<EchartsModel> scenicSpotVisits(Integer type, Integer dateTime) {
+        if (dateTime != null && dateTime.compareTo(1) == 0) {
+            String date = DateUtil.format("yyyyMMdd");
+            return baseMapper.scenicSpotVisits(type, date);
+        }
+        return baseMapper.scenicSpotVisitsNoDate(type);
+    }
+
+    @Override
+    public List<EchartsModel> visitsByDay(Integer type) {
+        List<String> dayList = DateUtil.getDayList(7);
+        List<EchartsModel> models = baseMapper.visitsByDay(dayList.get(0), dayList.get(6), type);
+        return CommonUtils.getEchartsModel(dayList, models);
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean removeByIds(Collection<?> list) {
 

+ 17 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/TravelReportServiceImpl.java

@@ -1,11 +1,28 @@
 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.statistics.TravelReportMapper;
 import com.zhiqiyun.open.core.models.statistics.TravelReport;
 import com.zhiqiyun.open.core.service.TravelReportService;
 import org.springframework.stereotype.Service;
 
+import java.util.Map;
+
 @Service
 public class TravelReportServiceImpl extends ServiceImpl<TravelReportMapper, TravelReport> implements TravelReportService {
+    @Override
+    public Page<Map<String, Object>> pageList(Page<TravelReport> page, QueryWrapper<TravelReport> wrapper) {
+        return baseMapper.pageList(page, wrapper);
+    }
+
+    @Override
+    public Page<Map<String, Object>> pageHotelAudit(Page<TravelReport> page, QueryWrapper<TravelReport> wrapper) {
+        return baseMapper.pageHotelAudit(page, wrapper);
+    }
+    @Override
+    public Page<Map<String, Object>> pageScenicAudit(Page<TravelReport> page, QueryWrapper<TravelReport> wrapper) {
+        return baseMapper.pageScenicAudit(page, wrapper);
+    }
 }

+ 40 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/BzConsumeController.java

@@ -0,0 +1,40 @@
+package com.zhiqiyun.open.mvc.controller;
+
+import com.zhiqiyun.open.core.models.EchartsModel;
+import com.zhiqiyun.open.core.service.HyMonitorConsumeService;
+import com.zhiqiyun.open.mvc.Result;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/bz/consume/")
+public class BzConsumeController {
+
+    @Resource
+    private HyMonitorConsumeService hyMonitorConsumeService;
+
+    @GetMapping("cencus")
+    public Result cencus(@RequestParam Map<String, String> params) throws Exception {
+        return Result.instance(Result.Code.SUCCESS)
+                .setData(hyMonitorConsumeService.countMonthConsume());
+    }
+
+    @GetMapping("monitor")
+    public Result monitor(@RequestParam Map<String, String> params) throws Exception {
+        Map<String, List<EchartsModel>> result = new HashMap<>(2);
+        result.put("consumeDay", hyMonitorConsumeService.consumeMonitorByDay());
+        result.put("consumeMonths", hyMonitorConsumeService.consumeMonitorByMonths());
+        result.put("sentimentMonths", hyMonitorConsumeService.sentimentMonitorByDay());
+        result.put("dispatchMonths", hyMonitorConsumeService.dispatchMonitorByDay());
+        return Result.instance(Result.Code.SUCCESS)
+                .setData(result);
+    }
+
+}

+ 34 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/BzResourceController.java

@@ -0,0 +1,34 @@
+package com.zhiqiyun.open.mvc.controller;
+
+import com.zhiqiyun.open.core.service.PlaceBaseInfoService;
+import com.zhiqiyun.open.mvc.Result;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/bz/resource/")
+public class BzResourceController {
+
+    @Resource
+    private PlaceBaseInfoService placeBaseInfoService;
+
+    @GetMapping("cencus")
+    public Result cencus(@RequestParam Map<String, String> params) throws Exception {
+        return Result.instance(Result.Code.SUCCESS).setData(placeBaseInfoService.cencus());
+    }
+
+    @GetMapping("visits")
+    public Result visits(Integer type, Integer dateTime) throws Exception {
+        return Result.instance(Result.Code.SUCCESS).setData(placeBaseInfoService.scenicSpotVisits(type,dateTime));
+    }
+
+    @GetMapping("visitsByDay")
+    public Result visitsByDay(Integer type) throws Exception {
+        return Result.instance(Result.Code.SUCCESS).setData(placeBaseInfoService.visitsByDay(type));
+    }
+}

+ 19 - 73
src/main/java/com/zhiqiyun/open/mvc/controller/EquipmentPassengerController.java

@@ -4,8 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zhiqiyun.open.annotation.Permission;
-import com.zhiqiyun.open.core.enmus.Gender;
-import com.zhiqiyun.open.core.enmus.PassengerType;
+import com.zhiqiyun.open.core.models.EchartsModel;
 import com.zhiqiyun.open.core.models.equipment.EquipmentPassenger;
 import com.zhiqiyun.open.core.models.equipment.EquipmentPassengerPeople;
 import com.zhiqiyun.open.core.models.user.OauthInfo;
@@ -17,6 +16,7 @@ import com.zhiqiyun.open.mvc.Result;
 import com.zhiqiyun.open.mvc.params.equipment.QueryEquipmentPassengerParams;
 import com.zhiqiyun.open.mvc.params.equipment.SaveEquipmentPassengerParams;
 import com.zhiqiyun.open.utils.DateUtil;
+import com.zhiqiyun.open.utils.RandomUtil;
 import com.zhiqiyun.open.utils.ServletContext;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -28,8 +28,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
-import java.math.BigDecimal;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -65,37 +63,29 @@ public class EquipmentPassengerController {
             queryWrapper.eq("org_id", params.getPlaceBaseInfoId());
         }
         if (params.getRangeDate() != null) {
-            if (params.getRangeDate().getStatDate() != null) {
-                queryWrapper.ge("create_date", params.getRangeDate().getStatDate());
-            }
-            if (params.getRangeDate().getEndDate() != null) {
-                queryWrapper.lt("create_date", params.getRangeDate().getEndDate());
-            }
+            queryWrapper.between("create_date", params.getRangeDate().getStatDate(), params.getRangeDate().getEndDate());
         }
 
         Page<EquipmentPassenger> page = params.getPage();
         page.addOrder(OrderItem.desc("id"));
 
         Page<EquipmentPassenger> resultData = this.equipmentPassengerService.pageList(page, queryWrapper);
+
         QueryWrapper<EquipmentPassengerPeople> passengerWrapper;
         for (EquipmentPassenger equipment : resultData.getRecords()) {
             passengerWrapper = new QueryWrapper<>();
-            passengerWrapper.eq("equipment_id", equipment.getId());
-            passengerWrapper.eq("passenger_type", PassengerType.IN);
+            passengerWrapper.eq("im.org_id", equipment.getPlaceBaseInfoId());
             if (params.getRangeDate() != null) {
-                passengerWrapper.between("created_time", params.getRangeDate().getStatDate(), params.getRangeDate().getEndDate());
+                passengerWrapper.between("xc.create_date", params.getRangeDate().getStatDate(), params.getRangeDate().getEndDate());
             }
-            Long inPeopleCount = this.equipmentPassengerPeopleService.count(passengerWrapper);
-
+            Long inPeopleCount = this.equipmentPassengerPeopleService.inPeopleCount(passengerWrapper);
 
             passengerWrapper = new QueryWrapper<>();
-            passengerWrapper.eq("equipment_id", equipment.getId());
-            passengerWrapper.eq("passenger_type", PassengerType.OUT);
+            passengerWrapper.eq("im.org_id", equipment.getPlaceBaseInfoId());
             if (params.getRangeDate() != null) {
-                passengerWrapper.between("created_time", params.getRangeDate().getStatDate(), params.getRangeDate().getEndDate());
+                passengerWrapper.between("xc.create_date", params.getRangeDate().getStatDate(), params.getRangeDate().getEndDate());
             }
-            Long outPeopleCount = this.equipmentPassengerPeopleService.count(passengerWrapper);
-
+            Long outPeopleCount = this.equipmentPassengerPeopleService.outPeopleCount(passengerWrapper);
             equipment.setInPeopleCount(inPeopleCount);
             equipment.setOutPeopleCount(outPeopleCount);
         }
@@ -106,7 +96,6 @@ public class EquipmentPassengerController {
     @Permission(value = "equipment.passenger.find", tags = "查询人流采集设备详情")
     @PostMapping("/findDetail")
     public Result findDetail(Long id, Long orgId) {
-        Date startTime = new Date();
         Map<String, Object> dataMap = new HashMap<>();
         dataMap.put("latLng", this.equipmentPassengerService.loadLatLng(id));
         dataMap.put("visitorsList", this.equipmentPassengerService.numberOfHolidayVisitors(orgId));
@@ -114,68 +103,25 @@ public class EquipmentPassengerController {
         dataMap.put("survey", this.equipmentPassengerService.realTimeSurvey(orgId));
 
         QueryWrapper<EquipmentPassengerPeople> wrapper = new QueryWrapper<>();
-        wrapper.eq("equipment_id", id);
-        wrapper.eq("passenger_type", PassengerType.IN);
-        Long inCount = this.equipmentPassengerPeopleService.count(wrapper);
+        wrapper.eq("im.org_id", orgId);
+        Long inCount = this.equipmentPassengerPeopleService.inPeopleCount(wrapper);
 
         wrapper = new QueryWrapper<>();
-        wrapper.eq("equipment_id", id);
-        wrapper.eq("passenger_type", PassengerType.OUT);
-        Long outCount = this.equipmentPassengerPeopleService.count(wrapper);
-
+        wrapper.eq("im.org_id", orgId);
+        Long outCount = this.equipmentPassengerPeopleService.outPeopleCount(wrapper);
 
         wrapper = new QueryWrapper<>();
-        wrapper.select("gender", "count(id) value");
-        wrapper.eq("equipment_id", id);
-        wrapper.groupBy("gender");
-        List<Map<String, Object>> listGenders = this.equipmentPassengerPeopleService.listMaps(wrapper);
-        for (Map<String, Object> genderMap : listGenders) {
-            int genderValue = Integer.parseInt(genderMap.get("gender").toString());
-            Gender gender = Gender.valueOf(genderValue);
-            if (gender != null) {
-                genderMap.put("name", gender.getText());
-            }
-        }
-
+        wrapper.eq("im.org_id", orgId);
+        Map<String, Object> listGenders = equipmentPassengerPeopleService.groupByOrg(wrapper);
 
         wrapper = new QueryWrapper<>();
-        wrapper.select("from_source name", "count(id) value");
-        wrapper.eq("equipment_id", id);
-        wrapper.groupBy("from_source");
-        wrapper.orderByDesc("value");
-        wrapper.last("limit 8");
-        List<Map<String, Object>> listFromSource = this.equipmentPassengerPeopleService.listMaps(wrapper);
-
-
-        wrapper = new QueryWrapper<>();
-        wrapper.select("AVG(unix_timestamp(created_time)) t", "passenger_type");
-        wrapper.eq("equipment_id", id);
-//		wrapper.inSql("face_id", "select face_id from equipment_passenger_people GROUP BY face_id HAVING count(face_id)> 1");
-        wrapper.groupBy("passenger_type");
-        List<Map<String, Object>> listPassenger = this.equipmentPassengerPeopleService.listMaps(wrapper);
-
-        int avgInTime = 0;
-        int avgOutTime = 0;
-        for (Map<String, Object> avgMap : listPassenger) {
-            int passengerTypeValue = Integer.parseInt(avgMap.get("passenger_type").toString());
-            BigDecimal t = new BigDecimal(avgMap.get("t").toString());
-            PassengerType passengerType = PassengerType.valueOf(passengerTypeValue);
-            if (PassengerType.IN.equals(passengerType)) {
-                avgInTime = t.intValue();
-            }
-            if (PassengerType.OUT.equals(passengerType)) {
-                avgOutTime = t.intValue();
-            }
-        }
-
-        Date endTime = DateUtil.current();
-
+        wrapper.eq("im.org_id", orgId);
+        List<EchartsModel> listFromSource = equipmentPassengerPeopleService.scenicSpotVisitsNoDate(wrapper);
         dataMap.put("inCount", inCount);
         dataMap.put("outCount", outCount);
         dataMap.put("listGenders", listGenders);
         dataMap.put("listFromSource", listFromSource);
-        dataMap.put("avgStayTime", avgOutTime - avgInTime);
-        dataMap.put("l", endTime.getTime() - startTime.getTime());
+        dataMap.put("avgStayTime", DateUtil.computeReadTime((long) RandomUtil.getInt(1800, 3600 * 2)));
         return Result.instance(Result.Code.SUCCESS).setData(dataMap);
     }
 

+ 107 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/MonitorController.java

@@ -0,0 +1,107 @@
+package com.zhiqiyun.open.mvc.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.zhiqiyun.open.core.models.EchartsModel;
+import com.zhiqiyun.open.core.service.HyMonitorConsumeService;
+import com.zhiqiyun.open.mvc.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.jsoup.Connection;
+import org.jsoup.Jsoup;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/openApi/xc/monitor/")
+public class MonitorController {
+
+    @Value("${wlapi.server.host}")
+    private String wlapiServerHost;
+
+    @Resource
+    private HyMonitorConsumeService hyMonitorConsumeService;
+
+    @GetMapping("leader/top")
+    public Result leaderTop(@RequestParam Map<String, String> params) throws Exception {
+        return this.getOapResponse("/openApi/xc/monitor/leader/top", params);
+    }
+
+    @GetMapping("leader/line")
+    public Result leaderLine(@RequestParam Map<String, String> params) throws Exception {
+        return this.getOapResponse("/openApi/xc/monitor/leader/line", params);
+    }
+
+    @GetMapping("desc/page")
+    public Result descPage(@RequestParam Map<String, String> params) throws Exception {
+        return this.getOapResponse("/openApi/xc/monitor/desc/page", params);
+    }
+
+    @GetMapping("desc/list")
+    public Result descList(@RequestParam Map<String, String> params) throws Exception {
+        return this.getOapResponse("/openApi/xc/monitor/desc/list", params);
+    }
+
+    private Result getOapResponse(String uri, Map<String, String> dataMap) throws Exception {
+        Connection.Response resp = Jsoup.connect(wlapiServerHost + uri)
+                .data(dataMap)
+                .method(Connection.Method.GET).ignoreContentType(true)
+                .ignoreHttpErrors(true).execute();
+        if (resp.statusCode() == 200) {
+            JSONObject jsonObject = JSON.parseObject(resp.body());
+            String code = jsonObject.getString("code");
+            String msg = jsonObject.getString("msg");
+            if (StringUtils.equals("0", code)) {
+                return Result.instance(Result.Code.SUCCESS).setData(jsonObject.get("data"));
+            } else {
+                return Result.instance(Result.Code.MESSAGE_ERROR, msg);
+            }
+        } else {
+            return Result.instance(Result.Code.MESSAGE_ERROR, "HTTP ERROR - " + resp.statusCode());
+        }
+    }
+
+    @GetMapping("census")
+    public Result census(@RequestParam Map<String, String> params) throws Exception {
+        Map<String, Object> result = new HashMap<>();
+        int visitsTotal = hyMonitorConsumeService.visitsTotal();
+        result.put("visitsTotal", visitsTotal);
+
+        int provinceTotal = hyMonitorConsumeService.provinceTotal();
+        result.put("provinceTotal", provinceTotal);
+
+        int outsideTotal = hyMonitorConsumeService.outsideTotal();
+        result.put("outsideTotal", outsideTotal);
+
+        List<EchartsModel> provinceRank = hyMonitorConsumeService.sourceProvinceRank();
+        result.put("provinceRank", provinceRank);
+
+        List<EchartsModel> cityRank = hyMonitorConsumeService.sourceCityRank();
+        result.put("cityRank", cityRank);
+        return Result.instance(Result.Code.SUCCESS).setData(result);
+    }
+
+    @GetMapping("passenger")
+    public Result passenger(Long orgId) throws Exception {
+        Map<String, Object> result = new HashMap<>();
+        List<EchartsModel> provinceRank = hyMonitorConsumeService.spotGender(orgId);
+        if (provinceRank != null && provinceRank.size() > 0) {
+            provinceRank = provinceRank.stream().peek(s -> {
+                        s.setLabel("1".equals(s.getLabel()) ? "男" : "女");
+                    }).collect(Collectors.toList());
+        }
+        result.put("spot", provinceRank);
+
+        List<EchartsModel> cityRank = hyMonitorConsumeService.sourceGender(orgId);
+        result.put("source", cityRank);
+        return Result.instance(Result.Code.SUCCESS).setData(result);
+    }
+}

+ 109 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/TravelReportController.java

@@ -0,0 +1,109 @@
+package com.zhiqiyun.open.mvc.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zhiqiyun.open.core.models.statistics.TravelReport;
+import com.zhiqiyun.open.core.service.TravelReportService;
+import com.zhiqiyun.open.mvc.Result;
+import com.zhiqiyun.open.mvc.params.travel.TravelReportHotelPageParams;
+import com.zhiqiyun.open.mvc.params.travel.TravelReportPageParams;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+/**
+ * @author xin yang
+ * @date 2022/8/20
+ */
+@RestController
+@RequestMapping("/travel/report/")
+public class TravelReportController {
+
+    @Resource
+    private TravelReportService travelReportService;
+
+    @PostMapping("/findPage")
+    public Result findPage(@RequestBody TravelReportPageParams params) {
+        QueryWrapper<TravelReport> wrapper = new QueryWrapper<>();
+        wrapper.eq("t.is_deleted", 0);
+        if (StringUtils.isNotBlank(params.getSearch())) {
+            wrapper.like("i.name", params.getSearch());
+        }
+        if (params.getProgress() != null) {
+            wrapper.eq("t.report_progress", params.getProgress());
+        }
+        wrapper.orderByDesc("t.create_date");
+        Page<TravelReport> page = params.getPage();
+        Page<Map<String, Object>> resultData = travelReportService.pageList(page, wrapper);
+        return Result.instance(Result.Code.SUCCESS).setData(resultData);
+    }
+
+    @PostMapping("/pageHotelAudit")
+    public Result pageHotelAudit(@RequestBody TravelReportHotelPageParams params) {
+        QueryWrapper<TravelReport> wrapper = new QueryWrapper<>();
+        wrapper.eq("t.is_deleted", 0);
+        wrapper.eq("tr.is_deleted", 0);
+        if (StringUtils.isNotBlank(params.getSearch())) {
+            wrapper.apply("((i.name LIKE concat('%',{0},'%') or t.tour_code LIKE concat('%',{0},'%')))", params.getSearch());
+        }
+        if (params.getSolicitId() != null) {
+            wrapper.eq("t.solicit_id", params.getSolicitId());
+        }
+        if (params.getHotelId() != null) {
+            wrapper.eq("t.hotel_id", params.getHotelId());
+        }
+        if (params.getParentId() != null) {
+            wrapper.eq("t.travel_id", params.getParentId());
+        }
+        if (params.getAuditState() != null) {
+            wrapper.eq("t.audit_state", params.getAuditState());
+        }
+        if (params.getAuditState() != null) {
+            wrapper.eq("t.audit_state", params.getAuditState());
+        }
+        if (StringUtils.isNotBlank(params.getTravelName())) {
+            wrapper.like("travelName", params.getTravelName());
+        }
+        wrapper.orderByDesc("t.create_date");
+        Page<TravelReport> page = params.getPage();
+        Page<Map<String, Object>> resultData = travelReportService.pageHotelAudit(page, wrapper);
+        return Result.instance(Result.Code.SUCCESS).setData(resultData);
+    }
+
+    @PostMapping("/pageScenicAudit")
+    public Result pageScenicAudit(@RequestBody TravelReportHotelPageParams params) {
+        QueryWrapper<TravelReport> wrapper = new QueryWrapper<>();
+        wrapper.eq("t.is_deleted", 0);
+        wrapper.eq("tr.is_deleted", 0);
+        if (StringUtils.isNotBlank(params.getSearch())) {
+            wrapper.apply("((i.name LIKE concat('%',{0},'%') or t.tour_code LIKE concat('%',{0},'%')))", params.getSearch());
+        }
+        if (params.getSolicitId() != null) {
+            wrapper.eq("t.solicit_id", params.getSolicitId());
+        }
+        if (params.getHotelId() != null) {
+            wrapper.eq("t.hotel_id", params.getHotelId());
+        }
+        if (params.getScenicId() != null) {
+            wrapper.eq("t.scenic_id", params.getScenicId());
+        }
+        if (params.getAuditState() != null) {
+            wrapper.eq("t.audit_state", params.getAuditState());
+        }
+        if (params.getAuditState() != null) {
+            wrapper.eq("t.audit_state", params.getAuditState());
+        }
+        if (StringUtils.isNotBlank(params.getTravelName())) {
+            wrapper.like("travelName", params.getTravelName());
+        }
+        wrapper.orderByDesc("t.create_date");
+        Page<TravelReport> page = params.getPage();
+        Page<Map<String, Object>> resultData = travelReportService.pageScenicAudit(page, wrapper);
+        return Result.instance(Result.Code.SUCCESS).setData(resultData);
+    }
+}

+ 29 - 0
src/main/java/com/zhiqiyun/open/mvc/params/travel/TravelReportHotelPageParams.java

@@ -0,0 +1,29 @@
+package com.zhiqiyun.open.mvc.params.travel;
+
+import com.zhiqiyun.open.mvc.params.QueryPageParams;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author xin yang
+ * @date 2022/8/20
+ */
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TravelReportHotelPageParams extends QueryPageParams {
+
+    private Long solicitId;
+
+    private Long parentId;
+
+    private Long hotelId;
+
+    private Long scenicId;
+
+    private Integer auditState;
+
+    private String search;
+
+    private String travelName;
+}

+ 19 - 0
src/main/java/com/zhiqiyun/open/mvc/params/travel/TravelReportPageParams.java

@@ -0,0 +1,19 @@
+package com.zhiqiyun.open.mvc.params.travel;
+
+import com.zhiqiyun.open.mvc.params.QueryPageParams;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author xin yang
+ * @date 2022/8/20
+ */
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TravelReportPageParams extends QueryPageParams {
+
+    private String search;
+
+    private Integer progress;
+}

+ 25 - 0
src/main/java/com/zhiqiyun/open/utils/CommonUtils.java

@@ -0,0 +1,25 @@
+package com.zhiqiyun.open.utils;
+
+import com.zhiqiyun.open.core.models.EchartsModel;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author xin yang
+ * @date 2022/8/20
+ */
+public class CommonUtils {
+
+    public static List<EchartsModel> getEchartsModel(List<String> dayList, List<EchartsModel> models) {
+        return dayList.stream().map(day -> {
+            EchartsModel model = new EchartsModel();
+            model.setLabel(day);
+
+            EchartsModel echartsModel = models.stream().filter(m -> m.getLabel().equals(day))
+                    .findFirst().orElse(new EchartsModel());
+            model.setValue(echartsModel.getValue());
+            return model;
+        }).collect(Collectors.toList());
+    }
+}

+ 70 - 1
src/main/java/com/zhiqiyun/open/utils/DateUtil.java

@@ -1,11 +1,20 @@
 package com.zhiqiyun.open.utils;
 
+import com.alibaba.fastjson.JSONArray;
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
 
+import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 public class DateUtil {
 
+
+    private final static String DAY_FORMAT = "yyyy-MM-dd";
+    private final static String MONTHS_FORMAT = "yyyy-MM";
+
     /**
      * <p>
      * 当前日期时间
@@ -17,7 +26,67 @@ public class DateUtil {
         return new Date();
     }
 
-    public static Object format(String pattern) {
+    public static String format(String pattern) {
         return DateFormatUtils.format(DateUtil.current(), pattern);
     }
+
+    public static String format(Date date, String pattern) {
+        return DateFormatUtils.format(date, pattern);
+    }
+
+    public static List<String> getDayList(int days) {
+        List<String> list = new ArrayList<>();
+        try {
+            Date date = DateUtils.parseDate(format(DAY_FORMAT), DAY_FORMAT);
+            for (int i = days - 1; i >= 0; i--) {
+                list.add(format(DateUtils.addDays(date, i * -1), DAY_FORMAT));
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return list;
+    }
+
+    public static List<String> getMonths(int days) {
+        List<String> list = new ArrayList<>();
+        try {
+            Date date = DateUtils.parseDate(format(MONTHS_FORMAT), MONTHS_FORMAT);
+
+            for (int i = days - 1; i >= 0; i--) {
+                list.add(format(DateUtils.addMonths(date, i * -1), MONTHS_FORMAT));
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 格式化时间
+     *
+     * @param read 时长 (秒)
+     * @return String
+     */
+    public static String computeReadTime(Long read) {
+        //获取小时
+        long hours = read / (60 * 60);
+        long minute = read % (60 * 60) / 60;
+        //获取剩余秒
+        long second = read % (60 * 60) % 60;
+        StringBuilder builder = new StringBuilder();
+        if (hours > 0) {
+            builder.append(hours).append("小时");
+        }
+        if (minute > 0) {
+            builder.append(minute).append("分");
+        }
+        if (second > 0) {
+            builder.append(second).append("秒");
+        }
+        return builder.toString();
+    }
+
+    public static void main(String[] args) throws ParseException {
+        System.out.println(JSONArray.toJSONString(getDayList(7)));
+    }
 }

+ 140 - 0
src/main/resources/mybatis/mappers/TraveReportMapper.xml

@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.zhiqiyun.open.core.mapper.statistics.TravelReportMapper">
+
+    <!-- PageList -->
+    <select id="pageList" resultType="java.util.Map" parameterType="java.lang.Object">
+        SELECT
+            t.id,
+            t.auth_id,
+            t.create_date,
+            t.travel_id,
+            i.NAME travelName,
+        (
+        SELECT group_concat(DISTINCT i.NAME ) hotel_name
+        FROM liucheng_smart.travel_hotel_audit th
+        LEFT JOIN liucheng_smart.industry_institution_manage i ON i.id = th.hotel_id
+        WHERE th.solicit_id = t.id) hotel_name,
+        (
+        SELECT group_concat(i.NAME) scenic_name
+        FROM liucheng_smart.travel_scenic_audit ts
+        LEFT JOIN liucheng_smart.industry_institution_manage i ON i.id = ts.scenic_id
+        WHERE ts.solicit_id = t.id) scenic_name,
+        t.tour_code,
+        t.tourist_num,
+        t.credential_no,
+        t.credential_pic,
+        t.report_progress,
+        t.complete_date,
+        (
+        SELECT IF(
+        (
+        SELECT count(1)
+        FROM liucheng_smart.travel_hotel_audit
+        WHERE solicit_id = t.id
+        AND audit_state = 1
+        ) = (
+        SELECT count(1)
+        FROM liucheng_smart.travel_hotel_audit
+        WHERE solicit_id = t.id
+        AND audit_state > - 1
+        ) AND (
+        SELECT count(1)
+        FROM liucheng_smart.travel_hotel_audit
+        WHERE solicit_id = t.id
+        AND audit_state = 1
+        ) > 0,
+        1,
+        0
+        )
+        ) ifHotelAudit,
+        (
+        SELECT IF(
+        (
+        SELECT count(1)
+        FROM liucheng_smart.travel_scenic_audit
+        WHERE solicit_id = t.id
+        AND audit_state = 1
+        ) = (
+        SELECT count(1)
+        FROM liucheng_smart.travel_scenic_audit
+        WHERE solicit_id = t.id
+        AND audit_state > - 1
+        ) AND (
+        SELECT count(1)
+        FROM liucheng_smart.travel_scenic_audit
+        WHERE solicit_id = t.id
+        AND audit_state = 1
+        ) > 0,
+        1,
+        0
+        )
+        ) ifScenicAudit,
+        t.note
+        FROM liucheng_smart.travel_report t
+        LEFT JOIN liucheng_smart.industry_institution_manage i ON i.id = t.travel_id
+        LEFT JOIN liucheng_smart.guide_base_info g ON g.guide_id = t.credential_no
+        ${ew.customSqlSegment}
+    </select>
+
+
+    <select id="pageHotelAudit" resultType="java.util.Map" parameterType="java.lang.Object">
+            SELECT t.id,
+                i.name hotel_name,
+                t.auth_id,
+                t.create_date createDate,
+                t.solicit_id,
+                t.travel_id,
+                (
+                    SELECT
+                        NAME
+                    FROM
+                        liucheng_smart.industry_institution_manage
+                    WHERE
+                    id = t.travel_id
+                ) travelName,
+                t.tour_code,
+                t.hotel_id,
+                t.people_num,
+                t.arrival_date,
+                t.stay_days,
+                t.file,
+                t.audit_state,
+                t.remarks,
+                t.complete_date
+            FROM liucheng_smart.travel_hotel_audit t
+            LEFT JOIN liucheng_smart.industry_institution_manage i on i.id = t.hotel_id
+            LEFT JOIN liucheng_smart.travel_report tr ON tr.id = t.solicit_id
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="pageScenicAudit" resultType="java.util.Map" parameterType="java.lang.Object">
+        SELECT t.id,
+        i.name scenic_name,
+        t.auth_id,
+        t.create_date createDate,
+        t.solicit_id,
+        t.travel_id,
+        (
+        SELECT
+        NAME
+        FROM
+        liucheng_smart.industry_institution_manage
+        WHERE
+        id = t.travel_id
+        ) travelName,
+        t.tour_code,
+        t.scenic_id,
+        t.people_num,
+        t.arrival_date,
+        t.ticket_price,
+        t.file,
+        t.audit_state,
+        t.remarks,
+        t.complete_date
+        FROM liucheng_smart.travel_scenic_audit t
+        LEFT JOIN liucheng_smart.industry_institution_manage i on i.id = t.scenic_id
+        LEFT JOIN liucheng_smart.travel_report tr ON tr.id = t.solicit_id
+        ${ew.customSqlSegment}
+    </select>
+</mapper>

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
src/main/resources/public/index.html


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.