diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java index d699264d4b..37674bfa8f 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java @@ -15,27 +15,27 @@ public class CustomerFootBarFormDTO { public interface CreateFootBarGroup extends CustomerClientShowGroup {} // 查询footbar列表分组 - public interface ListFootBarGroup {} + public interface ListFootBarGroup extends CustomerClientShowGroup {} // 更新footbar - public interface UpdateFootBarGroup {} + public interface UpdateFootBarGroup extends CustomerClientShowGroup {} // 保存顺序 - public interface SaveOrderGroup {} + public interface SaveOrderGroup extends CustomerClientShowGroup {} // 明细分组 - public interface FootBarDetailGroup {} + public interface FootBarDetailGroup extends CustomerClientShowGroup {} // 更新显示状态分组 - public interface UpdateDisplayStatusGroup {} + public interface UpdateDisplayStatusGroup extends CustomerClientShowGroup {} // 为客户添加默认footbar - public interface AddDefaultFootbars4Customer {} + public interface AddDefaultFootbars4Customer extends CustomerClientShowGroup {} @NotBlank(message = "FootBar的ID不能为空", groups = { UpdateFootBarGroup.class, FootBarDetailGroup.class, UpdateDisplayStatusGroup.class }) private String id; - @NotBlank(message = "客户ID不能为空", groups = { CreateFootBarGroup.class, AddDefaultFootbars4Customer.class }) + @NotBlank(message = "客户ID不能为空", groups = { AddDefaultFootbars4Customer.class }) private String customerId; // 哪一个端:gov,resi diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java index 3dae048df4..299298a0f0 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java @@ -121,7 +121,7 @@ public class CustomerFootBarController { } /** - * 创建footbar + * 创建footbar,只能创建默认的,不能直接为客户创建 * @param form * @return */ diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java index 3d8c9e6b3b..eff4970807 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java @@ -71,4 +71,6 @@ public interface CustomerFootBarDao extends BaseDao { @Param("appType") String appType); void updateDisplayStatus(@Param("id") String id, @Param("display") Boolean display); + + List listFootBarOwnerCustomerIds(); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java index 2527adf140..1b732343e4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java @@ -118,7 +118,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl customerIds = baseDao.listFootBarOwnerCustomerIds(); + for (String customerId : customerIds) { + CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, entity.getAppType(), entity.getBarKey()); + if (bar == null) { + // 该客户还没有该bar + CustomerFootBarEntity newBar = new CustomerFootBarEntity(); + newBar.setCustomerId(customerId); + newBar.setIconPath(entity.getIconPath()); + newBar.setPageTitle(entity.getPageTitle()); + newBar.setBarKey(entity.getBarKey()); + newBar.setBarName(entity.getBarName()); + newBar.setSelectedIconPath(entity.getSelectedIconPath()); + newBar.setOrderIndex(baseDao.fetchNextOrder(customerId, entity.getAppType())); + newBar.setAppType(entity.getAppType()); + newBar.setDisplay(true); + baseDao.insert(newBar); + } + } } @Override @@ -180,14 +207,14 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl footBarsOfCustomer = baseDao.listByAppTypeAndCustomerId(customerId, appType); - if (!CollectionUtils.isEmpty(footBarsOfCustomer)) { - throw new RenException(EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getCode(), - EpmetErrorCode.OPER_CUSTOMER_FOOTBAR_EXISTS.getMsg()); - } - List defaultBars = baseDao.listByAppTypeAndCustomerId("default", appType); for (CustomerFootBarEntity defaultBar : defaultBars) { + CustomerFootBarEntity bar = baseDao.getByAppTypeAndBarKeyOfCustomer(customerId, appType, defaultBar.getBarKey()); + if (bar != null) { + // 该客户已经有该bar了,不再添加 + continue; + } + defaultBar.setCustomerId(customerId); defaultBar.setId(null); defaultBar.setCreatedTime(null); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml index f8bc70c1da..54dec77c47 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml @@ -124,5 +124,11 @@ and app_type = #{appType} + + \ No newline at end of file