feiyu02
2026-01-21 fe031e01cc1737c2f05a133fde7c36c7a2a7b4b4
2026.1.21
1. 新增完善台账复制逻辑
已修改9个文件
112 ■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserSettingMapper.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/mapper/UserSettingMapper.kt
@@ -5,4 +5,10 @@
import org.apache.ibatis.annotations.Mapper
@Mapper
interface UserSettingMapper : MyMapper<UserSetting?>
interface UserSettingMapper : MyMapper<UserSetting?> {
    /**
     * 查询行政区划最适配的配置信息
     */
    fun selectBestConfig(setting: UserSetting): UserSetting?
}
src/main/kotlin/cn/flightfeather/supervision/domain/repository/UserConfigRep.kt
@@ -93,8 +93,9 @@
            districtName = baseInfo?.biDistrictName ?: userInfo.extension1
            sceneTypeId = userInfo.extension2?.toInt()
        }
        val res = userSettingMapper.select(userSetting)
        val res = userSettingMapper.selectBestConfig(userSetting)
        return if (res.isNotEmpty()) res[0] else null
//        return if (res.isNotEmpty()) res[0] else null
        return res
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/LedgerServiceImpl.kt
@@ -97,6 +97,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
@@ -188,6 +189,9 @@
                ledgerType = type?.get(0)?.getlTypename()
                ledgerFinished = true
                isUpLoad = true
                this.year = it.lrYear
                this.month = it.lrMonth
                this.day = it.lrDay
                updateDate = it.lrSubmitdate
                updateType = it.lrUpdatetype
                fileType = it.lrEasubmitkind.toInt()
@@ -248,6 +252,9 @@
                ledgerType = type?.get(0)?.getlTypename()
                ledgerFinished = true
                isUpLoad = true
                this.year = it.lrYear
                this.month = it.lrMonth
                this.day = it.lrDay
                updateDate = it.lrSubmitdate
                updateType = it.lrUpdatetype
                fileType = it.lrEasubmitkind.toInt()
