This commit is contained in:
Vinjor 2025-07-17 17:22:57 +08:00
parent 232f13be3e
commit 87c7c19565
18 changed files with 298 additions and 47 deletions

View File

@ -44,7 +44,7 @@ public class StatisticsController extends BaseController
//询盘流量
rtnMap.put("ipInquiry",busiThirdItemService.inquiryMap(tenantId));
//询盘来源前十国家
rtnMap.put("nationalData",busiThirdItemService.nationalData(tenantId));
rtnMap.put("nationalData",busiThirdItemService.nationalData(tenantId,null,null,10));
//询盘设备
rtnMap.put("equipmentData",busiThirdItemService.equipmentData(tenantId));
//近一个月询盘数
@ -59,4 +59,11 @@ public class StatisticsController extends BaseController
public AjaxResult inquiryChart(String tenantId,String startDate,String endDate){
return success(busiThirdItemService.inquiryChart(tenantId,startDate,endDate));
}
/**
* 询盘国家分布指定时间范围
*/
@GetMapping("/countryChart")
public AjaxResult countryChart(String tenantId,String startDate,String endDate){
return success(busiThirdItemService.nationalData(tenantId,startDate,endDate,null));
}
}

View File

@ -80,7 +80,6 @@ public class BusiInquiryItem extends DlBaseEntity
private String equipment;
/** 页面路径 */
@Excel(name = "页面路径")
private String pageUrl;
/** 站点唯一编码租户id */

View File

@ -49,7 +49,6 @@ public class BusiThirdItem extends DlBaseEntity
private String viewType;
/** 页面路径 */
@Excel(name = "页面路径")
private String pageUrl;
/** 设备类型 */

View File

@ -33,7 +33,7 @@ public interface BusiChatMainMapper extends BaseMapper<BusiChatMain>
**/
Integer selectIpCount(@Param("tenantId")String tenantId,@Param("startDate")String startDate,@Param("endDate")String endDate);
List<ChartDataVO> selectNationalSortList(@Param("tenantId")String tenantId);
List<ChartDataVO> selectNationalSortList(@Param("tenantId")String tenantId,@Param("startDate")String startDate,@Param("endDate")String endDate);
/**
* 查询询盘设备

View File

@ -33,7 +33,7 @@ public interface BusiInquiryItemMapper extends BaseMapper<BusiInquiryItem>
**/
Integer selectIpCount(@Param("tenantId")String tenantId,@Param("startDate")String startDate,@Param("endDate")String endDate);
List<ChartDataVO> selectNationalSortList(@Param("tenantId")String tenantId);
List<ChartDataVO> selectNationalSortList(@Param("tenantId")String tenantId,@Param("startDate")String startDate,@Param("endDate")String endDate);
/**
* 查询询盘设备

View File

@ -4,10 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.busi.domain.BusiThirdItem;
import com.ruoyi.busi.vo.ChartDataVO;
import com.ruoyi.busi.vo.IndexInquiryVO;
import com.ruoyi.busi.vo.ThirdSoftVO;
import com.ruoyi.busi.vo.ThirdVO;
import com.ruoyi.busi.vo.*;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@ -40,7 +37,7 @@ public interface BusiThirdItemMapper extends BaseMapper<BusiThirdItem>
* @param tenantId 站点ID
* @return java.util.List<com.ruoyi.busi.vo.ChartDataVO>
**/
List<ChartDataVO> selectNationalSortList(@Param("tenantId")String tenantId);
List<ChartDataVO> selectNationalSortList(@Param("tenantId")String tenantId,@Param("startDate")String startDate,@Param("endDate")String endDate);
/**
* 查询询盘设备

View File

@ -37,7 +37,7 @@ public interface IBusiThirdItemService extends IService<BusiThirdItem>
* @param tenantId 站点编码
* @return java.util.List<com.ruoyi.busi.vo.ChartDataVO>
**/
List<ChartDataVO> nationalData(String tenantId);
List<ChartDataVO> nationalData(String tenantId,String startDate,String endDate,Integer num);
/**
* 查询盘设备
@ -67,4 +67,14 @@ public interface IBusiThirdItemService extends IService<BusiThirdItem>
* @return java.util.Map<java.lang.String,java.lang.Object>
**/
Map<String, Object> inquiryChart(String tenantId,String startDate,String endDate);
/**
* 询盘国家分布
* @author vinjor-M
* @date 17:12 2025/7/16
* @param tenantId 站点编码
* @param startDate 开始日期
* @param endDate 结束日期
* @return java.util.Map<java.lang.String,java.lang.Object>
**/
Map<String, Object> countryChart(String tenantId, String startDate, String endDate);
}

View File

@ -139,13 +139,17 @@ public class BusiThirdItemServiceImpl extends ServiceImpl<BusiThirdItemMapper,Bu
* @date 10:47 2025/7/16
**/
@Override
public List<ChartDataVO> nationalData(String tenantId) {
public List<ChartDataVO> nationalData(String tenantId,String startDate,String endDate,Integer num) {
//开始日期
String startDateStr = null==startDate?null:startDate+StrConstants.START_DATE;
//截止日期
String endDateStr = null==endDate?null:endDate+StrConstants.END_DATE;
//三方系统跳转
List<ChartDataVO> thirdList = busiThirdItemMapper.selectNationalSortList(tenantId);
List<ChartDataVO> thirdList = busiThirdItemMapper.selectNationalSortList(tenantId,startDateStr,endDateStr);
//在线询盘
List<ChartDataVO> inquiryList = inquiryItemMapper.selectNationalSortList(tenantId);
List<ChartDataVO> inquiryList = inquiryItemMapper.selectNationalSortList(tenantId,startDateStr,endDateStr);
//在线聊天
List<ChartDataVO> chatList = chatMainMapper.selectNationalSortList(tenantId);
List<ChartDataVO> chatList = chatMainMapper.selectNationalSortList(tenantId,startDateStr,endDateStr);
//数据合并
Map<String,ChartDataVO> nationalMap = new HashMap<>();
this.dealMapFun(thirdList,nationalMap);
@ -154,6 +158,9 @@ public class BusiThirdItemServiceImpl extends ServiceImpl<BusiThirdItemMapper,Bu
//转list
List<ChartDataVO> dataVOList = new ArrayList<>(nationalMap.values())
.stream().sorted(Comparator.comparingInt(ChartDataVO::getValue).reversed()).collect(Collectors.toList());
if(null!=num && dataVOList.size()>num){
return dataVOList.subList(0,num);
}
return dataVOList;
}
@ -338,4 +345,25 @@ public class BusiThirdItemServiceImpl extends ServiceImpl<BusiThirdItemMapper,Bu
return rtnMap;
}
/**
* 询盘国家分布
*
* @param tenantId 站点编码
* @param startDate 开始日期
* @param endDate 结束日期
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author vinjor-M
* @date 17:12 2025/7/16
**/
@Override
public Map<String, Object> countryChart(String tenantId, String startDate, String endDate) {
Map<String,Object> rtnMap = new HashMap<>();
//开始日期
String startDateStr = startDate+StrConstants.START_DATE;
//截止日期
String endDateStr = endDate+StrConstants.END_DATE;
//先查出这段时间所有三方询盘国家分布情况
return rtnMap;
}
}

View File

@ -2,8 +2,15 @@ package com.ruoyi.busi.vo;
import lombok.Data;
/**
* 国家分布饼图实体
* @author vinjor-M
* @date 16:28 2025/7/17
**/
@Data
public class ChartDataVO {
/** 国家名称 */
private String name;
/** 数量 */
private Integer value;
}

View File

@ -86,6 +86,12 @@
WHERE
del_flag = '0'
AND tenant_id = #{tenantId}
<if test="startDate != null and startDate != ''">
and create_time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and create_time &lt;= #{endDate}
</if>
GROUP BY
national
</select>

View File

@ -72,6 +72,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
del_flag = '0'
AND tenant_id = #{tenantId}
<if test="startDate != null and startDate != ''">
and create_time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and create_time &lt;= #{endDate}
</if>
GROUP BY
national
</select>

View File

@ -77,6 +77,12 @@ order by dbti.create_time DESC
WHERE
del_flag = '0'
AND tenant_id = #{tenantId}
<if test="startDate != null and startDate != ''">
and create_time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and create_time &lt;= #{endDate}
</if>
GROUP BY
national
</select>

View File

@ -17,4 +17,12 @@ export function inquiryChart(query) {
params: query
})
}
//国家分布
export function countryChart(query) {
return request({
url: '/statistics/countryChart',
method: 'get',
params: query
})
}

View File

@ -26,7 +26,7 @@ export default {
},
data() {
return {
chart: null
chart: null,
}
},
mounted() {
@ -68,18 +68,28 @@ export default {
},
series: [
{
name: '',
name: '询盘设备',
type: 'pie',
roseType: 'radius',
radius: [15, 95],
center: ['50%', '38%'],
data:dataArray,
animationEasing: 'cubicInOut',
animationDuration: 2600
animationDuration: 2600,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
label: {
formatter: '{b}: {c} ({d}%)'
}
}
]
})
}
},
}
}
</script>

