2023-01-06 15:17:37 +08:00
|
|
|
|
package com.ai.da.controller;
|
|
|
|
|
|
|
2024-08-19 15:10:41 +08:00
|
|
|
|
import com.ai.da.common.config.exception.BusinessException;
|
2023-12-11 16:59:05 +08:00
|
|
|
|
import com.ai.da.common.response.PageBaseResponse;
|
2023-01-06 15:17:37 +08:00
|
|
|
|
import com.ai.da.common.response.Response;
|
2024-11-13 15:44:48 +08:00
|
|
|
|
import com.ai.da.mapper.primary.entity.Account;
|
2024-02-20 10:12:44 +08:00
|
|
|
|
import com.ai.da.mapper.primary.entity.TrialOrder;
|
2023-01-06 15:17:37 +08:00
|
|
|
|
import com.ai.da.model.dto.*;
|
|
|
|
|
|
import com.ai.da.model.vo.AccountLoginVO;
|
|
|
|
|
|
import com.ai.da.model.vo.AccountPreLoginVO;
|
2024-08-21 10:23:55 +08:00
|
|
|
|
import com.ai.da.model.vo.PersonalHomepageVO;
|
2023-01-06 15:17:37 +08:00
|
|
|
|
import com.ai.da.service.AccountService;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2023-12-29 13:48:42 +08:00
|
|
|
|
import org.springframework.http.HttpStatus;
|
2024-08-19 15:10:41 +08:00
|
|
|
|
import org.springframework.util.StringUtils;
|
2023-01-06 15:17:37 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
2024-08-19 15:10:41 +08:00
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
2023-01-06 15:17:37 +08:00
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import javax.validation.Valid;
|
2023-12-29 13:48:42 +08:00
|
|
|
|
import java.util.HashMap;
|
2023-12-11 16:59:05 +08:00
|
|
|
|
import java.util.List;
|
2023-12-29 13:48:42 +08:00
|
|
|
|
import java.util.Map;
|
2023-01-06 15:17:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Api(tags = "Account模块")
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
@RequestMapping("/api/account")
|
|
|
|
|
|
public class AccountController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
private AccountService accountService;
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "预先登入")
|
|
|
|
|
|
@PostMapping("/preLogin")
|
|
|
|
|
|
public Response<AccountPreLoginVO> preLogin(@Valid @RequestBody AccountPreLoginDTO accountDTO) {
|
|
|
|
|
|
return Response.success(accountService.preLogin(accountDTO));
|
|
|
|
|
|
}
|
2023-10-20 14:47:18 +08:00
|
|
|
|
|
2023-01-06 15:17:37 +08:00
|
|
|
|
@ApiOperation(value = "登入")
|
|
|
|
|
|
@PostMapping("/login")
|
|
|
|
|
|
public Response<AccountLoginVO> login(@Valid @RequestBody AccountLoginDTO accountDTO, HttpServletRequest request) {
|
2023-10-20 14:47:18 +08:00
|
|
|
|
return Response.success(accountService.login(accountDTO, request));
|
2023-01-06 15:17:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "绑定邮箱")
|
|
|
|
|
|
@PostMapping("/bindEmail")
|
|
|
|
|
|
public Response<Boolean> bindEmail(@Valid @RequestBody AccountBindEmailDTO accountBindEmailDTO) {
|
|
|
|
|
|
return Response.success(accountService.bindEmail(accountBindEmailDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "忘记密码")
|
|
|
|
|
|
@PostMapping("/resetPwd")
|
|
|
|
|
|
public Response<Boolean> resetPwd(@Valid @RequestBody AccountRegisterDTO accountRegisterDTO) {
|
|
|
|
|
|
return Response.success(accountService.forgetPwd(accountRegisterDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "发送邮件")
|
|
|
|
|
|
@PostMapping("/sendEmail")
|
|
|
|
|
|
public Response<Boolean> sendEmail(@Valid @RequestBody EmailSendDTO emailSendDTO) {
|
|
|
|
|
|
return Response.success(accountService.sendEmail(emailSendDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "登出")
|
|
|
|
|
|
@PostMapping("/logout")
|
|
|
|
|
|
public Response<Boolean> logout(@Valid @RequestBody AccountLogoutDTO accountLogoutDTO) {
|
2023-10-20 14:47:18 +08:00
|
|
|
|
return Response.success(accountService.logout(accountLogoutDTO));
|
2023-01-06 15:17:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "是否登入")
|
|
|
|
|
|
@PostMapping("/isLogin")
|
|
|
|
|
|
public Response<Boolean> isLogin(@Valid @RequestBody AccountLogoutDTO accountLogoutDTO) {
|
2023-10-20 14:47:18 +08:00
|
|
|
|
return Response.success(accountService.isLogin(accountLogoutDTO));
|
2023-01-06 15:17:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-31 15:05:27 +08:00
|
|
|
|
@ApiOperation(value = "获取当前用户语言")
|
|
|
|
|
|
@PostMapping("/getUserLanguage")
|
2023-11-09 17:13:33 +08:00
|
|
|
|
public Response<String> getUserLanguage() {
|
2023-10-31 15:05:27 +08:00
|
|
|
|
return Response.success(accountService.getUserLanguage());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-07 11:32:03 +08:00
|
|
|
|
@ApiOperation(value = "切换当前用户语言")
|
2023-11-14 15:26:54 +08:00
|
|
|
|
@GetMapping("/changeUserLanguage")
|
2023-10-31 15:28:37 +08:00
|
|
|
|
public Response<String> changeUserLanguage(String language) {
|
|
|
|
|
|
return Response.success(accountService.changeUserLanguage(language));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-20 15:06:15 +08:00
|
|
|
|
@ApiOperation(value = "试用用户退出登录")
|
|
|
|
|
|
@GetMapping("/trialUserLogout")
|
|
|
|
|
|
public Response<Boolean> trialUserLogout() {
|
|
|
|
|
|
return Response.success(accountService.trialUserLogout());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-29 14:37:32 +08:00
|
|
|
|
@ApiOperation(value = "完成新手教程")
|
|
|
|
|
|
@PostMapping("/completeGuidance")
|
|
|
|
|
|
public Response<Boolean> completeGuidance() {
|
|
|
|
|
|
return Response.success(accountService.completeGuidance());
|
|
|
|
|
|
}
|
2023-12-11 16:59:05 +08:00
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "试用订单列表")
|
|
|
|
|
|
@PostMapping("/trialOrderList")
|
|
|
|
|
|
public Response<PageBaseResponse<TrialOrder>> trialOrderList(@Valid @RequestBody TrialOrderDTO trialOrderDTO) {
|
|
|
|
|
|
return Response.success(PageBaseResponse.success(accountService.trialOrderList(trialOrderDTO)));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "通过试用订单审批")
|
|
|
|
|
|
@PostMapping("/trialOrderApproval")
|
|
|
|
|
|
public Response<Boolean> trialOrderApproval(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
|
return Response.success(accountService.trialOrderApproval(ids));
|
|
|
|
|
|
}
|
2023-12-14 16:33:57 +08:00
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "拒绝试用订单审批")
|
|
|
|
|
|
@PostMapping("/trialOrderRefuse")
|
|
|
|
|
|
public Response<Boolean> trialOrderRefuse(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
|
return Response.success(accountService.trialOrderRefuse(ids));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取是否自动审评")
|
|
|
|
|
|
@PostMapping("/getIsAutoApproval")
|
|
|
|
|
|
public Response<Boolean> getIsAutoApproval() {
|
|
|
|
|
|
return Response.success(accountService.getIsAutoApproval());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "切换是否自动审评")
|
|
|
|
|
|
@PostMapping("/switchIsAutoApproval")
|
|
|
|
|
|
public Response<Boolean> switchIsAutoApproval() {
|
|
|
|
|
|
return Response.success(accountService.switchIsAutoApproval());
|
|
|
|
|
|
}
|
2023-12-29 13:48:42 +08:00
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "aws状态检测")
|
|
|
|
|
|
@GetMapping("/healthy")
|
|
|
|
|
|
@ResponseStatus(HttpStatus.OK)
|
|
|
|
|
|
public Response<Map<String,Integer>> checkStatus(){
|
|
|
|
|
|
Map<String,Integer> returnMap = new HashMap<>();
|
|
|
|
|
|
returnMap.put("code",200);
|
|
|
|
|
|
return Response.success(returnMap);
|
|
|
|
|
|
}
|
2024-01-04 15:22:38 +08:00
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询账号到期时间")
|
|
|
|
|
|
@PostMapping("/getExpiredTime")
|
|
|
|
|
|
public Response<Long> getExpiredTime(){
|
|
|
|
|
|
return Response.success(accountService.getExpiredTime());
|
|
|
|
|
|
}
|
2024-01-15 15:06:48 +08:00
|
|
|
|
|
2024-01-17 17:49:40 +08:00
|
|
|
|
@ApiOperation(value = "免密登录")
|
2024-01-15 15:06:48 +08:00
|
|
|
|
@PostMapping("/noLoginRequired")
|
2024-01-17 17:49:40 +08:00
|
|
|
|
public Response<AccountLoginVO> noLoginRequired(@RequestBody NoLoginRequiredDTO noLoginRequiredDTO, HttpServletRequest request){
|
|
|
|
|
|
return Response.success(accountService.noLoginRequired(noLoginRequiredDTO, request));
|
2024-01-15 15:06:48 +08:00
|
|
|
|
}
|
2024-01-26 13:17:59 +08:00
|
|
|
|
|
|
|
|
|
|
@PostMapping("upgradeNotification")
|
|
|
|
|
|
@ApiOperation(value = "升级邮件通知")
|
|
|
|
|
|
public Response<Boolean> upgradeNotification() {
|
|
|
|
|
|
accountService.upgradeNotification();
|
|
|
|
|
|
return Response.success(true);
|
|
|
|
|
|
}
|
2024-06-12 09:47:55 +08:00
|
|
|
|
|
2024-06-17 09:34:48 +08:00
|
|
|
|
@CrossOrigin
|
2024-06-12 09:47:55 +08:00
|
|
|
|
@ApiOperation(value = "广场用户注册")
|
|
|
|
|
|
@PostMapping("/designWorksRegister")
|
|
|
|
|
|
public Response<Boolean> designWorksRegister(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
|
|
|
|
|
return Response.success(accountService.designWorksRegister(accountDesignWorksRegisterDTO));
|
|
|
|
|
|
}
|
2024-06-17 09:34:48 +08:00
|
|
|
|
|
|
|
|
|
|
@CrossOrigin
|
|
|
|
|
|
@ApiOperation(value = "广场用户注册")
|
|
|
|
|
|
@PostMapping("/designWorksRegisterCode")
|
|
|
|
|
|
public Response<AccountLoginVO> designWorksRegisterCode(@Valid @RequestBody AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
|
|
|
|
|
return Response.success(accountService.designWorksRegisterCode(accountDesignWorksRegisterDTO));
|
|
|
|
|
|
}
|
2024-06-20 10:27:04 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 填写调查问卷
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@ApiOperation(value = "填写调查问卷")
|
|
|
|
|
|
@PostMapping("/questionnaire")
|
|
|
|
|
|
public Response<Boolean> questionnaire(@Valid @RequestBody String questionnaireInfo){
|
|
|
|
|
|
return Response.success(accountService.collectQuestionnaires(questionnaireInfo));
|
|
|
|
|
|
}
|
2024-07-19 15:40:54 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 参与活动 获取福利
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@ApiOperation(value = "参与活动 获取福利")
|
|
|
|
|
|
@GetMapping("/activity")
|
|
|
|
|
|
public Response<String> getActivityBenefits(){
|
|
|
|
|
|
return Response.success(accountService.getActivityBenefits());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "将用户账号过期时间设置为过期当天的23:59:59")
|
|
|
|
|
|
@GetMapping("/setUserValidToDayEnd")
|
|
|
|
|
|
public Response<List<Long>> setUserValidToDayEnd(){
|
|
|
|
|
|
return Response.success(accountService.setUserValidToDayEnd());
|
|
|
|
|
|
}
|
2024-08-19 15:10:41 +08:00
|
|
|
|
|
|
|
|
|
|
// 用户上传头像
|
|
|
|
|
|
@ApiOperation(value = "上传头像")
|
2024-08-21 10:23:55 +08:00
|
|
|
|
@PostMapping(path = "/uploadAvatar")
|
2024-08-19 15:10:41 +08:00
|
|
|
|
public Response<String> uploadAvatar(@RequestParam("file") MultipartFile file) {
|
|
|
|
|
|
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
|
|
|
|
|
throw new BusinessException("file.cannot.be.empty");
|
|
|
|
|
|
}
|
|
|
|
|
|
return Response.success(accountService.uploadAvatar(file));
|
|
|
|
|
|
}
|
2024-08-21 10:23:55 +08:00
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "个人主页浏览量增加")
|
|
|
|
|
|
@GetMapping("/viewsIncrease")
|
|
|
|
|
|
public Response<Boolean> viewsGet(@RequestParam("id") Long id) {
|
|
|
|
|
|
return Response.success(accountService.viewsIncrease(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取个人主页信息")
|
|
|
|
|
|
@GetMapping("/personalHomepage")
|
|
|
|
|
|
public Response<PersonalHomepageVO> getPersonalHomepage(@RequestParam("id") Long id){
|
|
|
|
|
|
return Response.success(accountService.getPersonalHomepage(id));
|
|
|
|
|
|
}
|
2024-09-25 16:15:18 +08:00
|
|
|
|
|
2024-09-27 15:40:30 +08:00
|
|
|
|
@ApiOperation(value = "getUsernameModifyTimes")
|
2024-09-25 16:15:18 +08:00
|
|
|
|
@GetMapping("/getNicknameModifyTimes")
|
|
|
|
|
|
public Response<Map<String, Long>> getNicknameModifyTimes(){
|
|
|
|
|
|
return Response.success(accountService.getNicknameModifyTimes());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "editUserName")
|
|
|
|
|
|
@GetMapping("/editUserName")
|
|
|
|
|
|
public Response<String> editUserName(@RequestParam("newUserName") String newUserName){
|
|
|
|
|
|
accountService.editUserName(newUserName);
|
|
|
|
|
|
return Response.success("success");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "verifyUserEmail")
|
|
|
|
|
|
@GetMapping("/verifyUserEmail")
|
|
|
|
|
|
public Response<String> verifyUserEmail(@RequestParam("verifyCode") String verifyCode){
|
|
|
|
|
|
accountService.verifyUserEmail(verifyCode);
|
|
|
|
|
|
return Response.success("success");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "changeUserEmail")
|
|
|
|
|
|
@GetMapping("/changeUserEmail")
|
|
|
|
|
|
public Response<String> changeUserEmail(@RequestParam("newMailbox") String newMailbox){
|
|
|
|
|
|
accountService.changeUserEmail(newMailbox);
|
|
|
|
|
|
return Response.success("success");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "activateNewEmail")
|
|
|
|
|
|
@GetMapping("/activateNewEmail")
|
|
|
|
|
|
public Response<String> activateNewEmail(@RequestParam("token") String token){
|
|
|
|
|
|
accountService.activateNewEmail(token);
|
|
|
|
|
|
return Response.success("success");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-03 12:14:30 +08:00
|
|
|
|
@PostMapping("halfPricePromotion")
|
|
|
|
|
|
@ApiOperation(value = "十月半价活动")
|
|
|
|
|
|
public Response<Boolean> halfPricePromotion() {
|
|
|
|
|
|
accountService.halfPricePromotion();
|
|
|
|
|
|
return Response.success(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-02 12:02:19 +08:00
|
|
|
|
@PostMapping("temporaryUpgrade")
|
|
|
|
|
|
@ApiOperation(value = "临时升级")
|
|
|
|
|
|
public Response<Boolean> temporaryUpgrade() {
|
|
|
|
|
|
accountService.temporaryUpgrade();
|
|
|
|
|
|
return Response.success(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-13 15:44:48 +08:00
|
|
|
|
@PostMapping("enterpriseLogin")
|
|
|
|
|
|
@ApiOperation(value = "企业登录")
|
|
|
|
|
|
public Response<AccountLoginVO> enterpriseLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
|
|
|
|
|
|
return Response.success(accountService.enterpriseLogin(accountDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("schoolLogin")
|
|
|
|
|
|
@ApiOperation(value = "学校登录")
|
|
|
|
|
|
public Response<AccountLoginVO> schoolLogin(@Valid @RequestBody AccountLoginDTO accountDTO) {
|
|
|
|
|
|
return Response.success(accountService.schoolLogin(accountDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("addOrUpdateSubAccount")
|
|
|
|
|
|
@ApiOperation(value = "子账号新增")
|
|
|
|
|
|
public Response<Boolean> addSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
|
|
|
|
|
|
return Response.success(accountService.addSubAccount(addSubAccountDTO));
|
|
|
|
|
|
}
|
2024-09-25 16:15:18 +08:00
|
|
|
|
|
2024-11-13 15:44:48 +08:00
|
|
|
|
@PostMapping("deleteSubAccount")
|
|
|
|
|
|
@ApiOperation(value = "子账号删除")
|
|
|
|
|
|
public Response<Boolean> deleteSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
|
|
|
|
|
|
return Response.success(accountService.deleteSubAccount(addSubAccountDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("subAccountList")
|
|
|
|
|
|
@ApiOperation(value = "子账号查询")
|
|
|
|
|
|
public Response<PageBaseResponse<Account>> subAccountList(@Valid @RequestBody SubAccountPageDTO subAccountPageDTO) {
|
|
|
|
|
|
return Response.success(accountService.subAccountList(subAccountPageDTO));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("accountDetail")
|
|
|
|
|
|
@ApiOperation(value = "账号详情")
|
|
|
|
|
|
public Response<Account> accountDetail(@RequestParam("id") Long id) {
|
|
|
|
|
|
return Response.success(accountService.accountDetail(id));
|
|
|
|
|
|
}
|
2024-12-09 13:31:30 +08:00
|
|
|
|
|
|
|
|
|
|
@PostMapping("getAccountDetail")
|
|
|
|
|
|
@ApiOperation(value = "获取账户信息")
|
|
|
|
|
|
public Response<AccountLoginVO> getAccountDetail() {
|
|
|
|
|
|
return Response.success(accountService.getAccountDetail());
|
|
|
|
|
|
}
|
2024-12-11 14:21:29 +08:00
|
|
|
|
|
|
|
|
|
|
@CrossOrigin
|
|
|
|
|
|
@GetMapping("/bindGoogle")
|
|
|
|
|
|
@ApiOperation(value = "绑定谷歌")
|
2024-12-11 16:21:18 +08:00
|
|
|
|
public Response<Boolean> bindGoogle(@RequestParam("credential") String credential) {
|
2024-12-11 14:21:29 +08:00
|
|
|
|
return Response.success(accountService.bindGoogle(credential));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@CrossOrigin
|
|
|
|
|
|
@GetMapping("/bindWeChat")
|
|
|
|
|
|
@ApiOperation(value = "绑定微信")
|
2024-12-11 16:21:18 +08:00
|
|
|
|
public Response<Boolean> bindWeChat(@RequestParam("code") String code) {
|
2024-12-11 14:21:29 +08:00
|
|
|
|
return Response.success(accountService.bindWeChat(code));
|
|
|
|
|
|
}
|
2023-01-06 15:17:37 +08:00
|
|
|
|
}
|