主页信息
This commit is contained in:
parent
885268bc72
commit
da80439fcc
@ -55,3 +55,23 @@ export function getSummaryPieData(startDate: string,endDate: string) {
|
||||
params: {startDate,endDate}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 最近活动 getRecentActivity
|
||||
*/
|
||||
export function getRecentActivity() {
|
||||
return request<any[]>({
|
||||
url: '/common/statistics/getRecentActivity',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* getPricingSummary
|
||||
*/
|
||||
export function getPricingSummary() {
|
||||
return request<any>({
|
||||
url: '/common/statistics/getPricingSummary',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,33 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch, h } from 'vue' // 添加 h 导入
|
||||
import { useAppStore } from '@/store/modules/app'
|
||||
import HeaderBanner from './modules/header-banner.vue'
|
||||
//import CardData from './modules/card-data.vue'
|
||||
import CardDataSummary from './modules/card-data-summary.vue'
|
||||
import CardDataMkt from './modules/card-data-mkt.vue'
|
||||
//import ProjectNews from './modules/project-news.vue'
|
||||
//import CreativityBanner from './modules/creativity-banner.vue'
|
||||
import { useAuthStore } from "@/store/modules/auth"
|
||||
import {
|
||||
NButton,
|
||||
NCard,
|
||||
NStatistic,
|
||||
NDataTable,
|
||||
NTag,
|
||||
NDivider,
|
||||
NH1,
|
||||
NH2,
|
||||
NP,
|
||||
NNumberAnimation,
|
||||
NProgress,
|
||||
NGrid,
|
||||
NGi,
|
||||
NSpace,
|
||||
NIcon,
|
||||
NThing
|
||||
} from 'naive-ui'
|
||||
import { computed, h, onMounted, ref } from 'vue'; // 添加 h 导入
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import HeaderBanner from './modules/header-banner.vue';
|
||||
import CardDataSummary from './modules/card-data-summary.vue';
|
||||
import CardDataMkt from './modules/card-data-mkt.vue';
|
||||
import { useAuthStore } from '@/store/modules/auth';
|
||||
import { NCard, NDataTable, NGi, NGrid, NProgress, NSpace } from 'naive-ui';
|
||||
|
||||
import dayjs from 'dayjs'
|
||||
import dayjs from 'dayjs';
|
||||
import { getPricingSummary, getRecentActivity } from '@/service/api/statistics/statistics';
|
||||
|
||||
const appStore = useAppStore()
|
||||
const { userInfo } = useAuthStore()
|
||||
@ -35,7 +16,7 @@ const { userInfo } = useAuthStore()
|
||||
const gap = computed(() => (appStore.isMobile ? 0 : 16))
|
||||
|
||||
//是否管理用户
|
||||
let isAdmin = ref(false);
|
||||
// let isAdmin = ref(false);
|
||||
|
||||
// 初始设置为本月范围
|
||||
const dateRange = ref<[number, number]>([
|
||||
@ -48,6 +29,19 @@ const handleDateChange = (range: [number, number]) => {
|
||||
dateRange.value = range
|
||||
}
|
||||
|
||||
const pricingSummaryName: { [key: string]: string } = {
|
||||
'daishou': '代收业务',
|
||||
'qita': '其他',
|
||||
'waihui': '外汇业务',
|
||||
'jijie': '季节性计价',
|
||||
'hnt': '慧农通业务',
|
||||
'zyt': '智e通业务',
|
||||
'licai': '理财业务',
|
||||
'shebaoka': '社保卡业务',
|
||||
'zhsd': '综合收单业务',
|
||||
'jiaofei': '缴费业务'
|
||||
}
|
||||
|
||||
// 设置快速日期范围
|
||||
const setDateRange = (type: 'today' | 'week' | 'month') => {
|
||||
let start, end
|
||||
@ -97,7 +91,7 @@ const setDateRange = (type: 'today' | 'week' | 'month') => {
|
||||
|
||||
// 当用户是管理用户时,登陆后即异步查询所有用户信息
|
||||
// 当用户是营销用户时,登录后即异步查询自己的信息
|
||||
const adminData = ref({
|
||||
const adminData = ref<{ pricingSummary: { category : string ,amount : number ,percentage:string }[], recentActivities: any[]}>({
|
||||
//查询 按照业务类型查询计价金额汇总,取最大4条+其他汇总成一条
|
||||
pricingSummary: [
|
||||
],
|
||||
@ -168,16 +162,16 @@ const summaryColumns = [
|
||||
{
|
||||
title: '金额 (¥)',
|
||||
key: 'amount',
|
||||
render: (row: any) => {
|
||||
return h('div', { class: 'amount-with-trend' }, [
|
||||
h('span', row.amount.toLocaleString('zh-CN')),
|
||||
h(NIcon, {
|
||||
size: '16',
|
||||
color: row.trend === 'up' ? '#18a058' : '#d03050',
|
||||
style: { 'margin-left': '8px' }
|
||||
}, { default: () => '元' })
|
||||
])
|
||||
}
|
||||
// render: (row: any) => {
|
||||
// return h('div', { class: 'amount-with-trend' }, [
|
||||
// h('span', row.amount.toLocaleString('zh-CN')),
|
||||
// h(NIcon, {
|
||||
// size: '16',
|
||||
// color: row.trend === 'up' ? '#18a058' : '#d03050',
|
||||
// style: { 'margin-left': '8px' }
|
||||
// }, { default: () => '元' })
|
||||
// ])
|
||||
// }
|
||||
},
|
||||
{
|
||||
title: '占比',
|
||||
@ -187,7 +181,8 @@ const summaryColumns = [
|
||||
type: 'line',
|
||||
percentage: row.percentage,
|
||||
'indicator-placement': 'inside',
|
||||
color: row.trend === 'up' ? '#18a058' : '#d03050'
|
||||
// color: row.trend === 'up' ? '#18a058' : '#d03050'
|
||||
color: '#18a058'
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -220,7 +215,7 @@ const activityColumns = [
|
||||
]
|
||||
|
||||
// 转换为相对时间
|
||||
function getRelativeTime(timeString) {
|
||||
function getRelativeTime(timeString:string) {
|
||||
const inputTime = new Date(timeString);
|
||||
|
||||
if (isNaN(inputTime.getTime())) {
|
||||
@ -228,7 +223,7 @@ function getRelativeTime(timeString) {
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const diffInSeconds = Math.floor((now - inputTime) / 1000);
|
||||
const diffInSeconds = Math.floor((now.getTime() - inputTime.getTime()) / 1000);
|
||||
|
||||
if (diffInSeconds < 0) {
|
||||
return "未来时间";
|
||||
@ -267,56 +262,80 @@ function getRelativeTime(timeString) {
|
||||
|
||||
// 测试登录用户信息
|
||||
onMounted(() => {
|
||||
console.log(JSON.stringify(userInfo));
|
||||
// console.log(JSON.stringify(userInfo));
|
||||
//console.log("是否营销:" + userInfo.user.userCategory);
|
||||
//console.log("营销编号:" + userInfo.user.mktNo);
|
||||
//console.log("营销编号:" + userInfo.dept.deptCategory);
|
||||
|
||||
//根据用户部门判断是否管理用户
|
||||
//!!用户部门不可能为空的,测试时乱修改会造成为空情况,暂时这么写
|
||||
if(userInfo.dept == null){
|
||||
isAdmin = true;
|
||||
}else{
|
||||
isAdmin =
|
||||
(
|
||||
userInfo.dept.deptCategory === '251009999'
|
||||
|| userInfo.dept.deptCategory === '251000099'
|
||||
|| userInfo.dept.deptId === '100'
|
||||
);
|
||||
}
|
||||
// if(userInfo.dept == null){
|
||||
// isAdmin. value = true;
|
||||
// }else{
|
||||
// isAdmin.value =
|
||||
// (
|
||||
// userInfo.dept.deptCategory === '251009999'
|
||||
// || userInfo.dept.deptCategory === '251000099'
|
||||
// || userInfo.dept.deptId === '100'
|
||||
// );
|
||||
// }
|
||||
|
||||
// 当用户是管理用户时,登陆后即异步查询所有用户信息,暂时mock数据
|
||||
if(isAdmin.value){
|
||||
adminData.value.pricingSummary = [
|
||||
{ category: '智E通业务', amount: 245600.00, percentage: 42, trend: 'up', growth: 8.2 },
|
||||
{ category: '综合收单业务', amount: 187430.50, percentage: 32, trend: 'up', growth: 12.5 },
|
||||
{ category: '代收业务', amount: 151209.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
{ category: '社保卡业务', amount: 151209.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
{ category: '其他', amount: 151209.06, percentage: 26, trend: 'down', growth: -3.4 }
|
||||
];
|
||||
adminData.value.recentActivities = [
|
||||
{ user: '王凯', action: '录入营销数据', time: '5分钟前', type: 'update' },
|
||||
{ user: '李延玲', action: '录入营销数据', time: '30分钟前', type: 'import' },
|
||||
{ user: '柏学慧', action: '新增业务类型', time: '2小时前', type: 'submit' },
|
||||
{ user: '吴新宇', action: '修改分成比例', time: '昨天', type: 'review' },
|
||||
{ user: '赵清惠', action: '录入营销数据', time: '7天前', type: 'review' }
|
||||
]
|
||||
}else{// 当用户是营销用户时,登录后即异步查询自己的信息,暂时mock数据
|
||||
adminData.value.pricingSummary = [
|
||||
{ category: '智E通业务', amount: 24560.00, percentage: 42, trend: 'up', growth: 8.2 },
|
||||
{ category: '综合收单业务', amount: 18743.50, percentage: 32, trend: 'up', growth: 12.5 },
|
||||
{ category: '代收业务', amount: 15120.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
{ category: '社保卡业务', amount: 15129.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
{ category: '其他', amount: 15129.06, percentage: 26, trend: 'down', growth: -3.4 }
|
||||
];
|
||||
adminData.value.recentActivities = [
|
||||
{ user: userInfo.user.nickName, action: '录入营销数据', time: getRelativeTime('2025-09-04 15:07:12'), type: 'update' },
|
||||
{ user: userInfo.user.nickName, action: '录入营销数据', time: '30分钟前', type: 'import' },
|
||||
{ user: userInfo.user.nickName, action: '新增业务类型', time: '2小时前', type: 'submit' },
|
||||
{ user: userInfo.user.nickName, action: '修改分成比例', time: '昨天', type: 'review' },
|
||||
{ user: userInfo.user.nickName, action: '录入营销数据', time: '7天前', type: 'review' }
|
||||
]
|
||||
}
|
||||
// if(isAdmin.value){
|
||||
// adminData.value.pricingSummary = [
|
||||
// { category: '智E通业务', amount: 245600.00, percentage: 42, trend: 'up', growth: 8.2 },
|
||||
// { category: '综合收单业务', amount: 187430.50, percentage: 32, trend: 'up', growth: 12.5 },
|
||||
// { category: '代收业务', amount: 151209.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
// { category: '社保卡业务', amount: 151209.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
// { category: '其他', amount: 151209.06, percentage: 26, trend: 'down', growth: -3.4 }
|
||||
// ];
|
||||
// adminData.value.recentActivities = [
|
||||
// { user: '王凯', action: '录入营销数据', time: '5分钟前', type: 'update' },
|
||||
// { user: '李延玲', action: '录入营销数据', time: '30分钟前', type: 'import' },
|
||||
// { user: '柏学慧', action: '新增业务类型', time: '2小时前', type: 'submit' },
|
||||
// { user: '吴新宇', action: '修改分成比例', time: '昨天', type: 'review' },
|
||||
// { user: '赵清惠', action: '录入营销数据', time: '7天前', type: 'review' }
|
||||
// ]
|
||||
// }else{// 当用户是营销用户时,登录后即异步查询自己的信息,暂时mock数据
|
||||
// adminData.value.pricingSummary = [
|
||||
// { category: '智E通业务', amount: 24560.00, percentage: 42, trend: 'up', growth: 8.2 },
|
||||
// { category: '综合收单业务', amount: 18743.50, percentage: 32, trend: 'up', growth: 12.5 },
|
||||
// { category: '代收业务', amount: 15120.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
// { category: '社保卡业务', amount: 15129.06, percentage: 26, trend: 'down', growth: -3.4 },
|
||||
// { category: '其他', amount: 15129.06, percentage: 26, trend: 'down', growth: -3.4 }
|
||||
// ];
|
||||
// adminData.value.recentActivities = [
|
||||
// { user: userInfo.user.nickName, action: '录入营销数据', time: getRelativeTime('2025-09-04 15:07:12'), type: 'update' },
|
||||
// { user: userInfo.user.nickName, action: '录入营销数据', time: '30分钟前', type: 'import' },
|
||||
// { user: userInfo.user.nickName, action: '新增业务类型', time: '2小时前', type: 'submit' },
|
||||
// { user: userInfo.user.nickName, action: '修改分成比例', time: '昨天', type: 'review' },
|
||||
// { user: userInfo.user.nickName, action: '录入营销数据', time: '7天前', type: 'review' }
|
||||
// ]
|
||||
// }
|
||||
|
||||
//获取最近10条活动记录
|
||||
getRecentActivity().then(res => {
|
||||
adminData.value.recentActivities = res.data ?? [];
|
||||
for (let i of adminData.value.recentActivities) {
|
||||
//转换为相对时间
|
||||
i.time = getRelativeTime(i.time)
|
||||
}
|
||||
})
|
||||
getPricingSummary().then(res => {
|
||||
let tmp = []
|
||||
for (let key in pricingSummaryName) {
|
||||
if (res.data[key]) {
|
||||
tmp.push({
|
||||
category: pricingSummaryName[key],
|
||||
amount: res.data[key],
|
||||
percentage: (res.data[key] / res.data.total * 100).toFixed(2), //百分比 保留2位小数
|
||||
})
|
||||
}
|
||||
}
|
||||
//按照amount降序排序
|
||||
tmp.sort((a, b) => b.amount - a.amount)
|
||||
adminData.value.pricingSummary = tmp;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -325,9 +344,10 @@ onMounted(() => {
|
||||
<!-- 欢迎banner -->
|
||||
<HeaderBanner />
|
||||
|
||||
<!-- 营销数据概览 -->
|
||||
<!-- 数据卡 - 营销人员和其他人员看到的图表不同 -->
|
||||
<CardDataMkt
|
||||
v-if="userInfo.user.userCategory === '0'"
|
||||
v-if="userInfo?.user?.userCategory === '0'"
|
||||
:date-range="dateRange"
|
||||
@date-change="handleDateChange"
|
||||
@quick-change="setDateRange"
|
||||
|
||||
@ -161,40 +161,40 @@ function getGradientColor(color: MktCardData['color']) {
|
||||
</div>
|
||||
<div class="date-controls">
|
||||
<!-- 快速日期选项 -->
|
||||
<div class="quick-date-buttons">
|
||||
<NButton
|
||||
size="small"
|
||||
:type="dateRange[0] === dayjs().startOf('day').valueOf() ? 'primary' : 'default'"
|
||||
@click="handleQuickChange('today')"
|
||||
>
|
||||
本日
|
||||
</NButton>
|
||||
<NButton
|
||||
size="small"
|
||||
:type="dateRange[0] === dayjs().startOf('week').valueOf() ? 'primary' : 'default'"
|
||||
@click="handleQuickChange('week')"
|
||||
>
|
||||
本周
|
||||
</NButton>
|
||||
<NButton
|
||||
size="small"
|
||||
:type="dateRange[0] === dayjs().startOf('month').valueOf() ? 'primary' : 'default'"
|
||||
@click="handleQuickChange('month')"
|
||||
>
|
||||
本月
|
||||
</NButton>
|
||||
</div>
|
||||
<!-- <div class="quick-date-buttons">-->
|
||||
<!-- <NButton-->
|
||||
<!-- size="small"-->
|
||||
<!-- :type="dateRange[0] === dayjs().startOf('day').valueOf() ? 'primary' : 'default'"-->
|
||||
<!-- @click="handleQuickChange('today')"-->
|
||||
<!-- >-->
|
||||
<!-- 本日-->
|
||||
<!-- </NButton>-->
|
||||
<!-- <NButton-->
|
||||
<!-- size="small"-->
|
||||
<!-- :type="dateRange[0] === dayjs().startOf('week').valueOf() ? 'primary' : 'default'"-->
|
||||
<!-- @click="handleQuickChange('week')"-->
|
||||
<!-- >-->
|
||||
<!-- 本周-->
|
||||
<!-- </NButton>-->
|
||||
<!-- <NButton-->
|
||||
<!-- size="small"-->
|
||||
<!-- :type="dateRange[0] === dayjs().startOf('month').valueOf() ? 'primary' : 'default'"-->
|
||||
<!-- @click="handleQuickChange('month')"-->
|
||||
<!-- >-->
|
||||
<!-- 本月-->
|
||||
<!-- </NButton>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- 日期选择器 -->
|
||||
<div class="date-picker-group">
|
||||
<NDatePicker
|
||||
:value="dateRange"
|
||||
type="daterange"
|
||||
clearable
|
||||
@update:value="handleDatePickerChange"
|
||||
class="date-picker"
|
||||
/>
|
||||
</div>
|
||||
<!-- <div class="date-picker-group">-->
|
||||
<!-- <NDatePicker-->
|
||||
<!-- :value="dateRange"-->
|
||||
<!-- type="daterange"-->
|
||||
<!-- clearable-->
|
||||
<!-- @update:value="handleDatePickerChange"-->
|
||||
<!-- class="date-picker"-->
|
||||
<!-- />-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import org.dromara.mps.domain.MpsMarket;
|
||||
import org.dromara.mps.domain.vo.MpsMarketVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||
@ -29,6 +28,10 @@ public interface MpsMarketMapper extends BaseMapperPlus<MpsMarket, MpsMarketVo>
|
||||
/**
|
||||
* 按照客户身份证号去重后查询数量
|
||||
*/
|
||||
@DataPermission({
|
||||
@DataColumn(key = "deptName", value = "create_dept"),
|
||||
@DataColumn(key = "userName", value = "create_by")
|
||||
})
|
||||
Integer selectCountByCustId( @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||
import org.dromara.statistics.domain.vo.HomePageMarketingPerformanceSummary;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -46,4 +47,20 @@ public interface MarketingPerformanceMapper extends BaseMapperPlus<MarketingPerf
|
||||
})
|
||||
List<MarketingPerformanceExportVo> selectExportList(@Param(Constants.WRAPPER) Wrapper<MarketingPerformance> queryWrapper);
|
||||
|
||||
/**
|
||||
* homePageMarketingPerformanceSummary
|
||||
*/
|
||||
@DataPermission({
|
||||
@DataColumn(key = "deptName", value = "create_dept"),
|
||||
@DataColumn(key = "userName", value = "create_by")
|
||||
})
|
||||
HomePageMarketingPerformanceSummary homePageMarketingPerformanceSummary();
|
||||
|
||||
@DataPermission({
|
||||
@DataColumn(key = "deptName", value = "create_dept"),
|
||||
@DataColumn(key = "userName", value = "create_by")
|
||||
})
|
||||
default MarketingPerformance homePageSelectOne(Wrapper<MarketingPerformance> queryWrapper){
|
||||
return this.selectOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,11 @@ import org.dromara.business.mapper.BusinessSubcategoryMapper;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.mps.domain.MpsMarket;
|
||||
import org.dromara.mps.mapper.MpsMarketMapper;
|
||||
import org.dromara.report.domain.MarketingPerformance;
|
||||
import org.dromara.report.mapper.MarketingPerformanceMapper;
|
||||
import org.dromara.statistics.domain.vo.*;
|
||||
import org.dromara.system.domain.vo.SysOperLogVo;
|
||||
import org.dromara.system.mapper.SysOperLogMapper;
|
||||
import org.dromara.system.mapper.SysUserMapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -19,6 +23,7 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 统计分析控制器
|
||||
@ -36,6 +41,8 @@ public class StatisticsController {
|
||||
private final SysUserMapper sysUserMapper;
|
||||
private final MpsMarketMapper mpsMarketMapper;
|
||||
private final BusinessSubcategoryMapper businessSubcategoryMapper;
|
||||
private final SysOperLogMapper sysOperLogMapper;
|
||||
private final MarketingPerformanceMapper marketingPerformanceMapper;
|
||||
|
||||
// 日期格式化器
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("MM/dd");
|
||||
@ -44,12 +51,20 @@ public class StatisticsController {
|
||||
// 营销人员卡片数据
|
||||
@GetMapping("/getMktCardData")
|
||||
public R<MktCardVo> getMktCardData(String startDate, String endDate) {
|
||||
System.out.println(startDate + " " + endDate);
|
||||
MktCardVo mktCardVo = new MktCardVo();
|
||||
mktCardVo.setMpsCount(1765); // 总计件量
|
||||
mktCardVo.setMpsAmt(new BigDecimal(1026.12)); // 总计价额
|
||||
mktCardVo.setBusiCount(16); // 产品种类
|
||||
mktCardVo.setCustomerCount(66); // 客户数量
|
||||
|
||||
LambdaQueryWrapper<MarketingPerformance> mp = new LambdaQueryWrapper<>();
|
||||
mp.select(MarketingPerformance::getRecordDate, MarketingPerformance::getTotalCount, MarketingPerformance::getTotalAmount);
|
||||
//查询出日期最近的一条
|
||||
mp.orderByDesc(MarketingPerformance::getRecordDate);
|
||||
mp.last("limit 1");
|
||||
MarketingPerformance marketingPerformance = marketingPerformanceMapper.homePageSelectOne(mp);
|
||||
mktCardVo.setMpsCount(Math.toIntExact(marketingPerformance == null ? 0L : marketingPerformance.getTotalCount())); // 总计件量
|
||||
mktCardVo.setMpsAmt(marketingPerformance == null ? BigDecimal.ZERO : marketingPerformance.getTotalAmount()); // 总计价额
|
||||
Long busiCount = businessSubcategoryMapper.selectCount(new LambdaQueryWrapper<>());
|
||||
mktCardVo.setBusiCount(Math.toIntExact(busiCount)); // 产品种类
|
||||
Integer customerCount = mpsMarketMapper.selectCountByCustId(startDate, endDate);
|
||||
mktCardVo.setCustomerCount(Math.toIntExact(customerCount)); // 客户数量
|
||||
return R.ok(mktCardVo);
|
||||
}
|
||||
|
||||
@ -142,12 +157,11 @@ public class StatisticsController {
|
||||
// 汇总卡片数据接口
|
||||
@GetMapping("/getSummaryCardData")
|
||||
public R<Map<String, Integer>> getSummaryCardData(String startDate, String endDate) {
|
||||
System.out.println("获取汇总卡片数据: " + startDate + " 至 " + endDate);
|
||||
|
||||
// 计算日期范围天数
|
||||
LocalDate start = LocalDate.parse(startDate);
|
||||
LocalDate end = LocalDate.parse(endDate);
|
||||
long days = ChronoUnit.DAYS.between(start, end) + 1;
|
||||
// LocalDate start = LocalDate.parse(startDate);
|
||||
// LocalDate end = LocalDate.parse(endDate);
|
||||
// long days = ChronoUnit.DAYS.between(start, end) + 1;
|
||||
|
||||
Map<String, Integer> data = new HashMap<>();
|
||||
|
||||
@ -258,4 +272,42 @@ public class StatisticsController {
|
||||
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
//最近活动
|
||||
@GetMapping("/getRecentActivity")
|
||||
public R<List<RecentActivityVo>> getRecentActivity() {
|
||||
|
||||
List<SysOperLogVo> sysOperLogVos = sysOperLogMapper.selectRecentOperLog();
|
||||
List<RecentActivityVo> recentActivityVos = sysOperLogVos.stream().map(sysOperLogVo -> {
|
||||
RecentActivityVo recentActivityVo = new RecentActivityVo();
|
||||
recentActivityVo.setUser(sysOperLogVo.getOperName());
|
||||
recentActivityVo.setAction(sysOperLogVo.getTitle()+" "+convertHttpMethodToChinese(sysOperLogVo.getRequestMethod()));
|
||||
recentActivityVo.setTime(sysOperLogVo.getOperTime());
|
||||
return recentActivityVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return R.ok(recentActivityVos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将http请求方法转换成中文
|
||||
*/
|
||||
private String convertHttpMethodToChinese(String httpMethod) {
|
||||
return switch (httpMethod) {
|
||||
case "GET" -> "查询";
|
||||
case "POST" -> "添加";
|
||||
case "PUT" -> "修改";
|
||||
case "DELETE" -> "删除";
|
||||
default -> httpMethod;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 计价汇总
|
||||
*/
|
||||
@GetMapping("/getPricingSummary")
|
||||
public R<HomePageMarketingPerformanceSummary> getPricingSummary() {
|
||||
HomePageMarketingPerformanceSummary summary = marketingPerformanceMapper.homePageMarketingPerformanceSummary();
|
||||
return R.ok(summary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package org.dromara.statistics.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 首页营销计价统计
|
||||
*/
|
||||
@Data
|
||||
public class HomePageMarketingPerformanceSummary {
|
||||
/**
|
||||
* 代收业务
|
||||
*/
|
||||
String daishou;
|
||||
/**
|
||||
* 其他
|
||||
*/
|
||||
String qita;
|
||||
/**
|
||||
* 外汇业务
|
||||
*/
|
||||
String waihui;
|
||||
/**
|
||||
* 季节性计价
|
||||
*/
|
||||
String jijie;
|
||||
/**
|
||||
* 慧农通业务
|
||||
*/
|
||||
String hnt;
|
||||
/**
|
||||
* 智e通业务
|
||||
*/
|
||||
String zyt;
|
||||
/**
|
||||
* 理财业务
|
||||
*/
|
||||
String licai;
|
||||
/**
|
||||
* 社保卡业务
|
||||
*/
|
||||
String shebaoka;
|
||||
/**
|
||||
* 综合收单业务
|
||||
*/
|
||||
String zhsd;
|
||||
/**
|
||||
* 缴费业务
|
||||
*/
|
||||
String jiaofei;
|
||||
/**
|
||||
* total
|
||||
*/
|
||||
String total;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package org.dromara.statistics.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 主页,最近活动
|
||||
*/
|
||||
@Data
|
||||
public class RecentActivityVo {
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
private String user;
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
private String action;
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private Date time;
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysOperLog;
|
||||
import org.dromara.system.domain.vo.SysOperLogVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 数据层
|
||||
*
|
||||
@ -11,4 +15,12 @@ import org.dromara.system.domain.vo.SysOperLogVo;
|
||||
*/
|
||||
public interface SysOperLogMapper extends BaseMapperPlus<SysOperLog, SysOperLogVo> {
|
||||
|
||||
/**
|
||||
* 查询最近10条操作记录
|
||||
*/
|
||||
@DataPermission({
|
||||
@DataColumn(key = "deptName", value = "user.dept_id"),
|
||||
@DataColumn(key = "userName", value = "user.user_id")
|
||||
})
|
||||
List<SysOperLogVo> selectRecentOperLog();
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
<!-- 按照客户身份证号去重后查询数量-->
|
||||
<select id="selectCountByCustId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT cust_id) FROM mps_market
|
||||
WHERE del_flag = 0
|
||||
WHERE 1 = 1
|
||||
<if test="startDate != null and startDate != ''">
|
||||
AND entry_date >= #{startDate}
|
||||
</if>
|
||||
|
||||
@ -205,4 +205,22 @@
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 主页计价汇总-->
|
||||
<select id="homePageMarketingPerformanceSummary" resultType="org.dromara.statistics.domain.vo.HomePageMarketingPerformanceSummary">
|
||||
select sum(traffic_fine_collection_amount + electricity_fee_collection_amount + water_fee_collection_amount) as daishou,
|
||||
sum(online_payment_amount + magnetic_to_ic_card_amount + new_bank_card_amount + zhi_e_pay_amount + housing_fund_customer_amount + new_housing_fund_customer_amount) as qita,
|
||||
sum(new_foreign_account_amount) as waihui,
|
||||
sum(heat_fee_collection_amount) as jijie,
|
||||
sum(huinong_farmer_amount + huinong_buyer_amount) as hnt,
|
||||
sum(zhi_e_individual_amount + zhi_e_inactive_amount + zhi_e_enterprise_amount + corporate_mobile_bank_amount) as zyt,
|
||||
sum(new_personal_wealth_amount + new_corporate_wealth_amount + wealth_sales_amount + fixed_term_wealth_amount) as licai,
|
||||
sum(new_social_card_amount + loan_customer_social_card_amount + employee_social_card_amount + activated_social_card_amount + e_social_card_amount + medical_e_voucher_amount) as shebaoka,
|
||||
sum(new_merchant_first_month_amount + new_merchant_retention_quarter_amount + existing_merchant_retention_amount) as zhsd,
|
||||
sum(new_party_fee_unit_amount + new_union_fee_unit_amount + new_property_fee_unit_amount + new_meal_fee_unit_amount) as jiaofei,
|
||||
sum(total_amount) as total
|
||||
from marketing_performance
|
||||
where record_date = (select max(record_date) from marketing_performance)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -3,5 +3,17 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.system.mapper.SysOperLogMapper">
|
||||
|
||||
<!--查询最近10条操作记录-->
|
||||
<select id="selectRecentOperLog" resultType="org.dromara.system.domain.vo.SysOperLogVo">
|
||||
SELECT title,
|
||||
request_method,
|
||||
user.nick_name as oper_name,
|
||||
oper_time,
|
||||
user_id
|
||||
FROM sys_oper_log as log
|
||||
left join sys_user as user on log.oper_name = user.user_name
|
||||
where log.status = 0
|
||||
ORDER BY log.oper_time DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user