2026.1.22
1. 新增台账上传office文档功能;
2. 新增office文档存储原始文档名字功能
已修改6个文件
57 ■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/LedgerService.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SelfPatrolService.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SelfPatrolController.kt 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt
@@ -19,9 +19,11 @@
import cn.flightfeather.supervision.lightshare.vo.*
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import com.github.pagehelper.PageHelper
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.multipart.MultipartFile
import tk.mybatis.mapper.entity.Example
import java.io.File
@@ -305,11 +307,21 @@
        return true
    }
    override fun uploadLedger(userId: String, ledgerVoList: String, files: Array<MultipartFile>): Boolean {
    @Transactional
    override fun uploadLedger(
        userId: String, ledgerVoList: String,
        fileNames: String?, files: Array<MultipartFile>,
    ): Boolean {
        val mapper = ObjectMapper()
        val ledgerVos = mapper.readValue<List<LedgerVo>>(ledgerVoList, object : TypeReference<List<LedgerVo>>() {})
        val ledgerVos = mapper.readValue(ledgerVoList, 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()
@@ -356,8 +368,14 @@
                val record = tmp[0]
                it.id = record.lrGuid
                ledgerMedia = deleteLedgerFile(record.lrGuid)
                record.apply {
                    lrYear = updateYear
                    lrMonth = updateMonth.toByte()
                    lrDay = updateDay.toByte()
                    lrSubmitdate = Date()
                // 去除不涉及标志或复制标志
                record.lrExtension2 = null
                    lrExtension2 = null
                }
                ledgerRecordMapper.updateByPrimaryKey(record)
            }
@@ -365,9 +383,9 @@
            var picPath = ""
            val time = DateUtil.DateToString(Date(), DateUtil.DateStyle.YYYY_MM)
            files.forEach { file ->
                val fileName = file.originalFilename
                //TODO 此处的文件路径需要修改为动态配置
//                val basePath = "D:/02product/05ledger/images/"
                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()) {
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt
@@ -172,10 +172,18 @@
        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
@@ -232,7 +240,9 @@
            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()) {
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/LedgerService.kt
@@ -27,7 +27,7 @@
    /**
     * 上传台账
     */
    fun uploadLedger(userId: String, ledgerVoList: String, files: Array<MultipartFile>): Boolean
    fun uploadLedger(userId: String, ledgerVoList: String, fileNames: String?, files: Array<MultipartFile>): Boolean
    /**
     * 上传不涉及台账
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SelfPatrolService.kt
@@ -39,6 +39,7 @@
        userId: String,
        taskId: String?,
        list: String,
        fileNames: String?,
        files: Array<MultipartFile>,
    ): BaseResponse<Boolean>
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt
@@ -60,8 +60,10 @@
    fun uploadLedger(
        @ApiParam("用户id") @PathVariable userId: String,
        @ApiParam("台账信息json") @RequestParam("params") ledgerVoList: String,
        @ApiParam("台账图片") @RequestPart("images") files:Array<MultipartFile>
    ) = ledgerService.uploadLedger(userId, ledgerVoList, files)
        @ApiParam("临时文件名和原始文件名称的对应列表") @RequestParam("fileNames", required = false)
        fileNames: String?,
        @ApiParam("台账图片") @RequestPart("images") files: Array<MultipartFile>,
    ) = ledgerService.uploadLedger(userId, ledgerVoList, fileNames, files)
    @ApiOperation("上传不涉及台账")
    @PostMapping("/upload/noLedger")
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SelfPatrolController.kt
@@ -58,8 +58,10 @@
        @ApiParam("用户id") @RequestParam userId: String,
        @ApiParam("应急自巡查任务id") @RequestParam(required = false) taskId: String?,
        @ApiParam("自巡查信息json") @RequestParam("params") list: String,
        @ApiParam("临时文件名和原始文件名称的对应列表") @RequestParam("fileNames", required = false)
        fileNames: String?,
        @ApiParam("自巡查图片") @RequestPart("images") files: Array<MultipartFile>,
    ) = selfPatrolService.uploadSelfPatrol(userId, taskId, list, files)
    ) = selfPatrolService.uploadSelfPatrol(userId, taskId, list,fileNames, files)
    @ApiOperation("上传不涉及自巡查")
    @PostMapping("/task/record/upload/noInvolved")