1. 新增信访信息获取接口
2. 新增用电量信息获取接口
3. 新增风险评估结果接口
4. 新增污染权重实时分析接口
| | |
| | | <artifactId>uav</artifactId> |
| | | <version>1.0.0</version> |
| | | <packaging>war</packaging> |
| | | <name>obd</name> |
| | | <name>uav</name> |
| | | <description>Uav data server</description> |
| | | |
| | | <properties> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.domain.entity; |
| | | |
| | | import javax.persistence.*; |
| | | |
| | | @Table(name = "co_assessment") |
| | | public class Assessment { |
| | | @Id |
| | | @Column(name = "ID") |
| | | private Integer id; |
| | | |
| | | @Column(name = "CI_GUID") |
| | | private String ciGuid; |
| | | |
| | | @Column(name = "AS_Risk") |
| | | private String asRisk; |
| | | |
| | | /** |
| | | * @return ID |
| | | */ |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | /** |
| | | * @param id |
| | | */ |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | /** |
| | | * @return CI_GUID |
| | | */ |
| | | public String getCiGuid() { |
| | | return ciGuid; |
| | | } |
| | | |
| | | /** |
| | | * @param ciGuid |
| | | */ |
| | | public void setCiGuid(String ciGuid) { |
| | | this.ciGuid = ciGuid == null ? null : ciGuid.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @return AS_Risk |
| | | */ |
| | | public String getAsRisk() { |
| | | return asRisk; |
| | | } |
| | | |
| | | /** |
| | | * @param asRisk |
| | | */ |
| | | public void setAsRisk(String asRisk) { |
| | | this.asRisk = asRisk == null ? null : asRisk.trim(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.domain.entity; |
| | | |
| | | import java.util.Date; |
| | | import javax.persistence.*; |
| | | |
| | | @Table(name = "co_complaint") |
| | | public class Complaint { |
| | | @Id |
| | | @Column(name = "ID") |
| | | private Integer id; |
| | | |
| | | /** |
| | | * ä¼ä¸id |
| | | */ |
| | | @Column(name = "CI_GUID") |
| | | private String ciGuid; |
| | | |
| | | /** |
| | | * ä¼ä¸åç§° |
| | | */ |
| | | @Column(name = "CI_Name") |
| | | private String ciName; |
| | | |
| | | /** |
| | | * 信访æè¯æ±¡æç±»åid |
| | | */ |
| | | @Column(name = "CO_Type") |
| | | private Integer coType; |
| | | |
| | | /** |
| | | * 信访æè¯æ±¡æç±»å |
| | | */ |
| | | @Column(name = "CO_Type_Name") |
| | | private String coTypeName; |
| | | |
| | | /** |
| | | * ä¿¡è®¿æ¶æ®µ |
| | | */ |
| | | @Column(name = "CO_Time") |
| | | private Date coTime; |
| | | |
| | | /** |
| | | * @return ID |
| | | */ |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | /** |
| | | * @param id |
| | | */ |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | /** |
| | | * è·åä¼ä¸id |
| | | * |
| | | * @return CI_GUID - ä¼ä¸id |
| | | */ |
| | | public String getCiGuid() { |
| | | return ciGuid; |
| | | } |
| | | |
| | | /** |
| | | * 设置ä¼ä¸id |
| | | * |
| | | * @param ciGuid ä¼ä¸id |
| | | */ |
| | | public void setCiGuid(String ciGuid) { |
| | | this.ciGuid = ciGuid == null ? null : ciGuid.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åä¼ä¸åç§° |
| | | * |
| | | * @return CI_Name - ä¼ä¸åç§° |
| | | */ |
| | | public String getCiName() { |
| | | return ciName; |
| | | } |
| | | |
| | | /** |
| | | * 设置ä¼ä¸åç§° |
| | | * |
| | | * @param ciName ä¼ä¸åç§° |
| | | */ |
| | | public void setCiName(String ciName) { |
| | | this.ciName = ciName == null ? null : ciName.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·å信访æè¯æ±¡æç±»åid |
| | | * |
| | | * @return CO_Type - 信访æè¯æ±¡æç±»åid |
| | | */ |
| | | public Integer getCoType() { |
| | | return coType; |
| | | } |
| | | |
| | | /** |
| | | * 设置信访æè¯æ±¡æç±»åid |
| | | * |
| | | * @param coType 信访æè¯æ±¡æç±»åid |
| | | */ |
| | | public void setCoType(Integer coType) { |
| | | this.coType = coType; |
| | | } |
| | | |
| | | /** |
| | | * è·å信访æè¯æ±¡æç±»å |
| | | * |
| | | * @return CO_Type_Name - 信访æè¯æ±¡æç±»å |
| | | */ |
| | | public String getCoTypeName() { |
| | | return coTypeName; |
| | | } |
| | | |
| | | /** |
| | | * 设置信访æè¯æ±¡æç±»å |
| | | * |
| | | * @param coTypeName 信访æè¯æ±¡æç±»å |
| | | */ |
| | | public void setCoTypeName(String coTypeName) { |
| | | this.coTypeName = coTypeName == null ? null : coTypeName.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åä¿¡è®¿æ¶æ®µ |
| | | * |
| | | * @return CO_Time - ä¿¡è®¿æ¶æ®µ |
| | | */ |
| | | public Date getCoTime() { |
| | | return coTime; |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®ä¿¡è®¿æ¶æ®µ |
| | | * |
| | | * @param coTime ä¿¡è®¿æ¶æ®µ |
| | | */ |
| | | public void setCoTime(Date coTime) { |
| | | this.coTime = coTime; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.domain.mapper |
| | | |
| | | import com.flightfeather.uav.domain.MyMapper |
| | | import com.flightfeather.uav.domain.entity.Assessment |
| | | import com.flightfeather.uav.lightshare.bean.AssessmentVo |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface AssessmentMapper : MyMapper<Assessment> { |
| | | |
| | | fun getAssessment(): List<AssessmentVo> |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.domain.mapper |
| | | |
| | | import com.flightfeather.uav.domain.MyMapper |
| | | import com.flightfeather.uav.domain.entity.Complaint |
| | | import com.flightfeather.uav.lightshare.bean.ComplaintRecord |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface ComplaintMapper : MyMapper<Complaint?> { |
| | | |
| | | fun getComplaintInfo(townCode: String? = null): List<ComplaintRecord> |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.lightshare.bean |
| | | |
| | | import java.math.BigDecimal |
| | | |
| | | |
| | | data class AssessmentVo( |
| | | var ciGuid: String, |
| | | var ciName: String, |
| | | var ciLng: BigDecimal, |
| | | var ciLat: BigDecimal, |
| | | var ciIndex: String, |
| | | var ciAddress: String, |
| | | var risk: String |
| | | ) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.lightshare.bean |
| | | |
| | | import java.math.BigDecimal |
| | | import kotlin.math.round |
| | | |
| | | /** |
| | | * ä¼ä¸ä¿¡è®¿æè¯ç»è®¡ä¿¡æ¯ |
| | | */ |
| | | data class ComplaintVo( |
| | | val ciGuid: String, |
| | | val ciName: String, |
| | | var ciLng: Double, |
| | | var ciLat: Double, |
| | | val index: Int, |
| | | val ciAddress: String? = null, |
| | | val result: MutableList<ComplaintType> = mutableListOf() |
| | | ) |
| | | |
| | | /** |
| | | * 信访æè¯ç±»åä¿¡æ¯ |
| | | */ |
| | | data class ComplaintType( |
| | | // 污æç±»åid |
| | | val type: Int, |
| | | // 污æç±»ååç§° |
| | | val typeName: String, |
| | | // 信访æè¯è®¡æ° |
| | | val count: Int, |
| | | // å æ¯ |
| | | val percent: Double = .0 |
| | | ) |
| | | |
| | | /** |
| | | * 信访æè¯ç»è®¡ï¼æ°æ®åºè¿åç»æä½ï¼ |
| | | */ |
| | | data class ComplaintRecord( |
| | | var ciGuid: String, |
| | | var ciName: String, |
| | | var ciLng: BigDecimal, |
| | | var ciLat: BigDecimal, |
| | | var ciIndex: String, |
| | | var ciAddress: String, |
| | | var coType: Int, |
| | | var coTypeName: String, |
| | | var count: Long |
| | | ) { |
| | | var percent: Double = .0 |
| | | } |
| | | |
| | | /** |
| | | * æ±ä¿¡è®¿è®°å½ä¸æ¯ç§æè¯ç±»åçåèªå æ¯ |
| | | */ |
| | | fun List<ComplaintRecord>.percent() { |
| | | val cMap = mutableMapOf<Int, Int>() |
| | | this.forEach { |
| | | if (!cMap.containsKey(it.coType)) { |
| | | cMap[it.coType] = 0 |
| | | } |
| | | cMap[it.coType] = cMap[it.coType]?.plus(it.count)?.toInt() ?: 0 |
| | | } |
| | | this.forEach { |
| | | val t = cMap[it.coType] |
| | | it.percent = if (t != null && t != 0) round(it.count / t.toDouble() * 10000) / 10000 else .0 |
| | | } |
| | | } |
| | |
| | | package com.flightfeather.uav.lightshare.bean |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore |
| | | import com.fasterxml.jackson.annotation.JsonInclude |
| | | import com.flightfeather.uav.model.BaseMData |
| | | import com.flightfeather.uav.socket.bean.AirData |
| | |
| | | row.add(lng ?: -1.0) |
| | | row.add(lat ?: -1.0) |
| | | values?.forEach { |
| | | if (FactorType.outputFactor(it.factorName)) { |
| | | row.add(it.factorData ?: -1.0) |
| | | row.add(it.physicalQuantity ?: -1.0) |
| | | // row.add(it.physicalQuantity ?: -1.0) |
| | | } |
| | | } |
| | | return row.toTypedArray() |
| | | } |
| | |
| | | list.add("ç»åº¦") |
| | | list.add("纬度") |
| | | values?.forEach { |
| | | if (FactorType.outputFactor(it.factorName)) { |
| | | val name = it.factorName ?: "" |
| | | list.add(name) |
| | | list.add("$name(ç©çé)") |
| | | // list.add("$name(ç©çé)") |
| | | } |
| | | } |
| | | return list.toTypedArray() |
| | | } |
| | |
| | | package com.flightfeather.uav.lightshare.service |
| | | |
| | | import com.flightfeather.uav.domain.entity.Assessment |
| | | import com.flightfeather.uav.domain.entity.Company |
| | | import com.flightfeather.uav.lightshare.bean.AssessmentVo |
| | | import com.flightfeather.uav.lightshare.bean.BaseResponse |
| | | import com.flightfeather.uav.lightshare.bean.ComplaintVo |
| | | import com.flightfeather.uav.model.BaseModel |
| | | |
| | | interface CompanyService { |
| | |
| | | endTime: String, |
| | | companyIds: List<String>? = null |
| | | ): BaseResponse<MutableMap<String, MutableMap<String, MutableMap<String, BaseModel.ResultCell>>>> |
| | | |
| | | fun getComplaintInfo(): BaseResponse<List<ComplaintVo>> |
| | | |
| | | fun getAssessment(): BaseResponse<List<AssessmentVo>> |
| | | } |
| | |
| | | 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 |
| | |
| | | |
| | | @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>> { |
| | |
| | | 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++ |
| | | } |
| | |
| | | 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) |
| | | } |
| | | } |
| | |
| | | sTime?.let { andGreaterThanOrEqualTo("mvDataTime", it) } |
| | | eTime?.let { andLessThanOrEqualTo("mvDataTime", it) } |
| | | } |
| | | orderBy("mvDataTime") |
| | | orderBy("mvDataTime").apply { |
| | | // å½è¯·æ±æ¥å£ä¸ä¼ éèµ·å§æ¶é´ï¼é»è®¤è·åææ°çæ°æ® |
| | | if (startTime == null && endTime == null) { |
| | | desc() |
| | | } |
| | | } |
| | | }).forEach { |
| | | it?.let { result.add(it) } |
| | | } |
| | | if (startTime == null && endTime == null) { |
| | | result.reverse() |
| | | } |
| | | return BaseResponse(true, head = DataHead(pageInfo.pageNum, pageInfo.pages), data = result) |
| | | } |
| | | |
| | |
| | | |
| | | import com.flightfeather.uav.lightshare.service.CompanyService |
| | | import io.swagger.annotations.Api |
| | | import org.springframework.web.bind.annotation.GetMapping |
| | | import org.springframework.web.bind.annotation.RequestMapping |
| | | import org.springframework.web.bind.annotation.RequestParam |
| | | import org.springframework.web.bind.annotation.RestController |
| | | import org.springframework.web.bind.annotation.* |
| | | |
| | | @Api(tags = ["å·¥ä¸ä¼ä¸ä¿¡æ¯APIæ¥å£"]) |
| | | @RestController |
| | |
| | | @RequestParam(value = "endTime", required = true) endTime: String, |
| | | @RequestParam(value = "companyIds", required = false) companyIds: List<String>?, |
| | | ) = companyService.getEpwModelResult(deviceCode, startTime, endTime, companyIds) |
| | | |
| | | @GetMapping("/complaint") |
| | | fun getComplaintInfo() = companyService.getComplaintInfo() |
| | | |
| | | @GetMapping("/assessment") |
| | | fun getAssessment() = companyService.getAssessment() |
| | | } |
| | |
| | | @ApiParam(value = "ç»ææ¶é´", example = "yyyy-MM-dd HH:mm:ss") @RequestParam(value = "endTime", required = false) endTime: String?, |
| | | @RequestParam(value = "page", required = false) page: Int?, |
| | | @RequestParam(value = "perPage", required = false) perPage: Int? |
| | | ) = electricityService.getMinuteData(deviceCode, startTime, endTime, page, perPage) |
| | | ) = electricityService.getMinuteData2(deviceCode, startTime, endTime, page, perPage) |
| | | |
| | | @GetMapping("/company") |
| | | fun getByCompany( |
| | |
| | | } |
| | | |
| | | lastData.clear() |
| | | mDataList.subList(mDataList.lastIndex - ncal + 1, mDataList.lastIndex + 1).forEach { |
| | | val s = if ((mDataList.lastIndex - ncal + 1) < 0) 0 else mDataList.lastIndex - ncal + 1 |
| | | mDataList.subList(s, mDataList.lastIndex + 1).forEach { |
| | | lastData.add(it.copy()) |
| | | } |
| | | |
| | |
| | | import io.netty.channel.ChannelHandlerContext |
| | | import io.netty.channel.ChannelInboundHandlerAdapter |
| | | import io.netty.util.AttributeKey |
| | | import org.ietf.jgss.MessageProp |
| | | import java.lang.StringBuilder |
| | | import java.text.SimpleDateFormat |
| | | import java.util.* |
| | |
| | | |
| | | println(str) |
| | | |
| | | if (str == "01 04 00 00 00 00 00 00 00 00 00") { |
| | | ctx?.writeAndFlush("trigger") |
| | | return |
| | | } |
| | | if (str.isNotEmpty()) { |
| | | ctx?.writeAndFlush("data") |
| | | processor.dealStringMsg(str, ctx) |
| | | } |
| | | } |
| | |
| | | package com.flightfeather.uav.socket.bean |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude |
| | | |
| | | /** |
| | | * @author riku |
| | | * Date: 2020/6/10 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class AirData : DataUnit() { |
| | | var factorId: String? = null |
| | | var factorName: String? = null |
| | |
| | | HEIGHT -> 0.0 |
| | | else -> null |
| | | } |
| | | |
| | | fun outputFactor(factorName: String?): Boolean { |
| | | return when (factorName) { |
| | | NO2.des, |
| | | CO.des, |
| | | H2S.des, |
| | | SO2.des, |
| | | O3.des, |
| | | PM25.des, |
| | | PM10.des, |
| | | TEMPERATURE.des, |
| | | HUMIDITY.des, |
| | | VOC.des, |
| | | WIND_SPEED.des, |
| | | WIND_DIRECTION.des -> true |
| | | else -> false |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | # password: cn.FLIGHTFEATHER |
| | | |
| | | # çº¿ä¸æå¡å¨ |
| | | # url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | # username: dronemonitor |
| | | # password: dronemonitor_hackxrnomxm |
| | | url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | username: dronemonitor |
| | | password: dronemonitor_hackxrnomxm |
| | | |
| | | # å¼åæ¬å°æå¡å¨ |
| | | # url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | |
| | | # password: 123456 |
| | | |
| | | # å¼åè¿ç¨æå¡å¨ |
| | | url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | username: remoteU1 |
| | | password: eSoF8DnzfGTlhAjE |
| | | # url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | # username: remoteU1 |
| | | # password: eSoF8DnzfGTlhAjE |
| | | hikari: |
| | | maximum-pool-size: 500 |
| | | minimum-idle: 20 |
| | |
| | | <!-- <table tableName="air_real_time_data" domainObjectName="RealTimeData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="el_minutevalue" domainObjectName="ElectricMinuteValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="el_company_device" domainObjectName="CompanyDevice" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="el_company_device" domainObjectName="CompanyDevice" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="co_complaint" domainObjectName="Complaint" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="co_assessment" domainObjectName="Assessment" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | </context> |
| | | </generatorConfiguration> |
| | |
| | | <!--root é»è®¤å è½½--> |
| | | <loggers> |
| | | <root level="INFO"> |
| | | <!-- <appender-ref ref="Console"/>--> |
| | | <appender-ref ref="Console"/> |
| | | <!-- <appender-ref ref="allLog"/>--> |
| | | <!-- <appender-ref ref="debugLog"/>--> |
| | | <appender-ref ref="errorLog"/> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="com.flightfeather.uav.domain.mapper.AssessmentMapper"> |
| | | <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.Assessment"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="ID" jdbcType="INTEGER" property="id" /> |
| | | <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid" /> |
| | | <result column="AS_Risk" jdbcType="VARCHAR" property="asRisk" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | ID, CI_GUID, AS_Risk |
| | | </sql> |
| | | |
| | | <resultMap id="AssessmentVo" type="com.flightfeather.uav.lightshare.bean.AssessmentVo"> |
| | | <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid" /> |
| | | <result column="CI_Name" jdbcType="VARCHAR" property="ciName" /> |
| | | <result column="CI_Longitude" jdbcType="DECIMAL" property="ciLng" /> |
| | | <result column="CI_Latitude" jdbcType="DECIMAL" property="ciLat" /> |
| | | <result column="ciIndex" jdbcType="VARCHAR" property="ciIndex" /> |
| | | <result column="CI_Address" jdbcType="VARCHAR" property="ciAddress" /> |
| | | <result column="AS_Risk" jdbcType="VARCHAR" property="risk" /> |
| | | </resultMap> |
| | | <select id="getAssessment" resultMap="AssessmentVo"> |
| | | SELECT |
| | | b.CI_GUID, |
| | | b.CI_Name, |
| | | b.CI_Longitude, |
| | | b.CI_Latitude, |
| | | b.CI_Extension1 as ciIndex, |
| | | b.CI_Address, |
| | | a.AS_Risk |
| | | FROM |
| | | co_assessment AS a |
| | | LEFT JOIN ea_companyinfo AS b ON a.CI_GUID = b.CI_GUID |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="com.flightfeather.uav.domain.mapper.ComplaintMapper"> |
| | | <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.Complaint"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="ID" jdbcType="INTEGER" property="id" /> |
| | | <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid" /> |
| | | <result column="CI_Name" jdbcType="VARCHAR" property="ciName" /> |
| | | <result column="CO_Type" jdbcType="INTEGER" property="coType" /> |
| | | <result column="CO_Type_Name" jdbcType="VARCHAR" property="coTypeName" /> |
| | | <result column="CO_Time" jdbcType="TIMESTAMP" property="coTime" /> |
| | | </resultMap> |
| | | <resultMap id="ComplaintRecord" type="com.flightfeather.uav.lightshare.bean.ComplaintRecord"> |
| | | <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid" /> |
| | | <result column="CI_Name" jdbcType="VARCHAR" property="ciName" /> |
| | | <result column="CI_Longitude" jdbcType="DECIMAL" property="ciLng" /> |
| | | <result column="CI_Latitude" jdbcType="DECIMAL" property="ciLat" /> |
| | | <result column="ciIndex" jdbcType="VARCHAR" property="ciIndex" /> |
| | | <result column="CI_Address" jdbcType="VARCHAR" property="ciAddress" /> |
| | | <result column="CO_Type" jdbcType="INTEGER" property="coType" /> |
| | | <result column="CO_Type_Name" jdbcType="VARCHAR" property="coTypeName" /> |
| | | <result column="count" jdbcType="INTEGER" property="count" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | ID, CI_GUID, CI_Name, CO_Type, CO_Type_Name, CO_Time |
| | | </sql> |
| | | |
| | | <select id="getComplaintInfo" resultMap="ComplaintRecord"> |
| | | SELECT |
| | | a.CI_GUID, |
| | | a.CI_Name, |
| | | b.CI_Longitude, |
| | | b.CI_Latitude, |
| | | b.CI_Extension1 as ciIndex, |
| | | b.CI_Address, |
| | | a.CO_Type, |
| | | a.CO_Type_Name, |
| | | COUNT(*) as count |
| | | FROM |
| | | co_complaint AS a |
| | | LEFT JOIN ea_companyinfo AS b ON a.CI_GUID = b.CI_GUID |
| | | GROUP BY |
| | | a.CO_Type, |
| | | a.CI_GUID |
| | | </select> |
| | | </mapper> |
| | |
| | | val list = listOf(1, 2, 3, 4, 5, 0) |
| | | println(list.average()) |
| | | } |
| | | |
| | | @Test |
| | | fun get_crc16(){ |
| | | val dataSegment = "QN=20210713115502858;ST=22;CN=2011;PW=555555;MN=FYHB0MH0300045;Flag=1;CP=&&DataTime=20210713115000;a34001-Avg=0.025,a34001-CPM=5.9,a34001-Flag=N;a50001-Avg=0.0,a50001-Flag=D;a01001-Avg=33.0,a01001-Flag=N;a01002-Avg=68.2,a01002-Flag=N;a01007-Avg=0.0,a01007-Flag=N;a01008-Avg=0.0,a01008-Flag=N;Period=5;Scale=0.0;SelfTemp=0.0;SelfHum=0.0;IsReplacement=N&&" |
| | | var CRC = 0x0000ffff |
| | | val POLYNOMIAL = 0x0000a001 |
| | | var i: Int |
| | | var j: Int |
| | | val bufData = dataSegment.toByteArray() |
| | | val buflen = bufData.size |
| | | if (buflen == 0) { |
| | | return |
| | | } |
| | | i = 0 |
| | | while (i < buflen) { |
| | | CRC = CRC xor (bufData[i].toInt() and 0x000000ff) |
| | | j = 0 |
| | | while (j < 8) { |
| | | if (CRC and 0x00000001 != 0) { |
| | | CRC = CRC shr 1 |
| | | CRC = CRC xor POLYNOMIAL |
| | | } else { |
| | | CRC = CRC shr 1 |
| | | } |
| | | j++ |
| | | } |
| | | i++ |
| | | } |
| | | var strCRC = Integer.toHexString(CRC).toString() |
| | | if (strCRC.length < 4) { |
| | | strCRC += "0" |
| | | } |
| | | println(strCRC) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.model.epw |
| | | |
| | | import com.flightfeather.uav.common.utils.DateUtil |
| | | import com.flightfeather.uav.common.utils.ExcelUtil |
| | | import com.flightfeather.uav.lightshare.bean.DataVo |
| | | import com.flightfeather.uav.lightshare.service.RealTimeDataService |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook |
| | | import org.junit.Assert.* |
| | | import org.junit.Test |
| | | import org.junit.runner.RunWith |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit4.SpringRunner |
| | | import java.io.File |
| | | import java.io.FileOutputStream |
| | | import java.util.* |
| | | |
| | | @RunWith(SpringRunner::class) |
| | | @SpringBootTest |
| | | class EPWDataPrepTest { |
| | | |
| | | @Autowired |
| | | lateinit var realTimeDataService: RealTimeDataService |
| | | |
| | | @Test |
| | | fun foo1() { |
| | | val timeSet = listOf( |
| | | // ç½æ ¼åçæµæ¯æ¥ |
| | | // Pair("2021-06-18 15:00:00", "2021-06-18 23:59:59"), |
| | | // Pair("2021-06-19 00:00:00", "2021-06-19 23:59:59"), |
| | | // Pair("2021-06-20 00:00:00", "2021-06-20 23:59:59"), |
| | | // Pair("2021-06-21 00:00:00", "2021-06-21 23:59:59"), |
| | | // Pair("2021-06-22 00:00:00", "2021-06-22 23:59:59"), |
| | | // Pair("2021-06-23 00:00:00", "2021-06-23 23:59:59"), |
| | | // Pair("2021-06-24 00:00:00", "2021-06-24 23:59:59"), |
| | | // Pair("2021-06-25 00:00:00", "2021-06-25 23:59:59"), |
| | | // Pair("2021-06-26 00:00:00", "2021-06-26 23:59:59"), |
| | | // Pair("2021-06-27 00:00:00", "2021-06-27 23:59:59"), |
| | | // Pair("2021-06-28 00:00:00", "2021-06-28 23:59:59"), |
| | | // Pair("2021-06-29 00:00:00", "2021-06-29 23:59:59"), |
| | | // Pair("2021-06-30 00:00:00", "2021-06-30 23:59:59"), |
| | | // Pair("2021-07-01 00:00:00", "2021-07-01 23:59:59"), |
| | | // Pair("2021-07-02 00:00:00", "2021-07-02 23:59:59"), |
| | | // Pair("2021-07-03 00:00:00", "2021-07-03 23:59:59"), |
| | | // Pair("2021-07-04 00:00:00", "2021-07-04 23:59:59"), |
| | | // Pair("2021-07-05 00:00:00", "2021-07-05 23:59:59"), |
| | | // Pair("2021-07-06 00:00:00", "2021-07-06 23:59:59"), |
| | | // Pair("2021-07-07 00:00:00", "2021-07-07 23:59:59"), |
| | | Pair("2021-07-08 00:00:00", "2021-07-08 23:59:59"), |
| | | Pair("2021-07-09 00:00:00", "2021-07-09 23:59:59"), |
| | | Pair("2021-07-10 00:00:00", "2021-07-10 23:59:59"), |
| | | Pair("2021-07-11 00:00:00", "2021-07-11 23:59:59"), |
| | | Pair("2021-07-12 00:00:00", "2021-07-12 23:59:59"), |
| | | Pair("2021-07-13 00:00:00", "2021-07-13 23:59:59"), |
| | | |
| | | // Pair("2021-06-18 15:00:00", "2021-07-13 23:59:59"), |
| | | ) |
| | | |
| | | val prep = EPWDataPrep() |
| | | val deviceCode = "0d0000000001" |
| | | |
| | | for (i in timeSet.indices) { |
| | | val it = timeSet[i] |
| | | var page = 1 |
| | | var totalPage = -1 |
| | | val dataList = mutableListOf<DataVo>() |
| | | while (totalPage == -1 || page <= totalPage) { |
| | | realTimeDataService.getSecondData(deviceCode, it.first, it.second, page, 50000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |
| | | |
| | | val list = data?: emptyList() |
| | | |
| | | val prepList = prep.mDataPrep(list) |
| | | |
| | | dataList.addAll(prepList) |
| | | |
| | | page++ |
| | | } |
| | | } |
| | | |
| | | if (dataList.isNotEmpty()) { |
| | | val workbook = HSSFWorkbook() |
| | | val heads = mutableListOf<Array<String>>() |
| | | heads.add(dataList[0].toRowTitle()) |
| | | val contents = mutableListOf<Array<Any>>() |
| | | dataList.forEach { |
| | | contents.add(it.toRowContent()) |
| | | } |
| | | ExcelUtil.write(heads, contents, workbook) |
| | | |
| | | val fileName = "ç½æ ¼åé¢å¤çæ°æ®${it.first.substring(0, 10)}.xls" |
| | | val filePath = "E:\\work\\export\\é¢å¤ç\\$fileName" |
| | | val out = FileOutputStream(File(filePath)) |
| | | workbook.write(out) |
| | | workbook.close() |
| | | out.flush() |
| | | out.close() |
| | | } |
| | | } |
| | | } |
| | | } |