【开源了】撸了一个电子文件签字+合同系统,爽! |
您所在的位置:网站首页 › 签签字的签 › 【开源了】撸了一个电子文件签字+合同系统,爽! |
大家好,我是编程君! 一、前言今天公司领导提出一个功能,说实现一个文件的签字+盖章功能,然后自己进行了简单的学习,对文档进行数字签名与签署纸质文档的原因大致相同,数字签名通过使用计算机加密来验证 (身份验证:验证人员和产品所声明的身份是否属实的过程。例如,通过验证用于签名代码的数字签名来确认软件发行商的代码来源和完整性。)数字信息,如文档、电子邮件和宏。数字签名有助于确保:真实性,完整性,不可否认性。目前市面上的电子签章产品也是多样化,但是不管是哪个厂家的产品,在线签章简单易用,同时也能保证签章的有效性,防篡改,防伪造,稳定,可靠就是好产品。 此次开源的系统模拟演示了文件在OA系统中的流转,主要为办公系统跨平台在线处理Office文档提供了完美的解决方案。Word文档在线处理的核心环节,包括:起草文档、领导审批、核稿、领导盖章、正式发文。PageOffice产品支持PC端Word文档在线处理的所有环节;MobOffice产品支持了移动端领导审批和领导盖章的功能。支持PC端和移动端对文档审批和盖章的互认。然后此次博客中使用的卓正软件的电子签章采用自主知识产权的核心智能识别验证技术,确保文档安全可靠。采用 COM、ActiveX嵌入式技术开发,确保软件能够支持多种应用。遵循《中华人民共和国电子签名法》关于电子签名的规范,同时支持国际通用的 RSA算法,符合国家安全标准。 PageOffice和MobOffice产品结合使用为跨平台处理Office文件提供了完美的解决方案,主要功能有word在线编辑保存和留痕,word和pdf文件在线盖章(电子印章)。 二、项目该签字+盖章流程系统使用了SpringBoot+thymeleaf实现的,然后jar包依赖使用了maven 控制层 @Controller @RequestMapping("/mobile") public class MobileOfficeController { @Value("${docpath}") private String docPath; @Value("${moblicpath}") private String moblicpath; @Autowired DocService m_docService; /** * 添加MobOffice的服务器端授权程序Servlet(必须) * */ @RequestMapping("/opendoc") public void opendoc(HttpServletRequest request, HttpServletResponse response, HttpSession session,String type,String userName)throws Exception { String fileName = ""; userName= URLDecoder.decode(userName,"utf-8"); Doc doc=m_docService.getDocById(1); if(type.equals("word")){ fileName = doc.getDocName(); }else{ fileName = doc.getPdfName(); } OpenModeType openModeType = OpenModeType.docNormalEdit; if (fileName.endsWith(".doc")) { openModeType = OpenModeType.docNormalEdit; } else if (fileName.endsWith(".pdf")) { String mode = request.getParameter("mode"); if (mode.equals("normal")) { openModeType = OpenModeType.pdfNormal; } else { openModeType = OpenModeType.pdfReadOnly; } } MobOfficeCtrl mobCtrl = new MobOfficeCtrl(request,response); mobCtrl.setSysPath(moblicpath); mobCtrl.setServerPage("/mobserver.zz"); //mobCtrl.setZoomSealServer("http://xxx.xxx.xxx.xxx:8080/ZoomSealEnt/enserver.zz"); mobCtrl.setSaveFilePage("/mobile/savedoc?testid="+Math.random()); mobCtrl.webOpen("file://"+docPath+fileName, openModeType , userName); } @RequestMapping("/savedoc") public void savedoc(HttpServletRequest request, HttpServletResponse response){ FileSaver fs = new FileSaver(request, response); fs.saveToFile(docPath+fs.getFileName()); fs.close(); } }项目业务层源码 @Service public class DocServiceImpl implements DocService { @Autowired DocMapper docMapper; @Override public Doc getDocById(int id) throws Exception { Doc doc=docMapper.getDocById(id); //如果doc为null的话,页面所有doc.属性都报错 if(doc==null) { doc=new Doc(); } return doc; } @Override public Integer addDoc(Doc doc) throws Exception { int id=docMapper.addDoc(doc); return id; } @Override public Integer updateStatusForDocById(Doc doc) throws Exception { int id=docMapper.updateStatusForDocById(doc); return id; } @Override public Integer updateDocNameForDocById(Doc doc) throws Exception { int id=docMapper.updateDocNameForDocById(doc); return id; } @Override public Integer updatePdfNameForDocById(Doc doc) throws Exception { int id=docMapper.updatePdfNameForDocById(doc); return id; } }拷贝文件 public class CopyFileUtil { //拷贝文件 public static boolean copyFile(String oldPath, String newPath) throws Exception { boolean copyStatus=false; int bytesum = 0; int byteread = 0; File oldfile = new File(oldPath); if (oldfile.exists()) { //文件存在时 InputStream inStream = new FileInputStream(oldPath); //读入原文件 FileOutputStream fs = new FileOutputStream(newPath); byte[] buffer = new byte[1444]; int length; while ((byteread = inStream.read(buffer)) != -1) { bytesum += byteread; //字节数 文件大小 //System.out.println(bytesum); fs.write(buffer, 0, byteread); } fs.close(); inStream.close(); copyStatus=true; }else{ copyStatus=false; } return copyStatus; } }二维码源码 public class QRCodeUtil { private String codeText;//二维码内容 private BarcodeFormat barcodeFormat;//二维码类型 private int width;//图片宽度 private int height;//图片高度 private String imageformat;//图片格式 private int backColorRGB;//背景色,颜色RGB的数值既可以用十进制表示,也可以用十六进制表示 private int codeColorRGB;//二维码颜色 private ErrorCorrectionLevel errorCorrectionLevel;//二维码纠错能力 private String encodeType; public QRCodeUtil() { codeText = "www.zhuozhengsoft.com"; barcodeFormat = BarcodeFormat.PDF_417; width = 400; height = 400; imageformat = "png"; backColorRGB = 0xFFFFFFFF; codeColorRGB = 0xFF000000; errorCorrectionLevel = ErrorCorrectionLevel.H; encodeType = "UTF-8"; } public QRCodeUtil(String text) { codeText = text; barcodeFormat = BarcodeFormat.PDF_417; width = 400; height = 400; imageformat = "png"; backColorRGB = 0xFFFFFFFF; codeColorRGB = 0xFF000000; errorCorrectionLevel = ErrorCorrectionLevel.H; encodeType = "UTF-8"; } public String getCodeText() { return codeText; } public void setCodeText(String codeText) { this.codeText = codeText; } public BarcodeFormat getBarcodeFormat() { return barcodeFormat; } public void setBarcodeFormat(BarcodeFormat barcodeFormat) { this.barcodeFormat = barcodeFormat; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public String getImageformat() { return imageformat; } public void setImageformat(String imageformat) { this.imageformat = imageformat; } public int getBackColorRGB() { return backColorRGB; } public void setBackColorRGB(int backColorRGB) { this.backColorRGB = backColorRGB; } public int getCodeColorRGB() { return codeColorRGB; } public void setCodeColorRGB(int codeColorRGB) { this.codeColorRGB = codeColorRGB; } public ErrorCorrectionLevel getErrorCorrectionLevel() { return errorCorrectionLevel; } public void setErrorCorrectionLevel(ErrorCorrectionLevel errorCorrectionLevel) { this.errorCorrectionLevel = errorCorrectionLevel; } private BufferedImage toBufferedImage(BitMatrix bitMatrix) { int width = bitMatrix.getWidth(); int height = bitMatrix.getHeight(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |