| | |
| | | import com.doumee.dao.admin.request.UserImport; |
| | | import com.doumee.dao.business.ShopMapper; |
| | | import com.doumee.core.wx.WxMiniConfig; |
| | | import com.doumee.dao.business.SmsEmailMapper; |
| | | import com.doumee.dao.business.UsersMapper; |
| | | import com.doumee.dao.business.model.Multifile; |
| | | import com.doumee.dao.business.model.News; |
| | | import com.doumee.dao.business.model.Shop; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.Users; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.web.response.AccountResponse; |
| | | import com.doumee.service.business.UsersService; |
| | |
| | | private UsersMapper usersMapper; |
| | | @Autowired |
| | | private ShopMapper shopMapper; |
| | | @Autowired |
| | | private SmsEmailMapper smsEmailMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public AccountResponse phoneLogin(String phone,String code){ |
| | | if(StringUtils.isEmpty(phone)||StringUtils.isEmpty(code)){ |
| | |
| | | if(!StringUtils.equals(users.getStatus(),Constants.ZERO+"")){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前账户已停用,请联系管理员"); |
| | | } |
| | | //TODO 验证短信信息 |
| | | if(!StringUtils.equals(code,"123456")){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"验证码错误"); |
| | | //验证短信 |
| | | SmsEmail model = smsEmailMapper.selectOne(new QueryWrapper<SmsEmail>().lambda() |
| | | .eq(SmsEmail::getType, Constants.ZERO) |
| | | .eq(SmsEmail::getPhone, phone) |
| | | .eq(SmsEmail::getRemark, code) |
| | | .eq(SmsEmail::getIsdeleted, Constants.ZERO) |
| | | ); |
| | | if(model == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,验证码不正确,请重新发送再试!"); |
| | | } |
| | | if(!Constants.equalsInteger(model.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,验证码已失效,请重新发送再试!"); |
| | | } |
| | | model.setStatus(Constants.ONE); |
| | | model.setEditDate(new Date()); |
| | | if(model.getCreateDate() !=null && |
| | | System.currentTimeMillis() - model.getCreateDate().getTime() > 3*60*1000){ |
| | | smsEmailMapper.updateById(model); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,验证码已失效,请重新发送再试~"); |
| | | } |
| | | smsEmailMapper.updateById(model); |
| | | //创建token |
| | | JwtPayLoad payLoad = new JwtPayLoad(users.getId(),Constants.ONE); |
| | | String token = JwtTokenUtil.generateToken(payLoad); |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Users usersDetail(Long userId){ |
| | | Users users = usersMapper.selectById(userId); |
| | | if(Objects.isNull(users)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | String prefix = StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.RESOURCE_PATH).getCode()) + |
| | | StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE,Constants.USERS_FILE).getCode()); |
| | | if(StringUtils.isNotBlank(users.getImgurl())){ |
| | | users.setImgurlFull(prefix + users.getImgurl()); |
| | | } |
| | | if(StringUtils.isNotBlank(users.getQrcodeImg())){ |
| | | users.setQrcodeImgFull(prefix + users.getQrcodeImg()); |
| | | } |
| | | if(StringUtils.isNotBlank(users.getCompanyQrcodeImg())){ |
| | | users.setCompanyQrcodeImgFull(prefix + users.getCompanyQrcodeImg()); |
| | | } |
| | | if(Objects.nonNull(users.getDepartmentId())){ |
| | | Shop shop = shopMapper.selectById(users.getDepartmentId()); |
| | | if(Objects.nonNull(shop)){ |
| | | users.setShopName(shop.getName()); |
| | | if(StringUtils.isNotBlank(shop.getAddress())){ |
| | | users.setShopAddress(shop.getAddress()); |
| | | }else{ |
| | | users.setShopAddress(shop.getProvinceName()+shop.getCityName()+shop.getAreaName()+shop.getTown()+shop.getRegAddr()); |
| | | } |
| | | } |
| | | } |
| | | return users; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |