Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
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
王飞
vehicle-quality-review
Commits
8f3c0eda
Commit
8f3c0eda
authored
Mar 06, 2024
by
王飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'dev'
数据统计&编辑任务&暂存任务 See merge request
!128
parents
507c2f6f
345071b8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
524 additions
and
213 deletions
+524
-213
DataStatisticsUtils.java
...w/src/main/java/com/ruoyi/common/DataStatisticsUtils.java
+158
-0
TaskService.java
...y-review/src/main/java/com/ruoyi/service/TaskService.java
+5
-0
StrategyCarReviewTaskPending.java
.../com/ruoyi/service/impl/StrategyCarReviewTaskPending.java
+6
-89
StrategySystemReviewTaskPending.java
...m/ruoyi/service/impl/StrategySystemReviewTaskPending.java
+5
-86
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+228
-38
TaskController.java
...ty-review/src/main/java/com/ruoyi/web/TaskController.java
+21
-0
DataStatisticsResponse.java
...n/java/com/ruoyi/web/response/DataStatisticsResponse.java
+101
-0
No files found.
quality-review/src/main/java/com/ruoyi/common/DataStatisticsUtils.java
0 → 100644
View file @
8f3c0eda
package
com
.
ruoyi
.
common
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.mapper.TaskMapper
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
DataStatisticsUtils
{
public
static
int
calculateStandards
(
List
<
ReviewStandard
>
standards
)
{
return
standards
.
size
();
}
public
static
int
calculateStandardsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
int
standardsPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
boolean
isPass
=
true
;
for
(
ReviewDetails
reviewDetails
:
details
)
{
Integer
passed
=
detailsIsPass
(
reviewDetails
,
resultMap
);
if
(
passed
==
null
)
{
isPass
=
false
;
}
if
(
passed
==
ReviewStandard
.
NO_PASSED
)
{
isPass
=
false
;
}
}
if
(
isPass
)
{
standardsPass
=
standardsPass
+
1
;
}
}
return
standardsPass
;
}
public
static
int
calculateStandardsNoPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
int
standardsNoPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
boolean
isPass
=
true
;
for
(
ReviewDetails
reviewDetails
:
details
)
{
Integer
passed
=
detailsIsPass
(
reviewDetails
,
resultMap
);
if
(
passed
==
null
)
{
isPass
=
false
;
}
if
(
passed
==
ReviewStandard
.
PASSED
)
{
isPass
=
false
;
}
}
if
(
isPass
)
{
standardsNoPass
=
standardsNoPass
+
1
;
}
}
return
standardsNoPass
;
}
public
static
int
calculateDetails
(
List
<
ReviewStandard
>
standards
)
{
//审查细则(条)
int
detailsNum
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
detailsNum
=
detailsNum
+
details
.
size
();
}
return
detailsNum
;
}
public
static
int
calculateDetailsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
int
detailsPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(
detailsIsPass
(
reviewDetails
,
resultMap
)
==
null
)
{
continue
;
}
if
(
detailsIsPass
(
reviewDetails
,
resultMap
)
==
ReviewStandard
.
PASSED
)
{
detailsPass
=
detailsPass
+
1
;
}
}
}
return
detailsPass
;
}
public
static
int
calculateDetailsNoPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
int
detailsNoPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(
detailsIsPass
(
reviewDetails
,
resultMap
)
==
ReviewStandard
.
NO_PASSED
)
{
detailsNoPass
=
detailsNoPass
+
1
;
}
}
}
return
detailsNoPass
;
}
public
static
List
<
ReviewDetails
>
getDetailsByStandard
(
ReviewStandard
standard
)
{
List
<
ReviewDetails
>
details
=
new
ArrayList
();
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keyPoint
:
keyPointList
)
{
details
.
addAll
(
keyPoint
.
getReviewDetailsList
());
}
return
details
;
}
public
static
Integer
detailsIsPass
(
ReviewDetails
reviewDetails
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
ReviewDetailsResult
result
=
resultMap
.
get
(
reviewDetails
.
getId
());
if
(
result
==
null
)
{
return
null
;
}
return
result
.
getPassed
();
}
}
quality-review/src/main/java/com/ruoyi/service/TaskService.java
View file @
8f3c0eda
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.web.request.*
;
import
com.ruoyi.web.response.DataStatisticsResponse
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
com.ruoyi.web.response.TaskGetInfoResponse
;
...
...
@@ -57,7 +58,11 @@ public interface TaskService extends IService<Task> {
void
temporaryStorageTask
(
TaskCreateRequest
request
);
void
editTemporaryStorageTask
(
TaskEditRequest
request
);
TaskGetInfoResponse
getByUserId
(
Long
userId
);
TaskGetInfoResponse
getBySubtaskId
(
TaskSubGetInfoRequest
request
);
DataStatisticsResponse
dataStatistics
(
TaskGetInfoRequest
request
);
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategyCarReviewTaskPending.java
View file @
8f3c0eda
package
com
.
ruoyi
.
service
.
impl
;
import
com.
baomidou.mybatisplus.annotation.TableField
;
import
com.
ruoyi.common.DataStatisticsUtils
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.mapper.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.web.response.CarReviewTaskViewResponse
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
...
...
@@ -21,6 +18,8 @@ import java.util.*;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
static
com
.
ruoyi
.
common
.
DataStatisticsUtils
.
calculateStandardsPass
;
@Transactional
@Service
public
class
StrategyCarReviewTaskPending
implements
StrategyCarReviewTask
,
InitializingBean
{
...
...
@@ -190,98 +189,16 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List
<
TaskUserRelation
>
relationList
=
taskUserRelationMapper
.
selectQTeamMembers
(
taskMapper
.
findByCarReviewTaskId
(
carReviewTask
.
getId
()));
carReviewTask
.
setStandards
(
calculateStandards
(
standards
));
carReviewTask
.
setStandards
(
DataStatisticsUtils
.
calculateStandards
(
standards
));
BigDecimal
standardPass
=
new
BigDecimal
(
calculateStandardsPass
(
standards
,
resultMap
)
/
(
double
)
carReviewTask
.
getStandards
());
carReviewTask
.
setStandardsPass
(
standardPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
carReviewTask
.
setDetails
(
calculateDetails
(
standards
));
BigDecimal
detailsPass
=
new
BigDecimal
(
calculateDetailsPass
(
standards
,
resultMap
)
/
(
double
)
carReviewTask
.
getDetails
());
carReviewTask
.
setDetails
(
DataStatisticsUtils
.
calculateDetails
(
standards
));
BigDecimal
detailsPass
=
new
BigDecimal
(
DataStatisticsUtils
.
calculateDetailsPass
(
standards
,
resultMap
)
/
(
double
)
carReviewTask
.
getDetails
());
carReviewTask
.
setDetailsPass
(
detailsPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
carReviewTask
.
setPerson
(
relationList
.
size
());
}
private
int
calculateStandards
(
List
<
ReviewStandard
>
standards
)
{
return
standards
.
size
();
}
private
long
calculateStandardsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
long
standardsPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
boolean
isPass
=
true
;
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(!
detailsIsPass
(
reviewDetails
,
resultMap
))
{
isPass
=
false
;
}
}
if
(
isPass
)
{
standardsPass
=
standardsPass
+
1
;
}
}
return
standardsPass
;
}
private
int
calculateDetails
(
List
<
ReviewStandard
>
standards
)
{
//审查细则(条)
int
detailsNum
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
detailsNum
=
detailsNum
+
details
.
size
();
}
return
detailsNum
;
}
private
long
calculateDetailsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
long
detailsPass
=
0L
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(
detailsIsPass
(
reviewDetails
,
resultMap
))
{
detailsPass
=
detailsPass
+
1
;
}
}
}
return
detailsPass
;
}
private
List
<
ReviewDetails
>
getDetailsByStandard
(
ReviewStandard
standard
)
{
List
<
ReviewDetails
>
details
=
new
ArrayList
();
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keyPoint
:
keyPointList
)
{
details
.
addAll
(
keyPoint
.
getReviewDetailsList
());
}
return
details
;
}
private
boolean
detailsIsPass
(
ReviewDetails
reviewDetails
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
ReviewDetailsResult
result
=
resultMap
.
get
(
reviewDetails
.
getId
());
if
(
result
!=
null
)
{
return
Objects
.
equals
(
result
.
getPassed
(),
ReviewStandard
.
PASSED
);
}
else
{
return
false
;
}
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskPending.java
View file @
8f3c0eda
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.common.DataStatisticsUtils
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.exception.ServiceException
;
...
...
@@ -185,97 +186,15 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List
<
TaskUserRelation
>
relationList
=
taskUserRelationMapper
.
selectQTeamMembers
(
taskMapper
.
findBySystemReviewTaskId
(
systemReviewTask
.
getId
()));
systemReviewTask
.
setStandards
(
calculateStandards
(
standards
));
BigDecimal
standardPass
=
new
BigDecimal
(
calculateStandardsPass
(
standards
,
resultMap
)
/
(
double
)
systemReviewTask
.
getStandards
());
systemReviewTask
.
setStandards
(
DataStatisticsUtils
.
calculateStandards
(
standards
));
BigDecimal
standardPass
=
new
BigDecimal
(
DataStatisticsUtils
.
calculateStandardsPass
(
standards
,
resultMap
)
/
(
double
)
systemReviewTask
.
getStandards
());
systemReviewTask
.
setStandardsPass
(
standardPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
systemReviewTask
.
setDetails
(
calculateDetails
(
standards
));
BigDecimal
detailsPass
=
new
BigDecimal
(
calculateDetailsPass
(
standards
,
resultMap
)
/
(
double
)
systemReviewTask
.
getDetails
());
systemReviewTask
.
setDetails
(
DataStatisticsUtils
.
calculateDetails
(
standards
));
BigDecimal
detailsPass
=
new
BigDecimal
(
DataStatisticsUtils
.
calculateDetailsPass
(
standards
,
resultMap
)
/
(
double
)
systemReviewTask
.
getDetails
());
systemReviewTask
.
setDetailsPass
(
detailsPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
systemReviewTask
.
setPerson
(
relationList
.
size
());
}
private
int
calculateStandards
(
List
<
ReviewStandard
>
standards
)
{
return
standards
.
size
();
}
private
long
calculateStandardsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
long
standardsPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
boolean
isPass
=
true
;
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(!
detailsIsPass
(
reviewDetails
,
resultMap
))
{
isPass
=
false
;
}
}
if
(
isPass
)
{
standardsPass
=
standardsPass
+
1
;
}
}
return
standardsPass
;
}
private
int
calculateDetails
(
List
<
ReviewStandard
>
standards
)
{
//审查细则(条)
int
detailsNum
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
detailsNum
=
detailsNum
+
details
.
size
();
}
return
detailsNum
;
}
private
long
calculateDetailsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
long
detailsPass
=
0L
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(
detailsIsPass
(
reviewDetails
,
resultMap
))
{
detailsPass
=
detailsPass
+
1
;
}
}
}
return
detailsPass
;
}
private
List
<
ReviewDetails
>
getDetailsByStandard
(
ReviewStandard
standard
)
{
List
<
ReviewDetails
>
details
=
new
ArrayList
();
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keyPoint
:
keyPointList
)
{
details
.
addAll
(
keyPoint
.
getReviewDetailsList
());
}
return
details
;
}
private
boolean
detailsIsPass
(
ReviewDetails
reviewDetails
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
ReviewDetailsResult
result
=
resultMap
.
get
(
reviewDetails
.
getId
());
if
(
result
!=
null
)
{
return
Objects
.
equals
(
result
.
getPassed
(),
ReviewStandard
.
PASSED
);
}
else
{
return
false
;
}
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
8f3c0eda
package
com
.
ruoyi
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.DataStatisticsUtils
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.utils.SecurityUtils
;
...
...
@@ -11,19 +12,24 @@ import com.ruoyi.mapper.*;
import
com.ruoyi.service.*
;
import
com.ruoyi.system.service.ISysUserService
;
import
com.ruoyi.web.request.*
;
import
com.ruoyi.web.response.DataStatisticsResponse
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
com.ruoyi.web.response.TaskGetInfoResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Transactional
@Service
public
class
TaskServiceImpl
extends
ServiceImpl
<
TaskMapper
,
Task
>
implements
TaskService
{
public
class
TaskServiceImpl
extends
ServiceImpl
<
TaskMapper
,
Task
>
implements
TaskService
{
@Autowired
private
TaskMapper
taskMapper
;
...
...
@@ -73,6 +79,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired
private
ReviewEnterpriseArchiveService
reviewEnterpriseArchiveService
;
@Autowired
private
ReviewStandardService
reviewStandardService
;
@Autowired
private
ReviewDetailsResultService
reviewDetailsResultService
;
@Override
public
List
<
Task
>
findList
(
TaskListRequest
request
)
{
...
...
@@ -179,6 +191,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Override
public
void
editTask
(
TaskEditRequest
request
)
{
// 构建任务创建者
LoginUser
loginUser
=
SecurityUtils
.
getLoginUser
();
SysUser
initiator
=
sysUserService
.
selectUserById
(
loginUser
.
getUserId
());
Standard
standard
=
standardService
.
findListById
(
request
.
getStandardId
());
// 找到审查组长
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
...
...
@@ -198,6 +215,27 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task
.
setTaskList
(
joinTaskList
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
Task
oldTask
=
taskMapper
.
selectById
(
request
.
getId
());
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_GRFIS
)
&&
oldTask
.
getCarReviewTaskId
()
==
null
)
{
// 保存车型审查问卷任务
TaskCreateRequest
createRequest
=
new
TaskCreateRequest
();
BeanUtils
.
copyBeanProp
(
createRequest
,
request
);
task
.
setCarReviewTaskId
(
saveCarReview
(
createRequest
,
initiator
,
standard
,
leader
));
}
if
(
!
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_GRFIS
)
&&
oldTask
.
getCarReviewTaskId
()
!=
null
)
{
carReviewTaskMapper
.
deleteById
(
oldTask
.
getCarReviewTaskId
());
}
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_SRAIF
)
&&
oldTask
.
getSystemReviewTaskId
()
==
null
)
{
// 保存体系审查任务
TaskCreateRequest
createRequest
=
new
TaskCreateRequest
();
BeanUtils
.
copyBeanProp
(
createRequest
,
request
);
task
.
setSystemReviewTaskId
(
saveSystemReview
(
createRequest
,
initiator
,
standard
,
leader
));
}
if
(
!
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_SRAIF
)
&&
oldTask
.
getSystemReviewTaskId
()
!=
null
)
{
systemReviewTaskMapper
.
deleteById
(
oldTask
.
getSystemReviewTaskId
());
}
taskService
.
updateById
(
task
);
// 构建并保存该任务所关联的审核组信息
...
...
@@ -209,8 +247,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
taskUserRelationService
.
saveBatch
(
auditors
);
// 保存关联的整车样品信息
List
<
TaskSampleRelation
>
partRelationList
=
taskSampleRelationService
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
PART
_VEHICLE_SAMPLE
);
List
<
TaskSampleRelation
>
partRelationList
=
taskSampleRelationService
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
COMPLETE
_VEHICLE_SAMPLE
);
taskSampleRelationService
.
removeBatchByIds
(
partRelationList
);
List
<
TaskSampleRelation
>
relations
=
request
.
getSample
();
if
(
relations
.
size
()
!=
0
&&
relations
!=
null
)
{
for
(
TaskSampleRelation
sampleRelation
:
relations
)
{
...
...
@@ -220,9 +259,22 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
taskSampleRelationService
.
saveBatch
(
relations
);
}
// 保存关联的零部件样品信息
List
<
TaskSampleRelation
>
relationList
=
taskSampleRelationService
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
PART_VEHICLE_SAMPLE
);
taskSampleRelationService
.
removeBatchByIds
(
relationList
);
List
<
TaskSampleRelation
>
partRelations
=
request
.
getPartSample
();
if
(
partRelations
.
size
()
!=
0
&&
partRelations
!=
null
)
{
for
(
TaskSampleRelation
partSampleRelation
:
partRelations
)
{
partSampleRelation
.
setTaskId
(
task
.
getId
());
}
taskSampleRelationService
.
saveBatch
(
partRelations
);
}
// 任务样品关系
List
<
TaskSampleRelation
>
sampleRelations
=
taskSampleRelationMapper
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
COMPLETE_VEHICLE_SAMPLE
);
if
(
sampleRelations
.
size
()
!=
0
&&
sampleRelations
!=
null
)
{
// 获取之前的第一个企业名称
TaskSampleRelation
taskSampleRelation
=
sampleRelations
.
get
(
0
);
Sample
sample
=
sampleManagementMapper
.
selectSampleManagementById
(
taskSampleRelation
.
getSampleId
());
...
...
@@ -251,17 +303,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
reviewEnterpriseArchiveService
.
updateBatchById
(
reviewEnterpriseArchiveList1
);
}
// 保存关联的零部件样品信息
List
<
TaskSampleRelation
>
relationList
=
taskSampleRelationService
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
COMPLETE_VEHICLE_SAMPLE
);
taskSampleRelationService
.
removeBatchByIds
(
relationList
);
List
<
TaskSampleRelation
>
partRelations
=
request
.
getPartSample
();
if
(
partRelations
.
size
()
!=
0
&&
partRelations
!=
null
)
{
for
(
TaskSampleRelation
partSampleRelation
:
partRelations
)
{
partSampleRelation
.
setTaskId
(
task
.
getId
());
}
taskSampleRelationService
.
saveBatch
(
partRelations
);
}
}
...
...
@@ -340,17 +381,93 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
task
.
setTaskInitiator
(
initiator
.
getNickName
());
task
.
setTaskInitiatorDept
(
initiator
.
getDept
().
getDeptName
());
task
.
setTaskStatus
(
Task
.
TASK_STATUS_TEMPORARILY
);
String
joinTaskList
=
StringUtils
.
join
(
request
.
getTaskList
(),
","
);
task
.
setTaskList
(
joinTaskList
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
if
(
standard
!=
null
)
{
task
.
setName
(
standard
.
getName
());
task
.
setStandardNo
(
standard
.
getStandardNo
());
task
.
setFile
(
standard
.
getFile
());
}
// 找到审查组长
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
if
(
auditors
.
size
()
!=
0
&&
auditors
!=
null
)
{
for
(
TaskUserRelation
auditor
:
auditors
)
{
if
(
auditor
.
getIsLeader
()
==
1
)
{
leader
=
auditor
;
break
;
}
}
// 构建并保存该任务所关联的审核组信息
for
(
TaskUserRelation
auditor
:
auditors
)
{
auditor
.
setTaskId
(
task
.
getId
());
}
taskUserRelationService
.
saveBatch
(
auditors
);
// 任务组长
task
.
setLeaderId
(
leader
.
getUserId
());
task
.
setLeader
(
leader
.
getName
());
}
// 暂存
taskService
.
save
(
task
);
// 保存关联的整车样品信息
List
<
TaskSampleRelation
>
relations
=
request
.
getSample
();
if
(
relations
.
size
()
!=
0
&&
relations
!=
null
)
{
for
(
TaskSampleRelation
sampleRelation
:
relations
)
{
sampleRelation
.
setTaskId
(
task
.
getId
());
}
taskSampleRelationService
.
saveBatch
(
relations
);
}
// 保存关联的零部件样品信息
List
<
TaskSampleRelation
>
partRelations
=
request
.
getPartSample
();
if
(
partRelations
.
size
()
!=
0
&&
partRelations
!=
null
)
{
for
(
TaskSampleRelation
sampleRelation
:
partRelations
)
{
sampleRelation
.
setTaskId
(
task
.
getId
());
}
taskSampleRelationService
.
saveBatch
(
partRelations
);
}
}
@Override
public
void
editTemporaryStorageTask
(
TaskEditRequest
request
)
{
// 构建任务创建者
LoginUser
loginUser
=
SecurityUtils
.
getLoginUser
();
SysUser
initiator
=
sysUserService
.
selectUserById
(
loginUser
.
getUserId
());
Standard
standard
=
standardService
.
findListById
(
request
.
getStandardId
());
// 构建并保存任务信息
// 总任务
Task
task
=
new
Task
();
task
.
setTaskInitiatorId
(
loginUser
.
getUserId
());
task
.
setTaskInitiator
(
initiator
.
getNickName
());
task
.
setTaskInitiatorDept
(
initiator
.
getDept
().
getDeptName
());
String
joinTaskList
=
StringUtils
.
join
(
request
.
getTaskList
(),
","
);
task
.
setTaskList
(
joinTaskList
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
if
(
standard
!=
null
)
{
task
.
setName
(
standard
.
getName
());
task
.
setStandardNo
(
standard
.
getStandardNo
());
task
.
setFile
(
standard
.
getFile
());
}
// 找到审查组长
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
if
(
auditors
.
size
()
!=
0
&&
auditors
!=
null
)
{
List
<
TaskUserRelation
>
list
=
taskUserRelationService
.
selectQTeamMembers
(
request
.
getId
());
taskUserRelationService
.
removeBatchByIds
(
list
);
for
(
TaskUserRelation
auditor
:
auditors
)
{
if
(
auditor
.
getIsLeader
()
==
1
)
{
leader
=
auditor
;
...
...
@@ -371,10 +488,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
// 暂存
taskService
.
save
(
task
);
taskService
.
updateById
(
task
);
// 保存关联的整车样品信息
List
<
TaskSampleRelation
>
partRelationList
=
taskSampleRelationService
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
PART_VEHICLE_SAMPLE
);
taskSampleRelationService
.
removeBatchByIds
(
partRelationList
);
List
<
TaskSampleRelation
>
relations
=
request
.
getSample
();
if
(
relations
.
size
()
!=
0
&&
relations
!=
null
)
{
for
(
TaskSampleRelation
sampleRelation
:
relations
)
{
...
...
@@ -385,6 +504,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
// 保存关联的零部件样品信息
List
<
TaskSampleRelation
>
relationList
=
taskSampleRelationService
.
selectByTaskId
(
request
.
getId
(),
TaskSampleRelation
.
COMPLETE_VEHICLE_SAMPLE
);
taskSampleRelationService
.
removeBatchByIds
(
relationList
);
List
<
TaskSampleRelation
>
partRelations
=
request
.
getPartSample
();
if
(
partRelations
.
size
()
!=
0
&&
partRelations
!=
null
)
{
for
(
TaskSampleRelation
sampleRelation
:
partRelations
)
{
...
...
@@ -445,6 +566,75 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
}
@Override
public
DataStatisticsResponse
dataStatistics
(
TaskGetInfoRequest
request
)
{
Task
task
=
taskMapper
.
selectById
(
request
.
getId
());
SystemReviewTask
systemReviewTask
=
systemReviewTaskMapper
.
selectById
(
task
.
getSystemReviewTaskId
());
CarReviewTask
carReviewTask
=
carReviewTaskMapper
.
selectById
(
task
.
getCarReviewTaskId
());
DataStatisticsResponse
response
=
new
DataStatisticsResponse
();
// 获取最新问卷
List
<
ReviewStandard
>
standardTree
=
reviewStandardService
.
findTree
(
systemReviewTask
.
getStandardId
(),
ReviewStandard
.
TYPE_SYSTEM
);
// 获取当前问卷答案
List
<
ReviewDetailsResult
>
results
=
reviewDetailsResultService
.
findByTaskId
(
systemReviewTask
.
getId
());
// 体系审查
setSystemDataStatistics
(
standardTree
,
results
,
response
);
// 获取最新问卷
List
<
ReviewStandard
>
carStandardTree
=
reviewStandardService
.
findTree
(
carReviewTask
.
getStandardId
(),
ReviewStandard
.
TYPE_CAR
);
// 获取当前问卷答案
List
<
ReviewDetailsResult
>
carResults
=
reviewDetailsResultService
.
findByTaskId
(
carReviewTask
.
getId
());
// 车型审查
setCarDataStatistics
(
carStandardTree
,
carResults
,
response
);
return
response
;
}
private
void
setSystemDataStatistics
(
List
<
ReviewStandard
>
standards
,
List
<
ReviewDetailsResult
>
results
,
DataStatisticsResponse
response
)
{
Map
<
Long
,
ReviewDetailsResult
>
resultMap
=
results
.
stream
().
collect
(
Collectors
.
toMap
(
ReviewDetailsResult:
:
getReviewDetailsId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
response
.
setSystemStandards
(
DataStatisticsUtils
.
calculateStandards
(
standards
));
response
.
setSystemStandardsPassNum
(
DataStatisticsUtils
.
calculateStandardsPass
(
standards
,
resultMap
));
response
.
setSystemStandardsNoPassNum
(
DataStatisticsUtils
.
calculateStandardsNoPass
(
standards
,
resultMap
));
response
.
setSystemStandardsUnderNum
(
response
.
getSystemStandards
()
-
response
.
getSystemStandardsPassNum
()
-
response
.
getSystemStandardsNoPassNum
());
BigDecimal
standardPass
=
new
BigDecimal
(
response
.
getSystemStandardsPassNum
()
/
(
double
)
response
.
getSystemStandards
());
response
.
setSystemStandardsPass
(
standardPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
response
.
setSystemDetails
(
DataStatisticsUtils
.
calculateDetails
(
standards
));
response
.
setSystemDetailsPassNum
(
DataStatisticsUtils
.
calculateDetailsPass
(
standards
,
resultMap
));
response
.
setSystemDetailsNoPassNum
(
DataStatisticsUtils
.
calculateDetailsNoPass
(
standards
,
resultMap
));
response
.
setSystemDetailsUnderNum
(
response
.
getSystemDetails
()
-
response
.
getSystemDetailsPassNum
()
-
response
.
getSystemDetailsNoPassNum
());
BigDecimal
detailsPass
=
new
BigDecimal
(
response
.
getSystemDetailsPassNum
()
/
(
double
)
response
.
getSystemDetails
());
response
.
setSystemDetailsPass
(
detailsPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
}
private
void
setCarDataStatistics
(
List
<
ReviewStandard
>
standards
,
List
<
ReviewDetailsResult
>
results
,
DataStatisticsResponse
response
)
{
Map
<
Long
,
ReviewDetailsResult
>
resultMap
=
results
.
stream
().
collect
(
Collectors
.
toMap
(
ReviewDetailsResult:
:
getReviewDetailsId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
response
.
setCarStandards
(
DataStatisticsUtils
.
calculateStandards
(
standards
));
response
.
setCarStandardsPassNum
(
DataStatisticsUtils
.
calculateStandardsPass
(
standards
,
resultMap
));
response
.
setCarStandardsNoPassNum
(
DataStatisticsUtils
.
calculateStandardsNoPass
(
standards
,
resultMap
));
response
.
setCarStandardsUnderNum
(
response
.
getCarStandards
()
-
response
.
getCarStandardsPassNum
()
-
response
.
getCarStandardsNoPassNum
());
BigDecimal
standardPass
=
new
BigDecimal
(
response
.
getCarStandardsPassNum
()
/
(
double
)
response
.
getCarStandards
());
response
.
setCarStandardsPass
(
standardPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
response
.
setCarDetails
(
DataStatisticsUtils
.
calculateDetails
(
standards
));
response
.
setCarDetailsPassNum
(
DataStatisticsUtils
.
calculateDetailsPass
(
standards
,
resultMap
));
response
.
setCarDetailsNoPassNum
(
DataStatisticsUtils
.
calculateDetailsNoPass
(
standards
,
resultMap
));
response
.
setCarDetailsUnderNum
(
response
.
getCarDetails
()
-
response
.
getCarDetailsPassNum
()
-
response
.
getCarDetailsNoPassNum
());
BigDecimal
detailsPass
=
new
BigDecimal
(
response
.
getCarDetailsPassNum
()
/
(
double
)
response
.
getCarDetails
());
response
.
setCarDetailsPass
(
detailsPass
.
setScale
(
3
,
BigDecimal
.
ROUND_UP
).
doubleValue
()
*
100
);
}
public
List
<
TaskUserRelation
>
setAuditors
(
Long
id
)
{
// 小组成员
...
...
quality-review/src/main/java/com/ruoyi/web/TaskController.java
View file @
8f3c0eda
...
...
@@ -13,6 +13,7 @@ import com.ruoyi.service.TaskSampleRelationService;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskUserRelationService
;
import
com.ruoyi.web.request.*
;
import
com.ruoyi.web.response.DataStatisticsResponse
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
com.ruoyi.web.response.TaskGetInfoResponse
;
import
io.swagger.annotations.Api
;
...
...
@@ -148,6 +149,16 @@ public class TaskController extends BaseController {
return
R
.
ok
();
}
@ApiOperation
(
"编辑暂存任务"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@Log
(
title
=
"编辑暂存任务"
,
businessType
=
BusinessType
.
UPDATE
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/editTemporaryStorage"
)
public
R
<
String
>
editTemporaryStorage
(
@Validated
@RequestBody
TaskEditRequest
request
)
{
taskService
.
editTemporaryStorageTask
(
request
);
return
R
.
ok
();
}
@ApiOperation
(
"删除任务"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
...
...
@@ -169,4 +180,14 @@ public class TaskController extends BaseController {
}
@ApiOperation
(
"查看任务数据统计"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dataStatistics"
)
public
R
<
DataStatisticsResponse
>
dataStatistics
(
@Validated
@RequestBody
TaskGetInfoRequest
request
)
{
DataStatisticsResponse
response
=
taskService
.
dataStatistics
(
request
);
return
R
.
ok
(
response
);
}
}
quality-review/src/main/java/com/ruoyi/web/response/DataStatisticsResponse.java
0 → 100644
View file @
8f3c0eda
package
com
.
ruoyi
.
web
.
response
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
value
=
"DataStatisticsResponse"
,
description
=
"任务数据统计"
)
@Data
public
class
DataStatisticsResponse
{
@ApiModelProperty
(
"体系用例审查通过率"
)
private
Double
systemDetailsPass
;
@ApiModelProperty
(
"体系审查细则"
)
private
Integer
systemDetails
;
@ApiModelProperty
(
"体系审查细则通过"
)
private
Integer
systemDetailsPassNum
;
@ApiModelProperty
(
"体系审查细则未通过"
)
private
Integer
systemDetailsNoPassNum
;
@ApiModelProperty
(
"体系细则审查中"
)
private
Integer
systemDetailsUnderNum
;
@ApiModelProperty
(
"体系标准审查通过率"
)
private
Double
systemStandardsPass
;
@ApiModelProperty
(
"体系标准条款"
)
private
Integer
systemStandards
;
@ApiModelProperty
(
"体系标准条款通过"
)
private
Integer
systemStandardsPassNum
;
@ApiModelProperty
(
"体系标准条款未通过"
)
private
Integer
systemStandardsNoPassNum
;
@ApiModelProperty
(
"体系标准审查中"
)
private
Integer
systemStandardsUnderNum
;
@ApiModelProperty
(
" 车型审查用例审查通过率"
)
private
Double
carDetailsPass
;
@ApiModelProperty
(
" 车型审查审查细则"
)
private
Integer
carDetails
;
@ApiModelProperty
(
" 车型审查审查细则通过"
)
private
Integer
carDetailsPassNum
;
@ApiModelProperty
(
" 车型审查审查细则未通过"
)
private
Integer
carDetailsNoPassNum
;
@ApiModelProperty
(
" 车型审查细则审查中"
)
private
Integer
carDetailsUnderNum
;
@ApiModelProperty
(
" 车型审查标准审查通过率"
)
private
Double
carStandardsPass
;
@ApiModelProperty
(
" 车型审查标准条款"
)
private
Integer
carStandards
;
@ApiModelProperty
(
" 车型审查标准条款通过"
)
private
Integer
carStandardsPassNum
;
@ApiModelProperty
(
" 车型审查标准条款未通过"
)
private
Integer
carStandardsNoPassNum
;
@ApiModelProperty
(
" 车型审查标准审查中"
)
private
Integer
carStandardsUnderNum
;
@ApiModelProperty
(
" 车型试验用例审查通过率"
)
private
Double
testDetailsPass
;
@ApiModelProperty
(
" 车型试验审查细则"
)
private
Integer
testDetails
;
@ApiModelProperty
(
" 车型试验审查细则通过"
)
private
Integer
testDetailsPassNum
;
@ApiModelProperty
(
" 车型试验审查细则未通过"
)
private
Integer
testDetailsNoPassNum
;
@ApiModelProperty
(
" 车型试验细则审查中"
)
private
Integer
testDetailsUnderNum
;
@ApiModelProperty
(
" 车型试验标准审查通过率"
)
private
Double
testStandardsPass
;
@ApiModelProperty
(
" 车型试验标准条款"
)
private
Integer
testStandards
;
@ApiModelProperty
(
" 车型试验标准条款通过"
)
private
Integer
testStandardsPassNum
;
@ApiModelProperty
(
" 车型试验标准条款未通过"
)
private
Integer
testStandardsNoPassNum
;
@ApiModelProperty
(
" 车型试验标准审查中"
)
private
Integer
testStandardsUnderNum
;
}
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