瀏覽代碼

查询岗检排名列表

zhangjiansheng 10 月之前
父節點
當前提交
3a455ff6c1

+ 20 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/controller/PostAssessmentRatingOtherController.java

@@ -173,6 +173,26 @@ public class PostAssessmentRatingOtherController extends BaseController {
173 173
     @Log(title = "打分表(职能互评生产日常)", businessType = BusinessType.INSERT)
174 174
     @PostMapping("/batchAddRatingOther")
175 175
     public AjaxResult batchAddRatingOther(@RequestBody PostAssessmentRatingOther postAssessmentRatingOther) {
176
+        postAssessmentRatingOther.setDeptId(getDeptId());
176 177
         return toAjax(postAssessmentRatingOtherService.batchAddRatingOther(postAssessmentRatingOther));
177 178
     }
179
+
180
+
181
+
182
+
183
+    @ApiOperation("职能互评表打分提交")
184
+    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOther:update')")
185
+    @Log(title = "职能互评表打分提交", businessType = BusinessType.UPDATE)
186
+    @PostMapping("/functionalDepartmentSub")
187
+    public AjaxResult functionalDepartmentSub(@RequestBody PostAssessmentRatingOther postAssessmentRatingOther) {
188
+        return toAjax(postAssessmentRatingOtherService.batchAddRatingOtherUpdate(postAssessmentRatingOther));
189
+    }
190
+
191
+    @ApiOperation("生产部门日常得分")
192
+    @PreAuthorize("@ss.hasPermi('postCheck:postAssessmentRatingOther:update')")
193
+    @Log(title = "生产部门日常得分", businessType = BusinessType.UPDATE)
194
+    @PostMapping("/productionDepartmentSub")
195
+    public AjaxResult productionDepartmentSub(@RequestBody List<PostAssessmentRatingOther> postAssessmentRatingOther) {
196
+        return toAjax(postAssessmentRatingOtherService.productionDepartmentSub(postAssessmentRatingOther));
197
+    }
178 198
 }

+ 5 - 1
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/domain/PostAssessmentRatingOther.java

@@ -5,6 +5,8 @@ import java.util.Date;
5 5
 import java.util.List;
6 6
 
7 7
 import com.fasterxml.jackson.annotation.JsonFormat;
8
+import lombok.AllArgsConstructor;
9
+import lombok.NoArgsConstructor;
8 10
 import org.apache.commons.lang3.builder.ToStringBuilder;
9 11
 import org.apache.commons.lang3.builder.ToStringStyle;
10 12
 import com.ruoyi.common.annotation.Excel;
@@ -26,6 +28,8 @@ import lombok.EqualsAndHashCode;
26 28
 @Data
27 29
 @ApiModel(value = "打分表(职能互评生产日常)对象")
28 30
 @TableName("post_assessment_rating_other") // 数据库表名
31
+@AllArgsConstructor
32
+@NoArgsConstructor
29 33
 public class PostAssessmentRatingOther extends BaseEntity
30 34
 {
31 35
     private static final long serialVersionUID = 1L;
@@ -81,6 +85,6 @@ public class PostAssessmentRatingOther extends BaseEntity
81 85
 
82 86
     @ApiModelProperty("明细表集合")
83 87
     @TableField(exist = false)
84
-    private List<PostAssessmentRatingOtherInfo> children = new ArrayList<>();
88
+    private List<PostAssessmentRatingOtherInfo> children;
85 89
 
86 90
 }

+ 6 - 2
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/domain/PostAssessmentRatingOtherInfo.java

@@ -5,6 +5,8 @@ import java.util.ArrayList;
5 5
 import java.util.List;
6 6
 
7 7
 import com.ruoyi.postCheck.domain.tools.PostAssessmentRatingOtherInfoDept;
8
+import lombok.AllArgsConstructor;
9
+import lombok.NoArgsConstructor;
8 10
 import org.apache.commons.lang3.builder.ToStringBuilder;
9 11
 import org.apache.commons.lang3.builder.ToStringStyle;
10 12
 import com.ruoyi.common.annotation.Excel;
@@ -26,7 +28,9 @@ import lombok.EqualsAndHashCode;
26 28
 @Data
27 29
 @ApiModel(value = "打分表明细(职能互评生产日常)对象")
28 30
 @TableName("post_assessment_rating_other_info") // 数据库表名
29
-public class PostAssessmentRatingOtherInfo extends BaseEntity
31
+@AllArgsConstructor
32
+@NoArgsConstructor
33
+public class    PostAssessmentRatingOtherInfo extends BaseEntity
30 34
 {
31 35
     private static final long serialVersionUID = 1L;
32 36
 
@@ -75,6 +79,6 @@ public class PostAssessmentRatingOtherInfo extends BaseEntity
75 79
 
76 80
     @ApiModelProperty("打分表明细里面放的为各个部门的评分结果")
77 81
     @TableField(exist = false)
78
-    private List<PostAssessmentRatingOtherInfoDept> children = new ArrayList<>();
82
+    private List<PostAssessmentRatingOtherInfoDept> children;
79 83
 
80 84
 }

+ 7 - 1
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/domain/tools/PostAssessmentRatingOtherInfoDept.java

@@ -6,8 +6,10 @@ import com.ruoyi.common.annotation.Excel;
6 6
 import com.ruoyi.common.core.domain.BaseEntity;
7 7
 import io.swagger.annotations.ApiModel;
8 8
 import io.swagger.annotations.ApiModelProperty;
9
+import lombok.AllArgsConstructor;
9 10
 import lombok.Data;
10 11
 import lombok.EqualsAndHashCode;
12
+import lombok.NoArgsConstructor;
11 13
 
12 14
 import java.io.Serializable;
13 15
 import java.math.BigDecimal;
@@ -21,12 +23,14 @@ import java.math.BigDecimal;
21 23
 
22 24
 @Data
23 25
 @ApiModel(value = "打分表明细里面放的为各个部门的评分结果")
