Compare commits

..

6 Commits

Author SHA1 Message Date
wangqx
910da9cdff [fix]修改配置文件 2025-09-15 17:29:57 +08:00
wangqx
b1a2811885 Merge branch 'refs/heads/wzj-wqngqx' into wzj-main 2025-09-15 15:33:25 +08:00
wangqx
4ec050cbba [fix]增加统计 2025-09-15 11:14:40 +08:00
6586373a89 [fix]统计数据 2025-09-14 22:09:09 +08:00
wangqx
794751beef [fix]增加统计 2025-09-13 17:29:14 +08:00
wangqx
3fad44f28b [fix]增加统计 2025-09-13 17:27:49 +08:00
100 changed files with 4807 additions and 248 deletions

View File

@ -65,10 +65,10 @@
<profiles>
<profile>
<id>local</id>
<id>test</id>
<properties>
<!-- 环境标识,需要与配置文件的名称相对应 -->
<profiles.active>local</profiles.active>
<profiles.active>test</profiles.active>
<logging.level>debug</logging.level>
<monitor.username>ruoyi</monitor.username>
<monitor.password>123456</monitor.password>

View File

@ -143,7 +143,7 @@ public class AppMemberController {
//检查推广人
Long memberId = loginUser.getUserId();
//检查推广人是否绑定
Member member = service.getById(memberId);
Member member = service.getById(loginBody);
if (member.getSpreadUid() != null) {
throw new ServiceException("用户已绑定推广人");
}

View File

@ -102,13 +102,7 @@ public class AppVlogController {
*/
@PostMapping("publish")
public R<Void> publish(@RequestBody VlogBO vlogBO) throws Exception {
vlogService.createVlog(vlogBO);
return R.ok();
}
@ -154,6 +148,27 @@ public class AppVlogController {
vlogService.readVlog(loginUser.getUserId(), vlogBO.getId());
return R.ok();
}
@DeleteMapping("/delete/{id}")
public R<Void> delete(@PathVariable String id) {
LoginUser loginUser = LoginHelper.getLoginUser();
if (loginUser == null) {
throw new ServiceException("用户未登录");
}
vlogService.removeById(id);
return R.ok();
}
@PostMapping("/page")
public R<Page<IndexVlogVO>> page(@RequestBody VlogBO vlogBO) {
LoginUser loginUser = LoginHelper.getLoginUser();
if (loginUser == null) {
throw new ServiceException("用户未登录");
}
if(vlogBO.getMemberId()==null){
throw new ServiceException("用户id不能为空");
}
return R.ok(vlogService.getIndexVlogList(vlogBO,vlogBO.getPage()));
}
@Tag(name = "手动触发缓存点赞最多视频")
@PostMapping("/cacheTopLikedVlogs")

View File

@ -49,7 +49,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://192.168.1.65:13306/loopin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://82.156.121.2:13306/loopin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: wzj
password: A085F27A43B0
# # 从库数据源
@ -140,7 +140,7 @@ rocketmq:
# 生产者配置
producer:
# 生产者组名
group: wzj_group
group: wzj_dev
# 发送消息超时时间
send-message-timeout: 30000
# 消息最大长度
@ -154,7 +154,7 @@ rocketmq:
# 拉取消息最大数量
pull-batch-size: 10
# 消费者组 (系统模块)
group: consumer_group_system
group: wzj_dev
# 是否启动消费者
enabled: true
--- # mail 邮件发送

View File

@ -1,11 +1,8 @@
--- # 临时文件存储位置 避免临时文件被系统清理报错
spring.servlet.multipart.location: /ruoyi/server/temp
--- # 监控中心配置
spring.boot.admin.client:
# 增加客户端开关
enabled: true
url: http://localhost:9090/admin
enabled: false
url: http://43.143.227.203:9090/admin
instance:
service-host-type: IP
metadata:
@ -16,13 +13,13 @@ spring.boot.admin.client:
--- # snail-job 配置
snail-job:
enabled: true
enabled: false
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
group: "ruoyi_group"
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
server:
host: 127.0.0.1
host: 43.143.227.203
port: 17888
# 命名空间UUID 详见 script/sql/ry_job.sql `sj_namespace`表`unique_id`字段
namespace: ${spring.profiles.active}
@ -40,7 +37,7 @@ spring:
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
dynamic:
# 性能分析插件(有性能损耗 不建议生产环境使用)
p6spy: false
p6spy: true
# 设置默认的数据源或者数据源组,默认值即为 master
primary: master
# 严格模式 匹配不到数据源则报错
@ -52,35 +49,35 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://82.156.121.2:23306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://43.143.227.203:13306/soopin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: wzj
password: A085F27A43B0
# # 从库数据源
# slave:
# lazy: true
# type: ${spring.datasource.type}
# driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username:
# password:
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: root
# sqlserver:
# type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA
# password: root
# # 从库数据源
# slave:
# lazy: true
# type: ${spring.datasource.type}
# driverClassName: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username:
# password:
# oracle:
# type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# postgres:
# type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root
# password: root
# sqlserver:
# type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA
# password: root
hikari:
# 最大连接池数量
maxPoolSize: 20
@ -95,19 +92,19 @@ spring:
# 此属性控制池中连接的最长生命周期值0表示无限生命周期默认30分钟
maxLifetime: 1800000
# 多久检查一次连接的活性
keepaliveTime: 30000
keepaliveTime: 300000
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring.data:
redis:
# 地址
host: localhost
host: 43.143.227.203
# 端口默认为6379
port: 26379
port: 16379
# 数据库索引
database: 0
# redis 密码必须配置
password: ruoyi123
database: 2
# 密码(如没有密码请注释掉)
password: e4ea0caebfd2
# 连接超时时间
timeout: 10s
# 是否开启ssl
@ -118,17 +115,17 @@ redisson:
# redis key前缀
keyPrefix:
# 线程池数量
threads: 16
threads: 4
# Netty线程池数量
nettyThreads: 32
nettyThreads: 8
# 单节点配置
singleServerConfig:
# 客户端名称 不能用中文
clientName: RuoYi-Vue-Plus
# 最小空闲连接数
connectionMinimumIdleSize: 32
connectionMinimumIdleSize: 8
# 连接池大小
connectionPoolSize: 64
connectionPoolSize: 32
# 连接空闲超时,单位:毫秒
idleConnectionTimeout: 10000
# 命令等待超时,单位:毫秒
@ -136,6 +133,30 @@ redisson:
# 发布和订阅连接池大小
subscriptionConnectionPoolSize: 50
--- # RocketMQ 配置
rocketmq:
# RocketMQ 服务器地址
name-server: 43.143.227.203:9876
# 生产者配置
producer:
# 生产者组名
group: wzj_test
# 发送消息超时时间
send-message-timeout: 30000
# 消息最大长度
max-message-size: 4194304
# 消息发送失败重试次数
retry-times-when-send-failed: 3
# 异步消息发送失败重试次数
retry-times-when-send-async-failed: 3
# 消费者配置
consumer:
# 拉取消息最大数量
pull-batch-size: 10
# 消费者组 (系统模块)
group: wzj_test
# 是否启动消费者
enabled: true
--- # mail 邮件发送
mail:
enabled: false
@ -185,91 +206,60 @@ sms:
config2:
# 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
supplier: tencent
access-key-id: 您的accessKey
access-key-secret: 您的accessKeySecret
signature: 您的短信签名
sdk-app-id: 您的sdkAppId
access-key-id: AKIDvhEVWHm0xe5JGxOZXGitnRovlKcfRzIN
access-key-secret: qPhiTxA7oENFrCH5dvxiCQN4UdWAYgYA
signature: 无终街天津科技
sdk-app-id: 1400966042
--- # 三方授权
justauth:
# 前端外网访问地址
address: http://localhost:80
address: http://82.156.121.2:8880/
type:
maxkey:
# maxkey 服务器地址
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据
server-url: http://sso.maxkey.top
client-id: 876892492581044224
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8
redirect-uri: ${justauth.address}/social-callback?source=maxkey
topiam:
# topiam 服务器地址
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol
client-id: 449c4*********937************759
client-secret: ac7***********1e0************28d
redirect-uri: ${justauth.address}/social-callback?source=topiam
scopes: [ openid, email, phone, profile ]
qq:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=qq
union-id: false
weibo:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=weibo
gitee:
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac
redirect-uri: ${justauth.address}/social-callback?source=gitee
dingtalk:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=dingtalk
baidu:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=baidu
csdn:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=csdn
coding:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=coding
coding-group-name: xx
oschina:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=oschina
alipay_wallet:
alipay_wallet: # 支付宝钱包
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet
alipay-public-key: MIIB**************DAQAB
wechat_open:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
wechat_open: # 微信开放平台
client-id: wxebcdaea31881caab
client-secret: 71826d76bad096ec5407897c6ed1391f
redirect-uri: ${justauth.address}/social-callback?source=wechat_open
wechat_mp:
wechat_mp: # 微信小程序
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
wechat_enterprise:
wechat_enterprise: # 微信企业
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
agent-id: 1000002
gitlab:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=gitlab
# 腾讯云配置
# 腾讯云IM配置
tencent:
cloud:
secret-id: "AKIDvhEVWHm0xe5JGxOZXGitnRovlKcfRzIN"
secret-key: "qPhiTxA7oENFrCH5dvxiCQN4UdWAYgYA"
region: ap-guangzhou # 默认广州地区
vod:
app-id: 1323742234 # 点播应用ID
im:
enabled: true # 启用腾讯云IM
sdk-app-id: 1600080789 # 你的腾讯云 SDKAppID
secret-key: "311b5309d714a20f7f5b54360ee21b1e24ec208ebcd25ce8f47d24753bccc091" # 你的密钥
administrator: "administrator" # 管理员账号
expire-time: 604800 # UserSig 过期时间7天单位
# mongodb
data:
mongodb:
uri: 82.156.121.2:37017
database: wzj-shop
username: admin
password: A1969bf8
authentication-database: admin
# replica-set-name: mongoreplset
easypay:
api-path-prefix: https://d-phoenix-gap.easypay.com.cn:24443/yqt
req-id: D01X66666667068
mcht-code: 631000000003325
wechat-mchid: 804474446
easypay-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArgVerkGaSEQvZIOpLjeUoVpL0lSYLc04+txtPFtfm5r5XFbaNaf5Ahu0lziGEwWzrGONThSsnb3U9pqoY6BpqviN4h+Guw5oEdHr1T/eDkQD5urgQUaZA6lDoU9XC662r+0kpbKidvXIsK2CrShN+BF8HEJmRZuhglxh25OHWIWqQiUDjLZC+QJRZqUu9Uzy9RBBu7qa0f0xbqYl3hnYi+vH++SsyOavO2gUVQyKU5Kkt5ZJVpZFQvD3BXePgwJSpsvrjhj0hiYp2v6PScN9XHP1vXB4wtIYSFYwmVus1KkV/LfDzUm6zHjliHYTVl6lPMhveIVJlRIqInRZRHxg5QIDAQAB
merRsaPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCc1mku1mtfTc1vZM9z3TkRMZ9SaKP+6MdoQhjDHB9vJUOuG2Jnegej4gtzcm8MVYomV1azJMtCbPq4PN9aHegH13JthvrUPR3nAKp8AUp9Fh47ded//snNyAf7C7o8xKN5e7n89ROwacCAL2QDno76ngXzQQVj1TxY9pBdekZ03ezuDk1sv/u4FBlW8kRyaVdqyl4FdvP+EEljDe8gGxRikLyb3cK1B6G7w2BXgM/svft5SOoiqStx2XvgHRrFRB5w96TdoKNH9yxHU2clMJiz+5cej1VL6OHZspuY3cnPyJtyS+weYjDT+COLLBUe9UwbOV15DXDNpBLd34W4GiqtAgMBAAECggEAYaVwmVOwSAblp7wJGScb16OggStbJ2MAe93jEt7Yh1eZGrY7/xbP2O3smTUfBHvhZlusRB7dWf8F3l0v5iiGhRNTT/PhCPEARAl7G3emS9jQe869kkgslq06ose7bQg0i3dH5cEkQAqnameXClXWyRxHshrCY1SonO7uFPUDFtD2Z9GHu6dOWkOHfX7UETHV5/NTSqvner5M2YNsV/5To87zrmaeeNyvu91JgJSYofTD8IcMyhxcswxB9F3ECP7nulLDdCV+9mvE9zO0i4mPBxYb++87J0pu35TN9OY+gpiCK3Ed0gDqvvkTiCQEFu6y7OiqsQwy03CE5hAwWZR2YQKBgQDdb6e7+FWJSr9fIknfvZPPtKmbEkMHP1RYnVo3pmuVm14Z3UmostiSBRPMfVjeOX0N82SONM9P+1v9SDgSK3pL8rlk9Hx6D5KI7uj2IMtTVt00pO31KtxDLmXfgapDbWHK1RGEn1PDrnKYy5yOKJ8n0Wgp4lVEPIBN6uIud0A9iQKBgQC1UXdhEXFETyqEYWb9OnWbBjiVIw3D2/qW5c+WQGsHYdMEImC/0oTWIH9fKd4Azf26JjZ9nQvs5VcijJP6BXbGPqir5NgGVkwCj33PoNg4dDgIVE4BYaSp//7B6jCi5QiRTzCSOmUSkZ5L1Kz4SNEDe9r0MpLhxrsAzmR9aEJ/BQKBgHI71Ks63F2cSwd39+ZNtYA0cj7Gd/+4IvooCs+kseGXKj9rkkFOKj2CEwmuLHdP7vyQcHKQOdbIFFegtxRgi5G8oPm8yq5pdC3iGhpHJr1SlYFACGYu+zxJJlLcYIqyVf2+V3A0hZDwYLwEZjpMKHbxJ6xbz6MJFyObJZ3U9TYJAoGANXoGjJF5Z501u/+CQZN5VjSagZnqGGcL3G+BLx5msrGua9y7zjeHyCOjjWyqtnAKsllM3vVvq/nkHiN6DVaJNmUKmFARSqUvG944TAFzZAsa75H1w8CJsT34ZDbvC0wjn7/MYoRohPZ/ynu6XCwVwUJJTJaR7ZcQVmeJCdezLQUCgYEAszix6V9oL80Clb1nMwIly6I78+pcFKyk82yXxvySb6XPJvgoasbz9xYIeKlPyy6r8Aj/ujz5GVtDtkE6n6bsjekCdnUKUY3uTvFAX+YGQkuZnaPoisELJFI2Hal22tNnJyCOYh//AGAiHYpHNUKD4hsKBb45MhK1xwvTHpuLkdc=
trade-backUrl: http://82.156.121.2:8880/trans/easypay/trade/callback

View File

@ -1,8 +1,8 @@
--- # 监控中心配置
spring.boot.admin.client:
# 增加客户端开关
enabled: true
url: http://localhost:9090/admin
enabled: false
url: http://192.168.1.65:9090/admin
instance:
service-host-type: IP
metadata:
@ -13,13 +13,13 @@ spring.boot.admin.client:
--- # snail-job 配置
snail-job:
enabled: true
enabled: false
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
group: "ruoyi_group"
# SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config` 表
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
server:
host: 127.0.0.1
host: 192.168.1.65
port: 17888
# 命名空间UUID 详见 script/sql/ry_job.sql `sj_namespace`表`unique_id`字段
namespace: ${spring.profiles.active}
@ -49,7 +49,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://82.156.121.2:23306/wzj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://82.156.121.2:13306/soopin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: wzj
password: A085F27A43B0
# # 从库数据源
@ -92,17 +92,17 @@ spring:
# 此属性控制池中连接的最长生命周期值0表示无限生命周期默认30分钟
maxLifetime: 1800000
# 多久检查一次连接的活性
keepaliveTime: 30000
keepaliveTime: 300000
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring.data:
redis:
# 地址
host: 82.156.121.2
host: 192.168.1.65
# 端口默认为6379
port: 26379
port: 16379
# 数据库索引
database: 0
database: 2
# 密码(如没有密码请注释掉)
password: e4ea0caebfd2
# 连接超时时间
@ -133,6 +133,30 @@ redisson:
# 发布和订阅连接池大小
subscriptionConnectionPoolSize: 50
--- # RocketMQ 配置
rocketmq:
# RocketMQ 服务器地址
name-server: 43.143.227.203:9876
# 生产者配置
producer:
# 生产者组名
group: wzj_test
# 发送消息超时时间
send-message-timeout: 30000
# 消息最大长度
max-message-size: 4194304
# 消息发送失败重试次数
retry-times-when-send-failed: 3
# 异步消息发送失败重试次数
retry-times-when-send-async-failed: 3
# 消费者配置
consumer:
# 拉取消息最大数量
pull-batch-size: 10
# 消费者组 (系统模块)
group: wzj_test
# 是否启动消费者
enabled: true
--- # mail 邮件发送
mail:
enabled: false
@ -182,84 +206,60 @@ sms:
config2:
# 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
supplier: tencent
access-key-id: 您的accessKey
access-key-secret: 您的accessKeySecret
signature: 您的短信签名
sdk-app-id: 您的sdkAppId
access-key-id: AKIDvhEVWHm0xe5JGxOZXGitnRovlKcfRzIN
access-key-secret: qPhiTxA7oENFrCH5dvxiCQN4UdWAYgYA
signature: 无终街天津科技
sdk-app-id: 1400966042
--- # 三方授权
justauth:
# 前端外网访问地址
address: http://localhost:80
address: http://82.156.121.2:8880/
type:
maxkey:
# maxkey 服务器地址
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据
server-url: http://sso.maxkey.top
client-id: 876892492581044224
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8
redirect-uri: ${justauth.address}/social-callback?source=maxkey
topiam:
# topiam 服务器地址
server-url: http://127.0.0.1:1898/api/v1/authorize/y0q************spq***********8ol
client-id: 449c4*********937************759
client-secret: ac7***********1e0************28d
redirect-uri: ${justauth.address}/social-callback?source=topiam
scopes: [openid, email, phone, profile]
qq:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=qq
union-id: false
weibo:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=weibo
gitee:
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac
redirect-uri: ${justauth.address}/social-callback?source=gitee
dingtalk:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=dingtalk
baidu:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=baidu
csdn:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=csdn
coding:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=coding
coding-group-name: xx
oschina:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=oschina
alipay_wallet:
alipay_wallet: # 支付宝钱包
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet
alipay-public-key: MIIB**************DAQAB
wechat_open:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
wechat_open: # 微信开放平台
client-id: wxebcdaea31881caab
client-secret: 71826d76bad096ec5407897c6ed1391f
redirect-uri: ${justauth.address}/social-callback?source=wechat_open
wechat_mp:
wechat_mp: # 微信小程序
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
wechat_enterprise:
wechat_enterprise: # 微信企业
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
agent-id: 1000002
gitlab:
client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${justauth.address}/social-callback?source=gitlab
# 腾讯云IM配置
tencent:
im:
enabled: true # 启用腾讯云IM
sdk-app-id: 1600080789 # 你的腾讯云 SDKAppID
secret-key: "311b5309d714a20f7f5b54360ee21b1e24ec208ebcd25ce8f47d24753bccc091" # 你的密钥
administrator: "administrator" # 管理员账号
expire-time: 604800 # UserSig 过期时间7天单位
# mongodb
data:
mongodb:
uri: 82.156.121.2:37017
database: wzj-shop
username: admin
password: A1969bf8
authentication-database: admin
# replica-set-name: mongoreplset
easypay:
api-path-prefix: https://d-phoenix-gap.easypay.com.cn:24443/yqt
req-id: D01X66666667068
mcht-code: 631000000003325
wechat-mchid: 804474446
easypay-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArgVerkGaSEQvZIOpLjeUoVpL0lSYLc04+txtPFtfm5r5XFbaNaf5Ahu0lziGEwWzrGONThSsnb3U9pqoY6BpqviN4h+Guw5oEdHr1T/eDkQD5urgQUaZA6lDoU9XC662r+0kpbKidvXIsK2CrShN+BF8HEJmRZuhglxh25OHWIWqQiUDjLZC+QJRZqUu9Uzy9RBBu7qa0f0xbqYl3hnYi+vH++SsyOavO2gUVQyKU5Kkt5ZJVpZFQvD3BXePgwJSpsvrjhj0hiYp2v6PScN9XHP1vXB4wtIYSFYwmVus1KkV/LfDzUm6zHjliHYTVl6lPMhveIVJlRIqInRZRHxg5QIDAQAB
merRsaPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCc1mku1mtfTc1vZM9z3TkRMZ9SaKP+6MdoQhjDHB9vJUOuG2Jnegej4gtzcm8MVYomV1azJMtCbPq4PN9aHegH13JthvrUPR3nAKp8AUp9Fh47ded//snNyAf7C7o8xKN5e7n89ROwacCAL2QDno76ngXzQQVj1TxY9pBdekZ03ezuDk1sv/u4FBlW8kRyaVdqyl4FdvP+EEljDe8gGxRikLyb3cK1B6G7w2BXgM/svft5SOoiqStx2XvgHRrFRB5w96TdoKNH9yxHU2clMJiz+5cej1VL6OHZspuY3cnPyJtyS+weYjDT+COLLBUe9UwbOV15DXDNpBLd34W4GiqtAgMBAAECggEAYaVwmVOwSAblp7wJGScb16OggStbJ2MAe93jEt7Yh1eZGrY7/xbP2O3smTUfBHvhZlusRB7dWf8F3l0v5iiGhRNTT/PhCPEARAl7G3emS9jQe869kkgslq06ose7bQg0i3dH5cEkQAqnameXClXWyRxHshrCY1SonO7uFPUDFtD2Z9GHu6dOWkOHfX7UETHV5/NTSqvner5M2YNsV/5To87zrmaeeNyvu91JgJSYofTD8IcMyhxcswxB9F3ECP7nulLDdCV+9mvE9zO0i4mPBxYb++87J0pu35TN9OY+gpiCK3Ed0gDqvvkTiCQEFu6y7OiqsQwy03CE5hAwWZR2YQKBgQDdb6e7+FWJSr9fIknfvZPPtKmbEkMHP1RYnVo3pmuVm14Z3UmostiSBRPMfVjeOX0N82SONM9P+1v9SDgSK3pL8rlk9Hx6D5KI7uj2IMtTVt00pO31KtxDLmXfgapDbWHK1RGEn1PDrnKYy5yOKJ8n0Wgp4lVEPIBN6uIud0A9iQKBgQC1UXdhEXFETyqEYWb9OnWbBjiVIw3D2/qW5c+WQGsHYdMEImC/0oTWIH9fKd4Azf26JjZ9nQvs5VcijJP6BXbGPqir5NgGVkwCj33PoNg4dDgIVE4BYaSp//7B6jCi5QiRTzCSOmUSkZ5L1Kz4SNEDe9r0MpLhxrsAzmR9aEJ/BQKBgHI71Ks63F2cSwd39+ZNtYA0cj7Gd/+4IvooCs+kseGXKj9rkkFOKj2CEwmuLHdP7vyQcHKQOdbIFFegtxRgi5G8oPm8yq5pdC3iGhpHJr1SlYFACGYu+zxJJlLcYIqyVf2+V3A0hZDwYLwEZjpMKHbxJ6xbz6MJFyObJZ3U9TYJAoGANXoGjJF5Z501u/+CQZN5VjSagZnqGGcL3G+BLx5msrGua9y7zjeHyCOjjWyqtnAKsllM3vVvq/nkHiN6DVaJNmUKmFARSqUvG944TAFzZAsa75H1w8CJsT34ZDbvC0wjn7/MYoRohPZ/ynu6XCwVwUJJTJaR7ZcQVmeJCdezLQUCgYEAszix6V9oL80Clb1nMwIly6I78+pcFKyk82yXxvySb6XPJvgoasbz9xYIeKlPyy6r8Aj/ujz5GVtDtkE6n6bsjekCdnUKUY3uTvFAX+YGQkuZnaPoisELJFI2Hal22tNnJyCOYh//AGAiHYpHNUKD4hsKBb45MhK1xwvTHpuLkdc=
trade-backUrl: http://82.156.121.2:8880/trans/easypay/trade/callback

View File

@ -121,7 +121,7 @@ security:
- /app/**
- /resource/oss/**
- /callback/api
- /cms/vlog/vodCallBack
# 多租户配置
tenant:

View File

@ -16,12 +16,17 @@
<module>ruoyi-system</module>
<module>ruoyi-workflow</module>
<module>ruoyi-order</module>
<module>ruoyi-goods</module>
<module>ruoyi-member</module>
<module>ruoyi-content</module>
<module>ruoyi-im</module>
<module>ruoyi-auth</module>
<module>ruoyi-transaction</module>
<!-- <module>ruoyi-statistics</module>-->
</modules>
<artifactId>ruoyi-modules</artifactId>

View File

@ -36,7 +36,7 @@ import java.nio.file.Path;
@RequiredArgsConstructor
@RocketMQMessageListener(
topic = RocketMQConfig.VLOG_UPLOAD_TOPIC,
consumerGroup = RocketMQConfig.VLOG_UPLOAD_GROUP,
consumerGroup = "VLOG_UPLOAD_GROUP_LOCAL",
selectorExpression = RocketMQConfig.VLOG_UPLOAD_TAG
)
public class VlogUploadMessageConsumer implements RocketMQListener<MessageExt> {
@ -89,7 +89,7 @@ public class VlogUploadMessageConsumer implements RocketMQListener<MessageExt> {
}
String fileId = vlog.getFileId();
//检查该文件是否为oss文件如果不是说明已经上传过了
if (!vlog.getUrl().contains("#")) {
if (vlog.getUrl().contains("qcloud")) {
return true;
}
//从oss下载文件

View File

@ -25,7 +25,7 @@ public class VlogBO extends BaseBO {
private String id;
@ApiModelProperty(value = "作者id", hidden = true)
private String vlogerId;
private String memberId;
private String url;
private String cover;
private String title;

View File

@ -1,10 +1,9 @@
package com.wzj.soopin.content.domain.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType;
import org.dromara.common.core.domain.model.BaseAudit;
@TableName(value = "cont_vlog", autoResultMap = true)
@ -85,4 +84,8 @@ public class Vlog extends BaseAudit {
* 首帧图
*/
private String firstFrameImg;
@TableLogic(value ="0", delval = "1")
@TableField(value ="del_flag",fill = FieldFill.INSERT, jdbcType = JdbcType.CHAR)
private String delFlag;
}

View File

@ -145,7 +145,7 @@ public class VlogServiceImpl extends ServiceImpl<VlogMapper, Vlog> implements Vl
if (loginUser == null) {
throw new ServiceException("用户未登录");
}
vlogBO.setVlogerId(String.valueOf(loginUser.getUserId()));
vlogBO.setMemberId(String.valueOf(loginUser.getUserId()));
String vid = sid.nextShort();
Vlog vlog = vlogConvert.toPo(vlogBO);
@ -156,7 +156,7 @@ public class VlogServiceImpl extends ServiceImpl<VlogMapper, Vlog> implements Vl
vlog.setIsPrivate(YesOrNo.NO.type);
vlog.setMemberId(loginUser.getUserId()+"");
vlog.setUrl(vlogBO.getUrl()==null?"#":vlogBO.getUrl());
vlog.setUrl("#");
vlogMapper.insert(vlog);

View File

@ -44,6 +44,9 @@
<if test="bo.cityCode != null and bo.cityCode != ''">
AND v.city_code = #{bo.cityCode}
</if>
<if test="bo.memberId != null and bo.memberId != ''">
AND v.member_id = #{bo.memberId}
</if>
<if test="bo.title != null and bo.title != ''">
AND v.title like '%${bo.title}%'
</if>

View File

@ -9,5 +9,4 @@ import java.io.Serializable;
public interface IMemberForbiddenService extends IService<MemberForbidden> {
}

View File

@ -0,0 +1,109 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-modules</artifactId>
<version>5.3.1</version>
</parent>
<artifactId>ruoyi-statistics</artifactId>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-doc</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-translation</artifactId>
</dependency>
<!-- OSS功能模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-oss</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- excel-->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-excel</artifactId>
</dependency>
<!-- SMS功能模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sms</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-tenant</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-security</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-web</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-idempotent</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-encrypt</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-order</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-member</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,28 @@
package com.wzj.soopin.statistics.aop;
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
import java.lang.annotation.*;
/**
* 埋点统计
*
* @author Bulbasaur
* @since 2021/7/9 1:47 上午
*/
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PageViewPoint {
/**
* 描述
*/
PageViewEnum type();
/**
* 商品id店铺id
* 字段类型为string 支持 spel语法也可以填写
*/
String id();
}

View File

@ -0,0 +1,108 @@
package com.wzj.soopin.statistics.aop.aspect;
import cn.lili.cache.Cache;
import cn.lili.cache.CachePrefix;
import cn.lili.common.context.ThreadContextHolder;
import cn.lili.common.utils.IpUtils;
import cn.lili.common.utils.SpelUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
import cn.lili.modules.statistics.aop.PageViewPoint;
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
import cn.lili.modules.statistics.util.StatisticsSuffix;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* 页面浏览统计拦截
*
* @author Chopper
* @since 2021-01-14 18:01
*/
@Aspect
@Configuration
@Slf4j
public class PageViewInterceptor {
@Autowired
private Cache cache;
@AfterReturning(returning = "rvt", pointcut = "@annotation(cn.lili.modules.statistics.aop.PageViewPoint)")
public void interceptor(JoinPoint point, Object rvt) {
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
PageViewPoint pageViewPoint = method.getAnnotation(PageViewPoint.class);
PageViewEnum pageViewEnum = pageViewPoint.type();
//store id -1 代表平台访问
String storeId;
//商品访问
String goodsId = null;
switch (pageViewEnum) {
case SKU:
ResultMessage<Map<String, Object>> skuRvt = (ResultMessage<Map<String, Object>>) rvt;
if (skuRvt != null && skuRvt.getResult() != null && skuRvt.getResult().containsKey("data")) {
GoodsSkuVO goodsSkuDetail = (GoodsSkuVO) skuRvt.getResult().get("data");
storeId = goodsSkuDetail.getStoreId();
goodsId = goodsSkuDetail.getGoodsId();
break;
}
case STORE:
Map<String, String> map = null;
try {
map = spelFormat(point);
} catch (Exception e) {
return;
}
storeId = map.get("id");
break;
default:
storeId = "-1";
}
String ip = IpUtils.getIpAddress(ThreadContextHolder.getHttpRequest());
try {
//PV 统计48小时过期 留下一定时间予以统计累计数据库
cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(), 60 * 60 * 48);
//平台UV统计
cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), ip);
//PV 统计48小时过期 留下一定时间予以统计累计数据库
cache.incr(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(storeId), 60 * 60 * 48);
//店铺UV 统计则需要对id去重复所以如下处理
cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
} catch (Exception e) {
log.error("页面出错", e);
}
}
/**
* 获取注解中对方法的描述信息 用于Controller层注解
*
* @param joinPoint 切点
* @return 方法描述
* @throws Exception
*/
private static Map<String, String> spelFormat(JoinPoint joinPoint) {
Map<String, String> result = new HashMap<>(2);
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
PageViewPoint pageViewPoint = signature.getMethod().getAnnotation(PageViewPoint.class);
String id = SpelUtil.compileParams(joinPoint, pageViewPoint.id());
result.put("id", id);
return result;
}
}

