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
52ac1bea
Commit
52ac1bea
authored
Apr 21, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加调用规则代码-tzs
parent
93144e2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
23 deletions
+50
-23
CylinderInfoDto.java
...oin/amos/boot/module/tzs/flc/api/dto/CylinderInfoDto.java
+3
-0
CylinderInfoMapper.xml
...-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
+2
-1
CylinderInfoServiceImpl.java
...ule/tzs/flc/biz/service/impl/CylinderInfoServiceImpl.java
+45
-22
No files found.
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 @
52ac1bea
...
...
@@ -134,4 +134,7 @@ public class CylinderInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"客户类型"
)
private
String
customName
;
@ApiModelProperty
(
value
=
"联系电话"
)
private
String
contactPhone
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
52ac1bea
...
...
@@ -93,7 +93,8 @@
ci.latitude,
eu.address,
eu.custom_name,
eu.custom_type
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
...
...
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 @
52ac1bea
...
...
@@ -5,6 +5,7 @@ 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
;
...
...
@@ -15,6 +16,7 @@ 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
;
...
...
@@ -23,7 +25,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.function.Consumer
;
...
...
@@ -36,6 +37,7 @@ import java.util.function.IntConsumer;
* @date 2021-12-14
*/
@Service
@Slf4j
public
class
CylinderInfoServiceImpl
extends
BaseService
<
CylinderInfoDto
,
CylinderInfo
,
CylinderInfoMapper
>
implements
ICylinderInfoService
{
...
...
@@ -588,12 +590,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
public
void
calEarlyWarningLevel
()
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间调用规则开始"
);
}
// 1.批量分组大小
int
size
=
10
00
;
int
size
=
5
00
;
int
total
=
this
.
count
();
int
groupNumber
=
total
/
size
+
1
;
Date
now
=
new
Date
();
// 2.批量小分组处理数据
// 2.批量小分组处理数据,调用规则
for
(
int
i
=
0
;
i
<
groupNumber
;
i
++)
{
Page
<
CylinderInfo
>
page
=
new
Page
<>();
page
.
setCurrent
(
i
);
...
...
@@ -601,19 +605,36 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
LambdaQueryWrapper
<
CylinderInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
orderByDesc
(
CylinderInfo:
:
getSequenceNbr
);
IPage
<
CylinderInfo
>
result
=
this
.
page
(
page
,
wrapper
);
result
.
getRecords
().
forEach
(
r
->
{
try
{
int
interval
=
DateUtils
.
dateBetweenIncludeToday
(
r
.
getNextInspectionDate
(),
now
);
// TODO 循环调用规则 触发计算等级
// ruleTrigger.publish(equipmentInputItemRo, packageld, null);
}
catch
(
ParseException
e
)
{
log
.
error
(
JSON
.
toJSONString
(
r
)
+
"格式化失败"
);
}
});
this
.
updateBatchById
(
result
.
getRecords
());
for
(
CylinderInfo
r
:
result
.
getRecords
())
{
this
.
touchRuleToCalLevel
(
r
);
}
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间更新完成"
);
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
));
}
}
...
...
@@ -626,7 +647,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
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
.
eq
(
StringUtils
.
isNotEmpty
(
terminalType
),
MsgLog:
:
getTerminalType
,
terminalType
);
wrapper
.
orderByDesc
(
MsgLog:
:
getSendTime
);
return
msgLogService
.
list
(
wrapper
);
}
...
...
@@ -640,17 +661,18 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
public
Boolean
nextInspectionDateUpdate
(
List
<
CylinderInfoDto
>
cylinderInfoDtos
)
{
List
<
CylinderInfo
>
cylinderInfos
=
new
ArrayList
<>();
cylinderInfoDtos
.
forEach
(
c
->{
CylinderInfo
cylinderInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
CylinderInfo
>().
eq
(
CylinderInfo:
:
getSequenceCode
,
c
.
getSequenceCode
()));
// 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
);
// TODO 循环调用规则 触发计算等级及发送消息
// ruleTrigger.publish(equipmentInputItemRo, packageld, null);
});
if
(!
cylinderInfos
.
isEmpty
())
{
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