Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
smartDevices-platform-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6608df00
authored
Mar 22, 2021
by
周海宝
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!5
2 parents
ca1b1cdb
5263c796
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
124 deletions
src/main/java/cn/com/glsx/modules/controller/DeviceController.java
src/main/java/cn/com/glsx/modules/controller/UserController.java
src/main/java/cn/com/glsx/modules/factory/PlatForm.java
src/main/java/cn/com/glsx/modules/factory/PlatformConstants.java
src/main/java/cn/com/glsx/modules/factory/PlatformFactory.java
src/main/java/cn/com/glsx/modules/factory/PlatformStrategy.java
src/main/java/cn/com/glsx/modules/factory/strategy/TuyaStrategy.java
src/main/java/cn/com/glsx/modules/controller/DeviceController.java
View file @
6608df0
package
cn
.
com
.
glsx
.
modules
.
controller
;
import
cn.com.glsx.modules.model.param.DeviceInfo
;
import
cn.com.glsx.modules.model.param.Function
;
import
cn.com.glsx.modules.service.DeviceService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
src/main/java/cn/com/glsx/modules/controller/UserController.java
View file @
6608df0
package
cn
.
com
.
glsx
.
modules
.
controller
;
import
cn.com.glsx.modules.model.param.UserBo
;
import
cn.com.glsx.modules.model.param.UserInfo
;
import
cn.com.glsx.modules.service.UserService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
...
...
src/main/java/cn/com/glsx/modules/factory/PlatForm.java
deleted
100644 → 0
View file @
ca1b1cd
package
cn
.
com
.
glsx
.
modules
.
factory
;
/**
* @author fengzhi
* @date 2021/3/9 17:05
* @description 平台信息枚举
*/
public
enum
PlatForm
implements
PlatformConstants
{
TUYA
{
@Override
public
Integer
getCode
()
{
return
0
;
}
@Override
public
String
getValue
()
{
return
"涂鸦"
;
}
@Override
public
String
getBeanName
(){
return
"oneselfStrategy"
;
}
},
XIAOMI
{
@Override
public
Integer
getCode
()
{
return
1
;
}
@Override
public
String
getValue
()
{
return
"小米"
;
}
@Override
public
String
getBeanName
(){
return
"oneselfStrategy"
;
}
},;
public
static
String
getValueByCode
(
Integer
code
)
{
for
(
PlatForm
platForm
:
PlatForm
.
values
())
{
if
(
platForm
.
getCode
().
equals
(
code
))
{
return
platForm
.
getValue
();
}
}
return
null
;
}
public
static
String
getBeanNameByCode
(
Integer
code
)
{
for
(
PlatForm
platForm
:
PlatForm
.
values
())
{
if
(
platForm
.
getCode
().
equals
(
code
))
{
return
platForm
.
getBeanName
();
}
}
return
null
;
}
}
src/main/java/cn/com/glsx/modules/factory/PlatformConstants.java
deleted
100644 → 0
View file @
ca1b1cd
package
cn
.
com
.
glsx
.
modules
.
factory
;
/**
* @author fengzhi
* @date 2021/3/9 17:05
* @description 平台信息接口
*/
public
interface
PlatformConstants
{
Integer
getCode
();
String
getValue
();
String
getBeanName
();
}
src/main/java/cn/com/glsx/modules/factory/PlatformFactory.java
deleted
100644 → 0
View file @
ca1b1cd
package
cn
.
com
.
glsx
.
modules
.
factory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author fengzhi
* @date 2021/3/9 17:05
* @description 平台接口工厂类
*/
@Service
public
class
PlatformFactory
{
@Autowired
Map
<
String
,
PlatformStrategy
>
strategys
=
new
ConcurrentHashMap
<>(
3
);
public
PlatformStrategy
getStrategy
(
Integer
platformCode
)
throws
Exception
{
PlatformStrategy
strategy
=
strategys
.
get
(
PlatForm
.
getBeanNameByCode
(
platformCode
));
if
(
strategy
==
null
)
{
throw
new
RuntimeException
(
"no strategy defined"
);
}
return
strategy
;
}
}
src/main/java/cn/com/glsx/modules/factory/PlatformStrategy.java
deleted
100644 → 0
View file @
ca1b1cd
package
cn
.
com
.
glsx
.
modules
.
factory
;
/**
* @author fengzhi
* @date 2021/3/9 17:05
* @description 平台统一对外接口
*/
public
interface
PlatformStrategy
{
}
src/main/java/cn/com/glsx/modules/factory/strategy/TuyaStrategy.java
deleted
100644 → 0
View file @
ca1b1cd
package
cn
.
com
.
glsx
.
modules
.
factory
.
strategy
;
import
cn.com.glsx.modules.factory.PlatformStrategy
;
import
org.springframework.stereotype.Service
;
@Service
public
class
TuyaStrategy
implements
PlatformStrategy
{
}
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