puzhibing
2023-07-07 bfc06fc14d3c54801bfa94a138746daf3076358d
cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java
@@ -2,6 +2,7 @@
import com.dsh.account.entity.TAppUser;
import com.dsh.account.feignclient.other.SysLogClient;
import com.dsh.account.model.vo.userBenefitDetail.AppUserDetailsVo;
import com.dsh.account.model.vo.userBenefitDetail.BillingDetailsVo;
import com.dsh.account.model.vo.userBenefitDetail.IndexOfUserBenefirVo;
@@ -14,7 +15,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
/**
 * 使用福利 控制器
 */
@RestController
@RequestMapping("")
@@ -26,6 +32,9 @@
    @Autowired
    private TokenUtil tokenUtil;
    @Resource
    private SysLogClient slClient;
    private final SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
@@ -78,6 +87,58 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/useBenefit/cancellation")
    @ApiOperation(value = "个人信息-注销账号", tags = {"APP-使用福利"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
    })
    public ResultUtil cancellationAccount(){
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if(null == appUserId){
                return ResultUtil.tokenErr();
            }
//            变更账号的状态为删除
            tauService.cancellation(appUserId);
//            增加一条注销账号的日志
            slClient.cancellation(appUserId);
//            删除redis中用户key
            tokenUtil.logout();
            return ResultUtil.success();
        }catch (Exception e){
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
    @PostMapping("/api/useBenefit/logOut")
    @ApiOperation(value = "个人信息-退出登录", tags = {"APP-使用福利"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
    })
    public ResultUtil logOutAccount(){
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if(null == appUserId){
                return ResultUtil.tokenErr();
            }
            //            增加一条退出账号的日志
            slClient.logOut(appUserId);
            //            删除redis中用户key
            tokenUtil.logout();
            return ResultUtil.success();
        }catch (Exception e){
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
    @PostMapping("/api/useBenefit/userBilling")
    @ApiOperation(value = "账单", tags = {"APP-使用福利"})