From add5c816a5281cf6b1df4a0988e8b3a0c2b59bee Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 25 六月 2025 17:37:03 +0800 Subject: [PATCH] 电源表和电池信息表加入新的字段,添加,编辑需要修改 --- src/main/java/com/whyc/controller/BattCompareController.java | 83 ++++++++++++++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/whyc/controller/BattCompareController.java b/src/main/java/com/whyc/controller/BattCompareController.java index 5fc0086..35432dd 100644 --- a/src/main/java/com/whyc/controller/BattCompareController.java +++ b/src/main/java/com/whyc/controller/BattCompareController.java @@ -1,19 +1,21 @@ package com.whyc.controller; import com.whyc.dto.Response; +import com.whyc.dto.SocreHehaviorDto; import com.whyc.dto.Statistic.BattCompareStic; +import com.whyc.pojo.db_param.AppParam; import com.whyc.pojo.db_user.User; +import com.whyc.service.AppParamService; +import com.whyc.service.BattresdataInfService; import com.whyc.service.BatttestdataInfService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.text.ParseException; +import java.util.List; import java.util.Map; @RestController @@ -24,33 +26,78 @@ @Autowired private BatttestdataInfService battTinfService; + @Autowired + private BattresdataInfService battRinfService; - @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛�(1.2.15)") + @Autowired + private AppParamService appParamService; + + @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鏃堕棿鍚屼竴鍝佺墝/鍚屼竴鏃堕棿涓嶅悓涓�鍝佺墝/涓嶅悓涓�鏃堕棿鍚屼竴鍝佺墝锛�(2.5.1/2/3)") @PostMapping("getBattCompare15Statistic") public Response getBattCompare15Statistic(@RequestBody BattCompareStic stic) throws ParseException { User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); - if(stic.getInuserYear()!=null){ + if(stic.getInuseYear()!=null){ int year=ActionUtil.getNowYear(); - stic.setInuseStartTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year+1-stic.getInuserYear(),0,1,5))); + stic.setInuseStartTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year+1-stic.getInuseYear(),0,1,5))); stic.setInuseEndTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year,11,31,5))); } return battTinfService.getBattCompare15Statistic(stic); } - @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堜笉鍚屽搧鐗屽悓涓�鏃堕棿锛�(1.2.16)") - @PostMapping("getBattCompare16Statistic") - public Response getBattCompare16Statistic(@RequestBody BattCompareStic stic){ - User uinf= ActionUtil.getUser(); - stic.setUid(uinf.getId()); - return battTinfService.getBattCompare16Statistic(stic); + @ApiOperation(value = "鐐瑰嚮鍙充晶鎶樼嚎鍥剧敾鍑虹數姹犵粍鎵�鏈夊畬鏁村懆鏈熺殑瀹為檯瀹归噺鍙樺寲鍥�(1.2.15/16/17)") + @GetMapping("getRealCapChangeByBattgroupId") + public Response getRealCapChangeByBattgroupId(@RequestParam Integer battgroupId){ + return battTinfService.getRealCapChangeByBattgroupId(battgroupId); } - @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝涓嶅悓鏃堕棿锛�(1.2.17)") - @PostMapping("getBattCompare17Statistic") - public Response getBattCompare17Statistic(@RequestBody BattCompareStic stic){ + @ApiOperation(value = "鐐瑰嚮鍙充晶鎶樼嚎鍥剧敾鍑虹數姹犵粍鎵�鏈夊畬鏁村懆鏈熺殑娴厖鐢靛帇鍙樺寲鍥�(1.2.15/16/17)") + @GetMapping("getFloatGroupVolChangeByBattgroupId") + public Response getFloatGroupVolChangeByBattgroupId(@RequestParam Integer battgroupId){ + return battTinfService.getFloatGroupVolChangeByBattgroupId(battgroupId); + } + + @ApiOperation(value = "鐐瑰嚮鍙充晶鎶樼嚎鍥剧敾鍑虹數姹犵粍鍗曚綋鐨勬墍鏈夊唴闃绘祴璇曞崟浣撳唴闃诲彉鍖栧浘(1.2.15/16/17)") + @GetMapping("getMonResChangeByBattgroupId") + public Response getMonResChangeByBattgroupId(@RequestParam Integer battgroupId,@RequestParam Integer monNum){ + return battRinfService.getMonResChangeByBattgroupId(battgroupId,monNum); + } + + @ApiOperation(value = "寮圭獥鏍规嵁璁剧疆鐨勬潈閲嶈〃鏍艰瘎鍒�") + @PostMapping("getScoreByHehavior") + public Response getScoreByHehavior(@RequestBody SocreHehaviorDto dto) throws ParseException { User uinf= ActionUtil.getUser(); - stic.setUid(uinf.getId()); - return battTinfService.getBattCompare17Statistic(stic); + dto.setUid(uinf.getId()); + if(dto.getInuseYear()!=null){ + int year=ActionUtil.getNowYear(); + dto.setInuseStartTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year+1-dto.getInuseYear(),0,1,5))); + dto.setInuseEndTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year,11,31,5))); + } + if (dto.getProduct()!=null) { + if(dto.getInuseYear()!=null){ + dto.setSelectType(1); + }else{ + dto.setSelectType(2); + } + }else{ + if(dto.getInuseYear()!=null){ + dto.setSelectType(3); + }else{ + dto.setSelectType(4); + } + } + return battTinfService.getScoreByHehavior(dto); + } + + @ApiOperation(value = "璁剧疆鏉冮噸(1.2.16)") + @PostMapping("setHehavior") + public Response setHehavior(@RequestBody List<AppParam> List){ + return appParamService.setHehavior(List); + } + + @ApiOperation(value = "璇诲彇鏉冮噸(1.2.16)") + @GetMapping("getHehavior") + public Response getHehavior(){ + return appParamService.getHehavior(); } } \ No newline at end of file -- Gitblit v1.9.1