Browse Source

Merge branch 'master' of http://192.168.1.200/lxc/Iot

master
谕仙 2 years ago
parent
commit
5dad877a7f
  1. 28
      lpro/src/main/java/com/lp/dao/impl/BaseDaoImpl.java
  2. 36
      lpro/src/main/java/com/lp/util/ObjectUtil.java

28
lpro/src/main/java/com/lp/dao/impl/BaseDaoImpl.java

@ -1,21 +1,5 @@
package com.lp.dao.impl; package com.lp.dao.impl;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.lp.annotation.Code; import com.lp.annotation.Code;
import com.lp.annotation.CodeAnnotationBean; import com.lp.annotation.CodeAnnotationBean;
import com.lp.bo.ProDictionaryInfoBO; import com.lp.bo.ProDictionaryInfoBO;
@ -27,6 +11,16 @@ import com.lp.util.LogUtil;
import com.lp.util.ObjectUtil; import com.lp.util.ObjectUtil;
import com.lp.util.PageBean; import com.lp.util.PageBean;
import com.lp.util.ResultMapUtils; import com.lp.util.ResultMapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
/** /**
* 数据访问基类 * 数据访问基类
@ -196,7 +190,7 @@ public class BaseDaoImpl extends ResultMapUtils implements BaseDao {
code_value = ObjectUtil.dictionaryValue( Double.parseDouble(String.valueOf(valueSdata)), value); code_value = ObjectUtil.dictionaryValue( Double.parseDouble(String.valueOf(valueSdata)), value);
annotationedFieldMap.put(f.getField().getName(), code_value); annotationedFieldMap.put(f.getField().getName(), code_value);
}catch(NumberFormatException e){ }catch(NumberFormatException e){
LogUtil.errorLog(e);
} }
annotationedFieldMap.put(f.getField().getName()+"_value", value); annotationedFieldMap.put(f.getField().getName()+"_value", value);
}else{ }else{

36
lpro/src/main/java/com/lp/util/ObjectUtil.java

@ -1,18 +1,14 @@
package com.lp.util; package com.lp.util;
import org.apache.commons.lang.StringUtils;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
public class ObjectUtil extends CommonUtil { public class ObjectUtil extends CommonUtil {
@ -98,19 +94,39 @@ public class ObjectUtil extends CommonUtil {
return -9999; return -9999;
} }
public static String dictionaryValue(Double sdata , String value){ public static String dictionaryValue_old(Double sdata , String value){
if(isNotEmpty(value)){ if(isNotEmpty(value)){
String[] values = value.split(","); String[] values = value.split(",");
for(int i=0;i<values.length;i++){ for(int i=0;i<values.length;i++){
if( sdata == Double.parseDouble(values[i].split(":")[0] )){ if( sdata == Double.parseDouble(values[i].split(":")[0] )){
return values[i].split(":")[1] ; return values[i].split(":")[1] ;
} }
} }
} }
return null ; return null ;
} }
/*
2022-09-27
lxc 修改
* */
public static String dictionaryValue(Double sdata , String value){
if(isNotEmpty(value)){
String[] keyvalues = value.split(",");
for(int i=0;i<keyvalues.length;i++){
String[] keyvalue= keyvalues[i].split(":");
if(keyvalue.length>1){
if( sdata == Double.parseDouble(keyvalue[0] )){
return keyvalue[1] ;
}
}
}
}
return null ;
}
/** /**
* socket工具类 * socket工具类
* *

Loading…
Cancel
Save