| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.BeanUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.gson.JsonObject; |
| | | import com.whyc.constant.CMD_Constant; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.CustomMapper; |
| | |
| | | * @param queryWrapper |
| | | * @param opCmd 执行的操作输入 |
| | | * @param ackTimeLimitSecond 最大限制返回时间,单位秒 |
| | | * @param battIndex 电池组index,可传入[0,1]或者null |
| | | * @return 对比opCmd的操作输出,是否操作成功或者失败 |
| | | */ |
| | | public static Response getOpStatus(CustomMapper mapper, QueryWrapper<?> queryWrapper, Integer opCmd, Integer ackTimeLimitSecond) { |
| | | public static Response getOpStatus(CustomMapper mapper, QueryWrapper<?> queryWrapper, Integer opCmd, Integer ackTimeLimitSecond, Integer battIndex) { |
| | | try { |
| | | int count = ackTimeLimitSecond * 1000 / 250; |
| | | for (int i = 0; i < count; i++) { |
| | | queryWrapper.select("op_cmd").last(" limit 1"); |
| | | queryWrapper.select("op_cmd"); |
| | | if(battIndex != null){ |
| | | queryWrapper.eq("batt_index",battIndex); |
| | | } |
| | | queryWrapper.last(" limit 1"); |
| | | Object obj = mapper.selectOne(queryWrapper); |
| | | Class clazz = obj.getClass(); |
| | | |