Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
open-platform-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7eb234b8
authored
Dec 17, 2020
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户控制台总览统计
1 parent
c8aa349f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
194 additions
and
28 deletions
src/main/java/com/glsx/controller/IndexController.java
src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
src/main/java/com/glsx/mapper/PlatformUserMapper.java
src/main/java/com/glsx/service/IndexService.java
src/main/java/com/glsx/service/impl/IndexServiceImpl.java
src/main/resources/mapper/PlatformAppDownloadMapper.xml
src/main/resources/mapper/PlatformDeviceMapper.xml
src/main/resources/mapper/PlatformUserMapper.xml
src/main/java/com/glsx/controller/IndexController.java
View file @
7eb234b
package
com
.
glsx
.
controller
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.glsx.model.PlatformUser
;
import
com.glsx.service.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.service.ApiCallMgrService
;
import
com.glsx.service.AppDownloadMgrService
;
import
com.glsx.service.CustomerMgrService
;
import
com.glsx.service.DeviceMgrService
;
import
com.glsx.service.IndexService
;
import
com.glsx.service.UserMgrService
;
import
com.glsx.vo.R
;
import
com.glsx.vo.UserVo
;
import
io.swagger.annotations.Api
;
import
org.oreframework.web.ui.Pagination
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -16,10 +19,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author deployer name
* @version V1.0
...
...
@@ -52,6 +51,9 @@ public class IndexController {
@Autowired
private
AppDownloadMgrService
appDownloadMgrService
;
@Autowired
private
IndexService
indexService
;
@RequestMapping
(
value
=
"/getStatisticData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
R
getStatisticData
()
{
...
...
@@ -106,21 +108,32 @@ public class IndexController {
return
R
.
ok
().
data
(
hashMap
);
}
@RequestMapping
(
value
=
"/get
StatisticDataForUserConsole
"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/get
UcSummaryStatistic
"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
R
get
StatisticDataForUserConsole
(
String
customerName
)
{
Map
<
String
,
Integer
>
hashMap
=
new
HashMap
<>(
);
public
R
get
UcSummaryStatistic
(
String
customerName
)
{
Map
<
String
,
Integer
>
statisticMap
=
this
.
indexService
.
getUcSummaryStatistic
(
customerName
);
int
deviceCountAuth
=
deviceMgrService
.
getDeviceCountAuth
(
customerName
);
int
userCountAuth
=
userMgrService
.
getUserCountAuth
(
customerName
);
return
R
.
ok
().
data
(
statisticMap
);
}
int
apiCallCountAuth
=
appDownloadMgrService
.
getApiCallCountAuth
(
customerName
);
@RequestMapping
(
value
=
"/getUcDeviceActivationStatistic"
,
method
=
RequestMethod
.
GET
)
public
R
getUcDeviceActivationStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
this
.
indexService
.
getUcDeviceActivationStatistic
(
customerName
);
return
R
.
ok
().
data
(
statisticList
);
}
hashMap
.
put
(
"deviceCount"
,
deviceCountAuth
);
hashMap
.
put
(
"userCount"
,
userCountAuth
);
hashMap
.
put
(
"apiCallCount"
,
apiCallCountAuth
);
@RequestMapping
(
value
=
"/getUcUserActivityStatistic"
,
method
=
RequestMethod
.
GET
)
public
R
getUcUserActivityStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
this
.
indexService
.
getUcUserActivityStatistic
(
customerName
);
return
R
.
ok
().
data
(
statisticList
);
}
return
R
.
ok
().
data
(
hashMap
);
@RequestMapping
(
value
=
"/getUcAppDownloadStatistic"
,
method
=
RequestMethod
.
GET
)
public
R
getUcAppDownloadStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
this
.
indexService
.
getUcAppDownloadStatistic
(
customerName
);
return
R
.
ok
().
data
(
statisticList
);
}
}
src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
View file @
7eb234b
package
com
.
glsx
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.model.PlatformAppDownload
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>Description:
...
...
@@ -35,4 +37,7 @@ public interface PlatformAppDownloadMapper {
int
updateBatchSelective
(
List
<
PlatformAppDownload
>
list
);
int
getApiCallCountAuth
(
String
customerName
);
}
\ No newline at end of file
List
<
Map
<
String
,
Object
>>
getAppDownloadStatistic
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"customerName"
)
String
customerName
);
}
src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
View file @
7eb234b
package
com
.
glsx
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.model.PlatformDevice
;
import
com.glsx.vo.DeviceVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>Description:
* <p>Project: shop
...
...
@@ -46,4 +46,7 @@ public interface PlatformDeviceMapper {
Map
<
String
,
Integer
>
getDeviceGraphData
();
int
getDeviceCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
}
\ No newline at end of file
List
<
Map
<
String
,
Object
>>
getDeviceActivationStatistic
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"customerName"
)
String
customerName
);
}
src/main/java/com/glsx/mapper/PlatformUserMapper.java
View file @
7eb234b
package
com
.
glsx
.
mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.glsx.model.PlatformUser
;
import
com.glsx.vo.UserVo
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -40,4 +42,7 @@ public interface PlatformUserMapper {
int
getUserCount
();
int
getUserCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
List
<
Map
<
String
,
Object
>>
getUserActivityStatistic
(
@Param
(
"startTime"
)
Date
startTime
,
@Param
(
"endTime"
)
Date
endTime
,
@Param
(
"customerName"
)
String
customerName
);
}
src/main/java/com/glsx/service/IndexService.java
0 → 100644
View file @
7eb234b
package
com
.
glsx
.
service
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>Description:
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
public
interface
IndexService
{
Map
<
String
,
Integer
>
getUcSummaryStatistic
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getUcDeviceActivationStatistic
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getUcUserActivityStatistic
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getUcAppDownloadStatistic
(
String
customerName
);
}
src/main/java/com/glsx/service/impl/IndexServiceImpl.java
0 → 100644
View file @
7eb234b
package
com
.
glsx
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
cn.hutool.core.date.DateUtil
;
import
com.glsx.mapper.PlatformAppDownloadMapper
;
import
com.glsx.mapper.PlatformDeviceMapper
;
import
com.glsx.mapper.PlatformUserMapper
;
import
com.glsx.service.IndexService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* <p>Description: 总览业务
* <p>Project: open-platform-admin
*
* @author wbh
* @date 2020-12-16
*/
@Service
public
class
IndexServiceImpl
implements
IndexService
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
private
PlatformDeviceMapper
deviceMapper
;
@Autowired
private
PlatformUserMapper
userMapper
;
@Autowired
private
PlatformAppDownloadMapper
appDownloadMapper
;
@Override
public
Map
<
String
,
Integer
>
getUcSummaryStatistic
(
String
customerName
)
{
Map
<
String
,
Integer
>
statisticMap
=
new
HashMap
<>();
int
deviceCount
=
this
.
deviceMapper
.
getDeviceCountAuth
(
customerName
);
int
userCount
=
this
.
userMapper
.
getUserCountAuth
(
customerName
);
int
appDownloadCount
=
this
.
appDownloadMapper
.
getApiCallCountAuth
(
customerName
);
statisticMap
.
put
(
"deviceCount"
,
deviceCount
);
statisticMap
.
put
(
"userCount"
,
userCount
);
statisticMap
.
put
(
"appDownloadCount"
,
appDownloadCount
);
return
statisticMap
;
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getUcDeviceActivationStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
;
List
<
Map
<
String
,
Object
>>
columnList
=
this
.
deviceMapper
.
getDeviceActivationStatistic
(
this
.
getStatisticStartTime
(),
this
.
getStatisticEndTime
(),
customerName
);
statisticList
=
this
.
convertColumnToMap
(
columnList
,
"activateTime"
,
"count"
);
return
statisticList
;
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getUcUserActivityStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
;
List
<
Map
<
String
,
Object
>>
columnList
=
this
.
userMapper
.
getUserActivityStatistic
(
this
.
getStatisticStartTime
(),
this
.
getStatisticEndTime
(),
customerName
);
statisticList
=
this
.
convertColumnToMap
(
columnList
,
"lastLoginTime"
,
"count"
);
return
statisticList
;
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getUcAppDownloadStatistic
(
String
customerName
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
;
List
<
Map
<
String
,
Object
>>
columnList
=
this
.
appDownloadMapper
.
getAppDownloadStatistic
(
this
.
getStatisticStartTime
(),
this
.
getStatisticEndTime
(),
customerName
);
statisticList
=
this
.
convertColumnToMap
(
columnList
,
"appDownloadTime"
,
"count"
);
return
statisticList
;
}
private
Date
getStatisticStartTime
()
{
return
DateUtil
.
beginOfDay
(
new
Date
());
}
private
Date
getStatisticEndTime
()
{
return
DateUtil
.
offsetDay
(
DateUtil
.
beginOfDay
(
new
Date
()),
-
31
);
}
private
List
<
Map
<
String
,
Integer
>>
convertColumnToMap
(
List
<
Map
<
String
,
Object
>>
columnList
,
String
key
,
String
value
)
{
List
<
Map
<
String
,
Integer
>>
statisticList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
columnMap
:
columnList
)
{
Map
<
String
,
Integer
>
statisticMap
=
new
HashMap
<>();
statisticMap
.
put
((
String
)
columnMap
.
get
(
key
),
(
Integer
)
columnMap
.
get
(
value
));
statisticList
.
add
(
statisticMap
);
}
return
statisticList
;
}
}
src/main/resources/mapper/PlatformAppDownloadMapper.xml
View file @
7eb234b
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/PlatformDeviceMapper.xml
View file @
7eb234b
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/PlatformUserMapper.xml
View file @
7eb234b
...
...
@@ -77,6 +77,21 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<select
id=
"getUserActivityStatistic"
resultType=
"map"
>
select date_format(pu.last_login_time, '%Y-%m-%d') `lastLoginTime`,
count(pu.last_login_time) `count`
from t_platform_user pu
left join t_platform_customer pc on pc.id = pu.customer_id
<where>
pu.last_login_time >= #{startTime,jdbcType=TIMESTAMP}
and pu.last_login_time
<
#{endTime,jdbcType=TIMESTAMP}
<if
test=
"customerName != null and customerName != ''"
>
and pc.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
</where>
group by lastLoginTime
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment