mirror of https://gitee.com/stylefeng/roses
【8.1.0】【log】更新公司名称的包装渲染
parent
21f0baadf3
commit
651b12ac48
|
@ -26,6 +26,7 @@ package cn.stylefeng.roses.kernel.log.api.pojo.record;
|
|||
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.SimpleFieldFormat;
|
||||
import cn.stylefeng.roses.kernel.sys.api.format.CompanyNameFormatProcess;
|
||||
import cn.stylefeng.roses.kernel.sys.api.format.UserNameFormatProcess;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -105,6 +106,7 @@ public class LogRecordDTO {
|
|||
* 如果是http请求,并且用户已经登录,可以带这项
|
||||
*/
|
||||
@ChineseDescription("用户请求时候的登录机构id")
|
||||
@SimpleFieldFormat(processClass = CompanyNameFormatProcess.class)
|
||||
private Long userCurrentOrgId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package cn.stylefeng.roses.kernel.sys.api.format;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
|
||||
import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi;
|
||||
import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO;
|
||||
|
||||
/**
|
||||
* 获取公司名称的处理
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024-01-16 20:10
|
||||
*/
|
||||
public class CompanyNameFormatProcess extends BaseSimpleFieldFormatProcess {
|
||||
|
||||
private static final String NULL_ORG_NAME = "空";
|
||||
|
||||
@Override
|
||||
public Class<?> getItemClass() {
|
||||
return Long.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object simpleItemFormat(Object businessId) {
|
||||
|
||||
if (businessId == null) {
|
||||
return NULL_ORG_NAME;
|
||||
}
|
||||
|
||||
Long orgId = Convert.toLong(businessId);
|
||||
|
||||
OrganizationServiceApi organizationServiceApi = SpringUtil.getBean(OrganizationServiceApi.class);
|
||||
|
||||
CompanyDeptDTO orgCompanyInfo = organizationServiceApi.getOrgCompanyInfo(orgId);
|
||||
if (ObjectUtil.isEmpty(orgCompanyInfo)) {
|
||||
return NULL_ORG_NAME;
|
||||
}
|
||||
|
||||
return orgCompanyInfo.getCompanyName();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue