💩 改善代码, 通过 P3C 校验

This commit is contained in:
zhaojun1998
2019-12-21 12:08:24 +08:00
parent 0e6bcbfa11
commit 8e7d4432a3
58 changed files with 239 additions and 102 deletions

View File

@@ -15,6 +15,9 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhaojun
*/
@Service
public class SystemConfigService {
@@ -86,13 +89,13 @@ public class SystemConfigService {
storageStrategySystemConfig.setValue(systemConfigDTO.getStorageStrategy().getKey());
systemConfigList.add(storageStrategySystemConfig);
if (!StringUtils.isNullOrEmpty(systemConfigDTO.getUsername())) {
if (StringUtils.isNotNullOrEmpty(systemConfigDTO.getUsername())) {
SystemConfig usernameSystemConfig = systemConfigRepository.findByKey(SystemConfigConstant.USERNAME);
usernameSystemConfig.setValue(systemConfigDTO.getUsername());
systemConfigList.add(usernameSystemConfig);
}
if (!StringUtils.isNullOrEmpty(systemConfigDTO.getPassword())) {
if (StringUtils.isNotNullOrEmpty(systemConfigDTO.getPassword())) {
SystemConfig passwordSystemConfig = systemConfigRepository.findByKey(SystemConfigConstant.PASSWORD);
passwordSystemConfig.setValue(systemConfigDTO.getPassword());
systemConfigList.add(passwordSystemConfig);
@@ -106,7 +109,7 @@ public class SystemConfigService {
usernameConfig.setValue(username);
systemConfigRepository.save(usernameConfig);
password = SecureUtil.md5(password);;
password = SecureUtil.md5(password);
SystemConfig systemConfig = systemConfigRepository.findByKey(SystemConfigConstant.PASSWORD);
systemConfig.setValue(password);