refactor: "" -> StringUtils.EMPTY

This commit is contained in:
liqiang-fit2cloud 2022-10-17 14:34:59 +08:00
parent 5621516b13
commit b4b2dca27a
29 changed files with 93 additions and 89 deletions

View File

@ -254,7 +254,7 @@ public class MockConfigService {
List<String> savedExpectNumber = extMockExpectConfigMapper.selectExlectNumByMockConfigId(mockConfigId); List<String> savedExpectNumber = extMockExpectConfigMapper.selectExlectNumByMockConfigId(mockConfigId);
String apiNum = extMockExpectConfigMapper.selectApiNumberByMockConfigId(mockConfigId); String apiNum = extMockExpectConfigMapper.selectApiNumberByMockConfigId(mockConfigId);
if (StringUtils.isEmpty(apiNum)) { if (StringUtils.isEmpty(apiNum)) {
apiNum = ""; apiNum = StringUtils.EMPTY;
} else { } else {
apiNum = apiNum + "_"; apiNum = apiNum + "_";
} }
@ -427,8 +427,8 @@ public class MockConfigService {
JSONArray jsonArray = mockExpectRequestObj.optJSONArray("variables"); JSONArray jsonArray = mockExpectRequestObj.optJSONArray("variables");
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.optJSONObject(i); JSONObject object = jsonArray.optJSONObject(i);
String name = ""; String name = StringUtils.EMPTY;
String value = ""; String value = StringUtils.EMPTY;
if (object.has("name")) { if (object.has("name")) {
name = String.valueOf(object.get("name")).trim(); name = String.valueOf(object.get("name")).trim();
} }
@ -550,8 +550,8 @@ public class MockConfigService {
JSONArray jsonArray = requestObj.optJSONArray("variables"); JSONArray jsonArray = requestObj.optJSONArray("variables");
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.optJSONObject(i); JSONObject object = jsonArray.optJSONObject(i);
String name = ""; String name = StringUtils.EMPTY;
String value = ""; String value = StringUtils.EMPTY;
if (object.has("name")) { if (object.has("name")) {
name = String.valueOf(object.get("name")).trim(); name = String.valueOf(object.get("name")).trim();
} }
@ -570,7 +570,7 @@ public class MockConfigService {
} }
public String updateHttpServletResponse(String projectId, MockExpectConfigResponse finalExpectConfig, String url, Map<String, String> headerMap, RequestMockParams requestMockParams, HttpServletResponse response) { public String updateHttpServletResponse(String projectId, MockExpectConfigResponse finalExpectConfig, String url, Map<String, String> headerMap, RequestMockParams requestMockParams, HttpServletResponse response) {
String returnStr = ""; String returnStr = StringUtils.EMPTY;
try { try {
//设置响应头和响应码 //设置响应头和响应码
JSONObject responseObj = JSONUtil.parseObject(JSON.toJSONString(finalExpectConfig.getResponse())); JSONObject responseObj = JSONUtil.parseObject(JSON.toJSONString(finalExpectConfig.getResponse()));
@ -622,7 +622,7 @@ public class MockConfigService {
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.optJSONObject(i); JSONObject object = jsonArray.optJSONObject(i);
String name = null; String name = null;
String value = ""; String value = StringUtils.EMPTY;
if (object.has("name")) { if (object.has("name")) {
name = String.valueOf(object.get("name")).trim(); name = String.valueOf(object.get("name")).trim();
} }
@ -851,7 +851,7 @@ public class MockConfigService {
} }
public String checkReturnWithMockExpectByBodyParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest request, HttpServletResponse response) { public String checkReturnWithMockExpectByBodyParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest request, HttpServletResponse response) {
String returnStr = ""; String returnStr = StringUtils.EMPTY;
boolean matchApi = false; boolean matchApi = false;
String url = request.getRequestURL().toString(); String url = request.getRequestURL().toString();
if (project != null) { if (project != null) {
@ -884,7 +884,7 @@ public class MockConfigService {
} }
public String checkReturnWithMockExpectByUrlParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest request, HttpServletResponse response) { public String checkReturnWithMockExpectByUrlParam(String method, Map<String, String> requestHeaderMap, Project project, HttpServletRequest request, HttpServletResponse response) {
String returnStr = ""; String returnStr = StringUtils.EMPTY;
boolean matchApi = false; boolean matchApi = false;
String url = request.getRequestURL().toString(); String url = request.getRequestURL().toString();
List<ApiDefinitionWithBLOBs> aualifiedApiList = new ArrayList<>(); List<ApiDefinitionWithBLOBs> aualifiedApiList = new ArrayList<>();
@ -1344,7 +1344,7 @@ public class MockConfigService {
} }
public String getMockInfo(String projectId) { public String getMockInfo(String projectId) {
String returnStr = ""; String returnStr = StringUtils.EMPTY;
ApiTestEnvironmentWithBLOBs mockEnv = baseEnvironmentService.getMockEnvironmentByProjectId(projectId); ApiTestEnvironmentWithBLOBs mockEnv = baseEnvironmentService.getMockEnvironmentByProjectId(projectId);
if (mockEnv != null && mockEnv.getConfig() != null) { if (mockEnv != null && mockEnv.getConfig() != null) {
try { try {

View File

@ -174,7 +174,7 @@ public class MsHashTreeService {
if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) { if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) {
element.put(ENABLE, false); element.put(ENABLE, false);
} }
element.put(NUM, ""); element.put(NUM, StringUtils.EMPTY);
} }
return element; return element;
} }
@ -207,7 +207,7 @@ public class MsHashTreeService {
if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) { if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), REF)) {
element.put(ENABLE, false); element.put(ENABLE, false);
} }
element.put(NUM, ""); element.put(NUM, StringUtils.EMPTY);
} }
return element; return element;
} }

View File

@ -183,7 +183,7 @@ public class ShareInfoService extends BaseShareInfoService {
apiInfoDTO.setCreateUser(userIdMap.get(apiModel.getCreateUser()) == null ? apiModel.getCreateUser() : userIdMap.get(apiModel.getCreateUser()).getName()); apiInfoDTO.setCreateUser(userIdMap.get(apiModel.getCreateUser()) == null ? apiModel.getCreateUser() : userIdMap.get(apiModel.getCreateUser()).getName());
apiInfoDTO.setDesc(apiModel.getDescription()); apiInfoDTO.setDesc(apiModel.getDescription());
if (MapUtils.isNotEmpty(moduleMap)) { if (MapUtils.isNotEmpty(moduleMap)) {
apiInfoDTO.setModules(moduleMap.containsKey(apiModel.getModuleId()) ? moduleMap.get(apiModel.getModuleId()) : ""); apiInfoDTO.setModules(moduleMap.containsKey(apiModel.getModuleId()) ? moduleMap.get(apiModel.getModuleId()) : StringUtils.EMPTY);
} else { } else {
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class); ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
apiInfoDTO.setModules(apiModuleService.getModuleNameById(apiModel.getModuleId())); apiInfoDTO.setModules(apiModuleService.getModuleNameById(apiModel.getModuleId()));
@ -290,7 +290,7 @@ public class ShareInfoService extends BaseShareInfoService {
for (int i = 0; i < kvsArr.size(); i++) { for (int i = 0; i < kvsArr.size(); i++) {
JsonNode kv = kvsArr.get(i); JsonNode kv = kvsArr.get(i);
if (this.isObjectHasKey(kv, "name")) { if (this.isObjectHasKey(kv, "name")) {
String value = ""; String value = StringUtils.EMPTY;
if (kv.has("value")) { if (kv.has("value")) {
value = String.valueOf(kv.get("value")); value = String.valueOf(kv.get("value"));
} }
@ -312,7 +312,7 @@ public class ShareInfoService extends BaseShareInfoService {
Map<String, String> bodyMap = new HashMap<>(); Map<String, String> bodyMap = new HashMap<>();
String name = kv.get("description").asText(); String name = kv.get("description").asText();
ArrayNode fileArr = kv.withArray("files"); ArrayNode fileArr = kv.withArray("files");
String value = ""; String value = StringUtils.EMPTY;
for (int j = 0; j < fileArr.size(); j++) { for (int j = 0; j < fileArr.size(); j++) {
JsonNode fileObj = fileArr.get(j); JsonNode fileObj = fileArr.get(j);
if (this.isObjectHasKey(fileObj, "name")) { if (this.isObjectHasKey(fileObj, "name")) {
@ -413,7 +413,7 @@ public class ShareInfoService extends BaseShareInfoService {
String name = kv.get("description").asText(); String name = kv.get("description").asText();
ArrayNode fileArr = kv.withArray("files"); ArrayNode fileArr = kv.withArray("files");
String value = ""; String value = StringUtils.EMPTY;
for (int j = 0; j < fileArr.size(); j++) { for (int j = 0; j < fileArr.size(); j++) {
JsonNode fileObj = fileArr.get(j); JsonNode fileObj = fileArr.get(j);
if (this.isObjectHasKey(fileObj, "name")) { if (this.isObjectHasKey(fileObj, "name")) {

View File

@ -152,11 +152,11 @@ public class TestResultService {
if (scenarioRunModes.contains(dto.getRunMode())) { if (scenarioRunModes.contains(dto.getRunMode())) {
ApiScenarioReport scenarioReport = apiScenarioReportService.testEnded(dto); ApiScenarioReport scenarioReport = apiScenarioReportService.testEnded(dto);
if (scenarioReport != null) { if (scenarioReport != null) {
String environment = ""; String environment = StringUtils.EMPTY;
//执行人 //执行人
String userName = ""; String userName = StringUtils.EMPTY;
//负责人 //负责人
String principal = ""; String principal = StringUtils.EMPTY;
ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId()); ApiScenarioWithBLOBs apiScenario = apiScenarioMapper.selectByPrimaryKey(scenarioReport.getScenarioId());
if (apiScenario != null) { if (apiScenario != null) {
@ -211,8 +211,8 @@ public class TestResultService {
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId(); String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
String subject = ""; String subject = StringUtils.EMPTY;
String event = ""; String event = StringUtils.EMPTY;
String successContext = "${operator}执行接口自动化成功: ${name}" + ", 报告: ${reportUrl}"; String successContext = "${operator}执行接口自动化成功: ${name}" + ", 报告: ${reportUrl}";
String failedContext = "${operator}执行接口自动化失败: ${name}" + ", 报告: ${reportUrl}"; String failedContext = "${operator}执行接口自动化失败: ${name}" + ", 报告: ${reportUrl}";

View File

@ -3,6 +3,7 @@ package io.metersphere.consul;
import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.JSON;
import io.metersphere.controller.handler.annotation.NoResultHolder; import io.metersphere.controller.handler.annotation.NoResultHolder;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -50,7 +51,7 @@ public class CatalogApi {
int index = RandomUtils.nextInt(1000, 20000); int index = RandomUtils.nextInt(1000, 20000);
responseHeaders.set("X-Consul-Default-Acl-Policy", "allow"); responseHeaders.set("X-Consul-Default-Acl-Policy", "allow");
responseHeaders.set("X-Consul-Effective-Consistency", "leader"); responseHeaders.set("X-Consul-Effective-Consistency", "leader");
responseHeaders.set("X-Consul-Index", index + ""); responseHeaders.set("X-Consul-Index", index + StringUtils.EMPTY);
responseHeaders.set("X-Consul-Knownleader", "true"); responseHeaders.set("X-Consul-Knownleader", "true");
responseHeaders.set("X-Consul-Lastcontact", "0"); responseHeaders.set("X-Consul-Lastcontact", "0");
@ -67,7 +68,7 @@ public class CatalogApi {
int index = RandomUtils.nextInt(1000, 20000); int index = RandomUtils.nextInt(1000, 20000);
HttpHeaders responseHeaders = new HttpHeaders(); HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.set("X-Consul-Default-Acl-Policy", "allow"); responseHeaders.set("X-Consul-Default-Acl-Policy", "allow");
responseHeaders.set("X-Consul-Index", index + ""); responseHeaders.set("X-Consul-Index", index + StringUtils.EMPTY);
responseHeaders.set("X-Consul-Knownleader", "true"); responseHeaders.set("X-Consul-Knownleader", "true");
responseHeaders.set("X-Consul-Lastcontact", "0"); responseHeaders.set("X-Consul-Lastcontact", "0");

View File

@ -174,9 +174,9 @@ public abstract class AbstractEngine implements Engine {
Map<String, String> env = new HashMap<>(); Map<String, String> env = new HashMap<>();
env.put("RATIO", StringUtils.join(ratios, ",")); env.put("RATIO", StringUtils.join(ratios, ","));
env.put("RESOURCE_INDEX", "" + resourceIndex); env.put("RESOURCE_INDEX", StringUtils.EMPTY + resourceIndex);
env.put("METERSPHERE_URL", metersphereUrl); env.put("METERSPHERE_URL", metersphereUrl);
env.put("START_TIME", "" + System.currentTimeMillis()); env.put("START_TIME", StringUtils.EMPTY + System.currentTimeMillis());
env.put("TEST_ID", this.loadTestReport.getTestId()); env.put("TEST_ID", this.loadTestReport.getTestId());
env.put("REPORT_ID", this.loadTestReport.getId()); env.put("REPORT_ID", this.loadTestReport.getId());
env.put("BOOTSTRAP_SERVERS", kafkaProperties.getBootstrapServers()); env.put("BOOTSTRAP_SERVERS", kafkaProperties.getBootstrapServers());
@ -200,7 +200,7 @@ public abstract class AbstractEngine implements Engine {
completeCount.setId(UUID.randomUUID().toString()); completeCount.setId(UUID.randomUUID().toString());
completeCount.setReportId(loadTestReport.getId()); completeCount.setReportId(loadTestReport.getId());
completeCount.setReportKey(ReportKeys.ReportCompleteCount.name()); completeCount.setReportKey(ReportKeys.ReportCompleteCount.name());
completeCount.setReportValue("" + ratios.length); // 初始化一个 completeCount, 这个值用在data-streaming中 completeCount.setReportValue(StringUtils.EMPTY + ratios.length); // 初始化一个 completeCount, 这个值用在data-streaming中
LoadTestReportResultMapper loadTestReportResultMapper = CommonBeanFactory.getBean(LoadTestReportResultMapper.class); LoadTestReportResultMapper loadTestReportResultMapper = CommonBeanFactory.getBean(LoadTestReportResultMapper.class);
loadTestReportResultMapper.insertSelective(completeCount); loadTestReportResultMapper.insertSelective(completeCount);
} }

View File

@ -42,8 +42,8 @@ public class PerformanceNoticeEvent implements LoadTestFinishEvent {
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/performance/report/view/" + loadTestReport.getId(); String reportUrl = baseSystemConfigDTO.getUrl() + "/#/performance/report/view/" + loadTestReport.getId();
String subject = ""; String subject = StringUtils.EMPTY;
String event = ""; String event = StringUtils.EMPTY;
String successContext = "${operator}执行性能测试成功: ${name}, 报告: ${reportUrl}"; String successContext = "${operator}执行性能测试成功: ${name}, 报告: ${reportUrl}";
String failedContext = "${operator}执行性能测试失败: ${name}, 报告: ${reportUrl}"; String failedContext = "${operator}执行性能测试失败: ${name}, 报告: ${reportUrl}";
if (StringUtils.equals(ReportTriggerMode.API.name(), loadTestReport.getTriggerMode())) { if (StringUtils.equals(ReportTriggerMode.API.name(), loadTestReport.getTriggerMode())) {

View File

@ -61,7 +61,7 @@ public class EngineSourceParserFactory {
List<Node> nodes = document.selectNodes("//text()[normalize-space(.)='']"); List<Node> nodes = document.selectNodes("//text()[normalize-space(.)='']");
nodes.forEach(node -> { nodes.forEach(node -> {
if (node.getText().contains("\n")) { if (node.getText().contains("\n")) {
node.setText(""); node.setText(StringUtils.EMPTY);
} }
}); });

View File

@ -522,7 +522,7 @@ public class PerformanceReportService {
if (testResourcePool != null) { if (testResourcePool != null) {
return testResourcePool.getType(); return testResourcePool.getType();
} }
return ""; return StringUtils.EMPTY;
} }
public List<LoadTestExportJmx> getJmxContent(String reportId) { public List<LoadTestExportJmx> getJmxContent(String reportId) {

View File

@ -135,7 +135,7 @@ public class FileRepositoryService {
if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.API.name())) { if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.API.name())) {
ApiDefinition apiDefinition = apiMap.get(fileAssociation.getSourceId()); ApiDefinition apiDefinition = apiMap.get(fileAssociation.getSourceId());
if (apiDefinition != null) { if (apiDefinition != null) {
caseId = apiDefinition.getNum() == null ? "" : apiDefinition.getNum().toString(); caseId = apiDefinition.getNum() == null ? StringUtils.EMPTY : apiDefinition.getNum().toString();
caseName = apiDefinition.getName(); caseName = apiDefinition.getName();
} }
} else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.CASE.name())) { } else if (StringUtils.equals(fileAssociation.getType(), FileAssociationType.CASE.name())) {

View File

@ -235,7 +235,7 @@ public class ProjectService {
public void checkProjectTcpPort(AddProjectRequest project) { public void checkProjectTcpPort(AddProjectRequest project) {
//判断端口是否重复 //判断端口是否重复
if (project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) { if (project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0) {
String projectId = StringUtils.isEmpty(project.getId()) ? "" : project.getId(); String projectId = StringUtils.isEmpty(project.getId()) ? StringUtils.EMPTY : project.getId();
ProjectApplicationExample example = new ProjectApplicationExample(); ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name()).andTypeValueEqualTo(String.valueOf(project.getMockTcpPort())).andProjectIdNotEqualTo(projectId); example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name()).andTypeValueEqualTo(String.valueOf(project.getMockTcpPort())).andProjectIdNotEqualTo(projectId);
if (projectApplicationMapper.countByExample(example) > 0) { if (projectApplicationMapper.countByExample(example) > 0) {

View File

@ -257,7 +257,7 @@ public class TestCaseTemplateService extends TemplateBaseService {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.caseFieldColumns); List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.caseFieldColumns);
columns.forEach(item -> { columns.forEach(item -> {
if (item.getColumnName().equals("steps") && item.getOriginalValue().toString().equals("[{\"num\":1,\"desc\":\"\",\"result\":\"\"}]")) { if (item.getColumnName().equals("steps") && item.getOriginalValue().toString().equals("[{\"num\":1,\"desc\":\"\",\"result\":\"\"}]")) {
item.setOriginalValue(""); item.setOriginalValue(StringUtils.EMPTY);
} }
}); });
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns); OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);

View File

@ -296,7 +296,7 @@ public class SystemProjectService {
public void checkProjectTcpPort(AddProjectRequest project) { public void checkProjectTcpPort(AddProjectRequest project) {
//判断端口是否重复 //判断端口是否重复
if (project.getMockTcpPort() != null && project.getMockTcpPort() != 0) { if (project.getMockTcpPort() != null && project.getMockTcpPort() != 0) {
String projectId = StringUtils.isEmpty(project.getId()) ? "" : project.getId(); String projectId = StringUtils.isEmpty(project.getId()) ? StringUtils.EMPTY : project.getId();
ProjectApplicationExample example = new ProjectApplicationExample(); ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name()).andTypeValueEqualTo(String.valueOf(project.getMockTcpPort())).andProjectIdNotEqualTo(projectId); example.createCriteria().andTypeEqualTo(ProjectApplicationType.MOCK_TCP_PORT.name()).andTypeValueEqualTo(String.valueOf(project.getMockTcpPort())).andProjectIdNotEqualTo(projectId);
if (projectApplicationMapper.countByExample(example) > 0) { if (projectApplicationMapper.countByExample(example) > 0) {

View File

@ -375,7 +375,7 @@ public class UserService {
user.setLastProjectId(projects.get(0).getId()); user.setLastProjectId(projects.get(0).getId());
} }
} else { } else {
user.setLastProjectId(""); user.setLastProjectId(StringUtils.EMPTY);
} }
} }
// 执行变更 // 执行变更
@ -454,7 +454,7 @@ public class UserService {
.andGroupIdIn(groupIds); .andGroupIdIn(groupIds);
User user = userMapper.selectByPrimaryKey(userId); User user = userMapper.selectByPrimaryKey(userId);
if (StringUtils.equals(workspaceId, user.getLastWorkspaceId())) { if (StringUtils.equals(workspaceId, user.getLastWorkspaceId())) {
user.setLastWorkspaceId(""); user.setLastWorkspaceId(StringUtils.EMPTY);
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
} }
@ -489,10 +489,10 @@ public class UserService {
UserDTO user = getUserDTO(sessionUser.getId()); UserDTO user = getUserDTO(sessionUser.getId());
User newUser = new User(); User newUser = new User();
if (StringUtils.equals("organization", sign)) { if (StringUtils.equals("organization", sign)) {
user.setLastWorkspaceId(""); user.setLastWorkspaceId(StringUtils.EMPTY);
} }
if (StringUtils.equals("workspace", sign) && StringUtils.equals(sourceId, user.getLastWorkspaceId())) { if (StringUtils.equals("workspace", sign) && StringUtils.equals(sourceId, user.getLastWorkspaceId())) {
user.setLastWorkspaceId(""); user.setLastWorkspaceId(StringUtils.EMPTY);
} }
BeanUtils.copyProperties(user, newUser); BeanUtils.copyProperties(user, newUser);
@ -1075,7 +1075,7 @@ public class UserService {
.andGroupIdIn(groupIds); .andGroupIdIn(groupIds);
User user = userMapper.selectByPrimaryKey(userId); User user = userMapper.selectByPrimaryKey(userId);
if (StringUtils.equals(projectId, user.getLastProjectId())) { if (StringUtils.equals(projectId, user.getLastProjectId())) {
user.setLastProjectId(""); user.setLastProjectId(StringUtils.EMPTY);
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
} }
@ -1115,7 +1115,7 @@ public class UserService {
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
if (list.contains(user.getLastWorkspaceId())) { if (list.contains(user.getLastWorkspaceId())) {
user.setLastWorkspaceId(""); user.setLastWorkspaceId(StringUtils.EMPTY);
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
} }
} }

View File

@ -1,6 +1,7 @@
package io.metersphere.utils; package io.metersphere.utils;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import org.apache.commons.lang3.StringUtils;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Iterator; import java.util.Iterator;
@ -137,7 +138,7 @@ public class TypeUtils {
return null; return null;
} }
if (strVal.indexOf(',') != -1) { if (strVal.indexOf(',') != -1) {
strVal = strVal.replaceAll(",", ""); strVal = strVal.replaceAll(",", StringUtils.EMPTY);
} }
return Float.parseFloat(strVal); return Float.parseFloat(strVal);
} }
@ -165,7 +166,7 @@ public class TypeUtils {
return null; return null;
} }
if (strVal.indexOf(',') != -1) { if (strVal.indexOf(',') != -1) {
strVal = strVal.replaceAll(",", ""); strVal = strVal.replaceAll(",", StringUtils.EMPTY);
} }
return Double.parseDouble(strVal); return Double.parseDouble(strVal);
} }
@ -208,7 +209,7 @@ public class TypeUtils {
return null; return null;
} }
if (strVal.indexOf(',') != -1) { if (strVal.indexOf(',') != -1) {
strVal = strVal.replaceAll(",", ""); strVal = strVal.replaceAll(",", StringUtils.EMPTY);
} }
try { try {
return Long.parseLong(strVal); return Long.parseLong(strVal);
@ -370,7 +371,7 @@ public class TypeUtils {
return null; return null;
} }
if (strVal.indexOf(',') != -1) { if (strVal.indexOf(',') != -1) {
strVal = strVal.replaceAll(",", ""); strVal = strVal.replaceAll(",", StringUtils.EMPTY);
} }
return Integer.parseInt(strVal); return Integer.parseInt(strVal);
} }

View File

@ -15,6 +15,7 @@ import io.metersphere.plan.reuest.function.TestPlanFuncCaseBatchRequest;
import io.metersphere.plan.reuest.function.TestPlanFuncCaseEditRequest; import io.metersphere.plan.reuest.function.TestPlanFuncCaseEditRequest;
import io.metersphere.plan.service.TestPlanTestCaseService; import io.metersphere.plan.service.TestPlanTestCaseService;
import io.metersphere.request.ResetOrderRequest; import io.metersphere.request.ResetOrderRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -70,7 +71,7 @@ public class TestPlanTestCaseController {
@GetMapping("/list/node/all/{planId}/{nodePaths}") @GetMapping("/list/node/all/{planId}/{nodePaths}")
public List<TestPlanCaseDTO> getTestPlanCasesByNodePaths(@PathVariable String planId, @PathVariable String nodePaths) { public List<TestPlanCaseDTO> getTestPlanCasesByNodePaths(@PathVariable String planId, @PathVariable String nodePaths) {
String nodePath = nodePaths.replace("f", ""); String nodePath = nodePaths.replace("f", StringUtils.EMPTY);
String[] array = nodePath.split(","); String[] array = nodePath.split(",");
List<String> list = Arrays.asList(array); List<String> list = Arrays.asList(array);
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();

View File

@ -40,10 +40,10 @@ public class TrackStatisticsDTO {
*/ */
private long p3CaseCountNumber = 0; private long p3CaseCountNumber = 0;
private String p0CountStr = ""; private String p0CountStr = StringUtils.EMPTY;
private String p1CountStr = ""; private String p1CountStr = StringUtils.EMPTY;
private String p2CountStr = ""; private String p2CountStr = StringUtils.EMPTY;
private String p3CountStr = ""; private String p3CountStr = StringUtils.EMPTY;
/** /**
* 关联用例数量统计 * 关联用例数量统计
@ -66,9 +66,9 @@ public class TrackStatisticsDTO {
private long performanceCaseCount = 0; private long performanceCaseCount = 0;
private String apiCaseCountStr = ""; private String apiCaseCountStr = StringUtils.EMPTY;
private String scenarioCaseStr = ""; private String scenarioCaseStr = StringUtils.EMPTY;
private String performanceCaseCountStr = ""; private String performanceCaseCountStr = StringUtils.EMPTY;
/** /**
* 本周新增数量 * 本周新增数量

View File

@ -19,7 +19,7 @@ import io.metersphere.xpack.track.dto.request.IssuesUpdateRequest;
import io.metersphere.service.issue.platform.IssueFactory; import io.metersphere.service.issue.platform.IssueFactory;
import io.metersphere.xmind.utils.FileUtil; import io.metersphere.xmind.utils.FileUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
@ -190,7 +190,7 @@ public class AttachmentService {
List<AttachmentModuleRelation> attachmentModuleRelations = attachmentModuleRelationMapper.selectByExample(example); List<AttachmentModuleRelation> attachmentModuleRelations = attachmentModuleRelationMapper.selectByExample(example);
Map<String, String> relationMap = attachmentModuleRelations.stream() Map<String, String> relationMap = attachmentModuleRelations.stream()
.collect(Collectors.toMap(AttachmentModuleRelation::getAttachmentId, .collect(Collectors.toMap(AttachmentModuleRelation::getAttachmentId,
relation -> relation.getFileMetadataRefId() == null ? "" : relation.getFileMetadataRefId())); relation -> relation.getFileMetadataRefId() == null ? StringUtils.EMPTY : relation.getFileMetadataRefId()));
List<String> attachmentIds = attachmentModuleRelations.stream().map(AttachmentModuleRelation::getAttachmentId) List<String> attachmentIds = attachmentModuleRelations.stream().map(AttachmentModuleRelation::getAttachmentId)
.filter(StringUtils::isNotEmpty) .filter(StringUtils::isNotEmpty)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -255,8 +255,8 @@ public class AttachmentService {
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata(); FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata); BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
fileAttachmentMetadata.setId(record.getAttachmentId()); fileAttachmentMetadata.setId(record.getAttachmentId());
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? "" : fileMetadata.getCreateUser()); fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser());
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? "" : fileMetadata.getPath()); fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath());
fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata); fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata);
// 缺陷类型的附件, 关联时需单独同步第三方平台 // 缺陷类型的附件, 关联时需单独同步第三方平台
if (AttachmentType.ISSUE.type().equals(request.getBelongType())) { if (AttachmentType.ISSUE.type().equals(request.getBelongType())) {
@ -520,7 +520,7 @@ public class AttachmentService {
private String getFileTypeWithoutEnum(String filename) { private String getFileTypeWithoutEnum(String filename) {
if (org.apache.commons.lang3.StringUtils.isEmpty(filename)) { if (org.apache.commons.lang3.StringUtils.isEmpty(filename)) {
return ""; return StringUtils.EMPTY;
} }
int s = filename.lastIndexOf(".") + 1; int s = filename.lastIndexOf(".") + 1;
String type = filename.substring(s); String type = filename.substring(s);

View File

@ -190,8 +190,8 @@ public class IssuesService {
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata(); FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata); BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
fileAttachmentMetadata.setId(relation.getAttachmentId()); fileAttachmentMetadata.setId(relation.getAttachmentId());
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? "" : fileMetadata.getCreateUser()); fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser());
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? "" : fileMetadata.getPath()); fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath());
fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata); fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata);
// 下载文件管理文件, 同步到第三方平台 // 下载文件管理文件, 同步到第三方平台
File refFile = attachmentService.downloadMetadataFile(filemetaId, fileMetadata.getName()); File refFile = attachmentService.downloadMetadataFile(filemetaId, fileMetadata.getName());
@ -305,7 +305,7 @@ public class IssuesService {
return; return;
} }
for (IssuesDao issue : issues) { for (IssuesDao issue : issues) {
issue.setStatus(statusMap.getOrDefault(issue.getId(), "").replaceAll("\"", "")); issue.setStatus(statusMap.getOrDefault(issue.getId(), StringUtils.EMPTY).replaceAll("\"", StringUtils.EMPTY));
} }
} }
@ -928,7 +928,7 @@ public class IssuesService {
if (StringUtils.isBlank(item.getStatusValue())) { if (StringUtils.isBlank(item.getStatusValue())) {
item.setStatusValue(IssuesStatus.NEW.toString()); item.setStatusValue(IssuesStatus.NEW.toString());
} else { } else {
item.setStatusValue(item.getStatusValue().replace("\"", "")); item.setStatusValue(item.getStatusValue().replace("\"", StringUtils.EMPTY));
} }
}); });
return countByStatus; return countByStatus;

View File

@ -99,7 +99,7 @@ public class TestCaseCommentService {
if (!sTime.equals("null")) { if (!sTime.equals("null")) {
start = sdf.format(new Date(Long.parseLong(sTime))); start = sdf.format(new Date(Long.parseLong(sTime)));
} }
String context = ""; String context = StringUtils.EMPTY;
context = "测试评审任务通知:" + user.getName() + "" + start + "" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription(); context = "测试评审任务通知:" + user.getName() + "" + start + "" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
return context; return context;
} }

View File

@ -403,7 +403,7 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
} }
} }
if (!hasNode) { if (!hasNode) {
createNodeByPath(itemIterator, rootNodeName, null, projectId, 1, "", pathMap); createNodeByPath(itemIterator, rootNodeName, null, projectId, 1, StringUtils.EMPTY, pathMap);
} }
} }
return pathMap; return pathMap;

View File

@ -483,7 +483,7 @@ public class TestCaseReviewService {
Map<String, String> userMap = baseUserService.getProjectMemberList(queryMemberRequest) Map<String, String> userMap = baseUserService.getProjectMemberList(queryMemberRequest)
.stream().collect(Collectors.toMap(User::getId, User::getName)); .stream().collect(Collectors.toMap(User::getId, User::getName));
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
String name = ""; String name = StringUtils.EMPTY;
if (userIds.size() > 0) { if (userIds.size() > 0) {
for (String id : userIds) { for (String id : userIds) {
@ -519,11 +519,11 @@ public class TestCaseReviewService {
} else { } else {
start = "未设置"; start = "未设置";
} }
String context = ""; String context = StringUtils.EMPTY;
if (StringUtils.equals(NoticeConstants.Event.CREATE, type)) { if (StringUtils.equals(NoticeConstants.Event.CREATE, type)) {
context = "测试评审任务通知:" + user.getName() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进"; context = "测试评审任务通知:" + user.getName() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
} else if (StringUtils.equals(NoticeConstants.Event.UPDATE, type)) { } else if (StringUtils.equals(NoticeConstants.Event.UPDATE, type)) {
String status = ""; String status = StringUtils.EMPTY;
if (StringUtils.equals(TestPlanStatus.Underway.name(), reviewRequest.getStatus())) { if (StringUtils.equals(TestPlanStatus.Underway.name(), reviewRequest.getStatus())) {
status = "进行中"; status = "进行中";
} else if (StringUtils.equals(TestPlanStatus.Prepare.name(), reviewRequest.getStatus())) { } else if (StringUtils.equals(TestPlanStatus.Prepare.name(), reviewRequest.getStatus())) {

View File

@ -393,7 +393,7 @@ public class TestCaseService {
addDemandHyperLink(testCase, "edit"); addDemandHyperLink(testCase, "edit");
if (StringUtils.isEmpty(testCase.getDemandId())) { if (StringUtils.isEmpty(testCase.getDemandId())) {
testCase.setDemandId(""); testCase.setDemandId(StringUtils.EMPTY);
} }
createNewVersionOrNot(testCase, example); createNewVersionOrNot(testCase, example);
@ -572,13 +572,13 @@ public class TestCaseService {
// 如果上边字段全部相同去检查 remark steps // 如果上边字段全部相同去检查 remark steps
if (!CollectionUtils.isEmpty(caseList)) { if (!CollectionUtils.isEmpty(caseList)) {
String caseRemark = testCase.getRemark() == null ? "" : testCase.getRemark(); String caseRemark = testCase.getRemark() == null ? StringUtils.EMPTY : testCase.getRemark();
String caseSteps = testCase.getSteps() == null ? "" : testCase.getSteps(); String caseSteps = testCase.getSteps() == null ? StringUtils.EMPTY : testCase.getSteps();
String casePrerequisite = testCase.getPrerequisite() == null ? "" : testCase.getPrerequisite(); String casePrerequisite = testCase.getPrerequisite() == null ? StringUtils.EMPTY : testCase.getPrerequisite();
for (TestCaseWithBLOBs tc : caseList) { for (TestCaseWithBLOBs tc : caseList) {
String steps = tc.getSteps() == null ? "" : tc.getSteps(); String steps = tc.getSteps() == null ? StringUtils.EMPTY : tc.getSteps();
String remark = tc.getRemark() == null ? "" : tc.getRemark(); String remark = tc.getRemark() == null ? StringUtils.EMPTY : tc.getRemark();
String prerequisite = tc.getPrerequisite() == null ? "" : tc.getPrerequisite(); String prerequisite = tc.getPrerequisite() == null ? StringUtils.EMPTY : tc.getPrerequisite();
if (StringUtils.equals(steps, caseSteps) && StringUtils.equals(remark, caseRemark) && StringUtils.equals(prerequisite, casePrerequisite)) { if (StringUtils.equals(steps, caseSteps) && StringUtils.equals(remark, caseRemark) && StringUtils.equals(prerequisite, casePrerequisite)) {
//MSException.throwException(Translator.get("test_case_already_exists")); //MSException.throwException(Translator.get("test_case_already_exists"));
return tc; return tc;
@ -1402,7 +1402,7 @@ public class TestCaseService {
for (int i = 1; i <= 4; i++) { for (int i = 1; i <= 4; i++) {
path.append("/" + Translator.get("module") + i); path.append("/" + Translator.get("module") + i);
TestCaseDTO testCaseDTO = new TestCaseDTO(); TestCaseDTO testCaseDTO = new TestCaseDTO();
testCaseDTO.setCustomNum(""); testCaseDTO.setCustomNum(StringUtils.EMPTY);
testCaseDTO.setName(Translator.get("test_case") + i); testCaseDTO.setName(Translator.get("test_case") + i);
testCaseDTO.setNodePath(path.toString()); testCaseDTO.setNodePath(path.toString());
testCaseDTO.setPriority("P" + i % 4); testCaseDTO.setPriority("P" + i % 4);
@ -1575,7 +1575,7 @@ public class TestCaseService {
value = otherFieldMaps.get(head); value = otherFieldMaps.get(head);
} }
if (value == null) { if (value == null) {
value = ""; value = StringUtils.EMPTY;
} }
fields.add(value); fields.add(value);
} }
@ -1670,7 +1670,7 @@ public class TestCaseService {
if (converter != null) { if (converter != null) {
otherFields.put(header.getName(), converter.parse(t)); otherFields.put(header.getName(), converter.parse(t));
} else { } else {
otherFields.put(header.getName(), ""); otherFields.put(header.getName(), StringUtils.EMPTY);
} }
}); });
data.setOtherFields(otherFields); data.setOtherFields(otherFields);
@ -1681,7 +1681,7 @@ public class TestCaseService {
data.setCustomNum(t.getCustomNum()); data.setCustomNum(t.getCustomNum());
} else { } else {
if (t.getNum() == null) { if (t.getNum() == null) {
data.setCustomNum(""); data.setCustomNum(StringUtils.EMPTY);
} else { } else {
data.setCustomNum(String.valueOf(t.getNum())); data.setCustomNum(String.valueOf(t.getNum()));
} }
@ -1777,8 +1777,8 @@ public class TestCaseService {
String stepDesc = item.get("desc").toString(); String stepDesc = item.get("desc").toString();
String stepResult = item.get("result").toString(); String stepResult = item.get("result").toString();
if (StringUtils.isNotBlank(stepDesc) || StringUtils.isNotBlank(stepResult)) { if (StringUtils.isNotBlank(stepDesc) || StringUtils.isNotBlank(stepResult)) {
stepDescList.add(Optional.ofNullable(stepDesc).orElse("")); stepDescList.add(Optional.ofNullable(stepDesc).orElse(StringUtils.EMPTY));
stepResultList.add(Optional.ofNullable(stepResult).orElse("")); stepResultList.add(Optional.ofNullable(stepResult).orElse(StringUtils.EMPTY));
} }
} }
} }
@ -2139,8 +2139,8 @@ public class TestCaseService {
FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata(); FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata();
BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata); BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata);
fileAttachmentMetadata.setId(record.getAttachmentId()); fileAttachmentMetadata.setId(record.getAttachmentId());
fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? "" : fileMetadata.getCreateUser()); fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser());
fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? "" : fileMetadata.getPath()); fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath());
fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata); fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata);
}); });
sqlSession.flushStatements(); sqlSession.flushStatements();
@ -2216,7 +2216,7 @@ public class TestCaseService {
for (TestCaseMinderEditRequest.TestCaseMinderEditItem item : data) { for (TestCaseMinderEditRequest.TestCaseMinderEditItem item : data) {
if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) { if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) {
item.setNodeId(""); item.setNodeId(StringUtils.EMPTY);
} }
item.setProjectId(request.getProjectId()); item.setProjectId(request.getProjectId());
if (item.getIsEdit()) { if (item.getIsEdit()) {

View File

@ -131,7 +131,7 @@ public class TestReviewTestCaseService {
List<String> userIds = testCaseReviewService.getTestCaseReviewerIds(reviewId); List<String> userIds = testCaseReviewService.getTestCaseReviewerIds(reviewId);
String currentId = SessionUtils.getUser().getId(); String currentId = SessionUtils.getUser().getId();
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId); TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
String creator = ""; String creator = StringUtils.EMPTY;
if (caseReview != null) { if (caseReview != null) {
creator = caseReview.getCreator(); creator = caseReview.getCreator();
} }

View File

@ -161,7 +161,7 @@ public class TrackService {
return issueIds.size(); return issueIds.size();
} }
return (int) issueIds.stream() return (int) issueIds.stream()
.filter(id -> !StringUtils.equals(statusMap.getOrDefault(id, "").replaceAll("\"", ""), "closed")) .filter(id -> !StringUtils.equals(statusMap.getOrDefault(id, StringUtils.EMPTY).replaceAll("\"", StringUtils.EMPTY), "closed"))
.count(); .count();
} }

View File

@ -1,6 +1,7 @@
package io.metersphere.utils; package io.metersphere.utils;
import io.metersphere.dto.MsgDTO; import io.metersphere.dto.MsgDTO;
import org.apache.commons.lang3.StringUtils;
import javax.websocket.RemoteEndpoint; import javax.websocket.RemoteEndpoint;
import javax.websocket.Session; import javax.websocket.Session;
@ -27,8 +28,8 @@ public class WebSocketUtil {
// 单用户推送 // 单用户推送
public static void sendMessageSingle(MsgDTO dto) { public static void sendMessageSingle(MsgDTO dto) {
sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getReportId()).orElse("")), dto.getContent()); sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getReportId()).orElse(StringUtils.EMPTY)), dto.getContent());
sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getToReport()).orElse("")), dto.getContent()); sendMessage(ONLINE_USER_SESSIONS.get(Optional.ofNullable(dto.getToReport()).orElse(StringUtils.EMPTY)), dto.getContent());
} }
// 全用户推送 // 全用户推送

View File

@ -56,7 +56,7 @@ public abstract class AbstractCustomFieldValidator {
.replace("]", "\"]") .replace("]", "\"]")
.replace(",", "\",\"") .replace(",", "\",\"")
.replace("", "\"\"") .replace("", "\"\"")
.replace(" ", ""); .replace(" ", StringUtils.EMPTY);
} }
return JSON.parseArray(value, String.class); return JSON.parseArray(value, String.class);
} catch (Exception e) { } catch (Exception e) {

View File

@ -27,7 +27,7 @@ public class CustomFieldMultipleMemberValidator extends CustomFieldMemberValidat
@Override @Override
public Object parse2Key(String keyOrValuesStr, CustomFieldDao customField) { public Object parse2Key(String keyOrValuesStr, CustomFieldDao customField) {
if (StringUtils.isBlank(keyOrValuesStr)) { if (StringUtils.isBlank(keyOrValuesStr)) {
return ""; return StringUtils.EMPTY;
} }
List<String> keyOrValues = parse2Array(keyOrValuesStr); List<String> keyOrValues = parse2Array(keyOrValuesStr);

View File

@ -30,7 +30,7 @@ public class CustomFieldMultipleSelectValidator extends CustomFieldSelectValidat
@Override @Override
public Object parse2Key(String keyOrValuesStr, CustomFieldDao customField) { public Object parse2Key(String keyOrValuesStr, CustomFieldDao customField) {
if (StringUtils.isBlank(keyOrValuesStr)) { if (StringUtils.isBlank(keyOrValuesStr)) {
return ""; return StringUtils.EMPTY;
} }
List<String> keyOrValues = parse2Array(keyOrValuesStr); List<String> keyOrValues = parse2Array(keyOrValuesStr);
Map<String, String> nameMap = optionTextMapCache.get(customField.getId()); Map<String, String> nameMap = optionTextMapCache.get(customField.getId());