From 22631d5f009409330d87e86f34420150f5c06eeb Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 2 Sep 2020 12:32:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0footbar=EF=BC=8C=E5=90=8C=E6=AD=A5=E5=88=B0=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E6=9C=89=E8=87=AA=E5=AE=9A=E4=B9=89footbar=E7=9A=84?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/CustomerFootBarFormDTO.java | 14 ++++----- .../controller/CustomerFootBarController.java | 2 +- .../com/epmet/dao/CustomerFootBarDao.java | 2 ++ .../impl/CustomerFootBarServiceImpl.java | 29 ++++++++++++++++++- .../resources/mapper/CustomerFootBarDao.xml | 6 ++++ 5 files changed, 44 insertions(+), 9 deletions(-) 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..b72edf0ed4 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 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 From 94b81f624fdbb397c6e6a62a34b25a2da2b3ab4b Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 2 Sep 2020 12:37:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=AE=A2=E6=88=B7=E7=9A=84footbar=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E4=BF=AE=E6=94=B9bar=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E6=80=A7=E9=AA=8C=E8=AF=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CustomerFootBarServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 b72edf0ed4..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 @@ -207,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);