|
|
@@ -9,16 +9,16 @@ import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseCtlReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseFunReqVo;
|
|
|
import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceBaseService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
|
import org.springframework.aop.support.AopUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.lang.reflect.Method;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author 123
|
|
|
@@ -256,13 +256,27 @@ public abstract class IotDeviceBaseServiceImpl implements IotDeviceBaseService {
|
|
|
String methodName = iotDeviceBaseFunReqVo.getMethodName();
|
|
|
// 获取类下所有的方法
|
|
|
Method[] methods = this.getClass().getDeclaredMethods();
|
|
|
+ Method[] parentMethods = this.getClass().getSuperclass().getDeclaredMethods();
|
|
|
+ Map<String, Method> parentMethodMap = new HashMap<>();
|
|
|
+ for (Method item : parentMethods) {
|
|
|
+ String mn = item.getName();
|
|
|
+ int pc = item.getParameterCount();
|
|
|
+ String key = mn + pc;
|
|
|
+ parentMethodMap.put(key, item);
|
|
|
+ }
|
|
|
Method method = null;
|
|
|
T param = null;
|
|
|
// 根据methodName通过反射获取对应方法,并对参数进行预处理
|
|
|
for (Method item : methods) {
|
|
|
// 判断方法名称与参数数量
|
|
|
- if (!item.getName().equals(methodName) || item.getParameterCount() > 1) {
|
|
|
- continue;
|
|
|
+ String metname = item.getName();
|
|
|
+ int parameCount = item.getParameterCount();
|
|
|
+ if (!metname.equals(methodName) || parameCount > 1) {
|
|
|
+ if(parentMethodMap.containsKey(methodName + parameCount)){
|
|
|
+ item = parentMethodMap.get(methodName + parameCount);
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
method = item;
|
|
|
// 获取方法的参数类型
|