@@ -576,8 +583,8 @@
    }
    override fun copyLedger(userId: String, time: String, copyLedgerList: List<CopyLedgerVo>): BaseResponse<String> {
        val year = time.split("-")[0]
        val month = time.split("-")[1]
        val year = time.split("-")[0].toIntOrNull() ?: return BaseResponse(false, "年份格式错误")
        val month = time.split("-")[1].toIntOrNull() ?: return BaseResponse(false, "月份格式错误")
        val date = DateUtil.StringToDate(time, DateUtil.DateStyle.YYYY_MM)
        copyLedgerList.forEach {
            //去重判断
@@ -591,14 +598,17 @@
                return@forEach
            }
            val y = it.time?.split("-")?.get(0) ?: return@forEach
            val m = it.time?.split("-")?.get(1) ?: return@forEach
            val y = it.time?.split("-")?.get(0)
            val m = it.time?.split("-")?.get(1)
            ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply {
                createCriteria().andEqualTo("lrSubmitid", userId)
                    .andEqualTo("lsSubtypeid", it.subTypeId)
                    .andEqualTo("lrYear", y)
                    .andEqualTo("lrMonth", m)
            }).forEach record@{ lr ->
                orderBy("lrYear").desc()
                    .orderBy("lrMonth").desc()
                    .orderBy("lrSubmitdate").desc()
            }).takeIf { list-> list.isNotEmpty() }?.get(0)?.let record@{ lr ->
                //获取记录对应的文件信息
                val fileList = ledgerMediaFileMapper.selectByExample(Example(LedgerMediaFile::class.java).apply {
                    createCriteria().andEqualTo("lrGuid", lr.lrGuid)
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/SelfPatrolServiceImpl.kt
@@ -144,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
@@ -368,6 +369,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()
@@ -418,6 +422,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()
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerSubTypeVo.kt
@@ -20,7 +20,7 @@
        var ledgerType: String? = null,
        //台账完成状态
        var ledgerFinished: Boolean = false,
        //台账是否上传
        //台账是否上传(必填或选填)
        var upLoad: Boolean = false,
        //台账是否需要上传
        var needUpdate: Boolean = true,
@@ -34,6 +34,8 @@
        var iconUrl: String? = null,
        //台账是否有实时性要求,没有实时性要求的台账才可以复制
        var realTime: Boolean = false,
        //台账是否可以延续历史记录复制
        var copy: Boolean = false,
        //台账说明
        var description: String? = null,
        //台账是否开启不涉及选项(默认开启)
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/LedgerVo.kt
@@ -32,6 +32,9 @@
    //台账是否上传
    var isUpLoad: Boolean = false,
    //台账更新日期
    var year: Int? = null,
    var month: Byte? = null,
    var day: Byte? = null,
    var updateDate: Date? = null,
    //台账更新类型(0部分更新(部分缺失、遗失)、1已更新、2无更新等)
    var updateType: Byte? = null,
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/LedgerController.kt
@@ -90,9 +90,9 @@
    @ApiOperation("复制场景的台账")
    @PostMapping("/copy")
    fun copyLedger(
        @RequestParam("userId") userId: String,
        @RequestParam("time") time: String,
        @RequestBody copyLedgerList: List<CopyLedgerVo>
        @ApiParam("用户id") @RequestParam("userId") userId: String,
        @ApiParam("复制的目标月份") @RequestParam("time") time: String,
        @ApiParam("需要复制的源台账") @RequestBody copyLedgerList: List<CopyLedgerVo>
    ) = ledgerService.copyLedger(userId, time, copyLedgerList)
    @ApiOperation("审核台账")
src/main/resources/mapper/UserSettingMapper.xml
@@ -47,4 +47,61 @@
    -->
    sp_promise_content
  </sql>
  <!-- 行政区划最匹配查询条件 -->
  <select id="selectBestConfig" resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />, <include refid="Blob_Column_List" />
    FROM sm_t_setting
    <where>
      <if test="userTypeId != null">
        AND User_Type_Id = #{userTypeId}
      </if>
      <if test="sceneTypeId != null">
        AND (scene_type_id = #{sceneTypeId} OR scene_type_id IS NULL)
      </if>
      <if test="provinceName != null">
        AND (Province_Name = #{provinceName} OR Province_Name IS NULL)
      </if>
      <if test="cityName != null">
        AND (City_Name = #{cityName} OR City_Name IS NULL)
      </if>
      <if test="districtName != null">
        AND (District_Name = #{districtName} OR District_Name IS NULL)
      </if>
      <if test="townName != null">
        AND (Town_Name = #{townName} OR Town_Name IS NULL)
      </if>
      <if test="area != null">
        AND (Area = #{area} OR Area IS NULL)
      </if>
      <if test="managementCompany != null">
        AND (Management_Company = #{managementCompany} OR Management_Company IS NULL)
      </if>
    </where>
    ORDER BY
      CASE
        WHEN Province_Name = #{provinceName} AND City_Name = #{cityName}
          AND District_Name = #{districtName} AND Town_Name = #{townName} THEN 1
        WHEN Province_Name = #{provinceName} AND City_Name = #{cityName}
          AND District_Name = #{districtName} AND Town_Name IS NULL THEN 2
        WHEN Province_Name = #{provinceName} AND City_Name = #{cityName}
          AND District_Name IS NULL AND Town_Name IS NULL THEN 3
        WHEN Province_Name = #{provinceName} AND City_Name IS NULL
          AND District_Name IS NULL AND Town_Name IS NULL THEN 4
      END,
      CASE
        WHEN Area = #{area} THEN 1
        WHEN Area IS NULL THEN 2
      END,
      CASE
        WHEN Management_Company = #{managementCompany} THEN 1
        WHEN Management_Company IS NULL THEN 2
      END,
      CASE
        WHEN scene_type_id = #{sceneTypeId} THEN 1
        WHEN scene_type_id IS NULL THEN 2
      END
    LIMIT 1;
  </select>
</mapper>
src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
@@ -155,7 +155,7 @@
    @Test
    fun foo11(){
        val s = DateUtil.getStartMonthByPeriod(5, 12)
        val s = "02".toInt()
        println(s)
    }
}