26
+@NoArgsConstructor
24 27
 public class PostAssessmentRatingOtherInfoDept implements Serializable {
25 28
 
26 29
 
27 30
 //    public PostAssessmentRatingOtherInfoDept(Long ratingOtherInfoId, Long byDeptId, String byDeptName, BigDecimal byDeptScore) {
28
-    public PostAssessmentRatingOtherInfoDept( Long byDeptId, String byDeptName, BigDecimal byDeptScore) {
31
+    public PostAssessmentRatingOtherInfoDept( Long id,Long byDeptId, String byDeptName, BigDecimal byDeptScore) {
29 32
 //        this.ratingOtherInfoId = ratingOtherInfoId;
33
+        this.id = id;
30 34
         this.byDeptId = byDeptId;
31 35
         this.byDeptName = byDeptName;
32 36
         this.byDeptScore = byDeptScore;
@@ -41,6 +45,8 @@ public class PostAssessmentRatingOtherInfoDept implements Serializable {
41 45
 //    private Integer dutyType;
42 46
 
43 47
     @ApiModelProperty("被评分部门ID")
48
+    private Long id;
49
+    @ApiModelProperty("被评分部门ID")
44 50
     private Long byDeptId;
45 51
 
46 52
     @ApiModelProperty("被评分部门名称")

+ 12 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/mapper/PostAssessmentRatingOtherMapper.java

@@ -1,6 +1,8 @@
1 1
 package com.ruoyi.postCheck.mapper;
2 2
 
3 3
 import java.util.List;
4
+import java.util.Map;
5
+
4 6
 import com.ruoyi.postCheck.domain.PostAssessmentRatingOther;
5 7
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6 8
 
@@ -28,6 +30,10 @@ public interface PostAssessmentRatingOtherMapper extends BaseMapper<PostAssessme
28 30
      */
29 31
     public List<PostAssessmentRatingOther> selectPostAssessmentRatingOtherList(PostAssessmentRatingOther postAssessmentRatingOther);
30 32
 
33
+
34
+
35
+    public List<PostAssessmentRatingOther> selectPostAssessmentRatingOtherListGroup(PostAssessmentRatingOther postAssessmentRatingOther);
36
+
31 37
     /**
32 38
      * 新增打分表(职能互评生产日常)
33 39
      *
@@ -59,4 +65,10 @@ public interface PostAssessmentRatingOtherMapper extends BaseMapper<PostAssessme
59 65
      * @return 结果
60 66
      */
61 67
     public int deletePostAssessmentRatingOtherByIds(Long[] ids);
68
+
69
+
70
+    List<Long> getDeptIdList(Long id);
71
+
72
+    List<Map<String,String>> getDeptIdListByType(Integer type);
73
+
62 74
 }

+ 3 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/mapper/PostCheckedProblemMapper.java

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.postCheck.mapper;
2 2
 
3
+import java.math.BigDecimal;
3 4
 import java.util.List;
4 5
 import com.ruoyi.postCheck.domain.PostCheckedProblem;
5 6
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -59,4 +60,6 @@ public interface PostCheckedProblemMapper extends BaseMapper<PostCheckedProblem>
59 60
      * @return 结果
60 61
      */
61 62
     public int deletePostCheckedProblemByIds(Long[] ids);
63
+
64
+    BigDecimal getPostTotalByDeptId(Long deptId);
62 65
 }

+ 4 - 0
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/IPostAssessmentRatingOtherService.java

@@ -67,4 +67,8 @@ public interface IPostAssessmentRatingOtherService extends IService<PostAssessme
67 67
      * @return
68 68
      */
69 69
     int batchAddRatingOther(PostAssessmentRatingOther postAssessmentRatingOther);
70
+
71
+    int batchAddRatingOtherUpdate(PostAssessmentRatingOther postAssessmentRatingOther);
72
+
73
+    int productionDepartmentSub(List<PostAssessmentRatingOther> postAssessmentRatingOther);
70 74
 }

+ 149 - 170
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostAssessmentRatingOtherServiceImpl.java

@@ -1,27 +1,39 @@
1 1
 package com.ruoyi.postCheck.service.impl;
2 2
 
3
-import java.math.BigDecimal;
4
-import java.util.ArrayList;
5
-import java.util.Date;
6
-import java.util.List;
7
-
3
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
4
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 6
 import com.ruoyi.common.constant.PostAssessmentRatingOtherEnum;
9
-import com.ruoyi.common.utils.DateUtils;
10 7
 import com.ruoyi.common.utils.SecurityUtils;
11
-import com.ruoyi.common.utils.spring.SpringUtils;
8
+import com.ruoyi.postCheck.domain.PostAssessmentRatingOther;
12 9
 import com.ruoyi.postCheck.domain.PostAssessmentRatingOtherInfo;
10
+import com.ruoyi.postCheck.domain.PostAssessmentRules;
13 11
 import com.ruoyi.postCheck.domain.tools.PostAssessmentRatingOtherInfoDept;
14
-import io.swagger.annotations.ApiImplicitParam;
15
-import io.swagger.annotations.ApiModelProperty;
16
-import org.springframework.beans.factory.annotation.Autowired;
17
-import org.springframework.stereotype.Service;
12
+import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
13
+import com.ruoyi.postCheck.mapper.PostAssessmentRatingOtherInfoMapper;
18 14
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingOtherMapper;
19
-import com.ruoyi.postCheck.domain.PostAssessmentRatingOther;
15
+import com.ruoyi.postCheck.mapper.PostAssessmentRulesMapper;
20 16
 import com.ruoyi.postCheck.service.IPostAssessmentRatingOtherService;
21
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
22
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
17
+import org.springframework.beans.factory.annotation.Autowired;
18
+import org.springframework.stereotype.Service;
23 19
 import org.springframework.transaction.annotation.Transactional;
24 20
 
21
+import java.math.BigDecimal;
22
+import java.util.ArrayList;
23
+import java.util.Date;
24
+import java.util.List;
25
+import java.util.UUID;
26
+import java.util.stream.Collectors;
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
25 37
 /**
26 38
  * 打分表(职能互评生产日常)Service业务层处理
27 39
  *
@@ -31,6 +43,12 @@ import org.springframework.transaction.annotation.Transactional;
31 43
 @Service
32 44
 public class PostAssessmentRatingOtherServiceImpl extends ServiceImpl<PostAssessmentRatingOtherMapper, PostAssessmentRatingOther> implements IPostAssessmentRatingOtherService {
33 45
     @Autowired
46
+    private PostAssessmentRulesMapper postAssessmentRulesMapper;
47
+    @Autowired
48
+    private PostAssessmentRatingOtherInfoMapper postAssessmentRatingOtherInfoMapper;
49
+    @Autowired
50
+    private PostAssessmentRatingMapper postAssessmentRatingMapper;
51
+    @Autowired
34 52
     private PostAssessmentRatingOtherMapper postAssessmentRatingOtherMapper;
35 53
 
36 54
     /**
@@ -42,94 +60,45 @@ public class PostAssessmentRatingOtherServiceImpl extends ServiceImpl<PostAssess
42 60
     @Override
43 61
     public PostAssessmentRatingOther selectPostAssessmentRatingOtherById(Long id) {
44 62
         PostAssessmentRatingOther data = postAssessmentRatingOtherMapper.selectPostAssessmentRatingOtherById(id);
45
-
46
-        id = 123456789l;
47
-        data = new PostAssessmentRatingOther();
48
-
49
-//        PostAssessmentRatingOther data = new PostAssessmentRatingOther();
50
-        data.setId(id);
51
-        data.setType(PostAssessmentRatingOtherEnum.TYPE_ZN_HP.getValue());
52
-        data.setBatchId("111111");
53
-        data.setStatus(PostAssessmentRatingOtherEnum.STATUS_ING.getValue());//状态
54
-        data.setStartTime(new Date());//评分时间
55
-
56
-
63
+        List<PostAssessmentRatingOther> postAssessmentRatingOthers = postAssessmentRatingOtherMapper.selectList(Wrappers.<PostAssessmentRatingOther>lambdaQuery()
64
+                .eq(PostAssessmentRatingOther::getBatchId,data.getBatchId())
65
+        );
66
+        if (postAssessmentRatingOthers.isEmpty()){
67
+            return new PostAssessmentRatingOther();
68
+        }
57 69
 //        String[] deptArr = new String[]{"健康安全环保中心", "生产指挥中心", "设备管理中心", "技术中心", "仓储组", "党建工作部", "内控法务部", "人力资源部", "商务部", "办公室", "规划计划部", "信息中心", "财务资金部"};
58
-
70
+        Long type = 2L;
71
+        if (data.getType() == 2){
72
+            type = 3L;
73
+        }
74
+        List<PostAssessmentRules> postAssessmentRules = postAssessmentRulesMapper.selectList(Wrappers.<PostAssessmentRules>lambdaQuery()
75
+                .eq(PostAssessmentRules::getType, type)
76
+        );
59 77
         List<PostAssessmentRatingOtherInfo> children = new ArrayList<>();
60
-
61
-        String[] deptArr = new String[]{"健康安全环保中心", "生产指挥中心", "设备管理中心", "技术中心", "仓储组", "党建工作部", "内控法务部", "人力资源部", "商务部", "办公室", "规划计划部", "信息中心", "财务资金部"};
62
-        PostAssessmentRatingOtherInfo child1 = new PostAssessmentRatingOtherInfo();
63
-        child1.setId(System.currentTimeMillis());
64
-        child1.setRatingOtherId(id);
78
+        for (PostAssessmentRules postAssessmentRule : postAssessmentRules) {
79
+            PostAssessmentRatingOtherInfo child1 = new PostAssessmentRatingOtherInfo();
65 80
 // "评分分类/项目/专业:职责类别:1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规与保密职责;5-任职资格与能力素质要求;6-岗位责任制文件完整性与适宜性;
66 81
 // 10-工作态度;11-部门协作;12-廉洁从业;13-主要工作完成情况;
67 82
 // 20-HSE;21-生产;22-设备;")
68
-        child1.setDutyType(10);
69
-        child1.setScoreWeight(new BigDecimal(20));
70
-        List<PostAssessmentRatingOtherInfoDept> children1 = new ArrayList<>();
71
-        for (int i = 0; i < deptArr.length; i++) {
72
-            Long deptId = Long.parseLong(String.valueOf(i + 1));
73
-            String deptName = deptArr[i];
74
-            children1.add(new PostAssessmentRatingOtherInfoDept(deptId, deptName, new BigDecimal(20 - i)));
75
-        }
76
-        child1.setChildren(children1);
77
-        child1.setRule("评分标准-工作态度");
78
-
79
-        PostAssessmentRatingOtherInfo child2 = new PostAssessmentRatingOtherInfo();
80
-        child2.setId(System.currentTimeMillis());
81
-        child2.setRatingOtherId(id);
82
-        child2.setDutyType(11);
83
-        child2.setScoreWeight(new BigDecimal(20));
84
-        List<PostAssessmentRatingOtherInfoDept> children2 = new ArrayList<>();
85
-        for (int i = 0; i < deptArr.length; i++) {
86
-            Long deptId = Long.parseLong(String.valueOf(i + 1));
87
-            String deptName = deptArr[i];
88
-            children2.add(new PostAssessmentRatingOtherInfoDept(deptId, deptName, new BigDecimal(20 - i)));
83
+            child1.setDutyType(postAssessmentRule.getDutyType());
84
+            child1.setScoreWeight(new BigDecimal(postAssessmentRule.getFullScore()));
85
+            List<PostAssessmentRatingOtherInfoDept> children1 = new ArrayList<>();
86
+            for (PostAssessmentRatingOther postAssessmentRatingOther : postAssessmentRatingOthers) {
87
+                List<PostAssessmentRatingOtherInfo> postAssessmentRatingOtherInfos = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
88
+                        .eq(PostAssessmentRatingOtherInfo::getRatingOtherId,postAssessmentRatingOther.getId())
89
+                        .eq(PostAssessmentRatingOtherInfo::getDutyType,postAssessmentRule.getDutyType())
90
+                );
91
+                BigDecimal distance = new BigDecimal("0");
92
+                if (postAssessmentRatingOtherInfos.isEmpty()){
93
+                    continue;
94
+                }
95
+                distance = postAssessmentRatingOtherInfos.get(0).getByDeptScore();
96
+                children1.add(new PostAssessmentRatingOtherInfoDept(postAssessmentRatingOtherInfos.get(0).getId(),postAssessmentRatingOther.getDeptId(), postAssessmentRatingMapper.getSysDeptName(postAssessmentRatingOther.getDeptId()), distance));
97
+            }
98
+            child1.setChildren(children1);
99
+            children.add(child1);
89 100
         }
90
-        child2.setChildren(children2);
91
-        child2.setRule("评分标准-部门协作");
92
-
93
-
94
-        PostAssessmentRatingOtherInfo child3 = new PostAssessmentRatingOtherInfo();
95
-        child3.setId(System.currentTimeMillis());
96
-        child3.setRatingOtherId(id);
97
-        child3.setDutyType(12);
98
-        child3.setScoreWeight(new BigDecimal(20));
99
-        List<PostAssessmentRatingOtherInfoDept> children3 = new ArrayList<>();
100
-        for (int i = 0; i < deptArr.length; i++) {
101
-            Long deptId = Long.parseLong(String.valueOf(i + 1));
102
-            String deptName = deptArr[i];
103
-            children3.add(new PostAssessmentRatingOtherInfoDept(deptId, deptName, new BigDecimal(20 - i)));
104
-        }
105
-        child3.setChildren(children3);
106
-        child3.setRule("评分标准-廉洁从业");
107
-
108
-
109
-        PostAssessmentRatingOtherInfo child4 = new PostAssessmentRatingOtherInfo();
110
-        child4.setId(System.currentTimeMillis());
111
-        child4.setRatingOtherId(id);
112
-        child4.setDutyType(13);
113
-        child4.setScoreWeight(new BigDecimal(20));
114
-        List<PostAssessmentRatingOtherInfoDept> children4 = new ArrayList<>();
115
-        for (int i = 0; i < deptArr.length; i++) {
116
-            Long deptId = Long.parseLong(String.valueOf(i + 1));
117
-            String deptName = deptArr[i];
118
-            children4.add(new PostAssessmentRatingOtherInfoDept(deptId, deptName, new BigDecimal(20 - i)));
119
-        }
120
-        child4.setChildren(children4);
121
-        child4.setRule("评分标准-主要工作完成情况");
122
-
123
-
124
-        children.add(child1);
125
-        children.add(child2);
126
-        children.add(child3);
127
-        children.add(child4);
128
-
129
-
130 101
         data.setChildren(children);
131
-
132
-
133 102
         return data;
134 103
     }
135 104
 
@@ -141,60 +110,18 @@ public class PostAssessmentRatingOtherServiceImpl extends ServiceImpl<PostAssess
141 110
      */
142 111
     @Override
143 112
     public List<PostAssessmentRatingOther> selectPostAssessmentRatingOtherList(PostAssessmentRatingOther postAssessmentRatingOther) {
144
-        List<PostAssessmentRatingOther> list = postAssessmentRatingOtherMapper.selectPostAssessmentRatingOtherList(postAssessmentRatingOther);
145
-        list = new ArrayList<>();
146
-
147
-        Long id = 123456789l;
148
-        PostAssessmentRatingOther data = new PostAssessmentRatingOther();
149
-        data.setId(id);
150
-        data.setType(PostAssessmentRatingOtherEnum.TYPE_ZN_HP.getValue());
151
-        data.setBatchId("111111");
152
-        data.setStatus(PostAssessmentRatingOtherEnum.STATUS_ING.getValue());//状态
153
-        data.setStartTime(new Date());//评分时间
154
-
155
-//        String[] deptArr = new String[]{"", "", "", "", "", "", "", "", "", "", "", "", ""};
156
-
157
-        List<PostAssessmentRatingOtherInfo> children = new ArrayList<>();
158
-
159
-        PostAssessmentRatingOtherInfo child1 = new PostAssessmentRatingOtherInfo();
160
-        child1.setId(System.currentTimeMillis());
161
-        child1.setRatingOtherId(id);
162
-// "评分分类/项目/专业:职责类别:1-业务职责;2-党建及党风廉政;3-安全环保职责;4-合规与保密职责;5-任职资格与能力素质要求;6-岗位责任制文件完整性与适宜性;
163
-// 10-工作态度;11-部门协作;12-廉洁从业;13-主要工作完成情况;
164
-// 20-HSE;21-生产;22-设备;")
165
-        child1.setDutyType(10);
166
-        child1.setScoreWeight(new BigDecimal(20));
167
-
168
-        PostAssessmentRatingOtherInfo child2 = new PostAssessmentRatingOtherInfo();
169
-        child2.setId(System.currentTimeMillis());
170
-        child2.setRatingOtherId(id);
171
-        child2.setDutyType(11);
172
-        child2.setScoreWeight(new BigDecimal(20));
173
-
174
-
175
-        PostAssessmentRatingOtherInfo child3 = new PostAssessmentRatingOtherInfo();
176
-        child3.setId(System.currentTimeMillis());
177
-        child3.setRatingOtherId(id);
178
-        child3.setDutyType(12);
179
-        child3.setScoreWeight(new BigDecimal(20));
180
-
181
-
182
-        PostAssessmentRatingOtherInfo child4 = new PostAssessmentRatingOtherInfo();
183
-        child4.setId(System.currentTimeMillis());
184
-        child4.setRatingOtherId(id);
185
-        child4.setDutyType(13);
186
-        child4.setScoreWeight(new BigDecimal(20));
187
-
188
-
189
-        children.add(child1);
190
-        children.add(child2);
191
-        children.add(child3);
192
-        children.add(child4);
193
-
194
-
195
-        data.setChildren(children);
196
-
197
-        list.add(data);
113
+        List<PostAssessmentRatingOther> list = postAssessmentRatingOtherMapper.selectPostAssessmentRatingOtherListGroup(postAssessmentRatingOther);
114
+        if (list.isEmpty()){
115
+            return new ArrayList<>();
116
+        }
117
+        List<Long> collect = list.stream().map(PostAssessmentRatingOther::getId).collect(Collectors.toList());
118
+        List<PostAssessmentRatingOtherInfo> children = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
119
+                .in(PostAssessmentRatingOtherInfo::getRatingOtherId,collect)
120
+        );
121
+        for (PostAssessmentRatingOther assessmentRatingOther : list) {
122
+            List<PostAssessmentRatingOtherInfo> collect1 = children.stream().filter(d -> d.getRatingOtherId().equals(assessmentRatingOther.getId())).collect(Collectors.toList());
123
+            assessmentRatingOther.setChildren(collect1);
124
+        }
198 125
         return list;
199 126
     }
