| | |
| | | return baseDao.executeUpdate(sql.toString()); |
| | | } |
| | | |
| | | /** |
| | | * 根据附件uuid判断文件是否存在 |
| | | * |
| | | * @param uuid |
| | | * @return |
| | | */ |
| | | public boolean fileExist(String uuid) { |
| | | if (StringUtils.isEmpty(uuid)) { |
| | | return false; |
| | | } |
| | | FieldSetEntity attachmentFse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_ATTACHMENTS, uuid, false); |
| | | if (attachmentFse == null) { |
| | | return false; |
| | | } |
| | | |
| | | //判断文件存放在服务器还是本地 |
| | | boolean needDownloadFromServerFlag = "1".equals(attachmentFse.getString(CmnConst.UPLOAD_SIGN)); |
| | | String dir = attachmentFse.getString(CmnConst.ATTACHMENT_URL); |
| | | String fileName = attachmentFse.getString(CmnConst.ATTACHMENT_TITLE); |
| | | boolean encrptSignFlag = "1".equals(attachmentFse.getString(CmnConst.ENCRPT_SIGN)); |
| | | |
| | | if (needDownloadFromServerFlag) { |
| | | // 需要从附件服务器上取文件 |
| | | FTPService ftpService = new FTPService(); |
| | | return ftpService.fileIsExist(dir, fileName); |
| | | } else { |
| | | // 直接在本地的目录中找文件 |
| | | String localBasePath = Global.getSystemConfig("local.dir", ""); |
| | | String path = localBasePath + File.separator + dir + File.separator + fileName; |
| | | File file = new File(path); |
| | | return file.isFile(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 上传文件到本地服务器 |
| | |
| | | } |
| | | os.flush(); |
| | | } |
| | | |
| | | is.close(); |
| | | } |
| | | logger.info("文件流获取成功"); |
| | | } |