|
@@ -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 代表可以答题
|