同步odoo的其他四个
continuous-integration/drone/push Build is passing Details

沃森川job同步飞书
YXY 1 year ago
parent da9898d95c
commit aefa5f47f9

@ -26,7 +26,7 @@ public enum TableRelationTypeEnum {
SYNC_ODOO_ACCOUNT_MOVE_LINE("SYNC_ODOO_ACCOUNT_MOVE_LINE", "每天晚上7点后更新"), SYNC_ODOO_ACCOUNT_MOVE_LINE("SYNC_ODOO_ACCOUNT_MOVE_LINE", "每天晚上7点后更新"),
SYNC_ODOO_PRODUCT_PRODUCT("SYNC_ODOO_PRODUCT_PRODUCT", "周日一更"), SYNC_ODOO_PRODUCT_PRODUCT("SYNC_ODOO_PRODUCT_PRODUCT", "周日一更"),
SYNC_ODOO_PRODUCT_PACKING("SYNC_ODOO_PRODUCT_PACKING", "周日一更"), SYNC_ODOO_PRODUCT_PACKING("SYNC_ODOO_PRODUCT_PACKING", "周日一更"),
SYNC_ODOO_PRODUCT_PRODUCT1("SYNC_ODOO_PRODUCT_PRODUCT1", "周日一更"), SYNC_ODOO_PRODUCT_SHUKIKU("SYNC_ODOO_PRODUCT_SHUKIKU", "周日一更"),
SYNC_ODOO_STOCK_QUANT("SYNC_ODOO_STOCK_QUANT", "每天晚上7点后更新"); SYNC_ODOO_STOCK_QUANT("SYNC_ODOO_STOCK_QUANT", "每天晚上7点后更新");
private String code; private String code;

@ -0,0 +1,66 @@
package com.ruoyi.quartz.task.odoo;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.TableRelationTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author yuxiangyong
* @create 2023-07-23 18:18
*/
@Slf4j
@Component("accountMoveLineJob")
public class AccountMoveLineJob extends OdooAbstrackob {
@Override
protected String buildUniqueKey(JSONObject body) {
return body.getString("id");
}
@Override
protected String getQueryModelName() {
return "account.move.line";
}
@Override
protected List getQueryConditionList() {
return Arrays.asList(Arrays.asList(
Arrays.asList("parent_state", "=", "posted"),
Arrays.asList("account_id", "=", 1018)
// asList("Date", ">", 2022-01-01)
));
}
@Override
protected Map<String, List<String>> getQueryFieldMap() {
return new HashMap() {{
put("fields", Arrays.asList("id","partner_id.name", "date", "product_id.default_code"
, "quantity", "unit_price", "company_id.display_name","product_id.categ_id.name"));
}};
}
@Override
protected Map<String, Object> buildLarkBodyMap(JSONObject date) {
Map<String, Object> map = new HashMap<>();
map.put("id",date.getString("id"));
map.put("partner_id.name",date.getString("partner_id.name"));
map.put("date",date.getString("date"));
map.put("product_id.default_code",date.getString("product_id.default_code"));
map.put("quantity",date.getString("quantity"));
map.put("unit_price",date.getString("unit_price"));
map.put("company_id.display_name",date.getString("company_id.display_name"));
map.put("product_id,categ_id.name",date.getString("product_id.categ_id.name"));
return map;
}
@Override
protected TableRelationTypeEnum syncLarkType() {
return TableRelationTypeEnum.SYNC_ODOO_ACCOUNT_MOVE_LINE;
}
}

@ -57,7 +57,7 @@ public abstract class OdooAbstrackob {
public static final String ACCOUNT_MOVE_LINE_MODEL_NAME = "account.move.line"; public static final String ACCOUNT_MOVE_LINE_MODEL_NAME = "account.move.line";
public static final String PRODUCT_PRODUCT_MODEL_NAME = "product.product"; public static final String PRODUCT_PRODUCT_MODEL_NAME = "product.product";
public static final String PRODUCT_PACKING_MODEL_NAME = "product_packaging"; public static final String PRODUCT_PACKING_MODEL_NAME = "product_packaging";
public static final String PRODUCT_PRODUCT_MODEL_NAME2 = "product_product"; public static final String PRODUCT_PRODUCT_SHUKIKU_MODEL_NAME = "product.product.shukiku";
public static final String STOCK_QUANT_MODEL_NAME = "stock_quant"; public static final String STOCK_QUANT_MODEL_NAME = "stock_quant";
private static final String GET_DATA_DB = "Fortune_test0716"; private static final String GET_DATA_DB = "Fortune_test0716";

@ -0,0 +1,60 @@
package com.ruoyi.quartz.task.odoo;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.TableRelationTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author yuxiangyong
* @create 2023-07-23 18:18
*/
@Slf4j
@Component("productPackingJob")
public class ProductPackingJob extends OdooAbstrackob {
@Override
protected String buildUniqueKey(JSONObject body) {
return body.getString("id");
}
@Override
protected String getQueryModelName() {
return "product.packaging";
}
@Override
protected List getQueryConditionList() {
return Arrays.asList(
Arrays.asList(
Arrays.asList("active", "=", true)
)
);
}
@Override
protected Map<String, List<String>> getQueryFieldMap() {
return new HashMap() {{
put("fields", Arrays.asList("id", "name", "qty"));
}};
}
@Override
protected Map<String, Object> buildLarkBodyMap(JSONObject date) {
Map<String, Object> map = new HashMap<>();
map.put("id",date.getString("id"));
map.put("name",date.getString("name"));
map.put("qty",date.getString("qty"));
return map;
}
@Override
protected TableRelationTypeEnum syncLarkType() {
return TableRelationTypeEnum.SYNC_ODOO_PRODUCT_PACKING;
}
}

@ -16,7 +16,7 @@ import java.util.Map;
*/ */
@Slf4j @Slf4j
@Component("productProduceJob") @Component("productProduceJob")
public class ProductProduceJob extends OdooAbstrackob { public class ProductProductJob extends OdooAbstrackob {
@Override @Override
protected String buildUniqueKey(JSONObject body) { protected String buildUniqueKey(JSONObject body) {
@ -39,15 +39,9 @@ public class ProductProduceJob extends OdooAbstrackob {
@Override @Override
protected Map<String, List<String>> getQueryFieldMap() { protected Map<String, List<String>> getQueryFieldMap() {
// return new HashMap() {{
// put("fields", Arrays.asList(
// "id", "default_code", "name"
// ,"description_purchase", "qty_available", "incoming_qty"
// ,"cost", "categ_id.name", "packaging_ids"));
// }};
return new HashMap() {{ return new HashMap() {{
put("fields", Arrays.asList("id","default_code", "name", "description_purchase" put("fields", Arrays.asList("id","default_code", "name", "description_purchase"
, "qty_available", "incoming_qty", "packaging_ids")); , "qty_available", "incoming_qty","cost","categ_id.name", "packaging_ids"));
}}; }};
} }
@ -68,6 +62,6 @@ public class ProductProduceJob extends OdooAbstrackob {
@Override @Override
protected TableRelationTypeEnum syncLarkType() { protected TableRelationTypeEnum syncLarkType() {
return TableRelationTypeEnum.SYNC_ODOO_PRODUCT_PRODUCT; return TableRelationTypeEnum.SYNC_ODOO_ACCOUNT_MOVE_LINE;
} }
} }

@ -0,0 +1,70 @@
package com.ruoyi.quartz.task.odoo;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.TableRelationTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author yuxiangyong
* @create 2023-07-23 18:18
*/
@Slf4j
@Component("productShukikuJob")
public class ProductShukikuJob extends OdooAbstrackob {
@Override
protected String buildUniqueKey(JSONObject body) {
return body.getString("id");
}
@Override
protected String getQueryModelName() {
return "product.product.shukiku";
}
@Override
protected List getQueryConditionList() {
return Arrays.asList(
Arrays.asList(
Arrays.asList("active", "=", true)
),
Arrays.asList(
Arrays.asList("x_company_id.name","ilike","Shukiku Thailand")
)
);
}
@Override
protected Map<String, List<String>> getQueryFieldMap() {
return new HashMap() {{
put("fields", Arrays.asList("id","default_code", "name", "description_purchase"
, "qty_available", "incoming_qty","cost","categ_id.name", "packaging_ids"));
}};
}
@Override
protected Map<String, Object> buildLarkBodyMap(JSONObject date) {
Map<String, Object> map = new HashMap<>();
map.put("id",date.getString("id"));
map.put("default_code",date.getString("default_code"));
map.put("name",date.getString("name"));
map.put("description_purchase",date.getString("description_purchase"));
map.put("qty_available",date.getString("qty_available"));
map.put("incoming_qty",date.getString("incoming_qty"));
map.put("cost",date.getString("cost"));
map.put("categ_id.name",date.getString("categ_id.name"));
map.put("packaging_ids",date.getString("packaging_ids"));
return map;
}
@Override
protected TableRelationTypeEnum syncLarkType() {
return TableRelationTypeEnum.SYNC_ODOO_PRODUCT_SHUKIKU;
}
}

@ -0,0 +1,61 @@
package com.ruoyi.quartz.task.odoo;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.TableRelationTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author yuxiangyong
* @create 2023-07-23 18:18
*/
@Slf4j
@Component("stockQuantJob")
public class StockQuantJob extends OdooAbstrackob {
@Override
protected String buildUniqueKey(JSONObject body) {
return body.getString("default_code");
}
@Override
protected String getQueryModelName() {
return "stock_quant";
}
@Override
protected List getQueryConditionList() {
return Arrays.asList(
Arrays.asList(
Arrays.asList("active", "=", true)
)
);
}
@Override
protected Map<String, List<String>> getQueryFieldMap() {
return new HashMap() {{
put("fields", Arrays.asList("default code", "FOFO stock", "incoming", "forsince stock"));
}};
}
@Override
protected Map<String, Object> buildLarkBodyMap(JSONObject date) {
Map<String, Object> map = new HashMap<>();
map.put("default code",date.getString("default code"));
map.put("FOFO stock",date.getString("FOFO stock"));
map.put("incoming",date.getString("incoming"));
map.put("forsince stock",date.getString("forsince stock"));
return map;
}
@Override
protected TableRelationTypeEnum syncLarkType() {
return TableRelationTypeEnum.SYNC_ODOO_STOCK_QUANT;
}
}
Loading…
Cancel
Save