View File

@ -0,0 +1,15 @@
package com.wzj.soopin.statistics.aop.enums;
/**
* 统计页面类型
*
* @author Chopper
* @since 2021-01-14 17:55
*/
public enum PageViewEnum {
/**
* 店铺商品其他页面
*/
STORE, SKU, OTHER
}

View File

@ -0,0 +1,45 @@
package com.wzj.soopin.statistics.controller;
import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.StatisticsQuery;
import com.wzj.soopin.statistics.entity.vo.CategoryStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.GoodsStatisticsDataVO;
import com.wzj.soopin.statistics.service.StoreFlowStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 管理端,商品统计接口
*
* @author Bulbasaur
* @since 2020/12/9 19:04
*/
@Api(tags = "管理端,商品流水统计接口")
@RestController
@RequestMapping("/manager/statistics/goods")
public class GoodsStatisticsManagerController {
@Autowired
private StoreFlowStatisticsService storeFlowStatisticsService;
@ApiOperation(value = "获取统计列表,排行前一百的数据")
@GetMapping
public R<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
return R.ok(storeFlowStatisticsService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
}
@ApiOperation(value = "获取行业统计列表")
@GetMapping("/getCategoryByPage")
public R<List<CategoryStatisticsDataVO>> getCategoryByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
return R.ok(storeFlowStatisticsService.getCategoryStatisticsData(goodsStatisticsQueryParam));
}
}

View File

@ -0,0 +1,71 @@
package com.wzj.soopin.statistics.controller;
import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.StatisticsQuery;
import com.wzj.soopin.statistics.entity.vo.GoodsStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.IndexNoticeVO;
import com.wzj.soopin.statistics.entity.vo.IndexStatisticsVO;
import com.wzj.soopin.statistics.entity.vo.StoreStatisticsDataVO;
import com.wzj.soopin.statistics.service.IndexStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 管理端,首页统计数据接口
*
* @author Bulbasaur
* @since 2020/12/15 17:53
*/
@Slf4j
@Api(tags = "管理端,首页统计数据接口")
@RestController
@RequestMapping("/manager/statistics/index")
public class IndexStatisticsManagerController {
/**
* 首页统计
*/
@Autowired
private IndexStatisticsService indexStatisticsService;
@ApiOperation(value = "获取首页查询数据")
@GetMapping
public R<IndexStatisticsVO> index() {
try {
return R.ok(indexStatisticsService.indexStatistics());
} catch (Exception e) {
log.error("获取首页查询数据错误",e);
}
return null;
}
@ApiOperation(value = "获取首页查询热卖商品TOP10")
@GetMapping("/goodsStatistics")
public R<List<GoodsStatisticsDataVO>> goodsStatistics(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
//按照金额查询
goodsStatisticsQueryParam.setType(StatisticsQuery.PRICE.name());
return R.ok(indexStatisticsService.goodsStatistics(goodsStatisticsQueryParam));
}
@ApiOperation(value = "获取首页查询热卖店铺TOP10")
@GetMapping("/storeStatistics")
public R<List<StoreStatisticsDataVO>> storeStatistics(StatisticsQueryParam statisticsQueryParam) {
return R.ok(indexStatisticsService.storeStatistics(statisticsQueryParam));
}
@ApiOperation(value = "通知提示信息")
@GetMapping("/notice")
public R<IndexNoticeVO> notice() {
return R.ok(indexStatisticsService.indexNotice());
}
}

View File

@ -0,0 +1,34 @@
package com.wzj.soopin.statistics.controller;
import com.wzj.soopin.statistics.entity.dos.MemberStatisticsData;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.service.MemberStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 管理端,会员统计接口
*
* @author Bulbasaur
* @since 2020/12/9 19:04
*/
@Api(tags = "管理端,会员统计接口")
@RestController
@RequestMapping("/manager/statistics/member")
public class MemberStatisticsManagerController {
@Autowired
private MemberStatisticsService memberStatisticsService;
@ApiOperation(value = "获取会员统计")
@GetMapping
public R<List<MemberStatisticsData>> getByList(StatisticsQueryParam statisticsQueryParam) {
return R.ok(memberStatisticsService.statistics(statisticsQueryParam));
}
}

View File

