飞书字段类型映射

沃森川job同步飞书
YXY 1 year ago
parent 03c76eb2fe
commit f2b2fd53f2

@ -23,7 +23,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY_MM = "yyyy-MM"; public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd"; public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYY_MM_DD_SECOND = "yyyy/MM/dd"; public static String YYYY_MM_DD_SECOND = "yyyy/MM/dd HH:mm";
public static String YYYYMM = "yyyyMM"; public static String YYYYMM = "yyyyMM";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";

@ -2,6 +2,7 @@ package com.ruoyi.quartz.task.CJT;
import com.lark.oapi.service.bitable.v1.enums.AppTableCreateHeaderTypeEnum; import com.lark.oapi.service.bitable.v1.enums.AppTableCreateHeaderTypeEnum;
import com.lark.oapi.service.bitable.v1.model.AppTableCreateHeader; import com.lark.oapi.service.bitable.v1.model.AppTableCreateHeader;
import com.lark.oapi.service.bitable.v1.model.AppTableFieldProperty;
import com.lark.oapi.service.bitable.v1.model.CreateAppRespBody; import com.lark.oapi.service.bitable.v1.model.CreateAppRespBody;
import com.lark.oapi.service.bitable.v1.model.CreateAppTableRespBody; import com.lark.oapi.service.bitable.v1.model.CreateAppTableRespBody;
import com.ruoyi.common.enums.AppType; import com.ruoyi.common.enums.AppType;
@ -112,7 +113,7 @@ public class CJTCreateLarkTableJob{
buildHeader("产品", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("产品", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("生产单位", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("生产单位", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("备注1", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("备注1", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("客户", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("客户", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("合并字段", AppTableCreateHeaderTypeEnum.TEXT) buildHeader("合并字段", AppTableCreateHeaderTypeEnum.TEXT)
@ -124,9 +125,9 @@ public class CJTCreateLarkTableJob{
buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("采购单位", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("采购单位", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("单据日期", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据日期", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("创建时间", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("创建时间", AppTableCreateHeaderTypeEnum.DATETIME,buildProperty(DateUtils.YYYY_MM_DD_SECOND)),
buildHeader("单据编号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据编号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("供应商", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("供应商", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("单据状态", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据状态", AppTableCreateHeaderTypeEnum.TEXT),
@ -142,7 +143,7 @@ public class CJTCreateLarkTableJob{
buildHeader("存货编码", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("存货编码", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("采购单位", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("采购单位", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("预计到货日期", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("预计到货日期", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("销售订单号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("销售订单号", AppTableCreateHeaderTypeEnum.TEXT),
@ -153,7 +154,7 @@ public class CJTCreateLarkTableJob{
buildHeader("单据编号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据编号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("客户", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("客户", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("业务类型", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("业务类型", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("创建时间", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("创建时间", AppTableCreateHeaderTypeEnum.DATETIME,buildProperty(DateUtils.YYYY_MM_DD_SECOND)),
buildHeader("审核时间", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("审核时间", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("单据日期", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据日期", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("销售订单号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("销售订单号", AppTableCreateHeaderTypeEnum.TEXT),
@ -162,8 +163,8 @@ public class CJTCreateLarkTableJob{
buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("钢板面", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("钢板面", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("销售单位", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("销售单位", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("金额", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("金额", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0.00")),
buildHeader("备注1", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("备注1", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("明细备注", AppTableCreateHeaderTypeEnum.TEXT) buildHeader("明细备注", AppTableCreateHeaderTypeEnum.TEXT)
}; };
@ -171,7 +172,7 @@ public class CJTCreateLarkTableJob{
return new AppTableCreateHeader[]{ return new AppTableCreateHeader[]{
buildHeader("单据日期", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据日期", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("编号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("编号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("生单时间", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("生单时间", AppTableCreateHeaderTypeEnum.DATETIME,buildProperty(DateUtils.YYYY_MM_DD_SECOND)),
buildHeader("客户id", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("客户id", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("审核日期", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("审核日期", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("单据状态", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("单据状态", AppTableCreateHeaderTypeEnum.TEXT),
@ -179,12 +180,12 @@ public class CJTCreateLarkTableJob{
buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("销售单位", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("销售单位", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("累计执行数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("累计执行数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("钢板面", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("钢板面", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("明细备注", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("明细备注", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("备注1", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("备注1", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("金额", AppTableCreateHeaderTypeEnum.TEXT) buildPropertyHeader("金额", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0.00"))
}; };
case SYNC_CJT_SALE_DISPATCH_DATA_TO_MULTI_TABLE: case SYNC_CJT_SALE_DISPATCH_DATA_TO_MULTI_TABLE:
return new AppTableCreateHeader[]{ return new AppTableCreateHeader[]{
@ -197,12 +198,12 @@ public class CJTCreateLarkTableJob{
buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("存货", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("规格型号", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("计量单位", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("计量单位", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("数量", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("数量", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0")),
buildHeader("送货地址", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("送货地址", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("创建时间", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("创建时间", AppTableCreateHeaderTypeEnum.DATETIME,buildProperty(DateUtils.YYYY_MM_DD_SECOND)),
buildHeader("备注", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("备注", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("售价", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("售价", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0.00")),
buildHeader("销售金额", AppTableCreateHeaderTypeEnum.TEXT), buildPropertyHeader("销售金额", AppTableCreateHeaderTypeEnum.NUMBER,buildProperty("0.00")),
buildHeader("客服", AppTableCreateHeaderTypeEnum.TEXT), buildHeader("客服", AppTableCreateHeaderTypeEnum.TEXT),
buildHeader("配送路线", AppTableCreateHeaderTypeEnum.TEXT) buildHeader("配送路线", AppTableCreateHeaderTypeEnum.TEXT)
}; };
@ -211,6 +212,18 @@ public class CJTCreateLarkTableJob{
} }
} }
private AppTableFieldProperty buildProperty(String formatter){
AppTableFieldProperty.Builder property = AppTableFieldProperty.newBuilder();
if (DateUtils.YYYY_MM_DD_SECOND.equals(formatter)) {
property.autoFill(Boolean.FALSE);
property.dateFormatter(formatter);
}else {
property.formatter(formatter);
}
return property.build();
}
private AppTableCreateHeader buildHeader(String fieldName, AppTableCreateHeaderTypeEnum type){ private AppTableCreateHeader buildHeader(String fieldName, AppTableCreateHeaderTypeEnum type){
AppTableCreateHeader.Builder builder = new AppTableCreateHeader.Builder(); AppTableCreateHeader.Builder builder = new AppTableCreateHeader.Builder();
builder.fieldName(fieldName) builder.fieldName(fieldName)
@ -218,6 +231,14 @@ public class CJTCreateLarkTableJob{
return new AppTableCreateHeader(builder); return new AppTableCreateHeader(builder);
} }
private AppTableCreateHeader buildPropertyHeader(String fieldName, AppTableCreateHeaderTypeEnum type,AppTableFieldProperty property){
AppTableCreateHeader.Builder builder = new AppTableCreateHeader.Builder();
builder.fieldName(fieldName)
.type(type)
.property(property);
return new AppTableCreateHeader(builder);
}
private LarkCompanyRelation getCompanyRelation(AppType appType){ private LarkCompanyRelation getCompanyRelation(AppType appType){
LarkCompanyRelation companyRelationQuery = new LarkCompanyRelation(); LarkCompanyRelation companyRelationQuery = new LarkCompanyRelation();
companyRelationQuery.setAppType(appType.getCode()); companyRelationQuery.setAppType(appType.getCode());

@ -262,6 +262,10 @@ public abstract class SyncAccountsJobAbstract {
private Object changeValueType(String value,CJTSyncTypeRelation cjtSyncTypeRelation){ private Object changeValueType(String value,CJTSyncTypeRelation cjtSyncTypeRelation){
TableFieldTypeEnum type = cjtSyncTypeRelation.getType(); TableFieldTypeEnum type = cjtSyncTypeRelation.getType();
if (org.apache.commons.lang3.StringUtils.isBlank(value) || type == null){
return value;
}
switch (type){ switch (type){
case NUMBER: case NUMBER:
return Double.valueOf(value); return Double.valueOf(value);

Loading…
Cancel
Save