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
1b70fc14
Commit
1b70fc14
authored
Jun 07, 2024
by
韩桐桐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cyl):新增接口 向以天为维度的企业气瓶统计表刷入数据,支持指定时间及企业appid
parent
c22db50e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
12 deletions
+54
-12
ICylinderInfoService.java
...module/cylinder/flc/api/service/ICylinderInfoService.java
+3
-1
CylinderInfoController.java
...e/cylinder/flc/biz/controller/CylinderInfoController.java
+12
-1
CylinderInfoServiceImpl.java
...ylinder/flc/biz/service/impl/CylinderInfoServiceImpl.java
+39
-10
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/flc/api/service/ICylinderInfoService.java
View file @
1b70fc14
...
@@ -45,7 +45,9 @@ public interface ICylinderInfoService {
...
@@ -45,7 +45,9 @@ public interface ICylinderInfoService {
void
fillingCheckDataSynHandler
();
void
fillingCheckDataSynHandler
();
void
fillingRecordDataSynHandler
();
void
oneDayEnterpriseCylinderDataRefreshTask
(
String
day
,
String
appId
);
void
fillingRecordDataSynHandler
();
void
synFillingUnloadUnitData
();
void
synFillingUnloadUnitData
();
...
...
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 @
1b70fc14
...
@@ -1337,13 +1337,24 @@ public class CylinderInfoController extends BaseController {
...
@@ -1337,13 +1337,24 @@ public class CylinderInfoController extends BaseController {
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"主动向以天为维度的企业气瓶统计表中刷入当前时间前30天的数据"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"
先清除表数据,再
主动向以天为维度的企业气瓶统计表中刷入当前时间前30天的数据"
)
@GetMapping
(
value
=
"/thirtyDayEnterpriseCylinderDataRefreshTask"
)
@GetMapping
(
value
=
"/thirtyDayEnterpriseCylinderDataRefreshTask"
)
public
ResponseModel
<
Object
>
thirtyDayEnterpriseCylinderDataRefreshTask
()
{
public
ResponseModel
<
Object
>
thirtyDayEnterpriseCylinderDataRefreshTask
()
{
cylinderInfoServiceImpl
.
fillingRecordDataSynHandler
();
cylinderInfoServiceImpl
.
fillingRecordDataSynHandler
();
return
ResponseHelper
.
buildResponse
(
"ok"
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"以天为维度的企业气瓶统计表中刷入某天的数据,"
+
"支持传参:1、某天day(必填):刷入时间,例如2024-06-07;2、企业appId(非必填,如果不填则刷入所有企业的day数据):刷入企业的appId"
)
@GetMapping
(
value
=
"/oneDayEnterpriseCylinderDataRefreshTask"
)
public
ResponseModel
<
Object
>
oneDayEnterpriseCylinderDataRefreshTask
(
@RequestParam
(
value
=
"day"
,
required
=
true
)
String
day
,
@RequestParam
(
value
=
"appId"
,
required
=
false
)
String
appId
)
{
cylinderInfoServiceImpl
.
oneDayEnterpriseCylinderDataRefreshTask
(
day
,
appId
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
/**
/**
* 地市气瓶,气站信息统计
* 地市气瓶,气站信息统计
*
*
...
...
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 @
1b70fc14
...
@@ -806,21 +806,50 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
...
@@ -806,21 +806,50 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
cylinderFillingCheckDataUnitDto
.
setAppId
(
cylinderUnit
.
getAppId
());
cylinderFillingCheckDataUnitDto
.
setAppId
(
cylinderUnit
.
getAppId
());
}
}
@Override
@Override
public
void
fillingRecordDataSynHandler
()
{
public
void
oneDayEnterpriseCylinderDataRefreshTask
(
String
day
,
String
appId
)
{
// 清空数据
try
{
cylinderFillingRecordStatisticsUnitDayServiceImpl
.
remove
(
new
LambdaQueryWrapper
<>());
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
countByUnit
(
cylinderUnit
->
{
Date
date
=
formatter
.
parse
(
day
);
// 当前企业前31天数据填充
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
for
(
int
i
=
0
;
i
<=
30
;
i
++)
{
calendar
.
setTime
(
date
);
if
(
ValidationUtil
.
isEmpty
(
appId
))
{
// 刷入所有企业数据
CompletableFuture
.
runAsync
(()
->
countByUnit
(
cylinderUnit
->
{
CylinderFillingRecordStatisticsUnitDayDto
unitDay
=
new
CylinderFillingRecordStatisticsUnitDayDto
();
calcCylinderFillingCheckDataUnitDataWithDay
(
cylinderUnit
,
calendar
,
unitDay
);
cylinderFillingRecordStatisticsUnitDayServiceImpl
.
createWithModel
(
unitDay
);
}));
}
else
{
// 刷入指定企业数据
CylinderUnit
targetUnit
=
cylinderUnitServiceImpl
.
list
().
stream
()
.
filter
(
unit
->
unit
.
getAppId
().
equals
(
appId
))
.
findFirst
()
.
orElseThrow
(()
->
new
NoSuchElementException
(
"没有对应appid的企业"
));
CylinderFillingRecordStatisticsUnitDayDto
unitDay
=
new
CylinderFillingRecordStatisticsUnitDayDto
();
CylinderFillingRecordStatisticsUnitDayDto
unitDay
=
new
CylinderFillingRecordStatisticsUnitDayDto
();
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
calcCylinderFillingCheckDataUnitDataWithDay
(
targetUnit
,
calendar
,
unitDay
);
calcCylinderFillingCheckDataUnitDataWithDay
(
cylinderUnit
,
calendar
,
unitDay
);
cylinderFillingRecordStatisticsUnitDayServiceImpl
.
createWithModel
(
unitDay
);
cylinderFillingRecordStatisticsUnitDayServiceImpl
.
createWithModel
(
unitDay
);
}
}
});
}
catch
(
ParseException
e
)
{
log
.
error
(
"日期解析错误"
,
e
);
}
catch
(
NoSuchElementException
e
)
{
log
.
error
(
"未找到指定appid的企业"
,
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"刷新企业气瓶数据任务出错"
,
e
);
}
}
@Override
public
void
fillingRecordDataSynHandler
()
{
CompletableFuture
.
runAsync
(()
->
cylinderFillingRecordStatisticsUnitDayServiceImpl
.
remove
(
new
LambdaQueryWrapper
<>()))
.
thenRunAsync
(()
->
countByUnit
(
cylinderUnit
->
{
Calendar
calendar
=
Calendar
.
getInstance
();
for
(
int
i
=
0
;
i
<=
30
;
i
++)
{
CylinderFillingRecordStatisticsUnitDayDto
unitDay
=
new
CylinderFillingRecordStatisticsUnitDayDto
();
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
calcCylinderFillingCheckDataUnitDataWithDay
(
cylinderUnit
,
calendar
,
unitDay
);
cylinderFillingRecordStatisticsUnitDayServiceImpl
.
createWithModel
(
unitDay
);
}
}));
}
}
/**
/**
...
...
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