代码优化

This commit is contained in:
MaxKey
2024-01-13 21:48:32 +08:00
parent 47c725624c
commit a1213a7539
64 changed files with 341 additions and 144 deletions

View File

@@ -68,7 +68,7 @@ public class AccountsService extends JpaService<Accounts>{
return (AccountsMapper)super.getMapper();
}
@Override
public boolean insert(Accounts account) {
if (super.insert(account)) {
if(provisionService.getApplicationConfig().isProvisionSupport()) {
@@ -89,7 +89,8 @@ public class AccountsService extends JpaService<Accounts>{
return false;
}
public boolean update(Accounts account) {
@Override
public boolean update(Accounts account) {
if (super.update(account)) {
if(provisionService.getApplicationConfig().isProvisionSupport()) {
UserInfo loadUserInfo = userInfoService.findUserRelated(account.getUserId());
@@ -112,6 +113,8 @@ public class AccountsService extends JpaService<Accounts>{
public boolean updateStatus(Accounts accounts) {
return this.getMapper().updateStatus(accounts) > 0;
}
@Override
public boolean remove(String id) {
Accounts account = this.get(id);
if (super.remove(id)) {
@@ -196,7 +199,9 @@ public class AccountsService extends JpaService<Accounts>{
for(int i =1 ;i < 100 ;i++) {
accountResult = account + i;
AccountsList =getMapper().queryByAppIdAndAccount(accountsStrategy.getAppId(),accountResult + accountsStrategy.getSuffixes());
if(AccountsList.isEmpty())break;
if(AccountsList.isEmpty()) {
break;
}
}
}
}

View File

@@ -161,8 +161,9 @@ public class OrganizationsService extends JpaService<Organizations>{
rootOrg.setReorgNamePath(true);
for (Organizations org : orgList) {
if (org.isReorgNamePath())
if (org.isReorgNamePath()) {
continue;
}
if (org.getParentId().equalsIgnoreCase(rootOrg.getId())) {
reorg(orgMap, orgList, org);
}

View File

@@ -72,6 +72,7 @@ public class UserInfoService extends JpaService<UserInfo> {
return (UserInfoMapper)super.getMapper();
}
@Override
public boolean insert(UserInfo userInfo) {
this.passwordEncoder(userInfo);
if (super.insert(userInfo)) {
@@ -108,6 +109,7 @@ public class UserInfoService extends JpaService<UserInfo> {
return false;
}
@Override
public boolean update(UserInfo userInfo) {
ChangePassword changePassword = this.passwordEncoder(userInfo);
if (super.update(userInfo)) {
@@ -127,6 +129,7 @@ public class UserInfoService extends JpaService<UserInfo> {
return false;
}
@Override
public boolean delete(UserInfo userInfo) {
UserInfo loadUserInfo = null;
if(provisionService.getApplicationConfig().isProvisionSupport()) {

View File

@@ -71,7 +71,9 @@ public class AccountsServiceTest {
@Before
public void initSpringContext(){
if(context!=null) return;
if(context!=null) {
return;
}
_logger.info("init Spring Context...");
SimpleDateFormat sdf_ymdhms =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime=sdf_ymdhms.format(new Date());

View File

@@ -59,7 +59,9 @@ public class AppsServiceTest {
@Before
public void initSpringContext(){
if(context!=null) return;
if(context!=null) {
return;
}
_logger.info("init Spring Context...");
SimpleDateFormat sdf_ymdhms =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime=sdf_ymdhms.format(new Date());

View File

@@ -120,7 +120,9 @@ public class FormBasedDetailsServiceTest {
@Before
public void initSpringContext(){
if(context!=null) return;
if(context!=null) {
return;
}
_logger.info("init Spring Context...");
SimpleDateFormat sdf_ymdhms =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime=sdf_ymdhms.format(new Date());