| | |
| | | dataMap.forEach { (dCode, dayMap) -> |
| | | dayMap.forEach { (day, list) -> |
| | | dailyInfoMap[day]?.apply { |
| | | |
| | | changeType(deviceMap[dCode]) |
| | | setEndTime(list.last().mvDataTime) |
| | | getResult() |
| | | } |
| | | } |
| | | } |
| | |
| | | // TODO: 2021/12/1 1. 设备正式运行时间差 =》开启是否合规 |
| | | if (pfRTime != null && plRTime != null) { |
| | | rTimeDiff = ((pfRTime!!.time - plRTime!!.time) / 1000 / 60).toInt() |
| | | sResult = rTimeDiff > 0 |
| | | sResult = rTimeDiff < 0 |
| | | } |
| | | // TODO: 2021/12/1 2,设备关闭时间差 =》关闭是否合规 |
| | | if (pfETime != null && plETime != null) { |
| | | eTimeDiff = ((pfETime!!.time - plETime!!.time) / 1000 / 60).toInt() |
| | | eResult = eTimeDiff > 0 |
| | | } |
| | | // TODO: 2021/12/1 3. 运行时长差 =》运行过程是否合规 |
| | | runningTimeDiff = pfRunTime - plRunTime |
| | | // TODO: 2021/12/1 4. 综合判断结果 |
| | | rResult = runningTimeDiff > 0 |
| | | |
| | | // TODO: 2021/12/1 5. 多日摘要统计,运行天数、合规天数等 |
| | | } |
| | |
| | | /** |
| | | * 企业用电量日统计信息 |
| | | */ |
| | | fun dailyStatistics(cId: String, startTime: String?, endTime: String?): BaseResponse<List<ElectricDailyInfo>> |
| | | fun dailyAnalysis(cId: String, startTime: String?, endTime: String?): BaseResponse<List<ElectricDailyInfo>> |
| | | } |
| | |
| | | return BaseResponse(true, head = DataHead(pageInfo.pageNum, pageInfo.pages), data = result) |
| | | } |
| | | |
| | | override fun dailyStatistics(cId: String, startTime: String?, endTime: String?): BaseResponse<List<ElectricDailyInfo>> { |
| | | override fun dailyAnalysis(cId: String, startTime: String?, endTime: String?): BaseResponse<List<ElectricDailyInfo>> { |
| | | // 根据企业id获取对应设备 |
| | | val devices = companyDeviceMapper.selectByExample(Example(CompanyDevice::class.java).apply { |
| | | createCriteria().andEqualTo("cdCompanyId", cId) |
| | |
| | | @RequestParam(value = "page", required = false) page: Int?, |
| | | @RequestParam(value = "perPage", required = false) perPage: Int? |
| | | ) = electricityService.getElectricityInfo(cId, startTime, endTime, page, perPage) |
| | | |
| | | @ApiOperation(value = "企业用电量日分析") |
| | | @GetMapping("/analysis/daily") |
| | | fun dailyStatistics( |
| | | @ApiParam("企业id") @RequestParam(value = "cId") cId: String, |
| | | @ApiParam(value = "开始时间", example = "yyyy-MM-dd HH:mm:ss") @RequestParam(value = "startTime", required = false) startTime: String?, |
| | | @ApiParam(value = "结束时间", example = "yyyy-MM-dd HH:mm:ss") @RequestParam(value = "endTime", required = false) endTime: String?, |
| | | ) = electricityService.dailyAnalysis(cId, startTime, endTime) |
| | | } |
| | |
| | | # 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 |
| | |
| | | import com.flightfeather.uav.lightshare.service.ElectricityService |
| | | import org.junit.Test |
| | | |
| | | import org.junit.Assert.* |
| | | import org.junit.runner.RunWith |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | |
| | | |
| | | @Test |
| | | fun dailyStatistics() { |
| | | val r = electricityService.dailyStatistics("J3euwNl19WZvH7iE", "2021-07-16 00:00:00", "2021-07-16 00:00:00") |
| | | val r = electricityService.dailyAnalysis("J3euwNl19WZvH7iE", "2021-07-16 00:00:00", "2021-07-16 00:00:00") |
| | | println(r) |
| | | } |
| | | } |