From 4dbf61c9189796ec46d39ac4b839cfc064e70411 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 12 八月 2021 16:11:16 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity
---
service-report/src/main/java/com/java110/report/api/ReportInfoAnswerValueApi.java | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/service-report/src/main/java/com/java110/report/api/ReportInfoAnswerValueApi.java b/service-report/src/main/java/com/java110/report/api/ReportInfoAnswerValueApi.java
index 730b829..a6a7ca4 100644
--- a/service-report/src/main/java/com/java110/report/api/ReportInfoAnswerValueApi.java
+++ b/service-report/src/main/java/com/java110/report/api/ReportInfoAnswerValueApi.java
@@ -1,5 +1,6 @@
package com.java110.report.api;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.reportInfoAnswerValue.ReportInfoAnswerValueDto;
import com.java110.po.reportInfoAnswerValue.ReportInfoAnswerValuePo;
@@ -35,7 +36,7 @@
* @return
*/
@RequestMapping(value = "/saveReportInfoAnswerValue", method = RequestMethod.POST)
- public ResponseEntity<String> saveReportInfoAnswerValue(@RequestBody JSONObject reqJson) {
+ public ResponseEntity<String> saveReportInfoAnswerValue(@RequestHeader(value = "user-id") String userId,@RequestBody JSONObject reqJson) {
Assert.hasKeyAndValue(reqJson, "anValueId", "璇锋眰鎶ユ枃涓湭鍖呭惈anValueId");
Assert.hasKeyAndValue(reqJson, "userAnId", "璇锋眰鎶ユ枃涓湭鍖呭惈userAnId");
@@ -44,10 +45,21 @@
Assert.hasKeyAndValue(reqJson, "valueId", "璇锋眰鎶ユ枃涓湭鍖呭惈valueId");
Assert.hasKeyAndValue(reqJson, "valueContent", "璇锋眰鎶ユ枃涓湭鍖呭惈valueContent");
Assert.hasKeyAndValue(reqJson, "communityId", "璇锋眰鎶ユ枃涓湭鍖呭惈communityId");
+ Assert.hasKey(reqJson, "questionAnswerTitles", "鏈寘鍚洖绛旈」");
+ JSONArray questionAnswerTitles = reqJson.getJSONArray("questionAnswerTitles");
+ if (questionAnswerTitles == null || questionAnswerTitles.size() < 1) {
+ throw new IllegalArgumentException("鏈寘鍚瓟妗�");
+ }
+ JSONObject titleObj = null;
+ for (int questionAnswerTitleIndex = 0; questionAnswerTitleIndex < questionAnswerTitles.size(); questionAnswerTitleIndex++) {
+ titleObj = questionAnswerTitles.getJSONObject(questionAnswerTitleIndex);
+ Assert.hasKeyAndValue(titleObj, "valueContent", titleObj.getString("qaTitle") + ",鏈~鍐欑瓟妗�");
+ }
ReportInfoAnswerValuePo reportInfoAnswerValuePo = BeanConvertUtil.covertBean(reqJson, ReportInfoAnswerValuePo.class);
- return saveReportInfoAnswerValueBMOImpl.save(reportInfoAnswerValuePo);
+
+ return saveReportInfoAnswerValueBMOImpl.save(reportInfoAnswerValuePo,questionAnswerTitles);
}
/**
--
Gitblit v1.8.0