【8.1.0】【log】更新公司名称的包装渲染

pull/60/head
fengshuonan 2024-01-16 20:16:55 +08:00
parent 21f0baadf3
commit 651b12ac48
2 changed files with 46 additions and 0 deletions

View File

@ -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;
/**

View File

@ -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();
}
}