View File

@ -0,0 +1,78 @@
<template>
<div :class="className" :style="{height:height,width:width}"/>
</template>
<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '600px'
}
},
data() {
return {
chart: null,
//
}
},
mounted() {
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart(data) {
this.chart = echarts.init(this.$el, 'macarons')
const option = {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
// legend: {
// orient: 'vertical',
// left: 'left',
// data: data.map(item => item.name)
// },
series: [
{
name: '国家分布',
type: 'pie',
radius: '50%',
data: data,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
label: {
formatter: '{b}: {c} ({d}%)'
}
}
]
};
this.chart.setOption(option);
}
}
}
</script>

View File

@ -37,7 +37,7 @@
<img src="@/assets/index/third.png">
<span>三方询盘</span>
</div>
<div class="dl-menu-box" @click="goMenuClick('/base/pics')">
<div class="dl-menu-box" @click="goMenuClick('/statistics/inquiryItem')">
<img src="@/assets/index/chat.png">
<span>在线询盘</span>
</div>

View File

@ -1,10 +1,122 @@
<template>
<div class="app-container">www</div>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="120px">
<el-form-item label="时间范围" prop="dataRange">
<el-date-picker
v-model="queryParams.dataRange"
type="monthrange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<pie-cus-chart ref="pieCusChart"></pie-cus-chart>
</div>
</template>
<script>
import { countryChart } from "@/api/statistics/statistics";
import PieCusChart from '../../dashboard/PieCusChart'
export default {
name: 'countryChart'
name: 'countryChart',
components: { PieCusChart },
data() {
return {
//
queryParams: {
dataRange: '',
startDate: '',
endDate: '',
tenantId: null
},
pickerOptions: {
shortcuts: [{
text: '本月',
onClick(picker) {
picker.$emit('pick', [new Date(), new Date()]);
}
}, {
text: '今年至今',
onClick(picker) {
const end = new Date();
const start = new Date(new Date().getFullYear(), 0);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近六个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 6);
picker.$emit('pick', [start, end]);
}
}]
},
}
},
created() {
this.initDateRange()
},
methods:{
initDateRange(){
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 6);
this.queryParams.dataRange = [start,end]
this.handleQuery()
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
if (this.queryParams.dataRange && this.queryParams.dataRange.length > 1) {
this.queryParams.startDate = this.formatDate(this.queryParams.dataRange[0],false)
this.queryParams.endDate = this.formatDate(this.queryParams.dataRange[1],true)
console.log(this.queryParams, '12')
} else {
this.queryParams.startDate = null
this.queryParams.endDate = null
}
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.initDateRange()
},
/**
* 查询数据
*/
getList(){
countryChart(this.queryParams).then(response => {
this.$refs.pieCusChart.initChart(response.data)
});
},
/**
* 格式化时间戳
*/
formatDate(timestamp,ifEnd) {
const date = new Date(timestamp)
const year = date.getFullYear()
// 01
const month = String(date.getMonth() + 1).padStart(2, '0')
if(ifEnd){
//
const date = new Date(year, month, 0);
return `${year}-${month}`+"-"+date.getDate();
}else{
//
return `${year}-${month}`+"-01"
}
},
}
}
</script>

View File

@ -18,36 +18,16 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<line-chart ref="lineChart" :chart-data="lineChartData"></line-chart>
<line-chart ref="lineChart"></line-chart>
</div>
</template>
<script>
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145]
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130]
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130]
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130]
}
}
import { inquiryChart } from "@/api/statistics/statistics";
import LineChart from '../../dashboard/LineChart'
import PanelGroup from '../../dashboard/PanelGroup'
import RaddarChart from '../../dashboard/RaddarChart'
export default {
name: 'inquiryChart',
components: { RaddarChart, PanelGroup, LineChart },
components: { LineChart },
data() {
return {
//
@ -57,7 +37,6 @@ export default {
endDate: '',
tenantId: null
},
lineChartData: {},
pickerOptions: {
shortcuts: [{
text: '本月',
@ -117,8 +96,7 @@ export default {
*/
getList(){
inquiryChart(this.queryParams).then(response => {
this.lineChartData = response.data
this.$refs.lineChart.initChart(this.lineChartData)
this.$refs.lineChart.initChart(response.data)
});
},
/**