Commit ef3b6b77 authored by 赵啸非's avatar 赵啸非

修改克隆应用

parent f4db9714
...@@ -221,6 +221,21 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti ...@@ -221,6 +221,21 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti
appClone.setDistributeFilePath(""); appClone.setDistributeFilePath("");
appClone.setShelves(YesNoEnum.NO.getValue()); appClone.setShelves(YesNoEnum.NO.getValue());
appClone = this.save(appClone, context); appClone = this.save(appClone, context);
//克隆应用版本
AppVersionEntity appVersionCloneEntity = new AppVersionEntity();
appVersionCloneEntity.initAttrValue();
AppVersionQuery appVersionQuery = new AppVersionQuery();
appVersionQuery.setUsed(YesNoEnum.YES.getValue());
appVersionQuery.setAppId(appEntity.getId());
AppVersionEntity appVersionOriEntity = appVersionService.selectOne(appVersionQuery);
BeanUtils.copyProperties(appVersionOriEntity, appVersionCloneEntity, BeanUtil.getNullPropertyNames(appVersionOriEntity));
appVersionCloneEntity.setAppId(appClone.getId());
appVersionCloneEntity.setDistributeFilePath("");
appVersionCloneEntity.setUsed(YesNoEnum.NO.getValue());
appVersionCloneEntity.setId(null);
appVersionService.save(appVersionCloneEntity, context);
//保存数据集 //保存数据集
List<AppDatasetEntity> appDatasetList = appClone.getAppDatasetList(); List<AppDatasetEntity> appDatasetList = appClone.getAppDatasetList();
if (!ObjectUtils.isEmpty(appDatasetList)) { if (!ObjectUtils.isEmpty(appDatasetList)) {
...@@ -288,7 +303,7 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti ...@@ -288,7 +303,7 @@ public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEnti
AppEntity targetAppEntity = this.get(targetAppId, context); AppEntity targetAppEntity = this.get(targetAppId, context);
//删除应用的数据集 //删除应用的数据集
if(!ObjectUtils.isEmpty(appEntity.getTargetDelete())&&YesNoEnum.YES.getValue()==appEntity.getTargetDelete()) { if (!ObjectUtils.isEmpty(appEntity.getTargetDelete()) && YesNoEnum.YES.getValue() == appEntity.getTargetDelete()) {
Long[] delIds = targetAppEntity.getAppDatasetList().stream().map(i -> i.getId()).toArray(Long[]::new); Long[] delIds = targetAppEntity.getAppDatasetList().stream().map(i -> i.getId()).toArray(Long[]::new);
if (!ObjectUtils.isEmpty(delIds)) { if (!ObjectUtils.isEmpty(delIds)) {
appDatasetService.remove(delIds, context); appDatasetService.remove(delIds, context);
......
...@@ -201,7 +201,7 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService, ...@@ -201,7 +201,7 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService,
} }
List<AppEntity> appEntityList = this.service.find(new AppQuery().idList(appQuery.getIdList()), getContext()); List<AppEntity> appEntityList = this.service.find(new AppQuery().idList(appQuery.getIdList()), getContext());
List<SiteEntity> siteEntityList = siteService.find(new SiteQuery().idList(appQuery.getSiteIdList()), getContext()); List<SiteEntity> siteEntityList = siteService.find(new SiteQuery().idList(appQuery.getSiteIdList()), getContext());
Rest<String> cloneRest = this.service.cloneAppsBySites(appEntityList, siteEntityList, getContext()); this.service.cloneAppsBySites(appEntityList, siteEntityList, getContext());
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
log.error("自助服务应用部署", e); log.error("自助服务应用部署", e);
......
...@@ -104,7 +104,7 @@ public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppV ...@@ -104,7 +104,7 @@ public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppV
if (appVersionEntity.getUsed() == YesNoEnum.YES.getValue()) { if (appVersionEntity.getUsed() == YesNoEnum.YES.getValue()) {
throw new AppException("当前应用使用中!"); throw new AppException("当前应用使用中!");
} }
Rest<Void> usedRest = this.service.appUsed(appVersionEntity, getContext()); this.service.appUsed(appVersionEntity, getContext());
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment