Commit ba2f33d5 authored by renjie's avatar renjie

认证资格设置

parent 90d548b4
...@@ -332,6 +332,25 @@ public class AdministratorController { ...@@ -332,6 +332,25 @@ public class AdministratorController {
return resultDto; return resultDto;
} }
//获取用户企业认证的信息
@PreAuthorize(Securitys.ADMIN_EL)
@RequestMapping(path = "/0xadministrator/authorize/set", method = RequestMethod.PUT)
public ResultDto setAuthorize(Principal principal, @RequestParam("username") String username, @RequestParam("isAgree") boolean isAgree) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(accountService.setAuthorize(username, isAgree));
resultDto.setStatus(0);
}catch (ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode());
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
}
return resultDto;
}
//添加推广码 //添加推广码
@PreAuthorize(Securitys.ADMIN_EL) @PreAuthorize(Securitys.ADMIN_EL)
@RequestMapping(path = "/0xadministrator/promotioncode/add", method = RequestMethod.PUT) @RequestMapping(path = "/0xadministrator/promotioncode/add", method = RequestMethod.PUT)
......
...@@ -110,4 +110,6 @@ public interface AccountService { ...@@ -110,4 +110,6 @@ public interface AccountService {
File getAuthorizeFiles(String username); File getAuthorizeFiles(String username);
boolean setAuthorize(String username, boolean isAgree);
} }
...@@ -1182,4 +1182,22 @@ public class AccountServiceImpl implements AccountService { ...@@ -1182,4 +1182,22 @@ public class AccountServiceImpl implements AccountService {
throw new ClientRequestException(BrowserErrorCode.UNKNOWN); throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
} }
} }
@Override
public boolean setAuthorize(String username, boolean isAgree) {
try {
Account account = repository.findByName(username);
if (account == null)
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
if (isAgree)
account.setAuthorized(2);
else
account.setAuthorized(3);
repository.save(account);
return true;
} catch (Exception e) {
log.error(e.getMessage());
return false;
}
}
} }
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