|
|
@@ -397,20 +397,23 @@ public class PanelInstanceServiceImpl extends BaseService<PanelInstance> impleme
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据用户和面板,删除相应的实例
|
|
|
+ * 生成面板实例
|
|
|
*
|
|
|
- * @param panelCode 面板 code
|
|
|
+ * @param panelCode 面板 code
|
|
|
+ * @param oldPanelInstance 旧的面板实例
|
|
|
* @return 面板实例
|
|
|
*/
|
|
|
- private PanelInstance generateInstance(@NotEmpty("panelCode") String panelCode, @NotEmpty("oldPanelInstance") PanelInstance oldPanelInstance) {
|
|
|
+ private PanelInstance generateInstance(@NotEmpty("panelCode") String panelCode, PanelInstance oldPanelInstance) {
|
|
|
Panel panel = panelDao.checkExist(panelCode);
|
|
|
PanelInstance panelInstance = new PanelInstance();
|
|
|
panelInstance.setUserCode(SystemSession.getUser().codeNotEmpty());
|
|
|
panelInstance.setPanelCode(panelCode);
|
|
|
panelInstance.setPanelVersion(panel.getVersion());
|
|
|
// 切换频率、刷新频率
|
|
|
- panelInstance.setSwitchFrequency(oldPanelInstance.getSwitchFrequency());
|
|
|
- panelInstance.setRefreshFrequency(oldPanelInstance.getRefreshFrequency());
|
|
|
+ if (oldPanelInstance != null) {
|
|
|
+ panelInstance.setSwitchFrequency(oldPanelInstance.getSwitchFrequency());
|
|
|
+ panelInstance.setRefreshFrequency(oldPanelInstance.getRefreshFrequency());
|
|
|
+ }
|
|
|
initSwitchFrequence(panelInstance);
|
|
|
panelInstance.toParameters(generateParameters(panelCode));
|
|
|
List<Kanban> kanbans = kanbanDao.findByPanelCode(panelCode);
|
|
|
@@ -418,7 +421,9 @@ public class PanelInstanceServiceImpl extends BaseService<PanelInstance> impleme
|
|
|
throw new IllegalStateException("面板 '" + panel.getName() + "' 未关联看板");
|
|
|
}
|
|
|
panelInstance.initKanbanCodes(kanbans);
|
|
|
- recoverOldParameters(panelInstance, oldPanelInstance);
|
|
|
+ if (oldPanelInstance != null) {
|
|
|
+ recoverOldParameters(panelInstance, oldPanelInstance);
|
|
|
+ }
|
|
|
return panelInstanceDao.save(panelInstance);
|
|
|
}
|
|
|
|