| | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | |
| | | |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | } else { |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if (!b) { |
| | |
| | | |
| | | if (null == userInfo) { |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | userInfo.setPhone(phone); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | | userInfo.setNickName(nickName); |
| | |
| | | userInfo.setConsumption(0D); |
| | | userInfo.setBalance(0D); |
| | | userInfo.setState(1); |
| | | if(null != onconUUID){ |
| | | userInfo.setOnconUUID(onconUUID); |
| | | } |
| | | |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | |
| | | }else { |
| | | userInfo.setCompanyId(1); |
| | | } |
| | | |
| | | this.insert(userInfo); |
| | | |
| | | this.addCoupon(userInfo);//添加优惠券 |
| | |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | /** |
| | | * 手机验证码登录 |
| | | * 手机一键登录 |
| | | * @param accessToken |
| | | * @return |
| | | */ |
| | |
| | | return ResultUtil.error("登录失败"); |
| | | } |
| | | String phone = json.getJSONObject("data").getString("mobile"); |
| | | |
| | | |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | String nickName = this.getDefaultName(); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setEncryptType("aesbase64"); |
| | | request.setPassword(AESUtils.encryptBase64("123456")); |
| | | request.setNickname(nickName); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | }else{ |
| | | onconUUID = UserUtil.getOnconUUIDByMobile(phone); |
| | | } |
| | | |
| | | UserInfo userInfo = userInfoMapper.queryByPhone(phone); |
| | | if (null == userInfo) { |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | userInfo.setPhone(phone); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | | userInfo.setNickName(this.getDefaultName()); |
| | | userInfo.setNickName(nickName); |
| | | userInfo.setRegistIp(registIp); |
| | | userInfo.setIsAuth(1); |
| | | userInfo.setConsumption(0D); |
| | | userInfo.setBalance(0D); |
| | | userInfo.setState(1); |
| | | userInfo.setOnconUUID(onconUUID); |
| | | |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | loginWarpper.setPhone(2); |
| | | |
| | | //smsrecordService.saveData(1, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | @Override |
| | |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, |
| | | String registAreaCode, Integer sex, String nickName, String avatar,String loginType) throws Exception { |
| | |
| | | } |
| | | if (null == userInfo) { |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | | userInfo.setRegistIp(registIp); |
| | | userInfo.setSex(sex); |
| | |
| | | openid = map.get("openid"); |
| | | unionid = map.get("unionid"); |
| | | sessionKey = map.get("sessionKey"); |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | phone = getPhone(sessionKey, encryptedData, iv); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone).eq("state",1).ne("flag",3)); |
| | | if(phone1.size()>0){ |
| | |
| | | }else { |
| | | userInfo = userInfoMapper.queryByOpenid2(openid); |
| | | } |
| | | System.out.println(userInfo); |
| | | if(ToolUtil.isEmpty(phone) && ToolUtil.isNotEmpty(userInfo) && ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | String phone1 = getPhone(sessionKey, encryptedData, iv); |
| | | userInfo.setPhone(phone1); |
| | | userInfoMapper.updateById(userInfo); |
| | | } |
| | | }else{//APP |
| | | userInfo = userInfoMapper.queryByOpenid(openid); |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | nickName = this.getDefaultName(); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setEncryptType("aesbase64"); |
| | | request.setPassword(AESUtils.encryptBase64("123456")); |
| | | request.setNickname(nickName); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | }else{ |
| | | onconUUID = UserUtil.getOnconUUIDByMobile(phone); |
| | | } |
| | | |
| | | int i =0; |
| | | if(null == userInfo){ |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | String phone2 = getPhone(sessionKey, encryptedData, iv); |
| | | List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone2).eq("state",1).ne("flag",3)); |
| | | List<UserInfo> phone1 = userInfoMapper.selectList(new EntityWrapper<UserInfo>().eq("phone", phone).eq("state",1).ne("flag",3)); |
| | | if(phone1.size()>0){ |
| | | userInfo = phone1.get(0); |
| | | userInfo.setUnionid(unionid); |
| | |
| | | userInfoMapper.updateById(userInfo); |
| | | i=1; |
| | | }else { |
| | | userInfo.setPhone(phone2); |
| | | userInfo.setPhone(phone); |
| | | } |
| | | }else { |
| | | userInfo.setPhone(phone); |
| | |
| | | userInfo.setRegistIp(registIp); |
| | | userInfo.setSex(sex); |
| | | |
| | | userInfo.setNickName(ToolUtil.isNotEmpty(nickName) ? nickName : this.getDefaultName()); |
| | | userInfo.setNickName(nickName); |
| | | userInfo.setAvatar(avatar); |
| | | userInfo.setOnconUUID(onconUUID); |
| | | |
| | | if(type == 2){ |
| | | userInfo.setAppletsOpenId(openid); |
| | |
| | | nickName = userInfo.getNickName(); |
| | | } |
| | | //调中台接口查询用户 |
| | | String onconUUID = null; |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | } else { |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if (!b) { |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | onconUUID = UserUtil.getOnconUUIDByMobile(phone); |
| | | } |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | | if (null != userInfo1) { |
| | |
| | | userInfo1.setAvatar(userInfo.getAvatar()); |
| | | userInfo1.setSex(userInfo.getSex()); |
| | | userInfo1.setNickName(userInfo.getNickName()); |
| | | userInfo1.setOnconUUID(onconUUID); |
| | | this.updateById(userInfo1); |
| | | |
| | | if (ToolUtil.isNotEmpty(loginType) && loginType.equals("Applets")) {//小程序登录后绑定手机号码 |
| | |
| | | loginWarpper.setPhone(2); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | userInfo.setOnconUUID(onconUUID); |
| | | userInfo.setPhone(phone); |
| | | userInfo.setUpdateTime(new Date()); |
| | | userInfo.setUpdateUser(userInfo.getId()); |
| | |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(userInfo.getId())); |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(userInfo.getId()), 180, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(userInfo.getId()), 30, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getPhone(), s.substring(s.length() - 32)); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getId(), s); |
| | | return s; |
| | |
| | | } |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String addAppUser(String phone, String code, String areaCode, String onconUUID) throws Exception { |
| | | UserInfo userInfo = userInfoMapper.queryByPhone(phone); |
| | | String nickName = null; |
| | | if (null == userInfo) { |
| | | nickName = this.getDefaultName(); |
| | | } else { |
| | | nickName = userInfo.getNickName(); |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == userInfo) { |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAvatar("https://traffic.qytzt.cn/v1/AUTH_d8bef0a04db511f0b79d01a3e2b7587e/qyt20250702/imgs/management/d081e7a9-13d4-4eec-afb6-afd10885a664.png"); |
| | | userInfo.setPhone(phone); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | | userInfo.setNickName(nickName); |
| | | userInfo.setIsAuth(1); |
| | | userInfo.setConsumption(0D); |
| | | userInfo.setBalance(0D); |
| | | userInfo.setState(1); |
| | | if(null != onconUUID){ |
| | | userInfo.setOnconUUID(onconUUID); |
| | | } |
| | | |
| | | //用户所属企业 |
| | | if(null != areaCode){ |
| | | Company query = companyCityService.query(areaCode); |
| | | userInfo.setCompanyId(null != query ? query.getId() : 1); |
| | | userInfo.setRegistAreaCode(areaCode); |
| | | }else { |
| | | userInfo.setCompanyId(1); |
| | | } |
| | | |
| | | this.insert(userInfo); |
| | | } |
| | | return userInfo.getId().toString(); |
| | | } |
| | | } |