Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
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
竹天卫
tianjin-cement
Commits
0e362a24
Commit
0e362a24
authored
Feb 22, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计功能完成
parent
d9b7542f
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
318 additions
and
95 deletions
+318
-95
DataStatisticsController.java
.../cement/business/controller/DataStatisticsController.java
+26
-10
NormProductionController.java
.../cement/business/controller/NormProductionController.java
+22
-1
DataStatisticsMapper.java
.../wise/sc/cement/business/mapper/DataStatisticsMapper.java
+16
-5
DataStatisticsMapper.xml
...se/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
+72
-18
EntrustMapper.xml
...a/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
+1
-1
CountItemDistributionQuery.java
...ment/business/model/query/CountItemDistributionQuery.java
+10
-1
DataStatisticsTeamVo.java
...ise/sc/cement/business/model/vo/DataStatisticsTeamVo.java
+10
-11
SampleDistributionEnclosureVo.java
...ment/business/model/vo/SampleDistributionEnclosureVo.java
+5
-0
SampleHandleEnclosureVo.java
.../sc/cement/business/model/vo/SampleHandleEnclosureVo.java
+4
-0
IDataStatisticsService.java
...se/sc/cement/business/service/IDataStatisticsService.java
+3
-1
DataStatisticsServiceImpl.java
...ment/business/service/impl/DataStatisticsServiceImpl.java
+49
-22
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+7
-1
DataStatisticsMapper.xml
...n/wise/sc/cement/business/mapper/DataStatisticsMapper.xml
+93
-24
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/DataStatisticsController.java
View file @
0e362a24
...
...
@@ -106,9 +106,6 @@ public class DataStatisticsController {
//todo 委托单进展统计-列表导出
@ApiOperation
(
value
=
"统计概览-进行中任务数量统计"
)
@GetMapping
(
"/countTaskIng"
)
public
BaseResponse
countTaskIng
(
PageQuery
pageQuery
)
{
...
...
@@ -133,30 +130,47 @@ public class DataStatisticsController {
}
@ApiOperation
(
value
=
"检测项
数量
统计-检测项数量统计"
)
@ApiOperation
(
value
=
"检测项统计-检测项数量统计"
)
@GetMapping
(
"/countTeamDetail"
)
public
BaseResponse
countTeamDetail
(
Integer
cycle
,
String
startDate
,
String
endDate
)
{
try
{
return
dataStatisticsService
.
countTeamDetail
(
cycle
,
startDate
,
endDate
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"检测项
数量
统计-检测项数量统计{}"
,
e
);
log
.
debug
(
"检测项统计-检测项数量统计{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"检测项
数量统计-
列表"
)
@ApiOperation
(
value
=
"检测项
统计-分页
列表"
)
@GetMapping
(
"/countTeamList"
)
public
BaseResponse
countTeamList
()
{
public
BaseResponse
countTeamList
(
PageQuery
pageQuery
,
Integer
cycle
,
String
startDate
,
String
endDate
)
{
try
{
return
dataStatisticsService
.
countTeamList
(
pageQuery
,
cycle
,
startDate
,
endDate
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"检测项统计-列表{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
//todo 检测项"检测项统计-列表导出
@ApiOperation
(
value
=
"各委托单位项目数量统计"
)
@GetMapping
(
"/countByClient"
)
public
BaseResponse
countByClient
()
{
try
{
return
dataStatisticsService
.
count
TeamLis
t
();
return
dataStatisticsService
.
count
ByClien
t
();
}
catch
(
Exception
e
)
{
log
.
debug
(
"
检测项数量统计-列表
{}"
,
e
);
log
.
debug
(
"
各委托单位项目数量统计
{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
"检测项分布统计"
)
@ApiOperation
(
"检测元素含量分布情况统计"
)
@PostMapping
(
"/item/download"
)
public
BaseResponse
<
Page
<
ItemDistributionVo
>>
downloadItemDistribution
(
@RequestBody
CountItemDistributionQuery
query
,
HttpServletResponse
response
)
{
...
...
@@ -164,5 +178,7 @@ public class DataStatisticsController {
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/controller/NormProductionController.java
View file @
0e362a24
...
...
@@ -113,7 +113,7 @@ public class NormProductionController {
@GetMapping
(
"/statistics"
)
@ApiOperation
(
"标准产值统计"
)
@ApiOperation
(
"标准产值统计
-分页
"
)
public
BaseResponse
<
Page
<
NormProductionStatistics
>>
normProductionStatistics
(
String
start
,
String
end
,
String
name
,
Integer
groupId
,
PageQuery
pageQuery
)
{
Long
startTime
=
null
;
...
...
@@ -137,6 +137,27 @@ public class NormProductionController {
return
BaseResponse
.
okData
(
new
Page
<>());
}
@GetMapping
(
"/statisticsList"
)
@ApiOperation
(
"标准产值统计-列表"
)
public
BaseResponse
<
List
<
NormProductionStatistics
>>
normProductionStatisticsList
(
String
start
,
String
end
,
String
name
,
Integer
groupId
)
{
Long
startTime
=
null
;
Long
endTime
=
null
;
if
(
StrUtil
.
isNotBlank
(
start
)
&&
StrUtil
.
isNotBlank
(
end
))
{
startTime
=
DateUtil
.
parseDate
(
start
).
getTime
();
endTime
=
DateUtil
.
parseDate
(
end
).
offsetNew
(
DateField
.
DAY_OF_MONTH
,
1
).
getTime
();
}
//将list拆分成分页
BaseResponse
<
List
<
NormProductionStatistics
>>
baseResponse
=
iPrecipriceService
.
normProductionStatistics
(
startTime
,
endTime
,
name
,
groupId
);
return
baseResponse
;
}
@GetMapping
(
"/statistics/detail"
)
@ApiOperation
(
"标准产值详情"
)
public
BaseResponse
<
Page
<
NormProduction
.
NormProductionDetail
>>
normProductionDetails
(
Integer
userId
,
String
start
,
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/DataStatisticsMapper.java
View file @
0e362a24
...
...
@@ -34,7 +34,7 @@ public interface DataStatisticsMapper {
List
<
DataStatisticsVo
>
countEntrustType
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
IPage
<
EntrustVo
>
countEntrustPage
(
@Param
(
"page"
)
Page
page
);
IPage
<
EntrustVo
>
countEntrustPage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
IPage
<
DataStatisticsVo
>
countHandlePage
(
@Param
(
"page"
)
Page
page
);
...
...
@@ -48,14 +48,25 @@ public interface DataStatisticsMapper {
List
<
DataStatisticsVo
>
countTeam
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
List
<
DataStatisticsTeamVo
>
countTeamList
();
IPage
<
DataStatisticsTeamVo
>
countTeamPage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
Integer
countEntrustNum
(
@Param
(
"teamId"
)
Integer
teamId
);
Integer
countSampleNum
(
@Param
(
"teamId"
)
Integer
teamId
);
List
<
DataStatisticsVo
>
countByClient
();
IPage
<
ItemDistribution
>
countItemDistribution
(
@Param
(
"page"
)
Page
<
ItemDistribution
>
page
,
@Param
(
"start"
)
Date
startTime
,
@Param
(
"end"
)
Date
endTime
,
@Param
(
"start"
)
String
startTime
,
@Param
(
"end"
)
String
endTime
,
@Param
(
"origins"
)
List
<
String
>
origins
,
@Param
(
"itemId"
)
Long
itemId
);
ItemDistributionSample
countItemDistributionSample
(
@Param
(
"start"
)
Date
startTime
,
@Param
(
"end"
)
Date
endTime
,
ItemDistributionSample
countItemDistributionSample
(
@Param
(
"start"
)
String
startTime
,
@Param
(
"end"
)
String
endTime
,
@Param
(
"origin"
)
String
origin
,
@Param
(
"teamId"
)
Long
teamId
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
View file @
0e362a24
...
...
@@ -43,8 +43,8 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.
endDate != null and params.end
Date != ''"
>
and DATE(sd.create_time)
&
lt;
= #{params.end
Date}
<if
test=
"params.
startDate != null and params.start
Date != ''"
>
and DATE(sd.create_time)
&
gt;
= #{params.start
Date}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
...
...
@@ -81,8 +81,8 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(e.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.
endDate != null and params.end
Date != ''"
>
and DATE(e.create_time)
&
lt;
= #{params.end
Date}
<if
test=
"params.
startDate != null and params.start
Date != ''"
>
and DATE(e.create_time)
&
gt;
= #{params.start
Date}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(e.create_time)
<
= #{params.endDate}
...
...
@@ -91,7 +91,7 @@
</select>
<select
id=
"countEntrustType"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
select e.project_type
, count(*)
select e.project_type
as name, count(*) as value
from entrust e
where e.status != 0 and e.project_type is not null
<if
test=
"params.cycle == 1 "
>
...
...
@@ -103,8 +103,8 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(e.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.
endDate != null and params.end
Date != ''"
>
and DATE(e.create_time)
&
lt;
= #{params.end
Date}
<if
test=
"params.
startDate != null and params.start
Date != ''"
>
and DATE(e.create_time)
&
gt;
= #{params.start
Date}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(e.create_time)
<
= #{params.endDate}
...
...
@@ -136,6 +136,12 @@
<if
test=
"params.clientName != null and params.clientName != ''"
>
and c.name like concat('%', #{params.clientName}, '%')
</if>
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(e.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(e.create_time)
<
= #{params.endDate}
</if>
order by create_time desc
</select>
...
...
@@ -212,25 +218,68 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sd.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
group by sd.team_id
</select>
<select
id=
"countTeamPage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsTeamVo"
>
SELECT t.id as id, t.name as teamName, count(*) as teamNum FROM sample_distribution sd
left join team t on t.id = sd.team_id
where 1=1
<if
test=
"params.cycle == 1 "
>
and YEARWEEK(date_format(sd.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
<if
test=
"params.cycle == 2 "
>
and DATE_FORMAT( sd.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) ,'%Y%m')
</if>
<if
test=
"params.cycle == 3 "
>
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sd.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
group by sd.team_id
</select>
<select
id=
"countTeamList"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsTeamVo"
>
SELECT DISTINCT t.name as teamName, e.project_code as projectCode,
e.entrust_code as entrustCode, e.entrust_date as entrustDate,
e.sample_num as sampleNum
FROM sample_distribution sd
left join sample s on s.id = sd.sample_id
left join entrust e on e.id = s.entrust_id
left join team t on t.id = sd.team_id
<select
id=
"countEntrustNum"
resultType=
"integer"
>
select count(*) as entrustNum from (
SELECT sd.entrust_id as id, count(*) as entrustNum FROM sample_distribution sd
where sd.team_id = #{teamId}
group by sd.entrust_id
)aa
</select>
<select
id=
"countSampleNum"
resultType=
"integer"
>
select count(*) as sampleNum from (
SELECT sd.sample_id as id, count(*) as entrustNum FROM sample_distribution sd
where sd.team_id = #{teamId}
group by sd.sample_id
)aa
</select>
<select
id=
"countByClient"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
select c.name as name, count(*) as value from entrust e
left join client c on c.id = e.client_id
group by e.client_id
</select>
...
...
@@ -242,8 +291,10 @@
SELECT COUNT(sd.team_id) as `count`,t.`name` FROM sample_distribution sd
LEFT JOIN sample s ON sd.sample_id = s.id
LEFT JOIN team t ON t.id = sd.team_id
WHERE
sd.finish_time BETWEEN #{start} AND #{end}
WHERE 1=1
<if
test=
"start != null and end != null"
>
AND (sd.finish_time between #{start} and #{end})
</if>
<if
test=
"origin != null and origin != '' "
>
AND s.origin = #{origin}
</if>
...
...
@@ -258,7 +309,10 @@
`key` FROM sample_distribution sd
LEFT JOIN sample s ON sd.sample_id = s.id
LEFT JOIN team t ON t.id = sd.team_id
WHERE (sd.finish_time between #{start} and #{end})
WHERE 1=1
<if
test=
"start != null and end != null"
>
AND (sd.finish_time between #{start} and #{end})
</if>
<if
test=
"origins != null and origins.size()>0"
>
AND s.origin in
<foreach
collection=
"origins"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
View file @
0e362a24
...
...
@@ -438,7 +438,7 @@
<select
id=
"getSampleReturnCheckPage"
resultType=
"cn.wise.sc.cement.business.model.vo.EntrustVo"
>
select e.id as id, e.entrust_code as entrustCode, e.sample_num as sampleNum,e.entrust_date as entrustDate,
select
DISTINCT
e.id as id, e.entrust_code as entrustCode, e.sample_num as sampleNum,e.entrust_date as entrustDate,
e.project_type as projectType, t.remark as opinion,
e.status,
(
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/query/CountItemDistributionQuery.java
View file @
0e362a24
package
cn
.
wise
.
sc
.
cement
.
business
.
model
.
query
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.time.Period
;
...
...
@@ -13,10 +14,18 @@ import java.util.List;
**/
@Data
public
class
CountItemDistributionQuery
{
@ApiModelProperty
(
"检测元素(单选)"
)
private
Long
itemId
;
@ApiModelProperty
(
"地区(多选)"
)
private
List
<
String
>
origins
;
@ApiModelProperty
(
"开始日期 2021-02-22"
)
private
String
startTime
;
@ApiModelProperty
(
"结束日期 2021-02-22"
)
private
String
endTime
;
private
String
type
;
@ApiModelProperty
(
"分页参数"
)
private
PageQuery
pageQuery
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/DataStatisticsTeamVo.java
View file @
0e362a24
...
...
@@ -15,21 +15,20 @@ import java.time.LocalDate;
@ApiModel
(
"数据统计-检测项数量统计列表"
)
public
class
DataStatisticsTeamVo
{
@ApiModelProperty
(
"检测项目"
)
private
String
teamName
;
@ApiModelProperty
(
"
项目编号
"
)
private
String
projectCode
;
@ApiModelProperty
(
"
检测项目ID
"
)
private
Integer
id
;
@ApiModelProperty
(
"
委托编号
"
)
private
String
entrustCod
e
;
@ApiModelProperty
(
"
检测项目名称
"
)
private
String
teamNam
e
;
@ApiModelProperty
(
"委托日期"
)
private
LocalDate
entrustDate
;
@ApiModelProperty
(
"样品数量"
)
private
String
sampleNum
;
@ApiModelProperty
(
"检测项数量"
)
private
Integer
teamNum
;
@ApiModelProperty
(
"委托数量"
)
private
Integer
entrustNum
;
@ApiModelProperty
(
"样品数量"
)
private
Integer
sampleNum
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/SampleDistributionEnclosureVo.java
View file @
0e362a24
...
...
@@ -56,4 +56,9 @@ public class SampleDistributionEnclosureVo {
@ApiModelProperty
(
"pdf地址"
)
private
String
pdfUrl
;
@ApiModelProperty
(
"是否允许委托人查看 是否公开 (0不公开,1公开)"
)
private
Integer
isPublic
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/SampleHandleEnclosureVo.java
View file @
0e362a24
...
...
@@ -61,4 +61,8 @@ public class SampleHandleEnclosureVo {
@ApiModelProperty
(
"pdf地址"
)
private
String
pdfUrl
;
@ApiModelProperty
(
"是否允许委托人查看 是否公开 (0不公开,1公开)"
)
private
Integer
isPublic
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/IDataStatisticsService.java
View file @
0e362a24
...
...
@@ -42,7 +42,9 @@ public interface IDataStatisticsService {
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamDetail
(
Integer
cycle
,
String
startDate
,
String
endDate
);
BaseResponse
<
List
<
DataStatisticsTeamVo
>>
countTeamList
();
BaseResponse
<
IPage
<
DataStatisticsTeamVo
>>
countTeamList
(
PageQuery
pageQuery
,
Integer
cycle
,
String
startDate
,
String
endDate
);
BaseResponse
<
List
<
DataStatisticsVo
>>
countByClient
();
/**
* 导出检查项分布统计
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/DataStatisticsServiceImpl.java
View file @
0e362a24
...
...
@@ -191,6 +191,12 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
QueryWrapper
<
Entrust
>
entrustQw
=
new
QueryWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
startDate
)){
entrustQw
.
ge
(
"create_time"
,
startDate
);
}
if
(
StringUtils
.
isNotBlank
(
endDate
)){
entrustQw
.
le
(
"create_time"
,
endDate
);
}
Integer
sum_counts
=
entrustService
.
count
(
entrustQw
);
if
(
sum_counts
==
null
){
map
.
put
(
"sumCounts"
,
"0"
);
...
...
@@ -198,7 +204,7 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
map
.
put
(
"typeList"
,
null
);
}
else
{
List
<
DataStatisticsVo
>
statusList
=
dataStatisticsMapper
.
countEntrustStatus
(
params
);
List
<
DataStatisticsVo
>
typeList
=
dataStatisticsMapper
.
countEntrust
Status
(
params
);
List
<
DataStatisticsVo
>
typeList
=
dataStatisticsMapper
.
countEntrust
Type
(
params
);
map
.
put
(
"sumCounts"
,
sum_counts
);
map
.
put
(
"statusList"
,
statusList
);
map
.
put
(
"typeList"
,
typeList
);
...
...
@@ -221,7 +227,7 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
params
.
put
(
"endDate"
,
endDate
);
params
.
put
(
"clientName"
,
clientName
);
Page
<
EntrustVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
EntrustVo
>
pages
=
dataStatisticsMapper
.
countEntrustPage
(
page
);
IPage
<
EntrustVo
>
pages
=
dataStatisticsMapper
.
countEntrustPage
(
page
,
params
);
List
<
EntrustVo
>
list
=
pages
.
getRecords
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
...
...
@@ -428,34 +434,51 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
* @return
*/
@Override
public
BaseResponse
<
List
<
DataStatisticsTeamVo
>>
countTeamList
(){
List
<
DataStatisticsTeamVo
>
list
=
dataStatisticsMapper
.
countTeamList
();
return
BaseResponse
.
okData
(
list
);
public
BaseResponse
<
IPage
<
DataStatisticsTeamVo
>>
countTeamList
(
PageQuery
pageQuery
,
Integer
cycle
,
String
startDate
,
String
endDate
){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"cycle"
,
cycle
);
params
.
put
(
"startDate"
,
startDate
);
params
.
put
(
"endDate"
,
endDate
);
Page
<
DataStatisticsTeamVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
DataStatisticsTeamVo
>
pages
=
dataStatisticsMapper
.
countTeamPage
(
page
,
params
);
List
<
DataStatisticsTeamVo
>
list
=
pages
.
getRecords
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
DataStatisticsTeamVo
dstVo
:
list
)
{
Integer
entrustNum
=
dataStatisticsMapper
.
countEntrustNum
(
dstVo
.
getId
());
dstVo
.
setEntrustNum
(
entrustNum
);
Integer
sampleNum
=
dataStatisticsMapper
.
countSampleNum
(
dstVo
.
getId
());
dstVo
.
setSampleNum
(
sampleNum
);
}
}
return
BaseResponse
.
okData
(
pages
);
}
/**
* 各委托单位项目数量统计
* @return
*/
@Override
public
BaseResponse
<
List
<
DataStatisticsVo
>>
countByClient
(){
List
<
DataStatisticsVo
>
list
=
dataStatisticsMapper
.
countByClient
();
return
BaseResponse
.
okData
(
list
);
}
/**
* 检测元素含量分布情况统计
* @param query 请求参数
* @param response 响应
* @return
*/
@Override
public
BaseResponse
<
Page
<
ItemDistributionVo
>>
countItemDistribution
(
CountItemDistributionQuery
query
,
HttpServletResponse
response
)
{
String
startTimeStr
=
query
.
getStartTime
();
String
endTimeStr
=
query
.
getEndTime
();
String
type
=
query
.
getType
();
String
startTime
=
query
.
getStartTime
();
String
endTime
=
query
.
getEndTime
();
Long
itemId
=
query
.
getItemId
();
List
<
String
>
origins
=
query
.
getOrigins
();
Date
startTime
=
null
;
Date
endTime
=
null
;
Page
<
ItemDistribution
>
page
=
new
Page
<>(
query
.
getPageQuery
().
getPageNo
(),
query
.
getPageQuery
().
getPageSize
());
if
(
StrUtil
.
isNotEmpty
(
type
))
{
startTime
=
DateUtil
.
getStartTime
(
Integer
.
parseInt
(
type
));
endTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
date
();
}
if
(
StrUtil
.
isNotEmpty
(
startTimeStr
))
{
startTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parseDate
(
startTimeStr
);
}
if
(
StrUtil
.
isNotEmpty
(
endTimeStr
))
{
endTime
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parseDate
(
endTimeStr
);
}
//获取检测项目城市分布统计
IPage
<
ItemDistribution
>
list
=
dataStatisticsMapper
...
...
@@ -482,7 +505,11 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
vo
.
setItemName
(
sample
.
getName
());
vo
.
setSampleCount
(
sample
.
getCount
());
vo
.
setItemCount
(
distribution
.
getCount
());
vo
.
setTime
(
startTime
+
"_"
+
endTime
);
if
(
StringUtils
.
isEmpty
(
startTime
)
||
StringUtils
.
isEmpty
(
endTime
)){
vo
.
setTime
(
null
);
}
else
{
vo
.
setTime
(
startTime
+
"_"
+
endTime
);
}
rtsRecords
.
add
(
vo
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
0e362a24
...
...
@@ -2529,7 +2529,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
sampleDistributionEquipmentService
.
saveBatch
(
sdeList
);
}
//改变校核表状态为待校核状态
SampleDistributionCheckinput
sampleDistributionCheckinput
=
sampleDistributionCheckinputMapper
.
selectById
(
distribution
.
getCheckInputId
());
if
(
sampleDistributionCheckinput
!=
null
){
sampleDistributionCheckinput
.
setStatus
(
2
);
//待校核
sampleDistributionCheckinputMapper
.
updateById
(
sampleDistributionCheckinput
);
}
}
}
...
...
cement-business/target/classes/cn/wise/sc/cement/business/mapper/DataStatisticsMapper.xml
View file @
0e362a24
...
...
@@ -43,8 +43,8 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.
endDate != null and params.end
Date != ''"
>
and DATE(sd.create_time)
&
lt;
= #{params.end
Date}
<if
test=
"params.
startDate != null and params.start
Date != ''"
>
and DATE(sd.create_time)
&
gt;
= #{params.start
Date}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
...
...
@@ -81,8 +81,8 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(e.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.
endDate != null and params.end
Date != ''"
>
and DATE(e.create_time)
&
lt;
= #{params.end
Date}
<if
test=
"params.
startDate != null and params.start
Date != ''"
>
and DATE(e.create_time)
&
gt;
= #{params.start
Date}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(e.create_time)
<
= #{params.endDate}
...
...
@@ -91,7 +91,7 @@
</select>
<select
id=
"countEntrustType"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
select e.project_type
, count(*)
select e.project_type
as name, count(*) as value
from entrust e
where e.status != 0 and e.project_type is not null
<if
test=
"params.cycle == 1 "
>
...
...
@@ -103,8 +103,8 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(e.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.
endDate != null and params.end
Date != ''"
>
and DATE(e.create_time)
&
lt;
= #{params.end
Date}
<if
test=
"params.
startDate != null and params.start
Date != ''"
>
and DATE(e.create_time)
&
gt;
= #{params.start
Date}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(e.create_time)
<
= #{params.endDate}
...
...
@@ -136,6 +136,12 @@
<if
test=
"params.clientName != null and params.clientName != ''"
>
and c.name like concat('%', #{params.clientName}, '%')
</if>
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(e.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(e.create_time)
<
= #{params.endDate}
</if>
order by create_time desc
</select>
...
...
@@ -165,18 +171,33 @@
</select>
<select
id=
"countDistributionPage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT su.name as name, count(*) as value FROM sample_distribution sd
SELECT su.
id as id, su.
name as name, count(*) as value FROM sample_distribution sd
left join sys_user su on su.id = sd.user_id
where sd.status = 1 or sd.status = 5
group by sd.user_id
</select>
<select
id=
"countDistributionWeek"
resultType=
"integer"
>
SELECT count(*)
FROM sample_distribution sd
left join sys_user su on su.id = sd.user_id
where (sd.status =2 or sd.status =4)
<if
test=
"userId != null "
>
and sd.user_id = #{userId}
</if>
<if
test=
"weekType == 1 "
>
and YEARWEEK(date_format(sd.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())-1
</if>
<if
test=
"weekType == 2 "
>
and YEARWEEK(date_format(sd.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
group by sd.user_id
</select>
<select
id=
"countTeamIng"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT t.name as name, count(*) as value FROM sample_distribution sd
left join team t on t.id = sd.team_id
...
...
@@ -197,23 +218,59 @@
<if
test=
"params.cycle == 3 "
>
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sd.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
group by sd.team_id
</select>
<select
id=
"countTeamPage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsTeamVo"
>
SELECT t.id as id, t.name as teamName, count(*) as teamNum FROM sample_distribution sd
left join team t on t.id = sd.team_id
where 1=1
<if
test=
"params.cycle == 1 "
>
and YEARWEEK(date_format(sd.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
<if
test=
"params.cycle == 2 "
>
and DATE_FORMAT( sd.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) ,'%Y%m')
</if>
<if
test=
"params.cycle == 3 "
>
and YEAR(sd.create_time) = YEAR( NOW( ) )
</if>
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sd.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
group by sd.team_id
</select>
<select
id=
"countTeamList"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsTeamVo"
>
SELECT DISTINCT t.name as teamName, e.project_code as projectCode,
e.entrust_code as entrustCode, e.entrust_date as entrustDate,
e.sample_num as sampleNum
FROM sample_distribution sd
left join sample s on s.id = sd.sample_id
left join entrust e on e.id = s.entrust_id
left join team t on t.id = sd.team_id
<select
id=
"countEntrustNum"
resultType=
"integer"
>
select count(*) as entrustNum from (
SELECT sd.entrust_id as id, count(*) as entrustNum FROM sample_distribution sd
where sd.team_id = #{teamId}
group by sd.entrust_id
)aa
</select>
<select
id=
"countSampleNum"
resultType=
"integer"
>
select count(*) as sampleNum from (
SELECT sd.sample_id as id, count(*) as entrustNum FROM sample_distribution sd
where sd.team_id = #{teamId}
group by sd.sample_id
)aa
</select>
<select
id=
"countByClient"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
select c.name as name, count(*) as value from entrust e
left join client c on c.id = e.client_id
group by e.client_id
</select>
...
...
@@ -222,13 +279,22 @@
<select
id=
"countItemDistributionSample"
resultType=
"cn.wise.sc.cement.business.entity.ItemDistributionSample"
>
SELECT COUNT(sd.team_id) as `count`,t.`name` FROM sample_distribution sd
LEFT JOIN sample s ON sd.sample_id = s.id
LEFT JOIN team t ON t.id = sd.team_id
WHERE
sd.finish_time BETWEEN #{start} AND #{end}
WHERE 1=1
<if
test=
"start != null and end != null"
>
AND (sd.finish_time between #{start} and #{end})
</if>
<if
test=
"origin != null and origin != '' "
>
AND s.origin = #{origin}
</if>
...
...
@@ -243,7 +309,10 @@
`key` FROM sample_distribution sd
LEFT JOIN sample s ON sd.sample_id = s.id
LEFT JOIN team t ON t.id = sd.team_id
WHERE (sd.finish_time between #{start} and #{end})
WHERE 1=1
<if
test=
"start != null and end != null"
>
AND (sd.finish_time between #{start} and #{end})
</if>
<if
test=
"origins != null and origins.size()>0"
>
AND s.origin in
<foreach
collection=
"origins"
item=
"item"
open=
"("
separator=
","
close=
")"
>
...
...
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