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
38f5d3fa
Commit
38f5d3fa
authored
Apr 17, 2024
by
“yiyousong”
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/sample-form-platform
parents
e93a2fca
6ae3e085
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
161 additions
and
142 deletions
+161
-142
common-lib/src/main/java/com/mortals/xhx/common/pdu/device/DevicePdu.java
...ain/java/com/mortals/xhx/common/pdu/device/DevicePdu.java
+24
-0
common-lib/src/main/java/com/mortals/xhx/common/pdu/product/ProductPdu.java
...n/java/com/mortals/xhx/common/pdu/product/ProductPdu.java
+33
-0
common-lib/src/main/java/com/mortals/xhx/feign/device/IDeviceFeign.java
.../main/java/com/mortals/xhx/feign/device/IDeviceFeign.java
+17
-0
sample-form-manager/db/add.sql
sample-form-manager/db/add.sql
+4
-1
sample-form-manager/pom.xml
sample-form-manager/pom.xml
+9
-13
sample-form-manager/src/main/bin/start.sh
sample-form-manager/src/main/bin/start.sh
+2
-1
sample-form-manager/src/main/java/com/mortals/xhx/daemon/task/SyncSiteDeviceTaskImpl.java
...a/com/mortals/xhx/daemon/task/SyncSiteDeviceTaskImpl.java
+23
-80
sample-form-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
...ava/com/mortals/xhx/module/device/model/DeviceEntity.java
+1
-1
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/model/vo/MatterDatumVo.java
...com/mortals/xhx/module/matter/model/vo/MatterDatumVo.java
+9
-0
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterDatumServiceImpl.java
...hx/module/matter/service/impl/MatterDatumServiceImpl.java
+39
-46
No files found.
common-lib/src/main/java/com/mortals/xhx/common/pdu/device/DevicePdu.java
View file @
38f5d3fa
...
@@ -86,10 +86,34 @@ public class DevicePdu extends BaseEntityLong {
...
@@ -86,10 +86,34 @@ public class DevicePdu extends BaseEntityLong {
*/
*/
private
Integer
source
;
private
Integer
source
;
/**
* 设备生产厂商ID
*/
private
Long
deviceFirmId
;
/**
* 设备生产厂商名称
*/
private
String
deviceFirmname
;
/**
* 设备访问ip
*/
private
String
ip
;
/**
* 端口
*/
private
String
port
;
/**
/**
* 启用状态 (0.停止,1.启用)
* 启用状态 (0.停止,1.启用)
*/
*/
private
Integer
enabled
;
private
Integer
enabled
;
/**
* 最近上线时间
*/
private
Date
onlineTime
;
/**
* 最近离线时间
*/
private
Date
offlineTime
;
public
void
initAttrValue
(){
public
void
initAttrValue
(){
...
...
common-lib/src/main/java/com/mortals/xhx/common/pdu/product/ProductPdu.java
0 → 100644
View file @
38f5d3fa
package
com.mortals.xhx.common.pdu.product
;
import
lombok.Data
;
/**
* 产品实体对象
*
* @author zxfei
* @date 2022-11-09
*/
@Data
public
class
ProductPdu
{
/**
* id
*/
private
Long
id
;
/**
* 关联平台
*/
private
Long
platformId
;
/**
* 产品名称,名称唯一
*/
private
String
productName
;
/**
* 产品编码
*/
private
String
productCode
;
}
\ No newline at end of file
common-lib/src/main/java/com/mortals/xhx/feign/device/IDeviceFeign.java
View file @
38f5d3fa
...
@@ -6,6 +6,7 @@ import com.mortals.xhx.common.pdu.device.DevicePdu;
...
@@ -6,6 +6,7 @@ import com.mortals.xhx.common.pdu.device.DevicePdu;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.pdu.device.DeviceReq
;
import
com.mortals.xhx.common.pdu.device.DeviceReq
;
import
com.mortals.xhx.common.pdu.product.ProductPdu
;
import
com.mortals.xhx.feign.IFeign
;
import
com.mortals.xhx.feign.IFeign
;
import
feign.hystrix.FallbackFactory
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -74,6 +75,17 @@ public interface IDeviceFeign extends IFeign {
...
@@ -74,6 +75,17 @@ public interface IDeviceFeign extends IFeign {
@PostMapping
(
value
=
"/api/receive"
)
@PostMapping
(
value
=
"/api/receive"
)
Rest
<
String
>
deviceCall
(
@RequestBody
DeviceReq
deviceReq
);
Rest
<
String
>
deviceCall
(
@RequestBody
DeviceReq
deviceReq
);
/**
* 查看设备列表
*
* @param productPdu
* @return
*/
@PostMapping
(
value
=
"/product/interlist"
)
Rest
<
RespData
<
List
<
ProductPdu
>>>
list
(
@RequestBody
ProductPdu
productPdu
);
}
}
...
@@ -107,6 +119,11 @@ class DeviceFeignFallbackFactory implements FallbackFactory<IDeviceFeign> {
...
@@ -107,6 +119,11 @@ class DeviceFeignFallbackFactory implements FallbackFactory<IDeviceFeign> {
public
Rest
<
String
>
deviceCall
(
DeviceReq
deviceReq
)
{
public
Rest
<
String
>
deviceCall
(
DeviceReq
deviceReq
)
{
return
Rest
.
fail
(
"暂时无法保存设备,请稍后再试!"
);
return
Rest
.
fail
(
"暂时无法保存设备,请稍后再试!"
);
}
}
@Override
public
Rest
<
RespData
<
List
<
ProductPdu
>>>
list
(
ProductPdu
productPdu
)
{
return
Rest
.
fail
(
"请稍后再试!"
);
}
};
};
}
}
}
}
...
...
sample-form-manager/db/add.sql
View file @
38f5d3fa
...
@@ -64,4 +64,7 @@ ALTER TABLE mortals_xhx_device
...
@@ -64,4 +64,7 @@ ALTER TABLE mortals_xhx_device
ADD
COLUMN
`deviceInBuilding`
tinyint
(
4
)
COMMENT
'所属楼栋'
;
ADD
COLUMN
`deviceInBuilding`
tinyint
(
4
)
COMMENT
'所属楼栋'
;
ALTER
TABLE
mortals_xhx_device
ALTER
TABLE
mortals_xhx_device
ADD
COLUMN
`deviceInFloor`
tinyint
(
4
)
COMMENT
'所属楼层'
;
ADD
COLUMN
`deviceInFloor`
tinyint
(
4
)
COMMENT
'所属楼层'
;
\ No newline at end of file
ALTER
TABLE
mortals_xhx_device
ADD
COLUMN
`resolution`
varchar
(
64
)
COMMENT
'分辨率'
;
sample-form-manager/pom.xml
View file @
38f5d3fa
...
@@ -14,9 +14,18 @@
...
@@ -14,9 +14,18 @@
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<description>
样表服务管理平台
</description>
<description>
样表服务管理平台
</description>
<properties>
<properties>
<!-- 默认值 -->
<profiles.server.debug></profiles.server.debug>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.log.level>
info
</profiles.log.level>
<profiles.publish.path>
/home/publish
</profiles.publish.path>
<profiles.filepath>
/mortals/app/data
</profiles.filepath>
</properties>
</properties>
<profiles>
<profiles>
<profile>
<profile>
<id>
develop
</id>
<id>
develop
</id>
...
@@ -25,8 +34,6 @@
...
@@ -25,8 +34,6 @@
</activation>
</activation>
<properties>
<properties>
<profiles.active>
develop
</profiles.active>
<profiles.active>
develop
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
...
@@ -38,8 +45,6 @@
...
@@ -38,8 +45,6 @@
<id>
test
</id>
<id>
test
</id>
<properties>
<properties>
<profiles.active>
test
</profiles.active>
<profiles.active>
test
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
192.168.0.252:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
192.168.0.252:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
...
@@ -51,8 +56,6 @@
...
@@ -51,8 +56,6 @@
<id>
product
</id>
<id>
product
</id>
<properties>
<properties>
<profiles.active>
product
</profiles.active>
<profiles.active>
product
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
192.168.0.250:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
192.168.0.250:8848
</profiles.nacos.server-addr>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
...
@@ -65,8 +68,6 @@
...
@@ -65,8 +68,6 @@
<id>
yibin
</id>
<id>
yibin
</id>
<properties>
<properties>
<profiles.active>
yibin
</profiles.active>
<profiles.active>
yibin
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
172.15.28.120:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
172.15.28.120:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
...
@@ -79,7 +80,6 @@
...
@@ -79,7 +80,6 @@
<id>
xuanhan
</id>
<id>
xuanhan
</id>
<properties>
<properties>
<profiles.active>
xuanhan
</profiles.active>
<profiles.active>
xuanhan
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
D:/home/mortals/app/logs
</profiles.log.path>
<profiles.log.path>
D:/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
...
@@ -93,8 +93,6 @@
...
@@ -93,8 +93,6 @@
<id>
yanyuan
</id>
<id>
yanyuan
</id>
<properties>
<properties>
<profiles.active>
yanyuan
</profiles.active>
<profiles.active>
yanyuan
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
...
@@ -107,8 +105,6 @@
...
@@ -107,8 +105,6 @@
<id>
pengxi
</id>
<id>
pengxi
</id>
<properties>
<properties>
<profiles.active>
pengxi
</profiles.active>
<profiles.active>
pengxi
</profiles.active>
<profiles.server.port>
17002
</profiles.server.port>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.nacos.server-addr>
192.168.106.6:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
192.168.106.6:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
...
...
sample-form-manager/src/main/bin/start.sh
View file @
38f5d3fa
#!/bin/sh
#!/bin/sh
PORT
=
"@profiles.server.port@"
PORT
=
"@profiles.server.port@"
DEBUG
=
@profiles.server.debug@
BASEDIR
=
`
dirname
$0
`
/..
BASEDIR
=
`
dirname
$0
`
/..
BASEDIR
=
`
(
cd
"
$BASEDIR
"
;
pwd
)
`
BASEDIR
=
`
(
cd
"
$BASEDIR
"
;
pwd
)
`
PROJECT_NAME
=
"@project.artifactId@"
;
PROJECT_NAME
=
"@project.artifactId@"
;
...
@@ -55,12 +56,12 @@ cd "$BASEDIR/boot";
...
@@ -55,12 +56,12 @@ cd "$BASEDIR/boot";
echo
"starting application
$PROJECT_NAME
......"
echo
"starting application
$PROJECT_NAME
......"
exec
"
$JAVACMD
"
$JAVA_OPTS
\
exec
"
$JAVACMD
"
$JAVA_OPTS
\
$DEBUG
\
$EXTRA_JVM_ARGUMENTS
\
$EXTRA_JVM_ARGUMENTS
\
-Dapp
.name
=
"
$PROJECT_NAME
"
\
-Dapp
.name
=
"
$PROJECT_NAME
"
\
-Dapp
.port
=
"
$PORT
"
\
-Dapp
.port
=
"
$PORT
"
\
-Dbasedir
=
"
$BASEDIR
"
\
-Dbasedir
=
"
$BASEDIR
"
\
-Djava
.io.tmpdir
=
$TEMP_PATH
\
-Djava
.io.tmpdir
=
$TEMP_PATH
\
-agentlib
:jdwp
=
transport
=
dt_socket,server
=
y,suspend
=
n,address
=
15689
\
-jar
$MAIN_CLASS
\
-jar
$MAIN_CLASS
\
>
/dev/null &
>
/dev/null &
...
...
sample-form-manager/src/main/java/com/mortals/xhx/daemon/task/SyncSiteDeviceTaskImpl.java
View file @
38f5d3fa
...
@@ -10,6 +10,7 @@ import com.mortals.framework.service.ITaskExcuteService;
...
@@ -10,6 +10,7 @@ import com.mortals.framework.service.ITaskExcuteService;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.common.pdu.device.DevicePdu
;
import
com.mortals.xhx.common.pdu.product.ProductPdu
;
import
com.mortals.xhx.common.pdu.site.SiteMatterPdu
;
import
com.mortals.xhx.common.pdu.site.SiteMatterPdu
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.common.pdu.skin.SkinBasePdu
;
import
com.mortals.xhx.common.pdu.skin.SkinBasePdu
;
...
@@ -72,17 +73,30 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
...
@@ -72,17 +73,30 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
}
}
private
void
syncDevice
()
{
private
void
syncDevice
()
{
Long
productId
=
null
;
ProductPdu
productPdu
=
new
ProductPdu
();
productPdu
.
setProductCode
(
"ybj"
);
Rest
<
RespData
<
List
<
ProductPdu
>>>
rest
=
deviceFeign
.
list
(
productPdu
);
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
()
&&
!
ObjectUtils
.
isEmpty
(
rest
.
getData
()))
{
if
(!
ObjectUtils
.
isEmpty
(
rest
.
getData
().
getData
()))
{
ProductPdu
pdu
=
rest
.
getData
().
getData
().
get
(
0
);
productId
=
pdu
.
getId
();
}
}
SitePdu
sitePdu
=
new
SitePdu
();
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setId
(
1L
);
sitePdu
.
setId
(
1L
);
Rest
<
List
<
SitePdu
>>
siteRest
=
siteFeign
.
getFlatSitesBySiteId
(
sitePdu
);
Rest
<
List
<
SitePdu
>>
siteRest
=
siteFeign
.
getFlatSitesBySiteId
(
sitePdu
);
if
(
siteRest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
if
(
siteRest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
log
.
info
(
"站点总数量:{}"
,
siteRest
.
getData
().
size
());
log
.
info
(
"站点总数量:{}"
,
siteRest
.
getData
().
size
());
siteRest
.
getData
().
forEach
(
site
->
{
for
(
SitePdu
site
:
siteRest
.
getData
())
{
log
.
info
(
"站点名称:{}"
,
site
.
getSiteName
());
log
.
info
(
"站点名称:{}"
,
site
.
getSiteName
());
DevicePdu
devicePdu
=
new
DevicePdu
();
DevicePdu
devicePdu
=
new
DevicePdu
();
//devicePdu.setProductCode("ybj");
if
(!
ObjectUtils
.
isEmpty
(
productId
))
{
//devicePdu.setProductId(10L);
devicePdu
.
setProductId
(
productId
);
devicePdu
.
setProductName
(
"样表机"
);
}
else
{
devicePdu
.
setProductName
(
"样表机"
);
}
devicePdu
.
setSiteId
(
site
.
getId
());
devicePdu
.
setSiteId
(
site
.
getId
());
devicePdu
.
setSize
(-
1
);
devicePdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
DevicePdu
>>>
deviceRest
=
deviceFeign
.
list
(
devicePdu
);
Rest
<
RespData
<
List
<
DevicePdu
>>>
deviceRest
=
deviceFeign
.
list
(
devicePdu
);
...
@@ -95,6 +109,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
...
@@ -95,6 +109,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
DeviceEntity
deviceEntity
=
new
DeviceEntity
();
DeviceEntity
deviceEntity
=
new
DeviceEntity
();
deviceEntity
.
initAttrValue
();
deviceEntity
.
initAttrValue
();
BeanUtils
.
copyProperties
(
newDevice
,
deviceEntity
,
BeanUtil
.
getNullPropertyNames
(
newDevice
));
BeanUtils
.
copyProperties
(
newDevice
,
deviceEntity
,
BeanUtil
.
getNullPropertyNames
(
newDevice
));
deviceEntity
.
setDeviceId
(
newDevice
.
getId
());
return
deviceEntity
;
return
deviceEntity
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -109,7 +124,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
...
@@ -109,7 +124,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
List
<
DeviceEntity
>
updateDeviceLsit
=
newDeviceList
.
stream
().
map
(
item
->
{
List
<
DeviceEntity
>
updateDeviceLsit
=
newDeviceList
.
stream
().
map
(
item
->
{
if
(
oldDeviceMap
.
containsKey
(
item
.
getDeviceCode
()))
{
if
(
oldDeviceMap
.
containsKey
(
item
.
getDeviceCode
()))
{
item
.
setId
(
oldDeviceMap
.
get
(
item
.
getDeviceCode
()).
getId
());
item
.
setId
(
oldDeviceMap
.
get
(
item
.
getDeviceCode
()).
getId
());
item
.
setDeviceId
(
item
.
getId
());
//
item.setDeviceId(item.getId());
item
.
setProductCode
(
oldDeviceMap
.
get
(
item
.
getDeviceCode
()).
getProductCode
());
item
.
setProductCode
(
oldDeviceMap
.
get
(
item
.
getDeviceCode
()).
getProductCode
());
item
.
setProductName
(
oldDeviceMap
.
get
(
item
.
getDeviceCode
()).
getProductName
());
item
.
setProductName
(
oldDeviceMap
.
get
(
item
.
getDeviceCode
()).
getProductName
());
item
.
setUpdateTime
(
new
Date
());
item
.
setUpdateTime
(
new
Date
());
...
@@ -121,7 +136,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
...
@@ -121,7 +136,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
List
<
DeviceEntity
>
saveDeviceList
=
newDeviceList
.
stream
().
map
(
item
->
{
List
<
DeviceEntity
>
saveDeviceList
=
newDeviceList
.
stream
().
map
(
item
->
{
//log.info("deviceCode:{},oldDeviceMap:{}",item.getDeviceCode(),oldDeviceMap.containsKey(item.getDeviceCode()));
//log.info("deviceCode:{},oldDeviceMap:{}",item.getDeviceCode(),oldDeviceMap.containsKey(item.getDeviceCode()));
if
(!
oldDeviceMap
.
containsKey
(
item
.
getDeviceCode
()))
{
if
(!
oldDeviceMap
.
containsKey
(
item
.
getDeviceCode
()))
{
item
.
setDeviceId
(
item
.
getId
());
//
item.setDeviceId(item.getId());
item
.
setCreateUserId
(
1L
);
item
.
setCreateUserId
(
1L
);
item
.
setProductName
(
"样表机"
);
item
.
setProductName
(
"样表机"
);
item
.
setCreateUserName
(
"系统管理员"
);
item
.
setCreateUserName
(
"系统管理员"
);
...
@@ -141,7 +156,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
...
@@ -141,7 +156,7 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
if
(!
ObjectUtils
.
isEmpty
(
updateDeviceLsit
))
{
if
(!
ObjectUtils
.
isEmpty
(
updateDeviceLsit
))
{
log
.
info
(
"设备更新,size:{}"
,
updateDeviceLsit
.
size
());
log
.
info
(
"设备更新,size:{}"
,
updateDeviceLsit
.
size
());
deviceService
.
update
(
updateDeviceLsit
);
deviceService
.
update
(
updateDeviceLsit
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
saveDeviceList
))
{
if
(!
ObjectUtils
.
isEmpty
(
saveDeviceList
))
{
...
@@ -157,84 +172,12 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
...
@@ -157,84 +172,12 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
}
else
{
}
else
{
log
.
info
(
"设备列表查询异常,{}"
,
JSON
.
toJSONString
(
deviceRest
));
log
.
info
(
"设备列表查询异常,{}"
,
JSON
.
toJSONString
(
deviceRest
));
}
}
}
);
}
}
else
{
}
else
{
log
.
info
(
"站点列表查询异常,{}"
,
JSON
.
toJSONString
(
siteRest
));
log
.
info
(
"站点列表查询异常,{}"
,
JSON
.
toJSONString
(
siteRest
));
}
}
}
}
/* private void syncSkin() {
SkinBasePdu skinBasePdu = new SkinBasePdu();
skinBasePdu.setProductName("样表机");
skinBasePdu.setSize(-1);
Rest<RespData<List<SkinBasePdu>>> skinBaseRest = skinBaseFeign.list(skinBasePdu);
if (skinBaseRest.getCode() == YesNoEnum.YES.getValue()) {
List<SkinBasePdu> skinBasePduList = skinBaseRest.getData().getData();
log.info("样表机皮肤总数量:{}", skinBasePduList.size());
if (!ObjectUtils.isEmpty(skinBasePduList)) {
List<SkinEntity> newSkinList = skinBasePduList.stream().map(newSkin -> {
SkinEntity skinEntity = new SkinEntity();
skinEntity.initAttrValue();
//存相对地址
newSkin.setCssFilePath("/"+StrUtil.subAfter(newSkin.getCssFilePath(), "/", true));
newSkin.setPreviewImagePath("/"+StrUtil.subAfter(newSkin.getPreviewImagePath(), "/", true));
BeanUtils.copyProperties(newSkin, skinEntity, BeanUtil.getNullPropertyNames(newSkin));
return skinEntity;
}).collect(Collectors.toList());
List<SkinEntity> oldSkinList = skinService.find(new SkinQuery());
Map<Long, SkinEntity> oldSkinMap = oldSkinList.stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
Map<Long, SkinEntity> newSkinMap = newSkinList.stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
List<SkinEntity> updateSkinLsit = newSkinList.stream().map(item -> {
if (oldSkinMap.containsKey(item.getId())) {
item.setUsed(oldSkinMap.get(item.getId()).getUsed());
item.setUpdateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
List<SkinEntity> saveSkinList = newSkinList.stream().map(item -> {
if (!oldSkinMap.containsKey(item.getId())) {
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
//做差集
List<Long> delSkinList = oldSkinList.stream().map(item -> {
if (!newSkinMap.containsKey(item.getId())) {
return item.getId();
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
// if (!ObjectUtils.isEmpty(updateSkinLsit)) {
// log.info("皮肤更新,size:{}", updateSkinLsit.size());
// skinService.update(updateSkinLsit);
// }
if (!ObjectUtils.isEmpty(saveSkinList)) {
log.info("皮肤新增,size:{}", saveSkinList.size());
skinService.save(saveSkinList);
}
if (!ObjectUtils.isEmpty(delSkinList)) {
log.info("皮肤删除,size:{}", delSkinList.size());
skinService.remove(delSkinList, null);
}
}
}
}*/
@Override
@Override
public
void
stopTask
(
ITask
task
)
throws
AppException
{
public
void
stopTask
(
ITask
task
)
throws
AppException
{
...
...
sample-form-manager/src/main/java/com/mortals/xhx/module/device/model/DeviceEntity.java
View file @
38f5d3fa
...
@@ -160,7 +160,7 @@ public class DeviceEntity extends DeviceVo {
...
@@ -160,7 +160,7 @@ public class DeviceEntity extends DeviceVo {
this
.
deviceFirmname
=
""
;
this
.
deviceFirmname
=
""
;
this
.
ip
=
""
;
this
.
ip
=
""
;
this
.
port
=
""
;
this
.
port
=
""
;
this
.
enabled
=
0
;
this
.
enabled
=
1
;
this
.
productCode
=
""
;
this
.
productCode
=
""
;
this
.
productName
=
""
;
this
.
productName
=
""
;
this
.
deviceSrc
=
2
;
this
.
deviceSrc
=
2
;
...
...
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/model/vo/MatterDatumVo.java
View file @
38f5d3fa
...
@@ -28,5 +28,14 @@ public class MatterDatumVo extends BaseEntityLong {
...
@@ -28,5 +28,14 @@ public class MatterDatumVo extends BaseEntityLong {
private
Integer
pub
;
private
Integer
pub
;
/**
* 分类id
*/
private
Long
categoryId
;
/**
* 分类名称
*/
private
String
categoryName
;
}
}
\ No newline at end of file
sample-form-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterDatumServiceImpl.java
View file @
38f5d3fa
package
com.mortals.xhx.module.matter.service.impl
;
package
com.mortals.xhx.module.matter.service.impl
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.text.StrSplitter
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.deepoove.poi.XWPFTemplate
;
import
com.deepoove.poi.config.Configure
;
import
com.deepoove.poi.config.ConfigureBuilder
;
import
com.deepoove.poi.data.PictureRenderData
;
import
com.deepoove.poi.data.PictureType
;
import
com.deepoove.poi.data.Pictures
;
import
com.deepoove.poi.plugin.table.MultipleRowTableRenderPolicy
;
import
com.deepoove.poi.template.MetaTemplate
;
import
com.deepoove.poi.util.RegexUtils
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.ComponentEnum
;
import
com.mortals.xhx.common.code.MatterSourceEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.formdesign.*
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.ParamKey
;
import
com.mortals.xhx.common.pdu.gen.component.ComponentCons
;
import
com.mortals.xhx.common.utils.BeanUtil
;
import
com.mortals.xhx.common.utils.ExportDocUtil
;
import
com.mortals.xhx.common.utils.WordUtil
;
import
com.mortals.xhx.common.utils.WordUtil
;
import
com.mortals.xhx.module.matter.dao.MatterDao
;
import
com.mortals.xhx.module.datum.model.DatumCategoryEntity
;
import
com.mortals.xhx.module.datum.model.DatumCategoryQuery
;
import
com.mortals.xhx.module.datum.service.DatumCategoryService
;
import
com.mortals.xhx.module.matter.dao.MatterDatumDao
;
import
com.mortals.xhx.module.matter.model.MatterDatumEntity
;
import
com.mortals.xhx.module.matter.model.MatterDatumQuery
;
import
com.mortals.xhx.module.matter.model.MatterDatumQuery
;
import
com.mortals.xhx.module.matter.model.MatterEntity
;
import
com.mortals.xhx.module.matter.model.MatterEntity
;
import
com.mortals.xhx.module.matter.model.MatterQuery
;
import
com.mortals.xhx.module.matter.model.MatterQuery
;
import
com.mortals.xhx.module.matter.service.MatterDatumService
;
import
com.mortals.xhx.module.matter.service.MatterService
;
import
com.mortals.xhx.module.matter.service.MatterService
;
import
com.mortals.xhx.module.pubdatum.model.PubdatumEntity
;
import
com.mortals.xhx.module.pubdatum.model.PubdatumEntity
;
import
com.mortals.xhx.module.pubdatum.service.PubdatumService
;
import
com.mortals.xhx.module.pubdatum.service.PubdatumService
;
import
com.mortals.xhx.module.sheet.model.SheetMatterEntity
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.http.entity.ContentType
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.module.matter.dao.MatterDatumDao
;
import
com.mortals.xhx.module.matter.model.MatterDatumEntity
;
import
com.mortals.xhx.module.matter.service.MatterDatumService
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.io.File
;
import
java.util.*
;
import
java.io.FileNotFoundException
;
import
java.util.concurrent.TimeUnit
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -80,6 +54,8 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
...
@@ -80,6 +54,8 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
private
MatterService
matterService
;
private
MatterService
matterService
;
@Autowired
@Autowired
private
PubdatumService
pubdatumService
;
private
PubdatumService
pubdatumService
;
@Autowired
private
DatumCategoryService
datumCategoryService
;
public
static
String
word
[]
=
{
"doc"
,
"dot"
,
"wps"
,
"wpt"
,
"docx"
,
"dotx"
,
"docm"
,
"dotm"
};
public
static
String
word
[]
=
{
"doc"
,
"dot"
,
"wps"
,
"wpt"
,
"docx"
,
"dotx"
,
"docm"
,
"dotm"
};
...
@@ -289,7 +265,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
...
@@ -289,7 +265,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
for
(
MatterEntity
matterEntity
:
matterEntities
)
{
for
(
MatterEntity
matterEntity
:
matterEntities
)
{
recommendCount
+=
this
.
count
(
new
MatterDatumQuery
().
matterId
(
matterEntity
.
getId
()).
isRecommend
(
YesNoEnum
.
YES
.
getValue
()),
context
);
recommendCount
+=
this
.
count
(
new
MatterDatumQuery
().
matterId
(
matterEntity
.
getId
()).
isRecommend
(
YesNoEnum
.
YES
.
getValue
()),
context
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
matterDatumEntity
.
getIsRecommend
()
)&&
matterDatumEntity
.
getIsRecommend
()
==
YesNoEnum
.
NO
.
getValue
())
{
if
(!
ObjectUtils
.
isEmpty
(
matterDatumEntity
.
getIsRecommend
()
)
&&
matterDatumEntity
.
getIsRecommend
()
==
YesNoEnum
.
NO
.
getValue
())
{
if
(
recommendCount
>=
GlobalSysInfo
.
getParamIntValue
(
Constant
.
PARAMS_RECOMMEND_COUNT
,
7
))
{
if
(
recommendCount
>=
GlobalSysInfo
.
getParamIntValue
(
Constant
.
PARAMS_RECOMMEND_COUNT
,
7
))
{
throw
new
AppException
(
"超过推荐个数!"
);
throw
new
AppException
(
"超过推荐个数!"
);
}
}
...
@@ -304,11 +280,28 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
...
@@ -304,11 +280,28 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
@Override
@Override
protected
void
findAfter
(
MatterDatumEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
MatterDatumEntity
>
list
)
throws
AppException
{
protected
void
findAfter
(
MatterDatumEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
MatterDatumEntity
>
list
)
throws
AppException
{
List
<
Long
>
matterIdList
=
list
.
stream
().
map
(
item
->
item
.
getMatterId
()).
collect
(
Collectors
.
toList
());
MatterQuery
matterQuery
=
new
MatterQuery
();
matterQuery
.
setIdList
(
matterIdList
);
Map
<
Long
,
MatterEntity
>
matterEntityMap
=
matterService
.
find
(
matterQuery
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
y
->
y
,
(
o
,
n
)
->
n
));
DatumCategoryQuery
datumCategoryQuery
=
new
DatumCategoryQuery
();
datumCategoryQuery
.
setMaterialIdList
(
matterIdList
);
Map
<
Long
,
DatumCategoryEntity
>
collect
=
datumCategoryService
.
find
(
datumCategoryQuery
).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getMaterialId
(),
y
->
y
,
(
o
,
n
)
->
n
));
list
.
stream
().
forEach
(
entity
->
{
list
.
stream
().
forEach
(
entity
->
{
MatterEntity
matterEntity
=
matterService
.
get
(
entity
.
getMatterId
(),
context
);
if
(!
ObjectUtils
.
isEmpty
(
matterEntityMap
))
{
if
(!
ObjectUtils
.
isEmpty
(
matterEntity
))
{
MatterEntity
matterEntity
=
matterEntityMap
.
get
(
entity
.
getMatterId
());
entity
.
setMatterNo
(
matterEntity
.
getMatterNo
());
if
(!
ObjectUtils
.
isEmpty
(
matterEntity
))
{
entity
.
setMatterName
(
matterEntity
.
getMatterName
());
entity
.
setMatterNo
(
matterEntity
.
getMatterNo
());
entity
.
setMatterName
(
matterEntity
.
getMatterName
());
}
}
if
(!
ObjectUtils
.
isEmpty
(
collect
))
{
DatumCategoryEntity
datumCategoryEntity
=
collect
.
get
(
entity
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
datumCategoryEntity
))
{
entity
.
setCategoryId
(
datumCategoryEntity
.
getCategoryId
());
entity
.
setCategoryName
(
datumCategoryEntity
.
getCategoryName
());
}
}
}
});
});
super
.
findAfter
(
params
,
pageInfo
,
context
,
list
);
super
.
findAfter
(
params
,
pageInfo
,
context
,
list
);
...
...
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