1、阿里获取单据
parent
c95a5cf291
commit
b0d5378f43
@ -0,0 +1,12 @@
|
||||
package com.glxp.api.req.alihealth.local;
|
||||
|
||||
import com.glxp.api.req.alihealth.AlihealthYljgListupoutDetailReqeust;
|
||||
import com.glxp.api.req.alihealth.AlihealthYljgListupoutReqeust;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlihealthYljgLocalListupoutDetailReqeust {
|
||||
private String appSecret;
|
||||
|
||||
private AlihealthYljgListupoutDetailReqeust alihealthYljgListupoutDetailReqeust;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.glxp.api.req.alihealth.local;
|
||||
|
||||
import com.glxp.api.req.alihealth.AlihealthYljgListupoutReqeust;
|
||||
import com.glxp.api.req.alihealth.AlihealthYljgUploadinoutbillReqeust;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlihealthYljgLocalListupoutReqeust {
|
||||
private String erpName;
|
||||
private String appSecret;
|
||||
|
||||
private AlihealthYljgListupoutReqeust alihealthYljgListupoutReqeust;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.glxp.api.util.alihealth;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class CopyUtils {
|
||||
public static void compatibleCopy(Map<String,Object> map, Object target) {
|
||||
try {
|
||||
|
||||
Class targetClass = target.getClass();//得到对象的Class
|
||||
Field[] targetFields = targetClass.getDeclaredFields();//得到Class对象的所有属性
|
||||
Set keySet =map.keySet(); //获取到所有值
|
||||
for(Object key : keySet ) {
|
||||
Object value = map.get(key);
|
||||
|
||||
|
||||
for (Field targetField : targetFields) {
|
||||
targetField.setAccessible(true);
|
||||
|
||||
String targetName = targetField.getName();//目标对象的属性名
|
||||
System.out.println("1 "+targetName.equals(snakeToCamel((String) key)) +"targetName "+ targetName +"targetName "+ snakeToCamel((String) key ));
|
||||
System.out.println("2 "+key);
|
||||
|
||||
if (targetName.equals(snakeToCamel((String) key)) && !Objects.isNull(value)) {
|
||||
targetField.set(target, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("错误==="+e);
|
||||
|
||||
e.printStackTrace();
|
||||
// BeanUtil.copyProperties(source, target);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public static String snakeToCamel(String snakeCase) {
|
||||
// 将字符串按下划线分割
|
||||
String[] parts = snakeCase.split("_");
|
||||
|
||||
StringBuilder camelCase = new StringBuilder();
|
||||
|
||||
for (String part : parts) {
|
||||
if (camelCase.length() == 0) {
|
||||
// 第一个单词首字母小写
|
||||
camelCase.append(part.toLowerCase());
|
||||
} else {
|
||||
// 其他单词首字母大写
|
||||
camelCase.append(part.substring(0, 1).toUpperCase())
|
||||
.append(part.substring(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
return camelCase.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue