| | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | user.setPassword(company.getPassword()); |
| | | user.setPhonenumber(company.getChargePersonPhone()); |
| | | user.setNickName(company.getChargePerson()); |
| | | user.setRoleId(1l); |
| | | user.setCode(company.getCode()); |
| | | user.setRoleId(2l); |
| | | if (!userService.checkUserNameUnique(user)) { |
| | | return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | |
| | | @GetMapping(value = "/getQrcode") |
| | | public R<String> getQrcode(@RequestParam Long userId) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | Object o = redisTemplate.opsForValue().get("ADMIN_WX_IMG" + sysUser.getCode()); |
| | | Object o = redisTemplate.opsForValue().get("ADMIN_WX_IMG" + sysUser.getUserId()); |
| | | if(o!=null){ |
| | | return R.ok(o.toString()); |
| | | } |
| | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("page", "pages/home/home"); |
| | | param.put("width", 430); //二维码尺寸 |
| | | param.put("scene", "userId=" + userId); //二维码尺寸 |
| | | param.put("scene", "code=" + sysUser.getCode()+"&type=1"); //二维码尺寸 |
| | | param.put("env_version", "trial"); //二维码尺寸 |
| | | param.put("check_path", false); //二维码尺寸 |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.body(JSON.toJSONString(param)); |
| | | |
| | | byte[] result = post.execute().bodyBytes(); |
| | | HttpResponse execute = post.execute(); |
| | | byte[] result =execute .bodyBytes(); |
| | | // base64 |
| | | String img = Base64.getEncoder().encodeToString(result); |
| | | // 后台用户的小程序码 |
| | |
| | | { |
| | | return R.fail("新增用户'" + user.getUserName() + "'失败,推广号已存在"); |
| | | } |
| | | |
| | | |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | |
| | | user.setRoleType(3); |
| | | user.setRoleId(1l); |
| | | // 随机10数数字 |
| | | userService.insertUser(user); |
| | | if(user.getCompanyId()!=null){ |
| | |
| | | param.put("width", 430); //二维码尺寸 |
| | | param.put("scene", "code=" + user.getCode()+"&type=1"); //二维码尺寸 |
| | | param.put("env_version", "trial"); //二维码尺寸 |
| | | param.put("check_path", false); //二维码尺寸 |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.body(JSON.toJSONString(param)); |
| | | |
| | |
| | | |
| | | sysUser.setCreateBy(getUsername()); |
| | | sysUser.setRoleType(3); |
| | | sysUser.setRoleId(1L); |
| | | sysUser.setRoleId(2L); |
| | | // sysUsers.add(sysUser); |
| | | userService.insertUser(sysUser); |
| | | i++; |