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 5263c796
authored
Mar 22, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码整改
1 parent
8b10edd1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
118 deletions
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/factory/PlatForm.java
deleted
100644 → 0
View file @
8b10edd
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 @
8b10edd
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 @
8b10edd
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 @
8b10edd
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 @
8b10edd
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