Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sample-form-platform
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
赵啸非
sample-form-platform
Commits
0710b0fc
Commit
0710b0fc
authored
Mar 31, 2023
by
“yiyousong”
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/sample-form-platform
parents
ee8464b1
76821993
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2347 additions
and
25 deletions
+2347
-25
common-lib/src/main/java/com/mortals/xhx/common/pdu/dept/DeptPdu.java
...rc/main/java/com/mortals/xhx/common/pdu/dept/DeptPdu.java
+2206
-0
common-lib/src/main/java/com/mortals/xhx/feign/base/IApiBaseManagerFeign.java
...java/com/mortals/xhx/feign/base/IApiBaseManagerFeign.java
+1
-1
common-lib/src/main/java/com/mortals/xhx/feign/base/pdu/DeptPdu.java
...src/main/java/com/mortals/xhx/feign/base/pdu/DeptPdu.java
+0
-14
common-lib/src/main/java/com/mortals/xhx/feign/dept/IDeptFeign.java
.../src/main/java/com/mortals/xhx/feign/dept/IDeptFeign.java
+100
-0
sample-form-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceMatterDatumServiceImpl.java
...ule/device/service/impl/DeviceMatterDatumServiceImpl.java
+19
-0
sample-form-manager/src/main/java/com/mortals/xhx/module/home/pdu/HomeQueryPdu.java
...in/java/com/mortals/xhx/module/home/pdu/HomeQueryPdu.java
+1
-1
sample-form-manager/src/main/java/com/mortals/xhx/module/home/web/HomeController.java
.../java/com/mortals/xhx/module/home/web/HomeController.java
+20
-9
No files found.
common-lib/src/main/java/com/mortals/xhx/common/pdu/dept/DeptPdu.java
0 → 100644
View file @
0710b0fc
This diff is collapsed.
Click to expand it.
common-lib/src/main/java/com/mortals/xhx/feign/base/IApiBaseManagerFeign.java
View file @
0710b0fc
...
@@ -2,8 +2,8 @@ package com.mortals.xhx.feign.base;
...
@@ -2,8 +2,8 @@ package com.mortals.xhx.feign.base;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.pdu.dept.DeptPdu
;
import
com.mortals.xhx.feign.IFeign
;
import
com.mortals.xhx.feign.IFeign
;
import
com.mortals.xhx.feign.base.pdu.DeptPdu
;
import
com.mortals.xhx.feign.base.pdu.SitePdu
;
import
com.mortals.xhx.feign.base.pdu.SitePdu
;
import
com.mortals.xhx.feign.rsp.ApiResp
;
import
com.mortals.xhx.feign.rsp.ApiResp
;
import
feign.hystrix.FallbackFactory
;
import
feign.hystrix.FallbackFactory
;
...
...
common-lib/src/main/java/com/mortals/xhx/feign/base/pdu/DeptPdu.java
deleted
100644 → 0
View file @
ee8464b1
package
com.mortals.xhx.feign.base.pdu
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
DeptPdu
{
private
List
<
Long
>
idList
;
private
Long
siteId
;
private
Integer
page
;
/**分页每页显示数 -1为不分页*/
private
Integer
size
;
}
common-lib/src/main/java/com/mortals/xhx/feign/dept/IDeptFeign.java
0 → 100644
View file @
0710b0fc
package
com.mortals.xhx.feign.dept
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.dept.DeptPdu
;
import
com.mortals.xhx.feign.IFeign
;
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.*
;
import
java.util.List
;
/**
* 部门 Feign接口
* @author zxfei
* @date 2022-12-09
*/
@FeignClient
(
name
=
"base-manager"
,
path
=
"/base"
,
fallbackFactory
=
DeptFeignFallbackFactory
.
class
)
public
interface
IDeptFeign
extends
IFeign
{
/**
* 查看部门列表
*
* @param deptPdu
* @return
*/
@PostMapping
(
value
=
"/dept/list"
)
Rest
<
RespData
<
List
<
DeptPdu
>>>
list
(
@RequestBody
DeptPdu
deptPdu
);
/**
* 查看部门
*
* @param id
* @return
*/
@GetMapping
(
value
=
"/dept/info"
)
Rest
<
DeptPdu
>
info
(
@RequestParam
(
value
=
"id"
)
Long
id
);
/**
* 删除部门
*
* @param ids
* @return
*/
@GetMapping
(
value
=
"/dept/delete"
)
Rest
<
Void
>
delete
(
Long
[]
ids
,
@RequestHeader
(
"Authorization"
)
String
authorization
);
/**
* 部门保存更新
*
* @param deptPdu
* @return
*/
@PostMapping
(
value
=
"/dept/save"
)
Rest
<
RespData
<
DeptPdu
>>
save
(
@RequestBody
DeptPdu
deptPdu
,
@RequestHeader
(
"Authorization"
)
String
authorization
);
}
@Slf4j
@Component
class
DeptFeignFallbackFactory
implements
FallbackFactory
<
IDeptFeign
>
{
@Override
public
IDeptFeign
create
(
Throwable
t
)
{
return
new
IDeptFeign
()
{
@Override
public
Rest
<
RespData
<
List
<
DeptPdu
>>>
list
(
DeptPdu
deptPdu
)
{
return
Rest
.
fail
(
"暂时无法获取部门列表,请稍后再试!"
);
}
@Override
public
Rest
<
DeptPdu
>
info
(
Long
id
)
{
return
Rest
.
fail
(
"暂时无法获取部门详细,请稍后再试!"
);
}
@Override
public
Rest
<
Void
>
delete
(
Long
[]
ids
,
String
authorization
)
{
return
Rest
.
fail
(
"暂时无法删除部门,请稍后再试!"
);
}
@Override
public
Rest
<
RespData
<
DeptPdu
>>
save
(
DeptPdu
deptPdu
,
String
authorization
)
{
return
Rest
.
fail
(
"暂时无法保存部门,请稍后再试!"
);
}
};
}
}
sample-form-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceMatterDatumServiceImpl.java
View file @
0710b0fc
package
com.mortals.xhx.module.device.service.impl
;
package
com.mortals.xhx.module.device.service.impl
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.dept.DeptPdu
;
import
com.mortals.xhx.feign.dept.IDeptFeign
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.model.DeviceMatterDatumQuery
;
import
com.mortals.xhx.module.device.model.DeviceMatterDatumQuery
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
...
@@ -38,6 +43,8 @@ public class DeviceMatterDatumServiceImpl extends AbstractCRUDServiceImpl<Device
...
@@ -38,6 +43,8 @@ public class DeviceMatterDatumServiceImpl extends AbstractCRUDServiceImpl<Device
@Autowired
@Autowired
private
MatterDatumService
matterDatumService
;
private
MatterDatumService
matterDatumService
;
@Autowired
private
IDeptFeign
deptFeign
;
@Override
@Override
...
@@ -71,6 +78,18 @@ public class DeviceMatterDatumServiceImpl extends AbstractCRUDServiceImpl<Device
...
@@ -71,6 +78,18 @@ public class DeviceMatterDatumServiceImpl extends AbstractCRUDServiceImpl<Device
entity
.
setSource
(
matterEntity
.
getSource
());
entity
.
setSource
(
matterEntity
.
getSource
());
entity
.
setSort
(
matterEntity
.
getSort
());
entity
.
setSort
(
matterEntity
.
getSort
());
entity
.
setDeptId
(
matterEntity
.
getDeptId
());
entity
.
setDeptId
(
matterEntity
.
getDeptId
());
DeptPdu
deptPdu
=
new
DeptPdu
();
deptPdu
.
setDeptNumber
(
matterEntity
.
getDeptCode
());
deptPdu
.
setSiteId
(
entity
.
getSiteId
());
Rest
<
RespData
<
List
<
DeptPdu
>>>
rest
=
deptFeign
.
list
(
deptPdu
);
if
(
YesNoEnum
.
YES
.
getValue
()==
rest
.
getCode
()){
List
<
DeptPdu
>
data
=
rest
.
getData
().
getData
();
if
(!
ObjectUtils
.
isEmpty
(
data
)){
entity
.
setDeptId
(
data
.
get
(
0
).
getId
());
}
}
entity
.
setDeptCode
(
matterEntity
.
getDeptCode
());
entity
.
setDeptCode
(
matterEntity
.
getDeptCode
());
entity
.
setDeptName
(
matterEntity
.
getDeptName
());
entity
.
setDeptName
(
matterEntity
.
getDeptName
());
}
}
...
...
sample-form-manager/src/main/java/com/mortals/xhx/module/home/pdu/HomeQueryPdu.java
View file @
0710b0fc
...
@@ -6,7 +6,7 @@ import lombok.Data;
...
@@ -6,7 +6,7 @@ import lombok.Data;
public
class
HomeQueryPdu
{
public
class
HomeQueryPdu
{
private
Long
siteId
;
private
Long
siteId
;
private
String
device
num
;
private
String
device
Code
;
private
Integer
newSource
;
private
Integer
newSource
;
}
}
sample-form-manager/src/main/java/com/mortals/xhx/module/home/web/HomeController.java
View file @
0710b0fc
...
@@ -15,9 +15,11 @@ import com.mortals.framework.web.BaseJsonBodyController;
...
@@ -15,9 +15,11 @@ import com.mortals.framework.web.BaseJsonBodyController;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.dept.DeptPdu
;
import
com.mortals.xhx.feign.base.IApiBaseManagerFeign
;
import
com.mortals.xhx.feign.base.IApiBaseManagerFeign
;
import
com.mortals.xhx.feign.base.pdu.DeptPdu
;
import
com.mortals.xhx.feign.base.pdu.SitePdu
;
import
com.mortals.xhx.feign.base.pdu.SitePdu
;
import
com.mortals.xhx.feign.dept.IDeptFeign
;
import
com.mortals.xhx.feign.rsp.ApiResp
;
import
com.mortals.xhx.feign.rsp.ApiResp
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.baseset.model.BasesetEntity
;
import
com.mortals.xhx.module.baseset.model.BasesetEntity
;
...
@@ -65,6 +67,8 @@ public class HomeController extends BaseJsonBodyController {
...
@@ -65,6 +67,8 @@ public class HomeController extends BaseJsonBodyController {
private
ISiteFeign
siteFeign
;
private
ISiteFeign
siteFeign
;
@Autowired
@Autowired
private
BasesetService
basesetService
;
private
BasesetService
basesetService
;
@Autowired
private
IDeptFeign
deptFeign
;
@PostMapping
({
"site/list"
})
@PostMapping
({
"site/list"
})
public
Rest
<
Object
>
list
()
{
public
Rest
<
Object
>
list
()
{
...
@@ -132,17 +136,17 @@ public class HomeController extends BaseJsonBodyController {
...
@@ -132,17 +136,17 @@ public class HomeController extends BaseJsonBodyController {
deptPdu
.
setSiteId
(
queryPdu
.
getSiteId
());
deptPdu
.
setSiteId
(
queryPdu
.
getSiteId
());
deptPdu
.
setSize
(-
1
);
deptPdu
.
setSize
(-
1
);
if
(!
ObjectUtils
.
isEmpty
(
queryPdu
.
getDevice
num
())){
if
(!
ObjectUtils
.
isEmpty
(
queryPdu
.
getDevice
Code
())){
List
<
Long
>
deptIdList
=
deviceMatterDatumService
.
find
(
new
DeviceMatterDatumQuery
().
deviceCode
(
queryPdu
.
getDevice
num
())).
stream
().
map
(
item
->
item
.
getDeptId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
deptIdList
=
deviceMatterDatumService
.
find
(
new
DeviceMatterDatumQuery
().
deviceCode
(
queryPdu
.
getDevice
Code
())).
stream
().
map
(
item
->
item
.
getDeptId
()).
collect
(
Collectors
.
toList
());
deptPdu
.
setIdList
(
deptIdList
);
deptPdu
.
setIdList
(
deptIdList
);
}
}
String
resp
=
iApiBaseManagerFeign
.
getDeptByQuery
(
deptPdu
);
Rest
<
RespData
<
List
<
DeptPdu
>>>
apiResp
=
deptFeign
.
list
(
deptPdu
);
ApiResp
<
JSONObject
>
apiResp
=
JSON
.
parseObject
(
resp
,
ApiResp
.
class
);
//
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if
(
apiResp
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
())
{
if
(
apiResp
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
())
{
throw
new
AppException
(
"获取用户站点部门列表失败:"
+
apiResp
.
getMsg
());
throw
new
AppException
(
"获取用户站点部门列表失败:"
+
apiResp
.
getMsg
());
}
}
if
(
apiResp
.
getData
().
get
(
"data"
)
!=
null
)
{
if
(
apiResp
.
getData
().
get
Data
()
!=
null
)
{
model
.
put
(
"data"
,
apiResp
.
getData
().
get
(
"data"
));
model
.
put
(
"data"
,
apiResp
.
getData
().
get
Data
(
));
}
else
{
}
else
{
model
.
put
(
"data"
,
Collections
.
emptyList
());
model
.
put
(
"data"
,
Collections
.
emptyList
());
}
}
...
@@ -173,8 +177,15 @@ public class HomeController extends BaseJsonBodyController {
...
@@ -173,8 +177,15 @@ public class HomeController extends BaseJsonBodyController {
model
.
put
(
"deptMap"
,
new
HashMap
<>());
model
.
put
(
"deptMap"
,
new
HashMap
<>());
try
{
try
{
if
(
queryPdu
.
getSiteId
()
!=
null
)
{
if
(
queryPdu
.
getSiteId
()
!=
null
)
{
Map
<
String
,
String
>
deptMap
=
matterService
.
find
(
new
MatterQuery
().
siteId
(
queryPdu
.
getSiteId
())).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getDeptCode
(),
y
->
y
.
getDeptName
(),
(
o
,
n
)
->
n
));
if
(!
ObjectUtils
.
isEmpty
(
queryPdu
.
getDeviceCode
()))
{
model
.
put
(
"deptMap"
,
deptMap
);
Map
<
String
,
String
>
deptMap
=
deviceMatterDatumService
.
find
(
new
DeviceMatterDatumQuery
().
siteId
(
queryPdu
.
getSiteId
()).
deviceCode
(
queryPdu
.
getDeviceCode
())).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getDeptCode
(),
y
->
y
.
getDeptName
(),
(
o
,
n
)
->
n
));
;
model
.
put
(
"deptMap"
,
deptMap
);
// deptPdu.setIdList(deptIdList);
}
else
{
Map
<
String
,
String
>
deptMap
=
matterService
.
find
(
new
MatterQuery
().
siteId
(
queryPdu
.
getSiteId
())).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getDeptCode
(),
y
->
y
.
getDeptName
(),
(
o
,
n
)
->
n
));
model
.
put
(
"deptMap"
,
deptMap
);
}
}
}
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
model
.
put
(
"message_info"
,
busiDesc
+
"成功"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
...
...
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