| | |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.constant.TenantConstant; |
| | | import org.springblade.common.utils.IdCardNoUtil; |
| | | import org.springblade.common.utils.ImageUtils; |
| | | import org.springblade.common.utils.QRCodeUtil; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | |
| | | throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount())); |
| | | } |
| | | boolean b = save(user) && submitUserDept(user); |
| | | String rtime = null; |
| | | if (null != user.getRtime()) { |
| | | rtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getRtime()); |
| | | } |
| | | user.setIsDeleted(0); |
| | | String s = "insert into blade_user(id,tenant_id,account,password,real_name,email,phone,sex,role_id,dept_id,cardid,nativePlace,nation," + |
| | | "politicaloutlook,healstats,height,address,registered,securitynumber,hold,status,dispatch,jurisdiction,is_deleted) " + |
| | |
| | | */ |
| | | @Override |
| | | public void importQrCode(List<QrCodeExcel> data, Boolean isCovered, String deptId) { |
| | | String url = "http://223.82.109.183:2080/securityInfo.html"; |
| | | // String url = "http://223.82.109.183:2080/securityInfo.html"; |
| | | // data.forEach(qrCodeExcel -> { |
| | | // if (null!=qrCodeExcel.getSecuritynumber()) { |
| | | // String encoded = null; |
| | | // try { |
| | | // //中文字符串编码 |
| | | // encoded = URLEncoder.encode(qrCodeExcel.getSecuritynumber(),"UTF-8"); |
| | | // } catch (UnsupportedEncodingException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //url 拼接 |
| | | // String content = url + "?securityNumber=" + encoded; |
| | | // byte[] qrCodeImage = new byte[0]; |
| | | // try { |
| | | // //生成二维码字节流 |
| | | // qrCodeImage = QRCodeUtil.getQRCodeImage(content, 350, 350); |
| | | // } catch (WriterException e) { |
| | | // e.printStackTrace(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // String path = "D:\\QrCode\\"; |
| | | // FileOutputStream fileOutputStream = null; |
| | | // try { |
| | | // fileOutputStream = new FileOutputStream(path+qrCodeExcel.getSecuritynumber()+".png"); |
| | | // } catch (FileNotFoundException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // try { |
| | | // //图片下载到本地 |
| | | // fileOutputStream.write(qrCodeImage,0,qrCodeImage.length); |
| | | // fileOutputStream.flush(); |
| | | // fileOutputStream.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }); |
| | | //头像生成 |
| | | data.forEach(qrCodeExcel -> { |
| | | if (null!=qrCodeExcel.getSecuritynumber()) { |
| | | String encoded = null; |
| | | try { |
| | | //中文字符串编码 |
| | | encoded = URLEncoder.encode(qrCodeExcel.getSecuritynumber(),"UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //查询用户头像url |
| | | User user = new User(); |
| | | user.setSecuritynumber(qrCodeExcel.getSecuritynumber()); |
| | | User user1 = this.getOne(Condition.getQueryWrapper(user)); |
| | | //url 拼接 |
| | | String content = url + "?securityNumber=" + encoded; |
| | | byte[] qrCodeImage = new byte[0]; |
| | | try { |
| | | //生成二维码字节流 |
| | | qrCodeImage = QRCodeUtil.getQRCodeImage(content, 350, 350); |
| | | } catch (WriterException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //获取图片 |
| | | qrCodeImage = ImageUtils.getFileStream(user1.getAvatar()); |
| | | //路径 |
| | | String path = "D:\\QrCode\\"; |
| | | FileOutputStream fileOutputStream = null; |
| | | try { |
| | | fileOutputStream = new FileOutputStream(path+qrCodeExcel.getSecuritynumber()+".png"); |
| | | fileOutputStream = new FileOutputStream(path+user1.getRealName()+user1.getCardid()+".png"); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |