|
@@ -2,9 +2,14 @@ package com.ruoyi.postCheck.service.impl;
|
2
|
2
|
|
3
|
3
|
import java.awt.dnd.DropTarget;
|
4
|
4
|
import java.math.BigDecimal;
|
|
5
|
+import java.math.RoundingMode;
|
|
6
|
+import java.util.ArrayList;
|
5
|
7
|
import java.util.Date;
|
|
8
|
+import java.util.HashMap;
|
6
|
9
|
import java.util.List;
|
|
10
|
+import java.util.Map;
|
7
|
11
|
import java.util.Optional;
|
|
12
|
+import java.util.stream.Collectors;
|
8
|
13
|
|
9
|
14
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
10
|
15
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -16,6 +21,9 @@ import com.ruoyi.postCheck.domain.PostAssessmentRules;
|
16
|
21
|
import com.ruoyi.postCheck.domain.PostList;
|
17
|
22
|
import com.ruoyi.postCheck.domain.PostPlan;
|
18
|
23
|
import com.ruoyi.postCheck.domain.PostPlanInfo;
|
|
24
|
+import com.ruoyi.postCheck.domain.homePage.DeptProblemRectificationView;
|
|
25
|
+import com.ruoyi.postCheck.domain.homePage.PostCheckedProblemView;
|
|
26
|
+import com.ruoyi.postCheck.domain.homePage.PostCheckedUnCheckedView;
|
19
|
27
|
import com.ruoyi.postCheck.domain.homePage.PostTotalView;
|
20
|
28
|
import com.ruoyi.postCheck.domain.join.PostPlanJoinProblem;
|
21
|
29
|
import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
|
|
@@ -24,6 +32,7 @@ import com.ruoyi.postCheck.mapper.PostListMapper;
|
24
|
32
|
import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
|
25
|
33
|
import com.ruoyi.postCheck.mapper.PostPlanMapper;
|
26
|
34
|
import com.ruoyi.postCheck.service.IPostPlanJoinProblemService;
|
|
35
|
+import io.swagger.annotations.ApiModelProperty;
|
27
|
36
|
import lombok.Data;
|
28
|
37
|
import org.apache.commons.lang3.StringUtils;
|
29
|
38
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -66,6 +75,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
|
66
|
75
|
private IPostPlanJoinProblemService postPlanJoinProblemService;
|
67
|
76
|
@Autowired
|
68
|
77
|
private PostListMapper postListMapper;
|
|
78
|
+
|
69
|
79
|
/**
|
70
|
80
|
* 查询岗检问题表
|
71
|
81
|
*
|
|
@@ -157,7 +167,7 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
|
157
|
167
|
PostPlanInfo postPlanInfo = postPlanInfoMapper.selectById(planInfoId);
|
158
|
168
|
PostPlan postPlan = postPlanMapper.selectById(postPlanInfo.getPostPlanId());
|
159
|
169
|
List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
|
160
|
|
- .eq(PostCheckedProblem::getCheckedDeptId,departmentId)
|
|
170
|
+ .eq(PostCheckedProblem::getCheckedDeptId, departmentId)
|
161
|
171
|
.between(PostCheckedProblem::getCreateTime, postPlan.getStartTime(), postPlan.getEndTime())
|
162
|
172
|
|
163
|
173
|
);
|
|
@@ -173,37 +183,37 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
|
173
|
183
|
Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d -> d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
|
174
|
184
|
if (first.isPresent() && score.compareTo(new BigDecimal("0")) > 0) {
|
175
|
185
|
// 计算岗检得分
|
176
|
|
- if (postCheckedProblem.getProblemLevel().equals("1")){
|
|
186
|
+ if (postCheckedProblem.getProblemLevel().equals("1")) {
|
177
|
187
|
score = score.subtract(first.get().getProblemLevelOne());
|
178
|
|
- }else if(postCheckedProblem.getProblemLevel().equals("2")){
|
|
188
|
+ } else if (postCheckedProblem.getProblemLevel().equals("2")) {
|
179
|
189
|
score = score.subtract(first.get().getProblemLevelTwo());
|
180
|
190
|
}
|
181
|
191
|
}
|
182
|
192
|
}
|
183
|
193
|
|
184
|
194
|
// todo 公式计算
|
185
|
|
- if (postCheckedProblems.size()>0){
|
|
195
|
+ if (postCheckedProblems.size() > 0) {
|
186
|
196
|
BigDecimal bigDecimal = new BigDecimal("1");
|
187
|
197
|
List<PostPlanInfo> postPlanInfos = postPlanInfoMapper.selectList(Wrappers.<PostPlanInfo>lambdaQuery()
|
188
|
|
- .eq(PostPlanInfo::getPostPlanId,postPlan.getId())
|
|
198
|
+ .eq(PostPlanInfo::getPostPlanId, postPlan.getId())
|
189
|
199
|
);
|
190
|
|
- if (postPlanInfos.size() <= 0){
|
|
200
|
+ if (postPlanInfos.size() <= 0) {
|
191
|
201
|
score = new BigDecimal("0");
|
192
|
|
- }else{
|
|
202
|
+ } else {
|
193
|
203
|
BigDecimal divide = new BigDecimal(postCheckedProblems.size()).divide(new BigDecimal(postPlanInfos.size()).multiply(new BigDecimal("6")));
|
194
|
|
- if (divide.compareTo(new BigDecimal("0"))<=0 || divide.compareTo(new BigDecimal("1")) > 0){
|
|
204
|
+ if (divide.compareTo(new BigDecimal("0")) <= 0 || divide.compareTo(new BigDecimal("1")) > 0) {
|
195
|
205
|
score = new BigDecimal("0");
|
196
|
|
- }else{
|
|
206
|
+ } else {
|
197
|
207
|
score = bigDecimal.subtract(divide);
|
198
|
208
|
}
|
199
|
209
|
}
|
200
|
|
- }else{
|
|
210
|
+ } else {
|
201
|
211
|
score = new BigDecimal("0");
|
202
|
212
|
}
|
203
|
|
- postAssessmentRatingMapper.update(null,Wrappers.<PostAssessmentRating>lambdaUpdate()
|
204
|
|
- .set(PostAssessmentRating::getPositionScore,score)
|
205
|
|
- .eq(PostAssessmentRating::getDeptId,departmentId)
|
206
|
|
- .eq(PostAssessmentRating::getPlanId,postPlan.getId())
|
|
213
|
+ postAssessmentRatingMapper.update(null, Wrappers.<PostAssessmentRating>lambdaUpdate()
|
|
214
|
+ .set(PostAssessmentRating::getPositionScore, score)
|
|
215
|
+ .eq(PostAssessmentRating::getDeptId, departmentId)
|
|
216
|
+ .eq(PostAssessmentRating::getPlanId, postPlan.getId())
|
207
|
217
|
);
|
208
|
218
|
}
|
209
|
219
|
|
|
@@ -502,5 +512,117 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
|
502
|
512
|
postTotalView.setUncheckedPostCount(uncheckedPostCount);
|
503
|
513
|
return postTotalView;
|
504
|
514
|
}
|
|
515
|
+
|
|
516
|
+ @Override
|
|
517
|
+ public PostCheckedProblemView checkedProblem() {
|
|
518
|
+ List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
|
|
519
|
+ Integer problemComplete = 0;
|
|
520
|
+ Integer problemSuitable = 0;
|
|
521
|
+ Integer problemEffective = 0;
|
|
522
|
+ //(1-完整问题;2-有效性问题;3-适宜性问题;)
|
|
523
|
+ if (!postCheckedProblems.isEmpty())
|
|
524
|
+ for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
|
|
525
|
+ if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 1)
|
|
526
|
+ problemComplete++;
|
|
527
|
+ if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 3)
|
|
528
|
+ problemEffective++;
|
|
529
|
+ if (postCheckedProblem.getProblemAttribute()!=null && postCheckedProblem.getProblemAttribute() == 2)
|
|
530
|
+ problemSuitable++;
|
|
531
|
+ }
|
|
532
|
+ PostCheckedProblemView post = new PostCheckedProblemView();
|
|
533
|
+ post.setProblemTotal(postCheckedProblems.size());
|
|
534
|
+ post.setProblemComplete(problemComplete);
|
|
535
|
+ post.setProblemSuitable(problemSuitable);
|
|
536
|
+ post.setProblemEffective(problemEffective);
|
|
537
|
+ return post;
|
|
538
|
+ }
|
|
539
|
+
|
|
540
|
+ @Override
|
|
541
|
+ public Integer userTotal() {
|
|
542
|
+ return postListMapper.userTotal();
|
|
543
|
+ }
|
|
544
|
+
|
|
545
|
+ @Override
|
|
546
|
+ public Map<Integer, BigDecimal> problemRectification() {
|
|
547
|
+ List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
|
|
548
|
+ Integer problemComplete = 0;
|
|
549
|
+ Integer overproblemComplete = 0;
|
|
550
|
+ Integer problemSuitable = 0;
|
|
551
|
+ Integer overproblemSuitable = 0;
|
|
552
|
+ Integer problemEffective = 0;
|
|
553
|
+ Integer overproblemEffective = 0;
|
|
554
|
+ Integer total = 0;
|
|
555
|
+ Integer overtotal = 0;
|
|
556
|
+ //(1-完整问题;2-有效性问题;3-适宜性问题;4 总数)
|
|
557
|
+ if (!postCheckedProblems.isEmpty())
|
|
558
|
+ for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
|
|
559
|
+ if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 1) {
|
|
560
|
+ problemComplete++;
|
|
561
|
+ if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
|
|
562
|
+ overproblemComplete++;
|
|
563
|
+ }
|
|
564
|
+ }
|
|
565
|
+ if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 3) {
|
|
566
|
+ problemEffective++;
|
|
567
|
+ if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
|
|
568
|
+ overproblemEffective++;
|
|
569
|
+ }
|
|
570
|
+ }
|
|
571
|
+ if (postCheckedProblem.getProblemAttribute()!=null&&postCheckedProblem.getProblemAttribute() == 2) {
|
|
572
|
+ problemSuitable++;
|
|
573
|
+ if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
|
|
574
|
+ overproblemSuitable++;
|
|
575
|
+ }
|
|
576
|
+ }
|
|
577
|
+ total++;
|
|
578
|
+ if (postCheckedProblem.getIsImmediatelyCorrected()!=null&&postCheckedProblem.getIsImmediatelyCorrected() == 1) {
|
|
579
|
+ overtotal++;
|
|
580
|
+ }
|
|
581
|
+ }
|
|
582
|
+ Map<Integer, BigDecimal> map = new HashMap<>();
|
|
583
|
+ map.put(1, new BigDecimal(overproblemComplete).divide(new BigDecimal(problemComplete),4, RoundingMode.HALF_UP));
|
|
584
|
+ map.put(2, new BigDecimal(overproblemSuitable).divide(new BigDecimal(problemSuitable),4, RoundingMode.HALF_UP));
|
|
585
|
+ map.put(3, new BigDecimal(overproblemEffective).divide(new BigDecimal(problemEffective),4, RoundingMode.HALF_UP));
|
|
586
|
+ map.put(4, new BigDecimal(overtotal).divide(new BigDecimal(total),4, RoundingMode.HALF_UP));
|
|
587
|
+ return map;
|
|
588
|
+
|
|
589
|
+ }
|
|
590
|
+
|
|
591
|
+ @Override
|
|
592
|
+ public List<DeptProblemRectificationView> deptProblemRectification() {
|
|
593
|
+ List<DeptProblemRectificationView> dataList = new ArrayList<>();
|
|
594
|
+ List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.lambdaQuery());
|
|
595
|
+ if (!postCheckedProblems.isEmpty()){
|
|
596
|
+ Map<Long, List<PostCheckedProblem>> postMapListMap = postCheckedProblems.stream().collect(Collectors.groupingBy(PostCheckedProblem::getCheckedDeptId));
|
|
597
|
+ for (Map.Entry<Long, List<PostCheckedProblem>> entry : postMapListMap.entrySet()) {
|
|
598
|
+ DeptProblemRectificationView data1 = new DeptProblemRectificationView();
|
|
599
|
+ data1.setDeptId(entry.getKey());
|
|
600
|
+ data1.setDeptName(postAssessmentRatingMapper.getSysDeptName(entry.getKey()));
|
|
601
|
+ Integer problemTotal = 0;
|
|
602
|
+ Integer problemComplete = 0;
|
|
603
|
+ for (PostCheckedProblem postCheckedProblem : entry.getValue()) {
|
|
604
|
+ problemTotal++;
|
|
605
|
+ if (postCheckedProblem.getIsRectificationCompleted()!=null&&postCheckedProblem.getIsRectificationCompleted() == 1){
|
|
606
|
+ problemComplete++;
|
|
607
|
+ }
|
|
608
|
+ }
|
|
609
|
+ data1.setProblemTotal(problemTotal);
|
|
610
|
+ data1.setProblemComplete(problemComplete);
|
|
611
|
+ data1.setProblemRectificationRate(new BigDecimal(problemComplete).divide(new BigDecimal(problemTotal),4, RoundingMode.HALF_UP));
|
|
612
|
+ dataList.add(data1);
|
|
613
|
+ }
|
|
614
|
+ }
|
|
615
|
+ return dataList;
|
|
616
|
+ }
|
|
617
|
+
|
|
618
|
+ @Override
|
|
619
|
+ public List<PostCheckedUnCheckedView> postChecked(Integer i) {
|
|
620
|
+ return postListMapper.postChecked(i);
|
|
621
|
+ }
|
|
622
|
+
|
|
623
|
+ @Override
|
|
624
|
+ public Integer getPostCountByDeptId(Long deptId) {
|
|
625
|
+ return postListMapper.getPostCountByDeptId(deptId);
|
|
626
|
+ }
|
505
|
627
|
}
|
506
|
628
|
|