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
d9d068dc
Commit
d9d068dc
authored
Apr 21, 2022
by
chenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://39.98.45.134:8090/moa/amos-boot-biz
into developer
parents
2e641a02
52ac1bea
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
753 additions
and
17 deletions
+753
-17
CylWarningMsgDto.java
...eejoin/amos/boot/module/tzs/api/dto/CylWarningMsgDto.java
+35
-0
MsgLogDto.java
...a/com/yeejoin/amos/boot/module/tzs/api/dto/MsgLogDto.java
+11
-4
SpecialEquipmentDto.java
...oin/amos/boot/module/tzs/api/dto/SpecialEquipmentDto.java
+2
-0
EsCylinder.java
...m/yeejoin/amos/boot/module/tzs/api/entity/EsCylinder.java
+87
-0
MsgLog.java
...a/com/yeejoin/amos/boot/module/tzs/api/entity/MsgLog.java
+13
-0
EarlyWarningLevelEnum.java
...amos/boot/module/tzs/api/enums/EarlyWarningLevelEnum.java
+36
-0
SpecialEquipmentCategoryEnum.java
...ot/module/tzs/api/enums/SpecialEquipmentCategoryEnum.java
+47
-0
TerminalTypeEnum.java
...join/amos/boot/module/tzs/api/enums/TerminalTypeEnum.java
+20
-0
CylinderInfoDto.java
...oin/amos/boot/module/tzs/flc/api/dto/CylinderInfoDto.java
+27
-0
CylinderInfo.java
...oin/amos/boot/module/tzs/flc/api/entity/CylinderInfo.java
+17
-0
CylinderInfoMapper.java
...os/boot/module/tzs/flc/api/mapper/CylinderInfoMapper.java
+8
-1
CylinderInfoMapper.xml
...-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
+42
-3
SpecialEquipmentController.java
...module/tzs/biz/controller/SpecialEquipmentController.java
+9
-1
ESCylinderRepository.java
...in/amos/boot/module/tzs/biz/dao/ESCylinderRepository.java
+14
-0
ESCylinderServiceImpl.java
...ot/module/tzs/biz/service/impl/ESCylinderServiceImpl.java
+153
-0
CylinderInfoController.java
...module/tzs/flc/biz/controller/CylinderInfoController.java
+90
-6
CylinderSchedulerJob.java
.../boot/module/tzs/flc/biz/quartz/CylinderSchedulerJob.java
+26
-0
CylinderInfoServiceImpl.java
...ule/tzs/flc/biz/service/impl/CylinderInfoServiceImpl.java
+116
-2
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/CylWarningMsgDto.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
dto
;
import
java.io.Serializable
;
import
com.yeejoin.amos.component.rule.Label
;
import
com.yeejoin.amos.component.rule.RuleFact
;
import
lombok.Data
;
@RuleFact
(
value
=
"气瓶预警消息"
,
project
=
"气瓶监管"
)
@Data
public
class
CylWarningMsgDto
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Label
(
"企业名称"
)
private
String
companyName
;
@Label
(
"企业联系人"
)
private
String
people
;
@Label
(
"企业联系人电话"
)
private
String
phone
;
@Label
(
"使用人类型"
)
private
String
userType
;
@Label
(
"气瓶使用人"
)
private
String
userPeople
;
@Label
(
"使用人电话"
)
private
String
userPeoplePhone
;
@Label
(
"出厂编号"
)
private
String
factoryNum
;
@Label
(
"预警值"
)
private
String
num
;
@Label
(
"气瓶seq"
)
private
String
cylSeq
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/MsgLogDto.java
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
dto
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
...
...
@@ -15,10 +16,10 @@ import java.util.Date;
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MsgLogDto"
,
description
=
"消息流水表"
)
public
class
MsgLogDto
extends
BaseDto
{
@ApiModel
(
value
=
"MsgLogDto"
,
description
=
"消息流水表"
)
public
class
MsgLogDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"关联编号"
)
...
...
@@ -27,6 +28,9 @@ public class MsgLogDto extends BaseDto {
@ApiModelProperty
(
value
=
"消息类型(超期预警、许可超期、风险预警)"
)
private
String
msgType
;
@ApiModelProperty
(
value
=
"消息类型名称"
)
private
String
msgTypeName
;
@ApiModelProperty
(
value
=
"消息内容"
)
private
String
body
;
...
...
@@ -39,4 +43,7 @@ public class MsgLogDto extends BaseDto {
@ApiModelProperty
(
value
=
"发送日期"
)
private
Date
sendTime
;
@ApiModelProperty
(
value
=
"站端类型: WEB,APP"
)
private
String
terminalType
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/SpecialEquipmentDto.java
View file @
d9d068dc
...
...
@@ -54,4 +54,6 @@ public class SpecialEquipmentDto {
@ApiModelProperty
(
value
=
"内部编码"
)
private
String
innerNum
;
@ApiModelProperty
(
value
=
"设备唯一编码"
)
private
String
uniqueCode
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/EsCylinder.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
entity
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.elasticsearch.common.geo.GeoPoint
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.elasticsearch.annotations.Document
;
import
org.springframework.data.elasticsearch.annotations.Field
;
import
org.springframework.data.elasticsearch.annotations.FieldType
;
import
org.springframework.data.elasticsearch.annotations.GeoPointField
;
/**
* @author tb
* @date 2022-04-20.
*/
@Data
@Accessors
(
chain
=
true
)
@Document
(
indexName
=
"cylinder"
,
replicas
=
0
)
public
class
EsCylinder
{
/**
* 主键
*/
@Id
private
Long
sequenceNbr
;
/**
* 气瓶出厂编号
*/
@Field
(
type
=
FieldType
.
Text
)
private
String
factoryNum
;
// /**
// * 所属省
// */
// @Field(type = FieldType.Text)
// private String province;
//
// /**
// * 所属地市
// */
// @Field(type = FieldType.Text)
// private String city;
//
// /**
// * 所属区县
// */
// @Field(type = FieldType.Text)
// private String district;
//
// /**
// * 所属区域代码
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String regionCode;
/**
* 产权单位名称
*/
@Field
(
type
=
FieldType
.
Text
)
private
String
unitName
;
/**
* 经度
*/
@Field
(
type
=
FieldType
.
Double
)
private
Double
longitude
;
/**
* 纬度
*/
@Field
(
type
=
FieldType
.
Double
)
private
Double
latitude
;
/**
* 经纬度字段
*/
@GeoPointField
private
GeoPoint
location
;
/**
* 地址
*/
@Field
(
type
=
FieldType
.
Text
,
searchAnalyzer
=
"ik_max_word"
,
analyzer
=
"ik_max_word"
)
private
String
address
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/MsgLog.java
View file @
d9d068dc
...
...
@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.naming.ldap.PagedResultsControl
;
import
java.util.Date
;
/**
...
...
@@ -35,6 +37,11 @@ public class MsgLog extends BaseEntity {
private
String
msgType
;
/**
* 消息类型名称
*/
private
String
msgTypeName
;
/**
* 消息内容
*/
@TableField
(
"body"
)
...
...
@@ -58,4 +65,10 @@ public class MsgLog extends BaseEntity {
@TableField
(
"send_time"
)
private
Date
sendTime
;
/**
* 站端类型: WEB,APP
*/
private
String
terminalType
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/EarlyWarningLevelEnum.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.Optional
;
/**
* @author DELL
*/
@AllArgsConstructor
@Getter
public
enum
EarlyWarningLevelEnum
{
/**
* 预警等级枚举
*
*/
EARLY_WARNING_FIRST_LEVEL
(
"一级预警"
,
"1"
,
"即将超期"
,
"earlyWarning_firstLevel"
),
EARLY_WARNING_SECOND_LEVEL
(
"二级预警"
,
"2"
,
"即将超期"
,
"earlyWarning_secondLevel"
),
EARLY_WARNING_THREE_LEVEL
(
"三级预警"
,
"3"
,
"已超期"
,
"earlyWarning_threeLevel"
);
private
String
name
;
private
String
level
;
private
String
status
;
private
String
code
;
public
static
EarlyWarningLevelEnum
getEumByLevel
(
String
level
)
{
Optional
<
EarlyWarningLevelEnum
>
op
=
Arrays
.
stream
(
EarlyWarningLevelEnum
.
values
()).
filter
(
e
->
e
.
getLevel
().
equals
(
level
)).
findFirst
();
return
op
.
orElseThrow
(()
->
new
RuntimeException
(
"未知的类型"
));
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/SpecialEquipmentCategoryEnum.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
/**
* <pre>
* 特种设备类别枚举
* </pre>
*
* @author tb
*/
public
enum
SpecialEquipmentCategoryEnum
{
ELEVATOR
(
"3000"
,
"电梯"
),
PRESSURE_VESSEL
(
"2000"
,
"压力容器"
);
/**
* 编码
*/
private
String
code
;
/**
* 名称
*/
private
String
name
;
// 构造方法
SpecialEquipmentCategoryEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
SpecialEquipmentCategoryEnum
getEnum
(
String
code
)
{
for
(
SpecialEquipmentCategoryEnum
specialEquipmentCategoryEnum
:
SpecialEquipmentCategoryEnum
.
values
())
{
if
(
specialEquipmentCategoryEnum
.
getCode
().
equals
(
code
))
{
return
specialEquipmentCategoryEnum
;
}
}
return
null
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/TerminalTypeEnum.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* @author DELL
*/
@AllArgsConstructor
@Getter
public
enum
TerminalTypeEnum
{
/**
* 终端类型
*/
TERMINAL_TYPE_WEB
(
"WEB"
),
TERMINAL_TYPE_APP
(
"APP"
);
private
String
code
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/CylinderInfoDto.java
View file @
d9d068dc
...
...
@@ -107,7 +107,34 @@ public class CylinderInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"检验状态 0 已超期 1 正常 2 即将超期"
)
private
int
inspectionStatas
;
@ApiModelProperty
(
value
=
"检验状态描述"
)
private
String
inspectionStatusDesc
;
@ApiModelProperty
(
value
=
"预警等级"
)
private
String
earlyWarningLevel
;
@ApiModelProperty
(
value
=
"预警等级名称"
)
private
String
earlyWarningLevelName
;
@ApiModelProperty
(
value
=
"最近配送地址"
)
private
String
address
;
@ApiModelProperty
(
value
=
"最近预警时间"
)
private
Date
earlyWarningLevelCalDate
;
@ApiModelProperty
(
value
=
"经度"
)
private
String
longitude
;
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
@ApiModelProperty
(
value
=
"客户名称"
)
private
String
customType
;
@ApiModelProperty
(
value
=
"客户类型"
)
private
String
customName
;
@ApiModelProperty
(
value
=
"联系电话"
)
private
String
contactPhone
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/CylinderInfo.java
View file @
d9d068dc
...
...
@@ -164,4 +164,21 @@ public class CylinderInfo {
* 预警等级
*/
private
String
earlyWarningLevel
;
/**
* 预警等级 计算日期
*/
private
Date
earlyWarningLevelCalDate
;
/**
* 经度
*/
@TableField
(
"longitude"
)
private
String
longitude
;
/**
* 纬度
*/
@TableField
(
"latitude"
)
private
String
latitude
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/mapper/CylinderInfoMapper.java
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -57,5 +59,10 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
*/
Integer
getMonthBeforeLastInfoTotalUnit
(
@Param
(
"appId"
)
String
appId
);
Integer
countOverDateNumber
(
@Param
(
"threshold"
)
int
threshold
);
Integer
countOverDateNumber
(
@Param
(
"earlyWarningLevel"
)
String
earlyWarningLevel
);
Page
<
CylinderInfoDto
>
queryPageListByEarlyWarningLevel
(
Page
<
CylinderInfoDto
>
page
,
@Param
(
"earlyWarningLevel"
)
String
earlyWarningLevel
);
CylinderInfoDto
getDetail
(
String
sequenceCode
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
d9d068dc
...
...
@@ -58,8 +58,47 @@
count(1)
FROM `tz_cylinder_info` ci
where
DATEDIFF(ci.next_inspection_date,now())
<![CDATA[<=]]>
#{threshold
}
ci.early_warning_level = #{earlyWarningLevel
}
</select>
<select
id=
"queryPageListByEarlyWarningLevel"
resultType=
"com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto"
>
select
ci.sequence_code,
ci.unit_name,
ci.factory_num,
ci.inspection_date,
ci.next_inspection_date,
ci.early_warning_level,
ci.early_warning_level_cal_date,
ci.longitude,
ci.latitude,
eu.address
from
tz_cylinder_info ci
left join tz_end_user eu on ci.end_custom_code = eu.custom_code
where
ci.early_warning_level = #{earlyWarningLevel}
order by ci.next_inspection_date
</select>
<select
id=
"getDetail"
resultType=
"com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto"
>
select
ci.sequence_code,
ci.unit_name,
ci.inspection_date,
ci.factory_num,
ci.next_inspection_date,
ci.early_warning_level,
ci.early_warning_level_cal_date,
ci.longitude,
ci.latitude,
eu.address,
eu.custom_name,
eu.custom_type,
eu.contact_phone
from
tz_cylinder_info ci
left join tz_end_user eu on ci.end_custom_code = eu.custom_code
where
ci.sequence_code = #{sequenceCode}
</select>
</mapper>
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/SpecialEquipmentController.java
View file @
d9d068dc
...
...
@@ -26,9 +26,11 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentRegionNum
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintainInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.TestInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.SpecialEquipmentCategoryEnum
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorRelationService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESCylinderServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentRegionNumServiceImpl
;
...
...
@@ -112,6 +114,9 @@ public class SpecialEquipmentController extends BaseController {
@Autowired
EquipmentRegionNumServiceImpl
equipmentRegionNumServiceImpl
;
@Autowired
ESCylinderServiceImpl
esCylinderService
;
/**
* ES查询特种设备信息 带分页 加经纬度过滤 keyword 搜索
...
...
@@ -128,9 +133,12 @@ public class SpecialEquipmentController extends BaseController {
throw
new
BadRequest
(
"参数校验失败."
);
}
if
(
StringUtils
.
isNotBlank
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
// 查找特定设备
if
(
"3000"
.
equals
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
if
(
SpecialEquipmentCategoryEnum
.
ELEVATOR
.
getCode
()
.
equals
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
result
=
esElevatorService
.
queryPageByDto
(
esSpecialEquipmentDto
,
current
,
size
);
}
if
(
SpecialEquipmentCategoryEnum
.
PRESSURE_VESSEL
.
getCode
().
equals
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
result
=
esCylinderService
.
queryPageByDto
(
esSpecialEquipmentDto
,
current
,
size
);
}
}
return
ResponseHelper
.
buildResponse
(
result
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/dao/ESCylinderRepository.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
dao
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.stereotype.Repository
;
/**
* @author fengwang
* @date 2021-09-26.
*/
@Repository
public
interface
ESCylinderRepository
extends
PagingAndSortingRepository
<
EsCylinder
,
Long
>
{
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/ESCylinderServiceImpl.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EsSpecialEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.SpecialEquipmentCategoryEnum
;
import
com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderRepository
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.common.geo.GeoPoint
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
import
org.springframework.data.elasticsearch.core.SearchHit
;
import
org.springframework.data.elasticsearch.core.SearchHits
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQuery
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* <pre>
* 压力容器信息ES检索服务
* </pre>
*
* @author tb
* @version 2022年4月20日
*/
@Service
public
class
ESCylinderServiceImpl
{
@Autowired
private
ElasticsearchRestTemplate
elasticsearchTemplate
;
@Autowired
private
ESCylinderRepository
esCylinderRepository
;
/**
* <pre>
* 保存气瓶信息
* </pre>
*
* @param cylinderInfoList 保存气瓶信息
*/
public
boolean
saveEsCylinderToES
(
List
<
CylinderInfo
>
cylinderInfoList
)
{
List
<
EsCylinder
>
esCylinderList
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
cylinderInfoList
))
{
cylinderInfoList
.
forEach
(
cylinderInfo
->
{
EsCylinder
esCylinder
=
new
EsCylinder
();
if
(
StringUtils
.
isNotEmpty
(
cylinderInfo
.
getLongitude
()))
{
esCylinder
.
setLongitude
(
Double
.
parseDouble
(
cylinderInfo
.
getLongitude
()));
}
if
(
StringUtils
.
isNotEmpty
(
cylinderInfo
.
getLatitude
()))
{
esCylinder
.
setLatitude
(
Double
.
parseDouble
(
cylinderInfo
.
getLatitude
()));
}
esCylinder
.
setSequenceNbr
(
cylinderInfo
.
getSequenceNbr
());
// esCylinder.setAddress(cylinder.getAddress());
esCylinder
.
setFactoryNum
(
cylinderInfo
.
getFactoryNum
());
esCylinder
.
setUnitName
(
cylinderInfo
.
getUnitName
());
if
(
StringUtils
.
isNotBlank
(
cylinderInfo
.
getLatitude
())
&&
StringUtils
.
isNotBlank
(
cylinderInfo
.
getLongitude
()))
{
double
lat
=
Double
.
parseDouble
(
cylinderInfo
.
getLatitude
());
double
lon
=
Double
.
parseDouble
(
cylinderInfo
.
getLongitude
());
esCylinder
.
setLocation
(
new
GeoPoint
(
lat
,
lon
));
}
esCylinderList
.
add
(
esCylinder
);
});
}
esCylinderRepository
.
saveAll
(
esCylinderList
);
return
true
;
}
public
Page
<
SpecialEquipmentDto
>
queryPageByDto
(
EsSpecialEquipmentDto
esSpecialEquipmentDto
,
int
current
,
int
size
)
{
Page
<
SpecialEquipmentDto
>
result
=
new
Page
<>(
current
,
size
);
Double
startLongitude
=
esSpecialEquipmentDto
.
getStartLongitude
();
Double
startLatitude
=
esSpecialEquipmentDto
.
getStartLatitude
();
Double
endLongitude
=
esSpecialEquipmentDto
.
getEndLongitude
();
Double
endLatitude
=
esSpecialEquipmentDto
.
getEndLatitude
();
String
regionCode
=
esSpecialEquipmentDto
.
getRegionCode
();
String
keyword
=
esSpecialEquipmentDto
.
getKeyword
();
/**
* 通用匹配规则,条件构建
*/
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 经度比start 大比end 小 纬度比start 小 比end 大
if
(!
ValidationUtil
.
isEmpty
(
startLongitude
)
&&
!
ValidationUtil
.
isEmpty
(
startLatitude
)
&&
!
ValidationUtil
.
isEmpty
(
endLongitude
)
&&
!
ValidationUtil
.
isEmpty
(
endLatitude
))
{
BoolQueryBuilder
longLatMust
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
qb1
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
"longitude"
).
gte
(
startLongitude
).
lte
(
endLongitude
));
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
"latitude"
).
gte
(
endLatitude
).
lte
(
startLatitude
));
longLatMust
.
must
(
qb1
);
longLatMust
.
must
(
qb2
);
boolMust
.
must
(
longLatMust
);
}
if
(!
ValidationUtil
.
isEmpty
(
regionCode
))
{
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
filter
(
QueryBuilders
.
matchPhraseQuery
(
"regionCode"
,
regionCode
));
boolMust
.
must
(
qb2
);
}
if
(!
ValidationUtil
.
isEmpty
(
keyword
))
{
BoolQueryBuilder
qb0
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"factoryNum"
,
keyword
));
boolMust
.
should
(
qb0
);
BoolQueryBuilder
qb1
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"address"
,
keyword
));
boolMust
.
should
(
qb1
);
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"unitName"
,
keyword
));
boolMust
.
should
(
qb2
);
boolMust
.
minimumShouldMatch
(
1
);
}
// 创建查询构造器
NativeSearchQuery
query
=
new
NativeSearchQueryBuilder
()
// 分页
.
withPageable
(
PageRequest
.
of
(
current
-
1
,
size
))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.
withQuery
(
boolMust
).
build
();
query
.
setTrackTotalHits
(
true
);
query
.
setMaxResults
(
size
);
List
<
SpecialEquipmentDto
>
list
=
new
LinkedList
<>();
long
total
=
0
;
try
{
SearchHits
<
EsCylinder
>
searchHits
=
elasticsearchTemplate
.
search
(
query
,
EsCylinder
.
class
);
for
(
SearchHit
searchHit
:
searchHits
.
getSearchHits
())
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
searchHit
.
getContent
());
SpecialEquipmentDto
esCylinderDto
=
JSONObject
.
toJavaObject
(
jsonObject
,
SpecialEquipmentDto
.
class
);
esCylinderDto
.
setCategoryCode
(
SpecialEquipmentCategoryEnum
.
PRESSURE_VESSEL
.
getCode
());
esCylinderDto
.
setUniqueCode
(
jsonObject
.
getString
(
"factoryNum"
));
list
.
add
(
esCylinderDto
);
}
total
=
searchHits
.
getTotalHits
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
result
.
setRecords
(
list
);
result
.
setTotal
(
total
);
return
result
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/CylinderInfoController.java
View file @
d9d068dc
...
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESCylinderServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingRecordDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto
;
...
...
@@ -20,9 +22,19 @@ import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.common.recycler.Recycler
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
...
...
@@ -30,7 +42,12 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 气瓶基本信息
...
...
@@ -52,6 +69,9 @@ public class CylinderInfoController extends BaseController {
@Autowired
CylinderFillingRecordServiceImpl
cylinderFillingRecordServiceImpl
;
@Autowired
ESCylinderServiceImpl
esCylinderService
;
private
Map
<
Integer
,
String
>
regionMap
;
...
...
@@ -86,7 +106,6 @@ public class CylinderInfoController extends BaseController {
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
...
...
@@ -842,9 +861,74 @@ public class CylinderInfoController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶超期数量统计"
)
@GetMapping
(
value
=
"/{threshold}/statistics"
)
public
ResponseModel
<
Integer
>
getOverDateStatisticsNumber
(
@PathVariable
int
threshold
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getOverDateStatisticsNumber
(
threshold
));
@GetMapping
(
value
=
"/{earlyWarningLevel}/statistics"
)
public
ResponseModel
<
Integer
>
getOverDateStatisticsNumber
(
@PathVariable
String
earlyWarningLevel
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getOverDateStatisticsNumber
(
earlyWarningLevel
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"按照预警类型查询气瓶分页列表"
,
notes
=
"按照预警类型查询气瓶分页列表"
)
@GetMapping
(
value
=
"/{earlyWarningLevel}/page"
)
public
ResponseModel
<
Page
<
CylinderInfoDto
>>
getOverDateStatisticsNumber
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@PathVariable
String
earlyWarningLevel
){
Page
<
CylinderInfoDto
>
page
=
new
Page
<>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
earlyWarningLevelPageList
(
page
,
earlyWarningLevel
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶详情"
)
@GetMapping
(
value
=
"/{sequenceCode}/detail"
)
public
ResponseModel
<
CylinderInfoDto
>
getDetail
(
@PathVariable
String
sequenceCode
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getDetail
(
sequenceCode
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶处置日志"
)
@GetMapping
(
value
=
"/msg/{sequenceCode}/list"
)
public
ResponseModel
<
List
<
MsgLog
>>
getMsgList
(
@PathVariable
String
sequenceCode
,
@RequestParam
(
value
=
"terminalType"
,
required
=
false
)
String
terminalType
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getMsgList
(
sequenceCode
,
terminalType
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"下次检验日期更新"
,
notes
=
"下次检验日期更新"
)
@PutMapping
(
value
=
"/nextInspectionDate/update"
)
public
ResponseModel
<
Boolean
>
nextInspectionDateUpdate
(
@RequestBody
List
<
CylinderInfoDto
>
cylinderInfoDtos
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
nextInspectionDateUpdate
(
cylinderInfoDtos
));
}
/**
* 气瓶信息放入es
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/init"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"气瓶信息放入es"
,
notes
=
"气瓶信息放入es"
)
public
void
init
(
Integer
num
)
{
IPage
<
CylinderInfo
>
cylinderInfoPage
=
new
Page
<>();
Integer
count
=
cylinderInfoServiceImpl
.
count
();
Integer
times
=
0
;
if
(
ValidationUtil
.
isEmpty
(
num
)
&&
count
!=
0
)
{
times
=
count
/
500
;
int
last
=
count
%
500
;
if
(
last
>
0
)
{
times
++;
}
}
else
if
(
count
!=
0
)
{
times
=
num
;
}
for
(
int
i
=
0
;
i
<=
times
;
i
++)
{
cylinderInfoPage
.
setCurrent
(
i
);
cylinderInfoPage
.
setSize
(
500
);
cylinderInfoPage
=
cylinderInfoServiceImpl
.
page
(
cylinderInfoPage
);
esCylinderService
.
saveEsCylinderToES
(
cylinderInfoPage
.
getRecords
());
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/quartz/CylinderSchedulerJob.java
0 → 100644
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
quartz
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
/**
* @author DELL
*/
@Component
@EnableScheduling
public
class
CylinderSchedulerJob
{
@Autowired
private
CylinderInfoServiceImpl
cylinderInfoService
;
/**
* 每天凌晨0点-日报生成
*/
@Scheduled
(
cron
=
"0 0 8 * * ?"
)
public
void
dayReport
()
{
cylinderInfoService
.
calEarlyWarningLevel
();
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/CylinderInfoServiceImpl.java
View file @
d9d068dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.CylWarningMsgDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.EarlyWarningLevelEnum
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.*
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.*
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInfoService
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
...
...
@@ -27,6 +37,7 @@ import java.util.function.IntConsumer;
* @date 2021-12-14
*/
@Service
@Slf4j
public
class
CylinderInfoServiceImpl
extends
BaseService
<
CylinderInfoDto
,
CylinderInfo
,
CylinderInfoMapper
>
implements
ICylinderInfoService
{
...
...
@@ -78,6 +89,11 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Autowired
CylinderFillingUnloadDataUnitServiceImpl
cylinderFillingUnloadDataUnitServiceImpl
;
@Autowired
MsgLogServiceImpl
msgLogService
;
@Autowired
private
RuleTrigger
ruleTrigger
;
/**
* 分页查询
...
...
@@ -559,7 +575,104 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
}
public
Integer
getOverDateStatisticsNumber
(
int
threshold
)
{
return
this
.
baseMapper
.
countOverDateNumber
(
threshold
);
public
Integer
getOverDateStatisticsNumber
(
String
earlyWarningLevel
)
{
return
this
.
baseMapper
.
countOverDateNumber
(
earlyWarningLevel
);
}
public
Page
<
CylinderInfoDto
>
earlyWarningLevelPageList
(
Page
<
CylinderInfoDto
>
page
,
String
earlyWarningLevel
)
{
Page
<
CylinderInfoDto
>
result
=
this
.
baseMapper
.
queryPageListByEarlyWarningLevel
(
page
,
earlyWarningLevel
);
result
.
getRecords
().
forEach
(
r
->
{
r
.
setEarlyWarningLevelName
(
EarlyWarningLevelEnum
.
getEumByLevel
(
earlyWarningLevel
).
getName
());
r
.
setInspectionStatusDesc
(
EarlyWarningLevelEnum
.
getEumByLevel
(
earlyWarningLevel
).
getStatus
());
});
return
result
;
}
public
void
calEarlyWarningLevel
()
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间调用规则开始"
);
}
// 1.批量分组大小
int
size
=
500
;
int
total
=
this
.
count
();
int
groupNumber
=
total
/
size
+
1
;
// 2.批量小分组处理数据,调用规则
for
(
int
i
=
0
;
i
<
groupNumber
;
i
++)
{
Page
<
CylinderInfo
>
page
=
new
Page
<>();
page
.
setCurrent
(
i
);
page
.
setSize
(
size
);
LambdaQueryWrapper
<
CylinderInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
orderByDesc
(
CylinderInfo:
:
getSequenceNbr
);
IPage
<
CylinderInfo
>
result
=
this
.
page
(
page
,
wrapper
);
for
(
CylinderInfo
r
:
result
.
getRecords
())
{
this
.
touchRuleToCalLevel
(
r
);
}
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间调用规则完成"
);
}
}
private
void
touchRuleToCalLevel
(
CylinderInfo
r
)
{
Date
now
=
new
Date
();
//1.气瓶详情
CylinderInfoDto
cylinderInfoDto
=
this
.
getDetail
(
r
.
getSequenceCode
());
try
{
CylWarningMsgDto
cylWarningMsgDto
=
new
CylWarningMsgDto
();
int
interval
=
DateUtils
.
dateBetweenIncludeToday
(
cylinderInfoDto
.
getNextInspectionDate
(),
now
);
cylWarningMsgDto
.
setNum
(
String
.
valueOf
(
interval
));
cylWarningMsgDto
.
setFactoryNum
(
cylinderInfoDto
.
getFactoryNum
());
cylWarningMsgDto
.
setUserType
(
cylinderInfoDto
.
getCustomType
());
cylWarningMsgDto
.
setUserPeople
(
cylinderInfoDto
.
getCustomName
());
cylWarningMsgDto
.
setUserPeoplePhone
(
cylinderInfoDto
.
getContactPhone
());
cylWarningMsgDto
.
setCylSeq
(
cylinderInfoDto
.
getSequenceCode
());
cylWarningMsgDto
.
setCompanyName
(
cylinderInfoDto
.
getUnitName
());
// 2.循环调用规则 触发计算等级及发送消息
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"调用规则对象!+:{}"
,
JSON
.
toJSONString
(
cylWarningMsgDto
));
}
ruleTrigger
.
publish
(
cylWarningMsgDto
,
"气瓶监管"
,
null
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则失败!:{}"
,
JSON
.
toJSONString
(
cylinderInfoDto
));
}
}
public
CylinderInfoDto
getDetail
(
String
sequenceCode
)
{
CylinderInfoDto
dto
=
this
.
baseMapper
.
getDetail
(
sequenceCode
);
dto
.
setInspectionStatusDesc
(
dto
.
getEarlyWarningLevel
()
!=
null
?
EarlyWarningLevelEnum
.
getEumByLevel
(
dto
.
getEarlyWarningLevel
()).
getStatus
()
:
""
);
return
dto
;
}
public
List
<
MsgLog
>
getMsgList
(
String
sequenceCode
,
String
terminalType
)
{
LambdaQueryWrapper
<
MsgLog
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
MsgLog:
:
getRelationCode
,
sequenceCode
);
wrapper
.
eq
(
StringUtils
.
isNotEmpty
(
terminalType
),
MsgLog:
:
getTerminalType
,
terminalType
);
wrapper
.
orderByDesc
(
MsgLog:
:
getSendTime
);
return
msgLogService
.
list
(
wrapper
);
}
public
CylinderInfo
updateEarlyWarningLevel
(
String
sequenceCode
,
String
level
)
{
CylinderInfo
cylinderInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
CylinderInfo
>().
eq
(
CylinderInfo:
:
getSequenceCode
,
sequenceCode
));
cylinderInfo
.
setEarlyWarningLevel
(
level
);
cylinderInfo
.
setEarlyWarningLevelCalDate
(
new
Date
());
this
.
updateById
(
cylinderInfo
);
return
cylinderInfo
;
}
public
Boolean
nextInspectionDateUpdate
(
List
<
CylinderInfoDto
>
cylinderInfoDtos
)
{
// 1.更新下次检验日期
List
<
CylinderInfo
>
cylinderInfos
=
new
ArrayList
<>();
cylinderInfoDtos
.
forEach
(
c
->
{
CylinderInfo
cylinderInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
CylinderInfo
>().
eq
(
CylinderInfo:
:
getSequenceCode
,
c
.
getSequenceCode
()));
cylinderInfo
.
setNextInspectionDate
(
c
.
getNextInspectionDate
());
cylinderInfos
.
add
(
cylinderInfo
);
});
if
(!
cylinderInfos
.
isEmpty
())
{
this
.
updateBatchById
(
cylinderInfos
);
}
// 2.循环调用规则 触发计算等级及发送消息
cylinderInfos
.
forEach
(
this
::
touchRuleToCalLevel
);
return
Boolean
.
TRUE
;
}
}
\ No newline at end of file
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