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 8c8d60b0
authored
Dec 17, 2020
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
完成基本开发
1 parent
c2faaa49
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
173 additions
and
79 deletions
pom.xml
src/main/java/com/glsx/Main.java
src/main/java/com/glsx/controller/CustomerMgrController.java
src/main/java/com/glsx/controller/IndexController.java
src/main/java/com/glsx/mapper/PlatformApiCallMapper.java
src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
src/main/java/com/glsx/mapper/PlatformCustomerMapper.java
src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
src/main/java/com/glsx/model/PlatformCustomer.java
src/main/java/com/glsx/service/ApiCallMgrService.java
src/main/java/com/glsx/service/CustomerMgrService.java
src/main/java/com/glsx/service/DeviceMgrService.java
src/main/java/com/glsx/service/impl/AdMgrServiceImpl.java
src/main/java/com/glsx/service/impl/ApiCallMgrServiceImpl.java
src/main/java/com/glsx/service/impl/CustomerMgrServiceImpl.java
src/main/java/com/glsx/service/impl/DeviceMgrServiceImpl.java
src/main/resources/mapper/PlatformApiCallMapper.xml
src/main/resources/mapper/PlatformCustomerMapper.xml
src/main/resources/mapper/PlatformDeviceMapper.xml
src/main/resources/mapper/PlatformUserMapper.xml
pom.xml
View file @
8c8d60b
...
...
@@ -49,18 +49,6 @@
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis
</artifactId>
<version>
3.5.6
</version>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis-spring
</artifactId>
<version>
2.0.6
</version>
</dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper
</artifactId>
<version>
5.2.0
</version>
...
...
@@ -78,6 +66,11 @@
<version>
2.4.2
</version>
</dependency>
<dependency>
<groupId>
cn.com.glsx.openplatform
</groupId>
<artifactId>
rpc-openplatform-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
...
...
src/main/java/com/glsx/Main.java
View file @
8c8d60b
package
com
.
glsx
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.oreframework.boot.main.AbsOreBootStarter
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
...
...
@@ -21,7 +19,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@ServletComponentScan
@EnableSwagger2
@MapperScan
(
"com.glsx.mapper"
)
//@MapperScan(basePackages = {"com.glsx.mapper"}
)
public
class
Main
extends
AbsOreBootStarter
{
@Override
...
...
src/main/java/com/glsx/controller/CustomerMgrController.java
View file @
8c8d60b
...
...
@@ -62,4 +62,25 @@ public class CustomerMgrController {
}
return
R
.
ok
(
"账号状态修改成功"
);
}
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
R
register
(
PlatformCustomer
customer
)
{
int
num
=
customerMgrService
.
register
(
customer
);
if
(
num
==
0
)
{
return
R
.
error
(
"注册失败"
);
}
return
R
.
ok
(
"注册成功"
);
}
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
R
login
(
PlatformCustomer
customer
)
{
int
num
=
customerMgrService
.
login
(
customer
);
if
(
num
==
0
)
{
return
R
.
error
(
"登陆失败"
);
}
return
R
.
ok
(
"登陆成功"
);
}
}
src/main/java/com/glsx/controller/IndexController.java
View file @
8c8d60b
...
...
@@ -76,10 +76,10 @@ public class IndexController {
@RequestMapping
(
value
=
"/getGraphData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
R
getGraphData
()
{
Map
<
String
,
Map
<
String
,
Integer
>>
hashMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
deviceGraphData
=
deviceMgrService
.
getDeviceGraphData
();
Map
<
String
,
List
<
Map
<
String
,
Integer
>
>>
hashMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Integer
>
>
deviceGraphData
=
deviceMgrService
.
getDeviceGraphData
();
Map
<
String
,
Integer
>
apiCallGraphData
=
apiCallMgrService
.
getApiCallGraphData
();
List
<
Map
<
String
,
Integer
>
>
apiCallGraphData
=
apiCallMgrService
.
getApiCallGraphData
();
hashMap
.
put
(
"deviceGraphData"
,
deviceGraphData
);
hashMap
.
put
(
"apiCallGraphData"
,
apiCallGraphData
);
...
...
@@ -89,23 +89,34 @@ public class IndexController {
@RequestMapping
(
value
=
"/getPolylineData"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
R
getPolylineData
()
{
HashMap
<
String
,
Integer
>
hashMap
=
new
HashMap
<>();
int
customerCount
=
customerMgrService
.
getCustomerCount
();
HashMap
<
String
,
List
<
Map
<
String
,
Integer
>>>
hashMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Integer
>>
deviceAccessTrendList
=
deviceMgrService
.
getDeviceAccessTrendList
();
List
<
Map
<
String
,
Integer
>>
apiCallTrendList
=
apiCallMgrService
.
getApiCallTrendList
();
int
deviceCount
=
deviceMgrService
.
getDeviceCount
();
hashMap
.
put
(
"deviceAccessTrendList"
,
deviceAccessTrendList
);
hashMap
.
put
(
"apiCallTrendList"
,
apiCallTrendList
);
return
R
.
ok
().
data
(
hashMap
);
}
int
userCount
=
userMgrService
.
getUserCount
();
@RequestMapping
(
value
=
"/getStatisticDataForUserConsole"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
R
getStatisticDataForUserConsole1
(
String
customerName
)
{
Map
<
String
,
Integer
>
hashMap
=
new
HashMap
<>();
int
apiCallCount
=
apiCallMgrService
.
getApiCallCount
(
);
int
deviceCountAuth
=
deviceMgrService
.
getDeviceCountAuth
(
customerName
);
hashMap
.
put
(
"customerCount"
,
customerCount
);
hashMap
.
put
(
"deviceCount"
,
deviceCount
);
hashMap
.
put
(
"userCount"
,
userCount
);
hashMap
.
put
(
"apiCallCount"
,
apiCallCount
);
int
userCountAuth
=
userMgrService
.
getUserCountAuth
(
customerName
);
int
apiCallCountAuth
=
appDownloadMgrService
.
getApiCallCountAuth
(
customerName
);
hashMap
.
put
(
"deviceCount"
,
deviceCountAuth
);
hashMap
.
put
(
"userCount"
,
userCountAuth
);
hashMap
.
put
(
"apiCallCount"
,
apiCallCountAuth
);
return
R
.
ok
().
data
(
hashMap
);
}
@RequestMapping
(
value
=
"/getStatisticDataForUserConsole"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
R
getStatisticDataForUserConsole
(
String
customerName
)
{
...
...
src/main/java/com/glsx/mapper/PlatformApiCallMapper.java
View file @
8c8d60b
...
...
@@ -41,5 +41,7 @@ public interface PlatformApiCallMapper {
int
getApiCallCount
();
Map
<
String
,
Integer
>
getApiCallGraphData
();
List
<
Map
<
String
,
Integer
>>
getApiCallGraphData
();
List
<
Map
<
String
,
Integer
>>
getApiCallTrendList
();
}
\ No newline at end of file
src/main/java/com/glsx/mapper/PlatformAppDownloadMapper.java
View file @
8c8d60b
...
...
@@ -2,6 +2,7 @@ package com.glsx.mapper;
import
com.glsx.model.PlatformAppDownload
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -34,5 +35,5 @@ public interface PlatformAppDownloadMapper {
int
updateBatchSelective
(
List
<
PlatformAppDownload
>
list
);
int
getApiCallCountAuth
(
String
customerName
);
int
getApiCallCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
}
\ No newline at end of file
src/main/java/com/glsx/mapper/PlatformCustomerMapper.java
View file @
8c8d60b
...
...
@@ -39,4 +39,6 @@ public interface PlatformCustomerMapper {
List
<
String
>
getCustomerNameList
();
int
getCustomerCount
();
int
login
(
PlatformCustomer
customer
);
}
\ No newline at end of file
src/main/java/com/glsx/mapper/PlatformDeviceMapper.java
View file @
8c8d60b
...
...
@@ -43,7 +43,9 @@ public interface PlatformDeviceMapper {
int
getDeviceCount
();
Map
<
String
,
Integer
>
getDeviceGraphData
();
List
<
Map
<
String
,
Integer
>
>
getDeviceGraphData
();
int
getDeviceCountAuth
(
@Param
(
"customerName"
)
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getDeviceAccessTrendList
();
}
\ No newline at end of file
src/main/java/com/glsx/model/PlatformCustomer.java
View file @
8c8d60b
...
...
@@ -56,6 +56,11 @@ public class PlatformCustomer implements Serializable {
private
Integer
city
;
/**
* 城市 sys_area的id
*/
private
Integer
Area
;
/**
* 详细地址
*/
private
String
address
;
...
...
@@ -249,31 +254,36 @@ public class PlatformCustomer implements Serializable {
this
.
remark
=
remark
;
}
public
Integer
getArea
()
{
return
Area
;
}
public
void
setArea
(
Integer
area
)
{
Area
=
area
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", customerName="
).
append
(
customerName
);
sb
.
append
(
", contactPerson="
).
append
(
contactPerson
);
sb
.
append
(
", password="
).
append
(
password
);
sb
.
append
(
", contactNumber="
).
append
(
contactNumber
);
sb
.
append
(
", contactEmail="
).
append
(
contactEmail
);
sb
.
append
(
", province="
).
append
(
province
);
sb
.
append
(
", city="
).
append
(
city
);
sb
.
append
(
", address="
).
append
(
address
);
sb
.
append
(
", status="
).
append
(
status
);
sb
.
append
(
", publicKey="
).
append
(
publicKey
);
sb
.
append
(
", privateKey="
).
append
(
privateKey
);
sb
.
append
(
", channelNumber="
).
append
(
channelNumber
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", createBy="
).
append
(
createBy
);
sb
.
append
(
", updateBy="
).
append
(
updateBy
);
sb
.
append
(
", remark="
).
append
(
remark
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
return
"PlatformCustomer{"
+
"id="
+
id
+
", customerName='"
+
customerName
+
'\''
+
", contactPerson='"
+
contactPerson
+
'\''
+
", password='"
+
password
+
'\''
+
", contactNumber='"
+
contactNumber
+
'\''
+
", contactEmail='"
+
contactEmail
+
'\''
+
", province="
+
province
+
", city="
+
city
+
", Area="
+
Area
+
", address='"
+
address
+
'\''
+
", status="
+
status
+
", publicKey='"
+
publicKey
+
'\''
+
", privateKey='"
+
privateKey
+
'\''
+
", channelNumber='"
+
channelNumber
+
'\''
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", createBy="
+
createBy
+
", updateBy="
+
updateBy
+
", remark='"
+
remark
+
'\''
+
'}'
;
}
}
\ No newline at end of file
src/main/java/com/glsx/service/ApiCallMgrService.java
View file @
8c8d60b
...
...
@@ -11,5 +11,7 @@ public interface ApiCallMgrService {
int
getApiCallCount
();
Map
<
String
,
Integer
>
getApiCallGraphData
();
List
<
Map
<
String
,
Integer
>>
getApiCallGraphData
();
List
<
Map
<
String
,
Integer
>>
getApiCallTrendList
();
}
src/main/java/com/glsx/service/CustomerMgrService.java
View file @
8c8d60b
...
...
@@ -12,4 +12,8 @@ public interface CustomerMgrService {
int
startAndStop
(
int
id
,
int
status
);
int
getCustomerCount
();
int
register
(
PlatformCustomer
customer
);
int
login
(
PlatformCustomer
customer
);
}
src/main/java/com/glsx/service/DeviceMgrService.java
View file @
8c8d60b
...
...
@@ -15,7 +15,9 @@ public interface DeviceMgrService {
int
getDeviceCount
();
Map
<
String
,
Integer
>
getDeviceGraphData
();
List
<
Map
<
String
,
Integer
>
>
getDeviceGraphData
();
int
getDeviceCountAuth
(
String
customerName
);
List
<
Map
<
String
,
Integer
>>
getDeviceAccessTrendList
();
}
src/main/java/com/glsx/service/impl/AdMgrServiceImpl.java
View file @
8c8d60b
...
...
@@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -27,11 +28,13 @@ public class AdMgrServiceImpl implements AdMgrService {
@Override
public
int
insertAd
(
PlatformAd
ad
)
{
ad
.
setCreateTime
(
new
Date
());
return
adMapper
.
insert
(
ad
);
}
@Override
public
int
updateAd
(
PlatformAd
ad
)
{
ad
.
setUpdateTime
(
new
Date
());
return
adMapper
.
updateByPrimaryKeySelective
(
ad
);
}
...
...
src/main/java/com/glsx/service/impl/ApiCallMgrServiceImpl.java
View file @
8c8d60b
...
...
@@ -33,7 +33,12 @@ public class ApiCallMgrServiceImpl implements ApiCallMgrService {
}
@Override
public
Map
<
String
,
Integer
>
getApiCallGraphData
()
{
public
List
<
Map
<
String
,
Integer
>
>
getApiCallGraphData
()
{
return
apiCallMapper
.
getApiCallGraphData
();
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getApiCallTrendList
()
{
return
apiCallMapper
.
getApiCallTrendList
();
}
}
src/main/java/com/glsx/service/impl/CustomerMgrServiceImpl.java
View file @
8c8d60b
...
...
@@ -45,4 +45,14 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
public
int
getCustomerCount
()
{
return
customerMapper
.
getCustomerCount
();
}
@Override
public
int
register
(
PlatformCustomer
customer
)
{
return
customerMapper
.
insertSelective
(
customer
);
}
@Override
public
int
login
(
PlatformCustomer
customer
)
{
return
customerMapper
.
login
(
customer
);
}
}
src/main/java/com/glsx/service/impl/DeviceMgrServiceImpl.java
View file @
8c8d60b
...
...
@@ -47,7 +47,7 @@ public class DeviceMgrServiceImpl implements DeviceMgrService {
}
@Override
public
Map
<
String
,
Integer
>
getDeviceGraphData
()
{
public
List
<
Map
<
String
,
Integer
>
>
getDeviceGraphData
()
{
return
deviceMapper
.
getDeviceGraphData
();
}
...
...
@@ -55,4 +55,9 @@ public class DeviceMgrServiceImpl implements DeviceMgrService {
public
int
getDeviceCountAuth
(
String
customerName
)
{
return
deviceMapper
.
getDeviceCountAuth
(
customerName
);
}
@Override
public
List
<
Map
<
String
,
Integer
>>
getDeviceAccessTrendList
()
{
return
deviceMapper
.
getDeviceAccessTrendList
();
}
}
src/main/resources/mapper/PlatformApiCallMapper.xml
View file @
8c8d60b
...
...
@@ -26,7 +26,7 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"getApiCallMgrList"
resultMap=
"BaseResultMap"
>
<select
id=
"getApiCallMgrList"
parameterType=
"com.glsx.vo.ApiCallVo"
resultMap=
"BaseResultMap"
>
select
a.id,
b.customer_name,
...
...
@@ -41,11 +41,11 @@
left join t_platform_api c
on a.api_id = c.id
where 1=1
<if
test=
"a
piCallVo.a
ccessStartTime != null "
>
and create_time
>
=
apiCallVo.accessStartTime
<if
test=
"accessStartTime != null "
>
and create_time
>
=
#{accessStartTime,jdbcType=TIMESTAMP}
</if>
<if
test=
"a
piCallVo.a
ccessEndTime != null "
>
and create_time
<
=
apiCallVo.accessEndTime
<if
test=
"accessEndTime != null "
>
and create_time
<
=
#{accessEndTime,jdbcType=TIMESTAMP}
</if>
</select>
...
...
@@ -62,6 +62,14 @@
group by b.api_classification
</select>
<select
id=
"getApiCallTrendList"
resultType=
"java.util.Map"
>
select
date_format(create_time,'%Y-%m-%d') as create_time,
count(id)
from t_platform_api_call
group by create_time
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete from t_platform_api_call
...
...
src/main/resources/mapper/PlatformCustomerMapper.xml
View file @
8c8d60b
...
...
@@ -54,6 +54,13 @@
from t_platform_customer
</select>
<select
id=
"login"
parameterType=
"com.glsx.model.PlatformCustomer"
resultType=
"java.lang.Integer"
>
select count(1)
from t_platform_customer
where contact_number = #{contactNumber,jdbcType=VARCHAR}
and password = #{password,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete from t_platform_customer
...
...
src/main/resources/mapper/PlatformDeviceMapper.xml
View file @
8c8d60b
...
...
@@ -30,7 +30,7 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"getDeviceMgrList"
resultMap=
"BaseResultMap"
>
<select
id=
"getDeviceMgrList"
parameterType=
"com.glsx.vo.DeviceVo"
resultMap=
"BaseResultMap"
>
select
a.id,
a.device_sn,
...
...
@@ -47,17 +47,17 @@
left join t_platform_customer b
on a.customer_id = b.id
where 1 = 1
<if
test=
"
deviceVo.customerName != null and deviceVo.
customerName != '' "
>
and b.customer_name = #{
deviceVo.
customerName,jdbcType=VARCHAR}
<if
test=
"
customerName != null and
customerName != '' "
>
and b.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
<if
test=
"device
Vo.deviceType != null and deviceVo.
deviceType != '' "
>
and a.device_type = #{device
Vo.device
Type,jdbcType=VARCHAR}
<if
test=
"device
Type != null and
deviceType != '' "
>
and a.device_type = #{deviceType,jdbcType=VARCHAR}
</if>
<if
test=
"
deviceVo.activatStartTime != null and deviceVo.
activatStartTime != '' "
>
and a.create_time
>
=
apiCallVo.accessStartTime
<if
test=
"
activatStartTime != null and
activatStartTime != '' "
>
and a.create_time
>
=
#{accessStartTime,jdbcType=TIMESTAMP}
</if>
<if
test=
"
deviceVo.activatEndTime != null and deviceVo.
activatEndTime != '' "
>
and a.create_time
<
=
apiCallVo.accessEndTime
<if
test=
"
activatEndTime != null and
activatEndTime != '' "
>
and a.create_time
<
=
#{accessEndTime,jdbcType=TIMESTAMP}
</if>
</select>
...
...
@@ -88,6 +88,14 @@
where b.customer_name = #{customerName,jdbcType=VARCHAR}
</select>
<select
id=
"getDeviceAccessTrendList"
resultType=
"java.util.Map"
>
select
date_format(activat_time,'%Y-%m-%d') as activat_time,
count(id)
from t_platform_device
group by activat_time
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
<!--@mbg.generated-->
delete from t_platform_device
...
...
src/main/resources/mapper/PlatformUserMapper.xml
View file @
8c8d60b
...
...
@@ -33,7 +33,7 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"getUserMgrList"
resultMap=
"BaseResultMap"
>
<select
id=
"getUserMgrList"
parameterType=
"com.glsx.vo.UserVo"
resultMap=
"BaseResultMap"
>
select
a.id,
a.nickname,
...
...
@@ -53,14 +53,14 @@
left join t_platform_customer b
on a.customer_id = b.id
where 1 = 1
<if
test=
"
userVo.customerName != null and userVo.
customerName != '' "
>
and b.customer_name = #{
userVo.
customerName,jdbcType=VARCHAR}
<if
test=
"
customerName != null and
customerName != '' "
>
and b.customer_name = #{customerName,jdbcType=VARCHAR}
</if>
<if
test=
"
userVo.registerStartTime != null and userVo.
registerStartTime != '' "
>
and a.create_time
>
=
userVo.registerStartTime
<if
test=
"
registerStartTime != null and
registerStartTime != '' "
>
and a.create_time
>
=
#{registerStartTime,jdbcType=VARCHAR}
</if>
<if
test=
"
userVo.registerEndTime != null and userVo.
registerEndTime != '' "
>
and a.create_time
<
=
userVo.registerEndTime
<if
test=
"
registerEndTime != null and
registerEndTime != '' "
>
and a.create_time
<
=
#{registerEndTime,jdbcType=VARCHAR}
</if>
</select>
...
...
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