| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.common.model.LocDto; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | |
| | | Object fieldValue2 = getFieldValue(object2, fieldName); |
| | | if (isSame(fieldValue1, fieldValue2)) { |
| | | log.info("字段{}信息一致,{}-{}", fieldName, fieldValue1, fieldValue2); |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | |
| | | try { |
| | | field = aClass.getDeclaredField(fieldName); |
| | | } catch (NoSuchFieldException e) { |
| | | throw new RuntimeException(e); |
| | | return null; |
| | | } |
| | | field.setAccessible(true); // 设置为可访问 |
| | | try { |
| | | return field.get(object); |
| | | } catch (IllegalAccessException e) { |
| | | throw new RuntimeException(e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | LocDto locDto = new LocDto(); |
| | | locDto.setMatnr("123"); |
| | | OrderDetl orderDetl = new OrderDetl(); |
| | | orderDetl.setMatnr("123"); |
| | | System.out.println(compare(locDto, orderDetl)); |
| | | } |
| | | |
| | | } |