|
@@ -2,10 +2,15 @@ package com.onemap.apply.service.gdbh.impl;
|
|
|
|
|
|
import com.onemap.apply.domain.gdbh.TGdbhJctbFileDTO;
|
|
|
import com.onemap.apply.mapper.gdbh.TGdbhJctbFileMapper;
|
|
|
+import com.onemap.apply.mapper.gdbh.TGdbhJctbMapper;
|
|
|
import com.onemap.apply.service.gdbh.ITGdbhJctbFileService;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
+import java.nio.file.*;
|
|
|
+import java.nio.file.attribute.BasicFileAttributes;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -18,10 +23,35 @@ import java.util.List;
|
|
|
public class TGdbhJctbFileServiceImpl implements ITGdbhJctbFileService {
|
|
|
@Resource
|
|
|
private TGdbhJctbFileMapper gdbhJctbFileMapper;
|
|
|
+ @Resource
|
|
|
+ private TGdbhJctbMapper tGdbhJctbMapper;
|
|
|
+ @Value("${file.path}")
|
|
|
+ private String uploadFilePath;
|
|
|
|
|
|
@Override
|
|
|
public List<TGdbhJctbFileDTO> selectTGdbhJctbFileList(TGdbhJctbFileDTO tGdbhJctbFileDTO) {
|
|
|
return gdbhJctbFileMapper.selectTGdbhJctbFileList(tGdbhJctbFileDTO);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int deleteTGdbhJctbFileById(String id) {
|
|
|
+ TGdbhJctbFileDTO d0_filedto = gdbhJctbFileMapper.selectTGdbhJctbFileById(id);
|
|
|
+ if (null == d0_filedto) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ String unzip_path = d0_filedto.getUnzippath();
|
|
|
+ String d1_unzip_path = uploadFilePath + unzip_path;
|
|
|
+ try {
|
|
|
+ Path unzip = Paths.get(d1_unzip_path);
|
|
|
+ if (Files.exists(unzip)) {
|
|
|
+ Files.delete(unzip);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ tGdbhJctbMapper.deleteTGdbhJctbByPcsj(id);
|
|
|
+ gdbhJctbFileMapper.deleteTGdbhJctbFileById(id);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
}
|