src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/DataProductMapper.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProductServiceImpl.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProductController.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/kotlin/cn/flightfeather/supervision/model/dataproduct/PPListProbRecurrence.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/kotlin/cn/flightfeather/supervision/model/dataproduct/PPListProblemChange.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/ds1/DataProductMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/test/kotlin/cn/flightfeather/supervision/lightshare/web/DataProductControllerTest.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt
@@ -6,7 +6,7 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource import org.springframework.web.filter.CorsFilter //@Configuration @Configuration class CorsConfig { private fun buildConfig(): CorsConfiguration { @@ -18,7 +18,7 @@ } } // @Bean @Bean fun corsFilter(): CorsFilter { val source = UrlBasedCorsConfigurationSource().apply { registerCorsConfiguration("/**", buildConfig()) src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/DataProductMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package cn.flightfeather.supervision.domain.ds1.mapper import cn.flightfeather.supervision.model.dataproduct.DataProdOption import cn.flightfeather.supervision.model.dataproduct.PPListProblemChange import org.apache.ibatis.annotations.Mapper /** * * @date 2025/7/31 * @author feiyu02 */ @Mapper interface DataProductMapper { fun problemChangeList(option: DataProdOption): List<PPListProblemChange> } src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProductServiceImpl.kt
@@ -7,6 +7,7 @@ import cn.flightfeather.supervision.business.report.file.ReportThree import cn.flightfeather.supervision.business.report.file.ReportTwo import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.mapper.DataProductMapper import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.DataProductService import cn.flightfeather.supervision.lightshare.vo.AreaVo @@ -14,6 +15,7 @@ import cn.flightfeather.supervision.model.dataproduct.DataProdOption import cn.flightfeather.supervision.model.dataproduct.PPListProbRecurrence import cn.flightfeather.supervision.model.dataproduct.PPListProblemChange import org.springframework.beans.BeanUtils import org.springframework.beans.factory.annotation.Value import org.springframework.http.HttpHeaders import org.springframework.http.MediaType @@ -33,6 +35,7 @@ private val dbMapper: DbMapper, @Value("\${filePath}") private val filePath: String, private val reportTaskCtrl: ReportTaskCtrl, private val dataProductMapper: DataProductMapper, ) : DataProductService { override fun downloadProduct( @@ -83,10 +86,30 @@ } override fun problemChangeList(option: DataProdOption): List<PPListProblemChange> { TODO("Not yet implemented") return dataProductMapper.problemChangeList(option) } override fun problemRecurrence(option: DataProdOption): List<PPListProbRecurrence> { TODO("Not yet implemented") val res = mutableListOf<PPListProbRecurrence>() problemChangeList(option).forEach {pcl -> val r = res.find { it.sceneName == pcl.sceneName && it.problemName == pcl.problemName } if (r == null) { val probRec = PPListProbRecurrence() BeanUtils.copyProperties(pcl, probRec) probRec.apply { proNum = 1 changeNum += pcl.changeSum } res.add(probRec) } else { r.apply { proNum++ changeNum += pcl.changeSum } } } return res } } src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProductController.kt
@@ -3,6 +3,7 @@ import cn.flightfeather.supervision.lightshare.service.DataProductService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo import cn.flightfeather.supervision.model.dataproduct.DataProdOption import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam @@ -29,4 +30,16 @@ @ApiParam("æ¯å¦å¼ºå¶çææ°çæ¥å") @RequestParam forceUpdate: Boolean, @ApiIgnore response: HttpServletResponse, ) = resPack { dataProductService.downloadProduct(areaVo, type, forceUpdate, response) } @ApiOperation(value = "è·åé®é¢æ´æ¹æ¸ å") @PostMapping("/problemChange") fun problemChangeList( @ApiParam("æ¥è¯¢æ¡ä»¶") @RequestBody option: DataProdOption, ) = resPack { dataProductService.problemChangeList(option) } @ApiOperation(value = "è·åé®é¢å¤åæ åµ") @PostMapping("/problemRecurrence") fun problemRecurrence( @ApiParam("æ¥è¯¢æ¡ä»¶") @RequestBody option: DataProdOption, ) = resPack { dataProductService.problemRecurrence(option) } } src/main/kotlin/cn/flightfeather/supervision/model/dataproduct/PPListProbRecurrence.kt
@@ -1,7 +1,5 @@ package cn.flightfeather.supervision.model.dataproduct import cn.flightfeather.supervision.domain.ds1.entity.Scense /** * åçº§æ°æ®äº§å * é®é¢å¤åæ åµ @@ -10,33 +8,22 @@ */ class PPListProbRecurrence { /** * åºæ¯ä¿¡æ¯ */ var scene: Scense? = null /** * é®é¢ç±»åid */ var ptGuid: String? = null /** * é®é¢ç±»ååç§° */ var pTName: String? = null /** * é®é¢åç§° */ // åºæ¯å¯ä¸ç¼å· var index: Int? = null // åºæ¯åç§° var sceneName: String? = null // åºæ¯ç±»å var sceneType: String? = null var provinceName: String? = null var cityName: String? = null var districtName: String? = null var townName: String? = null // é®é¢ç±»å var problemType: String? = null // é®é¢åç§° var problemName: String? = null /** * é®é¢æ° */ // é®é¢æ° var proNum: Int = 0 /** * æ´æ¹æ° */ // æ´æ¹æ° var changeNum: Int = 0 } src/main/kotlin/cn/flightfeather/supervision/model/dataproduct/PPListProblemChange.kt
@@ -1,9 +1,7 @@ package cn.flightfeather.supervision.model.dataproduct import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import cn.flightfeather.supervision.domain.ds1.entity.Problemtype import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.entity.Subtask import java.util.* /** * åçº§æ°æ®äº§å @@ -13,23 +11,28 @@ */ class PPListProblemChange { /** * é®é¢ä¿¡æ¯ */ var problem: Problemlist? = null /** * åºæ¯ä¿¡æ¯ */ var scene: Scense? = null /** * å·¡æ¥ä¿¡æ¯ */ var subTask: Subtask? = null /** * é®é¢ç±»å */ var problemType: Problemtype? = null // åºæ¯å¯ä¸ç¼å· var index: Int? = null // åºæ¯åç§° var sceneName: String? = null // åºæ¯ç±»å var sceneType: String? = null var provinceName: String? = null var cityName: String? = null var districtName: String? = null var townName: String? = null // å·¡æ¥æ¶é´ var inspectionTime: Date? = null // é®é¢ç±»å var problemType: String? = null // é®é¢åç§° var problemName: String? = null // é®é¢åºå var location: String? = null var problemTime: Date? = null // é®é¢æ¯å¦æ´æ¹ var hasChanged: Boolean = false // æ´æ¹æ° var changeSum: Int = 0 var changedTime: Date? = null } src/main/resources/mapper/ds1/DataProductMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,79 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.DataProductMapper"> <!-- è¡æ¿åºåæ¡ä»¶ --> <sql id="Where_Area"> <if test="provinceCode != null"> AND ${pCode} = #{provinceCode} </if> <if test="cityCode != null"> AND ${cCode} = #{cityCode} </if> <if test="districtCode != null"> AND ${dCode} = #{districtCode} </if> <if test="townCode != null"> AND ${tCode} = #{townCode} </if> </sql> <!-- æ¶é´æ¡ä»¶ --> <sql id="Where_Time"> <if test="startTime != null"> AND ${sTime} >= #{startTime} </if> <if test="endTime != null"> AND ${eTime} <= #{endTime} </if> </sql> <!-- åºæ¯ä¿¡æ¯æ¡ä»¶ --> <sql id="Where_Scene"> <if test="sceneId != null"> AND ${sId} = #{sceneId} </if> <if test="sceneTypeId != null"> AND ${typeId} = #{sceneTypeId} </if> </sql> <!-- æ¥è¯¢é®é¢æ´æ¹æ¸ å--> <select id="problemChangeList" resultType="cn.flightfeather.supervision.model.dataproduct.PPListProblemChange"> SELECT b.S_Index as `index`, a.PL_SenseName as sceneName, b.S_Type as sceneType, b.S_ProvinceName as provinceName, b.S_CityName as cityName, b.S_DistrictName as districtName, b.S_TownName as townName, c.ST_PlanStartTime as inspectionTime, d.PT_TypeName as problemType, d.PT_Name as problemName, a.PL_Location as location, a.PL_Time as problemTime, a.PL_IsChanged as hasChanged, a.PL_IsChanged as changeSum, a.PL_ChangedTime as changedTime FROM im_t_problemlist AS a LEFT JOIN sm_t_scense AS b ON a.S_GUID = b.S_GUID LEFT JOIN tm_t_subtask as c on a.ST_GUID = c.ST_GUID LEFT JOIN sm_t_problemtype as d on a.PT_GUID = d.PT_GUID <where> <include refid="Where_Area"> <property name="pCode" value="b.S_ProvinceCode"/> <property name="cCode" value="b.S_CityCode"/> <property name="dCode" value="b.S_DistrictCode"/> <property name="tCode" value="b.S_TownCode"/> </include> <include refid="Where_Time"> <property name="sTime" value="a.PL_Time"/> <property name="eTime" value="a.PL_Time"/> </include> <include refid="Where_Scene"> <property name="sId" value="b.S_GUID"/> <property name="typeId" value="b.S_TypeID"/> </include> </where> ORDER BY a.PL_SenseName, c.ST_PlanStartTime, d.PT_TypeName, a.PL_Time ASC </select> </mapper> src/test/kotlin/cn/flightfeather/supervision/lightshare/web/DataProductControllerTest.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,46 @@ package cn.flightfeather.supervision.lightshare.web import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.lightshare.service.DataProductService import cn.flightfeather.supervision.model.dataproduct.DataProdOption import org.junit.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.runner.RunWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.junit.jupiter.SpringExtension import org.springframework.test.context.junit4.SpringRunner import java.time.LocalDateTime @RunWith(SpringRunner::class) @ExtendWith(SpringExtension::class) @SpringBootTest class DataProductControllerTest { @Autowired lateinit var dataProductController: DataProductController @Autowired lateinit var dataProductService: DataProductService private val option = DataProdOption().apply { provinceCode = "31" cityCode = "3100" districtCode = "310106" townCode startTime = LocalDateTime.of(2025, 1, 1, 0, 0, 0) endTime = LocalDateTime.of(2025, 7, 31, 23, 59, 59) sceneId sceneTypeId = Constant.SceneType.TYPE1.value.toInt() } @Test fun problemChangeList() { val result = dataProductService.problemChangeList(option) println(result) } @Test fun problemRecurrence() { } }