Browse Source

修改 dic bug

master
lxc 2 years ago
parent
commit
ae6195dad6
  1. 28
      lpro/src/main/java/com/lp/dao/impl/BaseDaoImpl.java
  2. 32
      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;
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.CodeAnnotationBean;
import com.lp.bo.ProDictionaryInfoBO;
@ -27,6 +11,16 @@ import com.lp.util.LogUtil;
import com.lp.util.ObjectUtil;
import com.lp.util.PageBean;
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);
annotationedFieldMap.put(f.getField().getName(), code_value);
}catch(NumberFormatException e){
LogUtil.errorLog(e);
}
annotationedFieldMap.put(f.getField().getName()+"_value", value);
}else{

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

@ -1,18 +1,14 @@
package com.lp.util;
import org.apache.commons.lang.StringUtils;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.Socket;
import java.net.SocketException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
import java.util.*;
public class ObjectUtil extends CommonUtil {
@ -98,11 +94,12 @@ public class ObjectUtil extends CommonUtil {
return -9999;
}
public static String dictionaryValue(Double sdata , String value){
public static String dictionaryValue_old(Double sdata , String value){
if(isNotEmpty(value)){
String[] values = value.split(",");
for(int i=0;i<values.length;i++){
if( sdata == Double.parseDouble(values[i].split(":")[0] )){
return values[i].split(":")[1] ;
}
}
@ -110,7 +107,26 @@ public class ObjectUtil extends CommonUtil {
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工具类
*

Loading…
Cancel
Save