200 127
 
@@ -272,39 +199,91 @@ public class PostAssessmentRatingOtherServiceImpl extends ServiceImpl<PostAssess
272 199
             return 0;
273 200
         }
274 201
 
202
+        List<PostAssessmentRules> postAssessmentRules = new ArrayList<>();
275 203
         //初始化13个职能部门评分 类型:1-职能互评;
276 204
         if (type == PostAssessmentRatingOtherEnum.TYPE_ZN_HP.getValue()) {
277
-
278
-            return SpringUtils.getBean(PostAssessmentRatingOtherServiceImpl.class).batchAddRatingOtherZhiNengDept(startTime);
205
+            postAssessmentRules = postAssessmentRulesMapper.selectList(Wrappers.<PostAssessmentRules>lambdaQuery()
206
+                    .eq(PostAssessmentRules::getType,2)
207
+            );
279 208
         }
280 209
 
281 210
         //初始化13个生产部门评分 类型:2-生产日常;
282 211
         if (type == PostAssessmentRatingOtherEnum.TYPE_SC_RC.getValue()) {
283
-            return SpringUtils.getBean(PostAssessmentRatingOtherServiceImpl.class).batchAddRatingOtherShengChanDept(startTime);
212
+            postAssessmentRules =postAssessmentRulesMapper.selectList(Wrappers.<PostAssessmentRules>lambdaQuery()
213
+                    .eq(PostAssessmentRules::getType,3)
214
+            );
215
+
216
+        }
217
+        List<Long> deptIdList = postAssessmentRatingOtherMapper.getDeptIdList(postAssessmentRatingOther.getDeptId());
218
+        String string = UUID.randomUUID().toString();
219
+        for (Long deptId : deptIdList) {
220
+            PostAssessmentRatingOther postAssessmentRatingOtherOther =new PostAssessmentRatingOther();
221
+            postAssessmentRatingOtherOther.setId(Long.parseLong(IdWorker.getIdStr().substring(4)));
222
+            postAssessmentRatingOtherOther.setType(type);
223
+            postAssessmentRatingOtherOther.setBatchId(string);
224
+            postAssessmentRatingOtherOther.setStartTime(new Date());
225
+            postAssessmentRatingOtherOther.setStatus(1);
226
+            postAssessmentRatingOtherOther.setDeptId(deptId);
227
+            postAssessmentRatingOtherOther.setCreateDefault();
228
+            postAssessmentRatingOtherOther.setCreateUserId(SecurityUtils.getLoginUser().getUserId());
229
+            postAssessmentRatingOtherMapper.insert(postAssessmentRatingOtherOther);
230
+            if(!postAssessmentRules.isEmpty()){
231
+                for (PostAssessmentRules postAssessmentRule : postAssessmentRules) {
232
+                    PostAssessmentRatingOtherInfo info = new PostAssessmentRatingOtherInfo();
233
+                    info.setId(Long.parseLong(IdWorker.getIdStr().substring(4)));
234
+                    info.setRatingOtherId(postAssessmentRatingOtherOther.getId());
235
+                    info.setDutyType(postAssessmentRule.getDutyType());
236
+                    info.setScoreWeight(new BigDecimal(postAssessmentRule.getFullScore()));
237
+                    info.setByDeptId(deptId);
238
+                    info.setCreateDefault();
239
+                    postAssessmentRatingOtherInfoMapper.insert(info);
240
+                }
241
+
242
+            }
284 243
         }
285
-        return 0;
244
+        return 1;
286 245
     }
287 246
 
288
-    /**
289
-     * 初始化13个职能部门评分 类型:1-职能互评;
290
-     *
291
-     * @param startTime 评分时间
292
-     */
293
-    @Transactional(rollbackFor = Exception.class)
294
-    public int batchAddRatingOtherZhiNengDept(Date startTime) {
295
-        //TODO 待开发:
247
+    @Override
248
+    public int batchAddRatingOtherUpdate(PostAssessmentRatingOther postAssessmentRatingOther) {
249
+        List<PostAssessmentRatingOther> postAssessmentRatingOthers = postAssessmentRatingOtherMapper.selectList(Wrappers.<PostAssessmentRatingOther>lambdaQuery()
250
+                .eq(PostAssessmentRatingOther::getBatchId,postAssessmentRatingOther.getBatchId())
251
+        );
252
+        if (postAssessmentRatingOthers.isEmpty()){
253
+            throw new RuntimeException("提交失败");
254
+        }
255
+        List<Long> collect = postAssessmentRatingOthers.stream().map(PostAssessmentRatingOther::getId).collect(Collectors.toList());
256
+        List<PostAssessmentRatingOtherInfo> info = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
257
+                .in(PostAssessmentRatingOtherInfo::getRatingOtherId,collect)
258
+        );
259
+        List<PostAssessmentRatingOtherInfo> children = postAssessmentRatingOther.getChildren();
260
+        children.forEach(x->{
261
+            List<PostAssessmentRatingOtherInfoDept> dept = x.getChildren();
262
+            dept.forEach(y->{
263
+                List<PostAssessmentRatingOtherInfo> collect1 = info.stream().filter(d -> d.getByDeptId().equals(y.getByDeptId()) && d.getDutyType().equals(x.getDutyType())).collect(Collectors.toList());
264
+                for (PostAssessmentRatingOtherInfo postAssessmentRatingOtherInfo : collect1) {
265
+                    postAssessmentRatingOtherInfo.setUpdateDefault();
266
+                    postAssessmentRatingOtherInfo.setByDeptScore(y.getByDeptScore());
267
+                    postAssessmentRatingOtherInfoMapper.updateById(postAssessmentRatingOtherInfo);
268
+                }
269
+            });
270
+        });
296 271
         return 1;
297 272
     }
