java版Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+直播短视频带货+三级分销
2022/1/11 19:04:24
本文主要是介绍java版Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+直播短视频带货+三级分销,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
@源码地址来源: https://minglisoft.cn/honghu2/business.html
手机端源码:
/** * Copyright © 2012-2017 <a href="http://minglisoft.cn">HongHu</a> All rights reserved. */ package com.honghu.cloud.controller; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.google.common.collect.Lists; import com.honghu.cloud.bean.SmsCode; import com.honghu.cloud.bean.SmsConfig; import com.honghu.cloud.bean.SmsTemplate; import com.honghu.cloud.bean.User; import com.honghu.cloud.code.ResponseCode; import com.honghu.cloud.constant.Globals; import com.honghu.cloud.dto.AccessoryDto; import com.honghu.cloud.dto.StoreDto; import com.honghu.cloud.dto.SysConfigDto; import com.honghu.cloud.dto.UserDto; import com.honghu.cloud.feign.AccessoryFeignClient; import com.honghu.cloud.feign.DistributionUserFeignClient; import com.honghu.cloud.feign.StoreFeignClient; import com.honghu.cloud.feign.SysConfigFeignClient; import com.honghu.cloud.redis.RedisUtil; import com.honghu.cloud.service.ISmsCodeService; import com.honghu.cloud.service.ISmsConfigService; import com.honghu.cloud.service.ISmsTemplateService; import com.honghu.cloud.service.IUserService; import com.honghu.cloud.tools.AliSmsUtil; import com.honghu.cloud.tools.SecurityUserHolder; import com.honghu.cloud.utils.CommUtil; import com.honghu.cloud.utils.JWT; import com.honghu.cloud.utils.tools.Md5Encrypt; import net.sf.json.JSONObject; /** * 短信服务 * @author Administrator * */ @RestController @RequestMapping(value = "/mobile") @CrossOrigin(origins = "*",maxAge = 3600) public class MobileController { @Autowired private ISmsConfigService smsConfigService; @Autowired private ISmsTemplateService smsTemplateService; @Autowired private ISmsCodeService smsCodeService; @Autowired private SysConfigFeignClient sysConfigFeignClient; @Autowired private IUserService userService; @Autowired private RedisUtil redisUtil; @Autowired private StoreFeignClient storeFeignClient; @Autowired private DistributionUserFeignClient disUserFeignClient; @Autowired private AccessoryFeignClient accessoryFeignClient; // 短信服务类型 public static List<String> sms_items = Lists.newArrayList(); static{ sms_items.add("bind_mobile"); // 绑定手机发送短信 sms_items.add("register_mobile"); // 手机号码注册发送短信 sms_items.add("login_mobile"); // 手机登录发送短信 sms_items.add("update_password"); // 修改密码 sms_items.add("update_pay_password"); // 修改支付密码 sms_items.add("forget_password"); // 忘记密码 } /** * 发送短信服务 * @param json(sms_type:bind_mobile,register_mobile,login_mobile) * @param request * @return */ @RequestMapping(value = "/sendCode", method = RequestMethod.POST) public Map<String,Object> sendCode(@RequestBody JSONObject json, HttpServletRequest request){ String sms_type = json.optString("sms_type"); if(StringUtils.isEmpty(sms_type)){ return ResponseCode.buildCodeMap("20001", "服务类型不能为空", null); } if(!sms_items.contains(sms_type)){ return ResponseCode.buildCodeMap("20002", "服务类型错误", null); } String mobile = json.optString("mobile"); if(StringUtils.isEmpty(mobile)){ return ResponseCode.buildCodeMap("20003", "手机号码不能为空", null); } // 查询短信配置 SmsConfig smsConfig = smsConfigService.findSmsConfig(); if(smsConfig == null){ return ResponseCode.buildCodeMap("20004", "系统未配置短信服务服务", null); } // 根据(英文模板名称)查询短信模板 SmsTemplate smsTemplate = smsTemplateService.findByCodeEn(sms_type); if(smsTemplate == null){ return ResponseCode.buildCodeMap("20005", "服务模板不存在", null); } String content = ""; if (StringUtils.equals(sms_type, "bind_mobile") || StringUtils.equals(sms_type, "register_mobile") || StringUtils.equals(sms_type, "login_mobile") || StringUtils.equals(sms_type, "forget_password") || StringUtils.equals(sms_type, "update_password")|| StringUtils.equals(sms_type, "update_pay_password")) { // 入库验证码 SmsCode smsCode = new SmsCode(); smsCode.setMobile(mobile); smsCode.setSend_time(new Date()); smsCode.setCode(CommUtil.randomInt(4)); smsCode.setCode_en(sms_type); smsCodeService.saveEntity(smsCode); content = "{\"code\":\"" + smsCode.getCode() + "\"}"; } // 发送短信 String result = AliSmsUtil.sendByALY(mobile, content, smsConfig, smsTemplate); if(StringUtils.isNotEmpty(result)){ return ResponseCode.buildCodeMap("20006", result, null); } return ResponseCode.buildSuccessMap("短信发送成功"); } /** * 手机号注册(登录) * @param json * @param request * @return */ @RequestMapping(value = "/register_mobile", method = RequestMethod.POST) public Map<String,Object> register_mobile(@RequestBody JSONObject json, HttpServletRequest request){ String sms_type = json.optString("sms_type"); if(StringUtils.isEmpty(sms_type)){ return ResponseCode.buildCodeMap("20001", "服务类型不能为空", null); } if(!StringUtils.equals("register_mobile", sms_type)){ return ResponseCode.buildCodeMap("20002", "服务类型错误", null); } String mobile = json.optString("mobile"); if(StringUtils.isEmpty(mobile)){ return ResponseCode.buildCodeMap("20003", "手机号码不能为空", null); } String code = json.optString("code"); if(StringUtils.isEmpty(code)){ return ResponseCode.buildCodeMap("20004", "验证码不能为空", null); } String password = json.optString("password"); if(StringUtils.isEmpty(password)){ return ResponseCode.buildCodeMap("20004", "密码不能为空", null); } // 查询短信配置 SmsConfig smsConfig = smsConfigService.findSmsConfig(); Integer use_minute = 5; if(smsConfig != null && smsConfig.getUse_minute() != null){ use_minute = smsConfig.getUse_minute(); } // 查询手机号有效期内的验证码 SmsCode smsCode = smsCodeService.findByCode(mobile, sms_type, use_minute); if(smsCode == null){ return ResponseCode.buildCodeMap("20005", "验证码已过期,请重新获取!", null); } if(!StringUtils.equals(code, smsCode.getCode())){ return ResponseCode.buildCodeMap("20006", "验证码错误", null); } // 查询手机号码是否注册 User user = userService.selectByUserName(mobile); if(user != null){ return ResponseCode.buildCodeMap("20007", "手机号已注册", null); } user = new User(); user.setDeleteStatus(0); user.setSex(-1); // 性别 1为男、0为女、-1为保密 user.setDeleteStatus(0); user.setAddTime(new Date()); user.setMonth_income(0); user.setIntegral(0); user.setIs_agent(0); user.setLoginCount(0); user.setAvailableBalance(BigDecimal.ZERO); user.setFreezeBlance(BigDecimal.ZERO); user.setMobile(mobile); user.setUserName(mobile); user.setPassword(Md5Encrypt.md5(password).toLowerCase()); user.setYears(0); // 用户年龄 user.setIs_live(0); user.setUser_type(0); // 用户类别,默认为0个人用户,1为企业用户 user.setStore_apply_step(0); // 店铺申请进行的步骤,默认为0 user.setInvoiceType(0); // 发票类型 user.setLive_code(userService.selectMaxLiveCode() + 1); user.setWhether_attention(1); //是否允许关注 0为不允许,1为允许 userService.saveEntity(user); userService.saveDisUser(user, "-1"); // 修改登录信息 user.setLoginCount(user.getLoginCount()+1); user.setLastLoginDate(new Date()); user.setLastLoginIp(CommUtil.getIpAddr(request)); // 生成token,格式:用户id;时间戳 String token = JWT.sign(user.getId() + ";" + System.currentTimeMillis()+";"+"app", 0); // 将token存到redis中,有效期24小时 redisUtil.set(Globals.ANDROID_LOGIN_MARK + user.getId(), token, Globals.USER_INFO_EXPIRE_TIME); // 返回结果集 Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("token", token); // 置空用户敏感字段 user.setPassword(""); user.setPay_password(""); resultMap.put("user", user); // 置空系统配置敏感字段 SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig(); sysConfig.setWeixin_appId(""); sysConfig.setWeixin_appSecret(""); sysConfig.setUploadFilePath(""); sysConfig.setUser_level(""); resultMap.put("sysConfig", sysConfig); return ResponseCode.buildSuccessMap(resultMap); } /** * 手机号登录 * @param json * @param request * @return */ @RequestMapping(value = "/login_mobile", method = RequestMethod.POST) public Map<String,Object> login_mobile(@RequestBody JSONObject json, HttpServletRequest request){ String sms_type = json.optString("sms_type"); if(StringUtils.isEmpty(sms_type)){ return ResponseCode.buildCodeMap("20001", "服务类型不能为空", null); } if(!StringUtils.equals("login_mobile", sms_type)){ return ResponseCode.buildCodeMap("20002", "服务类型错误", null); } String mobile = json.optString("mobile"); if(StringUtils.isEmpty(mobile)){ return ResponseCode.buildCodeMap("20003", "手机号码不能为空", null); } String code = json.optString("code"); if(StringUtils.isEmpty(code)){ return ResponseCode.buildCodeMap("20004", "验证码不能为空", null); } // 查询短信配置 SmsConfig smsConfig = smsConfigService.findSmsConfig(); Integer use_minute = 5; if(smsConfig != null && smsConfig.getUse_minute() != null){ use_minute = smsConfig.getUse_minute(); } // 查询手机号有效期内的验证码 SmsCode smsCode = smsCodeService.findByCode(mobile, sms_type, use_minute); if(smsCode == null){ return ResponseCode.buildCodeMap("20005", "验证码已过期,请重新获取!", null); } if(!StringUtils.equals(code, smsCode.getCode())){ return ResponseCode.buildCodeMap("20006", "验证码错误", null); } // 查询手机号码是否注册 User user = userService.selectByUserName(mobile); if(user == null){ return ResponseCode.buildCodeMap("20007", "该用户不存在", null); } if(user.getSecurity() == 1){ return ResponseCode.buildCodeMap("20008", "账户存在安全隐患禁止登录!", null); } String storestatus=""; if (user.getStore_id()!=null) { StoreDto storeDto = storeFeignClient.selectByPrimaryKey(user.getStore_id()); if (storeDto!=null) { storestatus=storeDto.getStore_status()+""; } } // 修改登录信息 user.setLoginCount(user.getLoginCount()+1); user.setLastLoginDate(new Date()); user.setLastLoginIp(CommUtil.getIpAddr(request)); // 生成token,格式:用户id;时间戳 String token = JWT.sign(user.getId() + ";" + System.currentTimeMillis()+";"+"app", 0); // 将token存到redis中,有效期24小时 redisUtil.set(Globals.ANDROID_LOGIN_MARK + user.getId(), token, Globals.USER_INFO_EXPIRE_TIME); // 返回结果集 Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("token", token); // 置空用户敏感字段 user.setPassword(""); user.setPay_password(""); if (user.getPhoto_id()!=null) { AccessoryDto accessoryDto = accessoryFeignClient.selectByPrimaryKey(user.getPhoto_id()); if (accessoryDto!=null) user.setPhoto(accessoryDto); } resultMap.put("user", user); /*// 置空系统配置敏感字段 SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig(); sysConfig.setWeixin_appId(""); sysConfig.setWeixin_appSecret(""); sysConfig.setUploadFilePath(""); sysConfig.setUser_level(""); resultMap.put("sysConfig", sysConfig);*/ resultMap.put("storestatus", storestatus); return ResponseCode.buildSuccessMap(resultMap); } /** * 手机号绑定 * @param json * @param request * @return */ @RequestMapping(value = "/login_bind", method = RequestMethod.POST) public Map<String,Object> login_bind(@RequestBody JSONObject json, HttpServletRequest request){ String sms_type = json.optString("sms_type"); if(StringUtils.isEmpty(sms_type)){ return ResponseCode.buildCodeMap("20001", "服务类型不能为空", null); } if(!StringUtils.equals("bind_mobile", sms_type)){ return ResponseCode.buildCodeMap("20002", "服务类型错误", null); } String mobile = json.optString("mobile"); if(StringUtils.isEmpty(mobile)){ return ResponseCode.buildCodeMap("20003", "手机号码不能为空", null); } String code = json.optString("code"); if(StringUtils.isEmpty(code)){ return ResponseCode.buildCodeMap("20004", "验证码不能为空", null); } String id = json.optString("id"); if(StringUtils.isEmpty(id)){ return ResponseCode.buildCodeMap("20008", "id不能为空", null); } // 查询短信配置 SmsConfig smsConfig = smsConfigService.findSmsConfig(); Integer use_minute = 5; if(smsConfig != null && smsConfig.getUse_minute() != null){ use_minute = smsConfig.getUse_minute(); } // 查询手机号有效期内的验证码 SmsCode smsCode = smsCodeService.findByCode(mobile, sms_type, use_minute); if(smsCode == null){ return ResponseCode.buildCodeMap("20005", "验证码已过期,请重新获取!", null); } if(!StringUtils.equals(code, smsCode.getCode())){ return ResponseCode.buildCodeMap("20006", "验证码错误", null); } // 返回结果集 Map<String, Object> resultMap = new HashMap<String, Object>(); // 查询手机号码是否注册 User UserName = userService.selectByUserName(mobile); //原用户 User user = userService.selectByPrimaryKey(CommUtil.null2Long(id)); //刚注册的用户 // 原手机号存在用户, 并且登录用户有微信union ,需要合并用户 , 手机号存在, 并且 unionid 为空 if (UserName!=null&&StringUtils.isEmpty(UserName.getWeixin_unionID())&&user.getWeixin_unionID()!=null) { UserName.setWeixin_unionID(user.getWeixin_unionID()); //将新unionid 存入旧数据中 if (UserName.getLive_code()==null) { UserName.setLive_code(userService.selectMaxLiveCode() + 1); } if (StringUtils.isEmpty(UserName.getNickName())) { UserName.setNickName(user.getNickName()); } if (user.getPhoto_id()!=null) { UserName.setPhoto_id(user.getPhoto_id()); } if (user.getOpenId()!=null) { UserName.setOpenId(user.getOpenId()); } userService.updateById(UserName); user.setDeleteStatus(1); user.setMobile("del"+CommUtil.null2String(mobile)); user.setUserName("del"+CommUtil.null2String(mobile)); user.setWeixin_unionID("del"+UserName.getId()+""); userService.updateById(user); disUserFeignClient.deleteByUserId(user.getId()); //删除新的 分销关系表 //redisUtil.remove(Globals.ANDROID_LOGIN_MARK + user.getId()); //redisUtil.remove(Globals.WECHAT_LOGIN_MARK + user.getId()); //换用户登录 // 生成token,格式:用户id;时间戳 // String token = JWT.sign(UserName.getId() + ";" + System.currentTimeMillis()+";"+"app", 0); String tokenStr = request.getHeader("token"); // 将token存到redis中,有效期24小时 redisUtil.set(Globals.ANDROID_LOGIN_MARK + UserName.getId(), tokenStr, Globals.USER_INFO_EXPIRE_TIME); resultMap.put("token", tokenStr); // 覆盖redis用户信息 UserDto userDto = new UserDto(); BeanUtils.copyProperties(UserName, userDto); redisUtil.set(Globals.USER_INFO_MARK + UserName.getId(), userDto, Globals.USER_INFO_EXPIRE_TIME); resultMap.put("user", UserName); return ResponseCode.buildSuccessMap(resultMap); }else if(UserName!=null){ return ResponseCode.buildCodeMap("20007", "手机号已存在", null); }else{ if (user!=null) { user.setMobile(mobile); user.setUserName(mobile); } userService.update(user); } // 修改登录信息 /*user.setLoginCount(user.getLoginCount()+1); user.setLastLoginDate(new Date()); user.setLastLoginIp(CommUtil.getIpAddr(request)); // 生成token,格式:用户id;时间戳 String token = JWT.sign(user.getId() + ";" + System.currentTimeMillis(), 0); // 将token存到redis中,有效期24小时 redisUtil.set(Globals.WECHAT_LOGIN_MARK + user.getId(), token, Globals.USER_INFO_EXPIRE_TIME);*/ // resultMap.put("token", token); // 置空用户敏感字段 /*user.setPassword(""); user.setPay_password("");*/ resultMap.put("user", user); // 置空系统配置敏感字段 /*SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig(); sysConfig.setWeixin_appId(""); sysConfig.setWeixin_appSecret(""); sysConfig.setUploadFilePath(""); sysConfig.setUser_level(""); resultMap.put("sysConfig", sysConfig);*/ return ResponseCode.buildSuccessMap(resultMap); } /** * 用户名密码登录 * @param json * @param request * @return */ @RequestMapping(value = "/login_user", method = RequestMethod.POST) public Map<String,Object> login_user(@RequestBody JSONObject json, HttpServletRequest request){ String username = json.optString("username"); if(StringUtils.isEmpty(username)){ return ResponseCode.buildCodeMap("20001", "用户不能为空", null); } String password = json.optString("password"); if(StringUtils.isEmpty(password)){ return ResponseCode.buildCodeMap("20002", "验证码不能为空", null); } User user = userService.selectByUserName(username); if(user == null){ return ResponseCode.buildCodeMap("20003", "用户不存在", null); } if(!StringUtils.equals(user.getPassword(), Md5Encrypt.md5(password).toLowerCase())){ return ResponseCode.buildCodeMap("20006", "密码错误", null); } if(user.getSecurity() == 1){ return ResponseCode.buildCodeMap("20008", "账户存在安全隐患禁止登录!", null); } String storestatus=""; if (user.getStore_id()!=null) { StoreDto storeDto = storeFeignClient.selectByPrimaryKey(user.getStore_id()); if (storeDto!=null) { storestatus=storeDto.getStore_status()+""; } } // 修改登录信息 user.setLoginCount(user.getLoginCount()+1); user.setLastLoginDate(new Date()); user.setLastLoginIp(CommUtil.getIpAddr(request)); // 生成token,格式:用户id;时间戳 String token = JWT.sign(user.getId() + ";" + System.currentTimeMillis()+";"+"app", 0); // 将token存到redis中,有效期24小时 redisUtil.set(Globals.ANDROID_LOGIN_MARK + user.getId(), token, Globals.USER_INFO_EXPIRE_TIME); // 返回结果集 Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("token", token); // 置空用户敏感字段 user.setPassword(""); user.setPay_password(""); resultMap.put("user", user); // 置空系统配置敏感字段 SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig(); sysConfig.setWeixin_appId(""); sysConfig.setWeixin_appSecret(""); sysConfig.setUploadFilePath(""); sysConfig.setUser_level(""); resultMap.put("sysConfig", sysConfig); resultMap.put("storestatus", storestatus); return ResponseCode.buildSuccessMap(resultMap); } /** * 忘记密码保存 * @param json * @param request * @return */ @RequestMapping(value = "/forget_password_save", method = RequestMethod.POST) public Map<String,Object> forget_password_save(@RequestBody JSONObject json, HttpServletRequest request){ String sms_type = json.optString("sms_type"); if(StringUtils.isEmpty(sms_type)){ return ResponseCode.buildCodeMap("20001", "服务类型不能为空", null); } if(!StringUtils.equals("forget_password", sms_type)){ return ResponseCode.buildCodeMap("20002", "服务类型错误", null); } String mobile = json.optString("mobile"); if(StringUtils.isEmpty(mobile)){ return ResponseCode.buildCodeMap("20003", "手机号码不能为空", null); } String code = json.optString("code"); if(StringUtils.isEmpty(code)){ return ResponseCode.buildCodeMap("20004", "验证码不能为空", null); } String password = json.optString("password"); if(StringUtils.isEmpty(password)){ return ResponseCode.buildCodeMap("20005", "密码不能为空", null); } // 查询短信配置 SmsConfig smsConfig = smsConfigService.findSmsConfig(); Integer use_minute = 5; if(smsConfig != null && smsConfig.getUse_minute() != null){ use_minute = smsConfig.getUse_minute(); } // 查询手机号有效期内的验证码 SmsCode smsCode = smsCodeService.findByCode(mobile, sms_type, use_minute); if(smsCode == null){ return ResponseCode.buildCodeMap("20006", "验证码已过期,请重新获取!", null); } if(!StringUtils.equals(code, smsCode.getCode())){ return ResponseCode.buildCodeMap("20007", "验证码错误", null); } // 查询手机号码是否注册 User user = userService.selectByUserName(mobile); if(user == null){ return ResponseCode.buildCodeMap("20008", "用户不存在", null); } user.setPassword(Md5Encrypt.md5(password).toLowerCase()); userService.updateById(user); return ResponseCode.buildSuccessMap(null); } //TODO 鱼易注册 /** * 手机号注册(登录) * @param json * @param request * @return */ @RequestMapping(value = "/register_mobile_new", method = RequestMethod.POST) public Map<String,Object> register_mobile_new(@RequestBody JSONObject json, HttpServletRequest request){ String sms_type = json.optString("sms_type"); String true_name = json.optString("true_name");//真实姓名 if(StringUtils.isEmpty(true_name)){ return ResponseCode.buildCodeMap("20007", "真实姓名不能为空", null); } if(StringUtils.isEmpty(sms_type)){ return ResponseCode.buildCodeMap("20001", "服务类型不能为空", null); } if(!StringUtils.equals("register_mobile", sms_type)){ return ResponseCode.buildCodeMap("20002", "服务类型错误", null); } String mobile = json.optString("mobile"); if(StringUtils.isEmpty(mobile)){ return ResponseCode.buildCodeMap("20003", "手机号码不能为空", null); } String code = json.optString("code"); if(StringUtils.isEmpty(code)){ return ResponseCode.buildCodeMap("20004", "验证码不能为空", null); } String password = json.optString("password"); if(StringUtils.isEmpty(password)){ return ResponseCode.buildCodeMap("20004", "密码不能为空", null); } // 查询短信配置 SmsConfig smsConfig = smsConfigService.findSmsConfig(); Integer use_minute = 5; if(smsConfig != null && smsConfig.getUse_minute() != null){ use_minute = smsConfig.getUse_minute(); } // 查询手机号有效期内的验证码 SmsCode smsCode = smsCodeService.findByCode(mobile, sms_type, use_minute); if(smsCode == null){ return ResponseCode.buildCodeMap("20005", "验证码已过期,请重新获取!", null); } if(!StringUtils.equals(code, smsCode.getCode())){ return ResponseCode.buildCodeMap("20006", "验证码错误", null); } // 查询手机号码是否注册 User user = userService.selectByUserName(mobile); if(user != null){ return ResponseCode.buildCodeMap("20007", "手机号已注册", null); } user = new User(); user.setDeleteStatus(0); user.setSex(-1); // 性别 1为男、0为女、-1为保密 user.setDeleteStatus(0); user.setAddTime(new Date()); user.setMonth_income(0); user.setIntegral(0); user.setIs_agent(0); user.setTrueName(true_name); user.setLoginCount(0); user.setAvailableBalance(BigDecimal.ZERO); user.setFreezeBlance(BigDecimal.ZERO); user.setMobile(mobile); user.setUserName(mobile); user.setPassword(Md5Encrypt.md5(password).toLowerCase()); user.setYears(0); // 用户年龄 user.setIs_live(0); user.setUser_type(0); // 用户类别,默认为0个人用户,1为企业用户 user.setStore_apply_step(0); // 店铺申请进行的步骤,默认为0 user.setInvoiceType(0); // 发票类型 user.setLive_code(userService.selectMaxLiveCode() + 1); user.setWhether_attention(1); //是否允许关注 0为不允许,1为允许 userService.saveEntity(user); userService.saveDisUser(user, "-1"); // 修改登录信息 user.setLoginCount(user.getLoginCount()+1); user.setLastLoginDate(new Date()); user.setLastLoginIp(CommUtil.getIpAddr(request)); // 生成token,格式:用户id;时间戳 String token = JWT.sign(user.getId() + ";" + System.currentTimeMillis()+";"+"app", 0); // 将token存到redis中,有效期24小时 redisUtil.set(Globals.ANDROID_LOGIN_MARK + user.getId(), token, Globals.USER_INFO_EXPIRE_TIME); //传同步给鱼易 真实姓名, 手机号 , 密码, //userService.yuyiSaveUser(true_name,mobile,password); // 返回结果集 Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("token", token); // 置空用户敏感字段 user.setPassword(""); user.setPay_password(""); resultMap.put("user", user); // 置空系统配置敏感字段 SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig(); sysConfig.setWeixin_appId(""); sysConfig.setWeixin_appSecret(""); sysConfig.setUploadFilePath(""); sysConfig.setUser_level(""); resultMap.put("sysConfig", sysConfig); return ResponseCode.buildSuccessMap(resultMap); } }
@源码地址来源: https://minglisoft.cn/honghu2/business.html
这篇关于java版Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+直播短视频带货+三级分销的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-25初学者必备:订单系统资料详解与实操教程
- 2024-12-24内网穿透资料入门教程
- 2024-12-24微服务资料入门指南
- 2024-12-24微信支付系统资料入门教程
- 2024-12-24微信支付资料详解:新手入门指南
- 2024-12-24Hbase资料:新手入门教程
- 2024-12-24Java部署资料
- 2024-12-24Java订单系统资料:新手入门教程
- 2024-12-24Java分布式资料入门教程
- 2024-12-24Java监控系统资料详解与入门教程