From 8a2a463d46b3dce73015462c9f6a2a258dd25f5b Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期五, 25 二月 2022 11:40:11 +0800
Subject: [PATCH] 优化diamante
---
service-report/src/main/java/com/java110/report/api/ReportInfoAnswerValueApi.java | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 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 e8ea88e..f3d280a 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,19 +36,24 @@
* @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");
+ Assert.hasKeyAndValue(reqJson, "questionAnswerTitles", "璇锋眰鎶ユ枃涓湭鍖呭惈鍥炵瓟椤�");
Assert.hasKeyAndValue(reqJson, "settingId", "璇锋眰鎶ユ枃涓湭鍖呭惈settingId");
- Assert.hasKeyAndValue(reqJson, "titleId", "璇锋眰鎶ユ枃涓湭鍖呭惈titleId");
- Assert.hasKeyAndValue(reqJson, "valueId", "璇锋眰鎶ユ枃涓湭鍖呭惈valueId");
- Assert.hasKeyAndValue(reqJson, "valueContent", "璇锋眰鎶ユ枃涓湭鍖呭惈valueContent");
Assert.hasKeyAndValue(reqJson, "communityId", "璇锋眰鎶ユ枃涓湭鍖呭惈communityId");
+ JSONArray questionAnswerTitles = reqJson.getJSONArray("questionAnswerTitles");
- ReportInfoAnswerValuePo reportInfoAnswerValuePo = BeanConvertUtil.covertBean(reqJson, ReportInfoAnswerValuePo.class);
- return saveReportInfoAnswerValueBMOImpl.save(reportInfoAnswerValuePo);
+ 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("title") + ",鏈~鍐欑瓟妗�");
+ }
+
+ return saveReportInfoAnswerValueBMOImpl.save(reqJson,userId);
}
/**
@@ -101,14 +107,20 @@
*/
@RequestMapping(value = "/queryReportInfoAnswerValue", method = RequestMethod.GET)
public ResponseEntity<String> queryReportInfoAnswerValue(@RequestParam(value = "communityId") String communityId,
- @RequestParam(value = "titleId") String titleId,
+ @RequestParam(value = "userName",required = false) String userName,
+ @RequestParam(value = "repName",required = false) String repName,
+ @RequestParam(value = "repTitle",required = false) String repTitle,
+ @RequestParam(value = "valueContent",required = false) String valueContent,
@RequestParam(value = "page") int page,
@RequestParam(value = "row") int row) {
ReportInfoAnswerValueDto reportInfoAnswerValueDto = new ReportInfoAnswerValueDto();
reportInfoAnswerValueDto.setPage(page);
reportInfoAnswerValueDto.setRow(row);
reportInfoAnswerValueDto.setCommunityId(communityId);
- reportInfoAnswerValueDto.setTitleId(titleId);
+ reportInfoAnswerValueDto.setUserName(userName);
+ reportInfoAnswerValueDto.setRepName(repName);
+ reportInfoAnswerValueDto.setRepTitle(repTitle);
+ reportInfoAnswerValueDto.setValueContent(valueContent);
return getReportInfoAnswerValueBMOImpl.get(reportInfoAnswerValueDto);
}
}
--
Gitblit v1.8.0