From bc73413f514e6fab6fd36576f45e030554af481a Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 7 Sep 2020 15:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=A4=96=E9=83=A8=E5=BA=94?= =?UTF-8?q?=E7=94=A8-=E5=86=85=E9=83=A8=E5=AE=A2=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/enu/CustomerTypeEnum.java | 6 +++--- .../epmet/service/impl/ExternalAppServiceImpl.java | 13 ++++++++++++- .../db/migration/V0.0.4__add_extcustomer_source.sql | 1 - .../db/migration/V0.0.4__add_extcustomer_type.sql | 1 + .../src/main/resources/mapper/ExternalAppDao.xml | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) delete mode 100644 epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_source.sql create mode 100644 epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_type.sql diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/CustomerTypeEnum.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/CustomerTypeEnum.java index c8554aeff2..c8ecc22dab 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/CustomerTypeEnum.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/CustomerTypeEnum.java @@ -7,9 +7,9 @@ import org.apache.commons.lang3.StringUtils; */ public enum CustomerTypeEnum { - INTERNAL("internal", "内部应用"), - EXTERNAL("external", "外部应用"), - UN_KNOW("unknow", "未知应用"); + INTERNAL("internal", "内部客户"), + EXTERNAL("external", "外部客户"), + UN_KNOW("unknow", "未知类型"); private String type; private String name; diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java index b04ccc65c2..32248addc8 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java @@ -74,11 +74,22 @@ public class ExternalAppServiceImpl implements ExternalAppService { EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getMsg()); } - if (externalCustomerDao.selectById(customerId) == null) { + if (CustomerTypeEnum.EXTERNAL.getType().equals(customerType) && externalCustomerDao.selectById(customerId) == null) { throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); } + if (CustomerTypeEnum.INTERNAL.getType().equals(customerType)) { + CustomerDTO form = new CustomerDTO(); + form.setId(customerId); + Result customerInfoRst = operCrmOpenFeignClient.getCustomerInfo(form); + if (customerInfoRst.success() && customerInfoRst.getData() == null) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), + EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); + } + + } + // 应用表插入 ExternalAppEntity appEntity = new ExternalAppEntity(); appEntity.setAppName(appName); diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_source.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_source.sql deleted file mode 100644 index 397bbebd5d..0000000000 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_source.sql +++ /dev/null @@ -1 +0,0 @@ -alter table external_app add column CUSTOMER_SOURCE varchar(20) not null after CUSTOMER_ID; \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_type.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_type.sql new file mode 100644 index 0000000000..fb82b44bcd --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.4__add_extcustomer_type.sql @@ -0,0 +1 @@ +alter table external_app add column CUSTOMER_TYPE varchar(20) not null after CUSTOMER_ID; \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml index b28e57914d..eea8b47dde 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml @@ -7,6 +7,7 @@ +