| | |
| | | |
| | | @ApiOperation(value = "批量设置a200均衡仪参数") |
| | | @PostMapping("setA200ParamPl") |
| | | public Object setA200ParamPl(@RequestBody List<A200ResDto> params){ |
| | | return service.setA200ParamPl(params); |
| | | public Object setA200ParamPl(@RequestBody A200ResDto param){ |
| | | return service.setA200ParamPl(param); |
| | | } |
| | | |
| | | @ApiOperation(value = "启动a200均衡仪放电/充电") |
| | |
| | | public Object setActmParam(@RequestBody ActmResDto param){ |
| | | return service.setActmParam(param); |
| | | } |
| | | |
| | | @ApiOperation(value = "批量设置actm均衡仪参数") |
| | | @PostMapping("setActmParamPl") |
| | | public Object setActmParamPl(@RequestBody List<ActmResDto> params){ |
| | | return service.setActmParamPl(params); |
| | | public Object setActmParamPl(@RequestBody ActmResDto param){ |
| | | return service.setActmParamPl(param); |
| | | } |
| | | |
| | | @ApiOperation(value = "启动,暂停,继续,停止actm均衡仪") |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | public class A200ResDto implements Serializable { |
| | | |
| | | private int devId; |
| | | |
| | | private List<Integer> devIds; |
| | | |
| | | @ApiModelProperty(value = "pack/模组号") |
| | | private String batteryName; |
| | |
| | | public void setDevId(int devId) { |
| | | this.devId = devId; |
| | | } |
| | | |
| | | public List<Integer> getDevIds() { |
| | | return devIds; |
| | | } |
| | | |
| | | public void setDevIds(List<Integer> devIds) { |
| | | this.devIds = devIds; |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ActmResDto { |
| | | |
| | | private int devId; |
| | | |
| | | private List<Integer> devIds; |
| | | |
| | | @ApiModelProperty(value = "模组需要,从0开始") |
| | | private Integer batteryStorageIndex; |
| | | |
| | |
| | | } |
| | | |
| | | //批量设置a200均衡仪参数 |
| | | public Object setA200ParamPl(List<A200ResDto> params) { |
| | | public Object setA200ParamPl(A200ResDto param) { |
| | | Map<Integer,Object> map=new HashMap<>(); |
| | | int size=param.getDevIds().size(); |
| | | try { |
| | | ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(params.size()); |
| | | for (A200ResDto param:params) { |
| | | CountDownLatch latch = new CountDownLatch(size); |
| | | for (Integer devId:param.getDevIds()) { |
| | | poolExecutor.execute(() -> { |
| | | param.setDevId(devId); |
| | | ResultA200Dto dto= (ResultA200Dto) setA200Param(param); |
| | | map.put(param.getDevId(),dto); |
| | | latch.countDown(); |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new Response().set(1,true,"批量设置a200均衡仪参数"); |
| | | return new Response().setII(1,true,map,"批量设置a200均衡仪参数"); |
| | | } |
| | | |
| | | //启动a200均衡仪放电/充电 |
| | |
| | | } |
| | | |
| | | //批量设置Actm均衡仪参数 |
| | | public Object setActmParamPl(List<ActmResDto> params) { |
| | | public Object setActmParamPl(ActmResDto param) { |
| | | Map<Integer,Object> map=new HashMap<>(); |
| | | int size=param.getDevIds().size(); |
| | | try { |
| | | ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(params.size()); |
| | | for (ActmResDto param:params) { |
| | | CountDownLatch latch = new CountDownLatch(size); |
| | | for (Integer devId:param.getDevIds()) { |
| | | poolExecutor.execute(() -> { |
| | | param.setDevId(devId); |
| | | ResultA200Dto dto= (ResultA200Dto) setActmParam(param); |
| | | map.put(param.getDevId(),dto); |
| | | latch.countDown(); |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new Response().set(1,true,"批量设置Actm均衡仪参数"); |
| | | return new Response().setII(1,true,map,"批量设置Actm均衡仪参数"); |
| | | } |
| | | |
| | | |