规范--反转equals使用

上级 26f423de
......@@ -189,7 +189,7 @@ public class HttpsRequestUtil {
String ret = "";
while (ret != null) {
ret = br.readLine();
if (ret != null && !ret.trim().equals("")) {
if (ret != null && !"".equals(ret.trim())) {
str_return = str_return + new String(ret.getBytes("ISO-8859-1"), "utf-8");
}
}
......
......@@ -98,6 +98,7 @@ public class BCryptPasswordEncoder implements PasswordEncoder {
return BCrypt.hashpw(rawPassword.toString(), salt);
}
public boolean matches(CharSequence rawPassword, String encodedPassword) {
if (rawPassword == null) {
throw new IllegalArgumentException("rawPassword cannot be null");
......
......@@ -59,7 +59,7 @@ public class UserReportServiceImpl implements UserReportService {
@Override
public Integer getUserActiveCount() {
ResultBody resultBody = wxService.getUserPortrait();
if (resultBody != null && resultBody.getCode().equals("200")) {
if (resultBody != null && "200".equals(resultBody.getCode())) {
JSONObject result = JSONObject.parseObject(resultBody.getResult().toString());
JSONArray jsonArray;
//当去微信拿不到日活量时会报空指针就返回null代表没拿到数据,要重新请求
......
......@@ -53,7 +53,7 @@ public class SealManageServiceImpl implements SealManageService {
@Override
public ResultBody uploadSeal(SealVO sealVO, LoginSuccessDTO loginSuccessDTO) {
ResultBody resultBody = this.checkAuthStatus(sealVO.getPort(), loginSuccessDTO);
if (!resultBody.getCode().equals("200")) {
if (!"200".equals(resultBody.getCode())) {
return resultBody;
}
UserFddDO userFddInfo = (UserFddDO) resultBody.getResult();
......@@ -122,7 +122,7 @@ public class SealManageServiceImpl implements SealManageService {
@Override
public ResultBody removeSeal(String signatureId, Integer port, LoginSuccessDTO loginSuccessDTO) {
ResultBody resultBody = checkAuthStatus(port, loginSuccessDTO);
if (!resultBody.getCode().equals("200")) {
if (!"200".equals(resultBody.getCode())) {
return resultBody;
}
UserFddDO userFddInfo = (UserFddDO) resultBody.getResult();
......@@ -184,7 +184,7 @@ public class SealManageServiceImpl implements SealManageService {
@Transactional(rollbackFor = Exception.class)
public ResultBody defaultSeal(String signatureId, Integer port, LoginSuccessDTO loginSuccessDTO) {
ResultBody resultBody = checkAuthStatus(port, loginSuccessDTO);
if (!resultBody.getCode().equals("200")) {
if (!"200".equals(resultBody.getCode())) {
return resultBody;
}
UserFddDO userFddInfo = (UserFddDO) resultBody.getResult();
......@@ -207,7 +207,7 @@ public class SealManageServiceImpl implements SealManageService {
@Override
public ResultBody getSealInfo(String signatureId, Integer port, LoginSuccessDTO loginSuccessDTO) {
ResultBody resultBody = checkAuthStatus(port, loginSuccessDTO);
if (!resultBody.getCode().equals("200")) {
if (!"200".equals(resultBody.getCode())) {
return resultBody;
}
UserFddDO userFddInfo = (UserFddDO) resultBody.getResult();
......
......@@ -200,13 +200,13 @@ public class UserFddAuthServiceImpl implements UserFddAuthService {
return ResultBody.error(ResultEnum.NOT_FOUND);
}
//修改认证状态
if (authenticationType.equals("2")) {
if ("2".equals(authenticationType)) {
userFddAuthDao.updateCompanyCertStatus(customerId, status);
} else {
userFddAuthDao.updatePersonCertStatus(customerId, status);
}
//通过需要申请证书
if (("2".equals(authenticationType) && status.equals("4")) || (authenticationType.equals("1") && status.equals("2"))) {
if (("2".equals(authenticationType) && "4".equals(status)) || ("1".equals(authenticationType) && "2".equals(status))) {
fddService.getApplyCert(verifyInfoDO.getCustomerId(), verifyInfoDO.getTransactionNo());
}
return ResultBody.success();
......
......@@ -347,7 +347,7 @@ public class MessageServiceImpl implements MessageService {
MessageTimeVO messageTimeVO1 = messageDao.selectUserMessageTimeType(id);
// 增加聊天时长
String timeValue = redisTemplate.opsForValue().get("Message" + userAccountId);
if (timeValue == null || timeValue.equals("")) {
if (timeValue == null || "".equals(timeValue)) {
redisTemplate.setValueSerializer(RedisSerializer.json());
redisTemplate.opsForValue().set("Message" + userAccountId, userAccountId.toString(), messageTimeVO1.getChatDuration() * 24 * 60 * 60, TimeUnit.SECONDS);
return ResultBody.success("成功购买"+messageTimeVO1.getChatDuration()+"天聊天功能");
......@@ -375,7 +375,7 @@ public class MessageServiceImpl implements MessageService {
}
// 增加聊天时长
String timeValue = redisTemplate.opsForValue().get("Message" + userAccountId);
if (timeValue == null || timeValue.equals("")) {
if (timeValue == null || "".equals(timeValue)) {
redisTemplate.setValueSerializer(RedisSerializer.json());
redisTemplate.opsForValue().set("Message" + userAccountId, userAccountId.toString(), messageTimeVO1.getChatDuration() * 24 * 60 * 60, TimeUnit.SECONDS);
return ResultBody.success("成功购买"+messageTimeVO1.getChatDuration()+"天聊天功能");
......
......@@ -73,7 +73,7 @@ public class RealNameAuthServiceImpl implements RealNameAuthService {
String faceMsg = JSONObject.parseObject(faceResult.toString()).getString("code");
String backMsg = JSONObject.parseObject(backResult.toString()).getString("code");
// 都解析通过
if (faceMsg.equals("200") && backMsg.equals("200")) {
if ("200".equals(faceMsg) && "200".equals(backMsg)) {
// 处理正面
JSONObject faceResultJson = JSONObject.parseObject(
JSONObject.parseObject(faceResult.toString()).getString("result"));
......@@ -96,9 +96,9 @@ public class RealNameAuthServiceImpl implements RealNameAuthService {
realNameAuthDO.setIssue(backResultJson.getString("issue"));
realNameAuthDO.setUnionId(realNameAuthVO.getUnionId());
if (faceResultJson.getString("sex").equals("男")) {
if ("男".equals(faceResultJson.getString("sex"))) {
realNameAuthDO.setSex(1);
} else if (faceResultJson.getString("sex").equals("女")) {
} else if ("女".equals(faceResultJson.getString("sex"))) {
realNameAuthDO.setSex(2);
} else {
realNameAuthDO.setSex(0);
......@@ -116,7 +116,7 @@ public class RealNameAuthServiceImpl implements RealNameAuthService {
realNameAuthDO.setBirthday(this.getDate(faceResultJson.getString("birth"), "yyyyMMdd"));
realNameAuthDO.setStartDate(this.getDate(backResultJson.getString("start_date"), "yyyyMMdd"));
if (backResultJson.getString("end_date").equals("长期")) {
if ("长期".equals(backResultJson.getString("end_date"))) {
realNameAuthDO.setEndDate(null);
} else {
realNameAuthDO.setEndDate(this.getDate(backResultJson.getString("end_date"), "yyyyMMdd"));
......@@ -168,7 +168,7 @@ public class RealNameAuthServiceImpl implements RealNameAuthService {
RealNameAuthDO realNameAuthDO = realNameAuthDao.getRealNameAuthById(id);
if (realNameAuthDO != null) {
UserAccountDO userAccountById = userServiceDao.getUserAccountById(realNameAuthDO.getUserAccountId());
if(realNameAuthDO.getUnionId() == null || realNameAuthDO.getUnionId().equals("")){
if(realNameAuthDO.getUnionId() == null || "".equals(realNameAuthDO.getUnionId())){
realNameAuthDO.setUnionId(userAccountById.getUnionId());
realNameAuthDao.updateRealNameAuth(realNameAuthDO);
}
......@@ -197,7 +197,7 @@ public class RealNameAuthServiceImpl implements RealNameAuthService {
RealNameAuthDO realNameAuthDO = realNameAuthDao.userDetail(userAccountId);
if (realNameAuthDO != null) {
UserAccountDO userAccountById = userServiceDao.getUserAccountById(realNameAuthDO.getUserAccountId());
if(realNameAuthDO.getUnionId() == null || realNameAuthDO.getUnionId().equals("")){
if(realNameAuthDO.getUnionId() == null || "".equals(realNameAuthDO.getUnionId())){
realNameAuthDO.setUnionId(userAccountById.getUnionId());
realNameAuthDao.updateRealNameAuth(realNameAuthDO);
}
......
......@@ -329,7 +329,7 @@ public class WxServiceImpl implements WxService {
String url = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + accessToken;
String res = HttpHelper.httpPost(url, param.toString());
JSONObject result = JSONObject.parseObject(res);
if (result.getString("errcode").equals("0")) {
if ("0".equals(result.getString("errcode"))) {
return result.getString("url_link");
}
return res;
......@@ -350,7 +350,7 @@ public class WxServiceImpl implements WxService {
JSONObject result = JSONObject.parseObject(res);
log.info("param: id:{},code:{}", id, code);
log.info("getUserPhoneNumber: " + result.toString());
if (result.getString("errcode").equals("0")) {
if ("0".equals(result.getString("errcode"))) {
String phone_info = result.getString("phone_info");
JSONObject phoneInfoObject = JSONObject.parseObject(phone_info);
return phoneInfoObject.getString("purePhoneNumber");
......
......@@ -134,7 +134,7 @@ public class XzServiceImpl implements XzService {
if (jsonObject1.get("data") != null) {
// 添加认证签约结果
JSONObject signedResult = this.getSignedResult(xzAuthVO);
if (signedResult.get("msg").equals("success")) {
if ("success".equals(signedResult.get("msg"))) {
// log.info("Signed result: {}", signedResult);
List<JSONObject> jsonObjects = JSONArray.parseArray(signedResult.get("data").toString(), JSONObject.class);
// log.info("jsonObjects : {}", com.alibaba.fastjson2.JSONObject.toJSONString(jsonObjects));
......@@ -185,7 +185,7 @@ public class XzServiceImpl implements XzService {
public String xzAuthNotify(JSONObject notify) {
log.info("xzAuthNotify获取到的推送结果:{}", notify.toString());
// 认证成功,修改认证状态
if (notify.get("code").toString().equals("0")) {
if ("0".equals(notify.get("code").toString())) {
XzAuthDO authDO = notify.get("data", XzAuthDO.class);
Integer userAccountId = (Integer) com.alibaba.fastjson2.JSONObject.parseObject(authDO.getCustomParams()).get("userAccountId");
if (userAccountId != null) {
......@@ -301,7 +301,7 @@ public class XzServiceImpl implements XzService {
.frontLogNo(frontLogNo)
.build());
System.out.println(jsonObject.toString());
if (jsonObject.get("isSuccess").toString().equals("T")) {
if ("T".equals(jsonObject.get("isSuccess").toString())) {
return ResultBody.success(jsonObject.get("data"));
} else {
return ResultBody.error(jsonObject.get("errorMessage").toString());
......
......@@ -108,7 +108,7 @@ public class QccEntAuthUtil {
String response = HttpsRequestUtil.httpsRequest(url, method, headers, bodys);
log.info("response11111111111111: " + response);
//获取response的body
if(response.equals("Invalid Result - invalid business license")){
if("Invalid Result - invalid business license".equals(response)){
return null;
}
return response;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论