src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt
@@ -30,6 +30,7 @@
    private val selfPatrolMediaFileMapper: SelfPatrolMediaFileMapper,
    private val userinfoMapper: UserinfoMapper,
    private val ledgerSubTypeMapper: LedgerSubTypeMapper,
    private val userSettingRecordMapper: UserSettingRecordMapper,
) : SelfPatrolService {
    @Value("\${imgPath}")
@@ -143,6 +144,7 @@
                sceneType = it.getlScenetype(),
                iconUrl = it.getlIconurl(),
                realTime = it.getlRealTime(),
                copy = it.getlAutoCopy() ?: false,
                description = it.getlDescription(),
                notRelated = it.getlNotRelatedSwitch() ?: true,
                multigroup = it.getlMultiGroup() ?: false
@@ -170,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
@@ -230,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()) {
@@ -367,6 +379,9 @@
                ledgerType = type?.get(0)?.getlTypename()
                ledgerFinished = true
                isUpLoad = true
                this.year = it.srYear
                this.month = it.srMonth
                this.day = it.srDay
                updateDate = it.srSubmitdate
                updateType = it.srUpdatetype
                fileType = it.srEasubmitkind.toInt()
@@ -417,6 +432,9 @@
                ledgerType = type.getlTypename()
                ledgerFinished = it != null
                isUpLoad = it != null
                this.year = it?.srYear
                this.month = it?.srMonth
                this.day = it?.srDay
                updateDate = it?.srSubmitdate
                updateType = it?.srUpdatetype
                fileType = it?.srEasubmitkind?.toInt()
@@ -463,7 +481,20 @@
     * 自寻查承诺
     * 承诺完成后,在一个自然年内记录都有效,也可以覆盖上传
     */
    override fun promiseSelfPatrol(record: UserSettingRecord): UserSettingRecord? {
        TODO("Not yet implemented")
    override fun promiseSelfPatrol(userId: String): UserSettingRecord? {
        var record = userSettingRecordMapper.selectByPrimaryKey(userId)
        if (record == null) {
            record = UserSettingRecord().apply {
                this.userId = userId
                this.selfPatrolPromised = true
                this.lastPromisedTime = Date()
            }
            userSettingRecordMapper.insert(record)
        } else {
            record.selfPatrolPromised = true
            record.lastPromisedTime = Date()
            userSettingRecordMapper.updateByPrimaryKey(record)
        }
        return record
    }
}