jinpengyong
2022-01-17 3ddfa12fbc43e80e99e4959fbac8881eaa8e3ca3
screen-manage/src/main/java/com/moral/api/controller/DeviceController.java
@@ -6,6 +6,7 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -54,7 +55,7 @@
        String mac = device.getMac();
        Integer monitorPointId = device.getMonitorPointId();
        Integer versionId = device.getDeviceVersionId();
        if (name == null || mac == null || monitorPointId == null || versionId == null) {
        if (ObjectUtils.isEmpty(name) || ObjectUtils.isEmpty(mac) || ObjectUtils.isEmpty(monitorPointId) || ObjectUtils.isEmpty(versionId)) {
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
@@ -63,7 +64,7 @@
        queryWrapper.eq("mac", device.getMac()).eq("is_delete", Constants.NOT_DELETE);
        QueryWrapper<SpecialDevice> specialDeviceQueryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mac", device.getMac()).eq("is_delete", Constants.NOT_DELETE);
        specialDeviceQueryWrapper.eq("mac", device.getMac()).eq("is_delete", Constants.NOT_DELETE);
        if (deviceService.getOne(queryWrapper) != null || specialDeviceService.getOne(specialDeviceQueryWrapper) != null) {
            return ResultMessage.fail(ResponseCodeEnum.MAC_IS_EXIST.getCode(), ResponseCodeEnum.MAC_IS_EXIST.getMsg());
@@ -102,8 +103,7 @@
            queryWrapper.eq("mac", device.getMac()).eq("is_delete", Constants.NOT_DELETE);
            QueryWrapper<SpecialDevice> specialDeviceQueryWrapper = new QueryWrapper<>();
            queryWrapper.eq("mac", device.getMac()).eq("is_delete", Constants.NOT_DELETE);
            specialDeviceQueryWrapper.eq("mac", device.getMac()).eq("is_delete", Constants.NOT_DELETE);
            if (deviceService.getOne(queryWrapper) != null || specialDeviceService.getOne(specialDeviceQueryWrapper) != null) {
                return ResultMessage.fail(ResponseCodeEnum.MAC_IS_EXIST.getCode(), ResponseCodeEnum.MAC_IS_EXIST.getMsg());
            }
@@ -262,4 +262,12 @@
        List<Map<String, Object>> professions = deviceService.selectDeviceDictData(Constants.SYSTEM_DICT_TYPE_PURCHASER);
        return ResultMessage.ok(professions);
    }
    @RequestMapping(value = "selectMonitorPiontAndDeviceByOrgId", method = RequestMethod.GET)
    public ResultMessage selectMonitorPiontAndDeviceByOrgId(HttpServletRequest request){
        Map parames = WebUtils.getParametersStartingWith(request,null);
        int id = Integer.parseInt(parames.get("organization_id").toString());
        List<Map<String, Object>> maps = deviceService.selectMonitorPiontAndDeviceByOrgId(id);
        return ResultMessage.ok(maps);
    }
}