From 30a53b41f09d2eefd33513a409d472c2166ba1ea Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 10 一月 2024 17:35:03 +0800 Subject: [PATCH] 1. 新增自动评估相关数据源的检查接口 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ComplaintController.kt | 22 + src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt | 26 + src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml | 15 - src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt | 3 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt | 31 ++ src/main/resources/mapper/ds2/ComplaintMapper.xml | 21 + src/main/resources/mapper/ds2/PunishmentMapper.xml | 21 + src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/PunishmentMapper.kt | 8 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluateResVo.kt | 11 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt | 21 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ComplaintVo.kt | 11 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/PunishmentVo.kt | 11 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt | 27 + src/main/resources/mapper/ds1/ScenseMapper.xml | 15 + src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt | 21 + src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt | 77 +++++ src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt | 26 + src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt | 47 ++ src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt | 8 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt | 75 +++++ src/main/kotlin/cn/flightfeather/supervision/common/utils/DateUtil.kt | 2 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt | 26 + src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt | 10 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt | 10 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt | 50 +++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ComplaintService.kt | 14 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/ComplaintMapper.kt | 10 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt | 5 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt | 9 /dev/null | 41 -- src/main/resources/mapper/ds2/UserMapMapper.xml | 3 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt | 9 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt | 58 +++ src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt | 8 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt | 26 - src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt | 4 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/UserMap.java | 18 + src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 3 src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 41 ++ 39 files changed, 727 insertions(+), 117 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt new file mode 100644 index 0000000..18706fb --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt @@ -0,0 +1,75 @@ +package cn.flightfeather.supervision.business.autooutput.dataanalysis + +import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.domain.ds2.repository.JADustSiteMapRep +import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteMapRep +import cn.flightfeather.supervision.domain.ds3.repository.XHFumeSiteMapRep +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import org.springframework.stereotype.Component + +/** + * 鐩戞祴鏁版嵁鍜岀郴缁熺敤鎴风殑鏄犲皠绠$悊 + */ +@Component +class AopDataDeviceMap( + private val jaDustSiteMapRep: JADustSiteMapRep, + private val jsDustSiteMapRep: JSDustSiteMapRep, + private val xhFumeSiteMapRep: XHFumeSiteMapRep, +) { + + /** + * 鑾峰彇鍖哄煙鏉′欢涓嬬殑璁惧鍜岀敤鎴风殑鏄犲皠鍏崇郴 + */ + fun findMapSet(areaVo: AreaVo, userIdList: List<String?>): List<DeviceMapVo> { + return when (areaVo.sourceType) { + //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋 + 1 -> find1(areaVo, userIdList) + //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋 + 2 -> find2(areaVo, userIdList) + else -> emptyList() + } + } + + private fun find1(areaVo: AreaVo, userIdList: List<String?>): List<DeviceMapVo> { + return when (areaVo.districtcode) { + //寰愭眹鍖� + "310104" -> { + when (areaVo.scensetypeid) { + //姹戒慨 + Constant.SceneTypeTZ.VehicleRepair.value.toString() -> emptyList() + else -> emptyList() + } + } + else -> emptyList() + } + } + + private fun find2(areaVo: AreaVo, userIdList: List<String?>): List<DeviceMapVo> { + return when (areaVo.districtcode) { + //闈欏畨鍖� + "310106" -> when (areaVo.scensetypeid) { + //宸ュ湴 + Constant.SceneType.TYPE1.value -> jaDustSiteMapRep.findBySVUserId(userIdList) + else -> emptyList() + } + //閲戝北鍖� + "310116" -> when (areaVo.scensetypeid) { + //宸ュ湴,鐮佸ご姘存偿鎼呮媽绔� + Constant.SceneType.TYPE1.value, + Constant.SceneType.TYPE2.value, + Constant.SceneType.TYPE3.value, + -> jsDustSiteMapRep.findBySVUserId(userIdList) + else -> emptyList() + } + //寰愭眹鍖� + "310104" -> when (areaVo.scensetypeid) { + //椁愰ギ + Constant.SceneType.TYPE5.value -> xhFumeSiteMapRep.findBySVUserId(userIdList) + else -> emptyList() + } + else -> emptyList() + + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt index 088061b..20fcc11 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt @@ -90,12 +90,8 @@ this.mode = 0 sceneSourceList.clear() val taskSceneIdList = - aopDbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) - - aopDbMapper.scenseMapper.selectByExample(Example(Scense::class.java).apply { - createCriteria() - .andIn("guid", taskSceneIdList) - })?.let { sceneSourceList.addAll(it) } + aopDbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) + sceneSourceList.addAll(taskSceneIdList) } // 浠庡彴璐︾郴缁熻幏鍙栧満鏅� diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt index 65594e6..063368b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt @@ -110,7 +110,8 @@ } }) } else { - taskSceneIdList = dbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode) + taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config + .sceneType, config.townCode).map { it.guid ?: "" } dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { createCriteria().andIn("scenseid", taskSceneIdList) .andEqualTo("tguid", config.topTaskGuid) diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt index bc73931..3068925 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt @@ -85,6 +85,47 @@ } } + enum class SceneTypeTZ(val value: Int, val des: String) { + NoType(0, "鏃犵被鍨�"), + Restaurant(1, "椁愰ギ"), + Construction(2, "宸ュ湴"), + Wharf(3, "鐮佸ご"), + StorageYard(4, "鍫嗗満"), + MixingPlant(5, "鎼呮媽绔�"), + Industrial(6, "宸ヤ笟浼佷笟"), + VehicleRepair(7, "姹戒慨"), + Laboratory(8, "瀹為獙瀹�"), + MedicalInstitution(9, "鍖荤枟鏈烘瀯"); + + companion object { + fun getNameByValue(value: Int?): String = when (value) { + 0 -> NoType.des + 1 -> Restaurant.des + 2 -> Construction.des + 3 -> Wharf.des + 4 -> StorageYard.des + 5 -> MixingPlant.des + 6 -> Industrial.des + 7 -> VehicleRepair.des + 8 -> Laboratory.des + 9 -> MedicalInstitution.des + else -> NoType.des + } + + fun toPairList() = listOf( + Pair(Restaurant.value.toString(), Restaurant.des), + Pair(Construction.value.toString(), Construction.des), + Pair(Wharf.value.toString(), Wharf.des), + Pair(StorageYard.value.toString(), StorageYard.des), + Pair(MixingPlant.value.toString(), MixingPlant.des), + Pair(Industrial.value.toString(), Industrial.des), + Pair(VehicleRepair.value.toString(), VehicleRepair.des), + Pair(Laboratory.value.toString(), Laboratory.des), + Pair(MedicalInstitution.value.toString(), MedicalInstitution.des), + ) + } + } + companion object { //闂瀹℃牳 const val PROBLEM_CHECK_PASS = "pass"//闂瀹℃牳閫氳繃 diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/DateUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/DateUtil.kt index 2584613..b520fc8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/DateUtil.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/DateUtil.kt @@ -1,10 +1,12 @@ package cn.flightfeather.supervision.common.utils +import org.springframework.stereotype.Component import java.sql.Timestamp import java.text.ParsePosition import java.text.SimpleDateFormat import java.util.* +@Component class DateUtil { private val threadLocal = ThreadLocal<SimpleDateFormat>() diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt index a018b4d..894e37c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt @@ -1,14 +1,10 @@ package cn.flightfeather.supervision.domain.ds1.mapper import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion +import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.util.MyMapper import org.apache.ibatis.annotations.Mapper import org.apache.ibatis.annotations.Select @Mapper -interface MonitorobjectversionMapper:MyMapper<Monitorobjectversion> { - - // @Select("select b.S_GUID from sm_t_monitorobjectversion as a left join sm_t_scense as b on a.S_GUID = b.S_GUID" + -// " where a.T_ID = #{param1} and b.S_TypeID = #{param2}") - fun getSceneByType(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<String> -} \ No newline at end of file +interface MonitorobjectversionMapper:MyMapper<Monitorobjectversion> \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt index ec2e823..a576989 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt @@ -8,5 +8,10 @@ @Mapper interface ScenseMapper:MyMapper<Scense>, MutableList<Scense> { + /** + * 鑾峰彇鏈垱寤虹敤鎴风殑鍦烘櫙 + */ fun selectNoAccountScene(): List<Scense> + + fun getSceneByType(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt new file mode 100644 index 0000000..b47f19a --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt @@ -0,0 +1,21 @@ +package cn.flightfeather.supervision.domain.ds1.repository + +import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper +import org.springframework.stereotype.Repository + +/** + * 鍦烘櫙淇℃伅鏁版嵁搴撶浉鍏虫搷浣� + */ +@Repository +class SceneRep( + private val scenseMapper: ScenseMapper, +) { + + /** + * 鏌ユ壘鍦烘櫙 + */ + fun findScene(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> { + return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt new file mode 100644 index 0000000..a3ea0a8 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt @@ -0,0 +1,31 @@ +package cn.flightfeather.supervision.domain.ds1.repository + +import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds1.entity.Userinfo +import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 椋炵窘鐩戠鐢ㄦ埛淇℃伅鏁版嵁搴撶浉鍏虫搷浣� + */ +@Repository +class UserInfoSVRep( + private val userinfoMapper: UserinfoMapper, +) { + + /** + * 鏌ユ壘鍦烘櫙 + */ + fun findUser(sceneIdList: List<String?>): List<Userinfo?> { + return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { + createCriteria().andIn("dGuid", sceneIdList) + }) + } + + fun findUser(sceneId: String): List<Userinfo?> { + return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { + createCriteria().andEqualTo("dGuid", sceneId) + }) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/UserMap.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/UserMap.java index ec27c8c..02a4ac8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/UserMap.java +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/UserMap.java @@ -3,6 +3,7 @@ import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.Table; +import java.util.Date; @Table(name = "ts_t_user_map") public class UserMap { @@ -30,6 +31,9 @@ */ @Column(name = "SV_User_Name") private String svUserName; + + @Column(name = "UM_Create_Time") + private Date umCreateTime; /** * 鑾峰彇椋炵窘鐜鐢ㄦ埛id @@ -102,4 +106,18 @@ public void setSvUserName(String svUserName) { this.svUserName = svUserName == null ? null : svUserName.trim(); } + + /** + * @return UM_Create_Time + */ + public Date getUmCreateTime() { + return umCreateTime; + } + + /** + * @param umCreateTime + */ + public void setUmCreateTime(Date umCreateTime) { + this.umCreateTime = umCreateTime; + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/ComplaintMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/ComplaintMapper.kt index 35ee58d..d918ecd 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/ComplaintMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/ComplaintMapper.kt @@ -2,7 +2,15 @@ import cn.flightfeather.supervision.domain.ds2.entity.Complaint import cn.flightfeather.supervision.domain.util.MyMapper +import cn.flightfeather.supervision.lightshare.vo.ComplaintVo import org.apache.ibatis.annotations.Mapper +import java.util.* @Mapper -interface ComplaintMapper : MyMapper<Complaint> \ No newline at end of file +interface ComplaintMapper : MyMapper<Complaint> { + + /** + * + */ + fun findComplaint(tzUserIdList: List<String?>, sTime: String?, eTime: String?): List<ComplaintVo?> +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/PunishmentMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/PunishmentMapper.kt index 078ade7..7fb4da0 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/PunishmentMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/PunishmentMapper.kt @@ -2,7 +2,13 @@ import cn.flightfeather.supervision.domain.ds2.entity.Punishment import cn.flightfeather.supervision.domain.util.MyMapper +import cn.flightfeather.supervision.lightshare.vo.ComplaintVo +import cn.flightfeather.supervision.lightshare.vo.PunishmentVo import org.apache.ibatis.annotations.Mapper +import java.util.* @Mapper -interface PunishmentMapper : MyMapper<Punishment> \ No newline at end of file +interface PunishmentMapper : MyMapper<Punishment> { + + fun findPunishment(tzUserIdList: List<String?>, sTime: String?, eTime: String?): List<PunishmentVo?> +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt new file mode 100644 index 0000000..3c60c11 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt @@ -0,0 +1,50 @@ +package cn.flightfeather.supervision.domain.ds2.repository + +import cn.flightfeather.supervision.common.utils.DateUtil +import cn.flightfeather.supervision.domain.ds2.mapper.ComplaintMapper +import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper +import cn.flightfeather.supervision.lightshare.vo.ComplaintVo +import cn.flightfeather.supervision.lightshare.vo.PunishmentVo +import org.springframework.stereotype.Repository +import java.util.* + +/** + * 淇¤鎶曡瘔鍜岃鏀垮缃氭暟鎹簱鐩稿叧鎿嶄綔 + */ +@Repository +class ComplaintAndPunishmentRep( + private val complaintMapper: ComplaintMapper, + private val punishmentMapper: PunishmentMapper, + private val dateUtil: DateUtil, +){ + + + + /** + * 鏌ヨ淇¤鎶曡瘔 + * @param tzUserIdList 椋炵窘鐜绯荤粺涓嬬殑鐢ㄦ埛id鍒楄〃 + */ + fun findComplaint(tzUserIdList: List<String?>, sTime: Date?, eTime: Date?): List<ComplaintVo?> { + val s = dateUtil.DateToString(sTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) + val e = dateUtil.DateToString(eTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) + return findComplaint(tzUserIdList, s, e) + } + + fun findComplaint(tzUserIdList: List<String?>, sTime: String?, eTime: String?): List<ComplaintVo?> { + return complaintMapper.findComplaint(tzUserIdList, sTime, eTime) + } + + /** + * 鏌ヨ琛屾斂澶勭綒 + * @param tzUserIdList 椋炵窘鐜绯荤粺涓嬬殑鐢ㄦ埛id鍒楄〃 + */ + fun findPunishment(tzUserIdList: List<String?>, sTime: Date?, eTime: Date?): List<PunishmentVo?> { + val s = dateUtil.DateToString(sTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) + val e = dateUtil.DateToString(eTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) + return findPunishment(tzUserIdList, s, e) + } + + fun findPunishment(tzUserIdList: List<String?>, sTime: String?, eTime: String?): List<PunishmentVo?> { + return punishmentMapper.findPunishment(tzUserIdList, sTime, eTime) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt new file mode 100644 index 0000000..5169703 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt @@ -0,0 +1,26 @@ +package cn.flightfeather.supervision.domain.ds2.repository + +import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap +import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 闈欏畨宸ュ湴鎵皹鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔 + */ +@Repository +class JADustSiteMapRep( + private val dustSiteMapMapper: DustSiteMapMapper, +) { + + /** + * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ + */ + fun findBySVUserId(idList: List<String?>): List<DeviceMapVo> { + val res = dustSiteMapMapper.selectByExample(Example(DustSiteMap::class.java).apply { + createCriteria().andIn("svUserId", idList) + }) + return DeviceMapVo.fromJADustSiteMap(res) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt index 955ed62..f37bba9 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt @@ -17,8 +17,16 @@ */ fun findEnterpriseUser(district: String?, sceneType: Constant.SceneType): List<UserinfoTZ?> { val type = Constant.SceneType.typeMap(sceneType.value.toByte()) + return findEnterpriseUser(district, type?.toInt()) + } + + /** + * 鏌ユ壘鍦ㄧ嚎鐨勬寮忎紒涓氱敤鎴� + * @param sceneTypeTZ 椋炵窘鐜绯荤粺涓殑鍦烘櫙绫诲瀷 + */ + fun findEnterpriseUser(district: String?, sceneTypeTZ: Int?): List<UserinfoTZ?> { return userinfoTZMapper.selectByExample(Example(UserinfoTZ::class.java).apply { - createCriteria().andEqualTo("extension2", type) + createCriteria().andEqualTo("extension2", sceneTypeTZ) .andEqualTo("extension1", district) .andEqualTo("usertypeid", Constant.UserType.ENTERPRISE.value) .andEqualTo("isenable", true) diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt index 022a302..1ed3e11 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt @@ -7,6 +7,7 @@ import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example @Repository class UserMapRep( @@ -35,4 +36,13 @@ // 鎵惧埌椋炵窘鐩戠涓殑鍦烘櫙淇℃伅 return scenseMapper.selectByPrimaryKey(userInfoSp.dGuid) } + + /** + * 閫氳繃椋炵窘鐩戠鐢ㄦ埛id鏌ヨ椋炵窘鐜鐢ㄦ埛id + */ + fun findBySVUserId(idList: List<String?>): List<UserMap?> { + return userMapMapper.selectByExample(Example(UserMap::class.java).apply { + createCriteria().andIn("svUserId", idList) + }) + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt new file mode 100644 index 0000000..129364b --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt @@ -0,0 +1,26 @@ +package cn.flightfeather.supervision.domain.ds3.repository + +import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap +import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 閲戝北鎵皹鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔 + */ +@Repository +class JSDustSiteMapRep( + private val jsDustSiteMapMapper: JSDustSiteMapMapper, +) { + + /** + * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ + */ + fun findBySVUserId(idList: List<String?>): List<DeviceMapVo> { + val res = jsDustSiteMapMapper.selectByExample(Example(JSDustSiteMap::class.java).apply { + createCriteria().andIn("svUserId", idList) + }) + return DeviceMapVo.fromJSDustSiteMap(res) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt new file mode 100644 index 0000000..5fe2ed4 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/XHFumeSiteMapRep.kt @@ -0,0 +1,26 @@ +package cn.flightfeather.supervision.domain.ds3.repository + +import cn.flightfeather.supervision.domain.ds3.entity.FumeSiteMap +import cn.flightfeather.supervision.domain.ds3.mapper.FumeSiteMapMapper +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 寰愭眹娌圭儫鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔 + */ +@Repository +class XHFumeSiteMapRep( + private val fumeSiteMapMapper: FumeSiteMapMapper, +) { + + /** + * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ + */ + fun findBySVUserId(idList: List<String?>): List<DeviceMapVo> { + val res = fumeSiteMapMapper.selectByExample(Example(FumeSiteMap::class.java).apply { + createCriteria().andIn("svUserId", idList) + }) + return DeviceMapVo.fromXHFumeSiteMap(res) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/repository/TaskRepository.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/repository/TaskRepository.kt deleted file mode 100644 index bf325fc..0000000 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/repository/TaskRepository.kt +++ /dev/null @@ -1,41 +0,0 @@ -//package cn.flightfeather.supervision.lightshare.repository -// -//import cn.flightfeather.supervision.domain.ds1.entity.TaskVo -//import cn.flightfeather.supervision.lightshare.service.TaskService -//import org.springframework.stereotype.Service -//import org.springframework.web.reactive.function.server.ServerRequest -//import reactor.core.publisher.Flux -//import reactor.core.publisher.FluxSink -//import reactor.core.publisher.Mono -//import reactor.core.publisher.MonoSink -// -// -//@Service -//class TaskRepository(val taskService: TaskService) { -// fun findOne(id: String) = Mono.create { sink: MonoSink<TaskVo> -> -// taskService.findOne(id) -// } -// -// fun findAll() = Flux.create { sink: FluxSink<TaskVo> -> -// taskService.findAll().forEach({ sink.next(it) }) -// sink.complete() -// } -// -// fun save(task: TaskVo) = Mono.create { sink: MonoSink<Int> -> -// sink.success(333) -// } -// -// fun test(request: ServerRequest) = Mono.create { sink: MonoSink<Int> -> -// val task = request.bodyToMono(String::class.java) -// println(task) -// sink.success(333) -// } -// -// fun update(task: TaskVo) = Mono.create { sink: MonoSink<Int> -> -// sink.success(taskService.update(task)) -// } -// -// fun delete(id: String) = Mono.create { sink: MonoSink<Int> -> -// sink.success(taskService.delete(id)) -// } -//} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ComplaintService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ComplaintService.kt new file mode 100644 index 0000000..1164146 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ComplaintService.kt @@ -0,0 +1,14 @@ +package cn.flightfeather.supervision.lightshare.service + +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.ComplaintVo +import cn.flightfeather.supervision.lightshare.vo.PunishmentVo + +interface ComplaintService { + + // 淇¤鎶曡瘔 + fun findComplaints(areaVo: AreaVo): List<ComplaintVo?> + + // 琛屾斂澶勭綒 + fun findPunishment(areaVo: AreaVo): List<PunishmentVo?> +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt index 2f897f6..dd4b9d3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt @@ -6,6 +6,7 @@ import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo import cn.flightfeather.supervision.lightshare.vo.BaseResponse +import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo interface EvaluationService { @@ -21,7 +22,7 @@ fun getRankOfSense(tguid: String, scensetypeid: String?, ruletypeid: ByteArray?): List<Evaluation> - fun getRankOfTown(tguid: String, scensetypeid: String?):List<AreaVo> + fun getRankOfTown(tguid: String, scensetypeid: String?):List<EvaluateResVo> fun autoScore(districtCode: String, time: String): List<String> diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt index 8a0645f..a1c810c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt @@ -1,12 +1,17 @@ package cn.flightfeather.supervision.lightshare.service -import cn.flightfeather.supervision.domain.ds1.entity.Version import cn.flightfeather.supervision.domain.ds2.entity.UserMap -import org.springframework.web.multipart.MultipartFile +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo interface UserMapService { + /** + * 鏍规嵁椋炵窘鐩戠绯荤粺涓殑鍦烘櫙id锛岃幏鍙栦笌椋炵窘鐜绯荤粺涓殑鍏宠仈鐢ㄦ埛 + */ fun getTZIdBySceneId(sceneId: String): UserMap fun autoCreateMap() + + fun fetchDeviceMap(areaVo: AreaVo): List<DeviceMapVo?> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt new file mode 100644 index 0000000..f56a1a1 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt @@ -0,0 +1,58 @@ +package cn.flightfeather.supervision.lightshare.service.impl + +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep +import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep +import cn.flightfeather.supervision.domain.ds2.entity.Complaint +import cn.flightfeather.supervision.domain.ds2.entity.Punishment +import cn.flightfeather.supervision.domain.ds2.mapper.ComplaintMapper +import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper +import cn.flightfeather.supervision.domain.ds2.repository.ComplaintAndPunishmentRep +import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep +import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep +import cn.flightfeather.supervision.lightshare.service.ComplaintService +import cn.flightfeather.supervision.lightshare.service.UserinfoService +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.ComplaintVo +import cn.flightfeather.supervision.lightshare.vo.PunishmentVo +import org.springframework.stereotype.Service + +@Service +class ComplaintServiceImpl( + private val complaintAndPunishmentRep: ComplaintAndPunishmentRep, + private val sceneRep: SceneRep, + private val taskRep: TaskRep, + private val userInfoSVRep: UserInfoSVRep, + private val userInfoTZRep: UserInfoTZRep, + private val userMapRep: UserMapRep, +) : ComplaintService { + + private fun getTZUserId(areaVo: AreaVo): List<String?> { + return when (areaVo.sourceType) { + //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋 + 1 -> { + val u = userInfoTZRep.findEnterpriseUser(areaVo.districtname, areaVo.scensetypeid?.toInt()) + u.map { it?.guid } + } + //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋 + 2 -> { + val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") + val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) + .map { it?.guid } + val idList = userInfoSVRep.findUser(scenes).map { it?.guid } + userMapRep.findBySVUserId(idList).map { it?.tzUserId } + } + else -> emptyList() + } + } + + override fun findComplaints(areaVo: AreaVo): List<ComplaintVo?> { + val userIdList = getTZUserId(areaVo) + return complaintAndPunishmentRep.findComplaint(userIdList, areaVo.starttime, areaVo.endtime) + } + + override fun findPunishment(areaVo: AreaVo): List<PunishmentVo?> { + val userIdList = getTZUserId(areaVo) + return complaintAndPunishmentRep.findPunishment(userIdList, areaVo.starttime, areaVo.endtime) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt index f5fc097..b7db654 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt @@ -16,11 +16,13 @@ import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.Domain import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.EvaluationService import cn.flightfeather.supervision.lightshare.service.SubtaskService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo import cn.flightfeather.supervision.lightshare.vo.BaseResponse +import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example @@ -31,6 +33,7 @@ class EvaluationServiceImpl( private val evaluationMapper: EvaluationMapper, private val evaluationRep: EvaluationRep, + private val taskRep: TaskRep, private val aopTaskCtrl: AopTaskCtrl, ) : EvaluationService { @@ -45,9 +48,9 @@ private var isAutoScoreRunning = false //鑾峰彇鏌愰《灞備换鍔′笅鏌愪釜鍦烘櫙鐨勮閬撹瘎鍒嗘帓鍚� - override fun getRankOfTown(tguid: String, scensetypeid: String?): List<AreaVo> { + override fun getRankOfTown(tguid: String, scensetypeid: String?): List<EvaluateResVo> { val evaluationlist = getRankInfo(tguid, scensetypeid, null) - var areaVolist = mutableListOf<AreaVo>() + var areaVolist = mutableListOf<EvaluateResVo>() //鑰冩牳绫诲瀷鏄鑼冭�冩牳 if (evaluationlist.isNotEmpty() && Objects.equals(evaluationlist.get(0).ertype, Constant.RuleType.STANDARD.value)) { @@ -63,7 +66,7 @@ val iterator: MutableIterator<Evaluation> = tmplist.iterator() val evaluation = evaluationlist.get(0)//鑾峰彇涓�绉嶈闀� - var areaVo = AreaVo() + var areaVo = EvaluateResVo() areaVo = transform(areaVo, evaluation) while (iterator.hasNext()){ val tmp = iterator.next() @@ -95,7 +98,7 @@ val iterator: MutableIterator<Evaluation> = tmplist.iterator() val evaluation = evaluationlist.get(0)//鑾峰彇涓�绉嶈闀� - var areaVo = AreaVo() + var areaVo = EvaluateResVo() areaVo = transform(areaVo, evaluation) while (iterator.hasNext()){ val tmp = iterator.next() @@ -169,7 +172,7 @@ } //Evaluation浼犻�掓暟鎹粰AreaVo - fun transform(areaVo: AreaVo, evaluation: Evaluation):AreaVo{ + fun transform(areaVo: EvaluateResVo, evaluation: Evaluation):EvaluateResVo{ areaVo.provincecode = evaluation.provincecode areaVo.provincename = evaluation.provincename areaVo.citycode = evaluation.citycode @@ -182,9 +185,9 @@ } //鎸夎閬撲弗閲嶄笉瑙勮寖鍦烘櫙鐧惧垎姣旀帓搴� - fun sort(areaVolist: MutableList<AreaVo>):MutableList<AreaVo>{ - Collections.sort(areaVolist, object : Comparator<AreaVo>{ - override fun compare(o1: AreaVo?, o2: AreaVo?): Int { + fun sort(areaVolist: MutableList<EvaluateResVo>):MutableList<EvaluateResVo>{ + Collections.sort(areaVolist, object : Comparator<EvaluateResVo>{ + override fun compare(o1: EvaluateResVo?, o2: EvaluateResVo?): Int { var num1 = 0.0 if (o1!!.allsensenum != 0) num1 = (o1.notstandardnum/o1.allsensenum).toDouble() @@ -267,6 +270,8 @@ override fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>? { //1. 鏌ユ壘鍘嗗彶璁板綍锛屾煡鐪嬭瘎浼版槸鍚﹀凡瀛樺湪 + areaVo.scensetypeid ?: throw IllegalStateException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�") + val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�") return evaluationRep.findAutoScore(areaVo) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt index 97eeab2..47e7b9e 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt @@ -1,13 +1,22 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.business.autooutput.dataanalysis.AopDataDeviceMap +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.UUIDGenerator import cn.flightfeather.supervision.domain.ds1.entity.Userinfo import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep +import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep import cn.flightfeather.supervision.domain.ds2.entity.UserMap import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper +import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep import cn.flightfeather.supervision.lightshare.service.UserMapService +import cn.flightfeather.supervision.lightshare.service.UserinfoService +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example @@ -15,15 +24,18 @@ class UserMapServiceImpl( private val userMapMapper: UserMapMapper, private val userinfoMapper: UserinfoMapper, - private val userinfoTZMapper: UserinfoTZMapper - ) : UserMapService { + private val userinfoTZMapper: UserinfoTZMapper, + private val sceneRep: SceneRep, + private val taskRep: TaskRep, + private val userInfoSVRep: UserInfoSVRep, + private val userInfoTZRep: UserInfoTZRep, + private val aopDataDeviceMap: AopDataDeviceMap, +) : UserMapService { override fun getTZIdBySceneId(sceneId: String): UserMap { - val list = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { - createCriteria().andEqualTo("dGuid", sceneId) - }) + val list = userInfoSVRep.findUser(sceneId) if (list.isEmpty()) return UserMap() - val userId = list[0].guid + val userId = list[0]?.guid val result = userMapMapper.selectByExample(Example(UserMap::class.java).apply { createCriteria().andEqualTo("svUserId", userId) }) @@ -60,7 +72,7 @@ // 2銆� 鏃犳硶绮剧‘鍖归厤鐨勶紝閲囩敤榛樿鐨勭紪鍙凤紝鎻掑叆璁板綍銆傚悗缁汉宸ヤ慨鏀癸紙鏆傚畾锛� else { if (userMapMapper.selectByExample(Example(UserMap::class.java).apply { - createCriteria().andEqualTo("svUserId", it.guid) + createCriteria().andEqualTo("svUserId", it.guid) }).isEmpty()) { val id = "temp" + UUIDGenerator.generateShortUUID() userMapMapper.insert(UserMap().apply { @@ -74,4 +86,25 @@ } } } + + override fun fetchDeviceMap(areaVo: AreaVo): List<DeviceMapVo?> { + // 1.閫氳繃鍖哄煙鏉′欢鑾峰彇涓讳綋鐢ㄦ埛 + val userIdList = when (areaVo.sourceType) { + //浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋 + 1 -> { + val u = userInfoTZRep.findEnterpriseUser(areaVo.districtname, areaVo.scensetypeid?.toInt()) + u.map { it?.guid } + } + //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋 + 2 -> { + val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") + val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) + .map { it?.guid } + userInfoSVRep.findUser(scenes).map { it?.guid } + } + else -> emptyList() + } + // 2.閫氳繃鍖哄煙鏉′欢鍐冲畾鍖归厤鐨勬暟鎹潵婧� + return aopDataDeviceMap.findMapSet(areaVo, userIdList) + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt index a15ee33..cb21ee7 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt @@ -6,19 +6,29 @@ import cn.flightfeather.supervision.domain.ds1.entity.Userinfo import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep +import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep +import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep import cn.flightfeather.supervision.lightshare.service.UserinfoService +import cn.flightfeather.supervision.lightshare.vo.AreaVo import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example +import kotlin.random.Random +import kotlin.random.nextInt @Service -class UserinfoServiceImpl(val userinfoMapper: UserinfoMapper, private val scenseMapper: ScenseMapper) : UserinfoService { +class UserinfoServiceImpl( + val userinfoMapper: UserinfoMapper, + private val scenseMapper: ScenseMapper, +) : UserinfoService { //鏍规嵁userinfo鏉′欢鏌ヨ override fun findOneByName(userinfo: Userinfo): Userinfo? { val example = Example(Userinfo::class.java) val criteria = example.createCriteria() criteria.andEqualTo("acountname", userinfo.acountname) - .andEqualTo("password", userinfo.password) + .andEqualTo("password", userinfo.password) val result = userinfoMapper.selectByExample(example) return if (result.isNotEmpty()) { result[0] @@ -91,21 +101,22 @@ private fun getUName(sceneName: String): String { var uName = PinYin.getPinYinHeader(sceneName) - var repeated = false + var suffix = "" + var repeated: Boolean var i = 1 do { userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { - createCriteria().andEqualTo("acountname", uName) + createCriteria().andEqualTo("acountname", uName + suffix) }).let { repeated = it.isNotEmpty() if (repeated) { - uName += i + suffix = Random.nextInt(100..999).toString() } } i++ } while (repeated && i < 20) if (repeated) uName = UUIDGenerator.generateShortUUID() - return uName + return uName + suffix } override fun autoCreateAccount() { @@ -115,8 +126,8 @@ } } - private fun createAccount(sence: Scense) { - sence.let { + private fun createAccount(scence: Scense) { + scence.let { val sceneName = it.name ?: return val uName = getUName(sceneName) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt index 7531298..348eedc 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt @@ -2,37 +2,33 @@ import com.fasterxml.jackson.annotation.JsonInclude +/** + * 鍖哄煙鏉′欢 + */ @JsonInclude(JsonInclude.Include.NON_NULL) open class AreaVo{ - + // 琛屾斂鍖哄垝 var provincecode: String? = null - var provincename: String? = null - var citycode: String? = null - var cityname: String? = null - var districtcode: String? = null - var districtname: String? = null - var towncode: String? = null - var townname: String? = null + // 鏃堕棿鑼冨洿 var starttime: String? = null - var endtime: String? = null + // 鍦烘櫙鍚嶇О var sceneName: String? = null - + // 鍦烘櫙绫诲瀷 var scensetypeid: String? = null - var notstandardnum: Int = 0 - - var allsensenum: Int = 0 - - //鏄惁涓婄嚎 + // 鏄惁涓婄嚎 var online: Boolean? = null + + // 涓绘暟鎹簮锛�1锛氫互椋炵窘鐜绯荤粺涓殑鐢ㄦ埛涓轰富浣擄紱2锛氫互椋炵窘鐩戠绯荤粺涓殑鐢ㄦ埛涓轰富浣� + var sourceType:Int = 1 } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ComplaintVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ComplaintVo.kt new file mode 100644 index 0000000..93e2872 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ComplaintVo.kt @@ -0,0 +1,11 @@ +package cn.flightfeather.supervision.lightshare.vo + +import cn.flightfeather.supervision.domain.ds2.entity.BaseInfo +import cn.flightfeather.supervision.domain.ds2.entity.Complaint + +/** + * 淇¤鎶曡瘔 + */ +class ComplaintVo : Complaint() { + var baseInfo: BaseInfo? = null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt new file mode 100644 index 0000000..8d8c370 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt @@ -0,0 +1,77 @@ +package cn.flightfeather.supervision.lightshare.vo + +import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap +import cn.flightfeather.supervision.domain.ds3.entity.FumeSiteMap +import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap +import org.springframework.beans.BeanUtils +import java.util.* + +/** + * 鐩戞祴璁惧鍜岄缇界洃绠$郴缁熴�侀缇界幆澧冪郴缁熺敤鎴风殑鍖归厤鍏崇郴 + */ +class DeviceMapVo { + // 鐩戞祴璁惧id + var deviceCode:String?=null + // 鐩戞祴璁惧鎴栫珯鐐瑰悕绉� + var deviceName:String?=null + // 椋炵窘鐩戠绯荤粺鐢ㄦ埛id + var svUserId:String?=null + // 椋炵窘鐩戠绯荤粺鐢ㄦ埛鍚嶇О + var svUserName:String?=null + // 椋炵窘鐜绯荤粺鐢ㄦ埛id + var tzUserId:String?=null + // 椋炵窘鐜绯荤粺鐢ㄦ埛鍚嶇О + var tzUserName:String?=null + + var createTime: Date? = null + + companion object { + fun fromJADustSiteMap(list: List<DustSiteMap?>): List<DeviceMapVo> { + val res = mutableListOf<DeviceMapVo>() + list.forEach { + it ?: return@forEach + res.add(DeviceMapVo().apply { + deviceCode = it.jaMnCode + deviceName = it.jaSceneName + svUserId = it.svUserId + svUserName = it.svUserName + tzUserId = it.tzUserId + tzUserName = it.tzUserName + }) + } + return res + } + + fun fromJSDustSiteMap(list: List<JSDustSiteMap?>): List<DeviceMapVo> { + val res = mutableListOf<DeviceMapVo>() + list.forEach { + it ?: return@forEach + res.add(DeviceMapVo().apply { + deviceCode = it.jsDeviceCode + deviceName = it.jsDeviceName + svUserId = it.svUserId + svUserName = it.svUserName + tzUserId = it.tzUserId + tzUserName = it.tzUserName + }) + } + return res + } + + fun fromXHFumeSiteMap(list: List<FumeSiteMap?>): List<DeviceMapVo> { + val res = mutableListOf<DeviceMapVo>() + list.forEach { + it ?: return@forEach + res.add(DeviceMapVo().apply { + deviceCode = it.xhDeviceCode + deviceName = it.xhDeviceName + svUserId = it.svUserId + svUserName = it.svUserName + tzUserId = it.tzUserId + tzUserName = it.tzUserName + }) + } + return res + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluateResVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluateResVo.kt new file mode 100644 index 0000000..6409df9 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluateResVo.kt @@ -0,0 +1,11 @@ +package cn.flightfeather.supervision.lightshare.vo + +/** + * 璇勪及缁撴灉缁熻 + */ +class EvaluateResVo:AreaVo() { + // 涓ラ噸涓嶈鑼冩暟閲� + var notstandardnum: Int = 0 + // 鍦烘櫙鎬绘暟 + var allsensenum: Int = 0 +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/PunishmentVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/PunishmentVo.kt new file mode 100644 index 0000000..b0211e0 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/PunishmentVo.kt @@ -0,0 +1,11 @@ +package cn.flightfeather.supervision.lightshare.vo + +import cn.flightfeather.supervision.domain.ds2.entity.BaseInfo +import cn.flightfeather.supervision.domain.ds2.entity.Punishment + +/** + * 琛屾斂澶勭綒 + */ +class PunishmentVo : Punishment() { + var baseInfo: BaseInfo? = null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt index ac7f6e1..9716c15 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt @@ -14,12 +14,12 @@ if (head is DataHead) { BaseResponse(true, head = head, data = res.second) } else { - BaseResponse(true, data = res.second) + BaseResponse(true, data = res) } } else { BaseResponse(true, data = res) } - } catch (e: Exception) { + } catch (e: IllegalStateException) { BaseResponse(false, message = e.message ?: "") } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ComplaintController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ComplaintController.kt new file mode 100644 index 0000000..8846516 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ComplaintController.kt @@ -0,0 +1,22 @@ +package cn.flightfeather.supervision.lightshare.web + +import cn.flightfeather.supervision.lightshare.service.ComplaintService +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import org.springframework.web.bind.annotation.* + +@Api(tags = ["淇¤鎶曡瘔鍙婅鏀垮缃氱浉鍏矨PI鎺ュ彛"]) +@RestController +@RequestMapping("") +class ComplaintController(val complaintService: ComplaintService) { + + @ApiOperation(value = "鑾峰彇淇¤鎶曡瘔淇℃伅") + @PostMapping("/complaint/find") + fun findComplaints(@ApiParam(value = "鍖哄煙鏉′欢") @RequestBody areaVo: AreaVo) = complaintService.findComplaints(areaVo) + + @ApiOperation(value = "鑾峰彇琛屾斂澶勭綒淇℃伅") + @PostMapping("/punishment/find") + fun findPunishment(@ApiParam(value = "鍖哄煙鏉′欢") @RequestBody areaVo: AreaVo) = complaintService.findPunishment(areaVo) +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt index 1b498bf..881841e 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt @@ -1,14 +1,21 @@ package cn.flightfeather.supervision.lightshare.web import cn.flightfeather.supervision.lightshare.service.UserMapService +import cn.flightfeather.supervision.lightshare.vo.AreaVo import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation import org.springframework.web.bind.annotation.* -@Api(tags = ["VersionController"], description = "鐢ㄦ埛id瀵瑰簲API鎺ュ彛") +@Api(tags = ["UserMapController"], description = "鐢ㄦ埛id瀵瑰簲API鎺ュ彛") @RestController @RequestMapping("/usermap") class UserMapController(val userMapService: UserMapService) { + @ApiOperation(value = "鏍规嵁椋炵窘鐩戠绯荤粺涓殑鍦烘櫙id锛岃幏鍙栦笌椋炵窘鐜绯荤粺涓殑鍏宠仈鐢ㄦ埛") @GetMapping fun getTZId(@RequestParam("sceneId") sceneId: String) = userMapService.getTZIdBySceneId(sceneId) + + @ApiOperation(value = "鑾峰彇鍖哄煙鐢ㄦ埛鐨勭洃娴嬭澶囧拰椋炵窘鐩戠绯荤粺銆侀缇界幆澧冪郴缁熺殑鍖归厤璁板綍") + @PostMapping("/device") + fun fetchDeviceMap(@RequestBody areaVo: AreaVo) = resPack { userMapService.fetchDeviceMap(areaVo) } } \ No newline at end of file diff --git a/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml b/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml index f831319..4e67a07 100644 --- a/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml +++ b/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml @@ -32,19 +32,4 @@ MOV_Suitable, MOV_DisplayID, MOV_Year, MOV_Month, MOV_Day, MOV_ISCP, MOV_CustomPeriod, MOV_Extension1, MOV_Extension2, MOV_Extension3, MOV_Remark </sql> - - <select id="getSceneByType" resultType="String"> - select - b.S_GUID - from sm_t_monitorobjectversion as a - left join sm_t_scense as b - on a.S_GUID = b.S_GUID - where a.T_ID = #{param1} - <if test="param2 != null"> - and b.S_TypeID = #{param2} - </if> - <if test="param3 != null"> - and b.S_TownCode = #{param3} - </if> - </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds1/ScenseMapper.xml b/src/main/resources/mapper/ds1/ScenseMapper.xml index 52ef693..5e1649d 100644 --- a/src/main/resources/mapper/ds1/ScenseMapper.xml +++ b/src/main/resources/mapper/ds1/ScenseMapper.xml @@ -45,4 +45,19 @@ <select id="selectNoAccountScene" resultMap="BaseResultMap"> select a.* FROM sm_t_scense as a LEFT JOIN sm_t_userinfo as b on a.S_GUID = b.D_GUID WHERE b.UI_GUID is null </select> + + <select id="getSceneByType" resultMap="BaseResultMap"> + select + b.* + from sm_t_monitorobjectversion as a + left join sm_t_scense as b + on a.S_GUID = b.S_GUID + where a.T_ID = #{param1} + <if test="param2 != null"> + and b.S_TypeID = #{param2} + </if> + <if test="param3 != null"> + and b.S_TownCode = #{param3} + </if> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds2/ComplaintMapper.xml b/src/main/resources/mapper/ds2/ComplaintMapper.xml index 903fd5a..db99793 100644 --- a/src/main/resources/mapper/ds2/ComplaintMapper.xml +++ b/src/main/resources/mapper/ds2/ComplaintMapper.xml @@ -28,4 +28,25 @@ CP_Mediate_Unit, CP_Mediate_Result, CP_Extension1, CP_Extension2, CP_Extension3, CP_Remark </sql> + + <resultMap id="ComplaintVo" type="cn.flightfeather.supervision.lightshare.vo.ComplaintVo" extends="BaseResultMap"> + <association property="baseInfo" resultMap="cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper.BaseResultMap" /> + </resultMap> + + <select id="findComplaint" resultMap="ComplaintVo"> + select + * + from ea_t_complaint as a + left join ea_t_baseinfo as b + on a.CP_SceneId = b.BI_GUID + <where> + a.CP_SceneId in #{tzUserIdList} + <if test="sTime != null"> + and a.CP_Time >= #{sTime} + </if> + <if test="eTime != null"> + and a.CP_Time <= #{eTime} + </if> + </where> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds2/PunishmentMapper.xml b/src/main/resources/mapper/ds2/PunishmentMapper.xml index f3ac57a..bad8e25 100644 --- a/src/main/resources/mapper/ds2/PunishmentMapper.xml +++ b/src/main/resources/mapper/ds2/PunishmentMapper.xml @@ -25,4 +25,25 @@ PM_GUID, PM_Name, PM_Time, PM_Reason, PM_Result, PM_Department, PM_Basis, PM_Scene_Id, PM_Extension1, PM_Extension2, PM_Extension3, PM_Remark </sql> + + <resultMap id="PunishmentVo" type="cn.flightfeather.supervision.lightshare.vo.PunishmentVo" extends="BaseResultMap"> + <association property="baseInfo" resultMap="cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper.BaseResultMap" /> + </resultMap> + + <select id="findPunishment" resultMap="PunishmentVo"> + select + * + from ea_t_punishment as a + left join ea_t_baseinfo as b + on a.PM_Scene_Id = b.BI_GUID + <where> + a.PM_Scene_Id in #{tzUserIdList} + <if test="sTime != null"> + and a.PM_Time >= #{sTime} + </if> + <if test="eTime != null"> + and a.PM_Time <= #{eTime} + </if> + </where> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds2/UserMapMapper.xml b/src/main/resources/mapper/ds2/UserMapMapper.xml index 6a50d59..3a8594c 100644 --- a/src/main/resources/mapper/ds2/UserMapMapper.xml +++ b/src/main/resources/mapper/ds2/UserMapMapper.xml @@ -9,11 +9,12 @@ <result column="TZ_User_Name" property="tzUserName" jdbcType="VARCHAR" /> <result column="SV_User_Id" property="svUserId" jdbcType="VARCHAR" /> <result column="SV_User_Name" property="svUserName" jdbcType="VARCHAR" /> + <result column="UM_Create_Time" jdbcType="TIMESTAMP" property="umCreateTime" /> </resultMap> <sql id="Base_Column_List" > <!-- WARNING - @mbg.generated --> - TZ_User_Id, TZ_User_Name, SV_User_Id, SV_User_Name + TZ_User_Id, TZ_User_Name, SV_User_Id, SV_User_Name, UM_Create_Time </sql> </mapper> \ No newline at end of file -- Gitblit v1.9.3