[perf] 去除不必要的方法

This commit is contained in:
WeiXiao
2025-09-28 16:51:48 +08:00
parent 4d098673b1
commit d225c30459
3 changed files with 11 additions and 87 deletions

View File

@@ -13,31 +13,25 @@ http://www.apache.org/licenses/
*/
package com.jeelowcode.core.framework.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jeelowcode.core.framework.entity.*;
import com.jeelowcode.core.framework.mapper.JeeLowCodeMapper;
import com.jeelowcode.core.framework.mapper.ReportFieldMapper;
import com.jeelowcode.core.framework.params.SaveImportDataParam;
import com.jeelowcode.core.framework.service.*;
import com.jeelowcode.core.framework.utils.Func;
import com.jeelowcode.framework.excel.model.ExcelTitleModel;
import com.jeelowcode.framework.exception.JeeLowCodeException;
import com.jeelowcode.framework.utils.component.redis.JeeLowCodeRedisUtils;
import com.jeelowcode.framework.utils.enums.YNEnum;
import com.jeelowcode.framework.utils.model.ExecuteEnhanceModel;
import com.jeelowcode.framework.utils.tool.spring.SpringUtils;
import com.jeelowcode.framework.utils.utils.FuncBase;
import com.jeelowcode.framework.utils.utils.JeeLowCodeUtils;
import com.jeelowcode.core.framework.params.model.ExcelImportDataDictModel;
import com.jeelowcode.core.framework.params.model.ExcelModel;
import com.jeelowcode.core.framework.params.model.ExcelTemplateModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jeelowcode.core.framework.service.*;
import com.jeelowcode.core.framework.utils.Func;
import com.jeelowcode.framework.excel.model.ExcelTitleModel;
import com.jeelowcode.framework.utils.enums.YNEnum;
import com.jeelowcode.framework.utils.utils.FuncBase;
import com.jeelowcode.framework.utils.utils.JeeLowCodeUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.LinkedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@@ -45,8 +39,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@@ -68,12 +60,6 @@ public class ExcelServiceImpl implements IExcelService {
@Autowired
private IExcelFileDataService excelDataService;
@Autowired
private JeeLowCodeRedisUtils jeeLowCodeRedisUtils;
@Autowired
private IExcelFileService excelFileService;
@Autowired
private IReportService reportService;
@@ -169,7 +155,6 @@ public class ExcelServiceImpl implements IExcelService {
/**
* 获取导出基本信息
*
*/
@Override
public ExcelModel getExcelReportModel(String reportCode) {
@@ -177,8 +162,8 @@ public class ExcelServiceImpl implements IExcelService {
String sheetName = reportEntity.getReportName();//表描述
LambdaQueryWrapper<ReportFieldEntity> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(ReportFieldEntity::getReportId,reportEntity.getId());
LambdaQueryWrapper<ReportFieldEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ReportFieldEntity::getReportId, reportEntity.getId());
wrapper.eq(ReportFieldEntity::getIsExport, YNEnum.Y.getCode());
List<ReportFieldEntity> fieldEntityList = reportFieldMapper.selectList(wrapper);
@@ -222,11 +207,11 @@ public class ExcelServiceImpl implements IExcelService {
//获取字典
ExcelImportDataDictModel dictModel = this.formatExcelImportDataList(dbFormId);
//处理导入
SaveImportDataParam param=new SaveImportDataParam();
SaveImportDataParam param = new SaveImportDataParam();
param.setFieldId(fieldId);
param.setEntityList(entityList);
param.setDictModel(dictModel);
frameService.handleImportData(dbFormId,param);
frameService.handleImportData(dbFormId, param);
}

View File

@@ -98,9 +98,6 @@ public class FrameServiceImpl implements IFrameService {
@Autowired
private IDbFormRoleService dbFormRoleService;
@Autowired
private FormRoleDataRuleMapper roleDataRuleMapper;
@Autowired
private JeeLowCodeRedisUtils jeeLowCodeRedisUtils;

View File

@@ -76,38 +76,6 @@ import java.util.stream.Collectors;
*/
public class Func extends FuncBase {
//校验数据类型
public static Object fomatDbValue(String fieldType, Object value) {
if (FuncBase.isEmpty(value)) {
return null;
}
if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.STRING.getFieldType())
|| FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.TEXT.getFieldType())
|| FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.LONGTEXT.getFieldType())) {//字符串
return FuncBase.toStr(value);
} else if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.INTEGER.getFieldType())) {
return FuncBase.toInt(value);
} else if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.BIGINT.getFieldType())) {
return FuncBase.toLong(value);
} else if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.BIGDECIMAL.getFieldType())) {
return new BigDecimal(FuncBase.toStr(value));
} else if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.DATE.getFieldType())) {
//yyyy-MM-dd
String str = FuncBase.toStr(value);
return DateUtil.parseDate(str.substring(0, 10));
} else if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.DATETIME.getFieldType())) {
//yyyy-MM-dd HH:mm:ss
String str = FuncBase.toStr(value);
return DateUtil.parseDateTime(str.substring(0, 19));
} else if (FuncBase.equals(fieldType, JeeLowCodeFieldTypeEnum.TIME.getFieldType())) {
//HH:mm:ss
String str = FuncBase.toStr(value);
return DateUtil.parseTime(str.substring(0, 8));
}
return FuncBase.toStr(value);
}
/**
* 校验表名称是否可用
*
@@ -257,33 +225,7 @@ public class Func extends FuncBase {
return sql;
}
/**
* 执行某一个类下的方法,
*
* @param classPath 类路径
* @param methodName 方法名称
* @param dataMap 参数
* @return
*/
public static Object runByClass(String classPath, String methodName, Map<String, Object> dataMap) {
try {
// 1. 获取Class对象
Class<?> clazz = Class.forName(classPath);
// 2. 创建DemoClass的一个实例
Object demoClassInstance = clazz.getDeclaredConstructor().newInstance();
// 3. 获取getBjName方法的对象
Method method = clazz.getMethod(methodName, Map.class);
// 4. 调用getBjName方法
return method.invoke(demoClassInstance, dataMap);
} catch (Exception e) {
e.printStackTrace();
throw new JeeLowCodeException(e.getMessage());
}
}
//计算
public static String executeJavaExpress(String express, Map<String, Object> dataMap) {