新增销售出库单表
continuous-integration/drone/push Build is passing Details

沃森川job同步飞书
YXY 1 year ago
parent c215761098
commit ec364dc9bc

@ -21,7 +21,8 @@ public enum TableRelationTypeEnum {
SYNC_CJT_PURCHASE_ARRIVAL_ORDER("SYNC_CJT_PURCHASE_ARRIVAL_ORDER", "同步畅捷通进货单"), SYNC_CJT_PURCHASE_ARRIVAL_ORDER("SYNC_CJT_PURCHASE_ARRIVAL_ORDER", "同步畅捷通进货单"),
SYNC_CJT_PURCHASE_ORDER("SYNC_CJT_PURCHASE_ORDER", "同步畅捷通采购订单"), SYNC_CJT_PURCHASE_ORDER("SYNC_CJT_PURCHASE_ORDER", "同步畅捷通采购订单"),
SYNC_CJT_SALE_DELIVERY("SYNC_CJT_SALE_DELIVERY", "同步畅捷通销货单"), SYNC_CJT_SALE_DELIVERY("SYNC_CJT_SALE_DELIVERY", "同步畅捷通销货单"),
SYNC_CJT_SALE_ORDER("SYNC_CJT_SALE_ORDER", "同步畅捷通销售订单");; SYNC_CJT_SALE_ORDER("SYNC_CJT_SALE_ORDER", "同步畅捷通销售订单"),
SYNC_CJT_SALE_DISPATCH("SYNC_CJT_SALE_DISPATCH", "同步畅捷通销售出库单");
private String code; private String code;
private String info; private String info;

@ -1,6 +1,7 @@
package com.ruoyi.quartz.controller; package com.ruoyi.quartz.controller;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.quartz.task.CJT.SaleOrderSyncJob;
import com.ruoyi.quartz.task.MailSyncTask; import com.ruoyi.quartz.task.MailSyncTask;
import com.ruoyi.quartz.task.MonitorJobTask; import com.ruoyi.quartz.task.MonitorJobTask;
import com.ruoyi.quartz.task.ScheduledRemindersTask; import com.ruoyi.quartz.task.ScheduledRemindersTask;
@ -20,6 +21,8 @@ public class MailInfoController extends BaseController {
private ScheduledRemindersTask scheduledRemindersTask; private ScheduledRemindersTask scheduledRemindersTask;
@Autowired @Autowired
private MonitorJobTask monitorJobTask; private MonitorJobTask monitorJobTask;
@Autowired
private SaleOrderSyncJob saleOrderSyncJob;
@PostMapping("/syncEmail") @PostMapping("/syncEmail")
public void syncEmail(Boolean readFlag) { public void syncEmail(Boolean readFlag) {
@ -28,7 +31,8 @@ public class MailInfoController extends BaseController {
@PostMapping("/scheduledReminders") @PostMapping("/scheduledReminders")
public void scheduledReminders() { public void scheduledReminders() {
monitorJobTask.monitor(); saleOrderSyncJob.executeSync(null);
// monitorJobTask.monitor();
// scheduledRemindersTask.scheduledReminders(); // scheduledRemindersTask.scheduledReminders();
} }

@ -91,7 +91,7 @@ public class CJTRequest implements Serializable {
*/ */
public void buildGenerateBody(){ public void buildGenerateBody(){
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("appTicket",appKey); body.put("appTicket",appTicket);
body.put("certificate",certificate); body.put("certificate",certificate);
this.jsonBody = body; this.jsonBody = body;
} }

@ -1,5 +1,6 @@
package com.ruoyi.quartz.domain; package com.ruoyi.quartz.domain;
import com.alibaba.fastjson.JSONObject;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
@ -14,12 +15,12 @@ public class CJTRequestBody {
private Integer pageIndex; private Integer pageIndex;
private Integer pageSize; private Integer pageSize;
private List<String> selectFields; private List<String> selectFields;
private CJTRequestBodyQueryDetail paramDic; private JSONObject paramDic;
public CJTRequestBody( Integer pageIndex,Integer pageSize, List<String> selectFields,CJTRequestBodyQueryDetail paramDic) { public CJTRequestBody(Integer pageIndex, Integer pageSize, List<String> selectFields, JSONObject paramDic) {
this.pageIndex = pageIndex; this.pageIndex = pageIndex;
this.pageSize = pageSize; this.pageSize = pageSize;
this.selectFields = selectFields; this.selectFields = selectFields;
this.paramDic = paramDic == null ? new CJTRequestBodyQueryDetail() : paramDic; this.paramDic = paramDic == null ? new JSONObject() : paramDic;
} }
} }

@ -88,8 +88,7 @@ public class OkHttpHelper {
,"C661F71361CC4C5636396480FF08BBA4" ,"C661F71361CC4C5636396480FF08BBA4"
,"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ.eyJzdWIiOiJpc3YiLCJpc3MiOiJjaGFuamV0IiwidXNlcklkIjoiNjAwMTI4MzgwNDUiLCJvcmdJZCI6IjkwMDE2MTQ0NjQ2IiwiYWNjZXNzX3Rva2VuIjoiYmstM2VlYmRkNDItOTU3YS00YmM2LTg1YTctYjIyZDQyYTljZTJjIiwiYXVkIjoiaXN2IiwibmJmIjoxNjg5Njg5NjAxLCJhcHBJZCI6IjU4Iiwic2NvcGUiOiJhdXRoX2FsbCIsImlkIjoiNWRhMjFmNjgtZjgyYy00YWY1LTgzZTktYjkyNjY4ODQ2MThjIiwiZXhwIjoxNjkwMjA4MDAxLCJpYXQiOjE2ODk2ODk2MDEsIm9yZ0FjY291bnQiOiJ1Zm42dXBzdGlkdTIifQ.za09y2rXfjChAxPlRRx53l8aYoj-Bv8nrNc2ENeyXMk"); ,"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ.eyJzdWIiOiJpc3YiLCJpc3MiOiJjaGFuamV0IiwidXNlcklkIjoiNjAwMTI4MzgwNDUiLCJvcmdJZCI6IjkwMDE2MTQ0NjQ2IiwiYWNjZXNzX3Rva2VuIjoiYmstM2VlYmRkNDItOTU3YS00YmM2LTg1YTctYjIyZDQyYTljZTJjIiwiYXVkIjoiaXN2IiwibmJmIjoxNjg5Njg5NjAxLCJhcHBJZCI6IjU4Iiwic2NvcGUiOiJhdXRoX2FsbCIsImlkIjoiNWRhMjFmNjgtZjgyYy00YWY1LTgzZTktYjkyNjY4ODQ2MThjIiwiZXhwIjoxNjkwMjA4MDAxLCJpYXQiOjE2ODk2ODk2MDEsIm9yZ0FjY291bnQiOiJ1Zm42dXBzdGlkdTIifQ.za09y2rXfjChAxPlRRx53l8aYoj-Bv8nrNc2ENeyXMk");
List<String> selectFields = Arrays.asList("SaleOrder.ID", "SaleOrder.VoucherDate", "SaleOrder.Code"); List<String> selectFields = Arrays.asList("SaleOrder.ID", "SaleOrder.VoucherDate", "SaleOrder.Code");
CJTRequestBodyQueryDetail cjtRequestBodyQueryDetail = new CJTRequestBodyQueryDetail(); CJTRequestBody cjtRequestBody = new CJTRequestBody(0, 20, selectFields, new JSONObject());
CJTRequestBody cjtRequestBody = new CJTRequestBody(0, 20, selectFields, cjtRequestBodyQueryDetail);
cjtRequest.setBody(cjtRequestBody); cjtRequest.setBody(cjtRequestBody);
String post = post(cjtRequest); String post = post(cjtRequest);
CJTResponseBody cjtResponseBody = JSONObject.parseObject(post, CJTResponseBody.class); CJTResponseBody cjtResponseBody = JSONObject.parseObject(post, CJTResponseBody.class);

@ -1,9 +1,10 @@
package com.ruoyi.quartz.task.CJT; package com.ruoyi.quartz.task.CJT;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.quartz.domain.CJTRequestBodyQueryDetail; import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -30,21 +31,52 @@ public class ManufactureOrderSyncJob extends SyncAccountsJobAbstract{
@Override @Override
protected List<String> getUniqueFields() { protected List<String> getUniqueFields() {
return null; return Arrays.asList(
"Code",
"ManufactureOrderDetails_Inventory_Code");
} }
@Override @Override
protected List<String> getQueryFields() { protected List<String> getQueryFields() {
return null; return Arrays.asList(
"ManufactureOrder.VoucherDate",
"ManufactureOrder.ManufactureOrderDetails.SourceVoucherCode",
"ManufactureOrder.Code",
"", // todo yxy 钢板面
"ManufactureOrder.CreatedTime",
"ManufactureOrder.Department.Name",
"ManufactureOrder.Person",
"ManufactureOrder.ManufactureOrderDetails.Inventory.Code",
"ManufactureOrder.ManufactureOrderDetails.Inventory.Name",
"ManufactureOrder.ManufactureOrderDetails.Inventory.Specification",
"ManufactureOrder.ManufactureOrderDetails.Unit.Name",
"ManufactureOrder.ManufactureOrderDetails.Quantity",
"ManufactureOrder.Memo",
""); // todo yxy 客户
} }
@Override @Override
protected Map<String, String> getQueryFieldsMap() { protected Map<String, String> getQueryFieldsMap() {
return null; Map<String, String> map = new CaseInsensitiveMap<>();
map.put("VoucherDate","单据日期");
map.put("ManufactureOrderDetails_SourceVoucherCode","存货编码");
map.put("Code","存货");
map.put("","钢板面");
map.put("CreatedTime","创建时间");
map.put("Department_Name","生产车间");
map.put("Person","负责人");
map.put("ManufactureOrderDetails_Inventory_Code","产品编码");
map.put("ManufactureOrderDetails_Inventory_Name","产品");
map.put("ManufactureOrderDetails_Inventory_Specification","规格型号");
map.put("ManufactureOrderDetails_Unit_Name","生产单位");
map.put("ManufactureOrderDetails_Quantity","数量");
map.put("Memo","备注1");
map.put("","客户");
return map;
} }
@Override @Override
protected CJTRequestBodyQueryDetail getQueryCondition() { protected String getQueryKey() {
return null; return "ManufactureOrder";
} }
} }

@ -1,9 +1,10 @@
package com.ruoyi.quartz.task.CJT; package com.ruoyi.quartz.task.CJT;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.quartz.domain.CJTRequestBodyQueryDetail; import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -29,21 +30,53 @@ public class PurchaseArrivalOpenSyncJob extends SyncAccountsJobAbstract{
@Override @Override
protected List<String> getUniqueFields() { protected List<String> getUniqueFields() {
return null; return Arrays.asList(
"code",
"Details_Inventory_Code");
} }
@Override @Override
protected List<String> getQueryFields() { protected List<String> getQueryFields() {
return null; return Arrays.asList(
"PurchaseArrival.PurchaseOrderCode",
"PurchaseArrival.Details.Inventory.Code",
"PurchaseArrival.Details.Inventory.Name",
"PurchaseArrival.Details.Inventory.Specification",
"PurchaseArrival.Details.Unit.Name",
"PurchaseArrival.Details.Quantity",
"PurchaseArrival.VoucherDate",
"PurchaseArrival.createdtime",
"PurchaseArrival.Code",
"PurchaseArrival.Partner.Name",
"PurchaseArrival.VoucherState.Name",
"PurchaseArrival.Details.Warehouse.Name",
"",//todo yxy 货位
"PurchaseArrival.Details.SaleOrderCode");
} }
@Override @Override
protected Map<String, String> getQueryFieldsMap() { protected Map<String, String> getQueryFieldsMap() {
return null; Map<String, String> map = new CaseInsensitiveMap<>();
map.put("PurchaseOrderCode","采购订单号");
map.put("Details_Inventory_Code","存货编码");
map.put("Details_Inventory_Name","存货");
map.put("Details_Inventory_Specification","规格型号");
map.put("Details_Unit_Name","采购单位");
map.put("Details_Quantity","数量");
map.put("VoucherDate","单据日期");
map.put("createdtime","创建时间");
map.put("Code","单据编号");
map.put("Partner_Name","供应商");
map.put("VoucherState_Name","单据状态");
map.put("Details_Warehouse_Name","仓库");
map.put("","货位");
map.put("Details_SaleOrderCode","销售订单号");
return map;
} }
@Override @Override
protected CJTRequestBodyQueryDetail getQueryCondition() { protected String getQueryKey() {
return null; return "PurchaseArrival";
} }
} }

@ -1,9 +1,10 @@
package com.ruoyi.quartz.task.CJT; package com.ruoyi.quartz.task.CJT;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.quartz.domain.CJTRequestBodyQueryDetail; import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -29,21 +30,46 @@ public class PurchaseOrderSyncJob extends SyncAccountsJobAbstract{
@Override @Override
protected List<String> getUniqueFields() { protected List<String> getUniqueFields() {
return null; return Arrays.asList(
"code",
"SaleOrderDetails_Inventory_Code");
} }
@Override @Override
protected List<String> getQueryFields() { protected List<String> getQueryFields() {
return null; return Arrays.asList(
"PurchaseOrder.VoucherDate",
"PurchaseOrder.Code",
"PurchaseOrder.Partner.Name",
"PurchaseOrder.PurchaseOrderDetails.Inventory.Code",
"PurchaseOrder.PurchaseOrderDetails.Inventory.Name",
"PurchaseOrder.PurchaseOrderDetails.Inventory.Specification",
"PurchaseOrder.PurchaseOrderDetails.Quantity",
"PurchaseOrder.PurchaseOrderDetails.Unit.Name",
"PurchaseOrder.PurchaseOrderDetails.AcceptDate",
"PurchaseOrder.PurchaseOrderDetails.SaleOrderCode",
"PurchaseOrder.PurchaseOrderDetails.DetailMemo");
} }
@Override @Override
protected Map<String, String> getQueryFieldsMap() { protected Map<String, String> getQueryFieldsMap() {
return null; Map<String, String> map = new CaseInsensitiveMap<>();
map.put("voucherdate","单据日期");
map.put("code","单据编号");
map.put("Partner_Name","供应商");
map.put("PurchaseOrderDetails_Inventory_Code","存货编码");
map.put("PurchaseOrderDetails_Inventory_Name","存货");
map.put("PurchaseOrderDetails_Inventory_Specification","规格型号");
map.put("PurchaseOrderDetails_Quantity","数量");
map.put("PurchaseOrderDetails_Unit_Name","采购单位");
map.put("PurchaseOrderDetails_AcceptDate","预计到货日期");
map.put("PurchaseOrderDetails_SaleOrderCode","销售订单号");
map.put("PurchaseOrderDetails_DetailMemo","明细备注");
return map;
} }
@Override @Override
protected CJTRequestBodyQueryDetail getQueryCondition() { protected String getQueryKey() {
return null; return "PurchaseOrder";
} }
} }

@ -1,9 +1,10 @@
package com.ruoyi.quartz.task.CJT; package com.ruoyi.quartz.task.CJT;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.quartz.domain.CJTRequestBodyQueryDetail; import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -29,21 +30,57 @@ public class SaleDeliverySyncJob extends SyncAccountsJobAbstract{
@Override @Override
protected List<String> getUniqueFields() { protected List<String> getUniqueFields() {
return null; return Arrays.asList(
"code",
"SaleDeliveryDetails_Inventory_Code");
} }
@Override @Override
protected List<String> getQueryFields() { protected List<String> getQueryFields() {
return null; return Arrays.asList(
"SaleDelivery.Code",
"SaleDelivery.Customer.ID",
"SaleDelivery.BusinessType",
"SaleDelivery.CreatedTime",
"SaleDelivery.auditeddate",
"SaleDelivery.VoucherDate",
"",//销售订单号
"SaleDelivery.SaleDeliveryDetails.Inventory.Code",
"SaleDelivery.SaleDeliveryDetails.Inventory.Name",
"SaleDelivery.SaleDeliveryDetails.Inventory.Specification",
"SaleDelivery.pubuserdefnvc1",
"SaleDelivery.SaleDeliveryDetails.Unit.Name",
"SaleDelivery.SaleDeliveryDetails.Quantity",
"SaleDelivery.SaleDeliveryDetails.OrigDiscountAmount",
"SaleDelivery.Memo",
"SaleDelivery.SaleDeliveryDetails.DetailMemo");
} }
@Override @Override
protected Map<String, String> getQueryFieldsMap() { protected Map<String, String> getQueryFieldsMap() {
return null; Map<String, String> map = new CaseInsensitiveMap<>();
map.put("code","单据编号");
map.put("Customer_ID","客户");
map.put("BusinessType","业务类型");
map.put("CreatedTime","创建时间");
map.put("auditeddate","审核时间");
map.put("voucherdate","单据日期");
map.put("","销售订单号"); // todo yxy 销售订单号
map.put("SaleDeliveryDetails_Inventory_Code","存货编码");
map.put("SaleDeliveryDetails_Inventory_Name","存货");
map.put("SaleDeliveryDetails_Inventory_Specification","规格型号");
map.put("SaleDelivery_pubuserdefnvc1","钢板面");
map.put("SaleDeliveryDetails_Unit_Name","销售单位");
map.put("SaleDeliveryDetails_Quantity","数量");
map.put("SaleDeliveryDetails_OrigDiscountAmount","金额");
map.put("Memo","备注1");
map.put("SaleDeliveryDetails_DetailMemo","明细备注");
return map;
} }
@Override @Override
protected CJTRequestBodyQueryDetail getQueryCondition() { protected String getQueryKey() {
return null; return "SaleDelivery";
} }
} }

