odoo job对接

沃森川job同步飞书
YXY 1 year ago
parent 39a910eb1f
commit 992149a1aa

@ -2,9 +2,11 @@ package com.ruoyi.quartz.task.odoo;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -28,20 +30,29 @@ public class AccountMoveLineJob extends OdooAbstrackob {
return "account.move.line"; return "account.move.line";
} }
@Override
public void execute() {
super.execute();
}
@Override @Override
protected List getQueryConditionList() { protected List getQueryConditionList() {
String date = DateUtils.ldt2str(LocalDateTime.now(), DateUtils.YYYY_MM_DD);
return Arrays.asList(Arrays.asList( return Arrays.asList(Arrays.asList(
Arrays.asList("parent_state", "=", "posted"), Arrays.asList("parent_state", "=", "posted")
Arrays.asList("account_id", "=", 1018) , Arrays.asList("account_id", "=", 1018)
// asList("Date", ">", 2022-01-01) // ,Arrays.asList("Date", ">", 2023-07-27)
)); ));
} }
@Override @Override
protected Map<String, List<String>> getQueryFieldMap() { 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"));
// }};
return new HashMap() {{ return new HashMap() {{
put("fields", Arrays.asList("id","partner_id.name", "date", "product_id.default_code" put("fields", Arrays.asList("id", "date", "quantity"));
, "quantity", "unit_price", "company_id.display_name","product_id.categ_id.name"));
}}; }};
} }

@ -28,6 +28,11 @@ public class ProductPackingJob extends OdooAbstrackob {
return "product.packaging"; return "product.packaging";
} }
@Override
public void execute() {
super.execute();
}
@Override @Override
protected List getQueryConditionList() { protected List getQueryConditionList() {
return Arrays.asList( return Arrays.asList(

@ -28,6 +28,11 @@ public class ProductProductJob extends OdooAbstrackob {
return "product.product"; return "product.product";
} }
@Override
public void execute() {
super.execute();
}
@Override @Override
protected List getQueryConditionList() { protected List getQueryConditionList() {
return Arrays.asList( return Arrays.asList(

@ -28,6 +28,11 @@ public class ProductShukikuJob extends OdooAbstrackob {
return "product.product.shukiku"; return "product.product.shukiku";
} }
@Override
public void execute() {
super.execute();
}
@Override @Override
protected List getQueryConditionList() { protected List getQueryConditionList() {
return Arrays.asList( return Arrays.asList(

@ -20,19 +20,25 @@ public class StockQuantJob extends OdooAbstrackob {
@Override @Override
protected String buildUniqueKey(JSONObject body) { protected String buildUniqueKey(JSONObject body) {
return body.getString("default_code"); return body.getString("id");
} }
@Override @Override
protected String getQueryModelName() { protected String getQueryModelName() {
return "stock_quant"; return "product.product";
}
@Override
public void execute() {
super.execute();
} }
@Override @Override
protected List getQueryConditionList() { protected List getQueryConditionList() {
return Arrays.asList( return Arrays.asList(
Arrays.asList( Arrays.asList(
Arrays.asList("active", "=", true) Arrays.asList("active", "=", true),
Arrays.asList("company_id", "in", Arrays.asList(1, 3, 5))
) )
); );
} }
@ -40,17 +46,18 @@ public class StockQuantJob extends OdooAbstrackob {
@Override @Override
protected Map<String, List<String>> getQueryFieldMap() { protected Map<String, List<String>> getQueryFieldMap() {
return new HashMap() {{ return new HashMap() {{
put("fields", Arrays.asList("default code", "FOFO stock", "incoming", "forsince stock")); put("fields", Arrays.asList("free_qty","incoming_qty","virtual_available", "company_id", "id"));
}}; }};
} }
@Override @Override
protected Map<String, Object> buildLarkBodyMap(JSONObject date) { protected Map<String, Object> buildLarkBodyMap(JSONObject date) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("default code",date.getString("default code")); map.put("free_qty", date.getString("free_qty"));
map.put("FOFO stock",date.getString("FOFO stock")); map.put("incoming_qty", date.getString("incoming_qty"));
map.put("incoming",date.getString("incoming")); map.put("virtual_available", date.getString("virtual_available"));
map.put("forsince stock",date.getString("forsince stock")); map.put("company_id", date.getString("company_id"));
map.put("id", date.getString("id"));
return map; return map;
} }

Loading…
Cancel
Save