From b77a69357da82a965cd63e76e8ceaf625ec4009b Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 15 七月 2021 16:37:47 +0800
Subject: [PATCH] 1. 新增信访信息获取接口 2. 新增用电量信息获取接口 3. 新增风险评估结果接口 4. 新增污染权重实时分析接口

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/CompanyServiceImpl.kt |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/CompanyServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/CompanyServiceImpl.kt
index 9dab0f0..5e5da20 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/CompanyServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/CompanyServiceImpl.kt
@@ -1,9 +1,11 @@
 package com.flightfeather.uav.lightshare.service.impl
 
+import com.flightfeather.uav.domain.entity.Assessment
 import com.flightfeather.uav.domain.entity.Company
+import com.flightfeather.uav.domain.mapper.AssessmentMapper
 import com.flightfeather.uav.domain.mapper.CompanyMapper
-import com.flightfeather.uav.lightshare.bean.BaseResponse
-import com.flightfeather.uav.lightshare.bean.CompanySOP
+import com.flightfeather.uav.domain.mapper.ComplaintMapper
+import com.flightfeather.uav.lightshare.bean.*
 import com.flightfeather.uav.lightshare.service.CompanyService
 import com.flightfeather.uav.lightshare.service.RealTimeDataService
 import com.flightfeather.uav.model.BaseModel
@@ -14,7 +16,11 @@
 
 @Service
 class CompanyServiceImpl(
-    private val companyMapper: CompanyMapper, private val realTimeDataService: RealTimeDataService) : CompanyService {
+    private val companyMapper: CompanyMapper,
+    private val realTimeDataService: RealTimeDataService,
+    private val complaintMapper: ComplaintMapper,
+    private val assessmentMapper: AssessmentMapper
+) : CompanyService {
 
 
     override fun getCompanyInfo(): BaseResponse<List<Company>> {
@@ -63,6 +69,15 @@
                     totalPage = head?.totalPage ?: 0
                 }
                 val dataList = data?: emptyList()
+
+                // FIXME: 2021/7/13 姝ゅ涓轰簡娴嬭瘯鏆傛椂灏嗙珯鐐圭粡绾害鍐欐锛屽悗缁�氳繃鏁版嵁搴撻厤缃幏鍙� 
+                dataList.forEach {
+                    if (it.lng == 0.0 && it.lat == 0.0) {
+                        it.lng = 121.235813
+                        it.lat = 30.835898
+                    }
+                }
+                
                 epwModel.execute(dataList, companySOPList, true)
                 page++
             }
@@ -70,4 +85,20 @@
         val r = epwModel.outputResult()
         return BaseResponse(true, data = r)
     }
+
+    override fun getComplaintInfo(): BaseResponse<List<ComplaintVo>> {
+        val map = mutableMapOf<String, ComplaintVo>()
+        complaintMapper.getComplaintInfo().apply { percent() }.forEach {
+            if (!map.containsKey(it.ciGuid)) {
+                map[it.ciGuid] = ComplaintVo(it.ciGuid, it.ciName, it.ciLng.toDouble(), it.ciLat.toDouble(), it.ciIndex.toIntOrNull() ?: 0, it.ciAddress)
+            }
+            map[it.ciGuid]?.result?.add(ComplaintType(it.coType, it.coTypeName, it.count.toInt(), it.percent))
+        }
+        return BaseResponse(true, data = map.values.toList())
+    }
+
+    override fun getAssessment(): BaseResponse<List<AssessmentVo>> {
+        val result = assessmentMapper.getAssessment()
+        return BaseResponse(true, data = result)
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3