Commit 7447d990 authored by 于桐's avatar 于桐

sonar fix

parent 3d99e408
...@@ -60,7 +60,8 @@ public class RedisLockAspect { ...@@ -60,7 +60,8 @@ public class RedisLockAspect {
} else if (StringUtils.isNotBlank(annotation.key())) { } else if (StringUtils.isNotBlank(annotation.key())) {
String keySPEL = annotation.key(); String keySPEL = annotation.key();
try { try {
if (keySPEL.startsWith("#this")) {//判断是否是spel表达式 String keyPrefix = "#this";
if (keySPEL.startsWith(keyPrefix)) {//判断是否是spel表达式
Expression expression = new SpelExpressionParser().parseExpression(keySPEL); Expression expression = new SpelExpressionParser().parseExpression(keySPEL);
String value = expression.getValue(args, String.class); String value = expression.getValue(args, String.class);
lockKey = prefix.concat(":").concat(value); lockKey = prefix.concat(":").concat(value);
......
...@@ -24,8 +24,8 @@ public class BlackHoleRegisteredEventListener implements ApplicationListener<Reg ...@@ -24,8 +24,8 @@ public class BlackHoleRegisteredEventListener implements ApplicationListener<Reg
private String routingKey; private String routingKey;
@Resource @Resource
private RabbitTemplate registeredNotifyBlackHoleRabbitTemplate; private RabbitTemplate registeredNotifyBlackHoleRabbitTemplate;
long [] templateIds = {8l,280l}; private long [] templateIds = {8L,280L};
long [] templateIds_159913 = {433l,434l}; // 羊小咩小程序的渠道,合同内容不包含现金分期业务,如果这种情况较多可以考虑配置化 private long [] templateIds_159913 = {433L,434L}; // 羊小咩小程序的渠道,合同内容不包含现金分期业务,如果这种情况较多可以考虑配置化
private static final Long YXM_CHANNEL = 159913L; // 羊小咩小程序的渠道(小程序_电商,小程序_VCC) private static final Long YXM_CHANNEL = 159913L; // 羊小咩小程序的渠道(小程序_电商,小程序_VCC)
@Override @Override
...@@ -37,7 +37,7 @@ public class BlackHoleRegisteredEventListener implements ApplicationListener<Reg ...@@ -37,7 +37,7 @@ public class BlackHoleRegisteredEventListener implements ApplicationListener<Reg
String dateStr = signDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")); String dateStr = signDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
int day = signDate.getDayOfMonth(); int day = signDate.getDayOfMonth();
// 信用钱包服务与隐私协议 // 信用钱包服务与隐私协议
long[] regTempIds = userRegisterParam.getRegisterFrom().equals(YXM_CHANNEL) ? templateIds_159913 : templateIds; long[] regTempIds = YXM_CHANNEL.equals(userRegisterParam.getRegisterFrom()) ? templateIds_159913 : templateIds;
for (long id : regTempIds) { for (long id : regTempIds) {
JSONObject fields = new JSONObject(); JSONObject fields = new JSONObject();
fields.put("phoneNo", user.getPhoneNo()); fields.put("phoneNo", user.getPhoneNo());
......
...@@ -261,7 +261,7 @@ public class UserServiceImpl implements IUserService, IBaseController { ...@@ -261,7 +261,7 @@ public class UserServiceImpl implements IUserService, IBaseController {
List<UserHashMapping> userHashMappings = userHashMappingRepository.findByIdNoMd5AndIdNoMd5Short(md5Value, value); List<UserHashMapping> userHashMappings = userHashMappingRepository.findByIdNoMd5AndIdNoMd5Short(md5Value, value);
if (!CollectionUtils.isEmpty(userHashMappings)) { if (!CollectionUtils.isEmpty(userHashMappings)) {
//如果多个只返回最新的 //如果多个只返回最新的
userHashMapping = userHashMappings.stream().max(Comparator.comparing(UserHashMapping::getId)).get(); userHashMapping = userHashMappings.stream().max(Comparator.comparing(UserHashMapping::getId)).orElse(null);
} }
} else { } else {
userHashMapping = null; userHashMapping = null;
......
...@@ -221,8 +221,11 @@ public class RedisLock { ...@@ -221,8 +221,11 @@ public class RedisLock {
retryCount++; retryCount++;
if (timeout > 100) { if (timeout > 100) {
timeout -= 100; } timeout -= 100; }
else else {
timeout = 1; { timeout = 1;
}
// TODO sonar检查,else语句缺少大括号发现问题,下面这个大括号什么鬼?
{
Thread.sleep(100); } Thread.sleep(100); }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment