|
@@ -0,0 +1,306 @@
|
|
|
|
+package com.hz.business.controller;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.hz.business.base.BaseLineChartVo;
|
|
|
|
+import com.hz.business.domain.Tag;
|
|
|
|
+import com.hz.business.dto.BatteryFolderDto;
|
|
|
|
+import com.hz.business.dto.TagDto;
|
|
|
|
+import com.hz.business.req.*;
|
|
|
|
+import com.hz.business.vo.*;
|
|
|
|
+import com.hz.common.annotation.Log;
|
|
|
|
+import com.hz.common.constant.Constants;
|
|
|
|
+import com.hz.common.enums.BusinessType;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import com.hz.common.core.controller.BaseController;
|
|
|
|
+import com.hz.common.core.domain.AjaxResult;
|
|
|
|
+import com.hz.business.service.IBatteryService;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.sql.SQLException;
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 动力大电池数据
|
|
|
|
+ *
|
|
|
|
+ * @author zyg
|
|
|
|
+ * @date 2022-02-15
|
|
|
|
+ */
|
|
|
|
+@Api(tags = "电池信息管理")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/business/battery")
|
|
|
|
+public class BatteryController extends BaseController {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IBatteryService batteryService;
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询电池信息列表")
|
|
|
|
+ @PostMapping("/list")
|
|
|
|
+ public AjaxResult list(@RequestBody BatteryParam param) {
|
|
|
|
+ PageInfo<BatteryVo> result = batteryService.selectBatteryList(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询快充电池信息列表")
|
|
|
|
+ @PostMapping("/fastList")
|
|
|
|
+ public AjaxResult selectFastChargeBatteryList(@RequestBody BatteryParam param) {
|
|
|
|
+ PageInfo<FastChargeBatteryVo> result = batteryService.selectFastChargeBatteryList(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("电池详细信息")
|
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) throws SQLException {
|
|
|
|
+ BatteryVo result = batteryService.getBatteryDetail(id);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("通过sn/vin获取电池详细信息")
|
|
|
|
+ @GetMapping(value = "/detail/{sn}")
|
|
|
|
+ public AjaxResult getDetailInfo(@PathVariable("sn") String sn) throws SQLException {
|
|
|
|
+ BatteryVo result = batteryService.getDetailInfo(sn);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询自定义分析-电池编号精确查询")
|
|
|
|
+ @GetMapping(value = "/query/{sn}")
|
|
|
|
+ public AjaxResult getBattery(@PathVariable("sn") String sn) {
|
|
|
|
+ BatteryVo result = batteryService.getBattery(sn);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取电池详细信息趋势图")
|
|
|
|
+ @PostMapping(value = "/detailChart")
|
|
|
|
+ public AjaxResult getDetailCharts(@RequestBody BatteryDetailChartParam param) throws ParseException, SQLException {
|
|
|
|
+ BatteryDetailChartVo result = batteryService.getDetailCharts(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取电池数据概览")
|
|
|
|
+ @PostMapping(value = "/yesterdayList")
|
|
|
|
+ public AjaxResult getBatteryStatistics(@RequestBody BatteryOverviewParam param) {
|
|
|
|
+ BatteryStatisticsVo result = batteryService.getBatteryStatistics(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取SOH里程分布图")
|
|
|
|
+ @GetMapping(value = "/sohMileage")
|
|
|
|
+ public AjaxResult getSohMileage() {
|
|
|
|
+ List<SohMileageVo> result = batteryService.getSohMileage();
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取状态概览-电池环状图信息")
|
|
|
|
+ @GetMapping(value = "/cycleList")
|
|
|
|
+ public AjaxResult batteryCyclePercentList() {
|
|
|
|
+ BatteryCycleDataVo result = batteryService.getBatteryCyclePercentList();
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取电池故障类型日趋势信息")
|
|
|
|
+ @GetMapping(value = "/faultTrend")
|
|
|
|
+ public AjaxResult faultTrend() {
|
|
|
|
+ BaseLineChartVo result = batteryService.getFaultTrend();
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取性能类实时指标信息")
|
|
|
|
+ @GetMapping(value = "/performance")
|
|
|
|
+ public AjaxResult performanceRealTime() {
|
|
|
|
+ PerformanceRealTimeVo result = batteryService.getPerformanceRealTime();
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("收藏电池")
|
|
|
|
+ @PostMapping(value = "/collectBattery")
|
|
|
|
+ public AjaxResult doCollectBattery(@RequestBody BatteryFolderDto dto) {
|
|
|
|
+ String result = batteryService.doCollectBattery(dto);
|
|
|
|
+ if (!Constants.OK.equals(result)) {
|
|
|
|
+ return AjaxResult.error(5001, result);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("添加电池标签")
|
|
|
|
+ @PostMapping(value = "/addTag")
|
|
|
|
+ @Log(title = "电池信息管理", businessType = BusinessType.INSERT)
|
|
|
|
+ public AjaxResult batteryAddTag(@RequestBody TagDto tagDto) {
|
|
|
|
+ String result = batteryService.batteryAddTag(tagDto);
|
|
|
|
+ if (!Constants.OK.equals(result)) {
|
|
|
|
+ return AjaxResult.error(5001, result);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("修改电池标签")
|
|
|
|
+ @PostMapping(value = "/editTag")
|
|
|
|
+ @Log(title = "电池信息管理", businessType = BusinessType.INSERT)
|
|
|
|
+ public AjaxResult batteryEditTag(@RequestBody TagDto tagDto) {
|
|
|
|
+ String result = batteryService.batteryEditTag(tagDto);
|
|
|
|
+ if (!Constants.OK.equals(result)) {
|
|
|
|
+ return AjaxResult.error(5001, result);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("删除电池标签")
|
|
|
|
+ @PostMapping(value = "/delTag/{id}")
|
|
|
|
+ public AjaxResult batteryDelTag(@PathVariable("id") Long id) {
|
|
|
|
+ String result = batteryService.batteryDelTag(id);
|
|
|
|
+ if (!Constants.OK.equals(result)) {
|
|
|
|
+ return AjaxResult.error(5001, result);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询电池标签")
|
|
|
|
+ @PostMapping(value = "/queryTag")
|
|
|
|
+ public AjaxResult batteryAddTag(@RequestBody BatteryTagParam param) {
|
|
|
|
+ PageInfo<BatteryTagVo> result = batteryService.batteryQueryTag(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询电池历史故障")
|
|
|
|
+ @GetMapping(value = "/historyFault/{sn}")
|
|
|
|
+ public AjaxResult historyFault(@PathVariable("sn") String sn) {
|
|
|
|
+ BatteryHistoryFaultVo result = batteryService.getHistoryFault(sn);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("电池安全诊断")
|
|
|
|
+ @GetMapping(value = "/checkBattery/{sn}")
|
|
|
|
+ public AjaxResult checkBattery(@PathVariable("sn") String sn) {
|
|
|
|
+ BatteryHistoryFaultVo result = batteryService.checkBattery(sn);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("电池列表准备工作")
|
|
|
|
+ @GetMapping(value = "/tagBattery/{type}")
|
|
|
|
+ public AjaxResult getTagBattery(@PathVariable("type") Integer type) {
|
|
|
|
+ List<Tag> result = batteryService.getTagBattery(type);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("电池概览")
|
|
|
|
+ @PostMapping(value = "/overview")
|
|
|
|
+ public AjaxResult getBatteryOverview(@RequestBody BatteryOverviewParam param) {
|
|
|
|
+ BatteryOverviewVo result = batteryService.getBatteryOverview(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询电池标签详情")
|
|
|
|
+ @GetMapping(value = "/batteryTag/{id}")
|
|
|
|
+ public AjaxResult getBatteryTagDetail(@PathVariable("id") Long id) {
|
|
|
|
+ BatteryTagVo result = batteryService.getBatteryTagDetail(id);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("我的电池收藏")
|
|
|
|
+ @PostMapping("/collect")
|
|
|
|
+ public AjaxResult getMyCollectData(@RequestBody BatteryFolderParam param) {
|
|
|
|
+ PageInfo<BatteryFolderVo> result = batteryService.getMyCollectData(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("电池健康度诊断--健康度趋势图")
|
|
|
|
+ @PostMapping("/health")
|
|
|
|
+ public AjaxResult getMyCollectData(@RequestBody BatteryHealthParam param) throws ParseException {
|
|
|
|
+ BatteryHealthVo result = batteryService.getHealthResult(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("导出电池详情数据")
|
|
|
|
+ @GetMapping("/export")
|
|
|
|
+ public void exportExcel(@RequestParam(required = false) String sn,
|
|
|
|
+ @RequestParam(required = false) String startTime,
|
|
|
|
+ @RequestParam(required = true) String vin,
|
|
|
|
+ @RequestParam(required = false) String endTime, HttpServletResponse response) throws Exception {
|
|
|
|
+ BatteryDetailChartParam param = new BatteryDetailChartParam();
|
|
|
|
+ param.setSn(sn);
|
|
|
|
+ param.setStartTime(startTime);
|
|
|
|
+ param.setVin(vin);
|
|
|
|
+ param.setEndTime(endTime);
|
|
|
|
+ batteryService.exportDetailExcel(param, response);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("导出电池详情数据-用电行为")
|
|
|
|
+ @GetMapping("/exportCharge")
|
|
|
|
+ public void exportDetailChargeExcel(@RequestParam(required = false) String sn,
|
|
|
|
+ @RequestParam(required = false) String startTime,
|
|
|
|
+ @RequestParam(required = true) String vin,
|
|
|
|
+ @RequestParam(required = false) String endTime,
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
+ BatteryDetailChartParam param = new BatteryDetailChartParam();
|
|
|
|
+ param.setSn(sn);
|
|
|
|
+ param.setStartTime(startTime);
|
|
|
|
+ param.setVin(vin);
|
|
|
|
+ param.setEndTime(endTime);
|
|
|
|
+ batteryService.exportDetailChargeExcel(param, response);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("导出电池详情数据")
|
|
|
|
+ @GetMapping("/exportHealth")
|
|
|
|
+ public void exportHealthExcel(@RequestParam(required = false) String sn,
|
|
|
|
+ @RequestParam(required = false) String startTime,
|
|
|
|
+ @RequestParam(required = true) String vin,
|
|
|
|
+ @RequestParam(required = false) String endTime,
|
|
|
|
+ HttpServletResponse response) throws Exception {
|
|
|
|
+ BatteryDetailChartParam param = new BatteryDetailChartParam();
|
|
|
|
+ param.setSn(sn);
|
|
|
|
+ param.setStartTime(startTime);
|
|
|
|
+ param.setVin(vin);
|
|
|
|
+ param.setEndTime(endTime);
|
|
|
|
+ batteryService.exportHealthExcel(param, response);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询实时电池位置统计")
|
|
|
|
+ @PostMapping("/getLocation")
|
|
|
|
+ public AjaxResult getLocation() {
|
|
|
|
+ List<BatteryLocationVo> res = batteryService.getBatteryLocation();
|
|
|
|
+ return AjaxResult.success(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询充电电池位置统计")
|
|
|
|
+ @PostMapping("/getChargingLocation")
|
|
|
|
+ public AjaxResult getChargingLocation() {
|
|
|
|
+ List<BatteryLocationVo> res = batteryService.getBatteryChargingLocation();
|
|
|
|
+ return AjaxResult.success(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询电池详细信息-用电行为")
|
|
|
|
+ @PostMapping(value = "/detailCharge")
|
|
|
|
+ public AjaxResult getDetailCharge(@RequestBody BatteryDetailChartParam param) throws ParseException, SQLException {
|
|
|
|
+ BatteryDetailChartVo result = batteryService.getDetailCharge(param);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("查询电池详细信息-用电行为分析")
|
|
|
|
+ @GetMapping(value = "/behavior/{vin}")
|
|
|
|
+ public AjaxResult getBehaviorAnalysis(@PathVariable("vin") String vin) throws SQLException {
|
|
|
|
+ BehaviorAnalysisVo result = batteryService.getBehaviorAnalysis(vin);
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("批量添加电池标签")
|
|
|
|
+ @Log(title = "批量添加电池标签", businessType = BusinessType.INSERT)
|
|
|
|
+ @PostMapping(value = "/batchAddTag")
|
|
|
|
+ public AjaxResult batteryBatchAddTag(@RequestBody TagDto dto) {
|
|
|
|
+ String result = batteryService.batteryBatchAddTag(dto);
|
|
|
|
+ if (!Constants.OK.equals(result)) {
|
|
|
|
+ return AjaxResult.error(5001, result);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("soh里程区间")
|
|
|
|
+ @GetMapping(value = "/sohOdo")
|
|
|
|
+ public AjaxResult calTotalElectricQuantity() {
|
|
|
|
+ batteryService.calTotalElectricQuantity();
|
|
|
|
+ return AjaxResult.success(Constants.OK);
|
|
|
|
+ }
|
|
|
|
+}
|