Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
self-service
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
廖旭伟
self-service
Commits
354631d5
Commit
354631d5
authored
Jan 12, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用信息改为从基础平台获取
parent
a4c0c563
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
613 additions
and
3 deletions
+613
-3
common-lib/src/main/java/com/mortals/xhx/common/pdu/app/AppPdu.java
.../src/main/java/com/mortals/xhx/common/pdu/app/AppPdu.java
+462
-0
common-lib/src/main/java/com/mortals/xhx/feign/app/IAppFeign.java
...ib/src/main/java/com/mortals/xhx/feign/app/IAppFeign.java
+63
-0
sst-manager/src/main/java/com/mortals/xhx/module/apps/model/vo/AppsInfoVo.java
...java/com/mortals/xhx/module/apps/model/vo/AppsInfoVo.java
+4
-1
sst-manager/src/main/java/com/mortals/xhx/module/apps/service/impl/AppsInfoServiceImpl.java
...als/xhx/module/apps/service/impl/AppsInfoServiceImpl.java
+81
-1
sst-manager/src/main/java/com/mortals/xhx/module/sst/service/impl/SstAppsServiceImpl.java
...rtals/xhx/module/sst/service/impl/SstAppsServiceImpl.java
+3
-1
No files found.
common-lib/src/main/java/com/mortals/xhx/common/pdu/app/AppPdu.java
0 → 100644
View file @
354631d5
This diff is collapsed.
Click to expand it.
common-lib/src/main/java/com/mortals/xhx/feign/app/IAppFeign.java
0 → 100644
View file @
354631d5
package
com.mortals.xhx.feign.app
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.app.AppPdu
;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.feign.IFeign
;
import
com.mortals.xhx.feign.device.IDeviceFeign
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
/**
* 自助终端应用
*/
@FeignClient
(
name
=
"base-manager"
,
path
=
"/base"
,
fallbackFactory
=
AppFeignFallbackFactory
.
class
)
public
interface
IAppFeign
extends
IFeign
{
/**
* 查看自助终端应用列表
*
* @param appPdu
* @return
*/
@PostMapping
(
value
=
"/app/list"
)
Rest
<
RespData
<
List
<
AppPdu
>>>
list
(
@RequestBody
AppPdu
appPdu
);
/**
* 查看自助终端应用
*
* @param id
* @return
*/
@GetMapping
(
value
=
"/app/info"
)
Rest
<
AppPdu
>
info
(
@RequestParam
(
value
=
"id"
)
Long
id
);
}
@Slf4j
@Component
class
AppFeignFallbackFactory
implements
FallbackFactory
<
IAppFeign
>
{
@Override
public
IAppFeign
create
(
Throwable
throwable
)
{
return
new
IAppFeign
(){
@Override
public
Rest
<
RespData
<
List
<
AppPdu
>>>
list
(
AppPdu
appPdu
)
{
return
Rest
.
fail
(
"暂时无法获取自助终端应用列表,请稍后再试!"
);
}
@Override
public
Rest
<
AppPdu
>
info
(
Long
id
)
{
return
Rest
.
fail
(
"暂时无法获取自助终端应用,请稍后再试!"
);
}
};
}
}
\ No newline at end of file
sst-manager/src/main/java/com/mortals/xhx/module/apps/model/vo/AppsInfoVo.java
View file @
354631d5
package
com.mortals.xhx.module.apps.model.vo
;
package
com.mortals.xhx.module.apps.model.vo
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.apps.model.AppsInfoEntity
;
import
com.mortals.xhx.module.apps.model.AppsInfoEntity
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -9,6 +11,7 @@ import java.util.List;
...
@@ -9,6 +11,7 @@ import java.util.List;
* @author zxfei
* @author zxfei
* @date 2022-12-26
* @date 2022-12-26
*/
*/
@Data
public
class
AppsInfoVo
extends
BaseEntityLong
{
public
class
AppsInfoVo
extends
BaseEntityLong
{
private
Long
siteId
;
}
}
\ No newline at end of file
sst-manager/src/main/java/com/mortals/xhx/module/apps/service/impl/AppsInfoServiceImpl.java
View file @
354631d5
package
com.mortals.xhx.module.apps.service.impl
;
package
com.mortals.xhx.module.apps.service.impl
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.app.AppPdu
;
import
com.mortals.xhx.feign.app.IAppFeign
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
...
@@ -6,6 +12,12 @@ import com.mortals.framework.model.Context;
...
@@ -6,6 +12,12 @@ import com.mortals.framework.model.Context;
import
com.mortals.xhx.module.apps.dao.AppsInfoDao
;
import
com.mortals.xhx.module.apps.dao.AppsInfoDao
;
import
com.mortals.xhx.module.apps.model.AppsInfoEntity
;
import
com.mortals.xhx.module.apps.model.AppsInfoEntity
;
import
com.mortals.xhx.module.apps.service.AppsInfoService
;
import
com.mortals.xhx.module.apps.service.AppsInfoService
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
/**
/**
* AppsInfoService
* AppsInfoService
* 应用信息 service实现
* 应用信息 service实现
...
@@ -16,4 +28,72 @@ import com.mortals.xhx.module.apps.service.AppsInfoService;
...
@@ -16,4 +28,72 @@ import com.mortals.xhx.module.apps.service.AppsInfoService;
@Service
(
"appsInfoService"
)
@Service
(
"appsInfoService"
)
public
class
AppsInfoServiceImpl
extends
AbstractCRUDServiceImpl
<
AppsInfoDao
,
AppsInfoEntity
,
Long
>
implements
AppsInfoService
{
public
class
AppsInfoServiceImpl
extends
AbstractCRUDServiceImpl
<
AppsInfoDao
,
AppsInfoEntity
,
Long
>
implements
AppsInfoService
{
@Autowired
private
IAppFeign
appFeign
;
@Override
public
AppsInfoEntity
save
(
AppsInfoEntity
entity
,
Context
context
)
throws
AppException
{
return
null
;
}
@Override
public
int
save
(
List
<
AppsInfoEntity
>
list
,
Context
context
)
throws
AppException
{
return
0
;
}
@Override
public
AppsInfoEntity
update
(
AppsInfoEntity
entity
,
Context
context
)
throws
AppException
{
return
null
;
}
@Override
public
int
update
(
List
<
AppsInfoEntity
>
list
,
Context
context
)
throws
AppException
{
return
0
;
}
@Override
public
AppsInfoEntity
get
(
Long
key
,
Context
context
)
throws
AppException
{
return
null
;
}
@Override
public
List
<
AppsInfoEntity
>
find
(
AppsInfoEntity
entity
)
throws
AppException
{
AppPdu
appPdu
=
new
AppPdu
();
appPdu
.
setSiteId
(
entity
.
getSiteId
());
appPdu
.
setSize
(
999
);
Rest
<
RespData
<
List
<
AppPdu
>>>
rest
=
appFeign
.
list
(
appPdu
);
if
(
rest
.
getCode
().
equals
(
YesNoEnum
.
YES
.
getValue
()))
{
List
<
AppsInfoEntity
>
appsInfoEntities
=
new
ArrayList
<>();
for
(
AppPdu
pdu:
rest
.
getData
().
getData
()){
appsInfoEntities
.
add
(
conversion
(
pdu
));
}
return
appsInfoEntities
;
}
else
{
return
Collections
.
emptyList
();
}
}
@Override
public
AppsInfoEntity
get
(
Long
id
)
throws
AppException
{
Rest
<
AppPdu
>
rest
=
appFeign
.
info
(
id
);
if
(
rest
.
getCode
().
equals
(
YesNoEnum
.
YES
.
getValue
()))
{
return
conversion
(
rest
.
getData
());
}
else
{
return
null
;
}
}
private
AppsInfoEntity
conversion
(
AppPdu
pdu
){
if
(
pdu
==
null
){
return
null
;
}
AppsInfoEntity
appsInfoEntity
=
new
AppsInfoEntity
();
appsInfoEntity
.
setId
(
pdu
.
getId
());
appsInfoEntity
.
setName
(
pdu
.
getAppName
());
appsInfoEntity
.
setDescribe
(
pdu
.
getSummary
());
appsInfoEntity
.
setIcon
(
pdu
.
getAppIconPath
());
appsInfoEntity
.
setUrl
(
pdu
.
getUrl
());
return
appsInfoEntity
;
}
}
}
\ No newline at end of file
sst-manager/src/main/java/com/mortals/xhx/module/sst/service/impl/SstAppsServiceImpl.java
View file @
354631d5
...
@@ -35,7 +35,9 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
...
@@ -35,7 +35,9 @@ public class SstAppsServiceImpl extends AbstractCRUDServiceImpl<SstAppsDao, SstA
if
(
siteId
==
null
){
if
(
siteId
==
null
){
throw
new
AppException
(
"站点id不能为空"
);
throw
new
AppException
(
"站点id不能为空"
);
}
}
List
<
AppsInfoEntity
>
allApps
=
appsInfoService
.
find
(
new
AppsInfoEntity
());
AppsInfoEntity
appsInfoQuery
=
new
AppsInfoEntity
();
appsInfoQuery
.
setSiteId
(
siteId
);
List
<
AppsInfoEntity
>
allApps
=
appsInfoService
.
find
(
appsInfoQuery
);
SstAppsEntity
query
=
new
SstAppsEntity
();
SstAppsEntity
query
=
new
SstAppsEntity
();
query
.
setSiteId
(
siteId
);
query
.
setSiteId
(
siteId
);
List
<
SstAppsEntity
>
appsEntities
=
this
.
find
(
query
);
List
<
SstAppsEntity
>
appsEntities
=
this
.
find
(
query
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment