Commit 72f05639 by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents f914557b 3a598654
...@@ -14,7 +14,7 @@ public interface UnionEnterpriseApiService { ...@@ -14,7 +14,7 @@ public interface UnionEnterpriseApiService {
ServiceResponse<Integer> delUnionEnterprise(Integer unionId, Integer enterpriseId); ServiceResponse<Integer> delUnionEnterprise(Integer unionId, Integer enterpriseId);
ServiceResponse<Integer> delUnionEnterpriseSource(Long resourceId); ServiceResponse<Integer> delUnionEnterpriseSource(Long resourceId, Integer enterpriseId);
ServiceResponse<UnionEnterpriseDTO> getUnionEnterpriseById(Integer unionId); ServiceResponse<UnionEnterpriseDTO> getUnionEnterpriseById(Integer unionId);
......
...@@ -74,4 +74,6 @@ public interface TabSysUnionEnterpriseResourceMapper { ...@@ -74,4 +74,6 @@ public interface TabSysUnionEnterpriseResourceMapper {
int delResourceByResourceId(Long resourceId); int delResourceByResourceId(Long resourceId);
List<String> getKeyByResourceId(@Param("resourceId") Long resourceId); List<String> getKeyByResourceId(@Param("resourceId") Long resourceId);
List<Integer> getUnionEnterpriseIdByResouce(@Param("resourceId") Long resourceId);
} }
\ No newline at end of file
...@@ -23,4 +23,6 @@ public interface UnionEnterpriseResourceService { ...@@ -23,4 +23,6 @@ public interface UnionEnterpriseResourceService {
List<TabSysUnionEnterpriseResource> listResourceByUnionId(Integer unionId); List<TabSysUnionEnterpriseResource> listResourceByUnionId(Integer unionId);
String getKeyByResourceId(Long resourceId); String getKeyByResourceId(Long resourceId);
Integer getUnionEnterpriseIdByResouce(Long resourceId);
} }
...@@ -83,4 +83,13 @@ public class UnionEnterrpiseResourceServiceImpl implements UnionEnterpriseResour ...@@ -83,4 +83,13 @@ public class UnionEnterrpiseResourceServiceImpl implements UnionEnterpriseResour
} }
return null; return null;
} }
@Override
public Integer getUnionEnterpriseIdByResouce(Long resourceId) {
List<Integer> list = this.tabSysUnionEnterpriseResourceMapper.getUnionEnterpriseIdByResouce(resourceId);
if(CollectionUtils.isNotEmpty(list)){
return list.get(0);
}
return 0;
}
} }
...@@ -74,8 +74,12 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService ...@@ -74,8 +74,12 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
} }
@Override @Override
public ServiceResponse<Integer> delUnionEnterpriseSource(Long resourceId) { public ServiceResponse<Integer> delUnionEnterpriseSource(Long resourceId, Integer enterpriseId) {
int i = this.unionEnterpriseResourceService.delResource(resourceId); int i = this.unionEnterpriseResourceService.delResource(resourceId);
if(i > 0){
Integer unionEnterpriseId = this.unionEnterpriseResourceService.getUnionEnterpriseIdByResouce(resourceId);
this.storeAuthorizationApiService.cancelStoreAll(enterpriseId, unionEnterpriseId);
}
return ServiceResponse.success(i); return ServiceResponse.success(i);
} }
......
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
</update> </update>
<update id="updateAuthorizationStatus" > <update id="updateAuthorizationStatus" >
update tab_sys_union_enterprise_resource update tab_sys_union_enterprise_resource
set authorization_status=#{authOrizationStatus},authorization_time=now(),authorization_message=#{authOrizationMessage}, key=#{key} set authorization_status=#{authOrizationStatus},authorization_time=now(),authorization_message=#{authOrizationMessage}, auth_key=#{key}
where enterprise_id= #{enterpriseId} and resource_type=#{resourceType} and status = 1 where enterprise_id= #{enterpriseId} and resource_type=#{resourceType} and status = 1
</update> </update>
<select id="listResourceByEnterpriseIdAndType" resultType="com.gic.auth.dto.UnionEnterpriseResourceDTO"> <select id="listResourceByEnterpriseIdAndType" resultType="com.gic.auth.dto.UnionEnterpriseResourceDTO">
...@@ -205,9 +205,15 @@ ...@@ -205,9 +205,15 @@
</update> </update>
<select id="getKeyByResourceId" resultMap="BaseResultMap"> <select id="getKeyByResourceId" resultMap="BaseResultMap">
select select
key auth_key
from tab_sys_union_enterprise_resource from tab_sys_union_enterprise_resource
where resource=#{resourceId} where resource=#{resourceId}
and status = 1 and status = 1
</select> </select>
<select id="getUnionEnterpriseIdByResouce" resultMap="BaseResultMap">
select
union_enterprise_id
from tab_sys_union_enterprise_resource t1, tab_sys_union_enterprise t2 where t1.union_id= t2.union_id
and t1.resource=#{resourceId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -120,7 +120,8 @@ public class UnionEnterpriseController { ...@@ -120,7 +120,8 @@ public class UnionEnterpriseController {
if(resourceId == null){ if(resourceId == null){
return EnterpriseRestResponse.failure(ErrorCode.MISS_PARAMETER); return EnterpriseRestResponse.failure(ErrorCode.MISS_PARAMETER);
} }
ServiceResponse<Integer> response = this.unionEnterpriseApiService.delUnionEnterpriseSource(resourceId); Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<Integer> response = this.unionEnterpriseApiService.delUnionEnterpriseSource(resourceId, enterpriseId);
if(response.getResult()>0){ if(response.getResult()>0){
ResourceTypeEnum[] values = ResourceTypeEnum.values(); ResourceTypeEnum[] values = ResourceTypeEnum.values();
for(ResourceTypeEnum typeEnum : values){ for(ResourceTypeEnum typeEnum : values){
......
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