@ -0,0 +1,89 @@
package com.wzj.soopin.statistics.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wzj.soopin.order.domain.entity.Aftersale;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.OrderOverviewVO;
import com.wzj.soopin.statistics.entity.vo.OrderSimpleVO;
import com.wzj.soopin.statistics.entity.vo.OrderStatisticsDataVO;
import com.wzj.soopin.statistics.service.AfterSaleStatisticsService;
import com.wzj.soopin.statistics.service.OrderStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
/**
* 管理端,订单统计接口
*
* @author Bulbasaur
* @since 2020/12/9 19:04
*/
@Slf4j
@Api(tags = "管理端,订单统计接口")
@RestController
@RequestMapping("/manager/statistics/order")
public class OrderStatisticsManagerController {
@Autowired
private OrderStatisticsService orderStatisticsService;
@Autowired
private AfterSaleStatisticsService afterSaleStatisticsService;
@ApiOperation(value = "订单概览统计")
@GetMapping("/overview")
public R<OrderOverviewVO> overview(StatisticsQueryParam statisticsQueryParam) {
try {
return R.ok(orderStatisticsService.overview(statisticsQueryParam));
} catch (Exception e) {
log.error("订单概览统计错误",e);
}
return null;
}
@ApiOperation(value = "订单图表统计")
@GetMapping
public R<List<OrderStatisticsDataVO>> statisticsChart(StatisticsQueryParam statisticsQueryParam) {
try {
return R.ok(orderStatisticsService.statisticsChart(statisticsQueryParam));
} catch (Exception e) {
log.error("订单图表统计",e);
}
return null;
}
@ApiOperation(value = "订单统计")
@GetMapping("/order")
public R<IPage<OrderSimpleVO>> order(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
try {
return R.ok(orderStatisticsService.getStatistics(statisticsQueryParam, pageVO));
} catch (Exception e) {
log.error("订单统计",e);
}
return null;
}
@ApiOperation(value = "退单统计")
@GetMapping("/refund")
public R<IPage<Aftersale>> refund(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
return R.ok(afterSaleStatisticsService.getStatistics(statisticsQueryParam, pageVO));
}
@ApiOperation(value = "退单统计导出")
@GetMapping("/refund/export")
public void exportRefund(StatisticsQueryParam statisticsQueryParam, HttpServletResponse response) throws IOException {
afterSaleStatisticsService.exportRefund(statisticsQueryParam, response);
}
}

View File

@ -0,0 +1,41 @@
package com.wzj.soopin.statistics.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.RefundOrderStatisticsDataVO;
import com.wzj.soopin.statistics.service.RefundOrderStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 管理端,退款统计接口
*
* @author Bulbasaur
* @since 2020/12/9 19:04
*/
@Api(tags = "管理端,退款统计接口")
@RestController
@RequestMapping("/manager/statistics/refundOrder")
public class RefundOrderStatisticsManagerController {
@Autowired
private RefundOrderStatisticsService refundOrderStatisticsService;
@ApiOperation(value = "获取退款统计列表")
@GetMapping("/getByPage")
public R<IPage<RefundOrderStatisticsDataVO>> getByPage(PageVO pageVO, StatisticsQueryParam statisticsQueryParam) {
return R.ok(refundOrderStatisticsService.getRefundOrderStatisticsData(pageVO, statisticsQueryParam));
}
@ApiOperation(value = "获取退款统计金额")
@GetMapping("/getPrice")
public R<Object> getPrice(StatisticsQueryParam statisticsQueryParam) {
return R.ok(refundOrderStatisticsService.getRefundOrderStatisticsPrice(statisticsQueryParam));
}
}

View File

@ -0,0 +1,57 @@
package com.wzj.soopin.statistics.controller;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import com.wzj.soopin.statistics.entity.vo.OnlineMemberVO;
import com.wzj.soopin.statistics.entity.vo.PlatformViewVO;
import com.wzj.soopin.statistics.service.PlatformViewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 管理端,流量统计接口
*
* @author Chopper
* @since 2021/2/9 11:19
*/
@Api(tags = "管理端,流量统计接口")
@RestController
@RequestMapping("/manager/statistics/view")
public class ViewStatisticsManagerController {
@Autowired
private PlatformViewService platformViewService;
@ApiOperation(value = "流量数据 表单获取")
@GetMapping("/list")
public R<List<PlatformViewVO>> getByPage(StatisticsQueryParam queryParam) {
return R.ok(platformViewService.list(queryParam));
}
@ApiOperation(value = "当前在线人数")
@GetMapping("/online/current")
public R<Long> currentNumberPeopleOnline() {
return R.ok(platformViewService.online());
}
@ApiOperation(value = "会员分布")
@GetMapping("/online/distribution")
public R<List<MemberDistributionVO>> memberDistribution() {
return R.ok(platformViewService.memberDistribution());
}
@ApiOperation(value = "在线人数历史默认48小时")
@GetMapping("/online/history")
public R<List<OnlineMemberVO>> history() {
return R.ok(platformViewService.statisticsOnline());
}
}

View File

@ -0,0 +1,39 @@
package com.wzj.soopin.statistics.entity.dos;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dromara.common.core.domain.BaseBO;
import java.util.Date;
/**
* 会员统计
*
* @author Chopper
* @since 2020/11/17 7:34 下午
*/
@Data
@TableName("li_member_statistics_data")
@ApiModel(value = "会员统计")
public class MemberStatisticsData extends BaseBO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "统计日")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date createDate;
@ApiModelProperty(value = "当前会员数量")
private Long memberCount;
@ApiModelProperty(value = "新增会员数量")
private Long newlyAdded;
@ApiModelProperty(value = "当日活跃数量")
private Long activeQuantity;
}

View File

@ -0,0 +1,37 @@
package com.wzj.soopin.statistics.entity.dos;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dromara.common.core.domain.BaseBO;
import java.util.Date;
/**
* 平台pv统计
*
* @author Chopper
* @since 2020-06-19 17:50
*/
@Data
@TableName("li_s_platform_view_data")
@ApiModel(value = "平台pv统计")
public class PlatformViewData extends BaseBO {
@ApiModelProperty(value = "pv数量")
private Long pvNum;
@ApiModelProperty(value = "uv数量")
private Long uvNum;
@ApiModelProperty(value = "统计日")
private Date date;
//默认是平台流量统计//
@ApiModelProperty(value = "店铺id")
private String storeId = "-1";
}

View File

@ -0,0 +1,18 @@
package com.wzj.soopin.statistics.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 商品统计查询参数
*
* @author Chopper
* @since 2020/11/17 7:34 下午
*/
@Data
public class GoodsStatisticsQueryParam extends StatisticsQueryParam {
@ApiModelProperty(value = "查询类型按数量NUM、按金额PRICE")
private String type;
}

View File

@ -0,0 +1,30 @@
package com.wzj.soopin.statistics.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 统计查询参数
*
* @author Bulbasaur
* @since 2020/12/9 14:20
*/
@Data
public class StatisticsQueryParam {
@ApiModelProperty(value = "快捷搜索", allowableValues = "TODAY, YESTERDAY, LAST_SEVEN, LAST_THIRTY")
private String searchType;
@ApiModelProperty(value = "类型YEAR、月MONTH")
private String timeType;
@ApiModelProperty(value = "年份")
private Integer year;
@ApiModelProperty(value = "月份")
private Integer month;
@ApiModelProperty(value = "店铺ID")
private String storeId;
}

View File

@ -0,0 +1,26 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 售后类型
*
* @author Chopper
* @since 2020/8/20 15:39
*/
public enum AfterSaleTypeEnum {
/**
* 售后服务类型枚举
*/
RETURN_MONEY("退款"), RETURN_GOODS("退货");
private final String description;
AfterSaleTypeEnum(String description) {
this.description = description;
}
public String description() {
return description;
}
}

View File

@ -0,0 +1,33 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 结算单状态
*
* @author Chopper
* @since 2020/11/17 4:27 下午
*/
public enum BillStatusEnum {
/**
* "已出账"
*/
OUT("已出账"),
/**
* "已核对"
*/
CHECK("已核对"),
/**
* "已完成"
*/
COMPLETE("已完成");
private final String description;
BillStatusEnum(String description) {
this.description = description;
}
public String description() {
return description;
}
}

View File

@ -0,0 +1,27 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 流水类型枚举
*
* @author Chopper
* @since 2020/11/17 7:25 下午
*/
public enum FlowTypeEnum {
/**
* 流水类型
*/
PAY("支付"),
REFUND("退款");
private final String description;
FlowTypeEnum(String description) {
this.description = description;
}
public String description() {
return description;
}
}

View File

@ -0,0 +1,32 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 商品审核
*
* @author pikachu
* @since 2020-02-26 23:24:13
*/
public enum GoodsAuthEnum {
/**
* 需要审核 并且待审核
*/
TOBEAUDITED("待审核"),
/**
* 审核通过
*/
PASS("审核通过"),
/**
* 审核通过
*/
REFUSE("审核拒绝");
private final String description;
GoodsAuthEnum(String description) {
this.description = description;
}
public String description() {
return description;
}
}

View File

@ -0,0 +1,28 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 商品类型枚举
*
* @author pikachu
* @since 2020-02-26 23:24:13
*/
public enum GoodsStatusEnum {
/**
* 上架
*/
UPPER("上架"),
/**
* 下架
*/
DOWN("下架");
private final String description;
GoodsStatusEnum(String description) {
this.description = description;
}
public String description() {
return description;
}
}

View File

@ -0,0 +1,29 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 订单状态枚举
*
* @author Chopper
* @since 2020/11/17 7:28 下午
*/
public enum PayStatusEnum {
/**
* 支付状态
*/
UNPAID("待付款"),
PAID("已付款"),
CANCEL("已取消"),
REFUNDED("已退款");
private final String description;
PayStatusEnum(String description) {
this.description = description;
}
public String description() {
return this.description;
}
}

View File

@ -0,0 +1,16 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 搜索类型
*
* @author Chopper
* @since 2021/2/9 16:17
*/
public enum SearchTypeEnum {
/**
* 昨天今天过去七天过去30天
*/
TODAY, YESTERDAY, LAST_SEVEN, LAST_THIRTY
}

View File

@ -0,0 +1,19 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 统计查询
* @author Chopper
* @since 2021/2/9 16:17
*/
public enum StatisticsQuery {
/**
* 数量
*/
NUM,
/**
* 金额
*/
PRICE,
}

View File

@ -0,0 +1,24 @@
package com.wzj.soopin.statistics.entity.enums;
/**
* 时间类型
* @author Chopper
* @since 2021/2/9 16:17
*/
public enum TimeTypeEnum {
/**
*
*/
MONTH,
/**
*
*/
YEAR,
/**
* 全部
*/
ALL;
}

View File

@ -0,0 +1,27 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 分类统计VO
*
* @author Bulbasaur
* @since 2020/12/10 15:42
*/
@Data
public class CategoryStatisticsDataVO {
@ApiModelProperty("一级分类ID")
private String categoryId;
@ApiModelProperty("一级分类名称")
private String categoryName;
@ApiModelProperty(value = "销售数量")
private String num;
@ApiModelProperty(value = "销售金额")
private Double price;
}

View File

@ -0,0 +1,26 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 商品统计VO
*
* @author Bulbasaur
* @since 2020/12/9 14:25
*/
@Data
public class GoodsStatisticsDataVO {
@ApiModelProperty(value = "商品ID")
private String goodsId;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "销售数量")
private String num;
@ApiModelProperty(value = "销售金额")
private Double price;
}

View File

@ -0,0 +1,33 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 消息提示
*
* @author Bulbasaur
* @since 2020/12/9 14:25
*/
@Data
public class IndexNoticeVO {
@ApiModelProperty(value = "待处理商品审核")
private Long goods;
@ApiModelProperty(value = "待处理店铺入驻审核")
private Long store;
@ApiModelProperty(value = "待处理售后申请")
private Long refund;
@ApiModelProperty(value = "待处理投诉审核")
private Long complain;
@ApiModelProperty(value = "待处理分销员提现申请")
private Long distributionCash;
@ApiModelProperty(value = "待处理商家结算")
private Long waitPayBill;
}

View File

@ -0,0 +1,53 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 首页统计内容
*
* @author Bulbasaur
* @since 2020/12/22 14:23
*/
@Data
public class IndexStatisticsVO {
@ApiModelProperty(value = "订单总数量")
private Long orderNum;
@ApiModelProperty(value = "商品总数量")
private Long goodsNum;
@ApiModelProperty(value = "会员总数量")
private Long memberNum;
@ApiModelProperty(value = "店铺总数量")
private Long storeNum;
/**
* 流量概括
*/
@ApiModelProperty(value = "今日访问数UV")
private Integer todayUV;
@ApiModelProperty(value = "昨日访问数UV")
private Integer yesterdayUV;
@ApiModelProperty(value = "前七日访问数UV")
private Integer lastSevenUV;
@ApiModelProperty(value = "三十日访问数UV")
private Integer lastThirtyUV;
/**
* 今日信息概括
*/
@ApiModelProperty(value = "今日订单数")
private Long todayOrderNum;
@ApiModelProperty(value = "今日下单金额")
private Double todayOrderPrice;
@ApiModelProperty(value = "今日新增会员数量")
private Long todayMemberNum;
@ApiModelProperty(value = "今日新增商品数量")
private Long todayGoodsNum;
@ApiModelProperty(value = "今日新增店铺数量")
private Long todayStoreNum;
@ApiModelProperty(value = "今日新增评论数量")
private Long todayMemberEvaluation;
@ApiModelProperty(value = "当前在线人数")
private Long currentNumberPeopleOnline;
}

View File

@ -0,0 +1,24 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 会员分布VO
*
* @author Chopper
* @since 2021-02-26 17:25
*/
@Data
public class MemberDistributionVO {
@ApiModelProperty(value = "客户端类型")
private String clientEnum;
@ApiModelProperty(value = "数量")
private Integer num;
@ApiModelProperty(value = "比例")
private Double proportion;
}

View File

@ -0,0 +1,30 @@
package com.wzj.soopin.statistics.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Date;
/**
* 在线会员
*
* @author Chopper
* @since 2021-02-21 09:59
*/
@Data
@AllArgsConstructor
public class OnlineMemberVO {
/**
* 在线时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH")
private Date date;
/**
* 在线会员人数
*/
private Integer num;
}

View File

@ -0,0 +1,126 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 订单统计概述
*
* @author Chopper
* @since 2021-03-03 10:27
*/
@Data
public class OrderOverviewVO {
@ApiModelProperty(value = "UV人次")
private Long uvNum;
/**
* 下单统计
*/
@ApiModelProperty(value = "下单数量")
private Long orderNum;
@ApiModelProperty(value = "下单人数")
private Long orderMemberNum;
@ApiModelProperty(value = "下单金额")
private Double orderAmount;
/**
* 付款统计
*/
@ApiModelProperty(value = "付款订单数量")
private Long paymentOrderNum;
@ApiModelProperty(value = "付款人数")
private Long paymentsNum;
@ApiModelProperty(value = "付款金额")
private Double paymentAmount;
/**
* 退单统计
*/
@ApiModelProperty(value = "退单笔数")
private Long refundOrderNum;
@ApiModelProperty(value = "退单金额")
private Double refundOrderPrice;
/**
* 转换率
*/
@ApiModelProperty(value = "下单转换率")
private String orderConversionRate;
@ApiModelProperty(value = "付款转换率")
private String paymentsConversionRate;
@ApiModelProperty(value = "整体转换率")
private String overallConversionRate;
public Long getUvNum() {
if (uvNum == null) {
return 0L;
}
return uvNum;
}
public Long getOrderNum() {
if (orderNum == null) {
return 0L;
}
return orderNum;
}
public Long getOrderMemberNum() {
if (orderMemberNum == null) {
return 0L;
}
return orderMemberNum;
}
public Double getOrderAmount() {
if (orderAmount == null) {
return 0D;
}
return orderAmount;
}
public Long getPaymentOrderNum() {
if (paymentOrderNum == null) {
return 0L;
}
return paymentOrderNum;
}
public Long getPaymentsNum() {
if (paymentsNum == null) {
return 0L;
}
return paymentsNum;
}
public Double getPaymentAmount() {
if (paymentAmount == null) {
return 0D;
}
return paymentAmount;
}
public Long getRefundOrderNum() {
if (refundOrderNum == null) {
return 0L;
}
return refundOrderNum;
}
public Double getRefundOrderPrice() {
if (refundOrderPrice == null) {
return 0D;
}
return refundOrderPrice;
}
}

View File

