1. 新增静安50分制评估结果转换逻辑;
2. 新增根据坐标圆心和半径查询范围内场景逻辑;
| | |
| | | * æ ¹æ®èªå¨è¯åç»æè¿è¡è½¬æ¢å¾åº |
| | | */ |
| | | @Component |
| | | class JAScore { |
| | | class JAScore(private val scoreMapper: ScoreMapper) { |
| | | |
| | | @Autowired |
| | | lateinit var scoreMapper: ScoreMapper |
| | | |
| | | fun toDb(e: Evaluation, info: Info) { |
| | | fun toDb(e: Evaluation, isEnable: Boolean) { |
| | | val time = LocalDateTime.ofInstant(e.evaluatetime?.toInstant(), ZoneId.systemDefault()) |
| | | val scoreVo = Score().apply { |
| | | sceneId = e.sguid |
| | |
| | | districtCode = e.districtcode |
| | | districtName = e.districtname |
| | | score = transform(e.resultscorebef?.toIntOrNull() ?: 0) |
| | | completion = !info.online |
| | | completion = !isEnable |
| | | } |
| | | |
| | | val res = scoreMapper.selectByExample(Example(Score::class.java).apply { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.bgtask |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.score.construction.JAScore |
| | | import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl |
| | | import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * éå®åº50åå¶è¯å转æ¢ä»»å¡ |
| | | */ |
| | | @Component |
| | | class JingAnScoreTaskCtrl( |
| | | private val backgroundTaskCtrl: BackgroundTaskCtrl, |
| | | private val jaScore: JAScore, |
| | | private val evaluationRep: EvaluationRep |
| | | ) { |
| | | |
| | | /** |
| | | * éå®å·¥å°åæ°è½¬æ¢ä»»å¡ |
| | | */ |
| | | fun startTaskJingAn(startTime: LocalDateTime) { |
| | | startTask("31", "3100", "310106", startTime) |
| | | } |
| | | |
| | | fun startTask(pCode: String, cCode: String, dCode: String, startTime: LocalDateTime) { |
| | | val areaVo = AreaVo().apply { |
| | | provincecode = pCode |
| | | citycode = cCode |
| | | districtcode = dCode |
| | | starttime = startTime |
| | | scensetypeid = "1" |
| | | } |
| | | evaluationRep.findAutoScore(areaVo)?.forEach { |
| | | it?.let { |
| | | it.evaluation?.let { e-> jaScore.toDb(e, it.isEnable) } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Scense |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper |
| | | import org.springframework.stereotype.Component |
| | | import tk.mybatis.mapper.entity.Example |
| | | import kotlin.math.PI |
| | | |
| | | /** |
| | | * 路段å¨è¾¹æ¥è¯¢ |
| | | */ |
| | | @Component |
| | | class LocationRoadNearby(private val scenseMapper: ScenseMapper) { |
| | | |
| | | private val utilFile = UtilFile() |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå¿åå徿¥è¯¢èå´å
çæµç¹ï¼å½åç®åæä½ï¼æ¹ä¸ºä»¥ç´å¾ä¸ºè¾¹é¿çæ£æ¹å½¢èå´ï¼ |
| | | * @param center åå¿ |
| | | * @param radius åå¾ï¼åä½ï¼ç±³ï¼ |
| | | * @return åºæ¯å表 |
| | | */ |
| | | fun searchByRadius(center: Pair<Double, Double>, radius: Double): List<Scense> { |
| | | // æ±ç»åº¦çæå°å¼ |
| | | val minLng = CoordinateUtil.getPointByLen(center, radius, PI * 1.5).first |
| | | // æ±ç»åº¦çæå¤§å¼ |
| | | val maxLng = CoordinateUtil.getPointByLen(center, radius, PI * 0.5).first |
| | | // æ±çº¬åº¦çæå°å¼ |
| | | val minLat = CoordinateUtil.getPointByLen(center, radius, PI).second |
| | | // æ±çº¬åº¦çæå¤§å¼ |
| | | val maxLat = CoordinateUtil.getPointByLen(center, radius, .0).second |
| | | |
| | | val list = listOf(minLng, maxLng, minLat, maxLat) |
| | | return getSceneFromDb(list) |
| | | } |
| | | |
| | | /** |
| | | * èå´éå® |
| | | * æ ¹æ®è·¯æ®µçå§æ«ç¹åæ åæ¥è¯¢åå¾ï¼è®¡ç®æå¤§å¯è½çèå´ç©å½¢ï¼å¾åºç»çº¬åº¦çæå¤§æå°å¼ |
| | | */ |
| | |
| | | .orIsNull("extension1")) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * ç²¾ç¡®è®¡ç® |
| | | */ |
| | | // private fun checkDistance(scense: Scense):Boolean { |
| | | // |
| | | // } |
| | | } |
| | |
| | | fun updateSceneDetail(typeId: Int, sceneDetailStr: SceneDetailStr): BaseResponse<String> |
| | | |
| | | fun searchScene(areaVo: AreaVo, page: Int?, perPage: Int?): BaseResponse<List<Scense>> |
| | | |
| | | fun searchByCoordinate(lng: Double, lat: Double, radius: Double): List<Scense> |
| | | } |
| | |
| | | val p = "$filePath/autoscore/" |
| | | val file = File(p + fileName) |
| | | if (config.forceUpdate || !file.exists()) { |
| | | val downloadUrl = "/autoscore/${fileName}" |
| | | reportTaskCtrl.startTask(t, downloadUrl) |
| | | // val downloadUrl = "/autoscore/${fileName}" |
| | | // reportTaskCtrl.startTask(t, downloadUrl) |
| | | return false |
| | | } else { |
| | | val fName = Base64.getEncoder().encodeToString(fileName.toByteArray()) |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.business.location.LocationRoadNearby |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.* |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.lightshare.service.* |
| | | import cn.flightfeather.supervision.lightshare.vo.* |
| | | import com.github.pagehelper.PageHelper |
| | |
| | | |
| | | @Service |
| | | class ScenseServiceImpl( |
| | | val scenseMapper: ScenseMapper, |
| | | val sceneConstructionSiteMapper: SceneConstructionSiteMapper, |
| | | val sceneDeviceMapper: SceneDeviceMapper, |
| | | val sceneMixingPlantMapper: SceneMixingPlantMapper, |
| | | val sceneStorageYardMapper: SceneStorageYardMapper, |
| | | val sceneWharfMapper: SceneWharfMapper, |
| | | val userinfoService: UserinfoService |
| | | val scenseMapper: ScenseMapper, |
| | | val sceneConstructionSiteMapper: SceneConstructionSiteMapper, |
| | | val sceneDeviceMapper: SceneDeviceMapper, |
| | | val sceneMixingPlantMapper: SceneMixingPlantMapper, |
| | | val sceneStorageYardMapper: SceneStorageYardMapper, |
| | | val sceneWharfMapper: SceneWharfMapper, |
| | | val userinfoService: UserinfoService, |
| | | private val locationRoadNearby: LocationRoadNearby, |
| | | ) : ScenseService { |
| | | |
| | | @Autowired |
| | |
| | | }) |
| | | return BaseResponse(true, head = DataHead(p.pageNum, p.pages, p.total), data = list) |
| | | } |
| | | |
| | | override fun searchByCoordinate(lng: Double, lat: Double, radius: Double): List<Scense> { |
| | | return locationRoadNearby.searchByRadius(Pair(lng, lat), radius) |
| | | } |
| | | } |
| | |
| | | class AutoScoreResultVo { |
| | | var userId: String? = null |
| | | var userName: String? = null |
| | | var isEnable: Boolean = true |
| | | var sceneId: String? = null |
| | | var sceneName: String? = null |
| | | var pName: String? = null |
| | |
| | | @RequestParam("per_page", required = false) perPage: Int? |
| | | ) = scenseService.searchScene(areaVo, page, perPage) |
| | | |
| | | @ApiOperation(value = "æ ¹æ®åå¿åå徿¾å°èå´å
çåºæ¯") |
| | | @PostMapping("/find/coor") |
| | | fun searchByCoordinate( |
| | | @RequestParam("lng") lng: Double, |
| | | @RequestParam("lat") lat: Double, |
| | | @RequestParam("radius") radius: Double, |
| | | ) = resPack { scenseService.searchByCoordinate(lng, lat, radius) } |
| | | } |
| | |
| | | <resultMap id="AutoScoreResultMap" type="cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo"> |
| | | <result column="userId" jdbcType="VARCHAR" property="userId"/> |
| | | <result column="userName" jdbcType="VARCHAR" property="userName"/> |
| | | <result column="isEnable" jdbcType="BIT" property="isEnable"/> |
| | | <result column="sceneId" jdbcType="VARCHAR" property="sceneId"/> |
| | | <result column="sceneName" jdbcType="VARCHAR" property="sceneName"/> |
| | | <result column="pName" jdbcType="VARCHAR" property="pName"/> |
| | |
| | | SELECT |
| | | c.UI_GUID AS userId, |
| | | c.UI_RealName AS userName, |
| | | c.UI_IsEnable AS isEnable, |
| | | b.S_GUID AS sceneId, |
| | | b.S_Name AS sceneName, |
| | | b.S_ProvinceName AS pName, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.bgtask |
| | | |
| | | import org.junit.Test |
| | | import org.junit.jupiter.api.Assertions.* |
| | | 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 JingAnScoreTaskCtrlTest() { |
| | | @Autowired |
| | | lateinit var jingAnScoreTaskCtrl: JingAnScoreTaskCtrl |
| | | |
| | | @Test |
| | | fun startTask() { |
| | | var time = LocalDateTime.of(2023, 10, 1, 0, 0, 0) |
| | | repeat(4) { |
| | | jingAnScoreTaskCtrl.startTaskJingAn(time) |
| | | time = time.plusMonths(1) |
| | | } |
| | | } |
| | | } |