Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 097d80a1
由
LN
编写于
2023-02-10 10:27:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1053报表Movement Summary修改
1 个父辈
442d14ab
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
17 行删除
src/main/java/com/neotel/smfcore/core/system/service/dao/impl/DataLogDaoImpl.java
src/main/java/com/neotel/smfcore/custom/micron20031/MicronReportController.java
src/main/java/com/neotel/smfcore/custom/micron20031/bean/dto/SpDailyLogDto.java
src/main/java/com/neotel/smfcore/core/system/service/dao/impl/DataLogDaoImpl.java
查看文件 @
097d80a
...
...
@@ -79,7 +79,7 @@ public class DataLogDaoImpl extends AbstractBaseDao implements IDataLogDao {
Aggregation
.
match
(
criteria
),
Aggregation
.
project
().
and
(
"updateDate"
).
extractDayOfYear
().
as
(
"label"
),
Aggregation
.
group
(
"label"
).
count
().
as
(
"value"
),
Aggregation
.
project
(
"value"
).
and
(
"
searchType
"
).
previousOperation
()
Aggregation
.
project
(
"value"
).
and
(
"
label
"
).
previousOperation
()
);
AggregationResults
<
SpDailyLog
>
results
=
getMongoTemplate
().
aggregate
(
agg
,
getEntityClass
(),
SpDailyLog
.
class
);
return
results
.
getMappedResults
();
...
...
src/main/java/com/neotel/smfcore/custom/micron20031/MicronReportController.java
查看文件 @
097d80a
...
...
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Slf4j
...
...
@@ -81,46 +82,54 @@ public class MicronReportController {
return
result
;
}
@ApiOperation
(
"M
aterial count
每天的出入库数量统计"
)
@ApiOperation
(
"M
ovement Summary
每天的出入库数量统计"
)
@GetMapping
(
"/dailyLog"
)
@AnonymousAccess
public
List
<
SpDailyLogDto
>
queryDailyLog
(
SpReportQueryCondition
criteria
)
{
Criteria
c
=
null
;
Date
start
=
null
;
Date
end
=
new
Date
();
if
(
criteria
.
getUpdateDate
().
getFrom
()
!=
null
&&
criteria
.
getUpdateDate
().
getTo
()
!=
null
)
{
Date
start
=
null
;
Date
end
=
new
Date
();
if
(
criteria
.
getUpdateDate
()
!=
null
&&
criteria
.
getUpdateDate
()
.
getFrom
()
!=
null
&&
criteria
.
getUpdateDate
().
getTo
()
!=
null
)
{
c
=
Criteria
.
where
(
"createDate"
).
gte
(
criteria
.
getUpdateDate
().
getFrom
()).
lte
(
criteria
.
getUpdateDate
().
getTo
());
start
=
criteria
.
getUpdateDate
().
getFrom
()
;
end
=
criteria
.
getUpdateDate
().
getTo
();
start
=
criteria
.
getUpdateDate
().
getFrom
()
;
end
=
criteria
.
getUpdateDate
().
getTo
();
}
else
{
//过去一月
Calendar
time
=
Calendar
.
getInstance
();
time
.
setTime
(
new
Date
());
time
.
add
(
Calendar
.
MONTH
,
-
1
);
time
.
add
(
Calendar
.
MONTH
,
-
2
);
start
=
time
.
getTime
();
c
=
Criteria
.
where
(
"createDate"
).
gte
(
time
.
getTime
()).
lte
(
new
Date
());
}
List
<
SpDailyLog
>
results
=
dataLogManager
.
getSpDailyLogs
(
start
,
end
,
""
);
HashMap
<
String
,
SpDailyLogDto
>
dailyLogDtos
=
new
HashMap
<
String
,
SpDailyLogDto
>();
List
<
String
>
types
=
new
ArrayList
<>();
List
<
SpDailyLog
>
results
=
dataLogManager
.
getSpDailyLogs
(
start
,
end
,
""
);
HashMap
<
String
,
SpDailyLogDto
>
dailyLogDtos
=
new
HashMap
<
String
,
SpDailyLogDto
>();
List
<
String
>
types
=
new
ArrayList
<>();
types
.
add
(
MInOutType
.
OFFLINE
);
types
.
add
(
MInOutType
.
DESPOSIT
);
types
.
add
(
MInOutType
.
REMOVED
);
types
.
add
(
MInOutType
.
RETURNED
);
types
.
add
(
MInOutType
.
WITHDRAWN
);
for
(
String
type
:
types
)
{
for
(
String
type
:
types
)
{
List
<
SpDailyLog
>
logs
=
dataLogManager
.
getSpDailyLogs
(
start
,
end
,
type
);
List
<
SpDailyLog
>
logs
=
dataLogManager
.
getSpDailyLogs
(
start
,
end
,
type
);
for
(
SpDailyLog
log
:
logs
)
{
SpDailyLogDto
dto
=
dailyLogDtos
.
getOrDefault
(
log
.
getLabel
(),
new
SpDailyLogDto
());
SpDailyLogDto
dto
=
dailyLogDtos
.
getOrDefault
(
log
.
getLabel
(),
new
SpDailyLogDto
());
if
(
dto
.
getTypeCounts
()==
null
){
dto
.
setDayOfYear
(
log
.
getLabel
());
Date
date
=
new
Date
();
SimpleDateFormat
f
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
ca
=
Calendar
.
getInstance
();
ca
.
set
(
Calendar
.
DAY_OF_YEAR
,
Integer
.
valueOf
(
log
.
getLabel
()));
String
time
=
f
.
format
(
ca
.
getTime
());
dto
.
setTime
(
time
);
if
(
dto
.
getTypeCounts
()
==
null
)
{
dto
.
setTypeCounts
(
new
HashMap
<>());
}
dto
.
getTypeCounts
().
put
(
type
,
log
.
getValue
());
dailyLogDtos
.
put
(
log
.
getLabel
(),
dto
);
dto
.
getTypeCounts
().
put
(
type
,
log
.
getValue
());
dailyLogDtos
.
put
(
log
.
getLabel
(),
dto
);
}
}
return
new
ArrayList
<>(
dailyLogDtos
.
values
());
...
...
src/main/java/com/neotel/smfcore/custom/micron20031/bean/dto/SpDailyLogDto.java
查看文件 @
097d80a
...
...
@@ -12,6 +12,8 @@ public class SpDailyLogDto implements Serializable {
@ApiModelProperty
(
"日期"
)
private
String
time
;
private
String
dayOfYear
;
private
HashMap
<
String
,
Integer
>
typeCounts
;
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论