| | |
| | | import com.whyc.dto.ResultA200Dto; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.mapper.DevA200TestParamMapper; |
| | | import com.whyc.mapper.DevInfMapper; |
| | | import com.whyc.mapper.DevLithiumInfMapper; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevA200TestParam; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevInf; |
| | | import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.JsonUtil; |
| | | import com.whyc.util.TestparamHttpUtil; |
| | | import com.whyc.util.TestParamHttpUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | |
| | | private DevA200TestParamMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private DevInfMapper devInfMapper; |
| | | private DevLithiumInfMapper devLithiumInfMapper; |
| | | |
| | | private final RestTemplate restTemplate; |
| | | |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/getTestParameter"; |
| | | ResultA200Dto dto= getA200Dto(url); |
| | | if(dto.getCode().equals("200")){ |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",param.getDevId()); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/setTestParameter"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | | //param转json字符串 |
| | | String paramJson = JsonUtil.getGson().toJson(param); |
| | | paramMap.add("testParameter",paramJson); |
| | | ResultA200Dto dto= (ResultA200Dto) TestparamHttpUtil.postforform_dataA200(restTemplate,url,paramMap); |
| | | ResultA200Dto dto= (ResultA200Dto) TestParamHttpUtil.postForFormDataA200(restTemplate,url,paramMap); |
| | | return dto; |
| | | } |
| | | |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/startTest"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | | paramMap.add("testType",type);//1 放电,2 充电 |
| | | ResultA200Dto dto= (ResultA200Dto) TestparamHttpUtil.postforform_dataA200(restTemplate,url,paramMap); |
| | | paramMap.add("testType",type); |
| | | ResultA200Dto dto= (ResultA200Dto) TestParamHttpUtil.postForFormDataA200(restTemplate,url,paramMap); |
| | | return dto; |
| | | } |
| | | //a200一体机暂停/继续 |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/pauseTest"; |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); |
| | | paramMap.add("controlType",type);//1 暂停测试 ,2继续测试 |
| | | ResultA200Dto dto= (ResultA200Dto) TestparamHttpUtil.postforform_dataA200(restTemplate,url,paramMap); |
| | | ResultA200Dto dto= (ResultA200Dto) TestParamHttpUtil.postForFormDataA200(restTemplate,url,paramMap); |
| | | return dto; |
| | | } |
| | | //停止a200一体机放电/充电 |
| | |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.last("limit 1"); |
| | | DevInf dinf=devInfMapper.selectOne(wrapper); |
| | | DevLithiumInf dinf= devLithiumInfMapper.selectOne(wrapper); |
| | | String url="http://"+dinf.getDevIp()+":8080/webService/stopTest"; |
| | | ResultA200Dto dto= getA200Dto(url); |
| | | return dto; |
| | |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.set("batch_state",1); |
| | | devInfMapper.update(null,wrapper); |
| | | devLithiumInfMapper.update(null,wrapper); |
| | | map.put(devId,dto); |
| | | } |
| | | return new Response().setII(1,true,map,"批量控制a200一体机"); |
| | |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("dev_id",devId); |
| | | wrapper.set("batch_state",1); |
| | | devInfMapper.update(null,wrapper); |
| | | devLithiumInfMapper.update(null,wrapper); |
| | | map.put(devId,dto); |
| | | } |
| | | return new Response().setII(1,true,map,"批量控制a200一体机"); |