Commit 3c651f95 authored by hongguangwu's avatar hongguangwu

1.5.8-hgw-权限-角色-账号

parent 9ce3005c
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @Author hgw
* @Date 2023-9-5 09:42:31
* @Description EKP数据权限
* @Version 1.0
*/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.permission", ignoreInvalidFields = false)
public class DaprEkpPermissionProperties {
/*
* @author fxj
* @date 14:34
* @Description dapr sidercar url 如:http://localhost:3005/v1.0/invoke/
**/
String appUrl;
/*
* @author fxj
* @date 14:35
* @decription app_id 如:"yifu_upms_sider"
**/
String appId;
String appPort;
String httpPort;
String grpcPort;
String metricsPort;
}
package com.yifu.cloud.plus.v1.job.compont;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprEkpPermissionProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author hgw
* @Description EKP权限定时任务
* @Date 2023-9-5 09:40:09
**/
@Component(value = "ekpPermissionTask")
@Slf4j
@EnableConfigurationProperties(DaprEkpPermissionProperties.class)
public class EkpPermissionTask {
@Autowired
private DaprEkpPermissionProperties daprEkpPermissionProperties;
/**
* @return
* @Author hgw
* @Description 刷新EKP权限里的账号信息
* @Date 2023-9-5 09:45:22
* @Param
**/
public void doStatisticsTaxDeclarer() throws Exception {
log.info("-------------刷新EKP权限里的账号信息-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpPermissionProperties.getAppUrl(), daprEkpPermissionProperties.getAppId(),
"/sysuserinfo/inner/doRefreshEkpUser", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------刷新EKP权限里的账号信息-定时任务结束------------");
}
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService; import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo; import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
...@@ -113,4 +114,18 @@ public class SysUserInfoController { ...@@ -113,4 +114,18 @@ public class SysUserInfoController {
return R.ok(sysUserInfoService.removeById(fdId)); return R.ok(sysUserInfoService.removeById(fdId));
} }
/**
* @param
* @Description: 定时任务-自动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 16:07
* @return: void
**/
@Inner
@Operation(description = "定时任务-自动同步并更新账号信息")
@PostMapping("/inner/doRefreshEkpUser")
public void doRefreshEkpUser() {
sysUserInfoService.doRefreshEkpUser();
}
} }
...@@ -22,6 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo; ...@@ -22,6 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 新权限-账号管理表 * 新权限-账号管理表
* *
...@@ -37,4 +39,14 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> { ...@@ -37,4 +39,14 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
* @return * @return
*/ */
IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, @Param("sysUserInfo") SysUserInfo sysUserInfo); IPage<SysUserInfo> getSysUserInfoPage(Page<SysUserInfo> page, @Param("sysUserInfo") SysUserInfo sysUserInfo);
/**
* @param
* @Description: 获取EKP全部账号
* @Author: hgw
* @Date: 2023/9/4 11:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo>
**/
List<SysUserInfo> getEkpUser();
} }
...@@ -60,4 +60,13 @@ public interface SysUserInfoService extends IService<SysUserInfo> { ...@@ -60,4 +60,13 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/ **/
R<String> saveOrUpdateUserInfo(SysUserInfoSaveVo vo); R<String> saveOrUpdateUserInfo(SysUserInfoSaveVo vo);
/**
* @param
* @Description: 同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 11:30
* @return: void
**/
void doRefreshEkpUser();
} }
...@@ -79,15 +79,15 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo ...@@ -79,15 +79,15 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
SysRoleMenuResSearchVo sysRoleMenuRes = new SysRoleMenuResSearchVo(); SysRoleMenuResSearchVo sysRoleMenuRes = new SysRoleMenuResSearchVo();
sysRoleMenuRes.setRoleId(role.getFdId()); sysRoleMenuRes.setRoleId(role.getFdId());
List<SysRoleMenuRes> resList = sysRoleMenuResService.noPageDiy(sysRoleMenuRes); List<SysRoleMenuRes> resList = sysRoleMenuResService.noPageDiy(sysRoleMenuRes);
vo.setRole(role);
vo.setResList(resList);
}
List<TreeNode<String>> collect = sysMenuMapper List<TreeNode<String>> collect = sysMenuMapper
.selectList(Wrappers.<SysMenu>lambdaQuery() .selectList(Wrappers.<SysMenu>lambdaQuery()
.orderByAsc(SysMenu::getCreateTime)).stream() .orderByAsc(SysMenu::getCreateTime)).stream()
.map(getNodeFunction()).collect(Collectors.toList()); .map(getNodeFunction()).collect(Collectors.toList());
List<Tree<String>> tree = TreeUtil.build(collect, CommonConstants.ZERO_STRING); List<Tree<String>> tree = TreeUtil.build(collect, CommonConstants.ZERO_STRING);
vo.setRole(role);
vo.setResList(resList);
vo.setTree(tree); vo.setTree(tree);
}
return R.ok(vo); return R.ok(vo);
} }
......
...@@ -154,4 +154,17 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs ...@@ -154,4 +154,17 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
return R.failed("请检查信息"); return R.failed("请检查信息");
} }
/**
* @param
* @Description: 同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/4 11:31
* @return: java.lang.String
**/
@Override
public void doRefreshEkpUser() {
List<SysUserInfo> ekpUser = baseMapper.getEkpUser();
this.saveOrUpdateBatch(ekpUser);
}
} }
...@@ -116,4 +116,13 @@ ...@@ -116,4 +116,13 @@
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<!--list-->
<select id="getEkpUser" resultMap="sysUserInfoMap">
select e.fd_id,e.fd_name,p.fd_login_name,e.fd_ldap_dn
,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) AS fd_dept_name
,p.fd_mobile_no,p.fd_email
from sys_org_element e JOIN sys_org_person p on e.fd_id=p.fd_id
</select>
</mapper> </mapper>
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