-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openubmc新增搜索反馈 #281
openubmc新增搜索反馈 #281
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
import com.datastat.model.CustomPropertiesConfig; | ||
import com.datastat.model.IsvCount; | ||
import com.datastat.model.NpsBody; | ||
import com.datastat.model.OpenUbmcSearchNps; | ||
import com.datastat.model.QaBotRequestBody; | ||
import com.datastat.model.SigDetails; | ||
import com.datastat.model.SigDetailsMaintainer; | ||
|
@@ -3708,6 +3709,44 @@ public String putGlobalNpsIssue(CustomPropertiesConfig queryConf, String token, | |
} | ||
} | ||
|
||
public String putSearchOpeUbmcIssue(CustomPropertiesConfig queryConf, String token, String community, OpenUbmcSearchNps body) { | ||
HashMap<String, Object> resMap = objectMapper.convertValue(body, new TypeReference<HashMap<String, Object>>() { | ||
}); | ||
resMap.put("community", community); | ||
if (token == null) { | ||
logger.info("Token is not allowed null"); | ||
throw new IllegalArgumentException("Token can not be null"); | ||
} | ||
String userId = userIdDao.getUserIdByCommunity(token, community); | ||
if(null == userId || userId.equals("")) { | ||
logger.info("UserId is null"); | ||
throw new IllegalArgumentException("UserId is null"); | ||
} | ||
resMap.put("userId", userId); | ||
try { | ||
Date now = new Date(); | ||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); | ||
String nowStr = simpleDateFormat.format(now); | ||
String uuid = UUID.randomUUID().toString(); | ||
resMap.put("created_at", nowStr); | ||
BulkRequest request = new BulkRequest(); | ||
RestHighLevelClient restHighLevelClient = getRestHighLevelClient(); | ||
IndexRequest indexRequest = new IndexRequest(queryConf.getOpenubmcSearchNpsIndex()); | ||
String s = queryConf.getOpenubmcSearchNpsIndex(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 未使用的变量 |
||
indexRequest.id(uuid); | ||
indexRequest.source(resMap, XContentType.JSON); | ||
request.add(indexRequest); | ||
if (request.requests().size() != 0) { | ||
restHighLevelClient.bulk(request, RequestOptions.DEFAULT); | ||
} | ||
restHighLevelClient.close(); | ||
return ResultUtil.resultJsonStr(200, objectMapper.valueToTree("success"), "success"); | ||
} catch (Exception e) { | ||
logger.error("Search nps issue exception - {}", e.getMessage()); | ||
return ResultUtil.resultJsonStr(400, null, "error"); | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 功能类似,可以考虑代码重用 |
||
@SneakyThrows | ||
public String queryGlobalIssues(CustomPropertiesConfig queryConf, String userId, ContributeRequestParams params) { | ||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* This project is licensed under the Mulan PSL v2. | ||
You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
You may obtain a copy of Mulan PSL v2 at: | ||
http://license.coscl.org.cn/MulanPSL2 | ||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
PURPOSE. | ||
See the Mulan PSL v2 for more details. | ||
Create: 2023 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 日期错误 |
||
*/ | ||
|
||
package com.datastat.model; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 请添加 copy right |
||
|
||
import com.datastat.aop.moderation.ModerationValid; | ||
|
||
import jakarta.validation.constraints.Pattern; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class OpenUbmcSearchNps { | ||
|
||
private Boolean searchFlag; | ||
|
||
@Size(max = 100, message = "the length can not exceed 100") | ||
@Pattern(regexp = "^[^<>%&$]*$", message = "Text format error") | ||
@ModerationValid | ||
private String feedbackText; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QaBotRequestBody 删除后是否有影响
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无影响,这个没有使用过,在vscode中被标注出来了