你还敢乱粘贴吗?

记一次联调测试的锅, 从此再也不敢乱粘代码了...

    private Map<String, String> generateParams(HandlingFeeReq reqData) {
        Map<String, String> params = new HashMap();
        Field[] fieldArr = reqData.getClass().getDeclaredFields();
        try {
            for (Field field : fieldArr) {
                field.setAccessible(true);
                if (field.get(reqData) != null && !"".equals(field.get(reqData).toString())) {
                    params.put(field.getName(), field.get(reqData).toString());
                }
            }
        } catch (IllegalAccessException e) {
            logger.error("参数转化异常, 参数:{}", JSON.toJSONString(params));
            e.printStackTrace();
        }
        return params;
    }

 

你还敢乱粘贴吗?

上一篇:SpringCloud Config客户端


下一篇:RuntimeError:stack expects each tensor to be equal size,but got [3,224,244] at entry 0 and [1,224,244] at entry 7