| | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.whyc.dto.A200ResDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.ResultDto; |
| | | import com.whyc.mapper.DevA200TestparamMapper; |
| | | import com.whyc.mapper.DevInfMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevA200Testparam; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevActmTestparam; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.util.ActionUtil; |
| | |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/getTestParameter"; |
| | | String results = restTemplate.postForObject(url, null, String.class); |
| | | ResultDto dto= ActionUtil.getGson().fromJson(results,ResultDto.class); |
| | | if(dto.getCode().equals("200")){ |
| | | DevA200Testparam a200Param=new DevA200Testparam(); |
| | | copyA200DTO(dto.getData(),a200Param); |
| | | a200Param.setDevId(devId); |
| | | a200Param.setReturnCode(Integer.parseInt(dto.getCode())); |
| | | UpdateWrapper updateWrapper=new UpdateWrapper(); |
| | | updateWrapper.eq("dev_id",devId); |
| | | mapper.update(a200Param,updateWrapper); |
| | | } |
| | | //System.out.println(results); |
| | | /*ResultDto dto= JSONObject.parseObject(results,ResultDto.class); |
| | | A200ResDto a200= JSONObject.parseObject(dto.getData().toString(),A200ResDto.class);*/ |
| | | //System.out.println(dto.toString()); |
| | | return dto; |
| | | } |
| | | |
| | | |
| | | //设置a200均衡仪参数 |
| | | public Response setA200Param(DevActmTestparam param) { |
| | |
| | | public Response controllA200ParamPl(List<Integer> devIds) { |
| | | return new Response().set(1,true,"批量控制a200均衡仪"); |
| | | } |
| | | |
| | | //将dto拷贝至param |
| | | private void copyA200DTO(Object data, DevA200Testparam a200Param) { |
| | | A200ResDto dto= (A200ResDto) data; |
| | | a200Param.setBatteryName(dto.getBatteryName()); |
| | | a200Param.setNominalCapacity(dto.getNominalCapacity()); |
| | | a200Param.setBatteryType(dto.getBatteryType()); |
| | | a200Param.setBatteryNumber(dto.getBatteryNumber()); |
| | | a200Param.setDiffBatteryVoltage(dto.getDiffBatteryVoltage()); |
| | | a200Param.setDischargeCurrent(dto.getDischargeCurrent()); |
| | | a200Param.setDischargeVoltage(dto.getDischargeVoltage()); |
| | | a200Param.setDischargeTime(dto.getDischargeTime()); |
| | | a200Param.setDischargeCapacity(dto.getDischargeCapacity()); |
| | | if(dto.isDischargeCapacityEnable()){ |
| | | a200Param.setIsDischargeCapacityEnable(1); |
| | | }else{ |
| | | a200Param.setIsDischargeCapacityEnable(0); |
| | | } |
| | | a200Param.setMinBatteryVoltage(dto.getMinBatteryVoltage()); |
| | | if(dto.isMinBatteryVoltageEnable()){ |
| | | a200Param.setIsMinBatteryVoltageEnable(1); |
| | | }else{ |
| | | a200Param.setIsMinBatteryVoltageEnable(0); |
| | | } |
| | | a200Param.setChargeVoltage(dto.getChargeVoltage()); |
| | | a200Param.setChargeProtectVoltage(dto.getChargeProtectVoltage()); |
| | | a200Param.setChargeCurrent(dto.getChargeCurrent()); |
| | | a200Param.setChargeStopCurrent(dto.getChargeStopCurrent()); |
| | | a200Param.setChargeTime(dto.getChargeTime()); |
| | | a200Param.setChargeCapacity(dto.getChargeCapacity()); |
| | | if(dto.isChargeCapacityEnable()){ |
| | | a200Param.setIsChargeCapacityEnable(1); |
| | | }else{ |
| | | a200Param.setIsChargeCapacityEnable(0); |
| | | } |
| | | |
| | | a200Param.setMaxBatteryVoltage(dto.getMaxBatteryVoltage()); |
| | | if(dto.isMaxBatteryVoltageEnable()){ |
| | | a200Param.setIsMaxBatteryVoltageEnable(1); |
| | | }else{ |
| | | a200Param.setIsMaxBatteryVoltageEnable(0); |
| | | } |
| | | a200Param.setChargePower(dto.getChargePower()); |
| | | a200Param.setBatteryTemperatureProtect(dto.getBatteryTemperatureProtect()); |
| | | } |
| | | } |