Merge branch 'master' of http://124.222.105.7:3000/dianliang/dl_site_system
This commit is contained in:
commit
54cc6be9fa
@ -1,5 +1,7 @@
|
||||
package com.ruoyi.busi.service.impl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -10,6 +12,7 @@ import com.ruoyi.busi.domain.BusiChatMain;
|
||||
import com.ruoyi.busi.domain.BusiInquiryItem;
|
||||
import com.ruoyi.busi.mapper.BusiChatMainMapper;
|
||||
import com.ruoyi.busi.mapper.BusiInquiryItemMapper;
|
||||
import com.ruoyi.busi.utils.CommonUtils;
|
||||
import com.ruoyi.busi.vo.ChartDataVO;
|
||||
import com.ruoyi.busi.vo.IndexInquiryVO;
|
||||
import com.ruoyi.busi.vo.ThirdSoftVO;
|
||||
@ -273,17 +276,66 @@ public class BusiThirdItemServiceImpl extends ServiceImpl<BusiThirdItemMapper,Bu
|
||||
**/
|
||||
@Override
|
||||
public Map<String, Object> inquiryChart(String tenantId, String startDate, String endDate) {
|
||||
Map<String,Object> rtnMap = new HashMap<>();
|
||||
//开始日期
|
||||
String startDateStr = startDate+StrConstants.START_DATE;
|
||||
//截止日期
|
||||
String endDateStr = startDate+StrConstants.END_DATE;
|
||||
String endDateStr = endDate+StrConstants.END_DATE;
|
||||
//先查出这段时间所有三方询盘数据
|
||||
List<BusiThirdItem> thirdItemList = busiThirdItemMapper.selectLineChart(tenantId,startDateStr,endDateStr);
|
||||
//这段时间所有在线询盘数据
|
||||
List<BusiInquiryItem> inquiryItemList = inquiryItemMapper.selectLineChart(tenantId, startDateStr, endDateStr);
|
||||
//这段时间所有在线聊天的数据
|
||||
List<BusiChatMain> chatMainList = chatMainMapper.selectLineChart(tenantId, startDateStr, endDateStr);
|
||||
//所有月份
|
||||
List<String> yearMonthList = CommonUtils.getAllYearMonth(startDate, endDate);
|
||||
List<Integer> allNumList = new ArrayList<>();
|
||||
List<Integer> emailNumList = new ArrayList<>();
|
||||
List<Integer> whatsAppNumList = new ArrayList<>();
|
||||
List<Integer> teamsNumList = new ArrayList<>();
|
||||
List<Integer> chatNumList = new ArrayList<>();
|
||||
List<Integer> inquiryNumList = new ArrayList<>();
|
||||
//遍历每个月份
|
||||
yearMonthList.forEach(item->{
|
||||
//本月总数
|
||||
Integer allNum = 0;
|
||||
Integer emailNum = 0;
|
||||
Integer whatsAppNum = 0;
|
||||
Integer teamsNum = 0;
|
||||
//先过滤三方询盘的
|
||||
List<BusiThirdItem> thirdFilterList = thirdItemList.stream().filter(thirdItem -> DateUtil.formatDate(thirdItem.getCreateTime()).contains(item)).collect(Collectors.toList());
|
||||
for (BusiThirdItem filter:thirdFilterList){
|
||||
if(DictConstants.THIRD_SOFT_EMAIL.equals(filter.getThirdSoft())){
|
||||
//email
|
||||
emailNum++;
|
||||
}else if(DictConstants.THIRD_SOFT_TEAMS.equals(filter.getThirdSoft())){
|
||||
//teams
|
||||
teamsNum++;
|
||||
}else if(DictConstants.THIRD_SOFT_WHATSAPP.equals(filter.getThirdSoft())){
|
||||
//whatsApp
|
||||
whatsAppNum++;
|
||||
}
|
||||
}
|
||||
//在线聊天数
|
||||
Integer chatNum = (int) chatMainList.stream().filter(thirdItem -> DateUtil.formatDate(thirdItem.getCreateTime()).contains(item)).count();
|
||||
//在线询盘数
|
||||
Integer inquiryNum = (int) inquiryItemList.stream().filter(thirdItem -> DateUtil.formatDate(thirdItem.getCreateTime()).contains(item)).count();
|
||||
allNum=emailNum+teamsNum+whatsAppNum+chatNum+inquiryNum;
|
||||
allNumList.add(allNum);
|
||||
emailNumList.add(emailNum);
|
||||
whatsAppNumList.add(whatsAppNum);
|
||||
teamsNumList.add(teamsNum);
|
||||
chatNumList.add(chatNum);
|
||||
inquiryNumList.add(inquiryNum);
|
||||
});
|
||||
rtnMap.put("month",yearMonthList);
|
||||
rtnMap.put("allNum",allNumList);
|
||||
rtnMap.put("emailNum",emailNumList);
|
||||
rtnMap.put("whatsAppNum",whatsAppNumList);
|
||||
rtnMap.put("teamsNum",teamsNumList);
|
||||
rtnMap.put("chatNum",chatNumList);
|
||||
rtnMap.put("inquiryNum",inquiryNumList);
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
/**
|
||||
@ -76,4 +78,28 @@ public class CommonUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取给定的一个时间范围内的所有月份
|
||||
* @author vinjor-M
|
||||
* @date 15:24 2025/7/17
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return java.util.List<java.lang.String>
|
||||
**/
|
||||
public static List<String> getAllYearMonth(String startDate,String endDate){
|
||||
//定期起始日期
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate startDateObj = LocalDate.parse(startDate,formatter);
|
||||
LocalDate endDateObj = LocalDate.parse(endDate,formatter);
|
||||
//获取所有年月
|
||||
List<String> yearMonthList = new ArrayList<>();
|
||||
// 从起始日期开始,遍历到结束日期
|
||||
while (!startDateObj.isAfter(endDateObj)) {
|
||||
// 只要startDate不晚于endDate 获取年-月格式
|
||||
yearMonthList.add(startDateObj.getYear() + "-" + String.format("%02d", startDateObj.getMonthValue()));
|
||||
// 增加一个月
|
||||
startDateObj = startDateObj.plusMonths(1);
|
||||
}
|
||||
return yearMonthList;
|
||||
}
|
||||
}
|
||||
|
@ -57,14 +57,14 @@ export default {
|
||||
this.chart = null
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
initChart(dataObj) {
|
||||
this.chart = echarts.init(this.$el, 'macarons')
|
||||
this.setOptions(this.chartData)
|
||||
this.setOptions(dataObj)
|
||||
},
|
||||
setOptions({ expectedData, actualData } = {}) {
|
||||
setOptions(dataObj) {
|
||||
this.chart.setOption({
|
||||
xAxis: {
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
data: dataObj.month,
|
||||
boundaryGap: false,
|
||||
axisTick: {
|
||||
show: false
|
||||
@ -90,41 +90,53 @@ export default {
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['expected', 'actual']
|
||||
data: ['总数', 'teams','whatsApp','email','在线询盘','在线聊天']
|
||||
},
|
||||
series: [{
|
||||
name: 'expected', itemStyle: {
|
||||
normal: {
|
||||
color: '#FF005A',
|
||||
lineStyle: {
|
||||
color: '#FF005A',
|
||||
width: 2
|
||||
}
|
||||
}
|
||||
},
|
||||
name: '总数',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: expectedData,
|
||||
data: dataObj.allNum,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'cubicInOut'
|
||||
},
|
||||
{
|
||||
name: 'actual',
|
||||
name: 'teams',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#3888fa',
|
||||
lineStyle: {
|
||||
color: '#3888fa',
|
||||
width: 2
|
||||
data: dataObj.teamsNum,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
},
|
||||
areaStyle: {
|
||||
color: '#f3f8ff'
|
||||
}
|
||||
}
|
||||
{
|
||||
name: 'whatsApp',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: dataObj.whatsAppNum,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
},
|
||||
data: actualData,
|
||||
{
|
||||
name: 'email',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: dataObj.emailNum,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
},
|
||||
{
|
||||
name: '在线询盘',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: dataObj.inquiryNum,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
},
|
||||
{
|
||||
name: '在线聊天',
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
data: dataObj.chatNum,
|
||||
animationDuration: 2800,
|
||||
animationEasing: 'quadraticOut'
|
||||
}]
|
||||
|
@ -57,7 +57,7 @@ export default {
|
||||
endDate: '',
|
||||
tenantId: null
|
||||
},
|
||||
lineChartData: lineChartData.newVisitis,
|
||||
lineChartData: {},
|
||||
pickerOptions: {
|
||||
shortcuts: [{
|
||||
text: '本月',
|
||||
@ -117,9 +117,8 @@ export default {
|
||||
*/
|
||||
getList(){
|
||||
inquiryChart(this.queryParams).then(response => {
|
||||
this.rtnMap = response.data
|
||||
this.$refs.barChart.initChart(this.rtnMap.nationalData)
|
||||
this.$refs.pieChart.initChart(this.rtnMap.equipmentData)
|
||||
this.lineChartData = response.data
|
||||
this.$refs.lineChart.initChart(this.lineChartData)
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user