Compare commits

..

No commits in common. '052fa3f7f4c50d4cd5852e303ea736ffb1f963b2' and 'de5a0c055b1fe0209eacca0dd79f927795b940b5' have entirely different histories.

@ -9,17 +9,6 @@ public enum CjtCallBackOperateEnum {
/**
*
*/
PURCHASE_ARRIVAL_ORDER_CREATE("PuArrival_Create", "新增进货单",AppType.SYNC_CJT_PURCHASE_ARRIVAL_ORDER_DATA_TO_MULTI_TABLE.getCode()),
PURCHASE_ARRIVAL_ORDER_UPDATE("PuArrival_Update", "修改进货单",AppType.SYNC_CJT_PURCHASE_ARRIVAL_ORDER_DATA_TO_MULTI_TABLE.getCode()),
PURCHASE_ARRIVAL_ORDER_DELETE("PuArrival_Delete", "删除进货单",AppType.SYNC_CJT_PURCHASE_ARRIVAL_ORDER_DATA_TO_MULTI_TABLE.getCode()),
PURCHASE_ORDER_CREATE("PurchaseOrder_Create", "新增采购订单",AppType.SYNC_CJT_PURCHASE_ORDER_DATA_TO_MULTI_TABLE.getCode()),
PURCHASE_ORDER_UPDATE("PurchaseOrder_Update", "修改采购订单",AppType.SYNC_CJT_PURCHASE_ORDER_DATA_TO_MULTI_TABLE.getCode()),
PURCHASE_ORDER_DELETE("PurchaseOrder_Delete", "删除采购订单",AppType.SYNC_CJT_PURCHASE_ORDER_DATA_TO_MULTI_TABLE.getCode()),
SALE_DELIVERY_CREATE("SaleDelivery_Create", "新增销货单",AppType.SYNC_CJT_SALE_DELIVERY_DATA_TO_MULTI_TABLE.getCode()),
SALE_DELIVERY_UPDATE("SaleDelivery_Create", "修改销货单",AppType.SYNC_CJT_SALE_DELIVERY_DATA_TO_MULTI_TABLE.getCode()),
SALE_DELIVERY_DELETE("SaleDelivery_Create", "删除销货单",AppType.SYNC_CJT_SALE_DELIVERY_DATA_TO_MULTI_TABLE.getCode()),
SALE_DISPATCH_CREATE("SaleDispatchVoucher_Create", "新增销售出库单",AppType.SYNC_CJT_SALE_DISPATCH_DATA_TO_MULTI_TABLE.getCode()),
SALE_DISPATCH_UPDATE("SaleDispatchVoucher_Update", "修改销售出库单",AppType.SYNC_CJT_SALE_DISPATCH_DATA_TO_MULTI_TABLE.getCode()),
SALE_DISPATCH_DELETE("SaleDispatchVoucher_Delete", "删除销售出库单",AppType.SYNC_CJT_SALE_DISPATCH_DATA_TO_MULTI_TABLE.getCode()),

@ -100,7 +100,7 @@ public abstract class CJTOperateCallBackAbstract {
erpLarkTempRelation.setCreateTime(date);
erpLarkTempRelation.setUpdateTime(date);
JSONObject body = req.getBody();
if (body != null) {
if (body != null){
erpLarkTempRelation.setRemark(body.toJSONString());
}
erpLarkTempRelation.setFlag(FlagStatus.OK.getCode());
@ -124,7 +124,7 @@ public abstract class CJTOperateCallBackAbstract {
CjtAccountEnum cjtAccountEnum = req.getCjtAccountEnum();
String msgType = req.getMsgType();
JSONObject jsonObject = null;
if (!msgType.contains("Delete")) {
if (!msgType.contains("Delete")){
LarkCJTRequestBody cjtRequestBody = new LarkCJTRequestBody(req.getVoucherId());
LarkCJTRequest cjtRequest = new LarkCJTRequest(getRequestUrl(), cjtAccountEnum.getAppKey(), cjtAccountEnum.getAppSecret(), generateToken(req), cjtRequestBody);
LarkOkHttpHelper.post(cjtRequest);
@ -206,12 +206,6 @@ public abstract class CJTOperateCallBackAbstract {
protected void addRecord(CJTEdiCallbackRequestVo req, JSONObject header) {
//获取已经存在的明细
List<ErpLarkRelation> existRecords = getExistRecords(req);
//如果存在相同的记录,则跳过插入步骤
if (CollectionUtils.isNotEmpty(existRecords)) {
return;
}
//多维表格id
String toTableId = req.getLarkToTableId();
//明细信息

@ -1,117 +0,0 @@
package com.ruoyi.flyingbook.strategy.cjt;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.CjtAccountEnum;
import com.ruoyi.common.enums.CjtCallBackOperateEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.flyingbook.domain.edi.CJTEdiCallbackRequestVo;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author yuxiangyong
* @create 2023-07-17 21:21
*/
@Component("purchaseArrivalOrderCallBackOperate")
public class PurchaseArrivalOrderCallBackOperate extends CJTOperateCallBackAbstract{
@Override
protected void syncRecord(CJTEdiCallbackRequestVo req, JSONObject returnBody) {
CjtCallBackOperateEnum msgTypeEnum = req.getMsgTypeEnum();
switch (msgTypeEnum) {
case PURCHASE_ARRIVAL_ORDER_CREATE:
addRecord(req, returnBody);
break;
case PURCHASE_ARRIVAL_ORDER_UPDATE:
updateRecord(req,returnBody);
break;
case PURCHASE_ARRIVAL_ORDER_DELETE:
deleteRecord(req);
break;
default:
break;
}
}
@Override
protected String buildUniqueKey(String toTableId, JSONObject header, JSONObject detail,CjtAccountEnum cjtAccountEnum) {
StringBuilder sb = new StringBuilder();
if (cjtAccountEnum.getCode().equals(CjtAccountEnum.TWO.getCode())){
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory == null) {
sb.append("null").append("_");
} else {
sb.append(inventory.get("Code")).append("_");
}
sb.append(header.get("Code")).append("_");
sb.append(detail.get("DetailMemo"));
}else {
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory == null) {
sb.append("null").append("_");
} else {
sb.append(inventory.get("Code")).append("_");
}
sb.append(detail.get("Quantity")).append("_");
sb.append(header.get("Code")).append("_");
sb.append(detail.get("DetailMemo"));
}
return sb.toString();
}
@Override
protected Map<String, Object> buildLarkBody(JSONObject header, JSONObject detail, CjtAccountEnum cjtAccountEnum) {
Map<String, Object> body = new HashMap<>();
body.put("采购订单号", header.getString("PurchaseOrderCode"));
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory != null){
body.put("存货编码", inventory.getString("Code"));
body.put("存货", inventory.getString("Name"));
body.put("规格型号", inventory.getString("Specification"));
}
JSONObject unit = detail.getJSONObject("Unit");
if (unit != null){
body.put("采购单位", unit.getString("Name"));
}
body.put("数量", detail.getDoubleValue("Quantity"));
body.put("单据日期", DateUtils.str2long(header.getString("VoucherDate"), DateUtils.YYYY_MM_DD));
body.put("创建时间", System.currentTimeMillis());
body.put("单据编号", header.getString("Code"));
JSONObject partner = header.getJSONObject("Partner");
if (partner != null){
body.put("供应商", partner.getString("Name"));
}
JSONObject voucherState = header.getJSONObject("VoucherState");
if (voucherState != null){
body.put("单据状态", voucherState.getString("Name"));
}
JSONObject warehouse = detail.getJSONObject("Warehouse");
if (warehouse != null){
body.put("仓库", warehouse.getString("Name"));
}
body.put("明细备注", detail.getString("DetailMemo"));
return body;
}
@Override
protected String getRequestUrl() {
return REQUEST_ROOT_PATH + "/tplus/api/v2/PurchaseArrivalOpenApi/GetVoucherDTO";
}
@Override
protected String getMethodUrl() {
return REQUEST_ROOT_PATH + "/tplus/api/v2/PurchaseArrivalOpenApi/FindVoucherList";
}
@Override
protected String getDetailName() {
return "PurchaseOrderDetails";
}
}

@ -1,99 +0,0 @@
package com.ruoyi.flyingbook.strategy.cjt;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.CjtAccountEnum;
import com.ruoyi.common.enums.CjtCallBackOperateEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.flyingbook.domain.edi.CJTEdiCallbackRequestVo;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author yuxiangyong
* @create 2023-07-17 21:21
*/
@Component("purchaseOrderSyncCallBackOperate")
public class PurchaseOrderSyncCallBackOperate extends CJTOperateCallBackAbstract{
@Override
protected void syncRecord(CJTEdiCallbackRequestVo req, JSONObject returnBody) {
CjtCallBackOperateEnum msgTypeEnum = req.getMsgTypeEnum();
switch (msgTypeEnum) {
case PURCHASE_ORDER_CREATE:
addRecord(req, returnBody);
break;
case PURCHASE_ORDER_UPDATE:
updateRecord(req,returnBody);
break;
case PURCHASE_ORDER_DELETE:
deleteRecord(req);
break;
default:
break;
}
}
@Override
protected String buildUniqueKey(String toTableId, JSONObject header, JSONObject detail, CjtAccountEnum cjtAccountEnum) {
StringBuilder sb = new StringBuilder();
sb.append(header.get("Code")).append("_");
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory == null) {
sb.append("null").append("_");
} else {
sb.append(inventory.get("Code")).append("_");
}
sb.append(detail.get("DetailMemo"));
return sb.toString();
}
@Override
protected Map<String, Object> buildLarkBody(JSONObject header, JSONObject detail, CjtAccountEnum cjtAccountEnum) {
Map<String, Object> body = new HashMap<>();
body.put("单据日期", DateUtils.str2long(header.getString("VoucherDate"), DateUtils.YYYY_MM_DD));
body.put("单据编号", header.getString("Code"));
JSONObject partner = header.getJSONObject("Partner");
if (partner != null){
body.put("供应商", partner.getString("Name"));
}
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory != null){
body.put("存货编码", inventory.getString("Code"));
body.put("存货", inventory.getString("Name"));
body.put("规格型号", inventory.getString("Specification"));
}
body.put("数量", detail.getDoubleValue("Quantity"));
JSONObject unit = detail.getJSONObject("Unit");
if (unit != null){
body.put("采购单位", unit.getString("Name"));
}
//todo yxy 这里日期格式待定
body.put("预计到货日期", DateUtils.str2long(detail.getString("AcceptDate"), DateUtils.YYYY_MM_DD));
body.put("销售订单号", detail.getString("SaleOrderCode"));
body.put("明细备注", detail.getString("DetailMemo"));
return body;
}
@Override
protected String getRequestUrl() {
return REQUEST_ROOT_PATH + "/tplus/api/v2/PurchaseOrderOpenApi/GetVoucherDTO";
}
@Override
protected String getMethodUrl() {
return REQUEST_ROOT_PATH + "/tplus/api/v2/PurchaseOrderOpenApi/FindVoucherList";
}
@Override
protected String getDetailName() {
return "PurchaseOrderDetails";
}
}

@ -1,135 +0,0 @@
package com.ruoyi.flyingbook.strategy.cjt;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.enums.CjtAccountEnum;
import com.ruoyi.common.enums.CjtCallBackOperateEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.flyingbook.domain.edi.CJTEdiCallbackRequestVo;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author yuxiangyong
* @create 2023-07-17 21:21
*/
@Component("saleDeliverySyncCallBackOperate")
public class SaleDeliverySyncCallBackOperate extends CJTOperateCallBackAbstract {
@Override
protected void syncRecord(CJTEdiCallbackRequestVo req, JSONObject returnBody) {
CjtCallBackOperateEnum msgTypeEnum = req.getMsgTypeEnum();
switch (msgTypeEnum) {
case SALE_DELIVERY_CREATE:
addRecord(req, returnBody);
break;
case SALE_DELIVERY_UPDATE:
updateRecord(req,returnBody);
break;
case SALE_DELIVERY_DELETE:
deleteRecord(req);
break;
default:
break;
}
}
@Override
protected String buildUniqueKey(String toTableId, JSONObject header, JSONObject detail,CjtAccountEnum cjtAccountEnum) {
StringBuilder sb = new StringBuilder();
if (cjtAccountEnum.getCode().equals(CjtAccountEnum.TWO.getCode())){
sb.append(header.get("Code")).append("_");
sb.append(detail.get("SaleOrderCode")).append("_");
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory == null) {
sb.append("null").append("_");
} else {
sb.append(inventory.get("Code")).append("_");
}
sb.append(detail.get("Quantity")).append("_");
sb.append(header.get("Memo")).append("_");
sb.append(detail.get("DetailMemo"));
}else {
sb.append(header.get("Code")).append("_");
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory == null) {
sb.append("null").append("_");
} else {
sb.append(inventory.get("Code")).append("_");
}
sb.append(detail.get("Quantity")).append("_");
sb.append(detail.get("DetailMemo"));
}
return sb.toString();
}
@Override
protected Map<String, Object> buildLarkBody(JSONObject header, JSONObject detail, CjtAccountEnum cjtAccountEnum) {
Map<String, Object> body = new HashMap<>();
body.put("单据编号", header.getString("Code"));
JSONObject customer = header.getJSONObject("Customer");
if (customer != null){
body.put("客户", customer.getString("Name"));
}
JSONObject businessType = header.getJSONObject("BusinessType");
if (businessType != null){
body.put("业务类型", businessType.getString("Name"));
}
body.put("创建时间", System.currentTimeMillis());
body.put("审核时间", DateUtils.str2long(header.getString("AuditedDate"), DateUtils.YYYY_MM_DD));
body.put("单据日期", DateUtils.str2long(header.getString("VoucherDate"), DateUtils.YYYY_MM_DD));
body.put("销售订单号", detail.getString("SaleOrderCode"));
JSONObject inventory = detail.getJSONObject("Inventory");
if (inventory != null){
body.put("存货编码", inventory.getString("Code"));
body.put("存货", inventory.getString("Name"));
body.put("规格型号", inventory.getString("Specification"));
}
body.put("钢板面", getSpecialKey(detail, "pubuserdefnvc1"));
JSONObject unit = detail.getJSONObject("Unit");
if (unit != null){
body.put("销售单位", unit.getString("Name"));
}
body.put("数量", detail.getDoubleValue("Quantity"));
body.put("金额", detail.getDoubleValue("OrigDiscountAmount"));
body.put("备注1", header.getString("Memo"));
body.put("明细备注", detail.getString("DetailMemo"));
switch (cjtAccountEnum) {
case ONE:
break;
case TWO:
JSONObject warehouse = detail.getJSONObject("Warehouse");
if (warehouse != null){
body.put("仓库", warehouse.getString("Name"));
}
break;
}
return body;
}
@Override
protected String getRequestUrl() {
return REQUEST_ROOT_PATH + "/tplus/api/v2/SaleDeliveryOpenApi/GetVoucherDTO";
}
@Override
protected String getMethodUrl() {
return REQUEST_ROOT_PATH + "/tplus/api/v2/SaleDeliveryOpenApi/FindVoucherList";
}
@Override
protected String getDetailName() {
return "SaleDeliveryDetails";
}
}
Loading…
Cancel
Save