Commit 1c4a7c0b by guojuxing

新建联合商户重复创建过滤

parent a0d45170
......@@ -94,11 +94,17 @@ public class UnionEnterpriseAuthController {
* @return
*/
@RequestMapping("check-enterprise-by-name")
public RestResponse checkEnterpriseName(String enterpriseName) {
public RestResponse checkEnterpriseName(String enterpriseName, Boolean isAdd) {
EnterpriseDTO enterpriseDTO = checkEnterpriseByEnterpriseName(enterpriseName);
if (enterpriseDTO == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在或者是自有商户");
}
if (isAdd != null && isAdd) {
UnionEnterpriseAuthDTO old = getUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), enterpriseDTO.getEnterpriseId());
if (old != null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户已经联合");
}
}
return RestResponse.success(EntityUtil.changeEntityNew(EnterpriseInfoVO.class, enterpriseDTO));
}
......@@ -151,7 +157,7 @@ public class UnionEnterpriseAuthController {
* @return
*/
@RequestMapping("create-union-enterprise")
public RestResponse createUnionEnterprise(String authCode, Integer authCodeId, String enterpriseName, Boolean isAdd) {
public RestResponse createUnionEnterprise(String authCode, Integer authCodeId, String enterpriseName) {
ServiceResponse authCodeResult = authCodeApiService.validateAuthCode(authCodeId, authCode);
if (!authCodeResult.isSuccess()) {
return RestResponse.failure(authCodeResult.getCode(), authCodeResult.getMessage());
......@@ -160,12 +166,6 @@ public class UnionEnterpriseAuthController {
if (unionEnterprise == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在或者是自有商户");
}
if (isAdd != null && isAdd) {
UnionEnterpriseAuthDTO old = getUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), unionEnterprise.getEnterpriseId());
if (old != null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户已经联合");
}
}
Integer ownEnterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
Integer unionEnterpriseId = unionEnterprise.getEnterpriseId();
......
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