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
4a054b34
Commit
4a054b34
authored
Jun 08, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加企业气瓶统计初始化数据接口
parent
5e2abb5a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
3 deletions
+66
-3
EnterpriseStatisticController.java
...tzs/flc/biz/controller/EnterpriseStatisticController.java
+9
-0
CylinderDateInfoServiceImpl.java
...tzs/flc/biz/service/impl/CylinderDateInfoServiceImpl.java
+57
-3
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/EnterpriseStatisticController.java
View file @
4a054b34
...
...
@@ -54,4 +54,13 @@ public class EnterpriseStatisticController extends BaseController {
return
ResponseHelper
.
buildResponse
(
null
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"初始化统计数据"
)
@GetMapping
(
value
=
"/initializeData"
)
public
ResponseModel
initializeData
()
{
cylinderDateInfoService
.
initializeData
();
return
ResponseHelper
.
buildResponse
(
null
);
}
}
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/CylinderDateInfoServiceImpl.java
View file @
4a054b34
...
...
@@ -12,6 +12,8 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderDateInfoMapper;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderUnitMapper
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
...
...
@@ -24,6 +26,7 @@ import java.util.List;
@Service
public
class
CylinderDateInfoServiceImpl
extends
BaseService
<
CylinderDateInfoDto
,
CylinderDateInfo
,
CylinderDateInfoMapper
>
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
CylinderDateInfoServiceImpl
.
class
);
@Autowired
private
CylinderUnitServiceImpl
cylinderUnitService
;
...
...
@@ -110,7 +113,7 @@ public class CylinderDateInfoServiceImpl extends BaseService<CylinderDateInfoDto
Page
<
CylinderUnit
>
cylinderUnitPage
=
new
Page
<>(
Long
.
parseLong
(
pageNumber
),
Long
.
parseLong
(
pageSize
));
LambdaQueryWrapper
<
CylinderUnit
>
lambda
=
new
QueryWrapper
<
CylinderUnit
>().
lambda
();
if
(!
ObjectUtils
.
isEmpty
(
regionName
)){
lambda
.
like
(
CylinderUnit:
:
getRegion
Nam
e
,
regionName
);
lambda
.
like
(
CylinderUnit:
:
getRegion
Cod
e
,
regionName
);
}
if
(!
ObjectUtils
.
isEmpty
(
unitName
)){
lambda
.
like
(
CylinderUnit:
:
getUnitName
,
unitName
);
...
...
@@ -175,7 +178,7 @@ public class CylinderDateInfoServiceImpl extends BaseService<CylinderDateInfoDto
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
todayStr
=
sdf
.
format
(
date
);
List
<
CylinderDateInfo
>
list
=
this
.
list
(
new
LambdaQueryWrapper
<
CylinderDateInfo
>().
between
(
CylinderDateInfo:
:
getSyncDate
,
todayStr
+
" 00:00:00"
,
todayStr
+
" 23:59:59"
).
eq
(
CylinderDateInfo:
:
getAppId
,
token
.
getAppId
()));
if
(
list
.
size
()
==
0
)
{
if
(
ObjectUtils
.
isEmpty
(
list
)
)
{
CylinderDateInfoDto
temp
=
new
CylinderDateInfoDto
();
temp
.
setSyncDate
(
date
);
String
appid
=
token
.
getAppId
();
...
...
@@ -231,9 +234,60 @@ public class CylinderDateInfoServiceImpl extends BaseService<CylinderDateInfoDto
e
.
printStackTrace
();
}
}
logger
.
info
(
"更新昨日数据成功"
);
}
System
.
out
.
println
(
"更新昨日数据成功"
);
public
void
initializeData
(){
// 每天更新或者添加昨天的数据
Date
date
=
new
Date
();
//取时间
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
//这个时间就是日期往后推一天的结果
date
=
calendar
.
getTime
();
LambdaQueryWrapper
<
CylinderUnit
>
lambda
=
new
QueryWrapper
<
CylinderUnit
>().
lambda
();
List
<
CylinderUnit
>
cylinderUnits
=
cylinderUnitMapper
.
selectList
(
lambda
);
logger
.
info
(
"清除cylinder_date_info表已有数据"
);
this
.
baseMapper
.
delete
(
null
);
for
(
CylinderUnit
token
:
cylinderUnits
)
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
todayStr
=
sdf
.
format
(
date
);
CylinderDateInfoDto
temp
=
new
CylinderDateInfoDto
();
temp
.
setSyncDate
(
date
);
String
appid
=
token
.
getAppId
();
temp
.
setUnitName
(
token
.
getUnitName
());
temp
.
setAppId
(
appid
);
temp
.
setDeveloperAgency
(
token
.
getDeveloperAgency
());
logger
.
info
(
"初始化数据时间{}"
,
todayStr
);
// 获取气瓶基本信息
Integer
cylinder
=
cylinderInfoService
.
count
(
new
LambdaQueryWrapper
<
CylinderInfo
>().
eq
(
CylinderInfo:
:
getAppId
,
appid
).
notLike
(
CylinderInfo:
:
getSyncDate
,
todayStr
));
Integer
cylinderUnit
=
cylinderUnitService
.
count
(
new
LambdaQueryWrapper
<
CylinderUnit
>().
eq
(
CylinderUnit:
:
getAppId
,
appid
).
notLike
(
CylinderUnit:
:
getSyncDate
,
todayStr
));
Integer
tags
=
cylinderTagsService
.
count
(
new
LambdaQueryWrapper
<
CylinderTags
>().
eq
(
CylinderTags:
:
getAppId
,
appid
).
notLike
(
CylinderTags:
:
getSyncDate
,
todayStr
));
Integer
inspection
=
cylinderInspectionService
.
count
(
new
LambdaQueryWrapper
<
CylinderInspection
>().
eq
(
CylinderInspection:
:
getAppId
,
appid
).
notLike
(
CylinderInspection:
:
getSyncDate
,
todayStr
));
Integer
filling
=
cylinderFillingService
.
count
(
new
LambdaQueryWrapper
<
CylinderFilling
>().
eq
(
CylinderFilling:
:
getAppId
,
appid
).
notLike
(
CylinderFilling:
:
getSyncDate
,
todayStr
));
Integer
fillingRecord
=
cylinderFillingRecordService
.
count
(
new
LambdaQueryWrapper
<
CylinderFillingRecord
>().
eq
(
CylinderFillingRecord:
:
getAppId
,
appid
).
notLike
(
CylinderFillingRecord:
:
getSyncDate
,
todayStr
));
Integer
fillingCheck
=
cylinderFillingCheckService
.
count
(
new
LambdaQueryWrapper
<
CylinderFillingCheck
>().
eq
(
CylinderFillingCheck:
:
getAppId
,
appid
).
notLike
(
CylinderFillingCheck:
:
getSyncDate
,
todayStr
));
Integer
examine
=
cylinderFillingExamineService
.
count
(
new
LambdaQueryWrapper
<
CylinderFillingExamine
>().
eq
(
CylinderFillingExamine:
:
getAppId
,
appid
).
notLike
(
CylinderFillingExamine:
:
getSyncDate
,
todayStr
));
Integer
total
=
cylinder
+
cylinderUnit
+
tags
+
inspection
+
filling
+
fillingRecord
+
fillingCheck
+
examine
;
temp
.
setCylinderExamineInfo
(
examine
);
temp
.
setCylinderUnit
(
cylinderUnit
);
temp
.
setCylinderFillingCheckInfo
(
fillingCheck
);
temp
.
setCylinderFillingInfo
(
filling
);
temp
.
setCylinderInspectionInfo
(
inspection
);
temp
.
setCylinderTagInfo
(
tags
);
temp
.
setCylinderInfo
(
cylinder
);
temp
.
setCylinderFillingRecordInfo
(
fillingRecord
);
temp
.
setCylinderTotal
(
total
);
this
.
createWithModel
(
temp
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
logger
.
info
(
"更新昨日数据成功"
);
}
}
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