fix(common): 统一异常处理并迁移打印功能到hiprint
- 替换所有System.out.println和printStackTrace为slf4j日志记录 - 在BeanUtils、AuditFieldUtil、DateUtils、ServletUtils等工具类中添加Logger实例 - 在Flowable相关控制器和服务中统一错误日志记录格式 - 在代码生成器中添加日志记录功能 - 将前端打印组件从Lodop迁移到hiprint打印方案 - 更新体温单打印功能使用hiprint预览打印 - 移除调试用的console.log语句 - 修复打印模板中线条元素类型定义
This commit is contained in:
@@ -7,6 +7,8 @@ import com.openhis.common.annotation.Dict;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -20,6 +22,8 @@ import java.util.List;
|
||||
@Component
|
||||
public class DictAspect {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DictAspect.class);
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate; // 使用 JdbcTemplate 执行 SQL
|
||||
|
||||
@@ -99,15 +103,15 @@ public class DictAspect {
|
||||
// 查询字典值
|
||||
String dictLabel = queryDictLabel(dictTable, dictCode, dictText, deleteFlag, fieldValue.toString());
|
||||
if (dictLabel != null) {
|
||||
// 动态生成 _dictText 字段名
|
||||
String textFieldName = field.getName() + "_dictText";
|
||||
try {
|
||||
// 动态生成 _dictText 字段名
|
||||
String textFieldName = field.getName() + "_dictText";
|
||||
Field textField = dto.getClass().getDeclaredField(textFieldName);
|
||||
textField.setAccessible(true);
|
||||
textField.set(dto, dictLabel); // 设置 _dictText 字段的值
|
||||
} catch (NoSuchFieldException e) {
|
||||
// 如果 _dictText 字段不存在,忽略错误
|
||||
e.printStackTrace();
|
||||
log.debug("字段 {} 不存在,跳过字典翻译", textFieldName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user