Compare commits
No commits in common. '052fa3f7f4c50d4cd5852e303ea736ffb1f963b2' and 'de5a0c055b1fe0209eacca0dd79f927795b940b5' have entirely different histories.
052fa3f7f4
...
de5a0c055b
@ -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…
Reference in new issue