Commit 2cc8254f by guojuxing

提供账号分组需要的接口

parent fcf11c6a
......@@ -43,6 +43,13 @@ public interface UnionEnterpriseAuthApiService {
ServiceResponse<UnionEnterpriseAuthDTO> getUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId);
/**
* 查询账号分组授权给了哪个联合商户,如果没有,返回null
* @param accountGroupId
* @return
*/
ServiceResponse<Integer> getEnterpriseIdByAuthAccountGroupId(Integer accountGroupId);
/**
* 资源重新授权
* @param ownEnterpriseId
* @param unionEnterpriseId
......
......@@ -35,6 +35,13 @@ public interface UnionEnterpriseAuthService {
TabSysUnionEnterpriseAuth getUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId);
/**
* 查询账号分组授权给了哪个联合商户,如果没有,返回null
* @param accountGroupId
* @return
*/
Integer getEnterpriseIdByAuthAccountGroupId(Integer accountGroupId);
/**
* 更新数据
*
* @param dto
......
......@@ -8,12 +8,15 @@ import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuth;
import com.gic.enterprise.service.UnionEnterpriseAuthService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 联合商户
......@@ -46,6 +49,21 @@ public class UnionEnterpriseAuthServiceImpl implements UnionEnterpriseAuthServic
}
@Override
public Integer getEnterpriseIdByAuthAccountGroupId(Integer accountGroupId) {
List<TabSysUnionEnterpriseAuth> list = tabSysUnionEnterpriseAuthMapper.listUnionEnterpriseAuthByAccountGroupId(accountGroupId);
if (CollectionUtils.isNotEmpty(list)) {
//账号分组不能同时授权多个商户
for (TabSysUnionEnterpriseAuth temp : list) {
String accountGroup = temp.getAccountGroup();
if (Arrays.stream(accountGroup.split(",")).anyMatch(e -> Objects.equals(accountGroupId, e))) {
return temp.getUnionEnterpriseId();
}
}
}
return null;
}
@Override
public int update(UnionEnterpriseAuthDTO dto) {
TabSysUnionEnterpriseAuth record = EntityUtil.changeEntityNew(TabSysUnionEnterpriseAuth.class, dto);
record.setUpdateTime(new Date());
......
......@@ -156,6 +156,11 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
}
@Override
public ServiceResponse<Integer> getEnterpriseIdByAuthAccountGroupId(Integer accountGroupId) {
return ServiceResponse.success(unionEnterpriseAuthService.getEnterpriseIdByAuthAccountGroupId(accountGroupId));
}
@Override
public ServiceResponse<Void> resetAuthResource(Integer ownEnterpriseId, Integer unionEnterpriseId, Integer resourceType) {
Assert.notNull(ownEnterpriseId, "自有商户不能为空");
Assert.notNull(unionEnterpriseId, "联合商户不能为空");
......
......@@ -301,6 +301,14 @@
</select>
<select id="listUnionEnterpriseAuthByAccountGroupId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_union_enterprise_auth
where delete_flag = 0
and status_flag != 3
and account_group like concat('%', #{accountGroupId}, '%')
</select>
<select id="listAll" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_union_enterprise_auth
......
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