298 273
 
299
-
300
-    /**
301
-     * 初始化13个生产部门评分 类型:2-生产日常;
302
-     *
303
-     * @param startTime 评分时间
304
-     */
305
-    @Transactional(rollbackFor = Exception.class)
306
-    public int batchAddRatingOtherShengChanDept(Date startTime) {
307
-        //TODO 待开发:
274
+    @Override
275
+    public int productionDepartmentSub(List<PostAssessmentRatingOther> postAssessmentRatingOther) {
276
+        for (PostAssessmentRatingOther assessmentRatingOther : postAssessmentRatingOther) {
277
+            List<PostAssessmentRatingOtherInfo> children = assessmentRatingOther.getChildren();
278
+            children.forEach(x->{
279
+                PostAssessmentRatingOtherInfo info = new PostAssessmentRatingOtherInfo();
280
+                info.setId(x.getId());
281
+                info.setByDeptScore(x.getByDeptScore());
282
+                info.setUpdateDefault();
283
+                postAssessmentRatingOtherInfoMapper.updateById(info);
284
+            });
285
+        }
308 286
         return 1;
309 287
     }
288
+
310 289
 }

+ 95 - 5
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostAssessmentRatingServiceImpl.java

@@ -1,12 +1,26 @@
1 1
 package com.ruoyi.postCheck.service.impl;
