【8.1.8】【system】更新几个通用名称获取的接口

dev-8.1.9
fengshuonan 2024-06-05 11:36:59 +08:00
parent 47d26c0a6b
commit edcabdea53
2 changed files with 169 additions and 0 deletions

View File

@ -0,0 +1,81 @@
package cn.stylefeng.roses.kernel.sys.modular.data.controller;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.sys.modular.data.service.BizDataProviderService;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
*
* @author fengshuonan
* @since 2024-04-20 11:16
*/
@RestController
@ApiResource(name = "表单组件数据提供")
public class BizDataProviderController {
@Resource
private BizDataProviderService bizDataProviderService;
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:19
*/
@GetResource(name = "通过id获取人员写姓名", path = "/bizFormComponentProvider/getUserName")
public ResponseData<String> getUserName(@RequestParam("userId") Long userId) {
return new SuccessResponseData<>(bizDataProviderService.getUserName(userId));
}
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:19
*/
@GetResource(name = "通过id获取机构的名称", path = "/bizFormComponentProvider/getOrgName")
public ResponseData<String> getOrgName(@RequestParam("orgId") Long orgId) {
return new SuccessResponseData<>(bizDataProviderService.getOrgName(orgId));
}
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:24
*/
@GetResource(name = "通过id获取角色名称", path = "/bizFormComponentProvider/getRoleName")
public ResponseData<String> getRoleName(@RequestParam("roleId") Long roleId) {
return new SuccessResponseData<>(bizDataProviderService.getRoleName(roleId));
}
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:24
*/
@GetResource(name = "通过职位id获取职位名称", path = "/bizFormComponentProvider/getPositionName")
public ResponseData<String> getPositionName(@RequestParam("positionId") Long positionId) {
return new SuccessResponseData<>(bizDataProviderService.getPositionName(positionId));
}
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:27
*/
@GetResource(name = "通过字典id获取字典值名称", path = "/bizFormComponentProvider/getDictName")
public ResponseData<String> getDictName(@RequestParam("dictId") Long dictId) {
return new SuccessResponseData<>(bizDataProviderService.getDictName(dictId));
}
}

View File

@ -0,0 +1,88 @@
package cn.stylefeng.roses.kernel.sys.modular.data.service;
import cn.stylefeng.roses.kernel.dict.api.DictApi;
import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi;
import cn.stylefeng.roses.kernel.sys.api.PositionServiceApi;
import cn.stylefeng.roses.kernel.sys.api.SysRoleServiceApi;
import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
import cn.stylefeng.roses.kernel.sys.api.pojo.org.HrOrganizationDTO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
*
*
* @author fengshuonan
* @since 2024-04-20 11:17
*/
@Service
public class BizDataProviderService {
@Resource
private SysUserServiceApi sysUserServiceApi;
@Resource
private OrganizationServiceApi organizationServiceApi;
@Resource
private SysRoleServiceApi sysRoleServiceApi;
@Resource
private PositionServiceApi positionServiceApi;
@Resource
private DictApi dictApi;
/**
*
*
* @author fengshuonan
* @since 2024-04-20 11:18
*/
public String getUserName(Long userId) {
return sysUserServiceApi.getUserRealName(userId);
}
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:23
*/
public String getOrgName(Long orgId) {
HrOrganizationDTO orgInfo = organizationServiceApi.getOrgInfo(orgId);
return orgInfo.getOrgName();
}
/**
* id
*
* @author fengshuonan
* @since 2024-04-20 11:25
*/
public String getRoleName(Long roleId) {
return sysRoleServiceApi.getRoleNameByRoleId(roleId);
}
/**
*
*
* @author fengshuonan
* @since 2024-04-20 11:27
*/
public String getPositionName(Long positionId) {
return positionServiceApi.getPositionName(positionId);
}
/**
* id·
*
* @author fengshuonan
* @since 2024-04-20 11:28
*/
public String getDictName(Long dictId) {
return dictApi.getDictNameByDictId(dictId);
}
}