|
@@ -262,6 +262,51 @@ public class WorkattachmentService extends CrudService<WorkattachmentDao, Workat
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //删除附件
|
|
|
+ //阿里云文件地址http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/attachment-file/workBidingDocument/3fcf03e37b3ba0fd5c7821998e392395.doc
|
|
|
+ //其中阿里云删除接口所需的参数 key 指的是 attachment-file/workBidingDocument/3fcf03e37b3ba0fd5c7821998e392395.doc
|
|
|
+ @Transactional(readOnly = false)
|
|
|
+ public void deleteExterFileFromAliyun(ExternalUnitWorkClientAttachment workattachment,String url) {
|
|
|
+ if(workattachment != null){
|
|
|
+ this.deleteExter(workattachment);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(url)) {
|
|
|
+// String aliyunUrl = Global.getAliyunUrl();
|
|
|
+// String aliDownloadUrl = Global.getAliDownloadUrl();
|
|
|
+// String cons = "";
|
|
|
+// if (url.contains(aliyunUrl)){
|
|
|
+// cons = aliyunUrl;
|
|
|
+// }else if (url.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
|
|
|
+// cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
|
|
|
+// }else {
|
|
|
+// cons = aliDownloadUrl;
|
|
|
+// }
|
|
|
+// final String[] arr = url.split(cons + "/");
|
|
|
+// String key = arr[1];
|
|
|
+// logger.info("key="+key);
|
|
|
+// OSSClientUtil ossClientUtil = new OSSClientUtil();
|
|
|
+// if (StringUtils.isNotBlank(key)) {
|
|
|
+// ossClientUtil.deleteSingleObject(key);
|
|
|
+// }
|
|
|
+// Workattachment workattachment1 = new Workattachment();
|
|
|
+// workattachment1.setUrl(url);
|
|
|
+// deleteByUrl(workattachment1);
|
|
|
+ try {
|
|
|
+ int index = url.indexOf(".com");
|
|
|
+ String path = URLDecoder.decode(url.substring(index + 4, url.length()), "UTF-8");
|
|
|
+ BOSClientUtil bosClientUtil = new BOSClientUtil();
|
|
|
+ bosClientUtil.deleteObject(path);
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void deleteExter(ExternalUnitWorkClientAttachment workattachment) {
|
|
|
+ workattachmentDao.deleteExter(workattachment);
|
|
|
+ }
|
|
|
+
|
|
|
public List<Workattachment> findAttachment(String attachmentId,String type) {
|
|
|
List<Workattachment> workattachmentList = new ArrayList<>();
|
|
|
if(StringUtils.isNotBlank(attachmentId)){
|
|
@@ -1068,6 +1113,11 @@ public class WorkattachmentService extends CrudService<WorkattachmentDao, Workat
|
|
|
return workattachmentDao.queryMaterialListFile(workattachment);
|
|
|
}
|
|
|
|
|
|
+ public ExternalUnitWorkClientAttachment getExterFile(String id) {
|
|
|
+ return workattachmentDao.getExterFile(id);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 根据id获取对象
|
|
|
*/
|