2 2
 
3
+import java.math.BigDecimal;
4
+import java.util.ArrayList;
3 5
 import java.util.List;
6
+import java.util.Map;
7
+import java.util.Optional;
8
+import java.util.Set;
9
+import java.util.stream.Collectors;
4 10
 
5 11
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
6 12
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 13
 import com.ruoyi.common.utils.DateUtils;
8 14
 import com.ruoyi.postCheck.domain.PostAssessmentRatingOther;
15
+import com.ruoyi.postCheck.domain.PostAssessmentRatingOtherInfo;
16
+import com.ruoyi.postCheck.domain.PostAssessmentRules;
17
+import com.ruoyi.postCheck.domain.PostCheckedProblem;
18
+import com.ruoyi.postCheck.mapper.PostAssessmentRatingOtherInfoMapper;
9 19
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingOtherMapper;
20
+import com.ruoyi.postCheck.mapper.PostAssessmentRulesMapper;
21
+import com.ruoyi.postCheck.mapper.PostCheckedProblemMapper;
22
+import com.ruoyi.postCheck.mapper.PostPlanInfoMapper;
23
+import com.ruoyi.postCheck.mapper.PostPlanMapper;
10 24
 import org.springframework.beans.factory.annotation.Autowired;
11 25
 import org.springframework.stereotype.Service;
12 26
 import com.ruoyi.postCheck.mapper.PostAssessmentRatingMapper;
@@ -23,8 +37,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
23 37
 @Service
24 38
 public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentRatingMapper, PostAssessmentRating> implements IPostAssessmentRatingService {
25 39
     @Autowired
40
+    private PostAssessmentRatingOtherMapper postAssessmentRatingOtherMapper;
41
+    @Autowired
42
+    private PostAssessmentRatingOtherInfoMapper postAssessmentRatingOtherInfoMapper;
43
+    @Autowired
26 44
     private PostAssessmentRatingMapper postAssessmentRatingMapper;
27
-
45
+    @Autowired
46
+    private PostCheckedProblemMapper postCheckedProblemMapper;
47
+    @Autowired
48
+    private PostPlanInfoMapper postPlanInfoMapper;
49
+    @Autowired
50
+    private PostPlanMapper postPlanMapper;
51
+    @Autowired
52
+    private PostAssessmentRulesMapper postAssessmentRulesMapper;
28 53
     /**
29 54
      * 查询考核评比
30 55
      *
@@ -44,10 +69,75 @@ public class PostAssessmentRatingServiceImpl extends ServiceImpl<PostAssessmentR
44 69
      */
45 70
     @Override
46 71
     public List<PostAssessmentRating> selectPostAssessmentRatingList(PostAssessmentRating postAssessmentRating) {
47
-        List<PostAssessmentRating> postAssessmentRatings = postAssessmentRatingMapper.selectPostAssessmentRatingList(postAssessmentRating);
48
-        postAssessmentRatings.forEach(x->{
49
-            x.setDeptIdStr(postAssessmentRatingMapper.getSysDeptName(x.getDeptId()));
50
-        });
72
+        // type 1 是职能管理部门, 2 生产运营部门
73
+        Integer type;
74
+        if (postAssessmentRating.getType() == 2){
75
+            type = 3;
76
+        } else {
77
+            type = 2;
78
+        }
79
+        List<PostAssessmentRating> postAssessmentRatings = new ArrayList<>();
80
+        List<Map<String, String>> deptIdListByType = postAssessmentRatingOtherMapper.getDeptIdListByType(postAssessmentRating.getType());
81
+        List<PostAssessmentRules> postAssessmentRules = postAssessmentRulesMapper.selectList(Wrappers.lambdaQuery());
82
+        for (Map<String, String> map : deptIdListByType) {
83
+            PostAssessmentRating post = new PostAssessmentRating();
84
+            post.setDeptId(Long.parseLong(map.get("deptId")));
85
+            post.setDeptIdStr(String.valueOf(map.get("deptName")));
86
+            // 计算一个部门的岗检得分
87
+            // 1 先查询问题
88
+            BigDecimal postSouce = new BigDecimal("100");
89
+            List<PostCheckedProblem> postCheckedProblems = postCheckedProblemMapper.selectList(Wrappers.<PostCheckedProblem>lambdaQuery()
90
+                    .eq(PostCheckedProblem::getCheckedDeptId,post.getDeptId())
91
+            );
92
+            BigDecimal postTotal = postCheckedProblemMapper.getPostTotalByDeptId(post.getDeptId());
93
+            if (postCheckedProblems.size() > 0){
94
+                // 计算扣除分数
95
+                BigDecimal postAfter = new BigDecimal("100");
96
+                Set<PostAssessmentRules> collect = postAssessmentRules.stream().filter(d -> d.getType() == type).collect(Collectors.toSet());
97
+                for (PostCheckedProblem postCheckedProblem : postCheckedProblems) {
98
+                    Optional<PostAssessmentRules> first = postAssessmentRules.stream().filter(d ->d.getType() == type && d.getDutyType().equals(postCheckedProblem.getDutyType())).findFirst();
99
+                    if (first.isPresent()){
100
+                        if (postCheckedProblem.getProblemLevel().equals("1")){
101
+                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelOne())));
102
+                        }else{
103
+                            postAfter = postAfter.subtract(new BigDecimal(String.valueOf(first.get().getProblemLevelTwo())));
104
+                        }
105
+                    }
106
+                }
107
+                // 计算系数 1-问题总数/需要查的问题数
108
+                BigDecimal divide = new BigDecimal(postCheckedProblems.size()).divide(postTotal.multiply(new BigDecimal(collect.size())));
109
+                if (divide.compareTo(new BigDecimal("1")) < 0 && divide.compareTo(new BigDecimal("0")) > 0 ){
110
+                    postSouce = postAfter.multiply(new BigDecimal("1").subtract(divide));
111
+                }else{
112
+                    postSouce = new BigDecimal("0");
113
+                }
114
+            }else {
115
+                postSouce = new BigDecimal("0");
116
+            }
117
+            post.setPositionScore(postSouce);
118
+            // 计算互评得分
119
+
120
+            List<PostAssessmentRatingOtherInfo> postAssessmentRatingOtherInfos = postAssessmentRatingOtherInfoMapper.selectList(Wrappers.<PostAssessmentRatingOtherInfo>lambdaQuery()
121
+                    .eq(PostAssessmentRatingOtherInfo::getByDeptId,post.getDeptId())
122
+                    .apply("and \"rating_other_id\" in (SELECT \"id\" FROM \"public\".\"post_assessment_rating_other\" WHERE \"type\"  = 1\n)")
123
+                    .orderByAsc(PostAssessmentRatingOtherInfo::getByDeptScore)
124
+            );
125
+            BigDecimal peerEvaluationScore = new BigDecimal("100");
126
+            if (postAssessmentRatingOtherInfos.size()>0){
127
+                postAssessmentRatingOtherInfos.remove(postAssessmentRatingOtherInfos.size()-1);
128
+                postAssessmentRatingOtherInfos.remove(0);
129
+                BigDecimal sum = new BigDecimal("0");
130
+                postAssessmentRatingOtherInfos.forEach(x -> {
131
+                    sum.add(x.getByDeptScore());
132
+                });
133
+                peerEvaluationScore = sum.divide(new BigDecimal(postAssessmentRatingOtherInfos.size()));
134
+            }
135
+            post.setPeerEvaluationScore(peerEvaluationScore);
136
+            postAssessmentRatings.add(post);
137
+            // 计算总得分
138
+            post.setDepartmentScore(post.getPositionScore().add(post.getPeerEvaluationScore()).divide(new BigDecimal("2")));
139
+        }
140
+        // 计算  岗检得分
51 141
         return postAssessmentRatings;
52 142
     }
53 143
 

+ 19 - 4
ruoyi-postcheck/src/main/java/com/ruoyi/postCheck/service/impl/PostCheckedProblemServiceImpl.java

@@ -131,8 +131,6 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
131 131
                 throw new BaseException("第" + count + "行更新失败请检查!");
132 132
             }
133 133
         }
134
-        // 计算岗检排名得分
135
-        jobInspectionScore(postCheckedProblemList);
136 134
         return 1;
137 135
     }
138 136
 
@@ -177,9 +175,26 @@ public class PostCheckedProblemServiceImpl extends ServiceImpl<PostCheckedProble
177 175
                 }
178 176
             }
179 177
         }
