From 7a14e1592dd0c2cfd6cd4e8b11f95c9f46f2ffe7 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 05 七月 2023 20:07:04 +0800 Subject: [PATCH] 修改支付相关逻辑代码 --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java | 110 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 98 insertions(+), 12 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java index 0e672e2..0fa2132 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java @@ -1,21 +1,17 @@ package com.stylefeng.guns.modular.api; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.google.code.kaptcha.Constants; import com.stylefeng.guns.core.common.constant.JwtConstants; import com.stylefeng.guns.core.common.exception.InvalidKaptchaException; import com.stylefeng.guns.core.support.HttpKit; import com.stylefeng.guns.core.util.ToolUtil; +import com.stylefeng.guns.modular.system.model.BankCard; import com.stylefeng.guns.modular.system.model.UserInfo; -import com.stylefeng.guns.modular.system.service.IReportLossService; -import com.stylefeng.guns.modular.system.service.ISmsrecordService; -import com.stylefeng.guns.modular.system.service.IUserInfoService; -import com.stylefeng.guns.modular.system.service.IVerifiedService; +import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; -import com.stylefeng.guns.modular.system.warpper.LoginWarpper; -import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; -import com.stylefeng.guns.modular.system.warpper.UserInviteInfoWarpper; -import com.stylefeng.guns.modular.system.warpper.VerifiedWarpper; +import com.stylefeng.guns.modular.system.warpper.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -55,6 +51,9 @@ @Autowired private IReportLossService reportLossService; + + @Autowired + private IBankCardService bankCardService; @Value("${spring.mail.template-path}") private String templatePath; @@ -788,25 +787,25 @@ */ @ResponseBody @PostMapping("/api/user/updateInfo") - @ApiOperation(value = "修改个人信息", tags = {"用户端-个人中心"}, notes = "") + @ApiOperation(value = "修改个人信息【1.1】", tags = {"用户端-个人中心"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "string"), @ApiImplicitParam(value = "昵称", name = "nickname", required = false, dataType = "string"), @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"), @ApiImplicitParam(value = "生日(2020-06-15)", name = "birthday", required = false, dataType = "string"), @ApiImplicitParam(value = "邮箱", name = "email", required = false, dataType = "string"), + @ApiImplicitParam(value = "邮箱验证码", name = "code", required = false, dataType = "string"), @ApiImplicitParam(value = "姓氏", name = "lastName", required = false, dataType = "string"), @ApiImplicitParam(value = "名字", name = "firstName", required = false, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil updateInfo(String avatar, String nickname, Integer sex, Date birthday, String email, String lastName, String firstName, HttpServletRequest request){ + public ResultUtil updateInfo(String avatar, String nickname, Integer sex, Date birthday, String email, String code, String lastName, String firstName, Integer language, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } - userInfoService.updateInfo(avatar, nickname, sex, birthday, email, lastName, firstName, uid); - return ResultUtil.success(); + return userInfoService.updateInfo(avatar, nickname, sex, birthday, email, code, lastName, firstName, uid, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -988,4 +987,91 @@ return ResultUtil.runErr(); } } + + + @ResponseBody + @PostMapping("/api/user/queryBankCardList") + @ApiOperation(value = "获取银行卡列表【1.1】", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil<List<BankCardWarpper>> queryBankCardList(HttpServletRequest request){ + try { + Integer uid = userInfoService.getUserIdFormRedis(request); + if(null == uid){ + return ResultUtil.tokenErr(); + } + List<BankCard> bankCards = bankCardService.selectList(new EntityWrapper<BankCard>().eq("userType", 1).eq("userId", uid)); + List<BankCardWarpper> list = new ArrayList<>(); + for (BankCard bankCard : bankCards) { + BankCardWarpper bankCardWarpper = new BankCardWarpper(); + bankCardWarpper.setId(bankCard.getId()); + bankCardWarpper.setBankName(bankCard.getBank()); + bankCardWarpper.setCode(bankCard.getCode()); + list.add(bankCardWarpper); + } + return ResultUtil.success(list); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } + + + + @ResponseBody + @PostMapping("/api/user/addBankCard") + @ApiOperation(value = "添加银行卡【1.1】", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "银行", name = "bank", required = true, dataType = "string"), + @ApiImplicitParam(value = "姓", name = "lastName", required = true, dataType = "string"), + @ApiImplicitParam(value = "名", name = "firstName", required = true, dataType = "string"), + @ApiImplicitParam(value = "卡号", name = "code", required = true, dataType = "string"), + @ApiImplicitParam(value = "1=中文,2=英文,3=法语", name = "language", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil addBankCard(String bank, String lastName, String firstName, String code, Integer language, HttpServletRequest request) { + try { + Integer uid = userInfoService.getUserIdFormRedis(request); + if(null == uid){ + return ResultUtil.tokenErr(); + } + BankCard bankCard = bankCardService.selectOne(new EntityWrapper<BankCard>().eq("code", code)); + if(null != bankCard){ + return ResultUtil.error(language == 1 ? "银行卡重复" : language == 2 ? "Duplicate bank card" : "Double carte bancaire"); + } + bankCard = new BankCard(); + bankCard.setUserId(uid); + bankCard.setUserType(1); + bankCard.setCode(code); + bankCard.setBank(bank); + bankCard.setFirstName(firstName); + bankCard.setLastName(lastName); + bankCard.setInsertTime(new Date()); + bankCardService.insert(bankCard); + return ResultUtil.success(); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } + + + + @ResponseBody + @PostMapping("/api/user/addBankCard") + @ApiOperation(value = "删除银行卡【1.1】", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "银行卡id", name = "id", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil delBankCard(Integer id){ + try { + bankCardService.deleteById(id); + return ResultUtil.success(); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } } -- Gitblit v1.7.1