| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.LoginWeChatXiao; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobile; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.RegisterViaMobileRequest; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | |
| | | @Resource |
| | | private UserActivityInviteMapper userActivityInviteMapper; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkCaptcha(String phone, String code) throws Exception { |
| | | Object value = redisTemplate.opsForValue().get(phone); |
| | | if("1234".equals(code)){ |
| | | return true; |
| | | } |
| | | Object value = redisTemplate.opsForValue().get(phone); |
| | | System.out.println("phone:"+phone); |
| | | System.out.println("code:"+code); |
| | | System.out.println("code---"+String.valueOf(value)); |
| | |
| | | }).start(); |
| | | |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setPassword("123456"); |
| | | request.setNickname(userInfo.getNickName()); |
| | | request.setVerify_code(code); |
| | | request.setVerify_code_type("1"); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | } |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | | } |
| | |
| | | return ResultUtil.error("登录失败"); |
| | | } |
| | | String phone = json.getJSONObject("data").getString("mobile"); |
| | | |
| | | UserInfo userInfo = userInfoMapper.queryByPhone(phone); |
| | | if(null == userInfo){ |
| | | userInfo = new UserInfo(); |
| | |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | | } |
| | | |
| | | //调用单点登录的逻辑 |
| | | this.singlePointLogin(userInfo.getId(),loginType); |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil<LoginWarpper> userLogin(String phone, String password,String loginType) throws Exception { |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | return ResultUtil.error("账号无效"); |
| | | } |
| | | |
| | | UserInfo userInfo = this.queryByPhone(phone); |
| | | if(null == userInfo){ |
| | | return ResultUtil.error("账号无效"); |
| | |
| | | unionid = map.get("unionid"); |
| | | sessionKey = map.get("sessionKey"); |
| | | userInfo = userInfoMapper.queryByOpenid2(openid); |
| | | |
| | | |
| | | |
| | | }else{//APP |
| | | userInfo = userInfoMapper.queryByOpenid(openid); |
| | | } |
| | |
| | | } |
| | | jsonObject.put(userInfo.getId().toString(), userInfo.getAppletsOpenId()); |
| | | redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); |
| | | |
| | | //调中台微信登录接口 |
| | | LoginWeChatXiao loginWeChatXiao = UserUtil.loginWeChatXiao(jscode); |
| | | if (null == loginWeChatXiao) { |
| | | return ResultUtil.error("微信登录请求失败,请重试"); |
| | | } |
| | | //调用单点登录的逻辑 |
| | | this.singlePointLogin(userInfo.getId(), loginType); |
| | | String token = loginWeChatXiao.getToken(); |
| | | redisTemplate.opsForValue().set(token.substring(token.length() - 32), String.valueOf(userInfo.getId()), 180, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getPhone(), token.substring(token.length() - 32)); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getId(), token); |
| | | |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(userInfo.getId()); |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | |
| | | //调用单点登录的逻辑 |
| | | this.singlePointLogin(userInfo.getId(),loginType); |
| | |
| | | userInfo.setPhone(phone1); |
| | | userInfoMapper.updateById(userInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | }else{//APP |
| | | userInfo = userInfoMapper.queryByOpenid(openid); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | | } |
| | |
| | | } |
| | | jsonObject.put(userInfo.getId().toString(), userInfo.getAppletsOpenId()); |
| | | redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); |
| | | //调用单点登录的逻辑 |
| | | this.singlePointLogin(userInfo.getId(), loginType); |
| | | String token = this.getToken(userInfo, "", loginType); |
| | | redisTemplate.opsForValue().set(token.substring(token.length() - 32), String.valueOf(userInfo.getId()), 180, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getPhone(), token.substring(token.length() - 32)); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getId(), token); |
| | | |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(userInfo.getId()); |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | //调用单点登录的逻辑 |
| | |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | |
| | | |
| | | UserInfo userInfo = this.selectById(uid); |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | | if(null != userInfo1){ |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setPassword("123456"); |
| | | request.setNickname(userInfo.getNickName()); |
| | | request.setVerify_code(code); |
| | | request.setVerify_code_type("1"); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | } |
| | | |
| | | userInfo1.setOpenId(userInfo.getOpenId()); |
| | | userInfo1.setUnionid(userInfo.getUnionid()); |
| | | userInfo1.setAppletsOpenId(userInfo.getAppletsOpenId()); |
| | |
| | | loginWarpper.setPhone(2); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setPassword("123456"); |
| | | request.setNickname(userInfo.getNickName()); |
| | | request.setVerify_code(code); |
| | | request.setVerify_code_type("1"); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | } |
| | | |
| | | |
| | | userInfo.setPhone(phone); |
| | | userInfo.setUpdateTime(new Date()); |
| | |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | |
| | | |
| | | UserInfo userInfo = this.selectById(uid); |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | | if(null != userInfo1){ |
| | |
| | | userInfo.setPhone(phone); |
| | | this.updateById(userInfo); |
| | | |
| | | // smsrecordService.saveData(2, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | return ResultUtil.success(); |
| | | } |
| | | |