jinpengyong
2022-01-17 dfd4d6a6a8de0c13f63c06f0a3d6f39e157ecd19
screen-api/src/main/java/com/moral/api/service/impl/SupervisionServiceImpl.java
@@ -12,6 +12,7 @@
import com.moral.util.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
@@ -41,9 +42,10 @@
    @Override
    public Map<String, Object> add(MultipartFile[] files, Supervision supervision) {
        String path = this.getClass().getClassLoader()
                .getResource("").getFile() + "static/img/";
        //获取jar包所在目录
        ApplicationHome h = new ApplicationHome(getClass());
        //在jar包所在目录下生成一个upload文件夹用来存储上传的图片
        String path = h.getSource().getParentFile().toString() + "/static/img";
        Map<String, Object> result = new HashMap<>();