Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
6ca89e3a
Commit
6ca89e3a
authored
Apr 20, 2022
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.气瓶接口
parent
ae29bc20
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
209 additions
and
8 deletions
+209
-8
EarlyWarningLevelEnum.java
...amos/boot/module/tzs/api/enums/EarlyWarningLevelEnum.java
+33
-0
CylinderInfoDto.java
...oin/amos/boot/module/tzs/flc/api/dto/CylinderInfoDto.java
+6
-0
CylinderInfo.java
...oin/amos/boot/module/tzs/flc/api/entity/CylinderInfo.java
+5
-0
CylinderInfoMapper.java
...os/boot/module/tzs/flc/api/mapper/CylinderInfoMapper.java
+7
-0
CylinderInfoMapper.xml
...-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
+31
-2
CylinderInfoController.java
...module/tzs/flc/biz/controller/CylinderInfoController.java
+31
-4
CylinderSchedulerJob.java
.../boot/module/tzs/flc/biz/quartz/CylinderSchedulerJob.java
+26
-0
CylinderInfoServiceImpl.java
...ule/tzs/flc/biz/service/impl/CylinderInfoServiceImpl.java
+70
-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/enums/EarlyWarningLevelEnum.java
0 → 100644
View file @
6ca89e3a
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
{
/**
* 预警等级枚举
*/
FIRST_LEVEL
(
"一级预警"
,
"1"
,
60
),
SECOND_LEVEL
(
"二级预警"
,
"2"
,
10
),
THREE_LEVEL
(
"三级预警"
,
"3"
,
0
);
private
String
name
;
private
String
code
;
private
int
threshold
;
public
static
EarlyWarningLevelEnum
getEumByCode
(
String
code
){
Optional
<
EarlyWarningLevelEnum
>
op
=
Arrays
.
stream
(
EarlyWarningLevelEnum
.
values
()).
filter
(
e
->
e
.
getCode
().
equals
(
code
)).
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/flc/api/dto/CylinderInfoDto.java
View file @
6ca89e3a
...
...
@@ -110,4 +110,10 @@ public class CylinderInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"预警等级"
)
private
String
earlyWarningLevel
;
@ApiModelProperty
(
value
=
"预警等级名称"
)
private
String
earlyWarningLevelName
;
@ApiModelProperty
(
value
=
"最近配送地址"
)
private
String
address
;
}
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 @
6ca89e3a
...
...
@@ -164,4 +164,9 @@ public class CylinderInfo {
* 预警等级
*/
private
String
earlyWarningLevel
;
/**
* 预警等级 计算日期
*/
private
Date
earlyWarningLevelCalDate
;
}
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 @
6ca89e3a
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
;
...
...
@@ -58,4 +60,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Integer
getMonthBeforeLastInfoTotalUnit
(
@Param
(
"appId"
)
String
appId
);
Integer
countOverDateNumber
(
@Param
(
"threshold"
)
int
threshold
);
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 @
6ca89e3a
...
...
@@ -60,6 +60,35 @@
where
DATEDIFF(ci.next_inspection_date,now())
<![CDATA[<=]]>
#{threshold}
</select>
<select
id=
"queryPageListByEarlyWarningLevel"
resultType=
"com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto"
>
select
ci.sequence_code,
ci.unit_name,
ci.inspection_date,
ci.next_inspection_date,
ci.early_warning_level,
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 next_inspection_date desc
</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.next_inspection_date,
ci.early_warning_level,
eu.address,
eu.custom_name
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/flc/biz/controller/CylinderInfoController.java
View file @
6ca89e3a
...
...
@@ -6,6 +6,7 @@ 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.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingRecordDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto
;
...
...
@@ -86,7 +87,6 @@ public class CylinderInfoController extends BaseController {
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
...
...
@@ -842,9 +842,36 @@ 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
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getMsgList
(
sequenceCode
));
}
}
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 @
6ca89e3a
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 0 * * ?"
)
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 @
6ca89e3a
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.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
;
...
...
@@ -15,6 +21,7 @@ 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
;
...
...
@@ -78,6 +85,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Autowired
CylinderFillingUnloadDataUnitServiceImpl
cylinderFillingUnloadDataUnitServiceImpl
;
@Autowired
MsgLogServiceImpl
msgLogService
;
/**
* 分页查询
...
...
@@ -559,7 +568,65 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
}
public
Integer
getOverDateStatisticsNumber
(
int
threshold
)
{
return
this
.
baseMapper
.
countOverDateNumber
(
threshold
);
public
Integer
getOverDateStatisticsNumber
(
String
earlyWarningLevel
)
{
EarlyWarningLevelEnum
earlyWarningLevelEnum
=
EarlyWarningLevelEnum
.
getEumByCode
(
earlyWarningLevel
);
return
this
.
baseMapper
.
countOverDateNumber
(
earlyWarningLevelEnum
.
getThreshold
());
}
public
Page
<
CylinderInfoDto
>
earlyWarningLevelPageList
(
Page
<
CylinderInfoDto
>
page
,
String
earlyWarningLevel
)
{
Page
<
CylinderInfoDto
>
result
=
this
.
baseMapper
.
queryPageListByEarlyWarningLevel
(
page
,
earlyWarningLevel
);
result
.
getRecords
().
forEach
(
r
->
r
.
setEarlyWarningLevelName
(
EarlyWarningLevelEnum
.
getEumByCode
(
earlyWarningLevel
).
getName
()));
return
result
;
}
public
void
calEarlyWarningLevel
()
{
// 1.批量分组大小
int
size
=
1000
;
int
total
=
this
.
count
();
int
groupNumber
=
total
/
size
+
1
;
Date
now
=
new
Date
();
// 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
);
result
.
getRecords
().
forEach
(
r
->
{
try
{
int
interval
=
DateUtils
.
dateBetweenIncludeToday
(
r
.
getNextInspectionDate
(),
now
);
if
(
interval
<=
60
)
{
r
.
setEarlyWarningLevel
(
EarlyWarningLevelEnum
.
FIRST_LEVEL
.
getCode
());
r
.
setEarlyWarningLevelCalDate
(
now
);
}
if
(
interval
<=
10
)
{
r
.
setEarlyWarningLevel
(
EarlyWarningLevelEnum
.
SECOND_LEVEL
.
getCode
());
r
.
setEarlyWarningLevelCalDate
(
now
);
}
if
(
interval
<=
0
)
{
r
.
setEarlyWarningLevel
(
EarlyWarningLevelEnum
.
THREE_LEVEL
.
getCode
());
r
.
setEarlyWarningLevelCalDate
(
now
);
}
}
catch
(
ParseException
e
)
{
log
.
error
(
JSON
.
toJSONString
(
r
)
+
"格式化失败"
);
}
});
this
.
updateBatchById
(
result
.
getRecords
());
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间更新完成"
);
}
}
public
CylinderInfoDto
getDetail
(
String
sequenceCode
)
{
return
this
.
baseMapper
.
getDetail
(
sequenceCode
);
}
public
List
<
MsgLog
>
getMsgList
(
String
sequenceCode
)
{
LambdaQueryWrapper
<
MsgLog
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
MsgLog:
:
getRelationCode
,
sequenceCode
);
wrapper
.
orderByDesc
(
MsgLog:
:
getSendTime
);
return
msgLogService
.
list
(
wrapper
);
}
}
\ 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