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
2f4ed3f9
Commit
2f4ed3f9
authored
Oct 14, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
两员配备- 气瓶基本信息,气瓶充装信息存入es优化
parent
b22267d2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
100 deletions
+109
-100
ESCylinderFillingRecordDto.java
...odule/cylinder/api/entity/ESCylinderFillingRecordDto.java
+11
-0
ESCylinderInfoDto.java
...os/boot/module/cylinder/api/entity/ESCylinderInfoDto.java
+4
-0
CylinderFillingRecordMapper.java
.../cylinder/flc/api/mapper/CylinderFillingRecordMapper.java
+5
-2
ICylinderFillingRecordService.java
...linder/flc/api/service/ICylinderFillingRecordService.java
+2
-1
CylinderFillingRecordMapper.xml
...src/main/resources/mapper/CylinderFillingRecordMapper.xml
+74
-63
CylinderInfoController.java
...e/cylinder/flc/biz/controller/CylinderInfoController.java
+7
-33
CylinderFillingRecordServiceImpl.java
...lc/biz/service/impl/CylinderFillingRecordServiceImpl.java
+0
-0
CylinderInfoServiceImpl.java
...ylinder/flc/biz/service/impl/CylinderInfoServiceImpl.java
+6
-1
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/entity/ESCylinderFillingRecordDto.java
View file @
2f4ed3f9
...
...
@@ -93,6 +93,10 @@ public class ESCylinderFillingRecordDto {
@Field
(
type
=
FieldType
.
Text
)
private
String
inspectionDate
;
//充装前检查时间毫秒值
@Field
(
type
=
FieldType
.
Long
)
private
Long
inspectionDateMs
;
//充装前检查结果
@Field
(
type
=
FieldType
.
Text
)
private
String
fillingResult
;
...
...
@@ -106,6 +110,10 @@ public class ESCylinderFillingRecordDto {
@Field
(
type
=
FieldType
.
Text
)
private
String
inspectionDateAfter
;
//充装前检查结果毫秒值
@Field
(
type
=
FieldType
.
Long
)
private
Long
inspectionDateAfterMS
;
//重装后检查结果
@Field
(
type
=
FieldType
.
Text
)
private
String
checkResult
;
...
...
@@ -122,4 +130,7 @@ public class ESCylinderFillingRecordDto {
@Field
(
type
=
FieldType
.
Text
)
private
String
regionCode
;
//appid+气瓶唯一标识
private
String
appIdAndSequenceCode
;
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/entity/ESCylinderInfoDto.java
View file @
2f4ed3f9
...
...
@@ -72,6 +72,10 @@ public class ESCylinderInfoDto {
@Field
(
type
=
FieldType
.
Text
)
private
String
inspectionDate
;
//检验日期
@Field
(
type
=
FieldType
.
Long
)
private
Long
inspectionDateMs
;
//气瓶唯一标识
@Field
(
type
=
FieldType
.
Text
)
private
String
sequenceCode
;
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/mapper/CylinderFillingRecordMapper.java
View file @
2f4ed3f9
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.cylinder.flc.api.mapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.CylinderFillingRecordDtoEs
;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderFillingRecordDto
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
...
@@ -47,7 +48,7 @@ public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingR
);
Page
<
ESCylinderFillingRecordDto
>
getCyinderFillingRecord
(
Page
<
ESCylinderFillingRecordDto
>
cylinderFillingRecordDto
);
List
<
ESCylinderFillingRecordDto
>
getCylinderFillingRecord
(
);
Double
getFillingSumByMonth
(
@Param
(
"appId"
)
String
appId
,
@Param
(
"time"
)
Date
time
);
...
...
@@ -55,7 +56,9 @@ public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingR
Double
getFillingSumByDate
(
@Param
(
"appId"
)
String
appId
,
@Param
(
"time"
)
Date
time
);
ESCylinderFillingRecordDto
getCyinderFillingRecordInfo
(
String
appId
,
String
sequenceCode
);
List
<
ESCylinderFillingRecordDto
>
getCylinderFillingRecordInfo
(
@Param
(
"appIds"
)
List
<
String
>
appIds
,
@Param
(
"sequenceCodeS"
)
List
<
String
>
sequenceCodeS
);
Integer
getCylinderFillingRecordTotal
();
void
updateCylinderFillingToEsStatus
(
@Param
(
"ids"
)
List
<
String
>
ids
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/service/ICylinderFillingRecordService.java
View file @
2f4ed3f9
...
...
@@ -16,7 +16,8 @@ public interface ICylinderFillingRecordService {
ESCylinderFillingRecordDto
saveCylinderFillingRecordToES
(
ESCylinderFillingRecordDto
ci
);
Page
<
ESCylinderFillingRecordDto
>
getCyinderFillingRecord
(
Page
<
ESCylinderFillingRecordDto
>
cylinderFillingRecordDto
);
List
<
ESCylinderFillingRecordDto
>
getCylinderFillingRecordAll
();
List
<
ESCylinderFillingRecordDto
>
getCylinderFillingRecordTest
();
Page
<
ESCylinderFillingRecordDto
>
queryByKeys
(
ESCylinderFillingRecordDto
esCylinderFillingRecordDto
,
int
pageNum
,
int
pageSize
);
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylinderFillingRecordMapper.xml
View file @
2f4ed3f9
...
...
@@ -146,83 +146,94 @@
select count(1) from tz_cylinder_filling_record r where date_format(r.filling_endTime,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
<select
id=
"getCyinderFillingRecord"
resultType=
"com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto"
>
SELECT
DISTINCT( r.filling_record_id),
r.sequence_nbr AS sequenceNbr,
r.filling_startTime AS fillingStarttime,
r.filling_endTime AS fillingEndtime,
r.filling_user AS fillingUser,
r.filling_quantity AS fillingQuantity,
r.temperature AS temperature,
CASE
r.abnormal
WHEN 3139 THEN
'有异常'
WHEN 3140 THEN
'正常' ELSE''
END AS abnormalStr,
b.inspector_user AS inspectorUser,
b.inspection_date AS inspectionDate,
b.check_results AS fillingResult,
b.sequence_code AS sequenceCode,
b.app_id AS appId,
b.filling_unit_name AS fillingUnitName,
af.inspector AS inspector,
af.inspection_date AS inspectionDateAfter,
af.check_results AS checkResult
<select
id=
"getCylinderFillingRecord"
resultType=
"com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto"
>
SELECT DISTINCT(r.filling_record_id),
r.sequence_nbr AS sequenceNbr,
r.filling_startTime AS fillingStarttime,
r.filling_endTime AS fillingEndtime,
r.filling_user AS fillingUser,
r.filling_quantity AS fillingQuantity,
r.temperature AS temperature,
CASE
r.abnormal
WHEN 3139 THEN
'有异常'
WHEN 3140 THEN
'正常'
ELSE ''
END AS abnormalStr,
b.inspector_user AS inspectorUser,
b.inspection_date AS inspectionDate,
b.check_results AS fillingResult,
b.sequence_code AS sequenceCode,
b.app_id AS appId,
concat(b.app_id, b.sequence_code) AS appIdAndSequenceCode,
b.filling_unit_name AS fillingUnitName,
af.inspector AS inspector,
af.inspection_date AS inspectionDateAfter,
af.check_results AS checkResult
FROM
tz_cylinder_filling_record
r
( SELECT * FROM tz_cylinder_filling_record WHERE is_not_es IS NULL LIMIT 5000 )
r
LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id
AND r.filling_before_id
is NOT null
AND date_format (
b.inspection_date, '%Y-%m-%d'
) = date_format ( r.filling_startTime, '%Y-%m-%d' )
AND r.filling_before_id
IS NOT NULL and b.inspection_date NOT LIKE'16%'
AND date_format (
b.inspection_date, '%Y-%m-%d'
) = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format (af.inspection_date,'%Y-%m-%d') = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_info i ON b.sequence_code = i.sequence_code
AND date_format ( af.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
WHERE b.sequence_code is not null AND b.app_id is not null
</select>
<select
id=
"getCylinderFillingRecordTotal"
resultType=
"java.lang.Integer"
>
SELECT
COUNT(1)
FROM
tz_cylinder_filling_record r
WHERE
r.is_not_es IS NULL
AND
b.inspection_date not like '16%'
ORDER BY r.filling_record_id
AND
r.filling_before_id IS NOT NULL
AND r.filling_check_id IS NOT NULL
</select>
<select
id=
"getCyinderFillingRecordInfo"
<update
id=
"updateCylinderFillingToEsStatus"
>
UPDATE tz_cylinder_filling_record SET "is_not_es" = 1 WHERE "sequence_nbr" IN
<foreach
collection=
"ids"
separator=
","
item=
"id"
open=
"("
close=
")"
>
#{id}
</foreach>
</update>
<select
id=
"getCylinderFillingRecordInfo"
resultType=
"com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto"
>
SELECT
ci.unit_name AS unit_name,
ci.factory_num AS factoryNum,
ci.cylinder_variety AS cylinder_variety,
d2.NAME AS cylinder_variety_name,
ci.unit_inner_code AS unit_inner_code,
ci.sequence_code AS sequence_code,
ct.qrCode,
ct.electronic_label_code,
ci.app_id,
ci.credit_code,
tn.region_code
ci.unit_name AS unit_name,
ci.factory_num AS factoryNum,
ci.cylinder_variety AS cylinder_variety,
d2.NAME AS cylinder_variety_name,
ci.unit_inner_code AS unit_inner_code,
ci.sequence_code AS sequence_code,
ct.qrCode,
ct.electronic_label_code,
ci.app_id,
ci.credit_code,
tn.region_code,
concat(ci.app_id, ci.sequence_code) AS appIdAndSequenceCode
FROM
tz_cylinder_info AS ci
LEFT JOIN cb_data_dictionary AS d1 ON d1.TYPE = 'CZJZMC' AND d1.code = ci.filling_media
LEFT JOIN cb_data_dictionary AS d2 ON d2.sequence_nbr = ci.cylinder_variety
LEFT JOIN tz_cylinder_tags AS ct ON ct.sequence_code = ci.sequence_code and ct.app_id = ci.app_id
LEFT JOIN tz_cylinder_unit AS tn ON ci.app_id = tn.app_id
where
ci.sequence_code = #{sequenceCode}
and ci.app_id = #{appId}
</select>
<select
id=
"getCylinderFillingRecordTotal"
resultType=
"java.lang.Integer"
>
SELECT
COUNT(1)
FROM
tz_cylinder_filling_record r
LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id
AND r.filling_before_id IS NOT NULL
AND date_format ( b.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format ( af.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_info i ON b.sequence_code = i.sequence_code
WHERE
r.is_not_es IS NULL
AND b.inspection_date NOT LIKE'16%'
<where>
<if
test=
"appIds != null and appIds.size() > 0"
>
ci.app_id in
<foreach
item=
"appId"
collection=
"appIds"
separator=
","
open=
"("
close=
")"
index=
""
>
#{appId}
</foreach>
</if>
<if
test=
"sequenceCodeS != null and sequenceCodeS.size() > 0"
>
and ci.sequence_code in
<foreach
item=
"sequenceCode"
collection=
"sequenceCodeS"
separator=
","
open=
"("
close=
")"
index=
""
>
#{sequenceCode}
</foreach>
</if>
</where>
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/controller/CylinderInfoController.java
View file @
2f4ed3f9
...
...
@@ -601,7 +601,7 @@ public class CylinderInfoController extends BaseController {
cylinderInfoPage
.
setCurrent
(
1
);
cylinderInfoPage
.
setSize
(
1000
);
cylinderInfoPage
=
cylinderInfoServiceImpl
.
getCyinderInfoList
(
cylinderInfoPage
);
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
))
{
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
)
&&
cylinderInfoPage
.
getRecords
().
size
()
>
0
)
{
cylinderInfoServiceImpl
.
saveCylinderInfo2ES
(
cylinderInfoPage
.
getRecords
());
}
return
ResponseHelper
.
buildResponse
(
true
);
...
...
@@ -639,45 +639,19 @@ public class CylinderInfoController extends BaseController {
return
ResponseHelper
.
buildResponse
(
pageResult
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/saveCyinderFillingRecord"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶充装信息存入es"
,
notes
=
"气瓶充装信息存入es"
)
public
void
saveCyinderFillingRecord
()
{
Page
<
ESCylinderFillingRecordDto
>
recordDtoPage
=
new
Page
<>();
Integer
count
=
cylinderFillingRecordServiceImpl
.
getCylinderFillingRecordTotal
();
Integer
times
=
0
;
if
(
count
!=
0
)
{
times
=
count
/
1000
;
int
last
=
count
%
1000
;
if
(
last
>
0
)
{
times
++;
}
}
else
{
return
;
}
for
(
int
i
=
0
;
i
<=
times
;
i
++)
{
recordDtoPage
.
setCurrent
(
1
);
recordDtoPage
.
setSize
(
1000
);
Page
<
ESCylinderFillingRecordDto
>
cyinderFillingRecord
=
cylinderFillingRecordServiceImpl
.
getCyinderFillingRecord
(
recordDtoPage
);
if
(!
ObjectUtils
.
isEmpty
(
cyinderFillingRecord
))
{
cylinderFillingRecordServiceImpl
.
saveCylinderFillingRecord2ES
(
cyinderFillingRecord
.
getRecords
());
}
}
public
ResponseModel
<
Object
>
saveCyinderFillingRecord
()
{
return
ResponseHelper
.
buildResponse
(
cylinderFillingRecordServiceImpl
.
getCylinderFillingRecordAll
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/getCyinderFillingRecord"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶充装信息存入es入口"
,
notes
=
"气瓶充装信息存入es入口"
)
public
Page
<
ESCylinderFillingRecordDto
>
getCyinderFillingRecord
()
{
Page
<
ESCylinderFillingRecordDto
>
cylinderInfoPage
=
new
Page
<>();
cylinderInfoPage
.
setCurrent
(
1
);
cylinderInfoPage
.
setSize
(
10
);
Page
<
ESCylinderFillingRecordDto
>
cyinderFillingRecord
=
cylinderFillingRecordServiceImpl
.
getCyinderFillingRecord
(
cylinderInfoPage
);
for
(
ESCylinderFillingRecordDto
ci
:
cyinderFillingRecord
.
getRecords
())
{
cylinderFillingRecordServiceImpl
.
saveCylinderFillingRecordToES
(
ci
);
}
return
cyinderFillingRecord
;
public
ResponseModel
<
Object
>
getCyinderFillingRecord
()
{
return
ResponseHelper
.
buildResponse
(
cylinderFillingRecordServiceImpl
.
getCylinderFillingRecordTest
());
}
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderFillingRecordServiceImpl.java
View file @
2f4ed3f9
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderInfoServiceImpl.java
View file @
2f4ed3f9
...
...
@@ -744,7 +744,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
});
}
//
@Scheduled(cron = "${tzs.cylinder.info.cron}")
@Scheduled
(
cron
=
"${tzs.cylinder.info.cron}"
)
@SchedulerLock
(
name
=
"cylinderInfoToESTask"
,
lockAtMostFor
=
"PT6H"
)
public
void
setTimeSaveCylinderInfoToES
()
{
Page
<
CylinderInfoDto
>
cylinderInfoPage
=
new
Page
<>();
...
...
@@ -778,6 +778,11 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
ESCylinderInfoDto
esCylinderInfo
=
new
ESCylinderInfoDto
();
BeanUtils
.
copyProperties
(
record
,
esCylinderInfo
);
esCylinderInfoDto
.
add
(
esCylinderInfo
);
try
{
esCylinderInfo
.
setInspectionDateMs
(
ObjectUtils
.
isEmpty
(
esCylinderInfo
.
getInspectionDate
())
?
0L
:
DateUtils
.
dateParse
(
esCylinderInfo
.
getInspectionDate
(),
DateUtils
.
DATE_TIME_PATTERN
).
getTime
());
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
ids
.
add
(
String
.
valueOf
(
record
.
getSequenceNbr
()));
}
StopWatch
stopWatch
=
new
StopWatch
();
...
...
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