@ -0,0 +1,84 @@
package com.ruoyi.quartz.task.CJT;
import com.ruoyi.common.enums.TableRelationTypeEnum;
import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
* @author yuxiangyong
* @create 2023-07-17 21:21
*/
@Component("SaleDispatchSyncJob")
public class SaleDispatchSyncJob extends SyncAccountsJobAbstract{
private static final String urlPath = "/tplus/api/v2/SaleDispatchOpenApi/FindVoucherList";
@Override
protected TableRelationTypeEnum syncLarkType() {
return TableRelationTypeEnum.SYNC_CJT_SALE_DISPATCH;
}
@Override
protected String getRequestUrl() {
return REQUEST_ROOT_PATH + urlPath;
}
@Override
protected List<String> getUniqueFields() {
return Arrays.asList(
"Code",
"ManufactureOrderDetails_Inventory_Code");
}
@Override
protected List<String> getQueryFields() {
return Arrays.asList(
"",//todo yxy 来源单号
"RDRecord.VoucherDate",
"RDRecord.Code",
"RDRecord.Partner.Name",
"RDRecord.Partner.Code",
"RDRecord.RDRecordDetails.Inventory.Code",
"RDRecord.RDRecordDetails.Inventory.Name",
"RDRecord.RDRecordDetails.Inventory.Specification",
"RDRecord.RDRecordDetails.Unit.Name",
"RDRecord.RDRecordDetails.Quantity",
"RDRecord.DispatchAddress",
"RDRecord.createdtime",
"RDRecord.Memo",
"RDRecord.RDRecordDetails.OrigSalePrice",
"RDRecord.RDRecordDetails.OrigSaleAmount");
}
@Override
protected Map<String, String> getQueryFieldsMap() {
Map<String, String> map = new CaseInsensitiveMap<>();
map.put("","来源单号");
map.put("VoucherDate","单据日期");
map.put("Code","单据编号");
map.put("Partner_Name","客户");
map.put("Partner_Code","客户编码");
map.put("RDRecordDetails_Inventory_Code","存货编码");
map.put("RDRecordDetails_Inventory_Name","存货");
map.put("RDRecordDetails_Inventory_Specification","规格型号");
map.put("RDRecordDetails_Unit_Name","计量单位");
map.put("RDRecordDetails_Quantity","数量");
map.put("DispatchAddress","送货地址");
map.put("createdtime","创建时间");
map.put("Memo","备注");
map.put("RDRecordDetails_OrigSalePrice","售价");
map.put("RDRecordDetails_OrigSaleAmount","销售金额");
return map;
}
@Override
protected String getQueryKey() {
return "RDRecord";
}
}

