字符串比较错误处理

This commit is contained in:
kerwincui
2022-05-19 17:08:07 +08:00
parent 9412466747
commit eaf2eac028
4 changed files with 5 additions and 6 deletions

View File

@@ -84,7 +84,7 @@ public class DeviceController extends BaseController
public TableDataInfo allShortList(Device device)
{
List<DeviceAllShortOutput> list = new ArrayList<>();
if(device.getUserName()==null || device.getUserName() == "")
if(device.getUserName()==null || device.getUserName().equals(""))
{
list = deviceService.selectAllDeviceShortList();
}else {

View File

@@ -51,7 +51,7 @@ public class GroupController extends BaseController
{
startPage();
List<Group> list = new ArrayList<>();
if(group.getUserName() == null || group.getUserName() == "")
if(group.getUserName() == null || group.getUserName().equals(""))
{
// 搜索查询 ,mapper使用的是模糊查询
list = groupService.selectGroupList(group);

View File

@@ -49,7 +49,7 @@ public class ThingsModelTemplateController extends BaseController
{
startPage();
List<ThingsModelTemplate> list = new ArrayList<>();
if (thingsModelTemplate.getTenantName() == ""|| thingsModelTemplate.getTenantName() == null){
if (thingsModelTemplate.getTenantName().equals("")|| thingsModelTemplate.getTenantName() == null){
list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
}else{
// 精准查询

View File

@@ -211,7 +211,7 @@ public class ToolController extends BaseController {
*/
private ResponseEntity encryptAuthentication(MqttAuthenticationModel mqttModel, ProductAuthenticateModel productModel) throws Exception {
String decryptPassword = AESUtils.decrypt(mqttModel.getPassword(), productModel.getMqttSecret());
if (decryptPassword == null || decryptPassword == "") {
if (decryptPassword == null || decryptPassword.equals("")) {
return returnUnauthorized(mqttModel, "设备加密认证mqtt密码解密失败");
}
String[] passwordArray = decryptPassword.split("&");
@@ -229,7 +229,6 @@ public class ToolController extends BaseController {
return returnUnauthorized(mqttModel, resultMessage);
}
}
if (!mqttPassword.equals(productModel.getMqttPassword())) {
return returnUnauthorized(mqttModel, "设备加密认证设备mqtt密码错误");
}
@@ -262,7 +261,7 @@ public class ToolController extends BaseController {
*/
private String authCodeProcess(String authCode, MqttAuthenticationModel mqttModel, ProductAuthenticateModel productModel) {
String message = "";
if (authCode == "") {
if (authCode.equals("")) {
message = "设备认证,设备授权码不能为空";
}
// 查询授权码是否存在