From 8dfc08125b7a6fa89604ae01704ea843904c1f29 Mon Sep 17 00:00:00 2001 From: XieChengzhi Date: Wed, 11 Dec 2024 14:06:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?openubmc=E6=96=B0=E5=A2=9E=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datastat/controller/QueryController.java | 10 ++++- src/main/java/com/datastat/dao/QueryDao.java | 39 +++++++++++++++++++ src/main/java/com/datastat/dao/UserIdDao.java | 12 ++++++ .../model/CustomPropertiesConfig.java | 1 + .../com/datastat/model/OpenUbmcSearchNps.java | 30 ++++++++++++++ .../com/datastat/service/QueryService.java | 9 +++++ 6 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/datastat/model/OpenUbmcSearchNps.java diff --git a/src/main/java/com/datastat/controller/QueryController.java b/src/main/java/com/datastat/controller/QueryController.java index aa9a61a..b951ac4 100644 --- a/src/main/java/com/datastat/controller/QueryController.java +++ b/src/main/java/com/datastat/controller/QueryController.java @@ -21,7 +21,7 @@ import com.datastat.model.HmsExportDataReq; import com.datastat.model.IsvCount; import com.datastat.model.NpsBody; -import com.datastat.model.QaBotRequestBody; +import com.datastat.model.OpenUbmcSearchNps; import com.datastat.model.SigGathering; import com.datastat.model.TeamupApplyForm; import com.datastat.model.dto.ContributeRequestParams; @@ -766,6 +766,14 @@ public String putGlobalNpsIssue(HttpServletRequest request, @CookieValue(value = return queryService.putGlobalNpsIssue(request, token, community, body); } + @LimitRequest(callTime = 1, callCount = 1000) + @RateLimit + @RequestMapping(value = "/search/openubmc/issue", method = RequestMethod.POST) + public String putSearchOpeUbmcIssue(HttpServletRequest request, @CookieValue(value = "_Y_G_") String token, + @RequestParam(value = "community") String community, @Valid @RequestBody OpenUbmcSearchNps body) { + return queryService.putSearchOpeUbmcIssue(request, token, community,body); + } + @RequestMapping("/user/owner/repos") public String queryUserOwnerRepos(HttpServletRequest request, @RequestParam(value = "user") String user) throws Exception { diff --git a/src/main/java/com/datastat/dao/QueryDao.java b/src/main/java/com/datastat/dao/QueryDao.java index baebf3d..faa36d6 100644 --- a/src/main/java/com/datastat/dao/QueryDao.java +++ b/src/main/java/com/datastat/dao/QueryDao.java @@ -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 resMap = objectMapper.convertValue(body, new TypeReference>() { + }); + 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(); + 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"); + } + } + @SneakyThrows public String queryGlobalIssues(CustomPropertiesConfig queryConf, String userId, ContributeRequestParams params) { SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); diff --git a/src/main/java/com/datastat/dao/UserIdDao.java b/src/main/java/com/datastat/dao/UserIdDao.java index c271233..9a10648 100644 --- a/src/main/java/com/datastat/dao/UserIdDao.java +++ b/src/main/java/com/datastat/dao/UserIdDao.java @@ -41,4 +41,16 @@ public String getUserId(String token){ } return userId; } + + public String getUserIdByCommunity(String token, String community) { + String userId = null; + try { + RSAPrivateKey privateKey = RSAUtil.getPrivateKey(env.getProperty("rsa.authing." + community + ".privateKey")); + DecodedJWT decode = JWT.decode(RSAUtil.privateDecrypt(token, privateKey)); + userId = decode.getAudience().get(0); + } catch (Exception e) { + logger.error("parse token exception - {}", e.getMessage()); + } + return userId; + } } diff --git a/src/main/java/com/datastat/model/CustomPropertiesConfig.java b/src/main/java/com/datastat/model/CustomPropertiesConfig.java index c51aeb4..ba07ac8 100644 --- a/src/main/java/com/datastat/model/CustomPropertiesConfig.java +++ b/src/main/java/com/datastat/model/CustomPropertiesConfig.java @@ -113,6 +113,7 @@ public class CustomPropertiesConfig { private String modelEventIndex; private String datasetEventIndex; private String openmindRepoIndex; + private String openubmcSearchNpsIndex; // -- query str -- private String extOsQueryStr; diff --git a/src/main/java/com/datastat/model/OpenUbmcSearchNps.java b/src/main/java/com/datastat/model/OpenUbmcSearchNps.java new file mode 100644 index 0000000..d66db84 --- /dev/null +++ b/src/main/java/com/datastat/model/OpenUbmcSearchNps.java @@ -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 +*/ + +package com.datastat.model; + +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; + +} diff --git a/src/main/java/com/datastat/service/QueryService.java b/src/main/java/com/datastat/service/QueryService.java index 081f48d..0b2214a 100644 --- a/src/main/java/com/datastat/service/QueryService.java +++ b/src/main/java/com/datastat/service/QueryService.java @@ -35,6 +35,7 @@ import com.datastat.model.HmsExportDataReq; import com.datastat.model.IsvCount; import com.datastat.model.NpsBody; +import com.datastat.model.OpenUbmcSearchNps; import com.datastat.model.QaBotRequestBody; import com.datastat.model.SigGathering; import com.datastat.model.TeamupApplyForm; @@ -1576,6 +1577,14 @@ public String putGlobalNpsIssue(HttpServletRequest request, String token, String return queryDao.putGlobalNpsIssue(queryConf, token, community, body); } + public String putSearchOpeUbmcIssue(HttpServletRequest request, String token, String community, + OpenUbmcSearchNps body) { + if (!checkCommunity(community)) return ResultUtil.resultJsonStr(404, "error", "not found"); + QueryDao queryDao = getQueryDao(request); + CustomPropertiesConfig queryConf = getQueryConf(request); + return queryDao.putSearchOpeUbmcIssue(queryConf, token, community, body); + } + public String queryGolbalIssues(HttpServletRequest request,String token, ContributeRequestParams params) throws Exception { if (!checkCommunity(params.getCommunity())) return ResultUtil.resultJsonStr(404, "error", "not found"); if (token == null) { From 9cddbbadd6bd53eda5bdfd021e070a5af1bf7da7 Mon Sep 17 00:00:00 2001 From: XieChengzhi Date: Fri, 13 Dec 2024 11:09:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?openeuler=E5=A2=9E=E5=8A=A0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/datastat/controller/QueryController.java | 10 +++++----- src/main/java/com/datastat/dao/QueryDao.java | 8 +++----- .../com/datastat/model/CustomPropertiesConfig.java | 2 +- .../{OpenUbmcSearchNps.java => SearchIssueBody.java} | 6 ++++-- src/main/java/com/datastat/service/QueryService.java | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) rename src/main/java/com/datastat/model/{OpenUbmcSearchNps.java => SearchIssueBody.java} (92%) diff --git a/src/main/java/com/datastat/controller/QueryController.java b/src/main/java/com/datastat/controller/QueryController.java index b951ac4..d031738 100644 --- a/src/main/java/com/datastat/controller/QueryController.java +++ b/src/main/java/com/datastat/controller/QueryController.java @@ -21,7 +21,7 @@ import com.datastat.model.HmsExportDataReq; import com.datastat.model.IsvCount; import com.datastat.model.NpsBody; -import com.datastat.model.OpenUbmcSearchNps; +import com.datastat.model.SearchIssueBody; import com.datastat.model.SigGathering; import com.datastat.model.TeamupApplyForm; import com.datastat.model.dto.ContributeRequestParams; @@ -768,10 +768,10 @@ public String putGlobalNpsIssue(HttpServletRequest request, @CookieValue(value = @LimitRequest(callTime = 1, callCount = 1000) @RateLimit - @RequestMapping(value = "/search/openubmc/issue", method = RequestMethod.POST) - public String putSearchOpeUbmcIssue(HttpServletRequest request, @CookieValue(value = "_Y_G_") String token, - @RequestParam(value = "community") String community, @Valid @RequestBody OpenUbmcSearchNps body) { - return queryService.putSearchOpeUbmcIssue(request, token, community,body); + @RequestMapping(value = "/search/issue", method = RequestMethod.POST) + public String putSearchNpsByCommunity(HttpServletRequest request, @CookieValue(value = "_Y_G_") String token, + @RequestParam(value = "community") String community, @Valid @RequestBody SearchIssueBody body) { + return queryService.putSearchNpsByCommunity(request, token, community,body); } @RequestMapping("/user/owner/repos") diff --git a/src/main/java/com/datastat/dao/QueryDao.java b/src/main/java/com/datastat/dao/QueryDao.java index faa36d6..aedd5fb 100644 --- a/src/main/java/com/datastat/dao/QueryDao.java +++ b/src/main/java/com/datastat/dao/QueryDao.java @@ -18,7 +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.SearchIssueBody; import com.datastat.model.QaBotRequestBody; import com.datastat.model.SigDetails; import com.datastat.model.SigDetailsMaintainer; @@ -97,7 +97,6 @@ import java.net.InetAddress; import java.net.URL; import java.security.SecureRandom; -import java.security.interfaces.RSAPrivateKey; @Primary @Repository(value = "queryDao") @@ -3709,7 +3708,7 @@ public String putGlobalNpsIssue(CustomPropertiesConfig queryConf, String token, } } - public String putSearchOpeUbmcIssue(CustomPropertiesConfig queryConf, String token, String community, OpenUbmcSearchNps body) { + public String putSearchNpsByCommunity(CustomPropertiesConfig queryConf, String token, String community, SearchIssueBody body) { HashMap resMap = objectMapper.convertValue(body, new TypeReference>() { }); resMap.put("community", community); @@ -3731,8 +3730,7 @@ public String putSearchOpeUbmcIssue(CustomPropertiesConfig queryConf, String tok resMap.put("created_at", nowStr); BulkRequest request = new BulkRequest(); RestHighLevelClient restHighLevelClient = getRestHighLevelClient(); - IndexRequest indexRequest = new IndexRequest(queryConf.getOpenubmcSearchNpsIndex()); - String s = queryConf.getOpenubmcSearchNpsIndex(); + IndexRequest indexRequest = new IndexRequest(queryConf.getSearchNpsIndex()); indexRequest.id(uuid); indexRequest.source(resMap, XContentType.JSON); request.add(indexRequest); diff --git a/src/main/java/com/datastat/model/CustomPropertiesConfig.java b/src/main/java/com/datastat/model/CustomPropertiesConfig.java index ba07ac8..8caaa2f 100644 --- a/src/main/java/com/datastat/model/CustomPropertiesConfig.java +++ b/src/main/java/com/datastat/model/CustomPropertiesConfig.java @@ -113,7 +113,7 @@ public class CustomPropertiesConfig { private String modelEventIndex; private String datasetEventIndex; private String openmindRepoIndex; - private String openubmcSearchNpsIndex; + private String searchNpsIndex; // -- query str -- private String extOsQueryStr; diff --git a/src/main/java/com/datastat/model/OpenUbmcSearchNps.java b/src/main/java/com/datastat/model/SearchIssueBody.java similarity index 92% rename from src/main/java/com/datastat/model/OpenUbmcSearchNps.java rename to src/main/java/com/datastat/model/SearchIssueBody.java index d66db84..ab63a8f 100644 --- a/src/main/java/com/datastat/model/OpenUbmcSearchNps.java +++ b/src/main/java/com/datastat/model/SearchIssueBody.java @@ -6,7 +6,7 @@ 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 + Create: 2024 */ package com.datastat.model; @@ -18,10 +18,12 @@ import lombok.Data; @Data -public class OpenUbmcSearchNps { +public class SearchIssueBody { private Boolean searchFlag; + private String keyword; + @Size(max = 100, message = "the length can not exceed 100") @Pattern(regexp = "^[^<>%&$]*$", message = "Text format error") @ModerationValid diff --git a/src/main/java/com/datastat/service/QueryService.java b/src/main/java/com/datastat/service/QueryService.java index 0b2214a..4aff5b5 100644 --- a/src/main/java/com/datastat/service/QueryService.java +++ b/src/main/java/com/datastat/service/QueryService.java @@ -35,7 +35,7 @@ import com.datastat.model.HmsExportDataReq; import com.datastat.model.IsvCount; import com.datastat.model.NpsBody; -import com.datastat.model.OpenUbmcSearchNps; +import com.datastat.model.SearchIssueBody; import com.datastat.model.QaBotRequestBody; import com.datastat.model.SigGathering; import com.datastat.model.TeamupApplyForm; @@ -1577,12 +1577,12 @@ public String putGlobalNpsIssue(HttpServletRequest request, String token, String return queryDao.putGlobalNpsIssue(queryConf, token, community, body); } - public String putSearchOpeUbmcIssue(HttpServletRequest request, String token, String community, - OpenUbmcSearchNps body) { + public String putSearchNpsByCommunity(HttpServletRequest request, String token, String community, + SearchIssueBody body) { if (!checkCommunity(community)) return ResultUtil.resultJsonStr(404, "error", "not found"); QueryDao queryDao = getQueryDao(request); CustomPropertiesConfig queryConf = getQueryConf(request); - return queryDao.putSearchOpeUbmcIssue(queryConf, token, community, body); + return queryDao.putSearchNpsByCommunity(queryConf, token, community, body); } public String queryGolbalIssues(HttpServletRequest request,String token, ContributeRequestParams params) throws Exception { From f3565a75ec71dceb196a7955f6263ddf7f5955f5 Mon Sep 17 00:00:00 2001 From: XieChengzhi Date: Mon, 16 Dec 2024 16:32:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/datastat/controller/QueryController.java | 5 ++--- src/main/java/com/datastat/dao/QueryDao.java | 12 +----------- src/main/java/com/datastat/service/QueryService.java | 5 ++--- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/datastat/controller/QueryController.java b/src/main/java/com/datastat/controller/QueryController.java index d031738..58dac44 100644 --- a/src/main/java/com/datastat/controller/QueryController.java +++ b/src/main/java/com/datastat/controller/QueryController.java @@ -767,11 +767,10 @@ public String putGlobalNpsIssue(HttpServletRequest request, @CookieValue(value = } @LimitRequest(callTime = 1, callCount = 1000) - @RateLimit @RequestMapping(value = "/search/issue", method = RequestMethod.POST) - public String putSearchNpsByCommunity(HttpServletRequest request, @CookieValue(value = "_Y_G_") String token, + public String putSearchNpsByCommunity(HttpServletRequest request, @RequestParam(value = "community") String community, @Valid @RequestBody SearchIssueBody body) { - return queryService.putSearchNpsByCommunity(request, token, community,body); + return queryService.putSearchNpsByCommunity(request, community,body); } @RequestMapping("/user/owner/repos") diff --git a/src/main/java/com/datastat/dao/QueryDao.java b/src/main/java/com/datastat/dao/QueryDao.java index aedd5fb..6089360 100644 --- a/src/main/java/com/datastat/dao/QueryDao.java +++ b/src/main/java/com/datastat/dao/QueryDao.java @@ -3708,20 +3708,10 @@ public String putGlobalNpsIssue(CustomPropertiesConfig queryConf, String token, } } - public String putSearchNpsByCommunity(CustomPropertiesConfig queryConf, String token, String community, SearchIssueBody body) { + public String putSearchNpsByCommunity(CustomPropertiesConfig queryConf, String community, SearchIssueBody body) { HashMap resMap = objectMapper.convertValue(body, new TypeReference>() { }); 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"); diff --git a/src/main/java/com/datastat/service/QueryService.java b/src/main/java/com/datastat/service/QueryService.java index 4aff5b5..1a8eea2 100644 --- a/src/main/java/com/datastat/service/QueryService.java +++ b/src/main/java/com/datastat/service/QueryService.java @@ -1577,12 +1577,11 @@ public String putGlobalNpsIssue(HttpServletRequest request, String token, String return queryDao.putGlobalNpsIssue(queryConf, token, community, body); } - public String putSearchNpsByCommunity(HttpServletRequest request, String token, String community, - SearchIssueBody body) { + public String putSearchNpsByCommunity(HttpServletRequest request, String community, SearchIssueBody body) { if (!checkCommunity(community)) return ResultUtil.resultJsonStr(404, "error", "not found"); QueryDao queryDao = getQueryDao(request); CustomPropertiesConfig queryConf = getQueryConf(request); - return queryDao.putSearchNpsByCommunity(queryConf, token, community, body); + return queryDao.putSearchNpsByCommunity(queryConf, community, body); } public String queryGolbalIssues(HttpServletRequest request,String token, ContributeRequestParams params) throws Exception { From fddcc52c834422978c50a5766c668f3ab7bc64b5 Mon Sep 17 00:00:00 2001 From: XieChengzhi Date: Wed, 18 Dec 2024 09:25:23 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E6=95=B0=E6=8D=AE=E8=BF=BD=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/datastat/controller/QueryController.java | 12 ++++++++++-- src/main/java/com/datastat/dao/QueryDao.java | 13 ++++++++++++- .../java/com/datastat/service/QueryService.java | 4 ++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/datastat/controller/QueryController.java b/src/main/java/com/datastat/controller/QueryController.java index 58dac44..b630abb 100644 --- a/src/main/java/com/datastat/controller/QueryController.java +++ b/src/main/java/com/datastat/controller/QueryController.java @@ -766,11 +766,19 @@ public String putGlobalNpsIssue(HttpServletRequest request, @CookieValue(value = return queryService.putGlobalNpsIssue(request, token, community, body); } + /** + * submit search issue based on the searchIssue body. + * + * @param request HttpServletRequest request. + * @param token ueser token. + * @param body issue body. + * @return Response string. + */ @LimitRequest(callTime = 1, callCount = 1000) @RequestMapping(value = "/search/issue", method = RequestMethod.POST) - public String putSearchNpsByCommunity(HttpServletRequest request, + public String putSearchNpsByCommunity(HttpServletRequest request, @CookieValue(value = "_Y_G_", required = false) String token, @RequestParam(value = "community") String community, @Valid @RequestBody SearchIssueBody body) { - return queryService.putSearchNpsByCommunity(request, community,body); + return queryService.putSearchNpsByCommunity(request, token, community,body); } @RequestMapping("/user/owner/repos") diff --git a/src/main/java/com/datastat/dao/QueryDao.java b/src/main/java/com/datastat/dao/QueryDao.java index 6089360..2ac0a3b 100644 --- a/src/main/java/com/datastat/dao/QueryDao.java +++ b/src/main/java/com/datastat/dao/QueryDao.java @@ -3708,10 +3708,21 @@ public String putGlobalNpsIssue(CustomPropertiesConfig queryConf, String token, } } - public String putSearchNpsByCommunity(CustomPropertiesConfig queryConf, String community, SearchIssueBody body) { + public String putSearchNpsByCommunity(CustomPropertiesConfig queryConf, String token, String community, SearchIssueBody body) { HashMap resMap = objectMapper.convertValue(body, new TypeReference>() { }); resMap.put("community", community); + String userId = ""; + if (token != null && !"mindspore".equals(community)) { + userId = userIdDao.getUserIdByCommunity(token, community); + if (null == userId || userId.equals("")) { + logger.warn("UserId parse error for token:" + token + ",community:" + community); + throw new IllegalArgumentException("UserId parse error"); + } + } else { + userId = "anonymous"; + } + resMap.put("userId", userId); try { Date now = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); diff --git a/src/main/java/com/datastat/service/QueryService.java b/src/main/java/com/datastat/service/QueryService.java index 1a8eea2..d90c73b 100644 --- a/src/main/java/com/datastat/service/QueryService.java +++ b/src/main/java/com/datastat/service/QueryService.java @@ -1577,11 +1577,11 @@ public String putGlobalNpsIssue(HttpServletRequest request, String token, String return queryDao.putGlobalNpsIssue(queryConf, token, community, body); } - public String putSearchNpsByCommunity(HttpServletRequest request, String community, SearchIssueBody body) { + public String putSearchNpsByCommunity(HttpServletRequest request, String token, String community, SearchIssueBody body) { if (!checkCommunity(community)) return ResultUtil.resultJsonStr(404, "error", "not found"); QueryDao queryDao = getQueryDao(request); CustomPropertiesConfig queryConf = getQueryConf(request); - return queryDao.putSearchNpsByCommunity(queryConf, community, body); + return queryDao.putSearchNpsByCommunity(queryConf, token, community, body); } public String queryGolbalIssues(HttpServletRequest request,String token, ContributeRequestParams params) throws Exception {