@ -1,12 +1,12 @@
package com.ruoyi.quartz.task.CJT; package com.ruoyi.quartz.task.CJT;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.quartz.domain.CJTRequestBodyQueryDetail;
import org.apache.commons.collections4.map.CaseInsensitiveMap; import org.apache.commons.collections4.map.CaseInsensitiveMap;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.*; import java.util.Arrays;
import java.util.List;
import java.util.Map;
/** /**
* *
@ -31,8 +31,8 @@ public class SaleOrderSyncJob extends SyncAccountsJobAbstract{
@Override @Override
protected List<String> getUniqueFields() { protected List<String> getUniqueFields() {
return Arrays.asList( return Arrays.asList(
"SaleOrder.voucherdate", "code",
"SaleOrder.SaleOrderDetails.Inventory.Name"); "SaleOrderDetails_Inventory_Code");
} }
@Override @Override
@ -44,35 +44,42 @@ public class SaleOrderSyncJob extends SyncAccountsJobAbstract{
"SaleOrder.idcustomer", "SaleOrder.idcustomer",
"SaleOrder.auditeddate", "SaleOrder.auditeddate",
"SaleOrder.voucherState", "SaleOrder.voucherState",
"SaleOrder.SaleOrderDetails.Inventory.Code",
"SaleOrder.SaleOrderDetails.Inventory.Name",
"SaleOrder.SaleOrderDetails.Inventory.Specification",
"SaleOrder.SaleOrderDetails.Unit.Name",
"SaleOrder.SaleOrderDetails.Quantity", "SaleOrder.SaleOrderDetails.Quantity",
"SaleOrder.SaleOrderDetails.executedQuantity", "SaleOrder.SaleOrderDetails.executedQuantity",
"SaleOrder.SaleOrderDetails.pubuserdefnvc1", "SaleOrder.SaleOrderDetails.pubuserdefnvc1",
"SaleOrder.SaleOrderDetails.DetailMemo", "SaleOrder.SaleOrderDetails.DetailMemo",
"SaleOrder.memo", "SaleOrder.memo",
"SaleOrder.SaleOrderDetails.origDiscountAmount", "SaleOrder.SaleOrderDetails.origDiscountAmount");
"SaleOrder.SaleOrderDetails.Inventory.Name");
} }
@Override @Override
protected Map<String, String> getQueryFieldsMap() { protected Map<String, String> getQueryFieldsMap() {
Map<String, String> map = new CaseInsensitiveMap<>(); Map<String, String> map = new CaseInsensitiveMap<>();
map.put("voucherdate",""); map.put("voucherdate","单据日期");
map.put("code",""); map.put("code","编号");
map.put("createdtime",""); map.put("createdtime","生单时间");
map.put("idcustomer",""); map.put("idcustomer","客户id");
map.put("auditeddate",""); map.put("auditeddate","审核日期");
map.put("voucherState",""); map.put("voucherState","单据状态");
map.put("SaleOrderDetails_Quantity",""); map.put("SaleOrderDetails_Inventory_Code","存货编码");
map.put("SaleOrderDetails_executedQuantity",""); map.put("SaleOrderDetails_Inventory_Name","存货");
map.put("SaleOrderDetails_pubuserdefnvc1",""); map.put("SaleOrderDetails_Inventory_Specification","规格型号");
map.put("SaleOrderDetails_DetailMemo",""); map.put("SaleOrderDetails_Unit_Name","销售单位");
map.put("memo",""); map.put("SaleOrderDetails_Quantity","数量");
map.put("SaleOrderDetails_origDiscountAmount",""); map.put("SaleOrderDetails_executedQuantity","累计执行数量");
map.put("SaleOrderDetails_pubuserdefnvc1","钢板面");
map.put("SaleOrderDetails_DetailMemo","明细备注");
map.put("memo","备注1");
map.put("SaleOrderDetails_origDiscountAmount","金额");
return map; return map;
} }
@Override @Override
protected CJTRequestBodyQueryDetail getQueryCondition() { protected String getQueryKey() {
return null; return "SaleOrder";
} }
} }

@ -7,6 +7,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.AppType; import com.ruoyi.common.enums.AppType;
import com.ruoyi.common.enums.FlagStatus; import com.ruoyi.common.enums.FlagStatus;
import com.ruoyi.common.enums.TableRelationTypeEnum; import com.ruoyi.common.enums.TableRelationTypeEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper; import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
import com.ruoyi.flyingbook.domain.ErpLarkRelation; import com.ruoyi.flyingbook.domain.ErpLarkRelation;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation; import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -117,7 +119,23 @@ public abstract class SyncAccountsJobAbstract {
/** /**
* *
*/ */
protected abstract CJTRequestBodyQueryDetail getQueryCondition(); protected abstract String getQueryKey();
protected JSONObject getQueryCondition(){
JSONObject jsonObject = new JSONObject();
LocalDateTime now = LocalDateTime.now();
String startTime = DateUtils.ldt2str(now, DateUtils.YYYY_MM_DD_HH_MM_SS);
String endTime = DateUtils.ldt2str(now.minusMinutes(2L), DateUtils.YYYY_MM_DD_HH_MM_SS);
Map<String, String> startTimeMap = new HashMap<>();
startTimeMap.put("text",startTime);
startTimeMap.put("value",startTime);
Map<String, String> endTimeMap = new HashMap<>();
endTimeMap.put("text",endTime);
endTimeMap.put("value",endTime);
List<Map<String, String>> timeRange = Arrays.asList(startTimeMap, endTimeMap);
String queryKey = String.format("%s.AuditedTime",getQueryKey());
jsonObject.put(queryKey,timeRange);
return jsonObject;
}
/** /**
* *
@ -209,7 +227,7 @@ public abstract class SyncAccountsJobAbstract {
//组成唯一键的集合 //组成唯一键的集合
List<String> uniqueFields = getUniqueFields(); List<String> uniqueFields = getUniqueFields();
//错误唯一键 //错误唯一键
List<String> errorKey = getUniqueFields(); List<String> errorKey = new ArrayList<>();
for (List<String> row : rows) { for (List<String> row : rows) {
String uniqueKey = null; String uniqueKey = null;
try { try {
@ -218,7 +236,7 @@ public abstract class SyncAccountsJobAbstract {
for (int i = 0; i < row.size(); i++) { for (int i = 0; i < row.size(); i++) {
String larkLabel = queryFieldsMap.get(keyList.get(i)); String larkLabel = queryFieldsMap.get(keyList.get(i));
String value = row.get(i); String value = row.get(i);
if (uniqueFields.contains(value)){ if (uniqueFields.contains(keyList.get(i))){
uniqueKeyList.add(value); uniqueKeyList.add(value);
} }
body.put(larkLabel,value); body.put(larkLabel,value);
@ -264,16 +282,18 @@ public abstract class SyncAccountsJobAbstract {
* ticket, * ticket,
*/ */
private void resetTicket(CJTJobContext context) { private void resetTicket(CJTJobContext context) {
Long expireTime = redisCache.getExpireTime(RedisConstants.CJT_TICKET_CACHE_KEY); // Long expireTime = redisCache.getExpireTime(RedisConstants.CJT_TICKET_CACHE_KEY);
//重置ticket存在响应时间提前十秒重置 // //重置ticket存在响应时间提前十秒重置
if (expireTime == null || expireTime < 10) { // if (expireTime == null || expireTime < 10) {
CJTRequest cjtRequest = new CJTRequest(REQUEST_RESET_TICKET_PATH // CJTRequest cjtRequest = new CJTRequest(REQUEST_RESET_TICKET_PATH
, context.getAppKey() // , context.getAppKey()
, context.getAppSecret()); // , context.getAppSecret());
post(cjtRequest); // post(cjtRequest);
} // }
String ticket = (String) redisCache.getCacheObject(RedisConstants.CJT_TICKET_CACHE_KEY); // String ticket = (String) redisCache.getCacheObject(RedisConstants.CJT_TICKET_CACHE_KEY);
context.setTicket(ticket); // context.setTicket(ticket);
//todo yxy 记得改回来
context.setTicket("t-e6deb85dfce3430ba1b230a9c0e2cc2d");
} }
/** /**

Loading…
Cancel
Save