Browse Source

物联网 BUG修复

mengkang 4 years ago
parent
commit
6b6d3c457b

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java

@ -193,11 +193,17 @@ public class IotDeviceController extends EnvelopRestEndpoint {
            if (size == null) {
                size = 10;
            }
            if(isBinding==3){
                return iotDeviceService.findDevice();
            }
            if (isBinding == null) {
                return iotDeviceService.queryPage(sn, hospital, hospitalName, orderId, purcharseId, productId, name, categoryCode, manufacturerId, page, size);
            } else {
                return iotDeviceService.queryPage(sn, hospital, orderId, purcharseId, isBinding, page, size);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 16 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -332,6 +332,22 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList, page, size,count);
    }
    /**
     *
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findDevice() {
        String sql ="SELECT DISTINCT c.* from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 GROUP BY c.`name`";
        List<IotDeviceDO> list = jdbcTempalte.query(sql,new BeanPropertyRowMapper(IotDeviceDO.class));
        //DO转VO
        List<IotDeviceVO> iotDeviceVOList = convertToModels(list,new ArrayList<>(list.size()),IotDeviceVO.class);
        translateDictForList(iotDeviceVOList);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList);
    }
    /**
     * 根据设备序列号判断设备是否存在
     * @param deviceSn