| | |
| | | userId: String, |
| | | taskId: String?, |
| | | list: String, |
| | | fileNames: String?, |
| | | files: Array<MultipartFile>, |
| | | ): BaseResponse<Boolean> { |
| | | val mapper = ObjectMapper() |
| | | val ledgerVos = mapper.readValue(list, object : TypeReference<List<LedgerVo>>() {}) |
| | | val fileNamePair = if (fileNames.isNullOrBlank()) { |
| | | emptyList() |
| | | } else { |
| | | mapper.readValue(fileNames, object : TypeReference<List<Map<String, String>>>() {})?.map { |
| | | it["first"] to it["second"] |
| | | } |
| | | } |
| | | ledgerVos.forEach { |
| | | it.id = it.id ?: UUIDGenerator.generate16ShortUUID() |
| | | it.fileType = it.fileType ?: 1 |
| | |
| | | var picPath = "" |
| | | val time = DateUtil.DateToString(Date(), DateUtil.DateStyle.YYYY_MM) |
| | | files.forEach { file -> |
| | | val fileName = file.originalFilename |
| | | var fileName = file.originalFilename |
| | | // 根据传入的文件配队信息获取原始文件名 |
| | | fileNamePair?.find { p-> p.first == file.originalFilename }?.let { p-> fileName = p.second } |
| | | val basePath = imgPath |
| | | val path = "$time/$userId/${it.ledgerName}/" |
| | | picPath += if (picPath.isEmpty()) { |