@ -0,0 +1,159 @@
package com.wzj.soopin.statistics.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wzj.soopin.order.domain.vo.OrderItemVO;
import io.micrometer.common.util.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 订单简略信息
* 用于订单列表查看
*
* @author Chopper
* @since 2020-08-17 20:28
*/
@Data
public class OrderSimpleVO {
@ApiModelProperty("sn")
private String sn;
@ApiModelProperty(value = "总价格")
private Double flowPrice;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* @see
*/
@ApiModelProperty(value = "订单状态")
private String orderStatus;
/**
* @see
*/
@ApiModelProperty(value = "付款状态")
private String payStatus;
@ApiModelProperty(value = "支付方式")
private String paymentMethod;
@ApiModelProperty(value = "支付时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date paymentTime;
@ApiModelProperty(value = "用户名")
private String memberName;
@ApiModelProperty(value = "店铺名称")
private String storeName;
@ApiModelProperty(value = "店铺ID")
private String storeId;
/**
* @see
*/
@ApiModelProperty(value = "订单来源")
private String clientType;
@ApiModelProperty(value = "用户电话")
private String mobile;
/**
* 子订单信息
*/
private List<OrderItemVO> orderItems;
@ApiModelProperty(hidden = true, value = "item goods_id")
@Setter
private String groupGoodsId;
@ApiModelProperty(hidden = true, value = "item sku id")
@Setter
private String groupSkuId;
@ApiModelProperty(hidden = true, value = "item 数量")
@Setter
private String groupNum;
@ApiModelProperty(hidden = true, value = "item 图片")
@Setter
private String groupImages;
@ApiModelProperty(hidden = true, value = "item 名字")
@Setter
private String groupName;
@ApiModelProperty(hidden = true, value = "item 编号")
@Setter
private String groupOrderItemsSn;
@ApiModelProperty(hidden = true, value = "item 商品价格")
@Setter
private String groupGoodsPrice;
/**
*/
@ApiModelProperty(hidden = true, value = "item 售后状态", allowableValues = "NOT_APPLIED(未申请),ALREADY_APPLIED(已申请),EXPIRED(已失效不允许申请售后)")
@Setter
private String groupAfterSaleStatus;
/**
*/
@ApiModelProperty(hidden = true, value = "item 投诉状态")
@Setter
private String groupComplainStatus;
/**
*/
@ApiModelProperty(hidden = true, value = "item 评价状态")
@Setter
private String groupCommentStatus;
/**
*/
@ApiModelProperty(value = "订单类型")
private String orderType;
/**
*/
@ApiModelProperty(value = "货运状态")
private String deliverStatus;
public List<OrderItemVO> getOrderItems() {
if (StringUtils.isEmpty(groupGoodsId)) {
return new ArrayList<>();
}
List<OrderItemVO> orderItemVOS = new ArrayList<>();
String[] orderItemsSn = groupOrderItemsSn.split(",");
String[] goodsId = groupGoodsId.split(",");
String[] skuId = groupSkuId.split(",");
String[] num = groupNum.split(",");
String[] image = groupImages.split(",");
String[] name = groupName.split(",");
String[] afterSaleStatus = groupAfterSaleStatus.split(",");
String[] complainStatus = groupComplainStatus.split(",");
String[] commentStatus = groupCommentStatus.split(",");
String[] goodsPrice = groupGoodsPrice.split(",");
for (int i = 0; i < goodsId.length; i++) {
// orderItemVOS.add(new OrderItemVO(orderItemsSn[i], goodsId[i], skuId[i], num[i], image[i], name[i], afterSaleStatus[i], complainStatus[i], commentStatus[i], Double.parseDouble(goodsPrice[i])));
}
return orderItemVOS;
}
}

View File

@ -0,0 +1,35 @@
package com.wzj.soopin.statistics.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 订单统计数据VO
*
* @author Bulbasaur
* @since 2020/12/9 17:13
*/
@Data
public class OrderStatisticsDataVO {
@ApiModelProperty(value = "店铺")
private String storeName;
@ApiModelProperty(value = "购买人")
private String memberName;
@ApiModelProperty(value = "订单金额")
private Double price;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "订单编号")
private String orderItemSn;
}

View File

@ -0,0 +1,59 @@
package com.wzj.soopin.statistics.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 流量数据展示VO
*
* @author Chopper
* @since 2020-06-19 17:50
*/
@Data
public class PlatformViewVO {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "展示时间")
private Date date;
@ApiModelProperty(value = "pv数量")
private Long pvNum;
@ApiModelProperty(value = "uv数量")
private Long uvNum;
@ApiModelProperty(value = "店铺id")
private String storeId = "-1";
public PlatformViewVO() {
//初始化参数
pvNum = 0L;
uvNum = 0L;
}
public Long getPvNum() {
if(pvNum==null){
return 0L;
}
return pvNum;
}
public Long getUvNum() {
if(uvNum==null){
return 0L;
}
return uvNum;
}
public PlatformViewVO(Date date) {
//初始化参数
pvNum = 0L;
uvNum = 0L;
this.date = date;
}
}

View File

@ -0,0 +1,32 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 退款统计VO
*
* @author Bulbasaur
* @since 2020/12/10 11:24
*/
@Data
public class RefundOrderStatisticsDataVO {
@ApiModelProperty(value = "售后SN")
private String refundSn;
@ApiModelProperty(value = "商家名称 ")
private String storeName;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "规格内容")
private String specs;
@ApiModelProperty(value = "实际退款金额")
private Double finalPrice;
}

View File

@ -0,0 +1,51 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 店铺首页数据
*
* @author Chopper
* @since 2021/3/17 4:04 下午
*/
@Data
public class StoreIndexStatisticsVO {
@ApiModelProperty(value = "商品总数量")
private Long goodsNum;
@ApiModelProperty(value = "订单总数量")
private Integer orderNum;
@ApiModelProperty(value = "订单总额")
private Double orderPrice;
@ApiModelProperty(value = "访客数UV")
private Integer storeUV;
@ApiModelProperty(value = "待付款订单数量")
private Long unPaidOrder;
@ApiModelProperty(value = "待发货订单数量")
private Long unDeliveredOrder;
@ApiModelProperty(value = "待收货订单数量")
private Long deliveredOrder;
@ApiModelProperty(value = "待处理退货数量")
private Long returnGoods;
@ApiModelProperty(value = "待处理退款数量")
private Long returnMoney;
@ApiModelProperty(value = "待回复评价数量")
private Long memberEvaluation;
@ApiModelProperty(value = "待处理交易投诉数量")
private Long complaint;
@ApiModelProperty(value = "待上架商品数量")
private Long waitUpper;
@ApiModelProperty(value = "待审核商品数量")
private Long waitAuth;
@ApiModelProperty(value = "可参与秒杀活动数量")
private Long seckillNum;
@ApiModelProperty(value = "未对账结算单数量")
private Long waitPayBill;
}

View File

@ -0,0 +1,24 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 评分VO
*
* @author Chopper
* @since 2021/3/15 5:55 下午
*/
@Data
public class StoreRatingVO {
@ApiModelProperty(value = "物流评分")
private String deliveryScore;
@ApiModelProperty(value = "服务评分")
private String serviceScore;
@ApiModelProperty(value = "描述评分")
private String descriptionScore;
}

View File

@ -0,0 +1,26 @@
package com.wzj.soopin.statistics.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 商品统计VO
*
* @author Bulbasaur
* @since 2020/12/9 14:25
*/
@Data
public class StoreStatisticsDataVO {
@ApiModelProperty(value = "店铺ID")
private String storeId;
@ApiModelProperty(value = "店铺名称")
private String storeName;
@ApiModelProperty(value = "销售数量")
private String num;
@ApiModelProperty(value = "销售金额")
private Double price;
}

View File

@ -0,0 +1,15 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzj.soopin.order.domain.entity.Aftersale;
/**
* 售后统计数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface AfterSaleStatisticsMapper extends BaseMapper<Aftersale> {
}

View File

@ -0,0 +1,55 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.member.domain.po.AccountBill;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 结算单数据处理层
*
* @author Chopper
* @since 2020/11/17 4:27 下午
*/
public interface BillStatisticsMapper extends BaseMapper<AccountBill> {
/**
* 查询结算单分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 结算单分页
*/
@Select("select b.id,b.sn,b.start_time,b.end_time,b.bill_status,b.store_name,b.bill_price,b.create_time from li_bill as b ${ew.customSqlSegment}")
IPage<AccountBill> queryBillPage(IPage<AccountBill> page, @Param(Constants.WRAPPER) Wrapper<AccountBill> queryWrapper);
/**
* 查询订单结算
*
* @param queryWrapper 查询条件
* @return 结算单
*/
@Select("SELECT SUM( final_price ) AS orderPrice,SUM( commission_price ) AS commissionPrice" +
",SUM( distribution_rebate ) AS distributionCommission,SUM( site_coupon_commission ) AS siteCouponCommission" +
",SUM( point_settlement_price ) AS pointSettlementPrice " +
",SUM( kanjia_settlement_price ) AS kanjiaSettlementPrice " +
",SUM( bill_price ) AS billPrice " +
"FROM li_store_flow ${ew.customSqlSegment}")
AccountBill getOrderBill(@Param(Constants.WRAPPER) QueryWrapper<AccountBill> queryWrapper);
/**
* 查询退款结算单
*
* @param queryWrapper 查询条件
* @return 结算单
*/
@Select("SELECT SUM( final_price ) AS refundPrice,SUM( commission_price ) AS refundCommissionPrice" +
",SUM( distribution_rebate ) AS distributionRefundCommission,SUM( site_coupon_commission ) AS siteCouponRefundCommission" +
",SUM( bill_price ) AS billPrice FROM li_store_flow ${ew.customSqlSegment}")
AccountBill getRefundBill(@Param(Constants.WRAPPER) QueryWrapper<AccountBill> queryWrapper);
}

View File

@ -0,0 +1,14 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.commons.math3.analysis.function.Divide;
/**
* 分销佣金数据统计
*
* @author pikachu
* @since 2020-03-26 18:45:56
*/
public interface DistributionCashStatisticsMapper extends BaseMapper<Divide> {
}

View File

@ -0,0 +1,14 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzj.soopin.goods.domain.entity.Product;
/**
* 商品统计数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface GoodsStatisticsMapper extends BaseMapper<Product> {
}

View File

@ -0,0 +1,63 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.member.domain.po.Feedback;
import com.wzj.soopin.statistics.entity.vo.StoreRatingVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* 会员商品评价数据处理层
*
* @author Bulbasaur
* @since 2020-02-25 14:10:16
*/
public interface MemberEvaluationStatisticsMapper extends BaseMapper<Feedback> {
/**
* 会员评价分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 会员评价分页
*/
@Select("select me.* from li_member_evaluation as me ${ew.customSqlSegment}")
IPage<Feedback> getMemberEvaluationList(IPage<Feedback> page, @Param(Constants.WRAPPER) Wrapper<Feedback> queryWrapper);
/**
* 评价数量
*
* @param goodsId 商品ID
* @return 会员评价
*/
@Select("select grade,count(1) as num from li_member_evaluation Where goods_id=#{goodsId} and status='OPEN' GROUP BY grade")
List<Map<String, Object>> getEvaluationNumber(String goodsId);
/**
* 获取店铺评分
*
* @param queryWrapper 查询条件
* @return 店铺评分
*/
@Select("SELECT round( AVG( delivery_score ), 2 ) AS delivery_score" +
",round( AVG( description_score ), 2 ) AS description_score" +
",round( AVG( service_score ), 2 ) AS service_score " +
"FROM li_member_evaluation ${ew.customSqlSegment}")
StoreRatingVO getStoreRatingVO(@Param(Constants.WRAPPER) Wrapper<Feedback> queryWrapper);
/**
* 商品会员评价数量
*
* @param queryWrapper 查询条件
* @return 评价数量
*/
@Select("SELECT goods_id,COUNT(goods_id) AS num FROM li_member_evaluation GROUP BY goods_id")
List<Map<String, Object>> memberEvaluationNum(@Param(Constants.WRAPPER) Wrapper<Feedback> queryWrapper);
}

View File

@ -0,0 +1,37 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.statistics.entity.dos.MemberStatisticsData;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 会员统计数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface MemberStatisticsMapper extends BaseMapper<MemberStatisticsData> {
/**
* 获取会员统计数量
*
* @param queryWrapper 查询条件
* @return 会员统计数量
*/
@Select("SELECT COUNT(0) FROM li_member ${ew.customSqlSegment}")
long customSqlQuery(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
* 获取会员分布列表
* @return 会员分布列表
*/
@Select("select client_enum,count(0) as num from li_member group by client_enum")
List<MemberDistributionVO> distribution();
}

View File

@ -0,0 +1,63 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.order.domain.entity.Order;
import com.wzj.soopin.statistics.entity.vo.OrderSimpleVO;
import com.wzj.soopin.statistics.entity.vo.OrderStatisticsDataVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 订单统计数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface OrderStatisticsMapper extends BaseMapper<Order> {
/**
* 获取订单统计数据
*
* @param queryWrapper 查询条件
* @return 订单统计列表
*/
@Select("SELECT DATE_FORMAT(create_time,'%Y-%m-%d') AS create_time,sum(flow_price) AS price FROM li_order " +
" ${ew.customSqlSegment}")
List<OrderStatisticsDataVO> getOrderStatisticsData(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
* 订单数量
*
* @param queryWrapper 查询条件
* @return 订单数量
*/
@Select("SELECT count(0) FROM li_order ${ew.customSqlSegment}")
Integer count(@Param(Constants.WRAPPER) Wrapper queryWrapper);
/**
* 查询订单简短信息分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 简短订单分页
*/
@Select("select o.sn,o.flow_price,o.create_time,o.order_status,o.pay_status,o.payment_method,o.payment_time,o.member_name,o.store_name as store_name,o.store_id as store_id,o.client_type,o.order_type,o.deliver_status " +
",GROUP_CONCAT(oi.goods_id) as group_goods_id," +
" GROUP_CONCAT(oi.sku_id) as group_sku_id," +
" GROUP_CONCAT(oi.num) as group_num" +
",GROUP_CONCAT(oi.image) as group_images" +
",GROUP_CONCAT(oi.goods_name) as group_name " +
",GROUP_CONCAT(oi.after_sale_status) as group_after_sale_status" +
",GROUP_CONCAT(oi.complain_status) as group_complain_status" +
",GROUP_CONCAT(oi.comment_status) as group_comment_status" +
",GROUP_CONCAT(oi.sn) as group_order_items_sn " +
",GROUP_CONCAT(oi.goods_price) as group_goods_price " +
" FROM li_order o INNER JOIN li_order_item AS oi on o.sn = oi.order_sn ${ew.customSqlSegment} ")
IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);
}

View File

@ -0,0 +1,25 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.statistics.entity.dos.PlatformViewData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* 平台流量数据
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface PlatformViewMapper extends BaseMapper<PlatformViewData> {
/**
* UV流量统计
*
* @param queryWrapper 查询条件
* @return UV流量统计数量
*/
@Select("SELECT sum(uv_num) FROM li_s_platform_view_data ${ew.customSqlSegment}")
Integer count(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
}

View File

@ -0,0 +1,31 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.member.domain.po.AccountBill;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.wzj.soopin.statistics.entity.vo.RefundOrderStatisticsDataVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
/**
* 退款统计数据处理层
*
* @author Bulbasaur
* @since 2020/12/10 11:22
*/
public interface RefundOrderStatisticsMapper extends BaseMapper<AccountBill> {
/**
* 退款统计
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 退款统计分页
*/
@Select("SELECT refund_sn,store_name,member_name,name,specs,final_price FROM li_store_flow ${ew.customSqlSegment}")
IPage<RefundOrderStatisticsDataVO> getRefundStatisticsData(IPage<RefundOrderStatisticsDataVO> page, @Param(Constants.WRAPPER) Wrapper<RefundOrderStatisticsDataVO> queryWrapper);
}

View File

@ -0,0 +1,56 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.statistics.entity.vo.CategoryStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.GoodsStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.StoreStatisticsDataVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 商品统计数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface StoreFlowStatisticsMapper extends BaseMapper<AccountBill> {
/**
* 商品统计
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 商品统计列表
*/
@Select("SELECT goods_id,goods_name,SUM(final_price) AS price,SUM(num) AS num FROM li_store_flow ${ew.customSqlSegment}")
List<GoodsStatisticsDataVO> getGoodsStatisticsData(IPage<GoodsStatisticsDataVO> page, @Param(Constants.WRAPPER) Wrapper<GoodsStatisticsDataVO> queryWrapper);
/**
* 分类统计
*
* @param queryWrapper 查询条件
* @return 分类统计列表
*/
@Select("SELECT category_id,category_name,SUM(price) AS price,SUM(num) AS num FROM li_store_flow ${ew.customSqlSegment}")
List<CategoryStatisticsDataVO> getCateGoryStatisticsData(@Param(Constants.WRAPPER) Wrapper<CategoryStatisticsDataVO> queryWrapper);
/**
* 店铺统计列表
*
* @param page 分页
* @param queryWrapper 查询参数
* @return 店铺统计列表
*/
@Select("SELECT store_id AS storeId,store_name AS storeName,SUM(final_price) AS price,SUM(num) AS num FROM li_store_flow ${ew.customSqlSegment}")
List<StoreStatisticsDataVO> getStoreStatisticsData(IPage<GoodsStatisticsDataVO> page, @Param(Constants.WRAPPER) Wrapper<GoodsStatisticsDataVO> queryWrapper);
}

View File

@ -0,0 +1,14 @@
package com.wzj.soopin.statistics.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.dromara.system.domain.SysTenant;
/**
* 店铺统计数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface StoreStatisticsMapper extends BaseMapper<SysTenant> {
}

View File

@ -0,0 +1,46 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.order.domain.entity.Aftersale;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 售后统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 19:04
*/
public interface AfterSaleStatisticsService extends IService<Aftersale> {
/**
* 获取待处理售后数量
*
* @param serviceType 售后类型
* @return 待处理售后数量
*/
long applyNum(String serviceType);
/**
* 获取售后统计
*
* @param statisticsQueryParam 统计查询参数
* @param pageVO 分页参数
* @return 售后统计分页
*/
IPage<Aftersale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO);
/**
* 导出售后统计
*
* @param statisticsQueryParam 统计查询参数
* @param response HTTP响应对象
* @throws IOException IO异常
*/
void exportRefund(StatisticsQueryParam statisticsQueryParam, HttpServletResponse response) throws IOException;
}

View File

@ -0,0 +1,23 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.member.enums.AccountBillChangeTypeEnum;
import com.wzj.soopin.statistics.entity.enums.BillStatusEnum;
/**
* 结算单统计
*
* @author Chopper
* @since 2020/11/17 4:28 下午
*/
public interface BillStatisticsService extends IService<AccountBill> {
/**
* 商家待结算数量
*
* @param billStatusEnum 结算单类型
* @return 待结算商家数量
*/
long billNum(BillStatusEnum billStatusEnum);
}

View File

@ -0,0 +1,20 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.commons.math3.analysis.function.Divide;
/**
* 分销佣金统计
*
* @author pikachu
* @since 2020-03-14 23:04:56
*/
public interface DistributionCashStatisticsService extends IService<Divide> {
/**
* 待处理分销员提现申请数量
*
* @return 待处理分销员提现申请数量
*/
long newDistributionCash();
}

View File

@ -0,0 +1,32 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.goods.domain.entity.Product;
import com.wzj.soopin.statistics.entity.enums.GoodsAuthEnum;
import com.wzj.soopin.statistics.entity.enums.GoodsStatusEnum;
/**
* 商品统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface GoodsStatisticsService extends IService<Product> {
/**
* 获取所有的已上架的商品数量
*
* @param goodsStatusEnum 商品状态枚举
* @param goodsAuthEnum 商品审核枚举
* @return 所有的已上架的商品数量
*/
long goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum);
/**
* 获取今天的已上架的商品数量
*
* @return 今天的已上架的商品数量
*/
long todayUpperNum();
}

View File

@ -0,0 +1,56 @@
package com.wzj.soopin.statistics.service;
import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.*;
import java.util.List;
/**
* 首页统计数据业务层
*
* @author Bulbasaur
* @since 2020/12/15 17:57
*/
public interface IndexStatisticsService {
/**
* 获取首页统计数据
*
* @return 运营后台首页统计数据
*/
IndexStatisticsVO indexStatistics();
/**
* 商家首页统计数据
*
* @return 商家后台首页统计数据
*/
StoreIndexStatisticsVO storeIndexStatistics();
/**
* 消息通知
*
* @return 通知内容
*/
IndexNoticeVO indexNotice();
/**
* 查询热卖商品TOP10
*
* @param statisticsQueryParam 商品统计查询参数
* @return 热卖商品TOP10
*/
List<GoodsStatisticsDataVO> goodsStatistics(GoodsStatisticsQueryParam statisticsQueryParam);
/**
* 查询热卖店铺TOP10
* @param statisticsQueryParam 统计查询参数
*
* @return 当月的热卖店铺TOP10
*/
List<StoreStatisticsDataVO> storeStatistics(StatisticsQueryParam statisticsQueryParam);
}

View File

@ -0,0 +1,28 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.member.domain.po.Feedback;
/**
* 会员商品评价统计
*
* @author Bulbasaur
* @since 2020-02-25 14:10:16
*/
public interface MemberEvaluationStatisticsService extends IService<Feedback> {
/**
* 获取今天新增的评价数量
*
* @return 今日评价数量
*/
long todayMemberEvaluation();
/**
* 获取等待回复评价数量
*
* @return 等待回复评价数量
*/
long getWaitReplyNum();
}

View File

@ -0,0 +1,75 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.statistics.entity.dos.MemberStatisticsData;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import java.util.Date;
import java.util.List;
/**
* 会员统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface MemberStatisticsService extends IService<MemberStatisticsData> {
/**
* 获取会员数量
*
* @return 会员统计
*/
long getMemberCount();
/**
* 获取今日新增会员数量
*
* @return 今日新增会员数量
*/
long todayMemberNum();
/**
* 获取指定结束时间前的会员数量
*
* @param endTime
* @return
*/
long memberCount(Date endTime);
/**
* 当天活跃会员数量
*
* @param startTime
* @return
*/
long activeQuantity(Date startTime);
/**
* 时间段内新增会员数量
*
* @param endTime
* @param startTime
* @return
*/
long newlyAdded(Date endTime, Date startTime);
/**
* 根据参数查询这段时间的会员统计
*
* @param statisticsQueryParam
* @return
*/
List<MemberStatisticsData> statistics(StatisticsQueryParam statisticsQueryParam);
/**
* 查看会员数据分布
*
* @return 会员数据分布
*/
List<MemberDistributionVO> distribution();
}

View File

@ -0,0 +1,20 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.member.domain.po.Feedback;
/**
* 交易投诉统计
*
* @author paulG
* @since 2020/12/4
**/
public interface OrderComplaintStatisticsService extends IService<Feedback> {
/**
* 待处理投诉数量
*
* @return 待处理投诉数量
*/
long waitComplainNum();
}

View File

@ -0,0 +1,55 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.order.domain.entity.Order;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.OrderOverviewVO;
import com.wzj.soopin.statistics.entity.vo.OrderSimpleVO;
import com.wzj.soopin.statistics.entity.vo.OrderStatisticsDataVO;
import java.util.List;
/**
* 订单统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface OrderStatisticsService extends IService<Order> {
/**
* 订单统计概览
*
* @param statisticsQueryParam
* @return
*/
OrderOverviewVO overview(StatisticsQueryParam statisticsQueryParam);
/**
* 获取订单总数量
*
* @param orderStatus 订单状态
* @return 订单总数量
*/
long orderNum(String orderStatus);
/**
* 图表统计
*
* @param statisticsQueryParam 统计查询参数
* @return 订单总数量
*/
List<OrderStatisticsDataVO> statisticsChart(StatisticsQueryParam statisticsQueryParam);
/**
* 获取统计的订单
*
* @param statisticsQueryParam
* @param pageVO
* @return
*/
IPage<OrderSimpleVO> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO);
}

View File

@ -0,0 +1,58 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.statistics.entity.dos.PlatformViewData;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import com.wzj.soopin.statistics.entity.vo.OnlineMemberVO;
import com.wzj.soopin.statistics.entity.vo.PlatformViewVO;
import java.util.List;
/**
* 平台PV统计
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface PlatformViewService extends IService<PlatformViewData> {
/**
* 当前在线人数
*
* @return
*/
Long online();
/**
* 会员分布
*
* @return
*/
List<MemberDistributionVO> memberDistribution();
/**
* 在线人数记录
*
* @return
*/
List<OnlineMemberVO> statisticsOnline();
/**
* 数据查询
*
* @param queryParam
* @return
*/
List<PlatformViewVO> list(StatisticsQueryParam queryParam);
/**
* 查询累计访客数
*
* @param queryParam
* @return
*/
Integer countUv(StatisticsQueryParam queryParam);
}

View File

@ -0,0 +1,36 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.RefundOrderStatisticsDataVO;
/**
* 退款订单统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface RefundOrderStatisticsService extends IService<AccountBill> {
/**
* 查询订单统计分页
*
* @param statisticsQueryParam 查询参数
* @param pageVO 分页
* @return 退款统计
*/
IPage<RefundOrderStatisticsDataVO> getRefundOrderStatisticsData(PageVO pageVO, StatisticsQueryParam statisticsQueryParam);
/**
* 查询退款订单统计金额
*
* @param statisticsQueryParam 查询参数
* @return 退款统计金额
*/
Double getRefundOrderStatisticsPrice(StatisticsQueryParam statisticsQueryParam);
}

View File

@ -0,0 +1,70 @@
package com.wzj.soopin.statistics.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.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.CategoryStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.GoodsStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.OrderOverviewVO;
import com.wzj.soopin.statistics.entity.vo.StoreStatisticsDataVO;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 流水统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface StoreFlowStatisticsService extends IService<AccountBill> {
/**
* 查询热卖商品
* 查询TOP100的商品
*
* @param goodsStatisticsQueryParam 查询参数
* @param num 数量
* @return
*/
List<GoodsStatisticsDataVO> getGoodsStatisticsData(GoodsStatisticsQueryParam goodsStatisticsQueryParam, Integer num);
/**
* 查询行业统计
* 根据商品一级分类ID查询
*
* @param goodsStatisticsQueryParam 查询参数
* @return
*/
List<CategoryStatisticsDataVO> getCategoryStatisticsData(GoodsStatisticsQueryParam goodsStatisticsQueryParam);
/**
* 店铺流水 根据店铺 统计
*
* @param page
* @param queryWrapper
* @return
*/
List<StoreStatisticsDataVO> getStoreStatisticsData(Page page, QueryWrapper queryWrapper);
/**
* 查询今日付款统计
*
* @return 订单统计金额
*/
Map<String, Object> getOrderStatisticsPrice();
/**
* 订单统计数据概览
*
* @param dates
* @param orderOverviewVO
* @param statisticsQueryParam
*/
void overview(Date[] dates, OrderOverviewVO orderOverviewVO, StatisticsQueryParam statisticsQueryParam);
}

View File

@ -0,0 +1,34 @@
package com.wzj.soopin.statistics.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.system.domain.SysTenant;
/**
* 店铺统计业务层
*
* @author Bulbasaur
* @since 2020/12/9 11:06
*/
public interface StoreStatisticsService extends IService<SysTenant> {
/**
* 获取待审核店铺数量
*
* @return 待审核店铺数量
*/
long auditNum();
/**
* 获取所有店铺数量
*
* @return 店铺总数
*/
long storeNum();
/**
* 获取今天的店铺数量
*
* @return 今天的店铺数量
*/
long todayStoreNum();
}

View File

@ -0,0 +1,112 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.order.domain.entity.Aftersale;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.order.utils.PageUtil;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.mapper.AfterSaleStatisticsMapper;
import com.wzj.soopin.statistics.service.AfterSaleStatisticsService;
import com.wzj.soopin.statistics.util.StatisticsDateUtil;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 售后统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/9 11:30
*/
@Service
public class AfterSaleStatisticsServiceImpl extends ServiceImpl<AfterSaleStatisticsMapper, Aftersale> implements AfterSaleStatisticsService {
@Override
public long applyNum(String serviceType) {
// AuthUser authUser = Objects.requireNonNull(UserContext.getCurrentUser());
LambdaQueryWrapper<Aftersale> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(Aftersale::getServiceStatus, AfterSaleStatusEnum.APPLY.name());
// queryWrapper.eq(CharSequenceUtil.isNotEmpty(serviceType), AfterSale::getServiceType, serviceType);
// queryWrapper.eq(CharSequenceUtil.equals(authUser.getRole().name(), UserEnums.STORE.name()),
// AfterSale::getStoreId, authUser.getStoreId());
return this.count(queryWrapper);
}
@Override
public IPage<Aftersale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
LambdaQueryWrapper<Aftersale> queryWrapper = new LambdaQueryWrapper<>();
// Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
// queryWrapper.between(AfterSale::getCreateTime, dates[0], dates[1]);
// queryWrapper.eq(CharSequenceUtil.isNotEmpty(statisticsQueryParam.getStoreId()), AfterSale::getStoreId, statisticsQueryParam.getStoreId());
return this.page(PageUtil.initPage(pageVO), queryWrapper);
}
@Override
public void exportRefund(StatisticsQueryParam statisticsQueryParam, HttpServletResponse response) throws IOException {
// 构建查询条件
LambdaQueryWrapper<Aftersale> queryWrapper = new LambdaQueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between(Aftersale::getCreateTime, dates[0], dates[1]);
queryWrapper.eq(CharSequenceUtil.isNotEmpty(statisticsQueryParam.getStoreId()),
Aftersale::getTenantId, statisticsQueryParam.getStoreId());
// 查询数据
List<Aftersale> list = this.list(queryWrapper);
// 创建Excel工作簿
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("退单统计");
// 创建表头
Row headerRow = sheet.createRow(0);
String[] headers = {"商家名称", "商品名称", "售后单类型", "售后单状态", "退款时间", "申请退款金额", "申请原因", "实际金额"};
for (int i = 0; i < headers.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers[i]);
}
// 创建日期格式化对象
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// 填充数据行
int rowNum = 1;
for (Aftersale afterSale : list) {
Row row = sheet.createRow(rowNum++);
// row.createCell(0).setCellValue(afterSale.getStoreName() != null ? afterSale.getStoreName() : "");
// row.createCell(1).setCellValue(afterSale.getGoodsName() != null ? afterSale.getGoodsName() : "");
// row.createCell(2).setCellValue(afterSale.getServiceType() != null ? afterSale.getServiceType() : "");
// row.createCell(3).setCellValue(afterSale.getServiceStatus() != null ? afterSale.getServiceStatus() : "");
// row.createCell(4).setCellValue(afterSale.getCreateTime() != null ? dateFormat.format(afterSale.getCreateTime()) : "");
// row.createCell(5).setCellValue(afterSale.getApplyRefundPrice() != null ? afterSale.getApplyRefundPrice().toString() : "0");
// row.createCell(6).setCellValue(afterSale.getReason() != null ? afterSale.getReason() : "");
// row.createCell(7).setCellValue(afterSale.getActualRefundPrice() != null ? afterSale.getActualRefundPrice().toString() : "0");
}
// 设置响应头
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=退单统计.xlsx");
// 写入响应流
workbook.write(response.getOutputStream());
workbook.close();
}
}

View File

@ -0,0 +1,36 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.member.enums.AccountBillChangeTypeEnum;
import com.wzj.soopin.statistics.mapper.BillStatisticsMapper;
import com.wzj.soopin.statistics.service.BillStatisticsService;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* 结算单统计
*
* @author Chopper
* @since 2020/11/17 4:28 下午
*/
@Service
public class BillStatisticsServiceImpl extends ServiceImpl<BillStatisticsMapper, AccountBill> implements BillStatisticsService {
@Override
public long billNum(AccountBillChangeTypeEnum billStatusEnum) {
LambdaUpdateWrapper<AccountBill> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
// lambdaUpdateWrapper.eq(Bill::getBillStatus, billStatusEnum.name());
// lambdaUpdateWrapper.eq(CharSequenceUtil.equals(Objects.requireNonNull(UserContext.getCurrentUser()).getRole().name(), UserEnums.STORE.name()),
// Bill::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.count(lambdaUpdateWrapper);
}
}

View File

@ -0,0 +1,30 @@
package com.wzj.soopin.statistics.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.statistics.mapper.DistributionCashStatisticsMapper;
import com.wzj.soopin.statistics.service.DistributionCashStatisticsService;
import org.apache.commons.math3.analysis.function.Divide;
import org.springframework.stereotype.Service;
/**
* 分销佣金统计层实现
*
* @author pikachu
* @since 2020-03-126 18:04:56
*/
@Service
public class DistributionCashStatisticsServiceImpl extends ServiceImpl<DistributionCashStatisticsMapper, Divide>
implements DistributionCashStatisticsService {
@Override
public long newDistributionCash() {
QueryWrapper queryWrapper = Wrappers.query();
// queryWrapper.eq("distribution_cash_status", Withdr.APPLY.name());
return this.count(queryWrapper);
}
}

View File

@ -0,0 +1,54 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.goods.domain.entity.Product;
import com.wzj.soopin.statistics.mapper.GoodsStatisticsMapper;
import com.wzj.soopin.statistics.service.GoodsStatisticsService;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* 商品统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/9 11:30
*/
@Service
public class GoodsStatisticsServiceImpl extends ServiceImpl<GoodsStatisticsMapper, Product> implements GoodsStatisticsService {
// @Override
// public long goodsNum(Productstatus goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {
// LambdaQueryWrapper<Product> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(Goods::getDeleteFlag, false);
//
// if (goodsStatusEnum != null) {
// queryWrapper.eq(Goods::getMarketEnable, goodsStatusEnum.name());
// }
// if (goodsAuthEnum != null) {
// queryWrapper.eq(Goods::getAuthFlag, goodsAuthEnum.name());
// }
// AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
// queryWrapper.eq(CharSequenceUtil.equals(currentUser.getRole().name(), UserEnums.STORE.name()),
// Goods::getStoreId, currentUser.getStoreId());
// return this.count(queryWrapper);
//}
@Override
public long todayUpperNum() {
LambdaQueryWrapper<Product> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(Goods::getMarketEnable, GoodsStatusEnum.UPPER.name());
// queryWrapper.ge(Goods::getCreateTime, DateUtil.beginOfDay(new DateTime()));
return baseMapper.selectCount(queryWrapper);
}
}

View File

@ -0,0 +1,272 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wzj.soopin.order.emum.OrderStatusEnum;
import com.wzj.soopin.order.utils.BeanUtil;
import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.*;
import com.wzj.soopin.statistics.entity.vo.*;
import com.wzj.soopin.statistics.service.*;
import com.wzj.soopin.statistics.util.StatisticsDateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 首页统计数据业务层实现
*
* @author Bulbasaur
* @since 2020/12/15 17:57
*/
@Service
public class IndexStatisticsServiceImpl implements IndexStatisticsService {
/**
* 订单统计
*/
@Autowired
private OrderStatisticsService orderStatisticsService;
/**
* 会员统计
*/
@Autowired
private MemberStatisticsService memberStatisticsService;
/**
* 商品统计
*/
@Autowired
private GoodsStatisticsService goodsStatisticsService;
/**
* 商品统计
*/
@Autowired
private StoreFlowStatisticsService storeFlowStatisticsService;
/**
* 店铺
*/
@Autowired
private StoreStatisticsService storeStatisticsService;
/**
* 店铺
*/
@Autowired
private MemberEvaluationStatisticsService memberEvaluationStatisticsService;
/**
* 售后
*/
@Autowired
private AfterSaleStatisticsService afterSaleStatisticsService;
/**
* 投诉
*/
@Autowired
private OrderComplaintStatisticsService orderComplaintStatisticsService;
/**
* 分销员提现
*/
@Autowired
private DistributionCashStatisticsService distributionCashStatisticsService;
/**
* 平台PV统计
*/
@Autowired
private PlatformViewService platformViewService;
/**
* 结算单
*/
@Autowired
private BillStatisticsService billStatisticsService;
@Override
public IndexNoticeVO indexNotice() {
IndexNoticeVO indexNoticeVO = new IndexNoticeVO();
//商品审核
indexNoticeVO.setGoods(goodsStatisticsService.goodsNum(null, GoodsAuthEnum.TOBEAUDITED));
//店铺入驻审核
indexNoticeVO.setStore(storeStatisticsService.auditNum());
//售后申请
indexNoticeVO.setRefund(afterSaleStatisticsService.applyNum(null));
//投诉审核
indexNoticeVO.setComplain(orderComplaintStatisticsService.waitComplainNum());
//分销员提现审核
indexNoticeVO.setDistributionCash(distributionCashStatisticsService.newDistributionCash());
//待处理商家结算
indexNoticeVO.setWaitPayBill(billStatisticsService.billNum(BillStatusEnum.CHECK));
return indexNoticeVO;
}
@Override
public IndexStatisticsVO indexStatistics() {
//首页统计内容
IndexStatisticsVO indexStatisticsVO = new IndexStatisticsVO();
//获取总订单数量
indexStatisticsVO.setOrderNum(orderStatisticsService.orderNum(null));
//获取总会员数量
indexStatisticsVO.setMemberNum(memberStatisticsService.getMemberCount());
//获取总上架商品数量
indexStatisticsVO.setGoodsNum(goodsStatisticsService.goodsNum(GoodsStatusEnum.UPPER, GoodsAuthEnum.PASS));
//获取总店铺数量
indexStatisticsVO.setStoreNum(storeStatisticsService.storeNum());
//下单统计
Map<String, Object> map = storeFlowStatisticsService.getOrderStatisticsPrice();
//今日下单数
indexStatisticsVO.setTodayOrderNum(map.get("num") == null ? 0L : (Long) map.get("num"));
//今日下单金额
indexStatisticsVO.setTodayOrderPrice(map.get("price") == null ? 0D : (Double) map.get("price"));
//今日新增会员数量
indexStatisticsVO.setTodayMemberNum(memberStatisticsService.todayMemberNum());
//今日新增商品数量
indexStatisticsVO.setTodayGoodsNum(goodsStatisticsService.todayUpperNum());
//今日新增店铺数量
indexStatisticsVO.setTodayStoreNum(storeStatisticsService.todayStoreNum());
//今日新增评论数量
indexStatisticsVO.setTodayMemberEvaluation(memberEvaluationStatisticsService.todayMemberEvaluation());
//当前在线人数
indexStatisticsVO.setCurrentNumberPeopleOnline(platformViewService.online());
//流量统计
StatisticsQueryParam queryParam = new StatisticsQueryParam();
//今日uv
queryParam.setSearchType(SearchTypeEnum.TODAY.name());
indexStatisticsVO.setTodayUV(platformViewService.countUv(queryParam));
// 昨日访问数UV
queryParam.setSearchType(SearchTypeEnum.YESTERDAY.name());
indexStatisticsVO.setYesterdayUV(platformViewService.countUv(queryParam));
// 前七日访问数UV
queryParam.setSearchType(SearchTypeEnum.LAST_SEVEN.name());
indexStatisticsVO.setLastSevenUV(platformViewService.countUv(queryParam));
// 三十日访问数UV
queryParam.setSearchType(SearchTypeEnum.LAST_THIRTY.name());
indexStatisticsVO.setLastThirtyUV(platformViewService.countUv(queryParam));
return indexStatisticsVO;
}
@Override
public StoreIndexStatisticsVO storeIndexStatistics() {
// String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
StoreIndexStatisticsVO storeIndexStatisticsVO = new StoreIndexStatisticsVO();
//商品总数量
storeIndexStatisticsVO.setGoodsNum(goodsStatisticsService.goodsNum(GoodsStatusEnum.UPPER, null));
//订单总数量订单总金额
Map<String, Object> map = storeFlowStatisticsService.getOrderStatisticsPrice();
storeIndexStatisticsVO.setOrderNum(Convert.toInt(map.get("num").toString()));
storeIndexStatisticsVO.setOrderPrice(map.get("price") != null ? Double.parseDouble(map.get("price").toString()) : 0.0);
//访问量
StatisticsQueryParam queryParam = new StatisticsQueryParam();
queryParam.setSearchType(SearchTypeEnum.TODAY.name());
// queryParam.setStoreId(storeId);
PlatformViewVO platformViewVO = platformViewService.list(queryParam).get(0);
storeIndexStatisticsVO.setStoreUV(platformViewVO.getUvNum().intValue());
//待付款订单数量
storeIndexStatisticsVO.setUnPaidOrder(orderStatisticsService.orderNum(OrderStatusEnum.UNPAID.name()));
//待核销订单数量
storeIndexStatisticsVO.setUnDeliveredOrder(orderStatisticsService.orderNum(OrderStatusEnum.VERIFY.name()));
//订单数量
storeIndexStatisticsVO.setDeliveredOrder(orderStatisticsService.orderNum(OrderStatusEnum.CLOSED.name()));
//待处理退货数量
storeIndexStatisticsVO.setReturnGoods(afterSaleStatisticsService.applyNum(AfterSaleTypeEnum.RETURN_GOODS.name()));
//待处理退款数量
storeIndexStatisticsVO.setReturnMoney(afterSaleStatisticsService.applyNum(AfterSaleTypeEnum.RETURN_MONEY.name()));
//待回复评价数量
storeIndexStatisticsVO.setMemberEvaluation(memberEvaluationStatisticsService.getWaitReplyNum());
//待处理投诉数量
storeIndexStatisticsVO.setComplaint(orderComplaintStatisticsService.waitComplainNum());
//待上架商品数量
storeIndexStatisticsVO.setWaitUpper(goodsStatisticsService.goodsNum(GoodsStatusEnum.DOWN, null));
//待审核商品数量
storeIndexStatisticsVO.setWaitAuth(goodsStatisticsService.goodsNum(null, GoodsAuthEnum.TOBEAUDITED));
//可参与秒杀活动数量
//待处理商家结算
storeIndexStatisticsVO.setWaitPayBill(billStatisticsService.billNum(BillStatusEnum.OUT));
return storeIndexStatisticsVO;
}
@Override
public List<GoodsStatisticsDataVO> goodsStatistics(GoodsStatisticsQueryParam statisticsQueryParam) {
//查询商品
return storeFlowStatisticsService.getGoodsStatisticsData(statisticsQueryParam, 10);
}
@Override
public List<StoreStatisticsDataVO> storeStatistics(StatisticsQueryParam statisticsQueryParam) {
QueryWrapper queryWrapper = Wrappers.query();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
Date startTime = dates[0], endTime = dates[1];
queryWrapper.between("create_time", startTime, endTime);
queryWrapper.orderByDesc("price");
queryWrapper.groupBy("store_id,store_name ");
queryWrapper.eq("flow_type", FlowTypeEnum.PAY.name());
//查询前十条记录
Page page = new Page<StoreStatisticsDataVO>(1, 10);
return storeFlowStatisticsService.getStoreStatisticsData(page, queryWrapper);
}
/**
* 获取当月查询参数
*
* @return 当月查询参数
*/
private StatisticsQueryParam getStatisticsQueryParam() {
StatisticsQueryParam statisticsQueryParam = new StatisticsQueryParam();
return statisticsQueryParam;
}
/**
* 获取当月订单查询条件
*
* @return 当月订单查询参数
*/
private GoodsStatisticsQueryParam getGoodsStatisticsQueryParam() {
GoodsStatisticsQueryParam goodsStatisticsQueryParam = new GoodsStatisticsQueryParam();
StatisticsQueryParam statisticsQueryParam = this.getStatisticsQueryParam();
BeanUtil.copyProperties(goodsStatisticsQueryParam, statisticsQueryParam);
//如果登录是商家的账号获取商家相关统计内容
// if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) {
// goodsStatisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
// }
DateTime dateTime = new DateTime();
goodsStatisticsQueryParam.setYear(dateTime.year());
goodsStatisticsQueryParam.setMonth(dateTime.monthBaseOne());
return goodsStatisticsQueryParam;
}
}

View File

@ -0,0 +1,42 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.member.domain.po.Feedback;
import com.wzj.soopin.statistics.mapper.MemberEvaluationStatisticsMapper;
import com.wzj.soopin.statistics.service.MemberEvaluationStatisticsService;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* 会员商品评价业务层实现
*
* @author Bulbasaur
* @since 2020-02-25 14:10:16
*/
@Service
public class MemberEvaluationStatisticsServiceImpl extends ServiceImpl<MemberEvaluationStatisticsMapper, Feedback> implements MemberEvaluationStatisticsService {
@Override
public long todayMemberEvaluation() {
return this.count(new LambdaQueryWrapper<Feedback>().ge(Feedback::getCreateTime, DateUtil.beginOfDay(new DateTime())));
}
@Override
public long getWaitReplyNum() {
QueryWrapper<Feedback> queryWrapper = Wrappers.query();
// queryWrapper.eq(CharSequenceUtil.equals(Objects.requireNonNull(UserContext.getCurrentUser()).getRole().name(), UserEnums.STORE.name()),
// "store_id", UserContext.getCurrentUser().getStoreId());
// queryWrapper.eq("reply_status", false);
return this.count(queryWrapper);
}
}

View File

@ -0,0 +1,98 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.statistics.entity.dos.MemberStatisticsData;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.SearchTypeEnum;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import com.wzj.soopin.statistics.mapper.MemberStatisticsMapper;
import com.wzj.soopin.statistics.service.MemberStatisticsService;
import com.wzj.soopin.statistics.util.StatisticsDateUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 会员统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/9 18:33
*/
@Service
public class MemberStatisticsServiceImpl extends ServiceImpl<MemberStatisticsMapper, MemberStatisticsData> implements MemberStatisticsService {
@Override
public long getMemberCount() {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("disabled", true);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long todayMemberNum() {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.ge("create_time", DateUtil.beginOfDay(new Date()));
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long memberCount(Date endTime) {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.le("create_time", endTime);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long activeQuantity(Date startTime) {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.ge("last_login_date", startTime);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long newlyAdded(Date startTime, Date endTime) {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.between("create_time", startTime, endTime);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public List<MemberStatisticsData> statistics(StatisticsQueryParam statisticsQueryParam) {
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
Date startTime = dates[0];
Date endTime = dates[1];
//如果统计今天则自行构造数据
if (statisticsQueryParam.getSearchType().equals(SearchTypeEnum.TODAY.name())) {
//构建数据然后返回集合提供给前端展示
MemberStatisticsData memberStatisticsData = new MemberStatisticsData();
memberStatisticsData.setMemberCount(this.memberCount(endTime));
memberStatisticsData.setCreateDate(startTime);
memberStatisticsData.setActiveQuantity(this.activeQuantity(startTime));
memberStatisticsData.setNewlyAdded(this.newlyAdded(startTime, endTime));
List result = new ArrayList<MemberStatisticsData>();
result.add(memberStatisticsData);
return result;
}
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.between("create_date", startTime, endTime);
return list(queryWrapper);
}
@Override
public List<MemberDistributionVO> distribution() {
return this.baseMapper.distribution();
}
}

View File

@ -0,0 +1,31 @@
package com.wzj.soopin.statistics.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.member.domain.po.Feedback;
import com.wzj.soopin.member.mapper.FeedbackMapper;
import com.wzj.soopin.statistics.service.OrderComplaintStatisticsService;
import org.springframework.stereotype.Service;
/**
* 交易投诉业务层实现
*
* @author paulG
* @since 2020/12/5
**/
@Service
public class OrderComplaintStatisticsServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> implements OrderComplaintStatisticsService {
@Override
public long waitComplainNum() {
QueryWrapper queryWrapper = Wrappers.query();
// queryWrapper.ne("complain_status", ComplaintStatusEnum.COMPLETE.name());
// queryWrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()),
// "store_id", UserContext.getCurrentUser().getStoreId());
return this.count(queryWrapper);
}
}

View File

@ -0,0 +1,179 @@
package com.wzj.soopin.statistics.service.impl;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.order.domain.entity.Order;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.order.utils.PageUtil;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.FlowTypeEnum;
import com.wzj.soopin.statistics.entity.enums.PayStatusEnum;
import com.wzj.soopin.statistics.entity.vo.OrderOverviewVO;
import com.wzj.soopin.statistics.entity.vo.OrderSimpleVO;
import com.wzj.soopin.statistics.entity.vo.OrderStatisticsDataVO;
import com.wzj.soopin.statistics.mapper.OrderStatisticsMapper;
import com.wzj.soopin.statistics.service.OrderStatisticsService;
import com.wzj.soopin.statistics.service.PlatformViewService;
import com.wzj.soopin.statistics.service.StoreFlowStatisticsService;
import com.wzj.soopin.statistics.util.CurrencyUtil;
import com.wzj.soopin.statistics.util.StatisticsDateUtil;
import io.micrometer.common.util.StringUtils;
import org.dromara.common.core.domain.event.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* 订单统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/9 17:16
*/
@Service
public class OrderStatisticsServiceImpl extends ServiceImpl<OrderStatisticsMapper, Order> implements OrderStatisticsService {
/**
* 平台PV统计
*/
@Autowired
private PlatformViewService platformViewService;
@Autowired
private StoreFlowStatisticsService storeFlowStatisticsService;
@Override
public OrderOverviewVO overview(StatisticsQueryParam statisticsQueryParam) {
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
OrderOverviewVO orderOverviewVO = new OrderOverviewVO();
/**
* 组织统计初始化
*/
storeFlowStatisticsService.overview(dates, orderOverviewVO, statisticsQueryParam);
//访客数
Integer uv = platformViewService.countUv(statisticsQueryParam);
if (uv != null) {
orderOverviewVO.setUvNum(uv.longValue());
}
//数据运算转换率比例相关
conversionRateOperation(orderOverviewVO);
return orderOverviewVO;
}
/**
* 运算转换率
*
* @param orderOverviewVO 订单统计视图
*/
private void conversionRateOperation(OrderOverviewVO orderOverviewVO) {
//下单转换率 订单数/UV
Double orderConversionRate = CurrencyUtil.div(orderOverviewVO.getOrderNum(), orderOverviewVO.getUvNum(), 4);
if (orderConversionRate > 1) {
orderConversionRate = 1d;
}
orderOverviewVO.setOrderConversionRate(CurrencyUtil.mul(orderConversionRate, 100) + "%");
//付款转换率 付款订单数/订单数
Double paymentsConversionRate = CurrencyUtil.div(orderOverviewVO.getPaymentOrderNum(), orderOverviewVO.getOrderNum(), 4);
if (paymentsConversionRate > 1) {
paymentsConversionRate = 1d;
}
orderOverviewVO.setPaymentsConversionRate(CurrencyUtil.mul(paymentsConversionRate, 100) + "%");
//整体转换率 付款数/UV
Double overallConversionRate = CurrencyUtil.div(orderOverviewVO.getPaymentOrderNum(), orderOverviewVO.getUvNum(), 4);
if (overallConversionRate > 1) {
overallConversionRate = 1d;
}
orderOverviewVO.setOverallConversionRate(CurrencyUtil.mul(overallConversionRate, 100) + "%");
}
@Override
public long orderNum(String orderStatus) {
LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CharSequenceUtil.isNotEmpty(orderStatus), Order::getStatus, orderStatus);
// queryWrapper.eq(CharSequenceUtil.equals(Objects.requireNonNull(UserContext.getCurrentUser()).getRole().name(), UserEnums.STORE.name()),
// Order::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.count(queryWrapper);
}
@Override
public List<OrderStatisticsDataVO> statisticsChart(StatisticsQueryParam statisticsQueryParam) {
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
QueryWrapper queryWrapper = new QueryWrapper();
//已支付
queryWrapper.eq("pay_status", PayStatusEnum.PAID.name());
//选择商家判定
queryWrapper.eq(StringUtils.isNotEmpty(statisticsQueryParam.getStoreId()), "store_id", statisticsQueryParam.getStoreId());
// 查询时间区间
queryWrapper.between("create_time", dates[0], dates[1]);
// 格式化时间
queryWrapper.groupBy("DATE_FORMAT(create_time,'%Y-%m-%d')");
List<OrderStatisticsDataVO> orderStatisticsDataVOS = this.baseMapper.getOrderStatisticsData(queryWrapper);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dates[0]);
List<OrderStatisticsDataVO> result = new ArrayList<>();
//时间判定将数据填充好
//如果当前的时间在结束时间之前
while (calendar.getTime().before(dates[1])) {
OrderStatisticsDataVO item = null;
//判定是否已经有这一天的数据
for (OrderStatisticsDataVO orderStatisticsDataVO : orderStatisticsDataVOS) {
if (orderStatisticsDataVO.getCreateTime().equals(calendar.getTime())) {
item = orderStatisticsDataVO;
}
}
//如果数据不存在则进行数据填充
if (item == null) {
item = new OrderStatisticsDataVO();
item.setPrice(0d);
item.setCreateTime(calendar.getTime());
}
result.add(item);
//增加时间
calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + 1);
}
return result;
}
@Override
public IPage<OrderSimpleVO> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
QueryWrapper<OrderSimpleVO> queryWrapper = new QueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between("o.create_time", dates[0], dates[1]);
queryWrapper.eq(StringUtils.isNotEmpty(statisticsQueryParam.getStoreId()),
"o.store_id", statisticsQueryParam.getStoreId());
queryWrapper.eq("o.delete_flag", false);
queryWrapper.groupBy("o.id");
queryWrapper.orderByDesc("o.id");
return this.baseMapper.queryByParams(PageUtil.initPage(pageVO), queryWrapper);
}
private QueryWrapper getQueryWrapper(StatisticsQueryParam statisticsQueryParam) {
QueryWrapper queryWrapper = Wrappers.query();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between("create_time", dates[0], dates[1]);
//设置店铺ID
queryWrapper.eq(StringUtils.isNotEmpty(statisticsQueryParam.getStoreId()), "store_id", statisticsQueryParam.getStoreId());
//设置为付款查询
queryWrapper.eq("flow_type", FlowTypeEnum.PAY.name());
return queryWrapper;
}
}

View File

@ -0,0 +1,301 @@
package com.wzj.soopin.statistics.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.protobuf.ServiceException;
import com.wzj.soopin.statistics.entity.dos.PlatformViewData;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.SearchTypeEnum;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import com.wzj.soopin.statistics.entity.vo.OnlineMemberVO;
import com.wzj.soopin.statistics.entity.vo.PlatformViewVO;
import com.wzj.soopin.statistics.mapper.PlatformViewMapper;
import com.wzj.soopin.statistics.service.MemberStatisticsService;
import com.wzj.soopin.statistics.service.PlatformViewService;
import com.wzj.soopin.statistics.util.CurrencyUtil;
import com.wzj.soopin.statistics.util.StatisticsDateUtil;
import com.wzj.soopin.statistics.util.StatisticsProperties;
import com.wzj.soopin.statistics.util.StatisticsSuffix;
import org.apache.commons.lang3.StringUtils;
import org.dromara.common.core.constant.CachePrefix;
import org.dromara.common.core.constant.ResultCode;
import org.dromara.common.redis.redis.RedisCache;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import static com.wzj.soopin.statistics.entity.enums.SearchTypeEnum.TODAY;
/**
* 流量统计
*
* @author Chopper
* @version v1.0
* @since v7.0
* 2021/1/18 12:07
*/
@Service
public class PlatformViewServiceImpl extends ServiceImpl<PlatformViewMapper, PlatformViewData> implements PlatformViewService {
/**
* 在线人数统计
*/
@Autowired
private StatisticsProperties statisticsProperties;
/**
* 会员
*/
@Autowired
private MemberStatisticsService memberStatisticsService;
/**
* 缓存
*/
@Autowired
private RedisCache cache;
/**
* 平台流量统计
*/
@Resource
private PlatformViewMapper platformViewMapper;
@Override
public Long online() {
Object object = cache.getCacheObject(CachePrefix.ONLINE_NUM.getPrefix());
if (null != object) {
return (Long) object;
}
//这里统计的是有效的accessToken 如果需要数据精确需要调整accessToken的有效时间开发人员建议2小时误差较为合适
// Long num = Long.valueOf(cache.keys(CachePrefix.ACCESS_TOKEN.getPrefix(UserEnums.MEMBER) + "*").size());
// cache.put(CachePrefix.ONLINE_NUM.getPrefix(), num, statisticsProperties.getCurrentOnlineUpdate().longValue());
// return num;
return 0L;
}
@Override
public List<MemberDistributionVO> memberDistribution() {
Object object = cache.getCacheObject(CachePrefix.MEMBER_DISTRIBUTION.getPrefix());
if (null != object) {
return (List<MemberDistributionVO>) object;
}
List<MemberDistributionVO> memberDistributionVOS = memberStatisticsService.distribution();
//统计总数
int count = 0;
for (MemberDistributionVO vo : memberDistributionVOS) {
count += vo.getNum();
}
//初始化数据填充枚举和比例
for (MemberDistributionVO vo : memberDistributionVOS) {
vo.setProportion(CurrencyUtil.div(vo.getNum(), count, 4));
//客户端填充
// if (StringUtils.isNotEmpty(vo.getClientEnum())) {
// vo.setClientEnum(ClientTypeEnum.valueOf(vo.getClientEnum()).clientName());
// } else {
// vo.setClientEnum(ClientTypeEnum.UNKNOWN.clientName());
// }
}
cache.setCacheObject(CachePrefix.MEMBER_DISTRIBUTION.getPrefix(), memberDistributionVOS);
return memberDistributionVOS;
}
@Override
public List<OnlineMemberVO> statisticsOnline() {
Object object = cache.getCacheObject(CachePrefix.ONLINE_MEMBER.getPrefix());
List<OnlineMemberVO> result = new ArrayList<>();
if (object != null) {
result = (List<OnlineMemberVO>) object;
}
return this.initData(result);
}
/**
* 在线会员数据初始化
*
* @param source
* @return
*/
private List<OnlineMemberVO> initData(List<OnlineMemberVO> source) {
List<OnlineMemberVO> onlineMemberVOS = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - statisticsProperties.getOnlineMember() - 1);
//循环填充数据
for (int i = 0; i < statisticsProperties.getOnlineMember(); i++) {
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) + 1);
OnlineMemberVO exitOnlineNum = null;
for (int j = 0; j < source.size(); j++) {
if (source.get(j).getDate().equals(calendar.getTime())) {
exitOnlineNum = source.get(j);
}
}
if (exitOnlineNum == null) {
onlineMemberVOS.add(new OnlineMemberVO(calendar.getTime(), 0));
} else {
onlineMemberVOS.add(exitOnlineNum);
}
}
return onlineMemberVOS;
}
@Override
public List<PlatformViewVO> list(StatisticsQueryParam queryParam) {
List<PlatformViewVO> result = new ArrayList<>();
//查询开始时间和结束时间用于数据库查询
Date endTime = null, startTime = null;
//搜索类型判定如果不为空则按照搜索类型进行查询
if (StringUtils.isNotEmpty(queryParam.getSearchType())) {
SearchTypeEnum searchTypeEnum = SearchTypeEnum.valueOf(queryParam.getSearchType());
switch (searchTypeEnum) {
case TODAY:
PlatformViewVO today = new PlatformViewVO();
//查询 平台流量
if (StringUtils.isEmpty(queryParam.getStoreId())) {
//设置PV UV属性
// String pv = cache.getString(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix());
// if (pv == null) {
// pv = "0";
// }
// today.setPvNum(Long.valueOf(pv));
// today.setUvNum(cache.counter(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix()).longValue());
}
//店铺流量
else {
//设置PV UV属性
// String pv = cache.getString(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(queryParam.getStoreId()));
// if (pv == null) {
// pv = "0";
// }
// today.setPvNum(Long.valueOf(pv));
// today.setUvNum(cache.counter(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(queryParam.getStoreId())).longValue());
}
today.setDate(new Date());
result.add(today);
break;
case YESTERDAY:
case LAST_SEVEN:
case LAST_THIRTY: {
Date[] dates = StatisticsDateUtil.getDateArray(searchTypeEnum);
endTime = dates[1];
startTime = dates[0];
break;
}
default:
// throw new ServiceException(ResultCode.ERROR.name());
break;
}
} else {
//根据查询时间来确定查询参数
Integer year = queryParam.getYear();
Integer month = queryParam.getMonth();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(year, month - 1, 1);
startTime = calendar.getTime();
calendar.set(year, month, -1);
endTime = calendar.getTime();
}
//时间不为空则按照时间开始数据查询
if (startTime != null) {
LambdaQueryWrapper<PlatformViewData> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.between(PlatformViewData::getDate, startTime, endTime);
lambdaQueryWrapper.eq(PlatformViewData::getStoreId, StringUtils.isEmpty(queryParam.getStoreId()) ?
"-1" : queryParam.getStoreId());
List<PlatformViewData> dataList = this.list(lambdaQueryWrapper);
result = builderVOS(startTime, endTime, dataList);
}
return result;
}
@Override
public Integer countUv(StatisticsQueryParam queryParam) {
Date[] dates = StatisticsDateUtil.getDateArray(queryParam);
//获取当前时间
Calendar calendar = Calendar.getInstance();
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
//如果是今天的统计则从redis 中拿否则从数据库中拿
if (dates[0].equals(calendar.getTime())) {
// if (StringUtils.isNotEmpty(queryParam.getStoreId())) {
// return cache.(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(queryParam.getStoreId())).intValue();
// }
// return cache.counter(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix()).intValue();
return null;
} else {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.between("date", dates[0], dates[1]);
//根据店铺查询判定如果有则店铺查询如果没有则根据商家查询
if (StringUtils.isNotEmpty(queryParam.getStoreId())) {
queryWrapper.eq("store_id", queryParam.getStoreId());
} else {
queryWrapper.eq("store_id", -1);
}
return platformViewMapper.count(queryWrapper);
}
}
/**
* 根据查询条件创建数据
*
* @param startDate
* @param endDate
* @param dataList
* @return
*/
private List<PlatformViewVO> builderVOS(Date startDate, Date endDate, List<PlatformViewData> dataList) {
Calendar startTime = Calendar.getInstance();
startTime.setTime(startDate);
Calendar endTime = Calendar.getInstance();
endTime.setTime(endDate);
List<PlatformViewVO> result = new ArrayList<>();
//构造所有需要统计展示等流量数据
List<Date> listDate = new ArrayList<>();
while (startTime.before(endTime) || startTime.getTime().equals(endTime.getTime())) {
listDate.add(startTime.getTime());
startTime.set(Calendar.DAY_OF_MONTH, startTime.get(Calendar.DAY_OF_MONTH) + 1);
}
//根据时间集匹配查询到等数据构建返回等VO
listDate.forEach(date -> {
PlatformViewVO platformViewVO = new PlatformViewVO(date);
dataList.forEach(platformViewData -> {
if (platformViewData.getDate().equals(date)) {
BeanUtils.copyProperties(platformViewData, platformViewVO);
}
});
//没有匹配到数据库查询的数据则初始化数据
result.add(platformViewVO);
});
return result;
}
}

View File

@ -0,0 +1,63 @@
package com.wzj.soopin.statistics.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.order.domain.vo.PageVO;
import com.wzj.soopin.order.utils.DateUtil;
import com.wzj.soopin.order.utils.PageUtil;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.FlowTypeEnum;
import com.wzj.soopin.statistics.entity.enums.TimeTypeEnum;
import com.wzj.soopin.statistics.entity.vo.RefundOrderStatisticsDataVO;
import com.wzj.soopin.statistics.mapper.RefundOrderStatisticsMapper;
import com.wzj.soopin.statistics.service.RefundOrderStatisticsService;
import io.micrometer.common.util.StringUtils;
import org.springframework.stereotype.Service;
/**
* 退款订单统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/10 11:30
*/
@Service
public class RefundOrderStatisticsServiceImpl extends ServiceImpl<RefundOrderStatisticsMapper, AccountBill> implements RefundOrderStatisticsService {
@Override
public IPage<RefundOrderStatisticsDataVO> getRefundOrderStatisticsData(PageVO pageVO, StatisticsQueryParam statisticsQueryParam) {
QueryWrapper queryWrapper = getQueryWrapper(statisticsQueryParam);
return this.baseMapper.getRefundStatisticsData(PageUtil.initPage(pageVO), queryWrapper);
}
@Override
public Double getRefundOrderStatisticsPrice(StatisticsQueryParam statisticsQueryParam) {
QueryWrapper queryWrapper = getQueryWrapper(statisticsQueryParam);
queryWrapper.select("SUM(final_price) AS price");
return (Double) this.getMap(queryWrapper).get("price");
}
private QueryWrapper getQueryWrapper(StatisticsQueryParam statisticsQueryParam) {
QueryWrapper queryWrapper = Wrappers.query();
//判断搜索类型是
if (statisticsQueryParam.getTimeType().equals(TimeTypeEnum.MONTH.name())) {
queryWrapper.between("create_time", DateUtil.getBeginTime(statisticsQueryParam.getYear(), statisticsQueryParam.getMonth()), DateUtil.getEndTime(statisticsQueryParam.getYear(), statisticsQueryParam.getMonth()));
} else {
queryWrapper.between("create_time", DateUtil.getBeginTime(statisticsQueryParam.getYear(), 1), DateUtil.getEndTime(statisticsQueryParam.getYear(), 12));
}
//设置店铺ID
queryWrapper.eq(!StringUtils.isEmpty(statisticsQueryParam.getStoreId()), "store_id", statisticsQueryParam.getStoreId());
//设置为退款查询
queryWrapper.eq("flow_type", FlowTypeEnum.REFUND);
return queryWrapper;
}
}

View File

@ -0,0 +1,220 @@
package com.wzj.soopin.statistics.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.protobuf.ServiceException;
import com.wzj.soopin.member.domain.po.AccountBill;
import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.enums.FlowTypeEnum;
import com.wzj.soopin.statistics.entity.enums.StatisticsQuery;
import com.wzj.soopin.statistics.entity.vo.CategoryStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.GoodsStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.OrderOverviewVO;
import com.wzj.soopin.statistics.entity.vo.StoreStatisticsDataVO;
import com.wzj.soopin.statistics.mapper.StoreFlowStatisticsMapper;
import com.wzj.soopin.statistics.service.OrderStatisticsService;
import com.wzj.soopin.statistics.service.StoreFlowStatisticsService;
import com.wzj.soopin.statistics.util.StatisticsDateUtil;
import io.micrometer.common.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 商品统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/9 11:30
*/
@Service
public class StoreFlowStatisticsServiceImpl extends ServiceImpl<StoreFlowStatisticsMapper, AccountBill> implements StoreFlowStatisticsService {
@Autowired
private OrderStatisticsService orderStatisticsService;
@Override
public List<GoodsStatisticsDataVO> getGoodsStatisticsData(GoodsStatisticsQueryParam goodsStatisticsQueryParam, Integer num) {
//获取查询条件
QueryWrapper queryWrapper = getQueryWrapper(goodsStatisticsQueryParam);
//根据商品分组
queryWrapper.groupBy("goods_id");
queryWrapper.groupBy("goods_name");
queryWrapper.eq(!StringUtils.isEmpty(goodsStatisticsQueryParam.getStoreId()), "store_id", goodsStatisticsQueryParam.getStoreId());
//查询前X记录
Page page = new Page<GoodsStatisticsDataVO>(1, num);
return this.baseMapper.getGoodsStatisticsData(page, queryWrapper);
}
@Override
public List<CategoryStatisticsDataVO> getCategoryStatisticsData(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
//获取查询条件
QueryWrapper queryWrapper = getQueryWrapper(goodsStatisticsQueryParam);
//根据分类分组
queryWrapper.groupBy("category_id");
return this.baseMapper.getCateGoryStatisticsData(queryWrapper);
}
@Override
public List<StoreStatisticsDataVO> getStoreStatisticsData(Page page, QueryWrapper queryWrapper) {
return this.baseMapper.getStoreStatisticsData(page, queryWrapper);
}
@Override
public Map<String, Object> getOrderStatisticsPrice() {
QueryWrapper queryWrapper = Wrappers.query();
//支付订单
// queryWrapper.eq("flow_type", FlowTypeEnum.PAY.name());
//商家查询则增加商家判定
// AuthUser authUser = UserContext.getCurrentUser();
// if (authUser.getRole().equals(UserEnums.STORE)) {
// queryWrapper.eq("store_id", authUser.getStoreId());
// }
//大于今天凌晨
// queryWrapper.ge("create_time", cn.lili.common.utils.DateUtil.startOfTodDayTime());
queryWrapper.select("SUM(final_price) AS price , COUNT(0) AS num");
return this.getMap(queryWrapper);
}
@Override
public void overview(Date[] dates, OrderOverviewVO orderOverviewVO, StatisticsQueryParam statisticsQueryParam) {
//下单统计
initOrder(dates, orderOverviewVO, statisticsQueryParam);
//付款统计
initPayment(dates, orderOverviewVO, statisticsQueryParam);
//退单统计
initAfterSale(dates, orderOverviewVO, statisticsQueryParam);
}
/**
* 订单统计-下单属性填充
*
* @param dates
* @param orderOverviewVO
*/
private void initOrder(Date[] dates, OrderOverviewVO orderOverviewVO, StatisticsQueryParam statisticsQueryParam) {
//构建查询条件
QueryWrapper queryWrapper = Wrappers.query();
//时间区间
queryWrapper.between("create_time", dates[0], dates[1]);
//如果有店铺id传入则查询店铺
if (StringUtils.isNotEmpty(statisticsQueryParam.getStoreId())) {
queryWrapper.eq("store_id", statisticsQueryParam.getStoreId());
}
//查询流水金额和订单数量
queryWrapper.select("SUM(flow_price) AS price , COUNT(0) AS num");
//获取查询结果
Map order = orderStatisticsService.getMap(queryWrapper);
//赋予订单数和流水金额
orderOverviewVO.setOrderNum(order != null && order.containsKey("num") ? (Long) order.get("num") : 0L);
orderOverviewVO.setOrderAmount(order != null && order.containsKey("price") ? (double) order.get("price") : 0L);
//查询下单人数
queryWrapper = Wrappers.query();
//时间区间
queryWrapper.between("create_time", dates[0], dates[1]);
//如果有店铺id传入则查询店铺
if (StringUtils.isNotEmpty(statisticsQueryParam.getStoreId())) {
queryWrapper.eq("store_id", statisticsQueryParam.getStoreId());
}
//查询下单人数的sql
queryWrapper.select("count(DISTINCT member_id) AS num");
//获取查询结果
Map memberNum = this.getMap(queryWrapper);
//写入下单人数
orderOverviewVO.setOrderMemberNum(memberNum != null && memberNum.containsKey("num") ? (Long) memberNum.get("num") : 0L);
}
/**
* 订单统计-付款属性填充
*
* @param dates
* @param orderOverviewVO
*/
private void initPayment(Date[] dates, OrderOverviewVO orderOverviewVO, StatisticsQueryParam statisticsQueryParam) {
//付款订单数付款金额
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.between("create_time", dates[0], dates[1]);
//如果有店铺id传入则查询店铺
if (StringUtils.isNotEmpty(statisticsQueryParam.getStoreId())) {
queryWrapper.eq("store_id", statisticsQueryParam.getStoreId());
}
queryWrapper.select("SUM(final_price) AS price , COUNT(0) AS num");
queryWrapper.eq("flow_type", FlowTypeEnum.PAY.name());
Map payment = this.getMap(queryWrapper);
orderOverviewVO.setPaymentOrderNum(payment != null && payment.containsKey("num") ? (Long) payment.get("num") : 0L);
orderOverviewVO.setPaymentAmount(payment != null && payment.containsKey("price") ? (Double) payment.get("price") : 0D);
//付款人数
queryWrapper = Wrappers.query();
queryWrapper.between("create_time", dates[0], dates[1]);
//如果有店铺id传入则查询店铺
if (StringUtils.isNotEmpty(statisticsQueryParam.getStoreId())) {
queryWrapper.eq("store_id", statisticsQueryParam.getStoreId());
}
queryWrapper.select("COUNT(0) AS num");
queryWrapper.groupBy("member_id");
Map paymentMemberNum = this.getMap(queryWrapper);
orderOverviewVO.setPaymentsNum(paymentMemberNum != null && paymentMemberNum.containsKey("num") ? (Long) paymentMemberNum.get("num") : 0L);
}
/**
* 订单统计-付款属性填充
*
* @param dates
* @param orderOverviewVO
*/
private void initAfterSale(Date[] dates, OrderOverviewVO orderOverviewVO, StatisticsQueryParam statisticsQueryParam) {
//付款订单数付款金额
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.between("create_time", dates[0], dates[1]);
queryWrapper.select("SUM(final_price) AS price , COUNT(0) AS num");
//如果有店铺id传入则查询店铺
if (StringUtils.isNotEmpty(statisticsQueryParam.getStoreId())) {
queryWrapper.eq("store_id", statisticsQueryParam.getStoreId());
}
queryWrapper.eq("flow_type", FlowTypeEnum.REFUND.name());
Map payment = this.getMap(queryWrapper);
orderOverviewVO.setRefundOrderNum(payment != null && payment.containsKey("num") ? (Long) payment.get("num") : 0L);
orderOverviewVO.setRefundOrderPrice(payment != null && payment.containsKey("price") ? (Double) payment.get("price") : 0D);
}
/**
* 组织查询条件
*
* @param goodsStatisticsQueryParam
* @return
*/
private QueryWrapper getQueryWrapper(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
QueryWrapper queryWrapper = Wrappers.query();
//判断搜索类型是
Date[] date = StatisticsDateUtil.getDateArray(goodsStatisticsQueryParam);
queryWrapper.between("create_time", date[0], date[1]);
//判断是按照数量统计还是按照金额统计
if (goodsStatisticsQueryParam.getType().equals(StatisticsQuery.PRICE.name())) {
queryWrapper.orderByDesc("price");
} else {
queryWrapper.orderByDesc("num");
}
//设置为付款查询
queryWrapper.eq("flow_type", FlowTypeEnum.PAY.name());
return queryWrapper;
}
}

View File

@ -0,0 +1,44 @@
package com.wzj.soopin.statistics.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.statistics.mapper.StoreStatisticsMapper;
import com.wzj.soopin.statistics.service.StoreStatisticsService;
import org.dromara.system.domain.SysTenant;
import org.springframework.stereotype.Service;
/**
* 商品统计业务层实现
*
* @author Bulbasaur
* @since 2020/12/9 11:30
*/
@Service
public class StoreStatisticsServiceImpl extends ServiceImpl<StoreStatisticsMapper, SysTenant> implements StoreStatisticsService {
@Override
public long auditNum() {
LambdaQueryWrapper<SysTenant> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.APPLYING.name());
return this.count(queryWrapper);
}
@Override
public long storeNum() {
LambdaQueryWrapper<SysTenant> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name());
return this.count(queryWrapper);
}
@Override
public long todayStoreNum() {
LambdaQueryWrapper<SysTenant> queryWrapper = Wrappers.lambdaQuery();
// queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name());
// queryWrapper.ge(Store::getCreateTime, DateUtil.beginOfDay(new DateTime()));
return this.count(queryWrapper);
}
}

View File

@ -0,0 +1,137 @@
package com.wzj.soopin.statistics.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
/**
* 金额计算工具
*
* @author Bulbasaur
* @since 2021/7/9 1:40 上午
*/
public final class CurrencyUtil {
/**
* 默认除法运算精度
*/
private static final int DEF_DIV_SCALE = 2;
/**
* 这个类不能实例化
*/
private CurrencyUtil() {
}
/**
* 提供精确的加法运算
*
* @return 累加之和
*/
public static Double add(double... params) {
BigDecimal result = new BigDecimal("0");
for (double param : params) {
BigDecimal bigParam = BigDecimal.valueOf(param);
result = result.add(bigParam).setScale(2, RoundingMode.HALF_UP);
}
return result.doubleValue();
}
/**
* 提供精确的减法运算
*
* @return 第一个参数为被减数其余数字为减数
*/
public static Double sub(double... params) {
BigDecimal result = BigDecimal.valueOf(params[0]);
params = Arrays.stream(params).skip(1).toArray();
for (double param : params) {
BigDecimal bigParam = BigDecimal.valueOf(param);
result = result.subtract(bigParam).setScale(2, RoundingMode.HALF_UP);
}
return result.doubleValue();
}
/**
* 提供精确的乘法运算
*
* @param v1 被乘数
* @param v2 乘数
* @return 两个参数的积
*/
public static Double mul(double v1, double v2) {
BigDecimal b1 = BigDecimal.valueOf(v1);
BigDecimal b2 = BigDecimal.valueOf(v2);
return b1.multiply(b2).setScale(2, RoundingMode.HALF_UP).doubleValue();
}
/**
* 提供精确的乘法运算
*
* @param v1 被乘数
* @param v2 乘数
* @param scale 表示表示需要精确到小数点以后几位
* @return 两个参数的积
*/
public static Double mul(double v1, double v2, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
BigDecimal b1 = BigDecimal.valueOf(v1);
BigDecimal b2 = BigDecimal.valueOf(v2);
return b1.multiply(b2).setScale(scale, RoundingMode.HALF_UP).doubleValue();
}
/**
* 提供相对精确的除法运算当发生除不尽的情况时 精确到小数点以后10位以后的数字四舍五入
*
* @param v1 被除数
* @param v2 除数
* @return 两个参数的商
*/
public static double div(double v1, double v2) {
return div(v1, v2, DEF_DIV_SCALE);
}
/**
* 提供相对精确的除法运算 当发生除不尽的情况时由scale参数指定精度以后的数字四舍五入
*
* @param v1 被除数
* @param v2 除数
* @param scale 表示表示需要精确到小数点以后几位
* @return 两个参数的商
*/
public static double div(double v1, double v2, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
//如果被除数等于0则返回0
if (v2 == 0) {
return 0;
}
BigDecimal b1 = BigDecimal.valueOf(v1);
BigDecimal b2 = BigDecimal.valueOf(v2);
return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
}
/**
* 金额转分
*
* @param money 金额
* @return 转换单位为分
*/
public static Integer fen(Double money) {
double price = mul(money, 100);
return (int) price;
}
/**
* 金额转分
*
* @param money 金额
* @return double类型分
*/
public static double reversalFen(Double money) {
return div(money, 100);
}
}

View File

@ -0,0 +1,126 @@
package com.wzj.soopin.statistics.util;
import com.google.protobuf.ServiceException;
import com.wzj.soopin.statistics.entity.enums.SearchTypeEnum;
import io.micrometer.common.util.StringUtils;
import org.dromara.common.core.constant.ResultCode;
import java.util.Calendar;
import java.util.Date;
import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
/**
* 统计缓存后缀工具
*
* @author Chopper
* @since 2021-01-15 15:30
*/
public class StatisticsDateUtil {
/**
* 快捷搜索得到开始时间和结束时间
*
* @param searchTypeEnum
* @return
*/
public static Date[] getDateArray(SearchTypeEnum searchTypeEnum) {
Date[] dateArray = new Date[2];
Calendar calendar = Calendar.getInstance();
//时间归到今天凌晨0点
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
switch (searchTypeEnum) {
case TODAY:
dateArray[0] = calendar.getTime();
calendar.set(Calendar.HOUR_OF_DAY, +24);
calendar.set(Calendar.MILLISECOND, -1);
dateArray[1] = calendar.getTime();
break;
case YESTERDAY:
//获取昨天
calendar.set(Calendar.HOUR_OF_DAY, -24);
dateArray[0] = calendar.getTime();
//昨天结束时间
calendar.set(Calendar.HOUR_OF_DAY, +24);
calendar.set(Calendar.MILLISECOND, -1);
dateArray[1] = calendar.getTime();
break;
case LAST_SEVEN:
calendar.set(Calendar.HOUR_OF_DAY, -24 * 7);
dateArray[0] = calendar.getTime();
calendar.set(Calendar.HOUR_OF_DAY, +24 * 7);
calendar.set(Calendar.MILLISECOND, -1);
//获取过去七天
dateArray[1] = calendar.getTime();
break;
case LAST_THIRTY:
//获取最近三十天
calendar.set(Calendar.HOUR_OF_DAY, -24 * 30);
dateArray[0] = calendar.getTime();
calendar.set(Calendar.HOUR_OF_DAY, +24 * 30);
calendar.set(Calendar.MILLISECOND, -1);
//获取过去七天
dateArray[1] = calendar.getTime();
break;
default:
break;
}
return dateArray;
}
/**
* 获取年月获取开始结束时间
*
* @param year
* @param month
* @return 返回时间
*/
public static Date[] getDateArray(Integer year, Integer month) {
Date[] dateArray = new Date[2];
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, 0);
dateArray[1] = calendar.getTime();
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
dateArray[0] = calendar.getTime();
return dateArray;
}
/**
* 根据搜索参数获取搜索开始结束时间
*
* @param statisticsQueryParam
* @return
*/
public static Date[] getDateArray(StatisticsQueryParam statisticsQueryParam) {
//如果快捷搜搜哦
if (StringUtils.isNotEmpty(statisticsQueryParam.getSearchType())) {
return getDateArray(SearchTypeEnum.valueOf(statisticsQueryParam.getSearchType()));
}
//按照年月查询
else if (statisticsQueryParam.getMonth() != null && statisticsQueryParam.getYear() != null) {
return getDateArray(statisticsQueryParam.getYear(), statisticsQueryParam.getMonth());
}
//默认查询当前月份
else {
Calendar calendar = Calendar.getInstance();
return getDateArray(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1);
}
}
}

View File

@ -0,0 +1,42 @@
package com.wzj.soopin.statistics.util;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* 在线人数统计
*
* @author Chopper
* @version v4.0
* @since 2021/2/21 10:19
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "lili.statistics")
public class StatisticsProperties {
/**
* 在线人数统计 X 小时
*/
private Integer onlineMember = 48;
/**
* 当前在线人数 刷新时间间隔
*/
private Integer currentOnlineUpdate = 600;
public Integer getOnlineMember() {
if (onlineMember == null) {
return 48;
}
return onlineMember;
}
public Integer getCurrentOnlineUpdate() {
if (currentOnlineUpdate == null) {
return 600;
}
return currentOnlineUpdate;
}
}

View File

@ -0,0 +1,70 @@
package com.wzj.soopin.statistics.util;
import java.util.Calendar;
/**
* 统计缓存后缀工具
*
* @author Chopper
* @since 2021-01-15 15:30
*/
public class StatisticsSuffix {
/**
* 平台统计后缀
*
* @return
*/
public static String suffix() { //取得系统当前时间
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day;
}
/**
* 平台统计后缀制定日期
*
* @return
*/
public static String suffix(Calendar calendar) { //取得系统当前时间
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day;
}
/**
* 获取商家统计后缀
*
* @param storeId
* @return
*/
public static String suffix(String storeId) {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day + "-" + storeId;
}
/**
* 获取商家统计后缀(指定日)
*
* @param storeId
* @return
*/
public static String suffix(Calendar calendar, String storeId) {
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day + "-" + storeId;
}
}

View File

@ -0,0 +1,9 @@
<archetype>
<id>ruoyi-statistics</id>
<sources>
<source>src/main/java/App.java</source>
</sources>
<testSources>
<source>src/test/java/AppTest.java</source>
</testSources>
</archetype>

View File

@ -0,0 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>$org.dromara</groupId>
<artifactId>$ruoyi-statistics</artifactId>
<version>$5.3.1</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,13 @@
package $org.dromara;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,38 @@
package $org.dromara;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

View File

@ -165,7 +165,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
tenant.setDomain(bo.getDomain());
tenant.setIntro(bo.getIntro());
tenant.setPackageId(bo.getPackageId());
tenant.setAccountCount(bo.getAccountCount());
tenant.setAccountCount(10l);
tenant.setStatus(bo.getStatus());
tenant.setDelFlag(bo.getDelFlag());
tenant.setBusinessLicense(bo.getBusinessLicense());

View File

@ -14,8 +14,8 @@ docker run -d \
-p 13306:3306 \
-e MYSQL_ROOT_PASSWORD=K9p@rS32qL7z \
-e TZ=Asia/Shanghai \
-v /var/local/docker/mysql/data:/var/lib/mysql \
-v /var/local/docker/mysql/conf:/etc/mysql/conf.d \
-v /usr/local/docker/mysql/data:/var/lib/mysql \
-v /usr/local/docker/mysql/conf:/etc/mysql/conf.d \
mysql:8.0 \
--lower_case_table_names=1
@ -25,8 +25,8 @@ docker run -d \
--name redis \
--restart always \
-p 16379:6379 \
-v /var/local/docker/redis/data:/data \
-v /var/local/docker/redis/conf:/usr/local/etc/redis \
-v /usr/local/docker/redis/data:/data \
-v /usr/local/docker/redis/conf:/usr/local/etc/redis \
redis:latest \
redis-server /usr/local/etc/redis/redis.conf --requirepass "e4ea0caebfd2"
@ -36,35 +36,37 @@ docker run -d \
--env TZ=Asia/Shanghai \
-p 8000:80 \
-p 7443:443 \
-v /var/local/docker/nginx/cert:/etc/nginx/cert \
-v /var/local/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /var/local/docker/nginx/html:/etc/nginx/html \
-v /var/local/docker/nginx/log:/var/log/nginx \
-v /var/local/docker/nginx/upload:/var/upload/files \
-v /usr/local/docker/nginx/cert:/etc/nginx/cert \
-v /usr/local/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /usr/local/docker/nginx/html:/etc/nginx/html \
-v /usr/local/docker/nginx/log:/var/log/nginx \
-v /usr/local/docker/nginx/upload:/var/upload/files \
--privileged \
--network host \
nginx
//创建java
docker run -d \
--name java \
--restart always \
-p 8880:8080 \
-v /var/local/docker/java/data:/java \
-v /var/local/docker/java/logs:/logs \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-e TZ=Asia/Shanghai \
-e JAVA_OPTS="-Xms512m -Xmx800m \
-XX:+UseContainerSupport \
-XX:MaxMetaspaceSize=256m \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/var/log/java-app/heapdump.hprof \
-Dlogging.file.path=/var/log/java-app \
-Dfile.encoding=UTF-8" \
--health-interval=30s \
--health-timeout=5s \
--health-retries=3 \
bellsoft/liberica-openjdk-debian:17.0.11-cds \
java $JAVA_OPTS -Djdk.internal.platform.CgroupMetrics.enabled=false -jar /java/ruoyi-admin.jar
--name java \
--restart always \
-p 8880:8080 \
-v /usr/local/docker/java/data:/java \
-v /usr/local/docker/java/logs:/logs \
-v /usr/fs/cgroup:/sys/fs/cgroup:ro \
-e TZ=Asia/Shanghai \
-e JAVA_OPTS="-Xms512m -Xmx800m \
-XX:+UseContainerSupport \
-XX:MaxMetaspaceSize=256m \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/var/log/java-app/heapdump.hprof \
-Dlogging.file.path=/var/log/java-app \
-Dfile.encoding=UTF-8 \
-Dprofile=prod" \
--health-interval=30s \
--health-timeout=5s \
--health-retries=3 \
bellsoft/liberica-openjdk-debian:17.0.11-cds \
java $JAVA_OPTS -Djdk.internal.platform.CgroupMetrics.enabled=false -jar /java/ruoyi-admin.jar
//es
@ -75,7 +77,7 @@ docker run -d \
-p 19300:9300 \
-e "discovery.type=single-node" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-v /var/local/docker/elasticsearch/data:/usr/share/elasticsearch/data \
-v /usr/local/docker/elasticsearch/data:/usr/share/elasticsearch/data \
elasticsearch:7.17.0
@ -89,25 +91,34 @@ docker run -d \
-e MINIO_COMPRESS=off \
-e MINIO_COMPRESS_EXTENSIONS="" \
-e MINIO_COMPRESS_MIME_TYPES="" \
-v /var/local/docker/minio/data:/data \
-v /var/local/docker/minio/config:/root/.minio/ \
-v /usr/local/docker/minio/data:/data \
-v /usr/local/docker/minio/config:/root/.minio/ \
--privileged \
minio/minio:RELEASE.2023-04-13T03-08-07Z \
server --address ':9000' --console-address ':9001' /data
rocket-mq
# 创建自定义网络
docker network create rocketmq-single-network
docker run -d --name rocketmq-namesrv --network rocketmq-single-network -p 9876:9876 -v /opt/rocketmq-single/namesrv/logs:/root/logs -v /opt/rocketmq-single/namesrv/store:/root/store --restart=always apache/rocketmq:4.9.4 sh mqnamesrv
docker run -d --name rocketmq-namesrv \
--network rocketmq-single-network \
-p 9876:9876 \
-v /usr/local/docker/rocketmq/namesrv/logs:/root/logs \
-v /usr/local/docker/rocketmq/namesrv/store:/root/store \
--restart=always \
apache/rocketmq:4.9.4 \
sh mqnamesrv
docker run -d \
--name rocketmq-broker \
--network rocketmq-single-network \
-p 10911:10911 \
-p 10909:10909 \
-v /var/local/docker/rocketmq/broker/logs:/root/logs \
-v /var/local/docker/rocketmq/broker/store:/root/store \
-v /var/local/docker/rocketmq/broker/conf/broker.conf:/home/rocketmq/rocketmq-4.9.4/conf/broker.conf \
-v /usr/local/docker/rocketmq/broker/logs:/root/logs \
-v /usr/local/docker/rocketmq/broker/store:/root/store \
-v /usr/local/docker/rocketmq/broker/conf/broker.conf:/home/rocketmq/rocketmq-4.9.4/conf/broker.conf \
-e "NAMESRV_ADDR=rocketmq-namesrv:9876" \
-e "ROCKETMQ_HOME=/home/rocketmq/rocketmq-4.9.4" \
--restart=always \

View File

@ -50,8 +50,8 @@ http {
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /dev-api/ {
proxy_pass http://192.168.1.65:8880/;
location /prod-api/ {
proxy_pass http://43.143.227.203:8880/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@ -7,3 +7,4 @@ brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
# 关键配置外部客户端如Java程序访问Broker的IP必须是宿主机可被外部访问的IP
brokerIP1 = 192.168.1.65
autoCreateNamespaceEnable = true