Commit d74cb6d2 authored by renjie's avatar renjie

browser-backend

parent 4e6f31b8
...@@ -95,12 +95,12 @@ public class AccountController { ...@@ -95,12 +95,12 @@ public class AccountController {
return accountService.saveChanges(principal.getName(), account); return accountService.saveChanges(principal.getName(), account);
} }
@RequestMapping(path = "/smsotp/{phone}", method = RequestMethod.GET) @RequestMapping(path = "/authCode", method = RequestMethod.GET)
public void requestOTP(@PathVariable String phone, @RequestParam(value = "by") String by) { public void requestOTP(@RequestParam(value = "mobile") String phone, @RequestParam(value = "by") String by) {
accountService.sendSmsOtp(phone, by); accountService.sendSmsOtp(phone, by);
} }
@RequestMapping(path = "/", method = RequestMethod.POST) @RequestMapping(path = "/signup", method = RequestMethod.POST)
public Account createNewAccount(@Valid @RequestBody User user) { public Account createNewAccount(@Valid @RequestBody User user) {
if (!StringUtils.isEmpty(user.getEmail())) if (!StringUtils.isEmpty(user.getEmail()))
return accountService.create(user); return accountService.create(user);
......
...@@ -118,14 +118,6 @@ public class AdministratorController { ...@@ -118,14 +118,6 @@ public class AdministratorController {
return administratorService.lockAbnormalAccount(name,account); return administratorService.lockAbnormalAccount(name,account);
} }
//将某个用户归属于代理tested
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(path ="/0xadministrator/belongtoagency/{name}",method = RequestMethod.PUT)
public Account belongToAgency(@PathVariable String name , @Valid @RequestBody Account account){
return administratorService.accountBelongToAgency(name,account);
}
//查询用户余额 //查询用户余额
@PreAuthorize(Securitys.ADMIN_EL) @PreAuthorize(Securitys.ADMIN_EL)
@RequestMapping(path = "/0xadministrator/finduserbalance", method = RequestMethod.GET) @RequestMapping(path = "/0xadministrator/finduserbalance", method = RequestMethod.GET)
......
...@@ -30,49 +30,12 @@ public class Account { ...@@ -30,49 +30,12 @@ public class Account {
private String phoneNumber; private String phoneNumber;
private String country;
private String province;
private String agencyID;
private String lockReason; private String lockReason;
private int iprate;
private boolean isPrePaid = true; private boolean isPrePaid = true;
private String token; private String token;
/**
是否具有参与免费试用两小时云主机资格
*/
private Boolean isQualified=true;
public Boolean isQualified() {
return isQualified;
}
public void setQualified(Boolean qualified) {
isQualified = qualified;
}
public int getIprate() {
return iprate;
}
public void setIprate(int iprate) {
this.iprate = iprate;
}
public String getAgencyID(){
return agencyID;
}
public void setAgencyID(String agencyID){
this.agencyID = agencyID;
}
private boolean allowedToCreateSubUser = false; private boolean allowedToCreateSubUser = false;
private boolean allowedToCreateCloudAccount = false; private boolean allowedToCreateCloudAccount = false;
...@@ -123,11 +86,9 @@ public class Account { ...@@ -123,11 +86,9 @@ public class Account {
this.setAllowedToCreateSubUser(account.isAllowedToCreateSubUser()); this.setAllowedToCreateSubUser(account.isAllowedToCreateSubUser());
this.setAllowedToCreateCloudAccount(account.isAllowedToCreateCloudAccount()); this.setAllowedToCreateCloudAccount(account.isAllowedToCreateCloudAccount());
this.setCompanyName(account.getCompanyName()); this.setCompanyName(account.getCompanyName());
this.setCountry(account.getCountry());
this.setEmail(account.getEmail()); this.setEmail(account.getEmail());
this.setJobTitle(account.getJobTitle()); this.setJobTitle(account.getJobTitle());
this.setPhoneNumber(account.getPhoneNumber()); this.setPhoneNumber(account.getPhoneNumber());
this.setProvince(account.getProvince());
} }
public String getEmail() { public String getEmail() {
...@@ -162,22 +123,6 @@ public class Account { ...@@ -162,22 +123,6 @@ public class Account {
this.phoneNumber = phoneNumber; this.phoneNumber = phoneNumber;
} }
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
@Length(min = 0, max = 20000) @Length(min = 0, max = 20000)
private String note; private String note;
......
...@@ -24,22 +24,14 @@ public class AccountDto { ...@@ -24,22 +24,14 @@ public class AccountDto {
private String phoneNumber; private String phoneNumber;
private String country;
private String province;
private boolean allowedToCreateSubUser; private boolean allowedToCreateSubUser;
private boolean allowedToCreateCloudAccount; private boolean allowedToCreateCloudAccount;
private List<CloudAccountDto> cloudAccounts;
private int balance; private int balance;
private boolean isPrePaid = true; private boolean isPrePaid = true;
private boolean isVpsUser = false;
private String parent; private String parent;
private String token; private String token;
...@@ -53,24 +45,14 @@ public class AccountDto { ...@@ -53,24 +45,14 @@ public class AccountDto {
this.setAllowedToCreateSubUser(account.isAllowedToCreateSubUser()); this.setAllowedToCreateSubUser(account.isAllowedToCreateSubUser());
this.setAllowedToCreateCloudAccount(account.isAllowedToCreateCloudAccount()); this.setAllowedToCreateCloudAccount(account.isAllowedToCreateCloudAccount());
this.setCompanyName(account.getCompanyName()); this.setCompanyName(account.getCompanyName());
this.setCountry(account.getCountry());
this.setEmail(account.getEmail()); this.setEmail(account.getEmail());
this.setJobTitle(account.getJobTitle()); this.setJobTitle(account.getJobTitle());
this.setPhoneNumber(account.getPhoneNumber()); this.setPhoneNumber(account.getPhoneNumber());
this.setProvince(account.getProvince());
this.setUserServices(account.getUserServices()); this.setUserServices(account.getUserServices());
this.setParent(account.getParent()); this.setParent(account.getParent());
this.setToken(account.getToken()); this.setToken(account.getToken());
} }
public boolean isVpsUser() {
return isVpsUser;
}
public void setVpsUser(boolean vpsUser) {
isVpsUser = vpsUser;
}
public boolean isPrePaid() { public boolean isPrePaid() {
return isPrePaid; return isPrePaid;
} }
...@@ -97,15 +79,6 @@ public class AccountDto { ...@@ -97,15 +79,6 @@ public class AccountDto {
this.userServices = userServices; this.userServices = userServices;
} }
public List<CloudAccountDto> getCloudAccounts() {
return cloudAccounts;
}
public void setCloudAccounts(List<CloudAccountDto> cloudAccounts) {
this.cloudAccounts = cloudAccounts;
}
public boolean isAllowedToCreateCloudAccount() { public boolean isAllowedToCreateCloudAccount() {
return allowedToCreateCloudAccount; return allowedToCreateCloudAccount;
} }
...@@ -186,22 +159,6 @@ public class AccountDto { ...@@ -186,22 +159,6 @@ public class AccountDto {
this.phoneNumber = phoneNumber; this.phoneNumber = phoneNumber;
} }
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public boolean isAllowedToCreateSubUser() { public boolean isAllowedToCreateSubUser() {
return allowedToCreateSubUser; return allowedToCreateSubUser;
} }
......
...@@ -28,10 +28,6 @@ public interface AdministratorService { ...@@ -28,10 +28,6 @@ public interface AdministratorService {
Account lockAbnormalAccount(String name, Account account); Account lockAbnormalAccount(String name, Account account);
Account accountBelongToAgency(String name, Account account);
Account accountDismissalAgency(String name, Account account);
Page<Account> searchAllUserPage(Pageable pageable); Page<Account> searchAllUserPage(Pageable pageable);
Page<UserPrePaidBilling> searchAllUserBillingPage(int page, int year1, int month1, int year2, int month2); Page<UserPrePaidBilling> searchAllUserBillingPage(int page, int year1, int month1, int year2, int month2);
......
...@@ -742,10 +742,8 @@ public class AccountServiceImpl implements AccountService { ...@@ -742,10 +742,8 @@ public class AccountServiceImpl implements AccountService {
} }
childAccount.setAllowedToCreateSubUser(user.isAllowedToCreateSubUser()); childAccount.setAllowedToCreateSubUser(user.isAllowedToCreateSubUser());
childAccount.setAllowedToCreateCloudAccount(user.isAllowedToCreateCloudAccount()); childAccount.setAllowedToCreateCloudAccount(user.isAllowedToCreateCloudAccount());
childAccount.setProvince(user.getProvince());
childAccount.setPhoneNumber(user.getPhoneNumber()); childAccount.setPhoneNumber(user.getPhoneNumber());
childAccount.setJobTitle(user.getJobTitle()); childAccount.setJobTitle(user.getJobTitle());
childAccount.setCountry(user.getCountry());
childAccount.setCompanyName(user.getCompanyName()); childAccount.setCompanyName(user.getCompanyName());
repository.save(childAccount); repository.save(childAccount);
return childAccount; return childAccount;
...@@ -764,10 +762,8 @@ public class AccountServiceImpl implements AccountService { ...@@ -764,10 +762,8 @@ public class AccountServiceImpl implements AccountService {
account.setNote(update.getNote()); account.setNote(update.getNote());
account.setLastSeen(new Date()); account.setLastSeen(new Date());
account.setCompanyName(update.getCompanyName()); account.setCompanyName(update.getCompanyName());
account.setCountry(update.getCountry());
account.setJobTitle(update.getJobTitle()); account.setJobTitle(update.getJobTitle());
// account.setPhoneNumber(update.getPhoneNumber()); // account.setPhoneNumber(update.getPhoneNumber());
account.setProvince(update.getProvince());
account.setEmail(update.getEmail()); account.setEmail(update.getEmail());
log.debug("account {} changes has been saved", name); log.debug("account {} changes has been saved", name);
if (!org.apache.commons.lang3.StringUtils.equalsIgnoreCase(preEmail, update.getEmail())) { if (!org.apache.commons.lang3.StringUtils.equalsIgnoreCase(preEmail, update.getEmail())) {
......
...@@ -138,31 +138,6 @@ public class AdministratorServiceImpl implements AdministratorService { ...@@ -138,31 +138,6 @@ public class AdministratorServiceImpl implements AdministratorService {
return abnormalAccount; return abnormalAccount;
} }
@Override
public Account accountBelongToAgency(String name, Account account) {
Account belongToAgencyAccount = accountRepository.findByName(name);
if (belongToAgencyAccount == null)
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST, "Username does not exist: " + name);
belongToAgencyAccount.setAgencyID(account.getAgencyID());
accountRepository.save(belongToAgencyAccount);
return belongToAgencyAccount;
}
@Override
public Account accountDismissalAgency(String name, Account account) {
Account dismissalAgencyAccount = accountRepository.findByName(name);
if (dismissalAgencyAccount == null)
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST, "Username does not exist: " + name);
dismissalAgencyAccount.setAgencyID(null);
accountRepository.save(dismissalAgencyAccount);
return dismissalAgencyAccount;
}
@Override @Override
public Page<Account> searchAllUserPage(Pageable pageable) { public Page<Account> searchAllUserPage(Pageable pageable) {
Page<Account> accounts = accountRepository.findAll(pageable); Page<Account> accounts = accountRepository.findAll(pageable);
......
...@@ -30,7 +30,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -30,7 +30,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public void configure(WebSecurity web) throws Exception { public void configure(WebSecurity web) throws Exception {
web.ignoring() web.ignoring()
.antMatchers("/users/verify/**", "/users/changepass", "/"); .antMatchers("/users/verify/**", "/users/changepass", "/account/authCode", "/account/signup");
} }
@Override @Override
......
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