Yansen 2 years ago
parent
commit
03593f2f99

db/.back_文明创办/文明创办-backup-2023216160334.pdma.json → db/.back_文明创办/文明创办-backup-2023217134109.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-2-13 11:18:21",
7
+  "updatedTime": "2023-2-16 16:03:34",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -5219,7 +5219,7 @@
5219 5219
       "fields": [
5220 5220
         {
5221 5221
           "defKey": "item_id",
5222
-          "defName": "点位ID",
5222
+          "defName": "测评项目ID",
5223 5223
           "comment": "",
5224 5224
           "type": "",
5225 5225
           "len": 32,

+ 35
- 1
db/文明创办.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-2-16 16:03:34",
7
+  "updatedTime": "2023-2-17 13:41:09",
8 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -4833,6 +4833,40 @@
4833 4833
           "domain": "",
4834 4834
           "id": "F2E17D81-03A9-42C4-8DD7-732C8D40DC59"
4835 4835
         },
4836
+        {
4837
+          "defKey": "loc_score_percent",
4838
+          "defName": "实地测评得分占比",
4839
+          "comment": "",
4840
+          "type": "DECIMAL",
4841
+          "len": 6,
4842
+          "scale": 2,
4843
+          "primaryKey": false,
4844
+          "notNull": false,
4845
+          "autoIncrement": false,
4846
+          "defaultValue": "",
4847
+          "hideInGraph": false,
4848
+          "refDict": "",
4849
+          "extProps": {},
4850
+          "domain": "",
4851
+          "id": "DE02FAE0-A53F-4F6F-BB1B-B1669DD46C82"
4852
+        },
4853
+        {
4854
+          "defKey": "survey_score_percent",
4855
+          "defName": "调查问卷得分占比",
4856
+          "comment": "",
4857
+          "type": "DECIMAL",
4858
+          "len": 6,
4859
+          "scale": 2,
4860
+          "primaryKey": false,
4861
+          "notNull": false,
4862
+          "autoIncrement": false,
4863
+          "defaultValue": "",
4864
+          "hideInGraph": false,
4865
+          "refDict": "",
4866
+          "extProps": {},
4867
+          "domain": "",
4868
+          "id": "85BA110E-FCC5-4FC5-BE12-2C83C3D0EC27"
4869
+        },
4836 4870
         {
4837 4871
           "defKey": "start_date",
4838 4872
           "defName": "开始日期",

+ 7
- 6
src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java View File

@@ -74,7 +74,8 @@ public class TaCheckItemController extends BaseController {
74 74
     @GetMapping("/taCheck/{checkId}/item/{typeId}")
75 75
     public ResponseBean queryByCheckId(@ApiParam("测评ID") @PathVariable String checkId,
76 76
                                        @ApiParam("点位ID 或者 调查问卷") @PathVariable String typeId) throws Exception {
77
-        TaCheckItem taCheckItem = getByCheckAndType(checkId, typeId);
77
+        String itemType = StringUtils.isEmpty(typeId) || Constants.CHECK_OF_SURVEY.equals(typeId) ? Constants.CHECK_OF_SURVEY : Constants.CHECK_OF_LOC;
78
+        TaCheckItem taCheckItem = getByCheckAndType(checkId, typeId, itemType);
78 79
         if (null == taCheckItem || Constants.STATUS_DELETE == taCheckItem.getStatus()) {
79 80
             return ResponseBean.error("未找到测评项目");
80 81
         }
@@ -87,11 +88,11 @@ public class TaCheckItemController extends BaseController {
87 88
         return ResponseBean.success(taCheckItem);
88 89
     }
89 90
 
90
-    private TaCheckItem getByCheckAndType(String checkId, String typeId) {
91
+    private TaCheckItem getByCheckAndType(String checkId, String typeId, String itemType) {
91 92
         QueryWrapper<TaCheckItem> queryWrapper = new QueryWrapper<>();
92 93
         queryWrapper.eq("check_id", checkId);
93 94
 
94
-        if (Constants.CHECK_OF_SURVEY.equals(typeId)) {
95
+        if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
95 96
             queryWrapper.eq("item_type", Constants.CHECK_OF_SURVEY);
96 97
         } else {
97 98
             queryWrapper.eq("item_type", Constants.CHECK_OF_LOC); // 只查点位
@@ -151,7 +152,7 @@ public class TaCheckItemController extends BaseController {
151 152
             }
152 153
         }
153 154
 
154
-        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getTypeId());
155
+        TaCheckItem origin = getByCheckAndType(taCheckItem.getCheckId(), taCheckItem.getTypeId(), taCheckItem.getItemType());
155 156
         if (null == origin) {
156 157
             // 新增
157 158
             taCheckItem.setStatus(Constants.STATUS_NORMAL);
@@ -192,7 +193,7 @@ public class TaCheckItemController extends BaseController {
192 193
             }});
193 194
         }
194 195
 
195
-        if (Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
196
+//        if (Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
196 197
             int cnt = taCheckAnswerService.countByItem(taCheckItem.getItemId());
197 198
             if (cnt >= taCheckItem.getNum()) {
198 199
                 return ResponseBean.success(new HashMap<String, Object>(){{
@@ -200,7 +201,7 @@ public class TaCheckItemController extends BaseController {
200 201
                     put("message", "当前问卷已收齐, 无须作答");
201 202
                 }});
202 203
             }
203
-        }
204
+//        }
204 205
 
205 206
         return ResponseBean.success(new HashMap<String, Object>(){{
206 207
             put("errorCode", 0);    // 0 代表可以答题

+ 6
- 0
src/main/java/com/example/civilizedcity/entity/TaCheck.java View File

@@ -39,6 +39,12 @@ public class TaCheck implements Serializable,Cloneable{
39 39
        /** 调查问卷得分 */
40 40
        @ApiModelProperty(name = "调查问卷得分",notes = "")
41 41
        private Double surveyScore ;
42
+     /** 实地测评得分占比 */
43
+     @ApiModelProperty(name = "实地测评得分占比",notes = "")
44
+     private Double locScorePercent ;
45
+     /** 调查问卷得分占比 */
46
+     @ApiModelProperty(name = "调查问卷得分占比",notes = "")
47
+     private Double surveyScorePercent ;
42 48
       /** 开始日期;YYYY-MM-DD */
43 49
       @ApiModelProperty(name = "开始日期",notes = "YYYY-MM-DD")
44 50
       private String startDate ;

+ 9
- 18
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java View File

@@ -113,12 +113,13 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
113 113
 
114 114
             // 每份试卷的得分 = 总分 / 份数
115 115
             double maxScore = taCheckItem.getFullScore()  / taCheckItem.getNum();
116
-            double totalScore = maxScore + negativeScore + positiveScore;
117
-
118
-            if (0 > totalScore) {
119
-                // 如果扣分项太多
120
-                totalScore = 0.0;
121
-            }
116
+            double totalScore = negativeScore + positiveScore;
117
+//            double totalScore = maxScore + negativeScore + positiveScore;
118
+//
119
+//            if (0 > totalScore) {
120
+//                // 如果扣分项太多
121
+//                totalScore = 0.0;
122
+//            }
122 123
             if (totalScore > maxScore) {
123 124
                 // 如果得分超过总分
124 125
                 totalScore = maxScore;
@@ -186,18 +187,8 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
186 187
             if (score > 0) {
187 188
                 positiveScore += score;
188 189
             } else {
189
-//                negativeScore += score;
190
-
191
-                // 扣分项
192
-                if (sign < 0) {
193
-                    mustCreateIssue = true;
194
-                    score = qu.getMaxScore() - score;
195
-                    if (score < 0) {
196
-                        score = 0;
197
-                    }
198
-
199
-                    positiveScore += score;
200
-                }
190
+                mustCreateIssue = true;
191
+                negativeScore += score;
201 192
             }
202 193
 
203 194
             // 保存附件

+ 34
- 1
src/main/java/com/example/civilizedcity/service/impl/TaCheckServiceImpl.java View File

@@ -68,6 +68,19 @@ public class TaCheckServiceImpl extends BaseServiceImpl<TaCheckMapper, TaCheck>
68 68
             checkItem.setScore(s);
69 69
             taCheckItemMapper.updateById(checkItem);
70 70
 
71
+            // 如果得到正分, 说明试卷得了满分
72
+            if (s > 0) {
73
+                s = checkItem.getFullScore();
74
+            }
75
+
76
+            // 如果产生扣分项
77
+            if (s < 0) {
78
+                s = checkItem.getFullScore() + s;
79
+                if (s < 0) {
80
+                    s = 0;
81
+                }
82
+            }
83
+
71 84
             totalScore += s;
72 85
         }
73 86
 
@@ -100,8 +113,10 @@ public class TaCheckServiceImpl extends BaseServiceImpl<TaCheckMapper, TaCheck>
100 113
             if (quList == null || quList.size() == 0) continue;
101 114
             int quNum = quList.size();
102 115
 
116
+            // 每份试卷的最大分数
117
+            double maxItemScore = 100.00 / copyNum;
103 118
             // 每题的最大分数
104
-            double maxStandScore = 100.00 / copyNum / quNum;
119
+            double maxStandScore = maxItemScore / quNum;
105 120
 
106 121
             // 总分
107 122
             double score = 0.0;
@@ -139,6 +154,10 @@ public class TaCheckServiceImpl extends BaseServiceImpl<TaCheckMapper, TaCheck>
139 154
                     quScore += s * ratio;
140 155
                 }
141 156
 
157
+                if (quScore > maxStandScore) {
158
+                    quScore = maxStandScore;
159
+                }
160
+
142 161
                 answer.setScore(quScore);
143 162
                 taCheckAnswerMapper.updateById(answer);
144 163
 
@@ -146,6 +165,20 @@ public class TaCheckServiceImpl extends BaseServiceImpl<TaCheckMapper, TaCheck>
146 165
                 score += quScore;
147 166
             }
148 167
 
168
+            // 如果是正数, 那么就是试卷的得分
169
+            // 但是不能超过最大值
170
+            if (score > maxItemScore) {
171
+                score = maxItemScore;
172
+            }
173
+
174
+            // 调查问卷理论上不会出现分数为负的情况
175
+            if (score < 0) {
176
+                score = maxItemScore + score;
177
+                if (score < 0) {
178
+                    score = 0;
179
+                }
180
+            }
181
+
149 182
             checkItem.setScore(score);
150 183
             taCheckItemMapper.updateById(checkItem);
151 184