puzhibing
2023-11-04 4becc1e8cdb2fbe0dcb94493b75a59ec1817028c
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java
@@ -9,6 +9,7 @@
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.TEmail;
import com.stylefeng.guns.modular.system.model.UserInfo;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.*;
@@ -68,6 +69,9 @@
    @Value("${spring.mail.template-path}")
    private String templatePath;
    @Autowired
    private TEmailService emailService;
@@ -112,8 +116,6 @@
        }
    }
    /**
     * 获取短信验证码
     * @param phone
@@ -154,8 +156,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/base/queryCaptcha1")
    @ApiOperation(value = "获取短信验证码", tags = {"用户端-登录"}, notes = "")
@@ -183,10 +183,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/base/sedEmail")
    @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -195,22 +191,33 @@
    })
    public ResultUtil sedEmail(String email, Integer language, HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(ToolUtil.isEmpty(email)){
                return ResultUtil.error(language == 1 ? "邮箱不能为空" : language == 2 ? "The mailbox cannot be empty" : "L’email ne peut pas être vide");
            }
            Random random = new Random();
            StringBuffer sb = new StringBuffer();
            for(int i = 0; i < 4; i++){
                sb.append((int) (random.nextDouble() * 10));
            }
            String authCode = sb.toString();
            redisUtil.setStrValue(email, authCode, 5 * 60);
            UserInfo userInfo = userInfoService.selectById(uid);
            String nickName = "";
            if(null != userInfo){
                nickName = userInfo.getNickName();
            }
            if(ToolUtil.isNotEmpty(email)){
@@ -240,7 +247,6 @@
                    Element content_french = document.getElementById("content_french");
                    content_french.text(authCode);
                }
                EmailUtil.send(email, language == 1 ? "验证码" : language == 2 ? "Verification code" : "Code de vérification",  document.html());
            }
            return ResultUtil.success();
@@ -249,9 +255,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 手机验证码登录
@@ -301,8 +304,6 @@
        }
    }
    /**
     * 手机验证码登录
     * @param phone
@@ -350,10 +351,6 @@
        }
    }
    /**
     * 账号密码登录
     * @param phone
@@ -386,7 +383,6 @@
            return ResultUtil.paranErr();
        }
    }
    /**
     * 忘记密码
@@ -422,7 +418,6 @@
            return ResultUtil.paranErr();
        }
    }
    /**
     * 微信授权登录
@@ -477,7 +472,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/base/user/facebookLogin")
    @ApiOperation(value = "FaceBook授权登录【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -493,15 +487,33 @@
    })
    public ResultUtil facebookLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){
        try {
            return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language);
            return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language,1);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
    @PostMapping("/base/user/twitterLogin")
    @ApiOperation(value = "twitter授权登录【1.0】", tags = {"用户端-登录"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "twitter用户id", name = "id", required = true, dataType = "String"),
            @ApiImplicitParam(value = "twitter用户名称", name = "name", required = true, dataType = "String"),
            @ApiImplicitParam(value = "twitter绑定的email", name = "email", required = false, dataType = "String"),
            @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "String"),
            @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"),
            @ApiImplicitParam(value = "纬度", name = "lat", required = false, dataType = "double"),
            @ApiImplicitParam(value = "经度", name = "lng", required = false, dataType = "double"),
            @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"),
    })
    public ResultUtil twitterLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){
        try {
            return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language,2);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    /**
     * 设置电话号码
@@ -553,7 +565,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/user/bindingEmail")
    @ApiOperation(value = "设置邮箱地址【1.0】", tags = {"用户端-登录"}, notes = "")
@@ -576,6 +587,24 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/user/getEmailList")
    @ApiOperation(value = "获取邮箱信息", tags = {"用户端-获取邮箱信息"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<?> getEmailList(HttpServletRequest request){
        try {
            Integer uid = userInfoService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(emailService.selectList(new EntityWrapper<TEmail>().eq("userId",uid).eq("type",1).orderBy("createTime",false)));
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    /**
     * 获取用户个人信息
@@ -601,7 +630,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 手机号码获取用户
@@ -635,7 +663,6 @@
        }
    }
    /**
     * 实名认证操作
     * @param verifiedWarpper
@@ -660,7 +687,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 设置紧急联系人
@@ -698,7 +724,6 @@
        }
    }
    /**
     * 用户充值余额
     * @param payType
@@ -728,7 +753,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 修改手机号码
@@ -813,8 +837,6 @@
        }
    }
    /**
     * 修改登录密码
     * @param password
@@ -840,7 +862,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 修改个人信息
@@ -878,7 +899,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/user/queryRealName")
    @ApiOperation(value = "获取实名认证的数据", tags = {"用户端-个人中心"}, notes = "")
@@ -899,7 +919,6 @@
        }
    }
    /**
     * 后台调用禁用用户
     * @param uid
@@ -919,7 +938,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 仿socket接口(单点登录)
@@ -1009,8 +1027,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/user/editLanguage")
    @ApiOperation(value = "修改多语言配置", tags = {"用户端-个人中心"}, notes = "")
@@ -1034,7 +1050,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/base/user/addReportLoss")
    @ApiOperation(value = "提交报失", tags = {"用户端-个人中心"}, notes = "")
@@ -1043,18 +1058,17 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "提交内容", name = "remark", required = true, dataType = "int"),
            @ApiImplicitParam(value = "提交图片", name = "image", required = true, dataType = "int"),
            @ApiImplicitParam(value = "1=中文,2=英文,3=法语", name = "language", required = true, dataType = "int"),
    })
    public ResultUtil addReportLoss(Integer orderType, Integer orderId, String remark, String image){
    public ResultUtil addReportLoss(Integer orderType, Integer orderId, String remark, String image, Integer language){
        try {
            reportLossService.addReportLoss(orderType, orderId, remark, image);
            reportLossService.addReportLoss(orderType, orderId, remark, image, language);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
    @PostMapping("/base/user/queryOrderLicensePlate")
@@ -1073,8 +1087,6 @@
        }
    }
    @ResponseBody
    @RequestMapping("/base/user/image")
    public String image(@RequestPart("file") MultipartFile file) {
@@ -1085,8 +1097,6 @@
            return null;
        }
    }
    @ResponseBody
    @PostMapping("/api/user/queryBankCardList")
@@ -1115,8 +1125,6 @@
            return ResultUtil.runErr();
        }
    }
    @ResponseBody
    @PostMapping("/api/user/addBankCard")
@@ -1160,8 +1168,6 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/user/delBankCard")
    @ApiOperation(value = "删除银行卡【1.1】", tags = {"用户端-个人中心"}, notes = "")
@@ -1178,7 +1184,6 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 下载pdf