180
-        if (score.compareTo(new BigDecimal("0")) < 0)
178
+
179
+        // todo 公式计算
180
+        if (postCheckedProblems.size()>0){
181
+            BigDecimal bigDecimal = new BigDecimal("1");
182
+            List<PostPlanInfo> postPlanInfos = postPlanInfoMapper.selectList(Wrappers.<PostPlanInfo>lambdaQuery()
183
+                    .eq(PostPlanInfo::getPostPlanId,postPlan.getId())
184
+            );
185
+            if (postPlanInfos.size() <= 0){
186
+                score = new BigDecimal("0");
187
+            }else{
188
+                BigDecimal divide = new BigDecimal(postCheckedProblems.size()).divide(new BigDecimal(postPlanInfos.size()).multiply(new BigDecimal("6")));
189
+                if (divide.compareTo(new BigDecimal("0"))<=0 || divide.compareTo(new BigDecimal("1")) > 0){
190
+                    score = new BigDecimal("0");
191
+                }else{
192
+                    score = bigDecimal.subtract(divide);
193
+                }
194
+            }
195
+        }else{
181 196
             score = new BigDecimal("0");
182
-        // todo 公式不完整
197
+        }
183 198
         postAssessmentRatingMapper.update(null,Wrappers.<PostAssessmentRating>lambdaUpdate()
184 199
                 .set(PostAssessmentRating::getPositionScore,score)
185 200
                 .eq(PostAssessmentRating::getDeptId,departmentId)

+ 67 - 6
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostAssessmentRatingOtherMapper.xml

@@ -3,7 +3,7 @@
3 3
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 4
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.ruoyi.postCheck.mapper.PostAssessmentRatingOtherMapper">
6
-    
6
+
7 7
     <resultMap type="PostAssessmentRatingOther" id="PostAssessmentRatingOtherResult">
8 8
         <result property="id"    column="id"    />
9 9
         <result property="type"    column="type"    />
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
29 29
 
30 30
     <select id="selectPostAssessmentRatingOtherList" parameterType="PostAssessmentRatingOther" resultMap="PostAssessmentRatingOtherResult">
31 31
         <include refid="selectPostAssessmentRatingOtherVo"/>
32
-        <where>  
32
+        <where>
33 33
             <if test="type != null "> and type = #{type}</if>
34 34
             <if test="batchId != null  and batchId != ''"> and batch_id = #{batchId}</if>
35 35
             <if test="startTime != null "> and start_time = #{startTime}</if>
@@ -41,12 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
41 41
             <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
42 42
         </where>
43 43
     </select>
44
-    
44
+
45 45
     <select id="selectPostAssessmentRatingOtherById" parameterType="Long" resultMap="PostAssessmentRatingOtherResult">
46 46
         <include refid="selectPostAssessmentRatingOtherVo"/>
47 47
         where id = #{id}
48 48
     </select>
49
-        
49
+
50 50
     <insert id="insertPostAssessmentRatingOther" parameterType="PostAssessmentRatingOther">
51 51
         insert into post_assessment_rating_other
52 52
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -114,9 +114,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
114 114
     </delete>
115 115
 
116 116
     <delete id="deletePostAssessmentRatingOtherByIds" parameterType="String">
117
-        delete from post_assessment_rating_other where id in 
117
+        delete from post_assessment_rating_other where id in
118 118
         <foreach item="id" collection="array" open="(" separator="," close=")">
119 119
             #{id}
120 120
         </foreach>
121 121
     </delete>
122
-</mapper>
122
+
123
+    <select id="getDeptIdList" resultType="java.lang.Long">
124
+        SELECT "dept_id"
125
+        FROM "public"."sys_dept" where "dept_id" != #{id};
126
+    </select>
127
+
128
+
129
+
130
+    <select id="selectPostAssessmentRatingOtherListGroup"
131
+            resultType="com.ruoyi.postCheck.domain.PostAssessmentRatingOther">
132
+        select
133
+        max("id") id,
134
+        max("type") "type",
135
+        max("batch_id") batch_id,
136
+        max("start_time") start_time,
137
+        max("status") status,
138
+        max("dept_id") dept_id,
139
+        max("complete_time") complete_time,
140
+        max("score_user_id") score_user_id,
141
+        max("score_user_name") score_user_name,
142
+        max("create_user_id") create_user_id,
143
+        max("remark") remark,
144
+        max("del_flag") del_flag,
145
+        max("create_time") create_time,
146
+        max("create_by") create_by,
147
+        max("update_time") update_time from post_assessment_rating_other
148
+        <where>
149
+            <if test="type != null ">
150
+                and type = #{type}
151
+            </if>
152
+            <if test="batchId != null  and batchId != ''">
153
+                and batch_id = #{batchId}
154
+            </if>
155
+            <if test="startTime != null ">
156
+                and start_time = #{startTime}
157
+            </if>
158
+            <if test="status != null ">
159
+                and status = #{status}
160
+            </if>
161
+            <if test="deptId != null ">
162
+                and dept_id = #{deptId}
163
+            </if>
164
+            <if test="completeTime != null ">
165
+                and complete_time = #{completeTime}
166
+            </if>
167
+            <if test="scoreUserId != null ">
168
+                and score_user_id = #{scoreUserId}
169
+            </if>
170
+            <if test="scoreUserName != null  and scoreUserName != ''">
171
+                and score_user_name like concat('%', #{scoreUserName}, '%')
172
+            </if>
173
+            <if test="createUserId != null ">
174
+                and create_user_id = #{createUserId}
175
+            </if>
176
+        </where>
177
+        group by batch_id
178
+    </select>
179
+
180
+    <select id="getDeptIdListByType" resultType="java.util.Map">
181
+        SELECT "dept_id" as deptId,"dept_name" as deptName FROM "public"."sys_dept" where "type" = #{type};
182
+    </select>
183
+</mapper>

+ 7 - 0
ruoyi-postcheck/src/main/resources/mapper/postCheck/PostCheckedProblemMapper.xml

@@ -292,4 +292,11 @@
292 292
             #{id}
293 293
         </foreach>
294 294
     </delete>
295
+
296
+    <select id="getPostTotalByDeptId" resultType="java.math.BigDecimal">
297
+        SELECT COUNT(0)
298
+        FROM "public"."sys_user_post" a LEFT JOIN "public"."sys_user_role" sur ON a."user_id"  = sur."user_id"
299
+                                        LEFT JOIN "public"."sys_role_dept" srd ON sur."role_id"  = srd."role_id"
300
+        WHERE srd."dept_id" = #{deptId} GROUP BY a."post_id"
301
+    </select>
295 302
 </mapper>