Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
aff4bd00
Commit
aff4bd00
authored
Jun 05, 2023
by
曹盼盼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
es数据同步
parent
0ef4d2aa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
2 deletions
+77
-2
SuperviseInfo.java
...eejoin/amos/boot/module/tzs/api/entity/SuperviseInfo.java
+5
-0
EquipmentCategoryServiceImpl.java
...le/tzs/biz/service/impl/EquipmentCategoryServiceImpl.java
+70
-0
application.properties
...-module-tzs-biz/src/main/resources/application.properties
+2
-2
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/SuperviseInfo.java
View file @
aff4bd00
...
@@ -63,6 +63,11 @@ public class SuperviseInfo extends AbstractEquipBaseEntity {
...
@@ -63,6 +63,11 @@ public class SuperviseInfo extends AbstractEquipBaseEntity {
@TableField
(
value
=
"\"IMPORTANT_PLACES\""
)
@TableField
(
value
=
"\"IMPORTANT_PLACES\""
)
private
String
importantPlaces
;
private
String
importantPlaces
;
/**
* 是否同步到es中
*/
@TableField
(
value
=
"\"IS_NOT_ES\""
)
private
Integer
isNotEs
;
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
aff4bd00
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentCategoryEnum;
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentCategoryEnum;
import
com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.SuperviseInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.SupervisoryCodeInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.SupervisoryCodeInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderFillingRecordRepository
;
import
com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderFillingRecordRepository
;
...
@@ -60,6 +61,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -60,6 +61,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
ESEquipmentCategory
esEquipmentCategory
;
ESEquipmentCategory
esEquipmentCategory
;
@Autowired
@Autowired
private
SuperviseInfoMapper
superviseInfoMapper
;
@Autowired
EquipmentCategoryMapper
equipmentCategoryMapper
;
EquipmentCategoryMapper
equipmentCategoryMapper
;
@Value
(
"classpath:/json/equipCategory.json"
)
@Value
(
"classpath:/json/equipCategory.json"
)
...
@@ -744,4 +748,69 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -744,4 +748,69 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
esEquipmentCategory
.
save
(
dto
);
esEquipmentCategory
.
save
(
dto
);
}
}
}
}
//分页查询所有数据
public
Page
<
Map
<
String
,
Object
>>
getAll
(
Map
<
String
,
Object
>
map
)
{
String
tableName
=
map
.
get
(
TABLENAME
).
toString
();
Assert
.
hasText
(
tableName
,
"表名不能为空"
);
String
selectSql
=
" SELECT * FROM "
+
tableName
;
Integer
number
=
ValidationUtil
.
isEmpty
(
map
.
get
(
"number"
))
?
0
:
Integer
.
valueOf
(
map
.
get
(
"number"
).
toString
());
Integer
size
=
ValidationUtil
.
isEmpty
(
map
.
get
(
"size"
))
?
0
:
Integer
.
valueOf
(
map
.
get
(
"size"
).
toString
());
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
number
,
size
);
int
begin
=
(
number
-
1
)
*
size
;
if
(
size
>
0
)
{
selectSql
=
selectSql
+
" LIMIT "
+
begin
+
","
+
size
;
}
List
<
Map
<
String
,
Object
>>
mapList
=
bizJdbcTemplate
.
queryForList
(
selectSql
);
page
.
setRecords
(
mapList
);
return
page
;
}
//查询总条数
public
Long
counts
(
Map
<
String
,
Object
>
map
){
String
tableName
=
map
.
get
(
TABLENAME
).
toString
();
Assert
.
hasText
(
tableName
,
"表名不能为空"
);
String
countSql
=
" SELECT COUNT(SEQUENCE_NBR) count FROM "
+
tableName
;
Long
count
=
bizJdbcTemplate
.
queryForObject
(
countSql
,
Long
.
class
);
return
count
;
}
/**
* es数据同步
* @return
*/
@Scheduled
(
cron
=
"${tzs.equipmentCategory.cron}"
)
public
void
saveEs
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
TABLENAME
,
"idx_biz_view_jg_all"
);
Long
counts
=
counts
(
map
);
Long
times
=
counts
/
1000
;
Long
yushu
=
counts
%
1000
;
if
(
yushu
>
0
)
{
times
++;
}
for
(
int
i
=
1
;
i
<=
times
;
i
++)
{
map
.
put
(
"number"
,
i
);
map
.
put
(
"size"
,
1000
);
Page
<
Map
<
String
,
Object
>>
page
=
getAll
(
map
);
for
(
Map
<
String
,
Object
>
record
:
page
.
getRecords
())
{
if
(
ValidationUtil
.
isEmpty
(
record
.
get
(
"IS_NOT_ES"
))
)
{
saveESEquipmentCategory
(
record
);
}
}
}
}
/**es保存设备数据*/
public
ESEquipmentCategoryDto
saveESEquipmentCategory
(
Map
<
String
,
Object
>
map
)
{
ESEquipmentCategoryDto
dto
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
map
),
ESEquipmentCategoryDto
.
class
);
ESEquipmentCategoryDto
save
=
esEquipmentCategory
.
save
(
dto
);
if
(!
ObjectUtils
.
isEmpty
(
save
))
{
//同步到es后修改
SuperviseInfo
superviseInfo
=
new
SuperviseInfo
();
superviseInfo
.
setIsNotEs
(
1
);
superviseInfoMapper
.
update
(
superviseInfo
,
new
QueryWrapper
<
SuperviseInfo
>().
eq
(
"SEQUENCE_NBR"
,
map
.
get
(
"SEQUENCE_NBR"
).
toString
()));
}
return
save
;
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/resources/application.properties
View file @
aff4bd00
spring.application.name
=
TZS
spring.application.name
=
TZS
-cpp
server.servlet.context-path
=
/tzs
server.servlet.context-path
=
/tzs
server.port
=
11000
server.port
=
11000
spring.profiles.active
=
dev3
spring.profiles.active
=
dev3
...
@@ -10,7 +10,7 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
...
@@ -10,7 +10,7 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
##liquibase
##liquibase
spring.liquibase.change-log
=
classpath:/db/changelog/changelog-master.xml
spring.liquibase.change-log
=
classpath:/db/changelog/changelog-master.xml
spring.liquibase.enabled
=
tru
e
spring.liquibase.enabled
=
fals
e
...
...
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