|
@@ -1,17 +1,19 @@
|
|
|
package org.king.modules.ad.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.king.common.api.vo.Result;
|
|
|
-import org.king.modules.ad.entity.AdDeviceCount;
|
|
|
-import org.king.modules.ad.entity.ChargeCount;
|
|
|
-import org.king.modules.ad.service.IAdDeviceService;
|
|
|
-import org.king.modules.ad.service.StaticalService;
|
|
|
+import org.king.modules.ad.entity.*;
|
|
|
+import org.king.modules.ad.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
@@ -22,6 +24,15 @@ public class StaticalController {
|
|
|
@Autowired
|
|
|
private StaticalService staticalService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IAdDeviceFaultReportService adDeviceFaultReportService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAdShipFaultReportService adShipFaultReportService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAdChargingRecordService adChargingRecordService;
|
|
|
+
|
|
|
@GetMapping(value = "/getDeviceCount")
|
|
|
public Result<?> getDeviceCount() {
|
|
|
AdDeviceCount count =staticalService.getDeviceCount();
|
|
@@ -33,4 +44,31 @@ public class StaticalController {
|
|
|
List<ChargeCount> list =staticalService.getChargeData();
|
|
|
return Result.ok(list);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping(value = "/getDeviceFault")
|
|
|
+ public Result<?> getDeviceFault() {
|
|
|
+ List<AdDeviceFaultReport> list =staticalService.getlist();
|
|
|
+ return Result.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/getShipFault")
|
|
|
+ public Result<?> getShipFault() {
|
|
|
+ List<AdShipFaultReport> list =adShipFaultReportService.list(Wrappers.<AdShipFaultReport>lambdaQuery().orderByDesc(AdShipFaultReport::getCreateTime));
|
|
|
+ return Result.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/getChargeRecord")
|
|
|
+ public Result<?> getChargeRecord(){
|
|
|
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ List<String> list = new ArrayList<String>();
|
|
|
+ List<AdChargingRecord> chargelist = adChargingRecordService.list(Wrappers.<AdChargingRecord>lambdaQuery().apply("date_format(create_time,'%Y-%m-%d') = '"+df.format(new Date())+"'"));
|
|
|
+ List<AdShipFaultReport> shiplist =adShipFaultReportService.list(Wrappers.<AdShipFaultReport>lambdaQuery().apply("date_format(create_time,'%Y-%m-%d') = '"+df.format(new Date())+"'"));
|
|
|
+ for(AdChargingRecord obj:chargelist){
|
|
|
+ list.add(obj.getShipId());
|
|
|
+ }
|
|
|
+ for(AdShipFaultReport obj:shiplist){
|
|
|
+ list.add(obj.getShipId());
|
|
|
+ }
|
|
|
+ return Result.ok(list);
|
|
|
+ }
|
|
|
}
|