| | |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.DataConfigDto; |
| | | import com.yuanchu.mom.dto.DeviceDto; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.pojo.DataConfig; |
| | | import com.yuanchu.mom.pojo.Device; |
| | | import com.yuanchu.mom.service.DataConfigService; |
| | |
| | | @PostMapping("/saveDataAcquisitionConfiguration") |
| | | public Result<?> saveDataAcquisitionConfiguration(@RequestParam(value = "deviceId") Integer deviceId, @RequestBody DataConfigDto dataConfigList) { |
| | | if (dataConfigList.getIsDevice()) { |
| | | Device one = deviceService.getOne(Wrappers.<Device>lambdaQuery() |
| | | .eq(Device::getIp, dataConfigList.getIp())); |
| | | if (ObjectUtils.isNotEmpty(one)) { |
| | | throw new ErrorException("该IP:" + dataConfigList.getIp() + "已经绑定了设备:" + one.getDeviceName()); |
| | | } |
| | | Device device = new Device(); |
| | | device.setId(deviceId); |
| | | device.setCollectUrl(dataConfigList.getCollectUrl()); |
| | | device.setStorageUrl(dataConfigList.getStorageUrl()); |
| | | device.setIp(dataConfigList.getIp()); |
| | | device.setFileType(dataConfigList.getFileType()); |
| | | device.setMdbEntrustCode(dataConfigList.getMdbEntrustCode()); |
| | | device.setMdbSampleCode(dataConfigList.getMdbSampleCode()); |
| | | deviceService.updateById(device); |
| | | } else { |
| | | dataConfigService.saveOrUpdateBatch(dataConfigList.getDataConfigList()); |
| | |
| | | dataConfigService.removeBatchByIds(collect); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "菜单") |
| | | @PostMapping("/menu") |
| | | public Result menu() { |
| | | return Result.success(deviceService.menu()); |
| | | } |
| | | } |
| | | |