| | |
| | | import com.nq.pojo.reponse.RUserAssets; |
| | | import com.nq.service.*; |
| | | import com.nq.utils.UserPointUtil; |
| | | import com.nq.utils.email.CodeUtil; |
| | | import com.nq.utils.email.EmailService; |
| | | import com.nq.utils.timeutil.DateTimeUtil; |
| | | import com.nq.utils.PropertiesUtil; |
| | | import com.nq.utils.SymmetricCryptoUtil; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.Assert; |
| | | |
| | | @Service("iUserService") |
| | | public class UserServiceImpl implements IUserService { |
| | |
| | | @Resource |
| | | ApplyLeverMapper applyLeverMapper; |
| | | |
| | | @Autowired |
| | | EmailService emailService; |
| | | @Autowired |
| | | CodeUtil codeUtil; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | |
| | | |
| | | public ServerResponse reg(String yzmCode, String agentCode, String phone, String userPwd, HttpServletRequest request) { |
| | | if (StringUtils.isBlank(agentCode) || StringUtils.isBlank(phone) || |
| | | StringUtils.isBlank(userPwd) || StringUtils.isBlank(yzmCode)) { |
| | | public ServerResponse reg(String yzmCode, String agentCode, String phone, String userPwd,String email, HttpServletRequest request) { |
| | | if (StringUtils.isAnyBlank(agentCode,phone,userPwd,yzmCode,email)) { |
| | | return ServerResponse.createByErrorMsg("注册失败。该参数不能为空",request); |
| | | } |
| | | Assert.isTrue(userMapper.selectCount(new LambdaQueryWrapper<User>().eq(User::getEmail,email)) == 0, |
| | | "Registration failed, the mobile mail number has been registered"); |
| | | |
| | | String redisCode = redisTemplate.opsForValue().get(codeUtil.KEY_PREFIX + yzmCode); |
| | | if (redisCode == null || !yzmCode.equals(redisCode)) { |
| | | return ServerResponse.createByErrorMsg("Verification code error"); |
| | | } |
| | | |
| | | /* |
| | | String keys = "AliyunSmsCode:" + phone; |
| | | String redis_yzm = RedisShardedPoolUtils.get(keys); |
| | | |
| | | log.info("redis_yzm = {},yzmCode = {}", redis_yzm, yzmCode); |
| | | if (!yzmCode.equals(redis_yzm) && !"6666".equals(yzmCode)) { |
| | | return ServerResponse.createByErrorMsg("由于验证码不正确,注册失败。过程",request); |
| | | } |
| | | }*/ |
| | | |
| | | |
| | | AgentUser agentUser = this.iAgentUserService.findByCode(agentCode); |
| | |
| | | user.setAgentName(agentUser.getAgentName()); |
| | | user.setPhone(phone); |
| | | user.setUserPwd(SymmetricCryptoUtil.encryptPassword(userPwd)); |
| | | |
| | | user.setEmail(email); |
| | | |
| | | user.setAccountType(Integer.valueOf(0)); |
| | | user.setIsLock(Integer.valueOf(1)); |
| | |
| | | } |
| | | userAssetsServices.availablebalanceChange(fromType,user.getId(), EUserAssets.TRANSFER,amtBig.negate(),fromType+"/"+toType,""); |
| | | if(fromType.equals("US")){ |
| | | amtBig = (new BigDecimal(7.35)).multiply(amtBig); |
| | | amtBig = (new BigDecimal(83.5)).multiply(amtBig); |
| | | }else{ |
| | | amtBig = rateServices.currencyRate(EStockType.getEStockTypeByCode(fromType),EStockType.getEStockTypeByCode(toType)).multiply(amtBig); |
| | | } |
| | |
| | | queryWrapper.eq("user_id",user.getId()); |
| | | return ServerResponse.createBySuccess(mapper.selectList(queryWrapper)); |
| | | } |
| | | @Override |
| | | public ServerResponse sendMailCode(String MailCode) { |
| | | if (MailCode == null || MailCode.equals("")) { |
| | | return ServerResponse.createByErrorMsg("The mobile mail number and password cannot be empty"); |
| | | } |
| | | emailService.sendSimpleMail(MailCode, "barclays register code", codeUtil.generateVerificationCode()); |
| | | return ServerResponse.createBySuccessMsg("send code success!"); |
| | | } |
| | | |
| | | } |
| | | |