| | |
| | | if(ywDeviceMapper.selectCount(new QueryWrapper<YwDevice>().lambda().eq(YwDevice::getIsdeleted,Constants.ZERO).eq(YwDevice::getCode,ywDevice.getCode()))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"设备编号重复!"); |
| | | } |
| | | // if(StringUtils.isBlank(ywDevice.getCode())){ |
| | | // String code = this.getMaxAutoMaticDeviceCode(); |
| | | // while (ywDeviceMapper.selectCount(new QueryWrapper<YwDevice>().lambda().eq(YwDevice::getIsdeleted,Constants.ZERO).eq(YwDevice::getCode,code))>Constants.ZERO){ |
| | | // code = this.getMaxAutoMaticDeviceCode(); |
| | | // } |
| | | // ywDevice.setCode(code); |
| | | // }else{ |
| | | // |
| | | // } |
| | | ywDevice.setCreateDate(new Date()); |
| | | ywDevice.setCreator(loginUserInfo.getId()); |
| | | ywDevice.setIsdeleted(Constants.ZERO); |
| | | ywDeviceMapper.insert(ywDevice); |
| | | |
| | | if(Objects.nonNull(ywDevice.getMultifile())){ |
| | | ywDevice.getMultifile().setCreator(loginUserInfo.getId()); |
| | | ywDevice.getMultifile().setCreateDate(new Date()); |
| | | ywDevice.getMultifile().setIsdeleted(Constants.ZERO); |
| | | ywDevice.getMultifile().setObjType(Constants.MultiFile.FN_DEVICE_FILE.getKey()); |
| | | ywDevice.getMultifile().setObjId(ywDevice.getId()); |
| | | multifileMapper.insert(ywDevice.getMultifile()); |
| | | if(Objects.nonNull(ywDevice.getFileUrl())){ |
| | | Multifile multifile = new Multifile(); |
| | | multifile.setCreator(loginUserInfo.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjType(Constants.MultiFile.FN_DEVICE_FILE.getKey()); |
| | | multifile.setObjId(ywDevice.getId()); |
| | | multifile.setFileurl(ywDevice.getFileUrl()); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | |
| | | return ywDevice.getId(); |
| | |
| | | .eq(Multifile::getObjId,ywDevice.getId()) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.FN_DEVICE_FILE.getKey()) |
| | | ); |
| | | if(Objects.nonNull(ywDevice.getMultifile())){ |
| | | ywDevice.getMultifile().setCreator(loginUserInfo.getId()); |
| | | ywDevice.getMultifile().setCreateDate(new Date()); |
| | | ywDevice.getMultifile().setIsdeleted(Constants.ZERO); |
| | | ywDevice.getMultifile().setObjType(Constants.MultiFile.FN_DEVICE_FILE.getKey()); |
| | | ywDevice.getMultifile().setObjId(ywDevice.getId()); |
| | | multifileMapper.insert(ywDevice.getMultifile()); |
| | | if(Objects.nonNull(ywDevice.getFileUrl())){ |
| | | Multifile multifile = new Multifile(); |
| | | multifile.setCreator(loginUserInfo.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjType(Constants.MultiFile.FN_DEVICE_FILE.getKey()); |
| | | multifile.setObjId(ywDevice.getId()); |
| | | multifile.setFileurl(ywDevice.getFileUrl()); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | |
| | | |
| | |
| | | if(Objects.nonNull(multifile)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_DEVICE).getCode(); |
| | | multifile.setFileurlFull(path + multifile.getFileurl()); |
| | | ywDevice.setMultifile(multifile); |
| | | ywDevice.setFileFullUrl(path + multifile.getFileurl()); |
| | | } |
| | | return ywDevice; |
| | | } |