| | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.FileUtil |
| | | import cn.flightfeather.supervision.lightshare.service.VersionService |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.web.multipart.MultipartFile |
| | | import tk.mybatis.mapper.entity.Example |
| | | |
| | | @Service |
| | | class VersionServiceImpl(val versionMapper: VersionMapper): VersionService { |
| | | class VersionServiceImpl( |
| | | val versionMapper: VersionMapper, @Value("\${filePath}") var filePath: String, |
| | | @Value("\${imgPath}") var imgPath: String, |
| | | ): VersionService { |
| | | |
| | | override fun save(version: Version): Int = versionMapper.insert(version) |
| | | |
| | |
| | | if (files.isNotEmpty()) { |
| | | val file = files[0] |
| | | val fileName = files[0].originalFilename |
| | | val basePath = Constant.DEFAULT_FILE_PATH + "/files/" |
| | | val path = "crash/" |
| | | val basePath = filePath |
| | | val path = "/crash/" |
| | | try { |
| | | //调用文件保存方法 |
| | | FileUtil().uploadFile(file.bytes, basePath + path, fileName!!) |
| | | FileUtil.uploadFile(file.bytes, basePath + path, fileName!!) |
| | | return true |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |