Commit 930b6bdb by guojuxing

删除策略接口

parent d4d693a2
......@@ -68,6 +68,14 @@ public interface UnionEnterpriseAuthApiService {
*/
ServiceResponse<List<UnionEnterpriseAuthListDTO>> listUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId, String enterpriseName, Integer authStatus);
/**
* 查询联合商户数据
* @param ownEnterpriseId
* @return
*/
ServiceResponse<List<UnionEnterpriseAuthDTO>> listUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId);
/**************应用策略************************/
/**
......@@ -100,6 +108,13 @@ public interface UnionEnterpriseAuthApiService {
ServiceResponse<String> deleteUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
/**
* 批量删除接口
* @param unionEnterpriseAuthId
* @return
*/
ServiceResponse<String> deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(@NotNull Integer unionEnterpriseAuthId);
/**
* 到期发送解除联合通知
* @param param
* @return
......
......@@ -3,6 +3,7 @@ package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp;
import org.apache.ibatis.annotations.Param;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
......@@ -71,4 +72,11 @@ public interface TabSysUnionEnterpriseAuthAppMapper {
int countRepeatStrategyName(@Param("unionEnterpriseAuthAppId") Integer unionEnterpriseAuthAppId,
@Param("unionEnterpriseAuthId") Integer unionEnterpriseAuthId,
@Param("strategyName") String strategyName);
/**
* 批量删除
* @param unionEnterpriseAuthId
* @return
*/
int deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(@Param("unionEnterpriseAuthId") Integer unionEnterpriseAuthId);
}
\ No newline at end of file
......@@ -58,4 +58,11 @@ public interface UnionEnterpriseAuthAppService {
* @return
*/
int deleteUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
/**
* 批量删除策略
* @param unionEnterpriseAuthId
* @return
*/
int deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(@NotNull Integer unionEnterpriseAuthId);
}
......@@ -67,4 +67,9 @@ public class UnionEnterpriseAuthAppServiceImpl implements UnionEnterpriseAuthApp
.setDeleteFlag(1)
.setUnionEnterpriseAuthAppId(unionEnterpriseAuthAppId));
}
@Override
public int deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(@NotNull Integer unionEnterpriseAuthId) {
return tabSysUnionEnterpriseAuthAppMapper.deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(unionEnterpriseAuthId);
}
}
......@@ -211,6 +211,11 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
}
@Override
public ServiceResponse<List<UnionEnterpriseAuthDTO>> listUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId) {
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> saveOrUpdateUnionEnterpriseAuthApp(@Valid UnionEnterpriseAuthAppDTO dto) {
List<TabSysUnionEnterpriseAuthApp> appList = unionEnterpriseAuthAppService.listUnionEnterpriseAuthApp(dto.getUnionEnterpriseAuthId());
Set<String> appIdSet = new HashSet<>();
......@@ -276,6 +281,12 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
}
@Override
public ServiceResponse<String> deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(@NotNull Integer unionEnterpriseAuthId) {
int num = unionEnterpriseAuthAppService.deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(unionEnterpriseAuthId);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> relieveTask(String param) {
List<TabSysUnionEnterpriseAuth> list = unionEnterpriseAuthService.listAll();
if (CollectionUtils.isNotEmpty(list)) {
......
......@@ -144,7 +144,7 @@
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
</select>
<select id="countRepeatStrategyName" resultType="int">
<select id="countRepeatStrategyName" resultType="Integer">
select count(1) from tab_sys_union_enterprise_auth_app
where delete_flag = 0
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
......@@ -153,4 +153,10 @@
</if>
and strategy_name = #{strategyName}
</select>
<select id="deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId" resultType="Integer">
update tab_sys_union_enterprise_auth_app set delete_flag = 1
where delete_flag = 0
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
</select>
</mapper>
\ No newline at end of file
......@@ -271,10 +271,8 @@ public class UnionEnterpriseAuthController {
@RequestMapping("/user-area")
public RestResponse channelResource(Integer resourceGroupId, Integer enterpriseId) {
Integer ownEnterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
UnionEnterpriseAuthDTO old = getUnionEnterpriseAuth(ownEnterpriseId, enterpriseId);
if (old == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在");
}
UnionEnterpriseAuthDTO old = checkUnionEnterpriseAuth(ownEnterpriseId, enterpriseId);
if (old.getResourceGroupId() != null && !old.getResourceGroupId().equals(resourceGroupId)) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "资源组数据错误,与联合商户授权资源不相符");
}
......@@ -341,10 +339,7 @@ public class UnionEnterpriseAuthController {
@RequestMapping("auth-app-resource")
public RestResponse authAppResource(UnionEnterpriseAuthAppQO unionEnterpriseAuthAppQO) {
//app资源授权
UnionEnterpriseAuthDTO old = getUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), unionEnterpriseAuthAppQO.getEnterpriseId());
if (old == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在");
}
UnionEnterpriseAuthDTO old = checkUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), unionEnterpriseAuthAppQO.getEnterpriseId());
UnionEnterpriseAuthAppDTO dto = EntityUtil.changeEntityNew(UnionEnterpriseAuthAppDTO.class, unionEnterpriseAuthAppQO);
dto.setUnionEnterpriseAuthId(old.getUnionEnterpriseAuthId());
return OperationResultUtils.operationResult(
......@@ -372,6 +367,13 @@ public class UnionEnterpriseAuthController {
return getAppStrategy(UserDetailUtils.getUserDetail().getEnterpriseId(), enterpriseId);
}
@RequestMapping("delete-all-app-resource")
public RestResponse deleteAllAppResource(Integer enterpriseId) {
UnionEnterpriseAuthDTO old = checkUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), enterpriseId);
return ResultControllerUtils.commonResult(unionEnterpriseAuthApiService
.deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId(old.getUnionEnterpriseAuthId()));
}
/**
* 自有商户列表
......@@ -545,6 +547,15 @@ public class UnionEnterpriseAuthController {
return null;
}
private UnionEnterpriseAuthDTO checkUnionEnterpriseAuth(Integer ownEnterpriseId, Integer unionEnterpriseId) {
ServiceResponse<UnionEnterpriseAuthDTO> unionResponse = unionEnterpriseAuthApiService
.getUnionEnterpriseAuth(ownEnterpriseId, unionEnterpriseId);
if (unionResponse.isSuccess()) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "联合记录不存在");
}
return unionResponse.getResult();
}
private EnterpriseDTO getEnterpriseById(Integer enterpriseId) {
//查询联合商户信息
ServiceResponse<EnterpriseDTO> enterpriseResponse = enterpriseApiService.getEnterpriseById(enterpriseId);
......
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