| | |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>3.10.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.afterturn</groupId> |
| | | <artifactId>easypoi-spring-boot-starter</artifactId> |
| | | <version>4.1.2</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.google.guava</groupId> |
| | | <artifactId>guava</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml-schemas</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!--<dependency> |
| | | <groupId>org.springframework.plugin</groupId> |
| | |
| | | @Autowired |
| | | private PwrdevAlarmParamService pwrAlmparamService; |
| | | |
| | | @Autowired |
| | | private BattalarmDataService battalarmDataService; |
| | | |
| | | @Autowired |
| | | private PwrdevAlarmService pwrdevAlarmService; |
| | | |
| | | @Autowired |
| | | private BattRealdataIdService battRealdataIdService; |
| | | |
| | | |
| | | /*@PostMapping("getBattAlmParam") |
| | |
| | | } |
| | | } |
| | | return new Response<List<AlarmParam>>().set(1,list); |
| | | } |
| | | |
| | | @PostMapping("getBattAlmAnalyse") |
| | | @ApiOperation("é¢è¦åæç®¡ç-çµæ± åè¦") |
| | | public Response getBattAlmAnalyse(@RequestBody AlmAnalyseDto dto){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return battalarmDataService.getBattAlmAnalyse(dto); |
| | | } |
| | | |
| | | @GetMapping("getBattHisRealInAlm") |
| | | @ApiOperation("é¢è¦åæç®¡ç-䏻屿§ååæå±æ§") |
| | | public Response getBattHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam String startTime,@RequestParam(required = false) Integer almId) throws ParseException, InterruptedException { |
| | | return battRealdataIdService.getBattHisRealInAlm(battgroupId,startTime,almId); |
| | | } |
| | | |
| | | @PostMapping("getPwrtAlmAnalyse") |
| | | @ApiOperation("é¢è¦åæç®¡ç-çµæºåè¦") |
| | | public Response getPwrtAlmAnalyse(@RequestBody AlmAnalyseDto dto){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return pwrdevAlarmService.getPwrtAlmAnalyse(dto); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.AnalysisAlm.AnalysisChangeRes; |
| | | import com.whyc.dto.Param.AlmAnalyseDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.service.AlmAnalysisParamService; |
| | | import com.whyc.service.BattRealdataIdService; |
| | | import com.whyc.service.BattalarmDataService; |
| | | import com.whyc.service.PwrdevAlarmService; |
| | | 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.*; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | @RequestMapping("analysis") |
| | | @RestController |
| | | @Api(tags = "é¢è¦åæç®¡ç") |
| | | public class AnalysisAlmController { |
| | | @Autowired |
| | | private BattalarmDataService battalarmDataService; |
| | | |
| | | @Autowired |
| | | private PwrdevAlarmService pwrdevAlarmService; |
| | | |
| | | @Autowired |
| | | private AlmAnalysisParamService almAnalysisParamService; |
| | | @PostMapping("getBattAlmAnalyse") |
| | | @ApiOperation("é¢è¦åæç®¡ç-çµæ± åè¦") |
| | | public Response getBattAlmAnalyse(@RequestBody AlmAnalyseDto dto){ |
| | | Integer uid= ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return battalarmDataService.getBattAlmAnalyse(dto); |
| | | } |
| | | |
| | | @PostMapping("getPwrtAlmAnalyse") |
| | | @ApiOperation("é¢è¦åæç®¡ç-çµæºåè¦") |
| | | public Response getPwrtAlmAnalyse(@RequestBody AlmAnalyseDto dto){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return pwrdevAlarmService.getPwrtAlmAnalyse(dto); |
| | | } |
| | | |
| | | @GetMapping("getHisRealInAlm") |
| | | @ApiOperation("é¢è¦åæç®¡ç-çµæºä¸»å±æ§ååæå±æ§") |
| | | public Response getHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam Integer powerId,@RequestParam String startTime,@RequestParam(required = false) Integer almId) throws ParseException, InterruptedException { |
| | | return almAnalysisParamService.getHisRealInAlm(battgroupId,powerId,startTime,almId); |
| | | } |
| | | |
| | | @PostMapping("getHisRealWithChage") |
| | | @ApiOperation("é¢è¦åæç®¡ç-忢æ¶é´é´éåå¯å±æ§") |
| | | public Response getHisRealWithChage(@RequestBody AnalysisChangeRes res) throws ParseException, InterruptedException { |
| | | return almAnalysisParamService.getHisRealWithChage(res); |
| | | } |
| | | |
| | | @PostMapping("getAlmSummaryParam") |
| | | @ApiOperation("é¢è¦åæç®¡ç-æ¥è¯¢ææç屿§å¯¹åºå
³ç³»") |
| | | public Response getAlmSummaryParam(){ |
| | | return almAnalysisParamService.getAlmSummaryParam(); |
| | | } |
| | | |
| | | } |
| | |
| | | @PostMapping("updateStationList") |
| | | @ApiOperation(value = "å
æºç»æ·»å æºæ¿åçµæº|ç§»é¤æºæ¿åçµæº",notes = "operationFlag为1,æ·»å ;-1,ç§»é¤") |
| | | public Response updateStationAndLockList(@RequestBody List<BaojigroupPower> baoJiGroupLockList, @RequestParam int operationFlag){ |
| | | service.updateStationAndLockList(baoJiGroupLockList,operationFlag); |
| | | if(operationFlag==1) { |
| | | return new Response().set(1, true,"æ·»å æå"); |
| | | }else{ |
| | | return new Response().set(1,true,"ç§»é¤æå"); |
| | | } |
| | | |
| | | return service.updateStationAndLockList(baoJiGroupLockList,operationFlag); |
| | | } |
| | | |
| | | |
| | |
| | | return service.add(spare,file); |
| | | } |
| | | |
| | | @PostMapping("addByExcel") |
| | | @ApiOperation("excel导å
¥") |
| | | public Response addByExcel(@RequestParam MultipartFile file) throws IOException { |
| | | return service.addByExcel(file); |
| | | } |
| | | |
| | | |
| | | @PostMapping("update") |
| | | @ApiOperation("ä¿®æ¹") |
| | | public Response update(@RequestBody DeviceSpare spare) { |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Real.ExportTinfDataDto; |
| | | import com.whyc.dto.Statistic.MonStic; |
| | | import com.whyc.service.ExportService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | |
| | | @RestController |
| | |
| | | public void exportBattTinfStatistic(HttpServletRequest req, HttpServletResponse resp ,@RequestBody MonStic stic) throws ParseException { |
| | | service.exportBattTinfStatistic(req,resp,stic); |
| | | } |
| | | |
| | | @PostMapping("exportTinfDataByTestRecordCount") |
| | | @ApiOperation(value = "å岿µè¯æ°æ®å¯¼åº") |
| | | public void exportTinfDataByTestRecordCount(HttpServletRequest req, HttpServletResponse resp ,@RequestBody ExportTinfDataDto dto) throws ParseException, IOException { |
| | | service.exportTinfDataByTestRecordCount(req,resp,dto); |
| | | } |
| | | } |
| | |
| | | import com.whyc.service.WorkflowLinkService; |
| | | import com.whyc.service.WorkflowMainService; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @GetMapping("ownStatistics") |
| | | @ApiOperation(value = "æ¬äººçåæ®ç»è®¡",notes = "statuså«ä¹:1-审æ¹ä¸,2-审æ¹å®æä¸éè¿,3-审æ¹å®æä¸é©³å") |
| | | public Response<Map<Integer,Integer>> getOwnStatistics(int type){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | int userId = CommonUtil.getUser().getId().intValue(); |
| | | return service.getOwnStatistics(userId,type); |
| | | } |
| | | |
| | |
| | | @GetMapping("ownListPage") |
| | | @ApiOperation(value = "æ¬äººçåæ®å表å页",notes = "statusä¼ å:0:å
¨é¨,1-审æ¹ä¸,2-审æ¹å®æä¸éè¿,3-审æ¹å®æä¸é©³å") |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int type,int status,int pageNum,int pageSize){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | int userId = CommonUtil.getUser().getId().intValue(); |
| | | return service.ownListPage(userId,type,status,pageNum,pageSize); |
| | | } |
| | | |
| | |
| | | @GetMapping("receivedStatistics") |
| | | @ApiOperation(value = "æ¥æ¶å°çåæ®ç»è®¡",notes = "statuså«ä¹:1-å¾
æ¥å,6-å¾
å®¡æ ¸,58-å·²å®¡æ ¸") |
| | | public Response<Map<Integer,Integer>> getReceivedStatistics(int type){ |
| | | User user = ActionUtil.getUser(); |
| | | User user = CommonUtil.getUser(); |
| | | return service.getReceivedStatistics(type,user); |
| | | } |
| | | |
| | |
| | | @GetMapping("receivedListPage") |
| | | @ApiOperation(value = "æ¥æ¶å°çåæ®å表å页", notes = "statusä¼ å:0-å
¨é¨,1-å¾
æ¥å,6-å¾
å®¡æ ¸,5|8-å·²å®¡æ ¸(éè¿|驳å)") |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, int pageNum, int pageSize) { |
| | | User user = ActionUtil.getUser(); |
| | | User user = CommonUtil.getUser(); |
| | | return service.getReceivedListPage(type, status, user, pageNum, pageSize); |
| | | } |
| | | |
New file |
| | |
| | | package com.whyc.dto.AnalysisAlm; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AnalysisChangeRes { |
| | | private Integer battgroupId; |
| | | private Integer powerId; |
| | | private String startTime; |
| | | private Integer intervalTime; |
| | | private String dataName1; |
| | | private Integer dataType1; |
| | | private String dataName2; |
| | | private Integer dataType2; |
| | | private String dataName3; |
| | | private Integer dataType3; |
| | | private String dataName4; |
| | | private Integer dataType4; |
| | | private String dataName5; |
| | | private Integer dataType5; |
| | | } |
New file |
| | |
| | | package com.whyc.dto.AnalysisAlm; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class ResAnalysis { |
| | | private Date recordTime; |
| | | private String dataName1; |
| | | private Float dataValue1; |
| | | private Integer dataType1; |
| | | private String dataName2; |
| | | private Float dataValue2; |
| | | private Integer dataType2; |
| | | private String dataName3; |
| | | private Float dataValue3; |
| | | private Integer dataType3; |
| | | private String dataName4; |
| | | private Float dataValue4; |
| | | private Integer dataType4; |
| | | private String dataName5; |
| | | private Float dataValue5; |
| | | private Integer dataType5; |
| | | } |
New file |
| | |
| | | package com.whyc.dto.Real; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExportTinfDataDto { |
| | | private Integer battgroupId; |
| | | private Integer testRecordCount; |
| | | private String picGroupVol; |
| | | private String picBattVol; |
| | | private String picGroupCurr; |
| | | } |
| | |
| | | public class City { |
| | | private String provice; |
| | | private String city; |
| | | private Integer uid; |
| | | private List<Country> countryList; |
| | | } |
| | |
| | | private String provice; |
| | | private String city; |
| | | private String country; |
| | | private Integer uid; |
| | | private List<Station> stationList; |
| | | } |
| | |
| | | @Data |
| | | public class Provice { |
| | | private String provice; |
| | | private Integer uid; |
| | | private List<City> cityList; |
| | | } |
| | |
| | | private String country; |
| | | private String stationName; |
| | | private Integer stationId; |
| | | private Integer uid; |
| | | private List<Power> pinflist; |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_param.AlmSummaryParam; |
| | | |
| | | public interface AlmSummaryParamMapper extends CustomMapper<AlmSummaryParam>{ |
| | | } |
| | |
| | | List<BaojigroupPower> getStationIdListWithDischargePlanFlag(); |
| | | |
| | | List<BaojigroupPower> getListByUserId(Integer userId); |
| | | |
| | | //æ¥è¯¢å
æºç»ä¸ççµæºé½å¨åªäºå
æºç»ä¸ä¸å
æºç»ççç»ç¶ææ¯å¥ |
| | | List<BaojigroupPower> checkPwrIsInBanzu(Integer baoJiGroupId); |
| | | //æ£æµå¦å¨å
¶ä»å
æºç»ä¸åå¨,è¥åå¨åæç¤ºå½åçµæºå·²å¨å
¶ä»çç»(å¯æç¤ºåå¨ççç»åç§°)ä¸åå¨ |
| | | List<BaojigroupPower> checkPower(Integer powerId); |
| | | } |
| | |
| | | //è·åç«ç¹ä¸ççµæ± ç»(䏿) |
| | | List<BattInf> getBattByUid(@Param("uid") Integer uid, @Param("provice") String provice, @Param("city") String city, @Param("country") String country, @Param("stationName") String stationName); |
| | | //æ ¹æ®æ¥è¯¢æ¡ä»¶è·åçµæ± ç»éå |
| | | BattInf getBattgroupIdList(@Param("battgroupId") Integer battgroupId); |
| | | BattInf getBattgroupIdInf(@Param("battgroupId") Integer battgroupId); |
| | | //æ¥è¯¢çµæºä¸ææççµæ± ç»id |
| | | List<Integer> getBattgroupIdList(@Param("powerId") Integer powerId); |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.web_site.DeviceScrap; |
| | | |
| | | public interface DeviceScrapMapper extends CustomMapper<DeviceScrap>{ |
| | | } |
| | |
| | | |
| | | import com.whyc.pojo.web_site.DeviceSpare; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DeviceSpareMapper extends CustomMapper<DeviceSpare>{ |
| | | |
| | | void outBound(List<DeviceSpare> spareList); |
| | | |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private String fullName; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer stationId; |
| | | @TableField(exist = false) |
| | | private Integer powerId; |
| | | |
| | | } |
| | |
| | | package com.whyc.pojo.db_batt_testdata; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ApiModelProperty(value = "åä½å
é»") |
| | | private Float monRes; |
| | | |
| | | @TableField(exist = false) |
| | | private Float realCap; |
| | | |
| | | @TableField(exist = false) |
| | | private Float restCap; |
| | | |
| | | @TableField(exist = false) |
| | | private String percentCap; |
| | | } |
| | |
| | | @ApiModelProperty(value = "æ¯å¦æ¯ææ°æ°æ®") |
| | | private Integer dataNew; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦ææ") |
| | | @ApiModelProperty(value = "æ¯å¦ä¸ºä¸æ¬¡ææçè®°å½1:ææ") |
| | | private Integer dataAvailable; |
| | | |
| | | @ApiModelProperty(value = "è®°å½ç¬æ°") |
| | |
| | | @ApiModelProperty(value = "山西61850çæµæ¾çµæ°æ®æ è¯ã0ï¼çæµæ¾çµï¼1åçµæ¾çµã") |
| | | private Integer testDatatype; |
| | | |
| | | @ApiModelProperty(value = "æ¤æ¬¡æ¾çµåçæµ®å
çµå") |
| | | private Float floatGroupVol; |
| | | |
| | | @TableField(exist = false) |
| | | private String stationName; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date recordDatetime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | @TableField(exist = false) |
| | | private Date recordDatetime1; |
| | | |
| | | @TableField(exist = false) |
| | | private String tableName; |
| | | |
| | | @ApiModelProperty(value = "ç¼å·") |
| | | private Integer recordNum; |
| | | |
New file |
| | |
| | | package com.whyc.pojo.db_param; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * é¢è¦åæç®¡çåæ®µæ»è¡¨ |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2025-06-20 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_param",value ="tb_alm_summary_param") |
| | | @ApiModel(value="AlmSummaryParam对象", description="é¢è¦åæç®¡çåæ®µæ»è¡¨") |
| | | public class AlmSummaryParam implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "èªå¢ä¸»é®") |
| | | @TableId(value = "num", type = IdType.AUTO) |
| | | private Long num; |
| | | |
| | | @ApiModelProperty(value = "åæ®µç±»å[1:ç´æµï¼2ï¼éä¿¡ï¼3é
ç½ 4:çµæ± 5:设å¤]") |
| | | private Integer fieldType; |
| | | |
| | | @ApiModelProperty(value = "åæ®µå±æ§") |
| | | private String fieldName; |
| | | |
| | | @ApiModelProperty(value = "䏿åç§°") |
| | | private String fieldNameZh; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private Long num; |
| | | |
| | | @ApiModelProperty(value = "çµæºID") |
| | | private Long powerId; |
| | | private Integer powerId; |
| | | |
| | | @ApiModelProperty(value = "åè¦ID") |
| | | private Integer almId; |
| | |
| | | private String country; |
| | | @TableField(exist = false) |
| | | private String fullName; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Integer> battgroupIdList; |
| | | } |
| | |
| | | private Integer paramType; |
| | | |
| | | @ApiModelProperty(value = "æ ååæ°å¯¹åºæ°æ®åç§°") |
| | | private Integer paramName; |
| | | private String paramName; |
| | | |
| | | @ApiModelProperty(value = "åºåå¼") |
| | | private Float basisVal; |
| | |
| | | @TableField(exist = false) |
| | | private String baoJiGroupName; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer teamFlag; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @ToString |
| | | @Data |
| | | @TableName(schema = "web_site",value ="tb_device_scrap") |
| | | @ApiModel("设å¤å¨ä»¶æ¥åºåº") |
| | | public class DeviceScrap { |
| | | |
| | | private Integer id; |
| | | @ApiModelProperty("å¨ä»¶åç§°") |
| | | private String name; |
| | | @ApiModelProperty("å¨ä»¶åå·") |
| | | private String model; |
| | | @ApiModelProperty("å¨ä»¶çæ¬") |
| | | private String version; |
| | | @ApiModelProperty("æ°é") |
| | | private Integer quantity; |
| | | @ApiModelProperty("åç") |
| | | private String brand; |
| | | @ApiModelProperty("ç±»å") |
| | | private String type; |
| | | @ApiModelProperty("ä¾åºå") |
| | | private String supplier; |
| | | @ApiModelProperty("æ¥åºç³è¯·äººid") |
| | | private Integer applyUserId; |
| | | @ApiModelProperty("æ¥åºç³è¯·äººåç§°") |
| | | private String applyUserName; |
| | | @ApiModelProperty("æ¥åºæ¶é´") |
| | | private Date createTime; |
| | | @ApiModelProperty("å
³èæ¥åºæµç¨ä¸»è¡¨id,ç¨äºè¿½æº¯") |
| | | private Integer mainId; |
| | | |
| | | } |
| | |
| | | /**å建人id*/ |
| | | @ApiModelProperty("å建人id") |
| | | private Integer createUserId; |
| | | @ApiModelProperty("å建人åç§°") |
| | | private String createUserName; |
| | | /**å建æ¶é´*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | |
| | | */ |
| | | @ApiModelProperty("å·¥åæµç±»å") |
| | | private Integer type; |
| | | |
| | | @TableField(exist = false) |
| | | private String createUserName; |
| | | |
| | | @TableField(exist = false) |
| | | private List<WorkflowLink> linkList; |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.dto.AnalysisAlm.AnalysisChangeRes; |
| | | import com.whyc.dto.AnalysisAlm.ResAnalysis; |
| | | import com.whyc.dto.Real.RealDateDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.mapper.AlmAnalysisParamMapper; |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_data_history.PwrdevHistorydataId; |
| | | import com.whyc.pojo.db_param.AlmAnalysisParam; |
| | | import com.whyc.pojo.db_param.AlmSummaryParam; |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.*; |
| | | import java.util.concurrent.CountDownLatch; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static java.lang.Thread.sleep; |
| | | |
| | | @Service |
| | | public class AlmAnalysisParamService { |
| | | @Autowired(required = false) |
| | | private AlmAnalysisParamMapper mapper; |
| | | |
| | | @Autowired |
| | | private AppParamService appParamService; |
| | | |
| | | @Autowired |
| | | private SubTablePageInfoService subTablePageInfoService; |
| | | |
| | | @Autowired |
| | | private AlmSummaryParamService summaryParamService; |
| | | |
| | | //è·ååè¦almId对åºçåæé
ç½®å±æ§å¼ |
| | | public AlmAnalysisParam getAnalysisParam(Integer almId) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | |
| | | AlmAnalysisParam param= mapper.selectOne(wrapper); |
| | | return param; |
| | | } |
| | | |
| | | //é¢è¦åæç®¡ç-çµæºä¸»å±æ§ååæå±æ§ |
| | | public Response getHisRealInAlm(Integer battgroupId,Integer powerId, String startTime, Integer almId) throws ParseException, InterruptedException { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("batt",null); |
| | | map.put("pwr",null); |
| | | //è·åé¢è¦åæå¨æéå¼ |
| | | AppParam appParam = appParamService.getAlarmAnalysisCycle(); |
| | | Integer cycleTime=appParam.getParamValue().intValue(); |
| | | Date cyscleDate=ActionUtil.getDateAdd(ThreadLocalUtil.parse(startTime,1),cycleTime*(-1)); |
| | | //è·åcyscleDateå°ç°å¨ææçåå²å®æ¶æ°æ® |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(cyscleDate,new Date()); |
| | | //è·ååè¦almId对åºçåæé
ç½®å±æ§å¼ |
| | | AlmAnalysisParam almAnalysisParam=getAnalysisParam(almId); |
| | | if(almAnalysisParam==null||almAnalysisParam.getMainFieldType()==null){ |
| | | return new Response().set(1,false,"æ 对åºåæå±æ§"); |
| | | }else{ |
| | | //åç»æ¥çéè¦æ¥è¯¢çµæº/çµæ± 宿¶è¡¨çåªäºæ°æ® |
| | | Map<String, Map<String,Integer>> groupmap=groupPwrAndBatt(almAnalysisParam); |
| | | Map<String,Integer> battMap=groupmap.get("batt"); |
| | | Map<String,Integer> pwrMap=groupmap.get("pwr"); |
| | | if(battgroupId!=null){ |
| | | if(battMap!=null&&battMap.size()>0){ |
| | | List battHislist=getBattRealData(battgroupId,monthTimeList,battMap); |
| | | map.put("batt",battHislist); |
| | | } |
| | | } |
| | | if(powerId!=null){ |
| | | if(pwrMap!=null&&pwrMap.size()>0){ |
| | | List pwrHislist=getPwrRealData(powerId,monthTimeList,pwrMap); |
| | | map.put("pwr",pwrHislist); |
| | | } |
| | | } |
| | | return new Response().setII(1,true, map,"é¢è¦åæç®¡ç-çµæºä¸»å±æ§ååæå±æ§"); |
| | | } |
| | | } |
| | | //åç»æ¥çéè¦æ¥è¯¢çµæº/çµæ± 宿¶è¡¨çåªäºæ°æ® |
| | | private Map<String, Map<String,Integer>> groupPwrAndBatt(AlmAnalysisParam almAnalysisParam) { |
| | | Map<String, Map<String,Integer>> map = new HashMap<>(); |
| | | Map<String,Integer> battMap=new HashMap<>(); |
| | | Map<String,Integer> pwrMap=new HashMap<>(); |
| | | if(almAnalysisParam.getMainFieldType()==1||almAnalysisParam.getMainFieldType()==2||almAnalysisParam.getMainFieldType()==3){ |
| | | if(almAnalysisParam.getMainField()!=null||almAnalysisParam.getMainField().length()>0){ |
| | | pwrMap.put(almAnalysisParam.getMainField(),almAnalysisParam.getMainFieldType()); |
| | | } |
| | | }else{ |
| | | if(almAnalysisParam.getMainField()!=null||almAnalysisParam.getMainField().length()>0){ |
| | | battMap.put(almAnalysisParam.getMainField(),almAnalysisParam.getMainFieldType()); |
| | | } |
| | | } |
| | | if(almAnalysisParam.getMinorField1Type()==1||almAnalysisParam.getMinorField1Type()==2||almAnalysisParam.getMinorField1Type()==3){ |
| | | if(almAnalysisParam.getMinorField1()!=null&&almAnalysisParam.getMinorField1().length()>0){ |
| | | pwrMap.put(almAnalysisParam.getMinorField1(),almAnalysisParam.getMinorField1Type()); |
| | | } |
| | | }else{ |
| | | if(almAnalysisParam.getMinorField1()!=null&&almAnalysisParam.getMinorField1().length()>0){ |
| | | battMap.put(almAnalysisParam.getMinorField1(),almAnalysisParam.getMinorField1Type()); |
| | | } |
| | | } |
| | | if(almAnalysisParam.getMinorField2Type()==1||almAnalysisParam.getMinorField2Type()==2||almAnalysisParam.getMinorField2Type()==3){ |
| | | if(almAnalysisParam.getMinorField2()!=null&&almAnalysisParam.getMinorField2().length()>0){ |
| | | pwrMap.put(almAnalysisParam.getMinorField2(),almAnalysisParam.getMinorField2Type()); |
| | | } |
| | | }else{ |
| | | if(almAnalysisParam.getMinorField2()!=null&&almAnalysisParam.getMinorField2().length()>0){ |
| | | battMap.put(almAnalysisParam.getMinorField2(),almAnalysisParam.getMinorField2Type()); |
| | | } |
| | | } |
| | | if(almAnalysisParam.getMinorField3Type()==1||almAnalysisParam.getMinorField3Type()==2||almAnalysisParam.getMinorField3Type()==3){ |
| | | if(almAnalysisParam.getMinorField3()!=null&&almAnalysisParam.getMinorField3().length()>0){ |
| | | pwrMap.put(almAnalysisParam.getMinorField3(),almAnalysisParam.getMinorField3Type()); |
| | | } |
| | | }else{ |
| | | if(almAnalysisParam.getMinorField3()!=null&&almAnalysisParam.getMinorField3().length()>0){ |
| | | battMap.put(almAnalysisParam.getMinorField3(),almAnalysisParam.getMinorField3Type()); |
| | | } |
| | | } |
| | | if(almAnalysisParam.getMinorField4Type()==1||almAnalysisParam.getMinorField4Type()==2||almAnalysisParam.getMinorField4Type()==3){ |
| | | if(almAnalysisParam.getMinorField4()!=null&&almAnalysisParam.getMinorField4().length()>0){ |
| | | pwrMap.put(almAnalysisParam.getMinorField4(),almAnalysisParam.getMinorField4Type()); |
| | | } |
| | | }else{ |
| | | if(almAnalysisParam.getMinorField4()!=null&&almAnalysisParam.getMinorField4().length()>0){ |
| | | battMap.put(almAnalysisParam.getMinorField4(),almAnalysisParam.getMinorField4Type()); |
| | | } |
| | | } |
| | | map.put("pwr",pwrMap); |
| | | map.put("batt",battMap); |
| | | return map; |
| | | } |
| | | //è¿æ¥æ± è·åçµæºåå²å®æ¶æ°æ® |
| | | public List getPwrRealData(Integer powerId,List<List<Date>> monthTimeList,Map<String,Integer> pwrMap) throws InterruptedException { |
| | | List<ResAnalysis> dataList = new LinkedList<>(); |
| | | ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(monthTimeList.size()); |
| | | for (int i = 0; i < monthTimeList.size(); i++) { |
| | | int finalI = i; |
| | | pool.execute(() -> { |
| | | int finalII = finalI; |
| | | PwrdevHistorydataId pwrHis = new PwrdevHistorydataId(); |
| | | pwrHis.setRecordDatetime(monthTimeList.get(finalII).get(0)); |
| | | pwrHis.setRecordDatetime1(monthTimeList.get(finalII).get(1)); |
| | | String table = powerId + "_" + ThreadLocalUtil.format(pwrHis.getRecordDatetime(),2); |
| | | pwrHis.setTableName(table);//è¡¨åæ¶é´æ ¼å¼é¨å |
| | | //å¤æè¡¨æ¯å¦åå¨ |
| | | int tableNum = subTablePageInfoService.judgeTable_pwrhis(table); |
| | | List<ResAnalysis> list = new ArrayList(); |
| | | if (tableNum > 0) { |
| | | list = subTablePageInfoService.getPwrHisRealInAlm(pwrHis,pwrMap); |
| | | } |
| | | dataList.addAll(list); |
| | | latch.countDown(); |
| | | }); |
| | | sleep(200); |
| | | } |
| | | latch.await(10, TimeUnit.MINUTES); |
| | | List dataListSorted = dataList.stream().sorted(Comparator.comparing(ResAnalysis::getRecordTime)).collect(Collectors.toList()); |
| | | return dataListSorted; |
| | | } |
| | | |
| | | //çµæ± åè¦ç¹å»å
·ä½åè¦ä¿¡æ¯æ¥çä»åè¦å¼å§æ¶é´å°ç°å¨çåå²å®æ¶æ°æ® |
| | | public List getBattRealData(Integer battgroupId, List<List<Date>> monthTimeList,Map<String,Integer> battMap) throws ParseException, InterruptedException { |
| | | List<ResAnalysis> dataList = new LinkedList<>(); |
| | | ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(monthTimeList.size()); |
| | | for (int i = 0; i < monthTimeList.size(); i++) { |
| | | int finalI = i; |
| | | pool.execute(() -> { |
| | | int finalII = finalI; |
| | | BattRealdataId realdata = new BattRealdataId(); |
| | | realdata.setRecordTime(monthTimeList.get(finalII).get(0)); |
| | | realdata.setRecordTime1(monthTimeList.get(finalII).get(1)); |
| | | String table = battgroupId + "_" + ThreadLocalUtil.format(realdata.getRecordTime(),2); |
| | | realdata.setTableName(table);//è¡¨åæ¶é´æ ¼å¼é¨å |
| | | //å¤æè¡¨æ¯å¦åå¨ |
| | | int tableNum = subTablePageInfoService.judgeTable_realdata(table); |
| | | List<ResAnalysis> list = new ArrayList(); |
| | | if (tableNum > 0) { |
| | | list = subTablePageInfoService.getBattHisRealInAlm(realdata,battMap); |
| | | } |
| | | dataList.addAll(list); |
| | | latch.countDown(); |
| | | }); |
| | | sleep(200); |
| | | } |
| | | latch.await(10, TimeUnit.MINUTES); |
| | | List dataListSorted = dataList.stream().sorted(Comparator.comparing(ResAnalysis::getRecordTime)).collect(Collectors.toList()); |
| | | return dataListSorted; |
| | | } |
| | | //é¢è¦åæç®¡ç-忢æ¶é´é´éåå¯å±æ§ |
| | | public Response getHisRealWithChage(AnalysisChangeRes res) throws ParseException, InterruptedException { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("batt",null); |
| | | map.put("pwr",null); |
| | | Integer cycleTime=0; |
| | | //è·åé¢è¦åæå¨æéå¼ |
| | | AppParam appParam = appParamService.getAlarmAnalysisCycle(); |
| | | if(res.getIntervalTime()==null){ |
| | | cycleTime=appParam.getParamValue().intValue(); |
| | | }else{ |
| | | //å°æ°æ®åºä¸æ¶é´é´éä¿®æ¹ |
| | | appParamService.updateAlarmAnalysisCycle(res.getIntervalTime()); |
| | | cycleTime=res.getIntervalTime(); |
| | | } |
| | | Date cyscleDate=ActionUtil.getDateAdd(ThreadLocalUtil.parse(res.getStartTime(),1),cycleTime*(-1)); |
| | | //è·åcyscleDateå°ç°å¨ææçåå²å®æ¶æ°æ® |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(cyscleDate,new Date()); |
| | | |
| | | //è·ååè¦almId对åºçåæé
ç½®å±æ§å¼ |
| | | AlmAnalysisParam almAnalysisParam=new AlmAnalysisParam(); |
| | | //å°å±æ§æ·è´è³almAnalysisParamä¸ |
| | | copyProperties(almAnalysisParam,res); |
| | | //åç»æ¥çéè¦æ¥è¯¢çµæº/çµæ± 宿¶è¡¨çåªäºæ°æ® |
| | | Map<String, Map<String,Integer>> groupmap=groupPwrAndBatt(almAnalysisParam); |
| | | Map<String,Integer> battMap=groupmap.get("batt"); |
| | | Map<String,Integer> pwrMap=groupmap.get("pwr"); |
| | | if(res.getBattgroupId()!=null){ |
| | | if(battMap!=null&&battMap.size()>0){ |
| | | List battHislist=getBattRealData(res.getBattgroupId(),monthTimeList,battMap); |
| | | map.put("batt",battHislist); |
| | | } |
| | | } |
| | | if(res.getPowerId()!=null){ |
| | | if(pwrMap!=null&&pwrMap.size()>0){ |
| | | List pwrHislist=getPwrRealData(res.getPowerId(),monthTimeList,pwrMap); |
| | | map.put("pwr",pwrHislist); |
| | | } |
| | | } |
| | | return new Response().setII(1,true, map,"é¢è¦åæç®¡ç-忢æ¶é´é´éåå¯å±æ§"); |
| | | } |
| | | //å°å±æ§æ·è´è³almAnalysisParamä¸ |
| | | private void copyProperties(AlmAnalysisParam almAnalysisParam, AnalysisChangeRes res) { |
| | | almAnalysisParam.setMainField(res.getDataName1()); |
| | | almAnalysisParam.setMainFieldType(res.getDataType1()); |
| | | almAnalysisParam.setMinorField1(res.getDataName2()); |
| | | almAnalysisParam.setMinorField1Type(res.getDataType2()); |
| | | almAnalysisParam.setMinorField2(res.getDataName3()); |
| | | almAnalysisParam.setMinorField2Type(res.getDataType3()); |
| | | almAnalysisParam.setMinorField3(res.getDataName4()); |
| | | almAnalysisParam.setMinorField3Type(res.getDataType4()); |
| | | almAnalysisParam.setMinorField4(res.getDataName5()); |
| | | almAnalysisParam.setMinorField4Type(res.getDataType5()); |
| | | } |
| | | //é¢è¦åæç®¡ç-æ¥è¯¢ææç屿§å¯¹åºå
³ç³» |
| | | public Response getAlmSummaryParam() { |
| | | //æ»ç屿§é
ç½® |
| | | List<AlmSummaryParam> summaryList=summaryParamService.getInfo(); |
| | | return new Response().setII(1,true,summaryList,"é¢è¦åæç®¡ç-æ¥è¯¢ææç屿§å¯¹åºå
³ç³»"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.mapper.AlmAnalysisParamMapper; |
| | | import com.whyc.mapper.AlmSummaryParamMapper; |
| | | import com.whyc.pojo.db_param.AlmSummaryParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class AlmSummaryParamService { |
| | | @Autowired(required = false) |
| | | private AlmSummaryParamMapper mapper; |
| | | //æ»ç屿§é
ç½® |
| | | public List<AlmSummaryParam> getInfo() { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.orderByAsc("num"); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | } |
| | |
| | | AppParam param=mapper.selectOne(wrapper); |
| | | return param; |
| | | } |
| | | //å°æ°æ®åºä¸æ¶é´é´éä¿®æ¹ |
| | | public void updateAlarmAnalysisCycle(Integer intervalTime) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("param_name_psx","alm_analysis_already_time"); |
| | | wrapper.set("param_value",intervalTime); |
| | | mapper.update(null,wrapper); |
| | | } |
| | | } |
| | |
| | | } |
| | | return new Response().setII(1,baojiList!=null,baojiList,"æ¥è¯¢å
æºç»åå
æºç»å¯¹åºçç¨æ·åå¯¹åºæºæ¿åé"); |
| | | } |
| | | //å
æºç»æ·»å æºæ¿åé|ç§»é¤æºæ¿åé |
| | | //å
æºç»æ·»å æºæ¿åçµæº|ç§»é¤æºæ¿åçµæº |
| | | //â¡)å°çµæºæ·»å å°çç»å
æºç»ä¸æ¶éæ£æ¥è¯¥çµæºæ¯å¦å¨å
¶ä»å
æºç»ä¸åå¨,è¥åå¨åæç¤ºå½åçµæºå·²å¨å
¶ä»çç»(å¯æç¤ºåå¨ççç»åç§°)ä¸åå¨ï¼è¥ä¸åå¨åæ§è¡æ·»å é»è¾ã |
| | | @Transactional |
| | | public void updateStationAndLockList(List<BaojigroupPower> BaojigroupPowerList, int operationFlag) { |
| | | public Response updateStationAndLockList(List<BaojigroupPower> BaojigroupPowerList, int operationFlag) { |
| | | if(operationFlag==1){ |
| | | bjPowermapper.insertBatchSomeColumn(BaojigroupPowerList); |
| | | List<BaojigroupPower> addList=new ArrayList<>(); |
| | | List<BaojigroupPower> unaddList=new ArrayList<>(); |
| | | for (BaojigroupPower bjp:BaojigroupPowerList) { |
| | | //æ£æµå¦å¨å
¶ä»å
æºç»ä¸åå¨,è¥åå¨åæç¤ºå½åçµæºå·²å¨å
¶ä»çç»(å¯æç¤ºåå¨ççç»åç§°)ä¸åå¨ |
| | | int flag=checkPowerIsInBanzu(bjp.getPowerId()); |
| | | if(flag==1){ |
| | | unaddList.add(bjp); |
| | | return new Response().setII(1,false,unaddList,"åå¨çµæºå·²æ·»å è¿çç»"); |
| | | } |
| | | } |
| | | bjPowermapper.insertBatchSomeColumn(addList); |
| | | return new Response().set(1, true,"æ·»å æå"); |
| | | |
| | | }else{ |
| | | bjPowermapper.deleteStationAndLockList(BaojigroupPowerList); |
| | | return new Response().set(1,true,"ç§»é¤æå"); |
| | | } |
| | | } |
| | | //æ£æµå¦å¨å
¶ä»å
æºç»ä¸åå¨,è¥åå¨åæç¤ºå½åçµæºå·²å¨å
¶ä»çç»(å¯æç¤ºåå¨ççç»åç§°)ä¸åå¨ |
| | | private int checkPowerIsInBanzu(Integer powerId) { |
| | | int flag=0; |
| | | List<BaojigroupPower> List=bjPowermapper.checkPower(powerId); |
| | | if(List!=null&&List.size()>0){ |
| | | List<Integer> flagList=List.stream().map(BaojigroupPower::getTeamFlag).collect(Collectors.toList()); |
| | | if (flagList != null && flagList.contains(1)) { |
| | | flag=1; |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | //å
æºç»æ·»å ç¨æ·|ç§»é¤ç¨æ· |
| | | @Transactional |
| | | public void updateUserList(List<BaojigroupUsr> baoJiGroupUserList, int operationFlag) { |
| | |
| | | List<BaojigroupUsr> list=bjUsrmapper.selectList(wrapper); |
| | | return list.size()>0?1:0 ; |
| | | } |
| | | //设置å
æºç»æ è®° |
| | | /*设置å
æºç»æ è®° |
| | | * â å°å
æºç»è®¾ç½®æçç»æ¶ï¼å¤æå½åå
æºç»å
ççµæºæ¯å¦å¨å
¶ä»è®¾ç½®æçç»çå
æºç»å
ï¼è¥å¨åæç¤ºå½åçµæºå·²å¨å
¶ä»çç»ä¸ãå¦åæ§è¡è®¾ç½®çç»é»è¾ã |
| | | * |
| | | * */ |
| | | public Response updateTeamFlag(Integer baoJiGroupId, Integer flag) { |
| | | if(flag==1) { |
| | | //æ¥è¯¢è¦è®¾ç½®çå
æºç»çç«ç¹ |
| | | QueryWrapper<BaojigroupPower> query = Wrappers.query(); |
| | | query.select("baoji_group_id", "station_id").eq("baoji_group_id", baoJiGroupId); |
| | | List<BaojigroupPower> stationIdList = bjPowermapper.selectList(query); |
| | | stationIdList = stationIdList.stream().distinct().collect(Collectors.toList()); |
| | | //æ¥è¯¢å
¶ä»çç»,å
å«çææç«ç¹ |
| | | List<BaojigroupPower> stationIdListWithDischargePlanFlag = bjPowermapper.getStationIdListWithDischargePlanFlag(); |
| | | stationIdListWithDischargePlanFlag = stationIdListWithDischargePlanFlag.stream().distinct().collect(Collectors.toList()); |
| | | List<BaojigroupPower> repeatedStationIdList = new LinkedList<>(); |
| | | for (int i = 0; i < stationIdList.size(); i++) { |
| | | BaojigroupPower baojiGroupBattGroup = stationIdList.get(i); |
| | | for (int j = 0; j < stationIdListWithDischargePlanFlag.size(); j++) { |
| | | BaojigroupPower baojiGroupBattGroupWithFlag = stationIdListWithDischargePlanFlag.get(j); |
| | | if (baojiGroupBattGroupWithFlag.getStationId().equals(baojiGroupBattGroup.getStationId())) { |
| | | repeatedStationIdList.add(baojiGroupBattGroupWithFlag); |
| | | break; |
| | | } |
| | | if(flag==1){ |
| | | //1æ£æµå½åå
æºç»ä¸ççµæºæ¯å¦å¨å
¶ä»å
æºç»ä¸åå¨ï¼åæ¥ç该å
æºç»æ¯å¦ä¸ºçç» |
| | | List<BaojigroupPower> powerList=bjPowermapper.checkPwrIsInBanzu(baoJiGroupId); |
| | | //2.è¥åå¨ä¸æ¡åè¿åï¼è¥ä¸åå¨ä¿®æ¹ä¸ºçç» |
| | | if(powerList!=null&&powerList.size()>0){ |
| | | List<Integer> flagList=powerList.stream().map(BaojigroupPower::getTeamFlag).collect(Collectors.toList()); |
| | | if (flagList != null && flagList.contains(1)) { |
| | | return new Response().set(1,false,"å½åå
ç»ä¸çµæºå·²åå¨çç»ä¸"); |
| | | } |
| | | } |
| | | //æ¥è¯¢éå¤ç«ç¹çä¿¡æ¯ |
| | | if (repeatedStationIdList.size() > 0) { |
| | | return new Response().setII(1, false, repeatedStationIdList, "设置失败"); |
| | | } |
| | | } |
| | | UpdateWrapper<Baojigroup> update = Wrappers.update(); |
| | | update.set("team_flag",flag).eq("baoji_group_id",baoJiGroupId); |
| | | mapper.update((Baojigroup) ActionUtil.objeNull,update); |
| | | UpdateWrapper wrapper = new UpdateWrapper(); |
| | | wrapper.set("team_flag",flag); |
| | | wrapper.eq("baoji_group_id",baoJiGroupId); |
| | | mapper.update(null,wrapper); |
| | | return new Response().set(1,true,"è®¾ç½®å®æ"); |
| | | } |
| | | //å é¤å
æºç»ä¸ççµæº |
| | |
| | | private BattInfService binfService; |
| | | //è·åçµæ± åè¦åæ° |
| | | public Response getBattAlmParam(ParamAlmDto dto) { |
| | | //æ ¹æ®æ¥è¯¢æ¡ä»¶è·åçµæ± ç»éå |
| | | BattInf binf=binfService.getBattgroupIdList(dto.getBattgroupId()); |
| | | //æ ¹æ®æ¥è¯¢æ¡ä»¶è·åçµæ± ç» |
| | | BattInf binf=binfService.getBattgroupIdInf(dto.getBattgroupId()); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",dto.getBattgroupId()); |
| | | if(dto.getAlmIdList()!=null){ |
| | |
| | | List<BattInf> list=mapper.getBattByUid(uid,provice,city,country,stationName); |
| | | return new Response().setII(1,list.size()>0,list,"è·åç«ç¹ä¸ççµæ± ç»(䏿)"); |
| | | } |
| | | //æ ¹æ®æ¥è¯¢æ¡ä»¶è·åçµæ± ç»éå |
| | | public BattInf getBattgroupIdList(Integer battgroupId) { |
| | | return mapper.getBattgroupIdList(battgroupId); |
| | | //æ ¹æ®æ¥è¯¢æ¡ä»¶è·åçµæ± ç» |
| | | public BattInf getBattgroupIdInf(Integer battgroupId) { |
| | | return mapper.getBattgroupIdInf(battgroupId); |
| | | } |
| | | //æ¥è¯¢çµæºä¸ææççµæ± ç»id |
| | | public List<Integer> getBattgroupIdList(Integer powerId) { |
| | | return mapper.getBattgroupIdList(powerId); |
| | | } |
| | | } |
| | |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_param.AlmAnalysisParam; |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.pojo.db_ram_db.BattRtstate; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | |
| | | @Autowired |
| | | private BattInfService binfService; |
| | | |
| | | @Autowired |
| | | private AlmAnalysisParamService almAnalysisParamService; |
| | | @Autowired(required = false) |
| | | private BattRtstateService rtstateService; |
| | | |
| | | @Autowired |
| | | private AppParamService appParamService; |
| | | |
| | | |
| | | //è·åçµæ± ç»æè¿ä¸å£åº¦çå使°æ® |
| | |
| | | } |
| | | //åå²å®æ¶æ°æ® |
| | | public Response getBattRealDataHis(Integer battgroupId, Integer granularity,String startTime,String endTime) throws ParseException, InterruptedException { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | //宿¶è·åçµæ± ç»ä¿¡æ¯ |
| | | BattRtstate battRtstate = rtstateService.getBattRealInfo(battgroupId); |
| | | //è·åçµæ± ç»ä¿¡æ¯ |
| | | BattInf binf = binfService.getBinfByBattgroupId(battgroupId); |
| | | map.put("æ 称容é",binf.getMoncapstd()); |
| | | map.put("èçµæ± æ°é",binf.getMoncount()); |
| | | map.put("æ ç§°çµå",binf.getMonvolstd()); |
| | | map.put("æµ®å
çµå",battRtstate.getGroupVol()); |
| | | |
| | | List<RealDateDTO> dataList = new LinkedList<>(); |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(ThreadLocalUtil.parse(startTime,1), ThreadLocalUtil.parse(endTime,1)); |
| | | ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | |
| | | } |
| | | latch.await(10, TimeUnit.MINUTES); |
| | | List dataListSorted = dataList.stream().sorted(Comparator.comparing(RealDateDTO::getRecordTime)).collect(Collectors.toList()); |
| | | return new Response().set(1, dataListSorted); |
| | | } |
| | | //çµæ± åè¦ç¹å»å
·ä½åè¦ä¿¡æ¯æ¥çä»åè¦å¼å§æ¶é´å°ç°å¨çåå²å®æ¶æ°æ® |
| | | public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer almId) throws ParseException, InterruptedException { |
| | | //è·ååè¦almId对åºçåæé
ç½®å±æ§å¼ |
| | | AlmAnalysisParam almAnalysisParam= almAnalysisParamService.getAnalysisParam(almId); |
| | | List<RealDateDTO> dataList = new LinkedList<>(); |
| | | //è·åé¢è¦åæå¨æéå¼ |
| | | AppParam appParam = appParamService.getAlarmAnalysisCycle(); |
| | | Integer cycleTime=appParam.getParamValue().intValue(); |
| | | Date cyscleDate=ActionUtil.getDateAdd(ThreadLocalUtil.parse(startTime,1),cycleTime*(-1)); |
| | | //è·åcyscleDateå°ç°å¨ææçåå²å®æ¶æ°æ® |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(cyscleDate,new Date()); |
| | | ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(monthTimeList.size()); |
| | | for (int i = 0; i < monthTimeList.size(); i++) { |
| | | int finalI = i; |
| | | pool.execute(() -> { |
| | | int finalII = finalI; |
| | | BattRealdataId realdata = new BattRealdataId(); |
| | | realdata.setRecordTime(monthTimeList.get(finalII).get(0)); |
| | | realdata.setRecordTime1(monthTimeList.get(finalII).get(1)); |
| | | String table = battgroupId + "_" + ThreadLocalUtil.format(realdata.getRecordTime(),2); |
| | | realdata.setTableName(table);//è¡¨åæ¶é´æ ¼å¼é¨å |
| | | //å¤æè¡¨æ¯å¦åå¨ |
| | | int tableNum = subTablePageInfoService.judgeTable_realdata(table); |
| | | List<RealDateDTO> list = new ArrayList(); |
| | | if (tableNum > 0) { |
| | | list = subTablePageInfoService.getBattHisRealInAlm(realdata); |
| | | } |
| | | dataList.addAll(list); |
| | | latch.countDown(); |
| | | }); |
| | | sleep(200); |
| | | } |
| | | latch.await(10, TimeUnit.MINUTES); |
| | | List dataListSorted = dataList.stream().sorted(Comparator.comparing(RealDateDTO::getRecordTime)).collect(Collectors.toList()); |
| | | return new Response().setIII(1,true, dataListSorted,almAnalysisParam,"çµæ± åè¦ç¹å»å
·ä½åè¦ä¿¡æ¯æ¥çä»åè¦å¼å§æ¶é´å°ç°å¨çåå²å®æ¶æ°æ®"); |
| | | |
| | | return new Response().setIII(1, dataListSorted!=null,dataListSorted,map,"åå²å®æ¶æ¥è¯¢"); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.factory.BattCapFactory; |
| | | import com.whyc.mapper.BatttestdataInfMapper; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.pojo.db_batt_testdata.BatttestdataId; |
| | | import com.whyc.pojo.db_batt_testdata.BatttestdataInf; |
| | | import com.whyc.pojo.db_station.BattInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Resource |
| | | private CommonMapper commonMapper; |
| | | |
| | | @Autowired |
| | | private BatttestdataInfService tinfService; |
| | | |
| | | @Autowired |
| | | private BattInfService binfService; |
| | | //æ¾è¿æ¬¡æ¾çµçæå®çä¸ç¬æ°æ® |
| | | public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) { |
| | | List<BatttestdataId> list=subTablePageInfoService.getLastDataByBattgroupId(battgroupId, testRecordCount, recordNum); |
| | |
| | | return new Response().set(1,false,battgroupId+"çµæ± ç»æ¾ä¸å°ç¬¬"+testRecordCount+"次æ¾çµè®°å½"); |
| | | } |
| | | List<BatttestdataId> list=subTablePageInfoService.getTinfDataWithTestRecordCount(tableName,testRecordCount,recordNum,granularity); |
| | | //è·åçµæ± ç»ä¿¡æ¯ |
| | | BattInf binf = binfService.getBinfByBattgroupId(battgroupId); |
| | | //è·åè¿ä¸æ¬¡çæ¾çµä¿¡æ¯ |
| | | BatttestdataInf tinf=tinfService.getTinfByTestRecordCount(battgroupId,testRecordCount); |
| | | int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); |
| | | for (BatttestdataId data:list) { |
| | | Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); |
| | | Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); |
| | | data.setRealCap(realCap); |
| | | data.setRestCap(restcap); |
| | | data.setPercentCap(String.format("%.5f",(realCap/binf.getMoncapstd()*100))); |
| | | } |
| | | return new Response().setII(1,list.size()>0,list,"è·åå岿µè¯è®°å½æ°æ®è¯¦æ
"); |
| | | } |
| | | } |
| | |
| | | wrapper.eq("battgroup_id", battgroupId); |
| | | wrapper.eq("test_type", 3); |
| | | wrapper.eq("test_starttype", 3); |
| | | wrapper.last(" and test_timelong >= 7200 ORDER BY test_starttime DESC "); |
| | | wrapper.eq("data_available", 1);//䏿¬¡ææçè®°å½ |
| | | wrapper.last(" ORDER BY test_starttime DESC "); |
| | | wrapper.last("limit 1"); |
| | | BatttestdataInf tinf = mapper.selectOne(wrapper); |
| | | tinf.setTestStoptypeReason(StopReasonEnum.getValue(tinf.getTestStoptype())); |
| | |
| | | if(testEndTime!=null){ |
| | | wrapper.lt("test_starttime",testEndTime); |
| | | } |
| | | wrapper.last(" and test_timelong >= 7200 ORDER BY test_starttime DESC "); |
| | | wrapper.last("limit 1"); |
| | | wrapper.eq("data_available", 1);//䏿¬¡ææçè®°å½ |
| | | wrapper.last(" ORDER BY test_starttime DESC "); |
| | | wrapper.last(" limit 1 "); |
| | | BatttestdataInf tinf = mapper.selectOne(wrapper); |
| | | return tinf; |
| | | } |
| | |
| | | dto.setMoncapstd(binf.getMoncapstd()); |
| | | dto.setMonCount(binf.getMoncount()); |
| | | dto.setMonvolstd(binf.getMonvolstd()); |
| | | dto.setFloatchartVol(tinf.getFloatGroupVol()); |
| | | if(battRtstate!=null){ |
| | | Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), realCap, binf.getMoncapstd()); |
| | | dto.setRestTime(restTime); |
| | | dto.setFloatchartVol(battRtstate.getGroupVol()); |
| | | }else{ |
| | | dto.setRestTime(0f); |
| | | dto.setFloatchartVol(0f); |
| | | } |
| | | //æ¾è¿æ¬¡æ¾çµçæå®ä¸ç¬æ°æ® |
| | | List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),1); |
| | |
| | | public int getHrDisCount(Integer userId, Date startTime, Date endTime) { |
| | | return mapper.getHrDisCount(userId, startTime, endTime); |
| | | } |
| | | //è·åè¿ä¸æ¬¡çæ¾çµä¿¡æ¯ |
| | | public BatttestdataInf getTinfByTestRecordCount(Integer battgroupId, Integer testRecordCount) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.eq("test_record_count",testRecordCount); |
| | | wrapper.last(" limit 1"); |
| | | return mapper.selectOne(wrapper); |
| | | } |
| | | //å岿µè¯æ°æ®å¯¼åº |
| | | public BatttestdataInf exportTinfDataByTestRecordCount(Integer battgroupId, Integer testRecordCount) { |
| | | QueryWrapper wrapper =new QueryWrapper(); |
| | | wrapper.eq("battgroup_id",battgroupId); |
| | | wrapper.eq("test_record_count",testRecordCount); |
| | | wrapper.last(" limit 1"); |
| | | return mapper.selectOne(wrapper); |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.mapper.DeviceScrapMapper; |
| | | import com.whyc.pojo.web_site.DeviceScrap; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class DeviceScrapService { |
| | | |
| | | @Resource |
| | | private DeviceScrapMapper mapper; |
| | | |
| | | public void add(List<DeviceScrap> scrapList) { |
| | | mapper.insertBatchSomeColumn(scrapList); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | List<DeviceSpare> deviceSpares = mapper.selectList(query); |
| | | return new Response<List<DeviceSpare>>().set(1,deviceSpares); |
| | | } |
| | | |
| | | public void addBatch(List<DeviceSpare> spareList) { |
| | | mapper.insertBatchSomeColumn(spareList); |
| | | } |
| | | |
| | | public void addOrUpdate(List<DeviceSpare> spareList) { |
| | | //æ¥è¯¢åºä¸æ¯å¦åå¨è¯¥è®¾å¤,åå¨åå¢å æ°é. |
| | | for (DeviceSpare spare : spareList) { |
| | | QueryWrapper<DeviceSpare> query = Wrappers.query(); |
| | | query.eq("name",spare.getName()); |
| | | query.eq("model",spare.getModel()); |
| | | query.eq("version",spare.getVersion()); |
| | | query.eq("brand",spare.getBrand()); |
| | | query.eq("type",spare.getType()); |
| | | query.eq("supplier",spare.getSupplier()); |
| | | query.last(" limit 1"); |
| | | DeviceSpare spareInDB = mapper.selectOne(query); |
| | | if(spareInDB != null){ |
| | | spareInDB.setQuantity(spareInDB.getQuantity()+spare.getQuantity()); |
| | | mapper.updateById(spareInDB); |
| | | |
| | | }else{ |
| | | //ä¸åå¨åæ°å¢ |
| | | mapper.insert(spare); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public void outBound(List<DeviceSpare> spareList) { |
| | | mapper.outBound(spareList); |
| | | } |
| | | |
| | | public Response addByExcel(MultipartFile file) throws IOException { |
| | | //å°æä»¶æµè½¬å为workbook |
| | | Workbook book = WorkbookFactory.create(file.getInputStream()); |
| | | Sheet sheet = book.getSheetAt(0); |
| | | //è·åæåä¸è¡ |
| | | int lastRowIndex = sheet.getLastRowNum(); |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | for (int i = 1; i <= lastRowIndex; i++) { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | Row row = sheet.getRow(i); |
| | | //对æ¯è¡çå7åè¿è¡éç©ºæ ¡éª |
| | | for (int j = 0; j < 7; j++) { |
| | | Cell cell = row.getCell(j); |
| | | //éå¾çåè¿è¡éç©ºæ ¡éª.ä¸åè§æ æ³ä¸ä¼ |
| | | if (cell == null || cell.getCellType() == CellType.BLANK) { |
| | | return new Response().set(1, false, "第" + (i + 1) + "è¡ç¬¬" + (j + 1) + "åæ°æ®ä¸ºç©º"); |
| | | } |
| | | } |
| | | //è·ååçå¼ |
| | | String name = row.getCell(0).getStringCellValue(); |
| | | String model = row.getCell(1).getStringCellValue(); |
| | | String version = row.getCell(2).getStringCellValue(); |
| | | int quantity = (int) row.getCell(3).getNumericCellValue(); |
| | | String brand = row.getCell(4).getStringCellValue(); |
| | | String type = row.getCell(5).getStringCellValue(); |
| | | String supplier = row.getCell(6).getStringCellValue(); |
| | | spare.setName(name); |
| | | spare.setModel(model); |
| | | spare.setVersion(version); |
| | | spare.setQuantity(quantity); |
| | | spare.setBrand(brand); |
| | | spare.setType(type); |
| | | spare.setSupplier(supplier); |
| | | |
| | | spareList.add(spare); |
| | | //第ä¸å为å¾ç TODO å¾
å¤ç |
| | | /*Cell cell = row.getCell(7); |
| | | CellType cellType = cell.getCellType(); |
| | | System.out.println("-");*/ |
| | | } |
| | | addBatch(spareList); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import cn.afterturn.easypoi.entity.ImageEntity; |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import com.whyc.dto.Real.ExportTinfDataDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.Statistic.MonStic; |
| | | import com.whyc.dto.Statistic.SticMonRes; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.pojo.db_batt_testdata.BatttestdataId; |
| | | import com.whyc.pojo.db_batt_testdata.BatttestdataInf; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.ServletUtils; |
| | | import org.apache.poi.hssf.usermodel.*; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.apache.poi.ss.usermodel.ClientAnchor; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.stereotype.Service; |
| | | import sun.misc.BASE64Decoder; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ExportService { |
| | | |
| | | @Autowired |
| | | private BatttestdataInfService battTinfService; |
| | | |
| | | @Autowired |
| | | private SubTablePageInfoService subTablePageInfoService; |
| | | |
| | | @Resource |
| | | private CommonMapper commonMapper; |
| | | |
| | | |
| | | //åèæ°éç»è®¡å¯¼åºï¼1.2.14ï¼ |
| | |
| | | rowNum = rowNum+rowNumAdd+5; |
| | | } |
| | | } |
| | | //å岿µè¯æ°æ®å¯¼åº |
| | | public void exportTinfDataByTestRecordCount(HttpServletRequest req, HttpServletResponse resp, ExportTinfDataDto dto) throws IOException { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | //å岿µè¯æ°æ®å¯¼åº |
| | | BatttestdataInf tinf = battTinfService.exportTinfDataByTestRecordCount(dto.getBattgroupId(), dto.getTestRecordCount()); |
| | | String tableName ="db_batt_testdata.tb_batttestdata_"+dto.getBattgroupId(); |
| | | //è·åå
·ä½çæ¾çµæ°æ® |
| | | List<BatttestdataId> dataList= subTablePageInfoService.exportTinfDataByTestRecordCount(dto.getBattgroupId(),dto.getTestRecordCount(),tableName); |
| | | map.put("dataList",dataList); |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | if(!dto.getPicGroupVol().equals("")) { |
| | | ImageEntity volImage = new ImageEntity(); |
| | | volImage.setData(decoder.decodeBuffer(dto.getPicGroupVol().substring(dto.getPicGroupVol().indexOf(",") + 1))); |
| | | volImage.setColspan(6); |
| | | volImage.setRowspan(17); |
| | | map.put("picGroupVol",volImage); |
| | | } |
| | | if(!dto.getPicBattVol().equals("")) { |
| | | ImageEntity volImage = new ImageEntity(); |
| | | volImage.setData(decoder.decodeBuffer(dto.getPicGroupVol().substring(dto.getPicBattVol().indexOf(",") + 1))); |
| | | volImage.setColspan(6); |
| | | volImage.setRowspan(17); |
| | | map.put("picBattVol",volImage); |
| | | } |
| | | if(!dto.getPicGroupCurr().equals("")) { |
| | | ImageEntity volImage = new ImageEntity(); |
| | | volImage.setData(decoder.decodeBuffer(dto.getPicGroupVol().substring(dto.getPicGroupCurr().indexOf(",") + 1))); |
| | | volImage.setColspan(6); |
| | | volImage.setRowspan(17); |
| | | map.put("picGroupCurr",volImage); |
| | | } |
| | | //è·åå¯¼åºæ¨¡æ¿å°å |
| | | ClassPathResource classPathResource = new ClassPathResource("excel_templates/batt_mon_static_template.xlsx"); |
| | | String path = classPathResource.getPath(); |
| | | TemplateExportParams templateExportParams1 = new TemplateExportParams(path,true); |
| | | Workbook wb = ExcelExportUtil.exportExcel(templateExportParams1, map); |
| | | try { |
| | | String fileName = "å岿µè¯æ°æ®è¡¨.xls"; |
| | | resp.setContentType("application/vnd.ms-excel"); |
| | | resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "utf-8")); |
| | | resp.flushBuffer(); |
| | | wb.write(resp.getOutputStream()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | // PageInfo<PwrdevAlarmParam> pageInfo=new PageInfo(list); |
| | | return new Response().setIII(1,list!=null,list,pinf,"è·åçµæºåè¦åæ°"); |
| | | return new Response().setIII(1,list!=null&&list.size()>0,list,pinf,"è·åçµæºåè¦åæ°"); |
| | | } |
| | | |
| | | //è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº) |
| | | public Response getPwrAlmParamToExport(Integer uid) { |
| | | List<PwrdevAlarmParam> list = mapper.getPwrAlmParamToExport(uid); |
| | | return new Response().setII(1,list!=null,list,"è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº)"); |
| | | return new Response().setII(1,list!=null&&list.size()>0,list,"è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº)"); |
| | | } |
| | | //ä¿®æ¹çµæºåè¦åæ° |
| | | public Response setPwrAlmParam(List<PwrdevAlarmParam> almparamList) { |
| | |
| | | import com.whyc.dto.AlarmDto; |
| | | import com.whyc.dto.Param.AlmAnalyseDto; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.dto.Real.RealDateDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.mapper.PwrdevAlarmMapper; |
| | | import com.whyc.pojo.db_alarm.DevalarmData; |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_data_history.PwrdevHistorydataId; |
| | | import com.whyc.pojo.db_param.AlmAnalysisParam; |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.CountDownLatch; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static java.lang.Thread.sleep; |
| | | |
| | | @Service |
| | | public class PwrdevAlarmService { |
| | | @Autowired(required = false) |
| | | private PwrdevAlarmMapper mapper; |
| | | @Autowired |
| | | private AppParamService appParamService; |
| | | @Autowired |
| | | private AlmAnalysisParamService almAnalysisParamService; |
| | | @Autowired |
| | | private SubTablePageInfoService subTablePageInfoService; |
| | | @Autowired |
| | | private BattInfService battInfService; |
| | | //è·åçµæºå®æ¶åè¦ä¿¡æ¯ |
| | | public Response getPwrAlmReal(AlmDto almDto) { |
| | | PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize()); |
| | |
| | | public Response getPwrtAlmAnalyse(AlmAnalyseDto dto) { |
| | | PageHelper .startPage(dto.getPageNum(),dto.getPageSize()); |
| | | List<PwrdevAlarm> list=mapper.getPwrtAlmAnalyse(dto); |
| | | for (PwrdevAlarm pwrAlm:list) { |
| | | pwrAlm.setAlmName(PowerAlarmEnum.getValue(pwrAlm.getAlmId())); |
| | | //æ¥è¯¢çµæºä¸ææççµæ± ç»id |
| | | List<Integer> battgroupIdList = battInfService.getBattgroupIdList(pwrAlm.getPowerId()); |
| | | pwrAlm.setBattgroupIdList(battgroupIdList); |
| | | } |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"çµæºåè¦åæ"); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class PwrdevHistorydataIdService { |
| | |
| | | List<String> datelist=ActionUtil.getDateListBetweenDates(apptimeParam.getParamValue(), new Date()); |
| | | //è·åçµæºä¼è¯å¤æçæ ååæ°å¼ |
| | | List<PowerPropertyParam> paramList=propertyParamService.getPwrStandardParam(powerType); |
| | | /*Map<String,Float> paramValues=new HashMap<>(); |
| | | for (PowerPropertyParam param : paramList) { |
| | | paramValues.put(param.getPropertyName()+"_upper", param.getBasisVal()*param.getAlarmLimithUpper()); |
| | | paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimitlLower()); |
| | | map.put(param.getPropertyName(), 0); |
| | | }*/ |
| | | List<String> propertyNameList = paramList.stream() |
| | | .map(param -> param.getPropertyName()) |
| | | .collect(Collectors.toList()); |
| | | for (int i=0;i<datelist.size();i++) { |
| | | String date=datelist.get(i); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+date; |
| | |
| | | if(existTableName == null){ |
| | | continue; |
| | | } |
| | | List<PwrdevHistorydataId> datalist=subTablePageInfoService.getPwrQuarter7(tableName); |
| | | List<PwrdevHistorydataId> datalist=subTablePageInfoService.getPwrQuarter7(tableName,propertyNameList); |
| | | // éå dataList å¹¶æ¯è¾å±æ§å¼ |
| | | for (PwrdevHistorydataId data : datalist) { |
| | | /*if(paramValues.get("acin1_vola_upper")!=null){ |
| | | if ((data.getAcin1Vola() > paramValues.get("acin1_vola_upper"))||(data.getAcin1Vola() < paramValues.get("acin1_vola_lower"))) { |
| | | map.put("acin1_vola", map.get("acin1_vola") + 1); |
| | | } |
| | | } |
| | | if(paramValues.get("acout_curra_upper")!=null) { |
| | | if ((data.getAcoutCurra() > paramValues.get("acout_curra_upper")) || (data.getAcoutCurra() < paramValues.get("acout_curra_lower"))) { |
| | | map.put("acout_curra", map.get("acout_curra") + 1); |
| | | } |
| | | } |
| | | if(paramValues.get("dcout_vol_upper")!=null) { |
| | | if ((data.getDcoutVol() > paramValues.get("dcout_vol_upper")) || (data.getDcoutVol() < paramValues.get("dcout_vo_lower"))) { |
| | | map.put("dcout_vol", map.get("dcout_vol") + 1); |
| | | } |
| | | } |
| | | if(paramValues.get("dcout_curr_upper")!=null) { |
| | | if ((data.getDcoutCurr() > paramValues.get("dcout_curr_upper")) || (data.getDcoutCurr() < paramValues.get("dcout_curr_lower"))) { |
| | | map.put("dcout_curr", map.get("dcout_curr") + 1); |
| | | } |
| | | }*/ |
| | | for (int j=0;j<paramList.size();j++) { |
| | | PowerPropertyParam param = paramList.get(j); |
| | | String propertyName = ActionUtil.toCamelCase(param.getPropertyName()); |
| | |
| | | import com.whyc.dto.AlmHis.BattAlmPar; |
| | | import com.whyc.dto.AlmHis.DevAlmPar; |
| | | import com.whyc.dto.AlmHis.PwrAlmPar; |
| | | import com.whyc.dto.AnalysisAlm.ResAnalysis; |
| | | import com.whyc.dto.Real.*; |
| | | import com.whyc.dto.Statistic.QuarterPwr7Res; |
| | | import com.whyc.mapper.CallBack; |
| | |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_data_history.PwrdevHistorydataId; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmHistory; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class SubTablePageInfoService { |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //夿åå²å®æ¶è¡¨æ¯å¦åå¨ |
| | | //å¤æçµæ± ç»åå²å®æ¶è¡¨æ¯å¦åå¨ |
| | | public int judgeTable_realdata( String table){ |
| | | String sql="select count(*) as tableNum " + |
| | | " from INFORMATION_SCHEMA.TABLES " + |
| | |
| | | } |
| | | return tableNum; |
| | | } |
| | | |
| | | //å¤æçµæºåå²å®æ¶è¡¨æ¯å¦åå¨ |
| | | public int judgeTable_pwrhis( String table){ |
| | | String sql="select count(*) as tableNum " + |
| | | " from INFORMATION_SCHEMA.TABLES " + |
| | | " where TABLE_SCHEMA = 'db_data_history' " + |
| | | " and TABLE_NAME = 'tb_pwrdev_historydata_"+table+"'"; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | LinkedList<Object> temp = new LinkedList<>(); |
| | | try { |
| | | while (rs.next()) |
| | | temp.add(rs.getInt("tableNum")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int tableNum =0; |
| | | if(list!=null){ |
| | | tableNum= (int) list.get(0); |
| | | } |
| | | return tableNum; |
| | | } |
| | | //çµæ± æ°æ®åå²å®æ¶å¤ç |
| | | public List<RealDateDTO> getBattRealDataHis(BattRealdataId realdata, int granularity,Integer maxRecordNum,Integer minRecordNum) { |
| | | String sql=" select record_time, group_vol, online_vol,group_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | |
| | | return list; |
| | | } |
| | | //çµæ± æ°æ®åå²å®æ¶å¤ç(é¢è¦åæ) |
| | | public List<RealDateDTO> getBattHisRealInAlm(BattRealdataId realdata) { |
| | | String sql=" select record_time, group_vol, online_vol,group_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | | public List<ResAnalysis> getBattHisRealInAlm(BattRealdataId realdata, Map<String,Integer> battMap) { |
| | | String result = String.join(",", battMap.keySet()); |
| | | String sql=" select record_time,"+result+" " + |
| | | " from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | | " where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " + |
| | | " and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' " + |
| | | " order by record_time asc,mon_num asc"; |
| | | List<RealDateDTO> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | List<ResAnalysis> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<RealDateDTO> list=new ArrayList<>(); |
| | | List<ResAnalysis> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | RealDateDTO ph=new RealDateDTO(); |
| | | ResAnalysis ph=new ResAnalysis(); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupCurr(rs.getFloat("group_curr")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonTmp(rs.getFloat("mon_tmp")); |
| | | ph.setMonRes(rs.getFloat("mon_res")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | int i=1; |
| | | for (String key : battMap.keySet()) { |
| | | Integer dataType = battMap.get(key); |
| | | try { |
| | | String propertyType = "dataType"+(i); |
| | | Field fieldType = ResAnalysis.class.getDeclaredField(propertyType); |
| | | fieldType.setAccessible(true); |
| | | fieldType.set(ph,dataType); |
| | | |
| | | Float value = rs.getFloat(key); |
| | | String propertyName = "dataName"+(i); |
| | | Field fieldName = ResAnalysis.class.getDeclaredField(propertyName); |
| | | fieldName.setAccessible(true); // 妿忮µæ¯ç§æçï¼éè¦è®¾ç½®ä¸ºå¯è®¿é® |
| | | fieldName.set(ph,key); |
| | | |
| | | String propertyValue = "dataValue"+(i); |
| | | Field fieldValue = ResAnalysis.class.getDeclaredField(propertyValue); |
| | | fieldValue.setAccessible(true); |
| | | fieldValue.set(ph,value); |
| | | } catch (NoSuchFieldException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | i++; |
| | | } |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //çµæºæ°æ®åå²å®æ¶å¤ç(é¢è¦åæ) |
| | | public List<ResAnalysis> getPwrHisRealInAlm(PwrdevHistorydataId pwrHis, Map<String,Integer> pwrMap) { |
| | | String result = String.join(",", pwrMap.keySet()); |
| | | String sql=" select record_datetime,"+result+" " + |
| | | " from db_data_history.tb_pwrdev_historydata_"+pwrHis.getTableName()+" " + |
| | | " where record_datetime >= '"+ThreadLocalUtil.format(pwrHis.getRecordDatetime(),1)+"' " + |
| | | " and record_datetime <= '"+ThreadLocalUtil.format(pwrHis.getRecordDatetime1(),1)+"' " + |
| | | " order by record_datetime asc "; |
| | | List<ResAnalysis> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<ResAnalysis> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | ResAnalysis ph=new ResAnalysis(); |
| | | ph.setRecordTime(rs.getTimestamp("record_datetime")); |
| | | int i=1; |
| | | for (String key : pwrMap.keySet()) { |
| | | Integer dataType = pwrMap.get(key); |
| | | try { |
| | | String propertyType = "dataType"+(i); |
| | | Field fieldType = ResAnalysis.class.getDeclaredField(propertyType); |
| | | fieldType.setAccessible(true); |
| | | fieldType.set(ph,dataType); |
| | | |
| | | Float value = rs.getFloat(key); |
| | | String propertyName = "dataName"+(i); |
| | | Field fieldName = ResAnalysis.class.getDeclaredField(propertyName); |
| | | fieldName.setAccessible(true); // 妿忮µæ¯ç§æçï¼éè¦è®¾ç½®ä¸ºå¯è®¿é® |
| | | fieldName.set(ph,key); |
| | | |
| | | String propertyValue = "dataValue"+(i); |
| | | Field fieldValue = ResAnalysis.class.getDeclaredField(propertyValue); |
| | | fieldValue.setAccessible(true); |
| | | fieldValue.set(ph,value); |
| | | } catch (NoSuchFieldException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | i++; |
| | | } |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | |
| | | return list; |
| | | } |
| | | //1.2.7ä¼è¯çµæºç»è®¡ä¸ä¸å£åº¦ççµæºæä¸å±æ§ååæ°éå¼è¶
è¿çæ¬¡æ° |
| | | public List<PwrdevHistorydataId> getPwrQuarter7(String tableName) { |
| | | String sql=" select distinct * " + |
| | | public List<PwrdevHistorydataId> getPwrQuarter7(String tableName,List<String> propertyNameList) { |
| | | String result = propertyNameList.stream().collect(Collectors.joining(",")); |
| | | String sql=" select distinct record_datetime,"+result+" " + |
| | | " from "+tableName+" " ; |
| | | sql+=" order by record_datetime asc"; |
| | | List<PwrdevHistorydataId> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | |
| | | while (rs.next()){ |
| | | PwrdevHistorydataId data=new PwrdevHistorydataId(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | data.setAcin1Vola(rs.getFloat("acin1_vola")); |
| | | data.setAcin1Volb(rs.getFloat("acin1_volb")); |
| | | data.setAcin1Volc(rs.getFloat("acin1_volc")); |
| | | data.setAcin2Vola(rs.getFloat("acin2_vola")); |
| | | data.setAcin2Volb(rs.getFloat("acin2_volb")); |
| | | data.setAcin2Volc(rs.getFloat("acin2_volc")); |
| | | data.setAcoutVola(rs.getFloat("acout_vola")); |
| | | data.setAcoutVolb(rs.getFloat("acout_volb")); |
| | | data.setAcoutVolc(rs.getFloat("acout_volc")); |
| | | data.setAcoutCurra(rs.getFloat("acout_curra")); |
| | | data.setAcoutCurrb(rs.getFloat("acout_currb")); |
| | | data.setAcoutCurrc(rs.getFloat("acout_currc")); |
| | | data.setDcoutVol(rs.getFloat("dcout_vol")); |
| | | data.setDcoutCurr(rs.getFloat("dcout_curr")); |
| | | |
| | | data.setBattgroup1Vol(rs.getFloat("battgroup1_vol")); |
| | | data.setBattgroup1Curr(rs.getFloat("battgroup1_curr")); |
| | | data.setBattgroup2Vol(rs.getFloat("battgroup2_vol")); |
| | | data.setBattgroup2Curr(rs.getFloat("battgroup2_curr")); |
| | | data.setTemprature(rs.getFloat("temprature")); |
| | | data.setMOutputvol(rs.getFloat("m_outputvol")); |
| | | data.setM1Outcurr(rs.getFloat("m1_outcurr")); |
| | | data.setM2Outcurr(rs.getFloat("m2_outcurr")); |
| | | data.setM3Outcurr(rs.getFloat("m3_outcurr")); |
| | | data.setM4Outcurr(rs.getFloat("m4_outcurr")); |
| | | data.setM5Outcurr(rs.getFloat("m5_outcurr")); |
| | | data.setM6Outcurr(rs.getFloat("m6_outcurr")); |
| | | data.setM7Outcurr(rs.getFloat("m7_outcurr")); |
| | | data.setM8Outcurr(rs.getFloat("m8_outcurr")); |
| | | data.setM9Outcurr(rs.getFloat("m9_outcurr")); |
| | | data.setM10Outcurr(rs.getFloat("m10_outcurr")); |
| | | data.setM11Outcurr(rs.getFloat("m11_outcurr")); |
| | | data.setM12Outcurr(rs.getFloat("m12_outcurr")); |
| | | data.setM13Outcurr(rs.getFloat("m13_outcurr")); |
| | | data.setM14Outcurr(rs.getFloat("m14_outcurr")); |
| | | data.setM15Outcurr(rs.getFloat("m15_outcurr")); |
| | | data.setM16Outcurr(rs.getFloat("m16_outcurr")); |
| | | |
| | | data.setAcin1Curra(rs.getFloat("acin1_curra")); |
| | | data.setAcin1Currb(rs.getFloat("acin1_currb")); |
| | | data.setAcin1Currc(rs.getFloat("acin1_currc")); |
| | | data.setLoaderCurr(rs.getFloat("loader_curr")); |
| | | data.setBattgroup1Ah(rs.getFloat("battgroup1_ah")); |
| | | data.setBattgroup1Temp(rs.getFloat("battgroup1_temp")); |
| | | data.setBattgroup2Ah(rs.getFloat("battgroup2_ah")); |
| | | data.setBattgroup2Temp(rs.getFloat("battgroup2_temp")); |
| | | data.setAcdcmTemp(rs.getFloat("acdcm_temp")); |
| | | data.setM1OutVol(rs.getFloat("m1_out_vol")); |
| | | data.setM2OutVol(rs.getFloat("m2_out_vol")); |
| | | data.setM3OutVol(rs.getFloat("m3_out_vol")); |
| | | data.setM4OutVol(rs.getFloat("m4_out_vol")); |
| | | data.setM5OutVol(rs.getFloat("m5_out_vol")); |
| | | data.setM6OutVol(rs.getFloat("m6_out_vol")); |
| | | data.setM7OutVol(rs.getFloat("m7_out_vol")); |
| | | data.setM8OutVol(rs.getFloat("m8_out_vol")); |
| | | data.setM9OutVol(rs.getFloat("m9_out_vol")); |
| | | data.setM10OutVol(rs.getFloat("m10_out_vol")); |
| | | data.setM11OutVol(rs.getFloat("m11_out_vol")); |
| | | data.setM12OutVol(rs.getFloat("m12_out_vol")); |
| | | data.setM13OutVol(rs.getFloat("m13_out_vol")); |
| | | data.setM14OutVol(rs.getFloat("m14_out_vol")); |
| | | data.setM15OutVol(rs.getFloat("m15_out_vol")); |
| | | data.setM16OutVol(rs.getFloat("m16_out_vol")); |
| | | |
| | | data.setUseracin1Vola(rs.getFloat("useracin1_vola")); |
| | | data.setUseracin1Volb(rs.getFloat("useracin1_volb")); |
| | | data.setUseracin1Volc(rs.getFloat("useracin1_volc")); |
| | | data.setUseracin1Curra(rs.getFloat("useracin1_curra")); |
| | | data.setUseracin1Currb(rs.getFloat("useracin1_currb")); |
| | | data.setUseracin1Currc(rs.getFloat("useracin1_currc")); |
| | | data.setUseracin1Freq(rs.getFloat("useracin1_freq")); |
| | | data.setUseracin2Vola(rs.getFloat("useracin2_vola")); |
| | | data.setUseracin2Volb(rs.getFloat("useracin2_volb")); |
| | | data.setUseracin2Volc(rs.getFloat("useracin2_volc")); |
| | | data.setUseracin2Curra(rs.getFloat("useracin2_curra")); |
| | | data.setUseracin2Currb(rs.getFloat("useracin2_currb")); |
| | | data.setUseracin2Currc(rs.getFloat("useracin2_currc")); |
| | | data.setUseracin2Freq(rs.getFloat("useracin2_freq")); |
| | | |
| | | data.setMTemper1(rs.getFloat("m_temper1")); |
| | | data.setMTemper2(rs.getFloat("m_temper2")); |
| | | data.setMTemper3(rs.getFloat("m_temper3")); |
| | | data.setMHumidity1(rs.getFloat("m_humidity1")); |
| | | data.setMHumidity2(rs.getFloat("m_humidity2")); |
| | | data.setMHumidity3(rs.getFloat("m_humidity3")); |
| | | for (int i=0;i<propertyNameList.size();i++){ |
| | | try { |
| | | Float value = rs.getFloat(propertyNameList.get(i)); |
| | | String propertyName = ActionUtil.toCamelCase(propertyNameList.get(i)); |
| | | Field fieldValue = PwrdevHistorydataId.class.getDeclaredField(propertyName); |
| | | fieldValue.setAccessible(true); |
| | | fieldValue.set(data,value); |
| | | } catch (NoSuchFieldException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //è·åå
·ä½çæ¾çµæ°æ® |
| | | public List<BatttestdataId> exportTinfDataByTestRecordCount(Integer battgroupId, Integer testRecordCount, String tableName) { |
| | | String sql="select distinct * from "+tableName+" "+ |
| | | " where test_record_count="+testRecordCount; |
| | | sql+=" order by record_time asc"; |
| | | List<BatttestdataId> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BatttestdataId> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BatttestdataId data=new BatttestdataId(); |
| | | data.setNum(rs.getInt("num")); |
| | | data.setBattgroupId(rs.getInt("battgroup_id")); |
| | | data.setTestRecordCount(rs.getInt("test_record_count")); |
| | | data.setTestType(rs.getInt("test_type")); |
| | | data.setRecordNum(rs.getInt("record_num")); |
| | | data.setDataNew(rs.getInt("data_new")); |
| | | data.setDataAvailable(rs.getInt("data_available")); |
| | | data.setTestTimelong(rs.getInt("test_timelong")); |
| | | data.setTestCurr(rs.getFloat("test_curr")); |
| | | data.setTestCap(rs.getFloat("test_cap")); |
| | | data.setMonNum(rs.getInt("mon_num")); |
| | | data.setMonVol(rs.getFloat("mon_vol")); |
| | | data.setMonTmp(rs.getFloat("mon_tmp")); |
| | | data.setMonRes(rs.getFloat("mon_res")); |
| | | data.setTestStarttime(rs.getTimestamp("test_starttime")); |
| | | data.setRecordTime(rs.getTimestamp("record_time")); |
| | | data.setGroupVol(rs.getFloat("group_vol")); |
| | | data.setOnlineVol(rs.getFloat("online_vol")); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowDevice; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.pojo.web_site.*; |
| | | import com.whyc.util.CommonUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | private WorkflowDeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private DeviceSpareService deviceSpareService; |
| | | @Autowired |
| | | private DeviceScrapService deviceScrapService; |
| | | |
| | | |
| | | public void addBatch(List<WorkflowLink> links) { |
| | |
| | | mainInDB.setEndTime(now); |
| | | mainInDB.setEndReason(link.getDealReason()); |
| | | mainService.updateById(mainInDB); |
| | | |
| | | List<WorkflowDevice> deviceListInDB = deviceService.getByMainId(mainInDB.getId()); |
| | | //å
¥åº |
| | | if(mainInDB.getType() == 2){ |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | deviceListInDB.forEach(device -> { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | /*spare.setName(device.getName()); |
| | | spare.setModel(device.getModel()); |
| | | spare.setVersion(device.getVersion()); |
| | | spare.setQuantity(device.getQuantity()); |
| | | spare.setBrand(device.getBrand()); |
| | | spare.setType(device.getType()); |
| | | spare.setSupplier(device.getSupplier());*/ |
| | | BeanUtils.copyProperties(device,spare); |
| | | |
| | | spareList.add(spare); |
| | | }); |
| | | deviceSpareService.addOrUpdate(spareList); |
| | | }else{ //è¿å
¥æ¥åºåº |
| | | List<DeviceScrap> scrapList = new ArrayList<>(); |
| | | deviceListInDB.forEach(device -> { |
| | | DeviceScrap deviceScrap = new DeviceScrap(); |
| | | BeanUtils.copyProperties(device,deviceScrap); |
| | | deviceScrap.setApplyUserId(mainInDB.getCreateUserId()); |
| | | deviceScrap.setApplyUserName(mainInDB.getCreateUserName()); |
| | | deviceScrap.setCreateTime(now); |
| | | deviceScrap.setMainId(mainInDB.getId()); |
| | | scrapList.add(deviceScrap); |
| | | }); |
| | | deviceScrapService.add(scrapList); |
| | | |
| | | } |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | case 4:{ //TODO åºåºç³è¯· |
| | | case 4:{ // åºåºç³è¯· |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_PASS.getValue()); |
| | | mainInDB.setEndTime(now); |
| | | mainInDB.setEndReason(link.getDealReason()); |
| | | mainService.updateById(mainInDB); |
| | | //è·ååºåºç³è¯·åè®¾å¤ |
| | | List<WorkflowDevice> deviceListInDB = deviceService.getByMainId(mainInDB.getId()); |
| | | List<DeviceSpare> spareList = new ArrayList<>(); |
| | | deviceListInDB.forEach(device -> { |
| | | DeviceSpare spare = new DeviceSpare(); |
| | | BeanUtils.copyProperties(device,spare); |
| | | spareList.add(spare); |
| | | }); |
| | | //æ´æ°åºå |
| | | deviceSpareService.outBound(spareList); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | //æ£æ¥æ¯å¦æå
³èå·¥å.妿æå
³èå·¥å,å
³èå·¥åç¶æé置为å®ç»å¾
å¤ç,宿æ¶é´é置为空 |
| | | if(mainInDB.getRelatedId() != null){ |
| | | Integer relatedId = mainInDB.getRelatedId(); |
| | | //mainService.resetRepairStatus(relatedId,mainInDB.getQuantity()); |
| | | } |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
| | |
| | | main.setOrderId(orderId); |
| | | main.setTitle(title); |
| | | main.setCreateUserId(user.getId()); |
| | | main.setCreateUserName(user.getName()); |
| | | main.setCreateTime(now); |
| | | main.setBeginTime(now); |
| | | main.setStatus(mainStatus); |
| | |
| | | ) |
| | | order by g.baoji_group_name |
| | | </select> |
| | | <select id="checkPwrIsInBanzu" resultType="com.whyc.pojo.db_user.BaojigroupPower"> |
| | | select tb_baojigroup_power.*,tb_baojigroup.baoji_group_name,tb_baojigroup.team_flag |
| | | from db_user.tb_baojigroup_power,db_user.tb_baojigroup |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup.baoji_group_id |
| | | and tb_baojigroup_power.power_id in |
| | | (SELECT power_id from tb_baojigroup_power where baoji_group_id=#{baoJiGroupId} |
| | | ) |
| | | and tb_baojigroup_power.baoji_group_id!=#{baoJiGroupId} |
| | | </select> |
| | | <select id="checkPower" resultType="com.whyc.pojo.db_user.BaojigroupPower"> |
| | | select tb_baojigroup_power.*,tb_baojigroup.baoji_group_name,tb_baojigroup.team_flag |
| | | from db_user.tb_baojigroup_power,db_user.tb_baojigroup |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup.baoji_group_id |
| | | and tb_baojigroup_power.power_id=#{powerId} |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getBattgroupIdList" resultType="com.whyc.pojo.db_station.BattInf"> |
| | | <select id="getBattgroupIdInf" resultType="com.whyc.pojo.db_station.BattInf"> |
| | | select distinct tb_batt_inf.* |
| | | ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_station.tb_batt_inf,db_station.tb_station_inf |
| | |
| | | </where> |
| | | limit 1 |
| | | </select> |
| | | <select id="getBattgroupIdList" resultType="java.lang.Integer"> |
| | | select distinct tb_batt_inf.battgroup_id |
| | | from db_station.tb_batt_inf |
| | | <where> |
| | | tb_batt_inf.power_id=#{powerId} |
| | | </where> |
| | | order by battgroup_num asc |
| | | </select> |
| | | </mapper> |
| | |
| | | ) |
| | | </select> |
| | | <select id="getBattAlmAnalyse" resultType="com.whyc.pojo.db_alarm.BattalarmData"> |
| | | select tb_battalarm_data.*,tb_batt_inf.battgroup_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | select tb_battalarm_data.*,tb_batt_inf.battgroup_name,tb_batt_inf.power_id,tb_batt_inf.station_id |
| | | ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_alarm.tb_battalarm_data,db_station.tb_batt_inf,db_station.tb_station_inf |
| | | <where> |
| | | tb_battalarm_data.battgroup_id=tb_batt_inf.battgroup_id |
| | |
| | | <select id="getNoDischargeData" resultType="com.whyc.pojo.db_batt_testdata.BatttestdataInf"> |
| | | select * from db_batt_testdata.tb_batttestdata_inf |
| | | <where> |
| | | battgroup_id=#{battgroupId} and test_type=3 |
| | | and (test_starttype!=3 or test_timelong <7200) |
| | | battgroup_id=#{battgroupId} |
| | | and test_type=3 |
| | | and data_available!=1 |
| | | <if test="testStartTime!=null"> |
| | | and tb_batttestdata_inf.test_starttime>=#{stic.testStartTime} |
| | | </if> |
New file |
| | |
| | | <?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.whyc.mapper.DeviceSpareMapper" > |
| | | |
| | | <update id="outBound"> |
| | | <foreach collection="list" item="item" separator=";"> |
| | | update web_site.tb_device_spare set quantity = quantity - #{item.quantity} |
| | | where name = #{item.name} |
| | | and model = #{item.model} |
| | | and version = #{item.version} |
| | | and brand = #{item.brand} |
| | | and type = #{item.type} |
| | | and supplier = #{item.supplier} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | |
| | | </select> |
| | | <resultMap id="name1List" type="provice"> |
| | | <result property="provice" column="provice" ></result> |
| | | <collection property="cityList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.City" column="{provice=provice}" select="selectCity"> |
| | | <result property="uid" column="uid" ></result> |
| | | <collection property="cityList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.City" column="{provice=provice,uid=uid}" select="selectCity"> |
| | | </collection> |
| | | </resultMap> |
| | | <select id="getLeftStation" resultMap="name1List"> |
| | | select distinct provice from db_station.tb_station_inf |
| | | select distinct provice,#{uid} as uid from db_station.tb_station_inf |
| | | <where> |
| | | <if test="uid>100"> |
| | | and tb_station_inf.station_id in( |
| | |
| | | <resultMap id="name2List" type="city"> |
| | | <result property="provice" column="provice"></result> |
| | | <result property="city" column="city" ></result> |
| | | <collection property="countryList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Country" column="{provice=provice,city=city}" select="selectCountry"> |
| | | <result property="uid" column="uid" ></result> |
| | | <collection property="countryList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Country" column="{provice=provice,city=city,uid=uid}" select="selectCountry"> |
| | | </collection> |
| | | </resultMap> |
| | | <select id="selectCity" resultMap="name2List"> |
| | | SELECT distinct #{provice} as provice,city from db_station.tb_station_inf |
| | | where provice=#{provice} |
| | | SELECT distinct #{provice} as provice,#{uid} as uid,city from db_station.tb_station_inf |
| | | <where> |
| | | provice=#{provice} |
| | | <if test="uid>100"> |
| | | and tb_station_inf.station_id in( |
| | | select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <resultMap id="name3List" type="country"> |
| | | <result property="provice" column="provice"></result> |
| | | <result property="city" column="city" ></result> |
| | | <result property="country" column="country" ></result> |
| | | <collection property="stationList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Station" column="{provice=provice,city=city,country=country}" select="selectStation"> |
| | | <result property="uid" column="uid" ></result> |
| | | <collection property="stationList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Station" column="{provice=provice,city=city,country=country,uid=uid}" select="selectStation"> |
| | | </collection> |
| | | </resultMap> |
| | | <select id="selectCountry" resultMap="name3List"> |
| | | SELECT distinct #{provice} as provice, #{city} as city,country from db_station.tb_station_inf |
| | | SELECT distinct #{provice} as provice, #{city} as city,#{uid} as uid,country from db_station.tb_station_inf |
| | | where provice=#{provice} and city=#{city} |
| | | <if test="uid>100"> |
| | | and tb_station_inf.station_id in( |
| | | select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | <resultMap id="name4List" type="station"> |
| | |
| | | <result property="country" column="country" ></result> |
| | | <result property="stationName" column="station_name" ></result> |
| | | <result property="stationId" column="station_id" ></result> |
| | | <collection property="pinflist" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Power" column="{stationId=station_id}" select="selectPower"> |
| | | <result property="uid" column="uid" ></result> |
| | | <collection property="pinflist" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Power" column="{stationId=station_id,uid=uid}" select="selectPower"> |
| | | </collection> |
| | | </resultMap> |
| | | <select id="selectStation" resultMap="name4List"> |
| | | SELECT distinct #{provice} as provice, #{city} as city, #{country} as country,station_name,station_id from db_station.tb_station_inf |
| | | SELECT distinct #{provice} as provice, #{city} as city, #{country} as country,#{uid} as uid,station_name,station_id from db_station.tb_station_inf |
| | | where provice=#{provice} and city=#{city} and country=#{country} |
| | | <if test="uid>100"> |
| | | and tb_station_inf.station_id in( |
| | | select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | </select> |
| | | <resultMap id="name5List" type="power"> |
| | | <result property="powerId" column="power_id"></result> |
| | |
| | | <select id="selectPower" resultMap="name5List"> |
| | | SELECT distinct tb_power_inf.power_id,power_name,station_id from db_station.tb_power_inf |
| | | where tb_power_inf.station_id=#{stationId} |
| | | <if test="uid>100"> |
| | | and tb_power_inf.power_id in( |
| | | select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectBatt" resultType="batt"> |
| | |
| | | l.id link_id, |
| | | l.main_id, |
| | | l.parent_id, |
| | | l.process_level as lProcessLevel, |
| | | l.process_level_name, |
| | | l.process_stage, |
| | | l.process_name, |
| | | l.create_time link_create_time, |
| | | l.deal_user_id, |
| | | l.deal_type, |
| | |
| | | <id column="link_id" property="id"/> |
| | | <result column="main_id" property="mainId"/> |
| | | <result column="parent_id" property="parentId"/> |
| | | <result column="lProcessLevel" property="processLevel"/> |
| | | <result column="process_level_name" property="processLevelName"/> |
| | | <result column="process_stage" property="processStage"/> |
| | | <result column="process_name" property="processName"/> |
| | | <result column="link_create_time" property="createTime"/> |
| | | <result column="deal_user_id" property="dealUserId"/> |
| | | <result column="deal_type" property="dealType"/> |
| | |
| | | <choose> |
| | | <!--å
¨é¨--> |
| | | <when test="status==0"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_role_id = #{user.role} |
| | | and l.deal_user_id is null |
| | | union all |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} order by id desc |
| | | and l.deal_user_id = #{user.id} order by id desc |
| | | </when> |
| | | <!--å¾
æ¥å--> |
| | | <when test="status==1"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_role_id = #{user.role} |
| | | and l.deal_user_id is null |
| | | and l.status = #{status} order by m.id desc |
| | | </when> |
| | | <otherwise> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | SELECT m.*,u.name as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.create_user_id = u.id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | and l.deal_user_id = #{user.id} |
| | | and l.status = #{status} order by m.id desc |
| | | </otherwise> |
| | | </choose> |