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
d9b7542f
Commit
d9b7542f
authored
Feb 20, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计分析优化
parent
d8fc0bbe
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
327 additions
and
76 deletions
+327
-76
DataStatisticsController.java
.../cement/business/controller/DataStatisticsController.java
+13
-8
EntrustController.java
...wise/sc/cement/business/controller/EntrustController.java
+1
-1
DataStatisticsMapper.java
.../wise/sc/cement/business/mapper/DataStatisticsMapper.java
+4
-0
DataStatisticsMapper.xml
...se/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
+54
-11
EntrustMapper.xml
...a/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
+1
-1
DataStatisticsVo.java
...cn/wise/sc/cement/business/model/vo/DataStatisticsVo.java
+8
-0
EntrustVo.java
...n/java/cn/wise/sc/cement/business/model/vo/EntrustVo.java
+7
-1
SampleDistributionTeamVo.java
...sc/cement/business/model/vo/SampleDistributionTeamVo.java
+3
-0
IDataStatisticsService.java
...se/sc/cement/business/service/IDataStatisticsService.java
+1
-1
DataStatisticsServiceImpl.java
...ment/business/service/impl/DataStatisticsServiceImpl.java
+166
-28
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+31
-15
DataStatisticsMapper.xml
...n/wise/sc/cement/business/mapper/DataStatisticsMapper.xml
+38
-10
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/DataStatisticsController.java
View file @
d9b7542f
...
...
@@ -70,7 +70,7 @@ public class DataStatisticsController {
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"统计概览-
项目
进展统计"
)
@ApiOperation
(
value
=
"统计概览-
委托单
进展统计"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"cycle"
,
value
=
"统计周期1:本周 2:本月 3:本年"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"startDate"
,
value
=
"开始日期"
,
paramType
=
"query"
,
dataType
=
"String"
),
...
...
@@ -81,29 +81,34 @@ public class DataStatisticsController {
try
{
return
dataStatisticsService
.
countEntrustStatus
(
cycle
,
startDate
,
endDate
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"统计概览-
项目
进展统计{}"
,
e
);
log
.
debug
(
"统计概览-
委托单
进展统计{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"
项目
进展统计-列表"
)
@ApiOperation
(
value
=
"
委托单
进展统计-列表"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"type"
,
value
=
"类型1:按时间 2:按地区"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"cycle"
,
value
=
"统计周期1:本周 2:本月 3:本年"
,
paramType
=
"query"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
name
=
"startDate"
,
value
=
"开始日期"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"endDate"
,
value
=
"结束日期"
,
paramType
=
"query"
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"endDate"
,
value
=
"结束日期"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"clientName"
,
value
=
"委托单位名称"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@GetMapping
(
"/countEntrustPage"
)
public
BaseResponse
countEntrustPage
(
PageQuery
pageQuery
)
{
public
BaseResponse
countEntrustPage
(
PageQuery
pageQuery
,
Integer
cycle
,
String
startDate
,
String
endDate
,
String
clientName
)
{
try
{
return
dataStatisticsService
.
countEntrustPage
(
pageQuery
);
return
dataStatisticsService
.
countEntrustPage
(
pageQuery
,
cycle
,
startDate
,
endDate
,
clientName
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"
项目
进展统计-列表{}"
,
e
);
log
.
debug
(
"
委托单
进展统计-列表{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
//todo 委托单进展统计-列表导出
@ApiOperation
(
value
=
"统计概览-进行中任务数量统计"
)
@GetMapping
(
"/countTaskIng"
)
public
BaseResponse
countTaskIng
(
PageQuery
pageQuery
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/EntrustController.java
View file @
d9b7542f
...
...
@@ -389,7 +389,7 @@ public class EntrustController {
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"详情-检测任务信息"
)
@ApiOperation
(
value
=
"详情-检测任务信息
(检测结果)
"
)
@GetMapping
(
"/getSampleCheckDtail/{id}"
)
public
BaseResponse
getSampleCheckDtail
(
@PathVariable
Integer
id
)
{
try
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/DataStatisticsMapper.java
View file @
d9b7542f
...
...
@@ -38,8 +38,12 @@ public interface DataStatisticsMapper {
IPage
<
DataStatisticsVo
>
countHandlePage
(
@Param
(
"page"
)
Page
page
);
Integer
countHandleWeek
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"weekType"
)
Integer
weekType
);
IPage
<
DataStatisticsVo
>
countDistributionPage
(
@Param
(
"page"
)
Page
page
);
Integer
countDistributionWeek
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"weekType"
)
Integer
weekType
);
List
<
DataStatisticsVo
>
countTeamIng
();
List
<
DataStatisticsVo
>
countTeam
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
View file @
d9b7542f
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"cn.wise.sc.cement.business.mapper.DataStatisticsMapper"
>
<select
id=
"countTeamByTime"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT DATE_FORMAT(sd.create_time,'%Y-%m') as name, count(sd.id) as value
SELECT DATE_FORMAT(sd.create_time,'%Y-%m
-%d
') as name, count(sd.id) as value
FROM sample_distribution sd
where sd.finish_time is not null
<if
test=
"params.cycle == 1 "
>
...
...
@@ -21,9 +21,14 @@
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
<if
test=
"params.endDate = null and params.endDate = null"
>
and date(sd.create_time) > date_sub(curdate(),interval 30 day)
</if>
group by name
</select>
<select
id=
"countTeamByOrigin"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT s.origin as name, count(sd.id) as value
FROM sample_distribution sd
...
...
@@ -60,6 +65,7 @@
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
ELSE ''
END
) as name,
...
...
@@ -107,7 +113,7 @@
</select>
<select
id=
"countEntrustPage"
resultType=
"cn.wise.sc.cement.business.model.vo.EntrustVo"
>
select e.*, c.name as clientName, su.name as userName,
select e.*,
p.name as projectName, p.code as projectCode,
c.name as clientName, su.name as userName,
(
CASE e.status
WHEN 0 THEN '未评审'
...
...
@@ -127,32 +133,69 @@
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
where e.status != 0 and e.project_type is not null
<if
test=
"params.clientName != null and params.clientName != ''"
>
and c.name like concat('%', #{params.clientName}, '%')
</if>
order by create_time desc
</select>
<select
id=
"countHandlePage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT su.name as name, count(*) as value FROM sample_handle sh
SELECT su.
id as id, su.
name as name, count(*) as value FROM sample_handle sh
left join sys_user su on su.id = sh.user_id
where sh.status != 2
where sh.status = 1 or sh.status = 5
group by sh.user_id
</select>
<select
id=
"countHandleWeek"
resultType=
"integer"
>
SELECT count(*)
FROM sample_handle sh
left join sys_user su on su.id = sh.user_id
where (sh.status =2 or sh.status =4)
<if
test=
"userId != null "
>
and sh.user_id = #{userId}
</if>
<if
test=
"weekType == 1 "
>
and YEARWEEK(date_format(sh.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())-1
</if>
<if
test=
"weekType == 2 "
>
and YEARWEEK(date_format(sh.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
group by sh.user_id
</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
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
where sd.status
!= 2
where sd.status
= 1 or sd.status = 5
group by sd.team_id
</select>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
View file @
d9b7542f
...
...
@@ -439,6 +439,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,
e.project_type as projectType, t.remark as opinion,
e.status,
(
CASE e.status
...
...
@@ -492,7 +493,6 @@
<if
test=
"params.isUrgent != null"
>
and e.is_urgent = #{params.isUrgent}
</if>
GROUP BY e.id
order by e.update_time desc
</select>
</mapper>
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/DataStatisticsVo.java
View file @
d9b7542f
...
...
@@ -13,10 +13,18 @@ import lombok.Data;
@ApiModel
(
"数据统计-展示类"
)
public
class
DataStatisticsVo
{
@ApiModelProperty
(
"id标识"
)
private
Integer
id
;
@ApiModelProperty
(
"名称"
)
private
String
name
;
@ApiModelProperty
(
"值"
)
private
String
value
;
@ApiModelProperty
(
"周涨幅"
)
private
String
weekUp
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/EntrustVo.java
View file @
d9b7542f
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -123,7 +124,7 @@ public class EntrustVo {
@ApiModelProperty
(
"任务接受时间"
)
private
LocalDateTime
acceptTime
;
@ApiModelProperty
(
"评审意见"
)
@ApiModelProperty
(
"评审意见
/退回原因
"
)
private
String
opinion
;
@ApiModelProperty
(
"文件名"
)
...
...
@@ -136,6 +137,11 @@ public class EntrustVo {
private
String
enclosureUrl
;
@ApiModelProperty
(
"产值(所有样品产值)"
)
private
BigDecimal
outputValue
;
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/SampleDistributionTeamVo.java
View file @
d9b7542f
...
...
@@ -37,6 +37,9 @@ public class SampleDistributionTeamVo {
@ApiModelProperty
(
" 状态值(0未接受,1接受,2待校核,3退回,4校核通过,5校核退回)"
)
private
String
statusValue
;
@ApiModelProperty
(
"最终结果"
)
private
String
lastResult
;
@ApiModelProperty
(
"检测设备列表"
)
List
<
SampleDistributionEquipmentVo
>
sampleDistributionEquipmentList
;
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/IDataStatisticsService.java
View file @
d9b7542f
...
...
@@ -34,7 +34,7 @@ public interface IDataStatisticsService {
BaseResponse
<
Map
<
String
,
Object
>>
countEntrustStatus
(
Integer
cycle
,
String
startDate
,
String
endDate
);
BaseResponse
<
IPage
<
EntrustVo
>>
countEntrustPage
(
PageQuery
pageQuery
);
BaseResponse
<
IPage
<
EntrustVo
>>
countEntrustPage
(
PageQuery
pageQuery
,
Integer
cycle
,
String
startDate
,
String
endDate
,
String
clientName
);
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/DataStatisticsServiceImpl.java
View file @
d9b7542f
...
...
@@ -14,6 +14,7 @@ import cn.wise.sc.cement.business.util.ExcelUtil;
import
cn.wise.sc.cement.business.util.RedisUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
...
...
@@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.text.NumberFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
...
...
@@ -62,11 +64,13 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
@Autowired
private
IEntrustService
entrustService
;
@Autowired
private
CommonServiceImpl
commonService
;
@Autowired
private
ISampleHandleService
sampleHandleService
;
@Autowired
private
ISampleDistributionService
sampleDistributionService
;
@Resource
private
TeamMapper
teamMapper
;
@Resource
private
SampleMapper
sampleMapper
;
/**
...
...
@@ -111,9 +115,7 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
@Override
public
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamByTime
(
Integer
cycle
,
String
startDate
,
String
endDate
){
Map
<
String
,
String
>
dateMap
=
new
HashMap
<>();
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM"
);
/* SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
if(startDate != null || endDate != null){
List<String> dateList = commonService.getMonthBetween(startDate, endDate);
if(dateList != null && dateList.size()>0){
...
...
@@ -133,7 +135,7 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
dateMap.put(dateTime,"0");
calendar.add(Calendar.MONTH, -1);
}
}
}
*/
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"cycle"
,
cycle
);
...
...
@@ -156,22 +158,6 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
return
BaseResponse
.
okData
(
listResult
);
}
/**
* 检测项统计-列表
* @param cycle
* @param startDate
* @param endDate
* @return
*/
/*public BaseResponse<List<Object>> countTeamByTime(Integer cycle, String startDate, String endDate){
}*/
...
...
@@ -193,7 +179,7 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
}
/**
*
项目
进展统计
*
委托单
进展统计
* @return
*/
@Override
...
...
@@ -220,18 +206,83 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
return
BaseResponse
.
okData
(
map
);
}
/**
*
项目
进展统计-列表
*
委托单
进展统计-列表
* @param pageQuery
* @return
*/
@Override
public
BaseResponse
<
IPage
<
EntrustVo
>>
countEntrustPage
(
PageQuery
pageQuery
){
public
BaseResponse
<
IPage
<
EntrustVo
>>
countEntrustPage
(
PageQuery
pageQuery
,
Integer
cycle
,
String
startDate
,
String
endDate
,
String
clientName
){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"cycle"
,
cycle
);
params
.
put
(
"startDate"
,
startDate
);
params
.
put
(
"endDate"
,
endDate
);
params
.
put
(
"clientName"
,
clientName
);
Page
<
EntrustVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
EntrustVo
>
pages
=
dataStatisticsMapper
.
countEntrustPage
(
page
);
List
<
EntrustVo
>
list
=
pages
.
getRecords
();
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
EntrustVo
entrustVo
:
list
)
{
//只统计主样的信息
List
<
Sample
>
sampleList
=
sampleMapper
.
getSampleList
(
entrustVo
.
getId
());
//检测项目名称
List
<
Integer
>
teamIdList
=
new
ArrayList
<>();
Map
<
String
,
Integer
>
teamMap
=
new
HashMap
<>();
//所有样品主样的产值
BigDecimal
outputValue
=
new
BigDecimal
(
"0.00"
);
if
(
sampleList
!=
null
&&
sampleList
.
size
()
>
0
)
{
//样品名称 列表中的拼接
for
(
Sample
sample
:
sampleList
)
{
if
(
sample
.
getOutputValue
()
!=
null
){
outputValue
=
outputValue
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
sample
.
getOutputValue
()
:
(
outputValue
.
add
(
sample
.
getOutputValue
()));
}
String
teamIds
=
sample
.
getTeamIds
();
String
checkTeam
=
""
;
if
(
teamIds
!=
null
)
{
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
for
(
String
teamId
:
teamIdS
)
{
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
)
{
if
(!
teamIdList
.
contains
(
team
.
getId
())){
teamMap
.
put
(
team
.
getName
(),
1
);
teamIdList
.
add
(
team
.
getId
());
}
else
{
teamMap
.
put
(
team
.
getName
(),
teamMap
.
get
(
team
.
getName
())+
1
);
}
checkTeam
=
checkTeam
.
equals
(
""
)
?
team
.
getName
()
:
(
checkTeam
+
"、"
+
team
.
getName
());
}
}
}
}
}
JSONArray
checkElementArray
=
mapToJSONArray
(
teamMap
);
String
teamString
=
JSON
.
toJSON
(
checkElementArray
).
toString
();
entrustVo
.
setCheckTeam
(
teamString
);
entrustVo
.
setOutputValue
(
outputValue
);
}
}
return
BaseResponse
.
okData
(
pages
);
}
//Map转json数组
public
JSONArray
mapToJSONArray
(
Map
<
String
,
Integer
>
map
){
JSONArray
jsonArray
=
new
JSONArray
();
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
()){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"name"
,
entry
.
getKey
());
jsonObject
.
put
(
"value"
,
entry
.
getValue
());
jsonArray
.
add
(
jsonObject
);
}
return
jsonArray
;
}
/**
...
...
@@ -241,21 +292,108 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
@Override
public
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//样品处理任务数量
QueryWrapper
<
SampleHandle
>
handleQw
=
new
QueryWrapper
<>();
handleQw
.
eq
(
"status"
,
0
).
or
().
eq
(
"status"
,
1
);
Integer
handle_counts
=
sampleHandleService
.
count
(
handleQw
);
map
.
put
(
"handleCounts"
,
handle_counts
);
//样品检测任务数量
QueryWrapper
<
SampleDistribution
>
distributionQw
=
new
QueryWrapper
<>();
distributionQw
.
eq
(
"status"
,
0
).
or
().
eq
(
"status"
,
1
);
Integer
distribution_counts
=
sampleDistributionService
.
count
(
distributionQw
);
map
.
put
(
"distributionCounts"
,
distribution_counts
);
Page
<
EntrustVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
DataStatisticsVo
>
pagesHandle
=
dataStatisticsMapper
.
countHandlePage
(
page
);
//样品处理按人分组统计任务数量
Page
<
EntrustVo
>
pageHan
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
DataStatisticsVo
>
pagesHandle
=
dataStatisticsMapper
.
countHandlePage
(
pageHan
);
List
<
DataStatisticsVo
>
listHandle
=
pagesHandle
.
getRecords
();
List
<
DataStatisticsVo
>
handleList
=
new
ArrayList
<>();
if
(
listHandle
!=
null
&&
listHandle
.
size
()
>
0
)
{
for
(
DataStatisticsVo
dataStatisticsVo
:
listHandle
)
{
//weekType 1上周数据 2本周数据
Integer
upWeekNums
=
dataStatisticsMapper
.
countHandleWeek
(
dataStatisticsVo
.
getId
(),
1
);
upWeekNums
=
upWeekNums
==
null
?
0
:
upWeekNums
;
Integer
thisweekNums
=
dataStatisticsMapper
.
countHandleWeek
(
dataStatisticsVo
.
getId
(),
2
);
thisweekNums
=
thisweekNums
==
null
?
0
:
thisweekNums
;
// 创建一个数值格式化对象 ↑↓
NumberFormat
numberFormat
=
NumberFormat
.
getInstance
();
// 设置精确到小数点后2位
numberFormat
.
setMaximumFractionDigits
(
2
);
String
resultNum
=
""
;
if
(
thisweekNums
>
upWeekNums
){
if
(
upWeekNums
==
0
){
resultNum
=
"100%↑"
;
}
else
{
Integer
errorNums
=
thisweekNums
-
upWeekNums
;
resultNum
=
numberFormat
.
format
((
float
)
errorNums
/(
float
)
thisweekNums
*
100
)
+
"%↑"
;
}
}
else
if
(
upWeekNums
>
thisweekNums
){
if
(
thisweekNums
==
0
){
resultNum
=
"100%↓"
;
}
else
{
Integer
errorNums
=
upWeekNums
-
thisweekNums
;
resultNum
=
numberFormat
.
format
((
float
)
errorNums
/(
float
)
upWeekNums
*
100
)
+
"%↓"
;
}
}
else
if
(
thisweekNums
==
thisweekNums
){
resultNum
=
"0%"
;
}
dataStatisticsVo
.
setWeekUp
(
resultNum
);
handleList
.
add
(
dataStatisticsVo
);
}
}
pagesHandle
.
setRecords
(
handleList
);
map
.
put
(
"pagesHandle"
,
pagesHandle
);
IPage
<
DataStatisticsVo
>
pagesDistribution
=
dataStatisticsMapper
.
countDistributionPage
(
page
);
//样品检测按人分组统计任务数量
Page
<
EntrustVo
>
pageDis
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
DataStatisticsVo
>
pagesDistribution
=
dataStatisticsMapper
.
countDistributionPage
(
pageDis
);
List
<
DataStatisticsVo
>
listDistribution
=
pagesDistribution
.
getRecords
();
List
<
DataStatisticsVo
>
distributionList
=
new
ArrayList
<>();
if
(
listDistribution
!=
null
&&
listDistribution
.
size
()
>
0
)
{
for
(
DataStatisticsVo
dataStatisticsVo
:
listDistribution
)
{
//weekType 1上周数据 2本周数据
Integer
upWeekNums
=
dataStatisticsMapper
.
countDistributionWeek
(
dataStatisticsVo
.
getId
(),
1
);
upWeekNums
=
upWeekNums
==
null
?
0
:
upWeekNums
;
Integer
thisweekNums
=
dataStatisticsMapper
.
countDistributionWeek
(
dataStatisticsVo
.
getId
(),
2
);
thisweekNums
=
thisweekNums
==
null
?
0
:
thisweekNums
;
// 创建一个数值格式化对象 ↑↓
NumberFormat
numberFormat
=
NumberFormat
.
getInstance
();
// 设置精确到小数点后2位
numberFormat
.
setMaximumFractionDigits
(
2
);
String
resultNum
=
""
;
if
(
thisweekNums
>
upWeekNums
){
if
(
upWeekNums
==
0
){
resultNum
=
"100%↑"
;
}
else
{
Integer
errorNums
=
thisweekNums
-
upWeekNums
;
resultNum
=
numberFormat
.
format
((
float
)
errorNums
/(
float
)
thisweekNums
*
100
)
+
"%↑"
;
}
}
else
if
(
upWeekNums
>
thisweekNums
){
if
(
thisweekNums
==
0
){
resultNum
=
"100%↓"
;
}
else
{
Integer
errorNums
=
upWeekNums
-
thisweekNums
;
resultNum
=
numberFormat
.
format
((
float
)
errorNums
/(
float
)
upWeekNums
*
100
)
+
"%↓"
;
}
}
else
if
(
thisweekNums
==
thisweekNums
){
resultNum
=
"0%"
;
}
dataStatisticsVo
.
setWeekUp
(
resultNum
);
distributionList
.
add
(
dataStatisticsVo
);
}
}
pagesDistribution
.
setRecords
(
distributionList
);
map
.
put
(
"pagesDistribution"
,
pagesDistribution
);
return
BaseResponse
.
okData
(
map
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
d9b7542f
...
...
@@ -298,18 +298,18 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
BeanUtils
.
copyProperties
(
sampleTmpQuery
,
sampleTmp
);
String
teamIds
=
sampleTmpQuery
.
getTeamIds
();
//选择的检测项id集合
BigDecimal
charge
=
new
BigDecimal
(
"0.00"
);
if
(
teamIds
!=
null
)
{
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
List
<
String
>
teamNameList
=
new
ArrayList
<>();
for
(
String
teamId
:
teamIdS
)
{
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
)
{
if
(!
teamNameList
.
contains
(
teamId
)){
charge
=
charge
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
team
.
getCharge
()
:
(
charge
.
add
(
team
.
getCharge
()));
teamNameList
.
add
(
team
.
getName
());
if
(
teamIds
!=
null
)
{
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
List
<
String
>
teamNameList
=
new
ArrayList
<>();
for
(
String
teamId
:
teamIdS
)
{
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
)
{
if
(!
teamNameList
.
contains
(
teamId
)){
charge
=
charge
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
team
.
getCharge
()
:
(
charge
.
add
(
team
.
getCharge
()));
teamNameList
.
add
(
team
.
getName
());
}
}
}
}
//选择Mg必须选择Ca;选择Al必须选择Fe
if
(
teamNameList
.
contains
(
"MgO"
)){
if
(!
teamNameList
.
contains
(
"CaO"
)){
...
...
@@ -558,6 +558,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
else
if
(
approvalIdList
.
contains
(
loginUser
.
getId
())){
//如果是评审人员修改
SysUser
createUser
=
userService
.
getById
(
entrust
.
getUserId
());
if
(
createUser
==
null
){
return
BaseResponse
.
errorMsg
(
"委托人信息错误"
);
...
...
@@ -1060,7 +1061,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
entrust
==
null
)
{
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
List
<
Sample
>
sampleList
=
sampleMapper
.
getSampleCheckList
(
id
);
//只看主样 对应的最终结果值
List
<
Sample
>
sampleList
=
sampleMapper
.
getCheckSampleList
(
id
);
List
<
SampleVo
>
sampleVoList
=
new
ArrayList
<>();
if
(
sampleList
!=
null
&&
sampleList
.
size
()
>
0
)
{
...
...
@@ -1069,12 +1071,21 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
BeanUtils
.
copyProperties
(
sample
,
sampleVo
);
List
<
SampleDistributionTeamVo
>
sampleDistributionTeamVoList
=
distributionMapper
.
getDistributionTeamList
(
sample
.
getId
(),
null
);
if
(
sampleDistributionTeamVoList
!=
null
&&
sampleDistributionTeamVoList
.
size
()
>
0
)
{
//已经派发过的列表
List
<
SampleTeamGroupVo
>
sampleTeamGroupVoListed
=
new
ArrayList
<>();
List
<
Integer
>
teamGroupIdList
=
new
ArrayList
<>();
for
(
SampleDistributionTeamVo
sampleDistributionTeamVo
:
sampleDistributionTeamVoList
){
SampleDistribution
sampleDistribution
=
distributionMapper
.
selectById
(
sampleDistributionTeamVo
.
getDistributionId
());
//该检测项的误差结果值和最终结果值
if
(
sampleDistribution
.
getCheckId
()
!=
null
){
SampleDistributionCheck
disCheck
=
sampleDistributionCheckMapper
.
selectById
(
sampleDistribution
.
getCheckId
());
sampleDistributionTeamVo
.
setLastResult
(
disCheck
.
getLastResult
());
}
else
{
sampleDistributionTeamVo
.
setLastResult
(
sampleDistribution
.
getDistributionResult
());
}
TeamGroup
teamGroup
=
teamGroupMapper
.
selectById
(
sampleDistribution
.
getTeamGroupId
());
if
(!
teamGroupIdList
.
contains
(
sampleDistribution
.
getTeamGroupId
())){
teamGroupIdList
.
add
(
sampleDistribution
.
getTeamGroupId
());
...
...
@@ -1514,6 +1525,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setIsHandle
(
0
)
//样品处理未完成状态
.
setIsDistribution
(
0
)
//任务派发未完成状态
.
setIsCheck
(
0
)
//样品校核未完成状态
.
setOutputValue
(
sample
.
getCharge
())
//产值不用评审人员修改
.
setParallelCode
(
maxCementCode
);
sampleList
.
add
(
sample
);
}
...
...
@@ -2069,7 +2081,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List
<
Integer
>
userIdList
=
new
ArrayList
<>();
if
(
query
.
getSampleDistributionQueryList
()
!=
null
&&
query
.
getSampleDistributionQueryList
().
size
()
>
0
)
{
List
<
SampleDistributionQuery
>
sampleDistributionQueryList
=
query
.
getSampleDistributionQueryList
();
List
<
SampleDistribution
>
sampleDistributionList
=
new
ArrayList
<>();
//
List<SampleDistribution> sampleDistributionList = new ArrayList<>();
//判断改委托单的所有样品检测项对应的处理项对应的处理人,然后按照检测项存入检测项表,以便校核的时候可以校核结果
//只显示主样,因为样品处理只显示主样
...
...
@@ -2104,7 +2116,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setStatus
(
2
)
//直接进入待校核状态
.
setAcceptTime
(
sampleHandle
.
getAcceptTime
())
.
setFinishTime
(
sampleHandle
.
getFinishTime
());
sampleDistributionList
.
add
(
sampleDistribution
);
distributionService
.
save
(
sampleDistribution
);
// sampleDistributionList.add(sampleDistribution);
//将样品处理的附件复制到样品检测的附件表中 如果校核附件有重复,可以去掉这个逻辑
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -2167,7 +2180,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setCreateTime
(
LocalDateTime
.
now
())
.
setStatus
(
1
)
//直接接收检测任务
.
setAcceptTime
(
LocalDateTime
.
now
());
sampleDistributionList
.
add
(
sampleDistribution
);
distributionService
.
save
(
sampleDistribution
);
// sampleDistributionList.add(sampleDistribution);
//获取产值信息
QueryWrapper
<
NormProduction
>
queryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -2201,7 +2215,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
sample
.
setStatus
(
1
);
//样品状态改成已领用状态
sampleList
.
add
(
sample
);
}
distributionService
.
saveBatch
(
sampleDistributionList
);
// distributionService.saveBatch(sampleDistributionList);
sampleService
.
updateBatchById
(
sampleList
);
}
entrust
.
setStatus
(
5
).
setIsDistribution
(
1
);
...
...
cement-business/target/classes/cn/wise/sc/cement/business/mapper/DataStatisticsMapper.xml
View file @
d9b7542f
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"cn.wise.sc.cement.business.mapper.DataStatisticsMapper"
>
<select
id=
"countTeamByTime"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT DATE_FORMAT(sd.create_time,'%Y-%m') as name, count(sd.id) as value
SELECT DATE_FORMAT(sd.create_time,'%Y-%m
-%d
') as name, count(sd.id) as value
FROM sample_distribution sd
where sd.finish_time is not null
<if
test=
"params.cycle == 1 "
>
...
...
@@ -21,9 +21,14 @@
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
<if
test=
"params.endDate = null and params.endDate = null"
>
and date(sd.create_time) > date_sub(curdate(),interval 30 day)
</if>
group by name
</select>
<select
id=
"countTeamByOrigin"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT s.origin as name, count(sd.id) as value
FROM sample_distribution sd
...
...
@@ -60,6 +65,7 @@
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
WHEN 9 THEN '修改待确认'
ELSE ''
END
) as name,
...
...
@@ -107,7 +113,7 @@
</select>
<select
id=
"countEntrustPage"
resultType=
"cn.wise.sc.cement.business.model.vo.EntrustVo"
>
select e.*, c.name as clientName, su.name as userName,
select e.*,
p.name as projectName, p.code as projectCode,
c.name as clientName, su.name as userName,
(
CASE e.status
WHEN 0 THEN '未评审'
...
...
@@ -127,32 +133,54 @@
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
where e.status != 0 and e.project_type is not null
<if
test=
"params.clientName != null and params.clientName != ''"
>
and c.name like concat('%', #{params.clientName}, '%')
</if>
order by create_time desc
</select>
<select
id=
"countHandlePage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT su.name as name, count(*) as value FROM sample_handle sh
SELECT su.
id as id, su.
name as name, count(*) as value FROM sample_handle sh
left join sys_user su on su.id = sh.user_id
where sh.status
!= 2
where sh.status
= 1 or sh.status = 5
group by sh.user_id
</select>
<select
id=
"countHandleWeek"
resultType=
"integer"
>
SELECT count(*)
FROM sample_handle sh
left join sys_user su on su.id = sh.user_id
where (sh.status =2 or sh.status =4)
<if
test=
"userId != null "
>
and sh.user_id = #{userId}
</if>
<if
test=
"weekType == 1 "
>
and YEARWEEK(date_format(sh.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())-1
</if>
<if
test=
"weekType == 2 "
>
and YEARWEEK(date_format(sh.create_time,'%Y-%m-%d' ) ) = YEARWEEK(now())
</if>
group by sh.user_id
</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
left join sys_user su on su.id = sd.user_id
where sd.status
!= 2
where sd.status
= 1 or sd.status = 5
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
where sd.status
!= 2
where sd.status
= 1 or sd.status = 5
group by sd.team_id
</select>
...
...
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